[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373
ap at apple.com
ap at apple.com
Thu Apr 8 01:13:41 UTC 2010
The following commit has been merged in the webkit-1.2 branch:
commit 38221c6511e0e94c0ec080025f2df5473ee9d510
Author: ap at apple.com <ap at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 18 22:05:55 2010 +0000
Reviewed by Darin Adler.
https://bugs.webkit.org/show_bug.cgi?id=33787
Add constants for more XML strings
No change in functionality, so no tests.
* WebCore/xml/xmlnsattrs.in: Added a new file for xmlns namespace and attribute -
XMLNames.{h,cpp} are auto-generated, and I dodn't see a reasonable way to extend it.
* platform/text/AtomicString.cpp: (WebCore::AtomicString::init):
* platform/text/AtomicString.h:
Added atomic strings for "xml" and "xmlns".
* page/Frame.cpp: (WebCore::Frame::Frame): Call XMLNSNames::init().
* dom/Attr.cpp: (WebCore::Attr::setPrefix):
* dom/Document.cpp:
(WebCore::Document::hasPrefixNamespaceMismatch):
(WebCore::Document::createAttributeNS):
* dom/Node.cpp:
(WebCore::Node::checkSetPrefix):
(WebCore::Node::isDefaultNamespace):
(WebCore::Node::lookupNamespaceURI):
(WebCore::Node::lookupNamespacePrefix):
* dom/XMLTokenizerLibxml2.cpp:
(WebCore::XMLTokenizer::XMLTokenizer):
(WebCore::handleElementNamespaces):
* editing/markup.cpp:
(WebCore::shouldAddNamespaceAttr):
(WebCore::appendNamespace):
* xml/XPathStep.cpp:
(WebCore::XPath::nodeMatchesBasicTest):
(WebCore::XPath::Step::nodesInAxis):
Use the new constants.
* Android.derived.mk:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gyp/WebCore.gyp:
* WebCore.pri:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* WebCoreSources.bkl:
Added the new files to projects.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/Android.derived.mk b/WebCore/Android.derived.mk
index c0afe81..c678e60 100644
--- a/WebCore/Android.derived.mk
+++ b/WebCore/Android.derived.mk
@@ -130,6 +130,14 @@ $(intermediates)/css/UserAgentStyleSheets.cpp : $(GEN)
# XML attribute names
+GEN:= $(intermediates)/XMLNSNames.cpp
+$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
+$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xmlns_attrs) --output $(dir $@)
+$(GEN): xmlns_attrs := $(LOCAL_PATH)/xml/xmlnsattrs.in
+$(GEN): $(LOCAL_PATH)/dom/make_names.pl $(xmlns_attrs)
+ $(transform-generated-source)
+LOCAL_GENERATED_SOURCES += $(GEN)
+
GEN:= $(intermediates)/XMLNames.cpp
$(GEN): PRIVATE_PATH := $(LOCAL_PATH)
$(GEN): PRIVATE_CUSTOM_TOOL = perl -I $(PRIVATE_PATH)/bindings/scripts $< --attrs $(xml_attrs) --output $(dir $@)
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index b187283..43272ae 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,51 @@
+2010-01-18 Alexey Proskuryakov <ap at apple.com>
+
+ Reviewed by Darin Adler.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33787
+ Add constants for more XML strings
+
+ No change in functionality, so no tests.
+
+ * WebCore/xml/xmlnsattrs.in: Added a new file for xmlns namespace and attribute -
+ XMLNames.{h,cpp} are auto-generated, and I dodn't see a reasonable way to extend it.
+
+ * platform/text/AtomicString.cpp: (WebCore::AtomicString::init):
+ * platform/text/AtomicString.h:
+ Added atomic strings for "xml" and "xmlns".
+
+ * page/Frame.cpp: (WebCore::Frame::Frame): Call XMLNSNames::init().
+
+ * dom/Attr.cpp: (WebCore::Attr::setPrefix):
+ * dom/Document.cpp:
+ (WebCore::Document::hasPrefixNamespaceMismatch):
+ (WebCore::Document::createAttributeNS):
+ * dom/Node.cpp:
+ (WebCore::Node::checkSetPrefix):
+ (WebCore::Node::isDefaultNamespace):
+ (WebCore::Node::lookupNamespaceURI):
+ (WebCore::Node::lookupNamespacePrefix):
+ * dom/XMLTokenizerLibxml2.cpp:
+ (WebCore::XMLTokenizer::XMLTokenizer):
+ (WebCore::handleElementNamespaces):
+ * editing/markup.cpp:
+ (WebCore::shouldAddNamespaceAttr):
+ (WebCore::appendNamespace):
+ * xml/XPathStep.cpp:
+ (WebCore::XPath::nodeMatchesBasicTest):
+ (WebCore::XPath::Step::nodesInAxis):
+ Use the new constants.
+
+ * Android.derived.mk:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.pri:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * WebCoreSources.bkl:
+ Added the new files to projects.
+
2010-01-18 Anders Carlsson <andersca at apple.com>
Fix !ENABLE(3D_CANVAS) build.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index d8dc976..c269b96 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -450,6 +450,7 @@ all : \
SVGNames.cpp \
UserAgentStyleSheets.h \
XLinkNames.cpp \
+ XMLNSNames.cpp \
XMLNames.cpp \
MathMLElementFactory.cpp \
MathMLNames.cpp \
@@ -636,6 +637,9 @@ endif
JSHTMLElementWrapperFactory.cpp : HTMLNames.cpp
+XMLNSNames.cpp : dom/make_names.pl xml/xmlnsattrs.in
+ perl -I $(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlnsattrs.in
+
XMLNames.cpp : dom/make_names.pl xml/xmlattrs.in
perl -I $(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 0090ddd..a10b89a 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -87,6 +87,7 @@ webcore_built_sources += \
DerivedSources/JSHTMLElementWrapperFactory.cpp \
DerivedSources/UserAgentStyleSheets.h \
DerivedSources/UserAgentStyleSheetsData.cpp \
+ DerivedSources/XMLNSNames.cpp \
DerivedSources/XMLNames.cpp
IDL_BINDINGS += \
@@ -3497,6 +3498,9 @@ endif # HTML_FLAGS
DerivedSources/JSHTMLElementWrapperFactory.cpp: DerivedSources/HTMLNames.cpp;
+DerivedSources/XMLNSNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlnsattrs.in
+ $(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlnsattrs.in --outputDir "$(GENSOURCES)"
+
DerivedSources/XMLNames.cpp: $(WebCore)/dom/make_names.pl $(WebCore)/xml/xmlattrs.in
$(AM_V_GEN)$(PERL) -I$(WebCore)/bindings/scripts $< --attrs $(WebCore)/xml/xmlattrs.in --outputDir "$(GENSOURCES)"
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index 5483e75..184990a 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -391,6 +391,26 @@
],
},
{
+ 'action_name': 'XMLNSNames',
+ 'inputs': [
+ '../dom/make_names.pl',
+ '../xml/xmlnsattrs.in',
+ ],
+ 'outputs': [
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.cpp',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.h',
+ ],
+ 'action': [
+ 'python',
+ 'scripts/action_makenames.py',
+ '<@(_outputs)',
+ '--',
+ '<@(_inputs)',
+ '--',
+ '--extraDefines', '<(feature_defines)'
+ ],
+ },
+ {
'action_name': 'XMLNames',
'inputs': [
'../dom/make_names.pl',
@@ -567,6 +587,7 @@
'<(SHARED_INTERMEDIATE_DIR)/webkit/SVGNames.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/UserAgentStyleSheetsData.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/XLinkNames.cpp',
+ '<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNSNames.cpp',
'<(SHARED_INTERMEDIATE_DIR)/webkit/XMLNames.cpp',
# Additional .cpp files from the webcore_bindings_sources rules.
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index 104cc32..562bac2 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -620,6 +620,12 @@ htmlnames.wkExtraSources = $${WC_GENERATED_SOURCES_DIR}/HTMLElementFactory.cpp $
addExtraCompiler(htmlnames)
# GENERATOR 5-B:
+xmlnsnames.output = $${WC_GENERATED_SOURCES_DIR}/XMLNSNames.cpp
+xmlnsnames.input = XMLNS_NAMES
+xmlnsnames.commands = perl -I$$PWD/bindings/scripts $$PWD/dom/make_names.pl --attrs $$PWD/xml/xmlnsattrs.in --preprocessor \"$${QMAKE_MOC} -E\" --outputDir $$WC_GENERATED_SOURCES_DIR
+addExtraCompiler(xmlnsnames)
+
+# GENERATOR 5-C:
xmlnames.output = $${WC_GENERATED_SOURCES_DIR}/XMLNames.cpp
xmlnames.input = XML_NAMES
xmlnames.commands = perl -I$$PWD/bindings/scripts $$PWD/dom/make_names.pl --attrs $$PWD/xml/xmlattrs.in --preprocessor \"$${QMAKE_MOC} -E\" --outputDir $$WC_GENERATED_SOURCES_DIR
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 338e88e..41d77a7 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -19397,6 +19397,14 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\XMLNSNames.cpp"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\XMLNSNames.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\XMLNames.cpp"
>
</File>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 9ae4c31..81a3369 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4670,6 +4670,8 @@
E1284BD61044A01E00EAEB52 /* DOMPageTransitionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = E1284BD41044A01E00EAEB52 /* DOMPageTransitionEvent.h */; };
E12EDB7B0B308A78002704B6 /* EventTarget.h in Headers */ = {isa = PBXBuildFile; fileRef = E12EDB7A0B308A78002704B6 /* EventTarget.h */; settings = {ATTRIBUTES = (Private, ); }; };
E12EDBEA0B308E0B002704B6 /* EventTarget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E12EDBE90B308E0B002704B6 /* EventTarget.cpp */; };
+ E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */ = {isa = PBXBuildFile; fileRef = E15A36D61104572000B7B639 /* XMLNSNames.h */; };
+ E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E15A36D81104572700B7B639 /* XMLNSNames.cpp */; };
E17A4A1B0D97991D00FC10C6 /* DOMSVGAltGlyphElement.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAC0D974A00000541AE /* DOMSVGAltGlyphElement.h */; };
E17A4A1C0D97991D00FC10C6 /* DOMSVGAltGlyphElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 65AA6BAE0D974A00000541AE /* DOMSVGAltGlyphElementInternal.h */; };
E182568F0EF2B02D00933242 /* JSWorkerContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */; };
@@ -9901,6 +9903,8 @@
E1284BD41044A01E00EAEB52 /* DOMPageTransitionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMPageTransitionEvent.h; sourceTree = "<group>"; };
E12EDB7A0B308A78002704B6 /* EventTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventTarget.h; sourceTree = "<group>"; };
E12EDBE90B308E0B002704B6 /* EventTarget.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventTarget.cpp; sourceTree = "<group>"; };
+ E15A36D61104572000B7B639 /* XMLNSNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = XMLNSNames.h; sourceTree = "<group>"; };
+ E15A36D81104572700B7B639 /* XMLNSNames.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XMLNSNames.cpp; sourceTree = "<group>"; };
E182568D0EF2B02D00933242 /* JSWorkerContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContext.cpp; sourceTree = "<group>"; };
E182568E0EF2B02D00933242 /* JSWorkerContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWorkerContext.h; sourceTree = "<group>"; };
E18258AB0EF3CD7000933242 /* JSWorkerContextCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWorkerContextCustom.cpp; sourceTree = "<group>"; };
@@ -11148,6 +11152,8 @@
4CA3AB480E556F2400E9C0C0 /* WMLNames.h */,
656581EA09D1508D000E61D7 /* XLinkNames.cpp */,
656581EB09D1508D000E61D7 /* XLinkNames.h */,
+ E15A36D81104572700B7B639 /* XMLNSNames.cpp */,
+ E15A36D61104572000B7B639 /* XMLNSNames.h */,
A833C80A0A2CF25600D57664 /* XMLNames.cpp */,
A833C80B0A2CF25600D57664 /* XMLNames.h */,
1A7629D30A07425100989F5B /* XPathGrammar.cpp */,
@@ -18350,6 +18356,7 @@
6E4E91AD10F7FB3100A2779C /* CanvasContextAttributes.h in Headers */,
6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */,
6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */,
+ E15A36D71104572000B7B639 /* XMLNSNames.h in Headers */,
59A9E7B21104759400DFB4C1 /* JavaInstanceJSC.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -20514,6 +20521,7 @@
6E4E91AC10F7FB3100A2779C /* CanvasContextAttributes.cpp in Sources */,
6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */,
6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */,
+ E15A36D91104572700B7B639 /* XMLNSNames.cpp in Sources */,
59A9E7B01104758800DFB4C1 /* JavaInstanceJSC.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
diff --git a/WebCore/WebCoreSources.bkl b/WebCore/WebCoreSources.bkl
index 87ac07e..ee20282 100644
--- a/WebCore/WebCoreSources.bkl
+++ b/WebCore/WebCoreSources.bkl
@@ -435,6 +435,7 @@ This file contains the list of files needed to build WebCore.
DerivedSources/WebCore/JSXSLTProcessor.cpp
DerivedSources/WebCore/UserAgentStyleSheetsData.cpp
DerivedSources/WebCore/XLinkNames.cpp
+ DerivedSources/WebCore/XMLNSNames.cpp
DerivedSources/WebCore/XMLNames.cpp
DerivedSources/WebCore/XPathGrammar.cpp
</set>
diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp
index a782756..2ef5f9b 100644
--- a/WebCore/dom/Attr.cpp
+++ b/WebCore/dom/Attr.cpp
@@ -27,6 +27,7 @@
#include "Element.h"
#include "ExceptionCode.h"
#include "Text.h"
+#include "XMLNSNames.h"
namespace WebCore {
@@ -102,8 +103,8 @@ void Attr::setPrefix(const AtomicString& prefix, ExceptionCode& ec)
if (ec)
return;
- if ((prefix == "xmlns" && namespaceURI() != "http://www.w3.org/2000/xmlns/")
- || static_cast<Attr*>(this)->qualifiedName() == "xmlns") {
+ if ((prefix == xmlnsAtom && namespaceURI() != XMLNSNames::xmlnsNamespaceURI)
+ || static_cast<Attr*>(this)->qualifiedName() == xmlnsAtom) {
ec = NAMESPACE_ERR;
return;
}
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 0cf7611..4dd6e45 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -128,6 +128,7 @@
#include "WebKitTransitionEvent.h"
#include "WheelEvent.h"
#include "XMLHttpRequest.h"
+#include "XMLNSNames.h"
#include "XMLNames.h"
#include "XMLTokenizer.h"
#include "htmlediting.h"
@@ -790,21 +791,17 @@ PassRefPtr<Node> Document::adoptNode(PassRefPtr<Node> source, ExceptionCode& ec)
bool Document::hasPrefixNamespaceMismatch(const QualifiedName& qName)
{
- DEFINE_STATIC_LOCAL(const AtomicString, xmlnsNamespaceURI, ("http://www.w3.org/2000/xmlns/"));
- DEFINE_STATIC_LOCAL(const AtomicString, xmlns, ("xmlns"));
- DEFINE_STATIC_LOCAL(const AtomicString, xml, ("xml"));
-
// These checks are from DOM Core Level 2, createElementNS
// http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrElNS
if (!qName.prefix().isEmpty() && qName.namespaceURI().isNull()) // createElementNS(null, "html:div")
return true;
- if (qName.prefix() == xml && qName.namespaceURI() != XMLNames::xmlNamespaceURI) // createElementNS("http://www.example.com", "xml:lang")
+ if (qName.prefix() == xmlAtom && qName.namespaceURI() != XMLNames::xmlNamespaceURI) // createElementNS("http://www.example.com", "xml:lang")
return true;
// Required by DOM Level 3 Core and unspecified by DOM Level 2 Core:
// http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#ID-DocCrElNS
// createElementNS("http://www.w3.org/2000/xmlns/", "foo:bar"), createElementNS(null, "xmlns:bar")
- if ((qName.prefix() == xmlns && qName.namespaceURI() != xmlnsNamespaceURI) || (qName.prefix() != xmlns && qName.namespaceURI() == xmlnsNamespaceURI))
+ if ((qName.prefix() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) || (qName.prefix() != xmlnsAtom && qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI))
return true;
return false;
@@ -4040,7 +4037,7 @@ PassRefPtr<Attr> Document::createAttributeNS(const String& namespaceURI, const S
}
// Spec: DOM Level 2 Core: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-DocCrAttrNS
- if (!shouldIgnoreNamespaceChecks && qName.localName() == "xmlns" && qName.namespaceURI() != "http://www.w3.org/2000/xmlns/") {
+ if (!shouldIgnoreNamespaceChecks && qName.localName() == xmlnsAtom && qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI) {
ec = NAMESPACE_ERR;
return 0;
}
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index 4a47dbc..1ec0604 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -1056,7 +1056,7 @@ void Node::checkSetPrefix(const AtomicString& prefix, ExceptionCode& ec)
const AtomicString& nodeNamespaceURI = namespaceURI();
if ((nodeNamespaceURI.isEmpty() && !prefix.isEmpty())
- || (prefix == "xml" && nodeNamespaceURI != XMLNames::xmlNamespaceURI)) {
+ || (prefix == xmlAtom && nodeNamespaceURI != XMLNames::xmlNamespaceURI)) {
ec = NAMESPACE_ERR;
return;
}
@@ -1779,7 +1779,7 @@ bool Node::isDefaultNamespace(const AtomicString& namespaceURIMaybeEmpty) const
for (unsigned i = 0; i < attrs->length(); i++) {
Attribute* attr = attrs->attributeItem(i);
- if (attr->localName() == "xmlns")
+ if (attr->localName() == xmlnsAtom)
return attr->value() == namespaceURI;
}
}
@@ -1865,12 +1865,12 @@ String Node::lookupNamespaceURI(const String &prefix) const
for (unsigned i = 0; i < attrs->length(); i++) {
Attribute *attr = attrs->attributeItem(i);
- if (attr->prefix() == "xmlns" && attr->localName() == prefix) {
+ if (attr->prefix() == xmlnsAtom && attr->localName() == prefix) {
if (!attr->value().isEmpty())
return attr->value();
return String();
- } else if (attr->localName() == "xmlns" && prefix.isNull()) {
+ } else if (attr->localName() == xmlnsAtom && prefix.isNull()) {
if (!attr->value().isEmpty())
return attr->value();
@@ -1920,7 +1920,7 @@ String Node::lookupNamespacePrefix(const AtomicString &_namespaceURI, const Elem
for (unsigned i = 0; i < attrs->length(); i++) {
Attribute *attr = attrs->attributeItem(i);
- if (attr->prefix() == "xmlns" &&
+ if (attr->prefix() == xmlnsAtom &&
attr->value() == _namespaceURI &&
originalElement->lookupNamespaceURI(attr->localName()) == _namespaceURI)
return attr->localName();
diff --git a/WebCore/dom/XMLTokenizerLibxml2.cpp b/WebCore/dom/XMLTokenizerLibxml2.cpp
index 21bdfb0..cac88d4 100644
--- a/WebCore/dom/XMLTokenizerLibxml2.cpp
+++ b/WebCore/dom/XMLTokenizerLibxml2.cpp
@@ -51,6 +51,7 @@
#include "ScriptValue.h"
#include "TextResourceDecoder.h"
#include "TransformSource.h"
+#include "XMLNSNames.h"
#include "XMLTokenizerScope.h"
#include <libxml/parser.h>
#include <libxml/parserInternals.h>
@@ -596,9 +597,9 @@ XMLTokenizer::XMLTokenizer(DocumentFragment* fragment, Element* parentElement)
if (NamedNodeMap* attrs = element->attributes()) {
for (unsigned i = 0; i < attrs->length(); i++) {
Attribute* attr = attrs->attributeItem(i);
- if (attr->localName() == "xmlns")
+ if (attr->localName() == xmlnsAtom)
m_defaultNamespaceURI = attr->value();
- else if (attr->prefix() == "xmlns")
+ else if (attr->prefix() == xmlnsAtom)
m_prefixToNamespaceMap.set(attr->localName(), attr->value());
}
}
@@ -678,11 +679,11 @@ static inline void handleElementNamespaces(Element* newElement, const xmlChar**
{
xmlSAX2Namespace* namespaces = reinterpret_cast<xmlSAX2Namespace*>(libxmlNamespaces);
for (int i = 0; i < nb_namespaces; i++) {
- String namespaceQName = "xmlns";
+ AtomicString namespaceQName = xmlnsAtom;
String namespaceURI = toString(namespaces[i].uri);
if (namespaces[i].prefix)
namespaceQName = "xmlns:" + toString(namespaces[i].prefix);
- newElement->setAttributeNS("http://www.w3.org/2000/xmlns/", namespaceQName, namespaceURI, ec);
+ newElement->setAttributeNS(XMLNSNames::xmlnsNamespaceURI, namespaceQName, namespaceURI, ec);
if (ec) // exception setting attributes
return;
}
diff --git a/WebCore/editing/markup.cpp b/WebCore/editing/markup.cpp
index 47714e7..b555981 100644
--- a/WebCore/editing/markup.cpp
+++ b/WebCore/editing/markup.cpp
@@ -55,6 +55,7 @@
#include "Range.h"
#include "VisibleSelection.h"
#include "TextIterator.h"
+#include "XMLNSNames.h"
#include "htmlediting.h"
#include "visible_units.h"
#include <wtf/StdLibExtras.h>
@@ -315,14 +316,12 @@ static bool shouldAddNamespaceElem(const Element* elem)
static bool shouldAddNamespaceAttr(const Attribute* attr, HashMap<AtomicStringImpl*, AtomicStringImpl*>& namespaces)
{
// Don't add namespace attributes twice
- DEFINE_STATIC_LOCAL(const AtomicString, xmlnsURI, ("http://www.w3.org/2000/xmlns/"));
- DEFINE_STATIC_LOCAL(const QualifiedName, xmlnsAttr, (nullAtom, "xmlns", xmlnsURI));
- if (attr->name() == xmlnsAttr) {
+ if (attr->name() == XMLNSNames::xmlnsAttr) {
namespaces.set(emptyAtom.impl(), attr->value().impl());
return false;
}
- QualifiedName xmlnsPrefixAttr("xmlns", attr->localName(), xmlnsURI);
+ QualifiedName xmlnsPrefixAttr(xmlnsAtom, attr->localName(), XMLNSNames::xmlnsNamespaceURI);
if (attr->name() == xmlnsPrefixAttr) {
namespaces.set(attr->localName().impl(), attr->value().impl());
return false;
@@ -341,9 +340,8 @@ static void appendNamespace(Vector<UChar>& result, const AtomicString& prefix, c
AtomicStringImpl* foundNS = namespaces.get(pre);
if (foundNS != ns.impl()) {
namespaces.set(pre, ns.impl());
- DEFINE_STATIC_LOCAL(const String, xmlns, ("xmlns"));
result.append(' ');
- append(result, xmlns);
+ append(result, xmlnsAtom.string());
if (!prefix.isEmpty()) {
result.append(':');
append(result, prefix);
diff --git a/WebCore/page/Frame.cpp b/WebCore/page/Frame.cpp
index dd2aae5..58531fb 100644
--- a/WebCore/page/Frame.cpp
+++ b/WebCore/page/Frame.cpp
@@ -75,6 +75,7 @@
#include "TextIterator.h"
#include "TextResourceDecoder.h"
#include "UserContentURLPattern.h"
+#include "XMLNSNames.h"
#include "XMLNames.h"
#include "htmlediting.h"
#include "markup.h"
@@ -167,6 +168,7 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient*
MathMLNames::init();
#endif
+ XMLNSNames::init();
XMLNames::init();
if (!ownerElement)
diff --git a/WebCore/platform/text/AtomicString.cpp b/WebCore/platform/text/AtomicString.cpp
index e2ff2b4..64c03cb 100644
--- a/WebCore/platform/text/AtomicString.cpp
+++ b/WebCore/platform/text/AtomicString.cpp
@@ -304,6 +304,8 @@ DEFINE_GLOBAL(AtomicString, emptyAtom, "")
DEFINE_GLOBAL(AtomicString, textAtom, "#text")
DEFINE_GLOBAL(AtomicString, commentAtom, "#comment")
DEFINE_GLOBAL(AtomicString, starAtom, "*")
+DEFINE_GLOBAL(AtomicString, xmlAtom, "xml")
+DEFINE_GLOBAL(AtomicString, xmlnsAtom, "xmlns")
void AtomicString::init()
{
@@ -318,6 +320,8 @@ void AtomicString::init()
new ((void*)&textAtom) AtomicString("#text");
new ((void*)&commentAtom) AtomicString("#comment");
new ((void*)&starAtom) AtomicString("*");
+ new ((void*)&xmlAtom) AtomicString("xml");
+ new ((void*)&xmlnsAtom) AtomicString("xmlns");
initialized = true;
}
diff --git a/WebCore/platform/text/AtomicString.h b/WebCore/platform/text/AtomicString.h
index 47d07c5..64a8bfe 100644
--- a/WebCore/platform/text/AtomicString.h
+++ b/WebCore/platform/text/AtomicString.h
@@ -156,6 +156,8 @@ inline bool equalIgnoringCase(const String& a, const AtomicString& b) { return e
extern const AtomicString textAtom;
extern const AtomicString commentAtom;
extern const AtomicString starAtom;
+ extern const AtomicString xmlAtom;
+ extern const AtomicString xmlnsAtom;
#endif
} // namespace WebCore
diff --git a/WebCore/xml/XPathStep.cpp b/WebCore/xml/XPathStep.cpp
index e5f2048..6e60952 100644
--- a/WebCore/xml/XPathStep.cpp
+++ b/WebCore/xml/XPathStep.cpp
@@ -34,6 +34,7 @@
#include "Document.h"
#include "Element.h"
#include "NamedNodeMap.h"
+#include "XMLNSNames.h"
#include "XPathParser.h"
#include "XPathUtil.h"
@@ -173,7 +174,7 @@ static inline bool nodeMatchesBasicTest(Node* node, Step::Axis axis, const Step:
ASSERT(node->isAttributeNode());
// In XPath land, namespace nodes are not accessible on the attribute axis.
- if (node->namespaceURI() == "http://www.w3.org/2000/xmlns/")
+ if (node->namespaceURI() == XMLNSNames::xmlnsNamespaceURI)
return false;
if (name == starAtom)
@@ -335,7 +336,7 @@ void Step::nodesInAxis(Node* context, NodeSet& nodes) const
// Avoid lazily creating attribute nodes for attributes that we do not need anyway.
if (m_nodeTest.kind() == NodeTest::NameTest && m_nodeTest.data() != starAtom) {
RefPtr<Node> n = static_cast<Element*>(context)->getAttributeNodeNS(m_nodeTest.namespaceURI(), m_nodeTest.data());
- if (n && n->namespaceURI() != "http://www.w3.org/2000/xmlns/") { // In XPath land, namespace nodes are not accessible on the attribute axis.
+ if (n && n->namespaceURI() != XMLNSNames::xmlnsNamespaceURI) { // In XPath land, namespace nodes are not accessible on the attribute axis.
if (nodeMatches(n.get(), AttributeAxis, m_nodeTest)) // Still need to check merged predicates.
nodes.append(n.release());
}
diff --git a/WebCore/xml/xmlnsattrs.in b/WebCore/xml/xmlnsattrs.in
new file mode 100644
index 0000000..7ac415a
--- /dev/null
+++ b/WebCore/xml/xmlnsattrs.in
@@ -0,0 +1,4 @@
+namespace="XMLNS"
+namespaceURI="http://www.w3.org/2000/xmlns/"
+
+xmlns
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list