summaryrefslogtreecommitdiff
path: root/Source/WebCore/html/LabelableElement.cpp
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
committerSimon Hausmann <simon.hausmann@nokia.com>2012-03-12 14:11:15 +0100
commitdd91e772430dc294e3bf478c119ef8d43c0a3358 (patch)
tree6f33ce4d5872a5691e0291eb45bf6ab373a5f567 /Source/WebCore/html/LabelableElement.cpp
parentad0d549d4cc13433f77c1ac8f0ab379c83d93f28 (diff)
downloadqtwebkit-dd91e772430dc294e3bf478c119ef8d43c0a3358.tar.gz
Imported WebKit commit 3db4eb1820ac8fb03065d7ea73a4d9db1e8fea1a (http://svn.webkit.org/repository/webkit/trunk@110422)
This includes build fixes for the latest qtbase/qtdeclarative as well as the final QML2 API.
Diffstat (limited to 'Source/WebCore/html/LabelableElement.cpp')
-rw-r--r--Source/WebCore/html/LabelableElement.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/Source/WebCore/html/LabelableElement.cpp b/Source/WebCore/html/LabelableElement.cpp
new file mode 100644
index 000000000..45b41b0eb
--- /dev/null
+++ b/Source/WebCore/html/LabelableElement.cpp
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
+ * (C) 1999 Antti Koivisto (koivisto@kde.org)
+ * (C) 2001 Dirk Mueller (mueller@kde.org)
+ * Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
+ * (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public License
+ * along with this library; see the file COPYING.LIB. If not, write to
+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "config.h"
+#include "LabelableElement.h"
+
+#include "ElementRareData.h"
+#include "LabelsNodeList.h"
+#include "RenderStyle.h"
+
+namespace WebCore {
+
+LabelableElement::LabelableElement(const QualifiedName& tagName, Document* document)
+ : HTMLElement(tagName, document)
+{
+}
+
+LabelableElement::~LabelableElement()
+{
+}
+
+PassRefPtr<NodeList> LabelableElement::labels()
+{
+ if (!isLabelable())
+ return 0;
+ if (!document())
+ return 0;
+
+ NodeListsNodeData* nodeLists = Node::ensureRareData()->ensureNodeLists(this);
+ if (nodeLists->m_labelsNodeListCache)
+ return nodeLists->m_labelsNodeListCache;
+
+ RefPtr<LabelsNodeList> list = LabelsNodeList::create(this);
+ nodeLists->m_labelsNodeListCache = list.get();
+ return list.release();
+}
+
+} // namespace Webcore