Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-29062009...
[qt-netbsd.git] / src / 3rdparty / webkit / WebCore / wml / WMLFieldSetElement.cpp
blobc0b4bc59eb190e834f009f1811b590c2265046c0
1 /**
2 * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
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.
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.
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.
21 #include "config.h"
23 #if ENABLE(WML)
24 #include "WMLFieldSetElement.h"
26 #include "HTMLNames.h"
27 #include "MappedAttribute.h"
28 #include "RenderFieldset.h"
29 #include "Text.h"
30 #include "WMLElementFactory.h"
31 #include "WMLNames.h"
33 namespace WebCore {
35 using namespace WMLNames;
37 WMLFieldSetElement::WMLFieldSetElement(const QualifiedName& tagName, Document* doc)
38 : WMLElement(tagName, doc)
42 WMLFieldSetElement::~WMLFieldSetElement()
46 void WMLFieldSetElement::insertedIntoDocument()
48 WMLElement::insertedIntoDocument();
50 String title = parseValueSubstitutingVariableReferences(getAttribute(HTMLNames::titleAttr));
51 if (title.isEmpty())
52 return;
54 m_insertedLegendElement = WMLElementFactory::createWMLElement(insertedLegendTag, document());
56 // Insert <dummyLegend> element, as RenderFieldset expect it to be present
57 // to layout it's child text content, when rendering <fieldset> elements
58 ExceptionCode ec = 0;
59 appendChild(m_insertedLegendElement, ec);
60 ASSERT(ec == 0);
62 // Create text node holding the 'title' attribute value
63 m_insertedLegendElement->appendChild(document()->createTextNode(title), ec);
64 ASSERT(ec == 0);
67 void WMLFieldSetElement::removedFromDocument()
69 WMLElement::removedFromDocument();
70 m_insertedLegendElement.clear();
73 RenderObject* WMLFieldSetElement::createRenderer(RenderArena* arena, RenderStyle*)
75 return new (arena) RenderFieldset(this);
80 #endif