• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public License
15  * along with this library; see the file COPYING.LIB.  If not, write to
16  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  *
19  */
20 
21 #include "config.h"
22 
23 #if ENABLE(WML)
24 #include "WMLNoopElement.h"
25 
26 #include "WMLDoElement.h"
27 #include "WMLErrorHandling.h"
28 #include "WMLNames.h"
29 
30 namespace WebCore {
31 
32 using namespace WMLNames;
33 
WMLNoopElement(const QualifiedName & tagName,Document * doc)34 WMLNoopElement::WMLNoopElement(const QualifiedName& tagName, Document* doc)
35     : WMLElement(tagName, doc)
36 {
37 }
38 
create(const QualifiedName & tagName,Document * document)39 PassRefPtr<WMLNoopElement> WMLNoopElement::create(const QualifiedName& tagName, Document* document)
40 {
41     return adoptRef(new WMLNoopElement(tagName, document));
42 }
43 
~WMLNoopElement()44 WMLNoopElement::~WMLNoopElement()
45 {
46 }
47 
insertedIntoDocument()48 void WMLNoopElement::insertedIntoDocument()
49 {
50     WMLElement::insertedIntoDocument();
51 
52     ContainerNode* parent = parentNode();
53     if (!parent || !parent->isWMLElement())
54         return;
55 
56     if (parent->hasTagName(doTag)) {
57         WMLDoElement* doElement = static_cast<WMLDoElement*>(parent);
58         doElement->setNoop(true);
59 
60         if (doElement->attached())
61             doElement->detach();
62 
63         ASSERT(!doElement->attached());
64         doElement->attach();
65     } else if (parent->hasTagName(anchorTag))
66         reportWMLError(document(), WMLErrorForbiddenTaskInAnchorElement);
67 }
68 
69 }
70 
71 #endif
72