[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.17-1283-gcf603cf
eric at webkit.org
eric at webkit.org
Tue Jan 5 23:53:43 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 9729e384a57458a96dd9ace081308dc154bf22cb
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Dec 18 16:40:57 2009 +0000
2009-12-18 Shu Chang <Chang.Shu at nokia.com>
Reviewed by Darin Adler.
New test cases for isId support.
https://bugs.webkit.org/show_bug.cgi?id=5578
* dom/xhtml/level3/core/attrisid04-expected.txt:
* dom/xhtml/level3/core/attrisid04.js:
(setUpPage):
* dom/xhtml/level3/core/attrisid05-expected.txt:
* dom/xhtml/level3/core/attrisid05.js:
(setUpPage):
* fast/dom/Element/attrisid-extra01-expected.txt: Added.
* fast/dom/Element/attrisid-extra01.html: Added.
* fast/dom/Element/id-in-applet-expected.txt: Added.
* fast/dom/Element/id-in-applet.html: Added.
* fast/dom/Element/id-in-deletebutton-expected.txt: Added.
* fast/dom/Element/id-in-deletebutton.html: Added.
* fast/dom/Element/id-in-formcollection-expected.txt: Added.
* fast/dom/Element/id-in-formcollection.html: Added.
* fast/dom/Element/id-in-frame-expected.txt: Added.
* fast/dom/Element/id-in-frame.html: Added.
* fast/dom/Element/id-in-frameset-expected.txt: Added.
* fast/dom/Element/id-in-frameset.html: Added.
* fast/dom/Element/id-in-getelement01-expected.txt: Added.
* fast/dom/Element/id-in-getelement01.html: Added.
* fast/dom/Element/id-in-insert-hr-expected.txt: Added.
* fast/dom/Element/id-in-insert-hr.html: Added.
* fast/dom/Element/id-in-map-expected.txt: Added.
* fast/dom/Element/id-in-map.html: Added.
* fast/dom/Element/id-in-param-expected.txt: Added.
* fast/dom/Element/id-in-param.html: Added.
2009-12-18 Shu Chang <Chang.Shu at nokia.com>
Reviewed by Darin Adler.
Implemented isId as specified by DOM Level 3. See detailed description below.
https://bugs.webkit.org/show_bug.cgi?id=5578
Added isId property and implementation:
Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
fast/dom/Element/attrisid-extra01.html
* dom/Attr.cpp:
(WebCore::Attr::isId):
* dom/Attr.h:
* dom/Attr.idl:
Replaced instances of HTMLNames::idAttr with Element::idAttributeName()
for the reason that id attribute name could be customized to a different
string other than "id". A test case is associated to each code change.
* dom/Document.cpp:
(WebCore::Document::getElementById): Test: fast/dom/Element/id-in-getelement01.html
* dom/Element.cpp: Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
(WebCore::Element::setAttribute):
(WebCore::Element::setAttributeMap):
(WebCore::Element::insertedIntoDocument):
(WebCore::Element::removedFromDocument):
(WebCore::Element::formatForDebugger):
(WebCore::Element::rareIDAttributeName):
* dom/Element.h: Added function idAttributeName().
(WebCore::Element::idAttributeName):
* dom/ElementRareData.h: Added member variable to store customized id name in ElementRareData.
(WebCore::ElementRareData::ElementRareData):
* dom/NamedAttrMap.cpp: Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
(WebCore::NamedNodeMap::setNamedItem):
(WebCore::NamedNodeMap::removeNamedItem):
(WebCore::NamedNodeMap::setAttributes):
* dom/Node.cpp: Removed ASSERT as it may not hold any more.
(WebCore::Node::querySelector):
* dom/SelectorNodeList.cpp: Removed ASSERT as it may not hold any more.
(WebCore::createSelectorNodeList):
* dom/StyledElement.cpp: Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
(WebCore::StyledElement::parseMappedAttribute):
* editing/DeleteButtonController.cpp: Test: fast/dom/Element/id-in-deletebutton.html
(WebCore::DeleteButtonController::createDeletionUI):
* editing/EditorCommand.cpp: Test: fast/dom/Element/id-in-insert-hr.html
(WebCore::executeInsertHorizontalRule):
* html/HTMLAppletElement.cpp: Test: fast/dom/Element/id-in-applet.html
(WebCore::HTMLAppletElement::parseMappedAttribute):
(WebCore::HTMLAppletElement::createRenderer):
* html/HTMLCollection.cpp:
(WebCore::HTMLCollection::checkForNameMatch): Test: fast/forms/select-namedItem.html
(WebCore::HTMLCollection::updateNameCache): Test: fast/dom/collection-namedItem-via-item.html
* html/HTMLDataGridColElement.cpp:
(WebCore::HTMLDataGridColElement::ensureColumn): Test: fast/dom/HTMLDataGridElement/DataGridColumns-dom.html
(WebCore::HTMLDataGridColElement::parseMappedAttribute): Test: fast/dom/HTMLDataGridElement/DataGridColumns-dom-attributes.html
* html/HTMLElement.cpp:
(WebCore::HTMLElement::parseMappedAttribute):
* html/HTMLFormCollection.cpp: Test: fast/dom/Element/id-in-formcollection.html
(WebCore::HTMLFormCollection::getNamedFormItem):
(WebCore::HTMLFormCollection::nextNamedItem):
(WebCore::HTMLFormCollection::updateNameCache):
* html/HTMLFrameElementBase.cpp: Test: fast/dom/Element/id-in-frame.html
(WebCore::HTMLFrameElementBase::parseMappedAttribute):
(WebCore::HTMLFrameElementBase::setNameAndOpenURL):
* html/HTMLImageElement.cpp: Test: fast/dom/Element/id-in-deletebutton.html
(WebCore::HTMLImageElement::parseMappedAttribute):
* html/HTMLMapElement.cpp: Test: fast/dom/Element/id-in-map.html
(WebCore::HTMLMapElement::parseMappedAttribute):
* html/HTMLNameCollection.cpp: Test: fast/dom/Element/id-in-frameset.html
(WebCore::HTMLNameCollection::itemAfter):
* html/HTMLObjectElement.cpp: Test: fast/dom/HTMLDocument/object-by-name-or-id.html
(WebCore::HTMLObjectElement::parseMappedAttribute):
* html/HTMLParamElement.cpp: Test: fast/dom/Element/id-in-param.html
(WebCore::HTMLParamElement::parseMappedAttribute):
* loader/CachedFont.cpp: Test: svg/custom/acid3-test-77.html
(WebCore::CachedFont::getSVGFontById):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::createGraphicsLayer): Debug-only code
* rendering/SVGRenderTreeAsText.cpp: Test: svg/text/text-gradient-positioning.svg
(WebCore::writeRenderResources):
* svg/SVGElement.cpp: Test: svg/custom/acid3-test-77.html
(WebCore::SVGElement::insertedIntoDocument):
* svg/SVGStyledElement.cpp: Test: svg/custom/js-update-image-and-display.svg
(WebCore::SVGStyledElement::isKnownAttribute):
* wml/WMLElement.cpp:
(WebCore::WMLElement::parseMappedAttribute):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52312 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2e2ca1f..891c624 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,37 @@
+2009-12-18 Shu Chang <Chang.Shu at nokia.com>
+
+ Reviewed by Darin Adler.
+
+ New test cases for isId support.
+ https://bugs.webkit.org/show_bug.cgi?id=5578
+
+ * dom/xhtml/level3/core/attrisid04-expected.txt:
+ * dom/xhtml/level3/core/attrisid04.js:
+ (setUpPage):
+ * dom/xhtml/level3/core/attrisid05-expected.txt:
+ * dom/xhtml/level3/core/attrisid05.js:
+ (setUpPage):
+ * fast/dom/Element/attrisid-extra01-expected.txt: Added.
+ * fast/dom/Element/attrisid-extra01.html: Added.
+ * fast/dom/Element/id-in-applet-expected.txt: Added.
+ * fast/dom/Element/id-in-applet.html: Added.
+ * fast/dom/Element/id-in-deletebutton-expected.txt: Added.
+ * fast/dom/Element/id-in-deletebutton.html: Added.
+ * fast/dom/Element/id-in-formcollection-expected.txt: Added.
+ * fast/dom/Element/id-in-formcollection.html: Added.
+ * fast/dom/Element/id-in-frame-expected.txt: Added.
+ * fast/dom/Element/id-in-frame.html: Added.
+ * fast/dom/Element/id-in-frameset-expected.txt: Added.
+ * fast/dom/Element/id-in-frameset.html: Added.
+ * fast/dom/Element/id-in-getelement01-expected.txt: Added.
+ * fast/dom/Element/id-in-getelement01.html: Added.
+ * fast/dom/Element/id-in-insert-hr-expected.txt: Added.
+ * fast/dom/Element/id-in-insert-hr.html: Added.
+ * fast/dom/Element/id-in-map-expected.txt: Added.
+ * fast/dom/Element/id-in-map.html: Added.
+ * fast/dom/Element/id-in-param-expected.txt: Added.
+ * fast/dom/Element/id-in-param.html: Added.
+
2009-12-18 Alejandro G. Castro <alex at igalia.com>
Reviewed by Darin Adler.
diff --git a/LayoutTests/dom/xhtml/level3/core/attrisid04-expected.txt b/LayoutTests/dom/xhtml/level3/core/attrisid04-expected.txt
index afed986..2cd58bd 100644
--- a/LayoutTests/dom/xhtml/level3/core/attrisid04-expected.txt
+++ b/LayoutTests/dom/xhtml/level3/core/attrisid04-expected.txt
@@ -1,3 +1,2 @@
Test http://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid04
-Status skip
-Message HTML loader does not support validating=true
+Status Success
diff --git a/LayoutTests/dom/xhtml/level3/core/attrisid04.js b/LayoutTests/dom/xhtml/level3/core/attrisid04.js
index afbce2a..24608b0 100644
--- a/LayoutTests/dom/xhtml/level3/core/attrisid04.js
+++ b/LayoutTests/dom/xhtml/level3/core/attrisid04.js
@@ -39,7 +39,16 @@ function setUpPage() {
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
- setImplementationAttribute("validating", true);
+
+ //
+ // WebKit modification:
+ //
+ // Remove the following line otherwise test case skipped.
+ //
+ //setImplementationAttribute("validating", true);
+ //
+ // End WebKit modification
+ //
docsLoaded = 0;
diff --git a/LayoutTests/dom/xhtml/level3/core/attrisid05-expected.txt b/LayoutTests/dom/xhtml/level3/core/attrisid05-expected.txt
index 0240d10..6a9f6be 100644
--- a/LayoutTests/dom/xhtml/level3/core/attrisid05-expected.txt
+++ b/LayoutTests/dom/xhtml/level3/core/attrisid05-expected.txt
@@ -1,3 +1,2 @@
Test http://www.w3.org/2001/DOM-Test-Suite/level3/core/attrisid05
-Status skip
-Message HTML loader does not support validating=true
+Status Success
diff --git a/LayoutTests/dom/xhtml/level3/core/attrisid05.js b/LayoutTests/dom/xhtml/level3/core/attrisid05.js
index e5d1cf2..772fa68 100644
--- a/LayoutTests/dom/xhtml/level3/core/attrisid05.js
+++ b/LayoutTests/dom/xhtml/level3/core/attrisid05.js
@@ -39,7 +39,16 @@ function setUpPage() {
// creates test document builder, may throw exception
//
builder = createConfiguredBuilder();
- setImplementationAttribute("validating", true);
+
+ //
+ // WebKit modification:
+ //
+ // Remove the following line otherwise test case skipped.
+ //
+ //setImplementationAttribute("validating", true);
+ //
+ // End WebKit modification
+ //
docsLoaded = 0;
diff --git a/LayoutTests/fast/dom/Element/attrisid-extra01-expected.txt b/LayoutTests/fast/dom/Element/attrisid-extra01-expected.txt
new file mode 100644
index 0000000..dbcb499
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/attrisid-extra01-expected.txt
@@ -0,0 +1,11 @@
+Test Attr.isId where Attr is created without element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS attr.isId is false
+PASS attr.isId is true
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/attrisid-extra01.html b/LayoutTests/fast/dom/Element/attrisid-extra01.html
new file mode 100644
index 0000000..96d6e69
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/attrisid-extra01.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test Attr.isId where Attr is created without element.");
+
+var attr = document.createAttributeNS("http://www.w3.org/XML/1998/namespace","xml:lang");
+shouldBeFalse('attr.isId');
+
+var attr = document.createAttributeNS("","id");
+shouldBeTrue('attr.isId');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-applet-expected.txt b/LayoutTests/fast/dom/Element/id-in-applet-expected.txt
new file mode 100644
index 0000000..20587ee
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-applet-expected.txt
@@ -0,0 +1,10 @@
+Test using id in applet element
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("applet1") is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/id-in-applet.html b/LayoutTests/fast/dom/Element/id-in-applet.html
new file mode 100644
index 0000000..752b955
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-applet.html
@@ -0,0 +1,21 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<applet id="applet1" width="10" height="10"></applet>
+
+<script>
+description("Test using id in applet element");
+
+shouldBeNonNull('document.getElementById("applet1")');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-deletebutton-expected.txt b/LayoutTests/fast/dom/Element/id-in-deletebutton-expected.txt
new file mode 100644
index 0000000..d1496fe
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-deletebutton-expected.txt
@@ -0,0 +1,12 @@
+Test document.getElementById("WebKit-Editing-Delete-Button")
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS deleteButton is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+1
+2
+
diff --git a/LayoutTests/fast/dom/Element/id-in-deletebutton.html b/LayoutTests/fast/dom/Element/id-in-deletebutton.html
new file mode 100644
index 0000000..6517726
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-deletebutton.html
@@ -0,0 +1,29 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<div contenteditable="true">
+<ul class="needsDeletionUI"><li>1</li><li id="li">2</li></ul>
+
+<script>
+description('Test document.getElementById("WebKit-Editing-Delete-Button")');
+
+sel = window.getSelection();
+li = document.getElementById("li");
+sel.setPosition(li, 0);
+
+if (window.layoutTestController) {
+ deleteButton = document.getElementById("WebKit-Editing-Delete-Button");
+ shouldBeNonNull('deleteButton');
+}
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-formcollection-expected.txt b/LayoutTests/fast/dom/Element/id-in-formcollection-expected.txt
new file mode 100644
index 0000000..d0018c9
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-formcollection-expected.txt
@@ -0,0 +1,10 @@
+Test using id in HTMLFormCollection
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS elems("ids1",1).getAttribute("name") is "name2"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/id-in-formcollection.html b/LayoutTests/fast/dom/Element/id-in-formcollection.html
new file mode 100644
index 0000000..4e04eeb
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-formcollection.html
@@ -0,0 +1,25 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<form id="idf1">
+<select id="ids1" name="name1"><option selected>FAILURE</option></select>
+<select id="ids1" name="name2"><option selected>FAILURE</option></select>
+</form>
+
+<script>
+description("Test using id in HTMLFormCollection");
+
+var elems = document.getElementById("idf1").elements;
+shouldBe('elems("ids1",1).getAttribute("name")', '"name2"');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-frame-expected.txt b/LayoutTests/fast/dom/Element/id-in-frame-expected.txt
new file mode 100644
index 0000000..4101d1c
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-frame-expected.txt
@@ -0,0 +1,10 @@
+Test using id in frame
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("theframe") is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/id-in-frame.html b/LayoutTests/fast/dom/Element/id-in-frame.html
new file mode 100644
index 0000000..603e802
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-frame.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<script>
+description("Test using id in frame");
+
+var parent = document.createElement('iframe');
+parent.id = 'theframe';
+document.body.appendChild(parent);
+
+shouldBeNonNull('document.getElementById("theframe")');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-frameset-expected.txt b/LayoutTests/fast/dom/Element/id-in-frameset-expected.txt
new file mode 100644
index 0000000..b3db1a3
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-frameset-expected.txt
@@ -0,0 +1,2 @@
+ALERT: 1
+
diff --git a/LayoutTests/fast/dom/Element/id-in-frameset.html b/LayoutTests/fast/dom/Element/id-in-frameset.html
new file mode 100644
index 0000000..d26c150
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-frameset.html
@@ -0,0 +1,23 @@
+<html>
+
+<frameset id="frameset">
+ <frame name="frame2" src="about:blank">
+ <frame name="frame1" src="javascript:
+ function log(s)
+ {
+ if (window.layoutTestController)
+ alert(s);
+ else
+ top.frame1.document.write('<p>' + s + '</p>');
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+
+ top.frameset.removeChild(top.frame2.frameElement);
+ log(top.frameset.children.length);
+ ">
+
+ <frame name="frame3" src="about:blank">
+</frameset>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-getelement01-expected.txt b/LayoutTests/fast/dom/Element/id-in-getelement01-expected.txt
new file mode 100644
index 0000000..1ff0b86
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-getelement01-expected.txt
@@ -0,0 +1,12 @@
+Test getElementById
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS elem.getAttribute("name") is "name1"
+PASS elem.getAttribute("name") is "name2"
+PASS elem is null
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/id-in-getelement01.html b/LayoutTests/fast/dom/Element/id-in-getelement01.html
new file mode 100644
index 0000000..54d4d7c
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-getelement01.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<div name='name1' id='id1'/>
+<div name='name2' id='id2'/>
+<div name='name3' id='id2'/>
+
+<script>
+description("Test getElementById");
+
+var elem;
+
+// element found with exact match
+elem = document.getElementById('id1');
+shouldBe('elem.getAttribute("name")', '"name1"');
+
+// multiple elements having same id return the first one
+elem = document.getElementById('id2');
+shouldBe('elem.getAttribute("name")', '"name2"');
+
+// element with id not found
+elem = document.getElementById('id3');
+shouldBeNull('elem');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-insert-hr-expected.txt b/LayoutTests/fast/dom/Element/id-in-insert-hr-expected.txt
new file mode 100644
index 0000000..1ff7f35
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-insert-hr-expected.txt
@@ -0,0 +1,10 @@
+Test using id in execCommand(InsertHorizontalRule)
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS hr is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+foobar
diff --git a/LayoutTests/fast/dom/Element/id-in-insert-hr.html b/LayoutTests/fast/dom/Element/id-in-insert-hr.html
new file mode 100644
index 0000000..d2a226e
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-insert-hr.html
@@ -0,0 +1,29 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<div id="test1" contenteditable="true">foobar</div>
+
+<script>
+description("Test using id in execCommand(InsertHorizontalRule)");
+
+var s = window.getSelection();
+var e = document.getElementById("test1");
+s.setPosition(e, 0);
+
+var id = "hr";
+document.execCommand("InsertHorizontalRule", false, id);
+var hr = document.getElementById(id);
+
+shouldBeNonNull('hr');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-map-expected.txt b/LayoutTests/fast/dom/Element/id-in-map-expected.txt
new file mode 100644
index 0000000..5111cce
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-map-expected.txt
@@ -0,0 +1,10 @@
+Test using id in map element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("firstmap") is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/id-in-map.html b/LayoutTests/fast/dom/Element/id-in-map.html
new file mode 100644
index 0000000..a1805ba
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-map.html
@@ -0,0 +1,21 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<map title="map" id="firstmap">
+
+<script>
+description("Test using id in map element.");
+
+shouldBeNonNull('document.getElementById("firstmap")');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/fast/dom/Element/id-in-param-expected.txt b/LayoutTests/fast/dom/Element/id-in-param-expected.txt
new file mode 100644
index 0000000..f8b3a0c
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-param-expected.txt
@@ -0,0 +1,10 @@
+Test using id in param element.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS document.getElementById("id1") is non-null.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/dom/Element/id-in-param.html b/LayoutTests/fast/dom/Element/id-in-param.html
new file mode 100644
index 0000000..e5da153
--- /dev/null
+++ b/LayoutTests/fast/dom/Element/id-in-param.html
@@ -0,0 +1,23 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../js/resources/js-test-style.css">
+<script src="../../js/resources/js-test-pre.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+
+<object width=100 height=100>
+ <param name="movie" id="id1">
+</object>
+
+<script>
+description("Test using id in param element.");
+
+shouldBeNonNull('document.getElementById("id1")');
+
+var successfullyParsed = true;
+</script>
+<script src="../../js/resources/js-test-post.js"></script>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4623c95..24f68b9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,89 @@
+2009-12-18 Shu Chang <Chang.Shu at nokia.com>
+
+ Reviewed by Darin Adler.
+
+ Implemented isId as specified by DOM Level 3. See detailed description below.
+ https://bugs.webkit.org/show_bug.cgi?id=5578
+
+ Added isId property and implementation:
+ Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
+ fast/dom/Element/attrisid-extra01.html
+ * dom/Attr.cpp:
+ (WebCore::Attr::isId):
+ * dom/Attr.h:
+ * dom/Attr.idl:
+
+ Replaced instances of HTMLNames::idAttr with Element::idAttributeName()
+ for the reason that id attribute name could be customized to a different
+ string other than "id". A test case is associated to each code change.
+ * dom/Document.cpp:
+ (WebCore::Document::getElementById): Test: fast/dom/Element/id-in-getelement01.html
+ * dom/Element.cpp: Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
+ (WebCore::Element::setAttribute):
+ (WebCore::Element::setAttributeMap):
+ (WebCore::Element::insertedIntoDocument):
+ (WebCore::Element::removedFromDocument):
+ (WebCore::Element::formatForDebugger):
+ (WebCore::Element::rareIDAttributeName):
+ * dom/Element.h: Added function idAttributeName().
+ (WebCore::Element::idAttributeName):
+ * dom/ElementRareData.h: Added member variable to store customized id name in ElementRareData.
+ (WebCore::ElementRareData::ElementRareData):
+ * dom/NamedAttrMap.cpp: Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
+ (WebCore::NamedNodeMap::setNamedItem):
+ (WebCore::NamedNodeMap::removeNamedItem):
+ (WebCore::NamedNodeMap::setAttributes):
+ * dom/Node.cpp: Removed ASSERT as it may not hold any more.
+ (WebCore::Node::querySelector):
+ * dom/SelectorNodeList.cpp: Removed ASSERT as it may not hold any more.
+ (WebCore::createSelectorNodeList):
+ * dom/StyledElement.cpp: Tests: dom/xhtml/level3/core/attrisid01-07.xhtml
+ (WebCore::StyledElement::parseMappedAttribute):
+ * editing/DeleteButtonController.cpp: Test: fast/dom/Element/id-in-deletebutton.html
+ (WebCore::DeleteButtonController::createDeletionUI):
+ * editing/EditorCommand.cpp: Test: fast/dom/Element/id-in-insert-hr.html
+ (WebCore::executeInsertHorizontalRule):
+ * html/HTMLAppletElement.cpp: Test: fast/dom/Element/id-in-applet.html
+ (WebCore::HTMLAppletElement::parseMappedAttribute):
+ (WebCore::HTMLAppletElement::createRenderer):
+ * html/HTMLCollection.cpp:
+ (WebCore::HTMLCollection::checkForNameMatch): Test: fast/forms/select-namedItem.html
+ (WebCore::HTMLCollection::updateNameCache): Test: fast/dom/collection-namedItem-via-item.html
+ * html/HTMLDataGridColElement.cpp:
+ (WebCore::HTMLDataGridColElement::ensureColumn): Test: fast/dom/HTMLDataGridElement/DataGridColumns-dom.html
+ (WebCore::HTMLDataGridColElement::parseMappedAttribute): Test: fast/dom/HTMLDataGridElement/DataGridColumns-dom-attributes.html
+ * html/HTMLElement.cpp:
+ (WebCore::HTMLElement::parseMappedAttribute):
+ * html/HTMLFormCollection.cpp: Test: fast/dom/Element/id-in-formcollection.html
+ (WebCore::HTMLFormCollection::getNamedFormItem):
+ (WebCore::HTMLFormCollection::nextNamedItem):
+ (WebCore::HTMLFormCollection::updateNameCache):
+ * html/HTMLFrameElementBase.cpp: Test: fast/dom/Element/id-in-frame.html
+ (WebCore::HTMLFrameElementBase::parseMappedAttribute):
+ (WebCore::HTMLFrameElementBase::setNameAndOpenURL):
+ * html/HTMLImageElement.cpp: Test: fast/dom/Element/id-in-deletebutton.html
+ (WebCore::HTMLImageElement::parseMappedAttribute):
+ * html/HTMLMapElement.cpp: Test: fast/dom/Element/id-in-map.html
+ (WebCore::HTMLMapElement::parseMappedAttribute):
+ * html/HTMLNameCollection.cpp: Test: fast/dom/Element/id-in-frameset.html
+ (WebCore::HTMLNameCollection::itemAfter):
+ * html/HTMLObjectElement.cpp: Test: fast/dom/HTMLDocument/object-by-name-or-id.html
+ (WebCore::HTMLObjectElement::parseMappedAttribute):
+ * html/HTMLParamElement.cpp: Test: fast/dom/Element/id-in-param.html
+ (WebCore::HTMLParamElement::parseMappedAttribute):
+ * loader/CachedFont.cpp: Test: svg/custom/acid3-test-77.html
+ (WebCore::CachedFont::getSVGFontById):
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::createGraphicsLayer): Debug-only code
+ * rendering/SVGRenderTreeAsText.cpp: Test: svg/text/text-gradient-positioning.svg
+ (WebCore::writeRenderResources):
+ * svg/SVGElement.cpp: Test: svg/custom/acid3-test-77.html
+ (WebCore::SVGElement::insertedIntoDocument):
+ * svg/SVGStyledElement.cpp: Test: svg/custom/js-update-image-and-display.svg
+ (WebCore::SVGStyledElement::isKnownAttribute):
+ * wml/WMLElement.cpp:
+ (WebCore::WMLElement::parseMappedAttribute):
+
2009-12-18 Simon Hausmann <simon.hausmann at nokia.com>
Reviewed by Tor Arne Vestbø.
diff --git a/WebCore/dom/Attr.cpp b/WebCore/dom/Attr.cpp
index aa5916b..8a0b51f 100644
--- a/WebCore/dom/Attr.cpp
+++ b/WebCore/dom/Attr.cpp
@@ -30,6 +30,8 @@
namespace WebCore {
+using namespace HTMLNames;
+
inline Attr::Attr(Element* element, Document* document, PassRefPtr<Attribute> attribute)
: ContainerNode(document)
, m_element(element)
@@ -164,4 +166,9 @@ void Attr::childrenChanged(bool changedByParser, Node* beforeChange, Node* after
m_element->attributeChanged(m_attribute.get());
}
+bool Attr::isId() const
+{
+ return qualifiedName().matches(m_element ? m_element->idAttributeName() : idAttr);
+}
+
}
diff --git a/WebCore/dom/Attr.h b/WebCore/dom/Attr.h
index e927a6e..2e02a02 100644
--- a/WebCore/dom/Attr.h
+++ b/WebCore/dom/Attr.h
@@ -52,6 +52,8 @@ public:
Attribute* attr() const { return m_attribute.get(); }
const QualifiedName& qualifiedName() const { return m_attribute->name(); }
+ bool isId() const;
+
// An extension to get presentational information for attributes.
CSSStyleDeclaration* style() { return m_attribute->style(); }
diff --git a/WebCore/dom/Attr.idl b/WebCore/dom/Attr.idl
index c01f34a..c50fc1d 100644
--- a/WebCore/dom/Attr.idl
+++ b/WebCore/dom/Attr.idl
@@ -38,7 +38,11 @@ module core {
// DOM Level 2
readonly attribute Element ownerElement;
-
+
+ // DOM Level 3
+
+ readonly attribute boolean isId;
+
// extensions
#if !defined(LANGUAGE_COM) || !LANGUAGE_COM
readonly attribute CSSStyleDeclaration style;
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 2926872..b00c10e 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -856,7 +856,7 @@ Element* Document::getElementById(const AtomicString& elementId) const
for (Node *n = traverseNextNode(); n != 0; n = n->traverseNextNode()) {
if (n->isElementNode()) {
element = static_cast<Element*>(n);
- if (element->hasID() && element->getAttribute(idAttr) == elementId) {
+ if (element->hasID() && element->getAttribute(element->idAttributeName()) == elementId) {
m_duplicateIds.remove(elementId.impl());
m_elementsById.set(elementId.impl(), element);
return element;
diff --git a/WebCore/dom/Element.cpp b/WebCore/dom/Element.cpp
index d7f1b11..b347264 100644
--- a/WebCore/dom/Element.cpp
+++ b/WebCore/dom/Element.cpp
@@ -532,7 +532,7 @@ void Element::setAttribute(const AtomicString& name, const AtomicString& value,
document()->incDOMTreeVersion();
- if (localName == idAttr.localName())
+ if (localName == idAttributeName().localName())
updateId(old ? old->value() : nullAtom, value);
if (old && value.isNull())
@@ -552,7 +552,7 @@ void Element::setAttribute(const QualifiedName& name, const AtomicString& value,
// allocate attributemap if necessary
Attribute* old = attributes(false)->getAttributeItem(name);
- if (name == idAttr)
+ if (name == idAttributeName())
updateId(old ? old->value() : nullAtom, value);
if (old && value.isNull())
@@ -607,8 +607,9 @@ void Element::setAttributeMap(PassRefPtr<NamedNodeMap> list)
// If setting the whole map changes the id attribute, we need to call updateId.
- Attribute* oldId = namedAttrMap ? namedAttrMap->getAttributeItem(idAttr) : 0;
- Attribute* newId = list ? list->getAttributeItem(idAttr) : 0;
+ const QualifiedName& idName = idAttributeName();
+ Attribute* oldId = namedAttrMap ? namedAttrMap->getAttributeItem(idName) : 0;
+ Attribute* newId = list ? list->getAttributeItem(idName) : 0;
if (oldId || newId)
updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
@@ -713,7 +714,7 @@ void Element::insertedIntoDocument()
if (hasID()) {
if (NamedNodeMap* attrs = namedAttrMap.get()) {
- Attribute* idItem = attrs->getAttributeItem(idAttr);
+ Attribute* idItem = attrs->getAttributeItem(idAttributeName());
if (idItem && !idItem->isNull())
updateId(nullAtom, idItem->value());
}
@@ -724,7 +725,7 @@ void Element::removedFromDocument()
{
if (hasID()) {
if (NamedNodeMap* attrs = namedAttrMap.get()) {
- Attribute* idItem = attrs->getAttributeItem(idAttr);
+ Attribute* idItem = attrs->getAttributeItem(idAttributeName());
if (idItem && !idItem->isNull())
updateId(idItem->value(), nullAtom);
}
@@ -1073,7 +1074,7 @@ void Element::formatForDebugger(char* buffer, unsigned length) const
result += s;
}
- s = getAttribute(idAttr);
+ s = getAttribute(idAttributeName());
if (s.length() > 0) {
if (result.length() > 0)
result += "; ";
@@ -1432,4 +1433,9 @@ KURL Element::getURLAttribute(const QualifiedName& name) const
return document()->completeURL(deprecatedParseURL(getAttribute(name)));
}
+const QualifiedName& Element::rareIDAttributeName() const
+{
+ return rareData()->m_idAttributeName;
+}
+
} // namespace WebCore
diff --git a/WebCore/dom/Element.h b/WebCore/dom/Element.h
index 1f025e8..1fb2211 100644
--- a/WebCore/dom/Element.h
+++ b/WebCore/dom/Element.h
@@ -26,6 +26,7 @@
#define Element_h
#include "ContainerNode.h"
+#include "HTMLNames.h"
#include "QualifiedName.h"
#include "ScrollTypes.h"
@@ -111,6 +112,8 @@ public:
void setAttribute(const AtomicString& name, const AtomicString& value, ExceptionCode&);
void setAttributeNS(const AtomicString& namespaceURI, const AtomicString& qualifiedName, const AtomicString& value, ExceptionCode&);
+ const QualifiedName& idAttributeName() const;
+
void scrollIntoView(bool alignToTop = true);
void scrollIntoViewIfNeeded(bool centerIfNeeded = true);
@@ -282,6 +285,7 @@ private:
virtual bool childTypeAllowed(NodeType);
virtual PassRefPtr<Attribute> createAttribute(const QualifiedName&, const AtomicString& value);
+ const QualifiedName& rareIDAttributeName() const;
#ifndef NDEBUG
virtual void formatForDebugger(char* buffer, unsigned length) const;
@@ -339,6 +343,11 @@ inline Element* Node::parentElement() const
return parent && parent->isElementNode() ? static_cast<Element*>(parent) : 0;
}
+inline const QualifiedName& Element::idAttributeName() const
+{
+ return hasRareData() ? rareIDAttributeName() : HTMLNames::idAttr;
+}
+
} //namespace
#endif
diff --git a/WebCore/dom/ElementRareData.h b/WebCore/dom/ElementRareData.h
index 94e0499..f23ad8e 100644
--- a/WebCore/dom/ElementRareData.h
+++ b/WebCore/dom/ElementRareData.h
@@ -27,6 +27,8 @@
namespace WebCore {
+using namespace HTMLNames;
+
class ElementRareData : public NodeRareData {
public:
ElementRareData();
@@ -38,6 +40,7 @@ public:
IntSize m_minimumSizeForResizing;
RefPtr<RenderStyle> m_computedStyle;
+ QualifiedName m_idAttributeName;
};
inline IntSize defaultMinimumSizeForResizing()
@@ -47,6 +50,7 @@ inline IntSize defaultMinimumSizeForResizing()
inline ElementRareData::ElementRareData()
: m_minimumSizeForResizing(defaultMinimumSizeForResizing())
+ , m_idAttributeName(idAttr)
{
}
diff --git a/WebCore/dom/NamedAttrMap.cpp b/WebCore/dom/NamedAttrMap.cpp
index 56b40b9..24d4ef5 100644
--- a/WebCore/dom/NamedAttrMap.cpp
+++ b/WebCore/dom/NamedAttrMap.cpp
@@ -130,7 +130,7 @@ PassRefPtr<Node> NamedNodeMap::setNamedItem(Node* arg, ExceptionCode& ec)
return 0;
}
- if (a->name() == idAttr)
+ if (attr->isId())
m_element->updateId(old ? old->value() : nullAtom, a->value());
// ### slightly inefficient - resizes attribute array twice.
@@ -155,9 +155,9 @@ PassRefPtr<Node> NamedNodeMap::removeNamedItem(const QualifiedName& name, Except
return 0;
}
- RefPtr<Node> r = a->createAttrIfNeeded(m_element);
+ RefPtr<Attr> r = a->createAttrIfNeeded(m_element);
- if (name == idAttr)
+ if (r->isId())
m_element->updateId(a->value(), nullAtom);
removeAttribute(name);
@@ -242,8 +242,8 @@ void NamedNodeMap::setAttributes(const NamedNodeMap& other)
// If assigning the map changes the id attribute, we need to call
// updateId.
- Attribute *oldId = getAttributeItem(idAttr);
- Attribute *newId = other.getAttributeItem(idAttr);
+ Attribute* oldId = getAttributeItem(m_element->idAttributeName());
+ Attribute* newId = other.getAttributeItem(m_element->idAttributeName());
if (oldId || newId)
m_element->updateId(oldId ? oldId->value() : nullAtom, newId ? newId->value() : nullAtom);
diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp
index 687d7da..9c225c5 100644
--- a/WebCore/dom/Node.cpp
+++ b/WebCore/dom/Node.cpp
@@ -1653,7 +1653,6 @@ PassRefPtr<Element> Node::querySelector(const String& selectors, ExceptionCode&
// FIXME: we could also optimize for the the [id="foo"] case
if (strictParsing && inDocument() && querySelectorList.hasOneSelector() && querySelectorList.first()->m_match == CSSSelector::Id) {
- ASSERT(querySelectorList.first()->attribute() == idAttr);
Element* element = document()->getElementById(querySelectorList.first()->m_value);
if (element && (isDocumentNode() || element->isDescendantOf(this)) && selectorChecker.checkSelector(querySelectorList.first(), element))
return element;
diff --git a/WebCore/dom/SelectorNodeList.cpp b/WebCore/dom/SelectorNodeList.cpp
index 85b1238..bc97034 100644
--- a/WebCore/dom/SelectorNodeList.cpp
+++ b/WebCore/dom/SelectorNodeList.cpp
@@ -50,7 +50,6 @@ PassRefPtr<StaticNodeList> createSelectorNodeList(Node* rootNode, const CSSSelec
CSSStyleSelector::SelectorChecker selectorChecker(document, strictParsing);
if (strictParsing && rootNode->inDocument() && onlySelector && onlySelector->m_match == CSSSelector::Id && !document->containsMultipleElementsWithId(onlySelector->m_value)) {
- ASSERT(querySelectorList.first()->attribute() == idAttr);
Element* element = document->getElementById(onlySelector->m_value);
if (element && (rootNode->isDocumentNode() || element->isDescendantOf(rootNode)) && selectorChecker.checkSelector(onlySelector, element))
nodes.append(element);
diff --git a/WebCore/dom/StyledElement.cpp b/WebCore/dom/StyledElement.cpp
index 46ce137..106ea1f 100644
--- a/WebCore/dom/StyledElement.cpp
+++ b/WebCore/dom/StyledElement.cpp
@@ -234,7 +234,7 @@ void StyledElement::classAttributeChanged(const AtomicString& newClassString)
void StyledElement::parseMappedAttribute(MappedAttribute *attr)
{
- if (attr->name() == idAttr) {
+ if (attr->name() == idAttributeName()) {
// unique id
setHasID(!attr->isNull());
if (namedAttrMap) {
diff --git a/WebCore/editing/DeleteButtonController.cpp b/WebCore/editing/DeleteButtonController.cpp
index c154426..c5a4a7d 100644
--- a/WebCore/editing/DeleteButtonController.cpp
+++ b/WebCore/editing/DeleteButtonController.cpp
@@ -187,7 +187,7 @@ void DeleteButtonController::respondToChangedSelection(const VisibleSelection& o
void DeleteButtonController::createDeletionUI()
{
RefPtr<HTMLDivElement> container = new HTMLDivElement(divTag, m_target->document());
- container->setAttribute(idAttr, containerElementIdentifier);
+ container->setAttribute(container->idAttributeName(), containerElementIdentifier);
CSSMutableStyleDeclaration* style = container->getInlineStyleDecl();
style->setProperty(CSSPropertyWebkitUserDrag, CSSValueNone);
@@ -202,7 +202,7 @@ void DeleteButtonController::createDeletionUI()
style->setProperty(CSSPropertyLeft, "0");
RefPtr<HTMLDivElement> outline = new HTMLDivElement(divTag, m_target->document());
- outline->setAttribute(idAttr, outlineElementIdentifier);
+ outline->setAttribute(outline->idAttributeName(), outlineElementIdentifier);
const int borderWidth = 4;
const int borderRadius = 6;
@@ -225,7 +225,7 @@ void DeleteButtonController::createDeletionUI()
return;
RefPtr<DeleteButton> button = new DeleteButton(m_target->document());
- button->setAttribute(idAttr, buttonElementIdentifier);
+ button->setAttribute(button->idAttributeName(), buttonElementIdentifier);
const int buttonWidth = 30;
const int buttonHeight = 30;
diff --git a/WebCore/editing/EditorCommand.cpp b/WebCore/editing/EditorCommand.cpp
index 3379b3c..780983b 100644
--- a/WebCore/editing/EditorCommand.cpp
+++ b/WebCore/editing/EditorCommand.cpp
@@ -471,7 +471,7 @@ static bool executeInsertHorizontalRule(Frame* frame, Event*, EditorCommandSourc
{
RefPtr<HTMLHRElement> hr = new HTMLHRElement(hrTag, frame->document());
if (!value.isEmpty())
- hr->setAttribute(idAttr, value);
+ hr->setAttribute(hr->idAttributeName(), value);
return executeInsertNode(frame, hr.release());
}
diff --git a/WebCore/html/HTMLAppletElement.cpp b/WebCore/html/HTMLAppletElement.cpp
index f67e9dc..fb23b5c 100644
--- a/WebCore/html/HTMLAppletElement.cpp
+++ b/WebCore/html/HTMLAppletElement.cpp
@@ -63,7 +63,7 @@ void HTMLAppletElement::parseMappedAttribute(MappedAttribute* attr)
document->addNamedItem(newName);
}
m_name = newName;
- } else if (attr->name() == idAttr) {
+ } else if (attr->name() == idAttributeName()) {
const AtomicString& newId = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
@@ -118,7 +118,7 @@ RenderObject* HTMLAppletElement::createRenderer(RenderArena*, RenderStyle* style
if (!codeBase.isNull())
args.set("codeBase", codeBase);
- const AtomicString& name = getAttribute(document()->isHTMLDocument() ? nameAttr : idAttr);
+ const AtomicString& name = getAttribute(document()->isHTMLDocument() ? nameAttr : idAttributeName());
if (!name.isNull())
args.set("name", name);
const AtomicString& archive = getAttribute(archiveAttr);
diff --git a/WebCore/html/HTMLCollection.cpp b/WebCore/html/HTMLCollection.cpp
index 44e1104..6b90cf1 100644
--- a/WebCore/html/HTMLCollection.cpp
+++ b/WebCore/html/HTMLCollection.cpp
@@ -266,7 +266,7 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A
HTMLElement* e = static_cast<HTMLElement*>(element);
if (!checkName)
- return e->getAttribute(idAttr) == name;
+ return e->getAttribute(e->idAttributeName()) == name;
// document.all returns only images, forms, applets, objects and embeds
// by name (though everything by id)
@@ -277,7 +277,7 @@ bool HTMLCollection::checkForNameMatch(Element* element, bool checkName, const A
e->hasLocalName(selectTag)))
return false;
- return e->getAttribute(nameAttr) == name && e->getAttribute(idAttr) != name;
+ return e->getAttribute(nameAttr) == name && e->getAttribute(e->idAttributeName()) != name;
}
Node* HTMLCollection::namedItem(const AtomicString& name) const
@@ -319,7 +319,7 @@ void HTMLCollection::updateNameCache() const
if (!element->isHTMLElement())
continue;
HTMLElement* e = static_cast<HTMLElement*>(element);
- const AtomicString& idAttrVal = e->getAttribute(idAttr);
+ const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName());
const AtomicString& nameAttrVal = e->getAttribute(nameAttr);
if (!idAttrVal.isEmpty()) {
// add to id cache
diff --git a/WebCore/html/HTMLDataGridColElement.cpp b/WebCore/html/HTMLDataGridColElement.cpp
index 8398545..935375e 100644
--- a/WebCore/html/HTMLDataGridColElement.cpp
+++ b/WebCore/html/HTMLDataGridColElement.cpp
@@ -55,7 +55,7 @@ void HTMLDataGridColElement::ensureColumn()
{
if (m_column)
return;
- m_column = DataGridColumn::create(getAttribute(idAttr), label(), type(), primary(), sortable());
+ m_column = DataGridColumn::create(getAttribute(idAttributeName()), label(), type(), primary(), sortable());
}
void HTMLDataGridColElement::insertedIntoTree(bool deep)
@@ -162,8 +162,8 @@ void HTMLDataGridColElement::parseMappedAttribute(MappedAttribute* attr)
column()->setSortable(sortable());
else if (attr->name() == sortdirectionAttr)
column()->setSortDirection(sortDirection());
- else if (attr->name() == idAttr)
- column()->setId(getAttribute(idAttr));
+ else if (attr->name() == idAttributeName())
+ column()->setId(getAttribute(idAttributeName()));
}
} // namespace WebCore
diff --git a/WebCore/html/HTMLElement.cpp b/WebCore/html/HTMLElement.cpp
index cb6282f..f8ba820 100644
--- a/WebCore/html/HTMLElement.cpp
+++ b/WebCore/html/HTMLElement.cpp
@@ -114,7 +114,7 @@ bool HTMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry
void HTMLElement::parseMappedAttribute(MappedAttribute *attr)
{
- if (attr->name() == idAttr || attr->name() == classAttr || attr->name() == styleAttr)
+ if (attr->name() == idAttributeName() || attr->name() == classAttr || attr->name() == styleAttr)
return StyledElement::parseMappedAttribute(attr);
String indexstring;
diff --git a/WebCore/html/HTMLFormCollection.cpp b/WebCore/html/HTMLFormCollection.cpp
index 812d98a..65c48fe 100644
--- a/WebCore/html/HTMLFormCollection.cpp
+++ b/WebCore/html/HTMLFormCollection.cpp
@@ -110,7 +110,8 @@ Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, con
bool foundInputElements = false;
for (unsigned i = 0; i < form->formElements.size(); ++i) {
HTMLFormControlElement* e = form->formElements[i];
- if (e->isEnumeratable() && e->getAttribute(attrName) == name) {
+ const QualifiedName& attributeName = (attrName == idAttr) ? e->idAttributeName() : attrName;
+ if (e->isEnumeratable() && e->getAttribute(attributeName) == name) {
foundInputElements = true;
if (!duplicateNumber)
return e;
@@ -121,7 +122,8 @@ Element* HTMLFormCollection::getNamedFormItem(const QualifiedName& attrName, con
if (!foundInputElements) {
for (unsigned i = 0; i < form->imgElements.size(); ++i) {
HTMLImageElement* e = form->imgElements[i];
- if (e->getAttribute(attrName) == name) {
+ const QualifiedName& attributeName = (attrName == idAttr) ? e->idAttributeName() : attrName;
+ if (e->getAttribute(attributeName) == name) {
if (!duplicateNumber)
return e;
--duplicateNumber;
@@ -171,10 +173,10 @@ Node* HTMLFormCollection::nextNamedItem(const AtomicString& name) const
// The nextNamedItemInternal function can return the same item twice if it has
// both an id and name that are equal to the name parameter. So this function
// checks if we are on the nameAttr half of the iteration and skips over any
- // that also have the same idAttr.
+ // that also have the same idAttributeName.
Element* impl = nextNamedItemInternal(name);
if (m_idsDone)
- while (impl && impl->getAttribute(idAttr) == name)
+ while (impl && impl->getAttribute(impl->idAttributeName()) == name)
impl = nextNamedItemInternal(name);
return impl;
}
@@ -191,7 +193,7 @@ void HTMLFormCollection::updateNameCache() const
for (unsigned i = 0; i < f->formElements.size(); ++i) {
HTMLFormControlElement* e = f->formElements[i];
if (e->isEnumeratable()) {
- const AtomicString& idAttrVal = e->getAttribute(idAttr);
+ const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName());
const AtomicString& nameAttrVal = e->getAttribute(nameAttr);
if (!idAttrVal.isEmpty()) {
// add to id cache
@@ -218,7 +220,7 @@ void HTMLFormCollection::updateNameCache() const
for (unsigned i = 0; i < f->imgElements.size(); ++i) {
HTMLImageElement* e = f->imgElements[i];
- const AtomicString& idAttrVal = e->getAttribute(idAttr);
+ const AtomicString& idAttrVal = e->getAttribute(e->idAttributeName());
const AtomicString& nameAttrVal = e->getAttribute(nameAttr);
if (!idAttrVal.isEmpty() && !foundInputElements.contains(idAttrVal.impl())) {
// add to id cache
diff --git a/WebCore/html/HTMLFrameElementBase.cpp b/WebCore/html/HTMLFrameElementBase.cpp
index 80df829..9551b6e 100644
--- a/WebCore/html/HTMLFrameElementBase.cpp
+++ b/WebCore/html/HTMLFrameElementBase.cpp
@@ -111,7 +111,7 @@ void HTMLFrameElementBase::parseMappedAttribute(MappedAttribute *attr)
{
if (attr->name() == srcAttr)
setLocation(deprecatedParseURL(attr->value()));
- else if (attr->name() == idAttr) {
+ else if (attr->name() == idAttributeName()) {
// Important to call through to base for the id attribute so the hasID bit gets set.
HTMLFrameOwnerElement::parseMappedAttribute(attr);
m_frameName = attr->value();
@@ -152,7 +152,7 @@ void HTMLFrameElementBase::setNameAndOpenURL()
{
m_frameName = getAttribute(nameAttr);
if (m_frameName.isNull())
- m_frameName = getAttribute(idAttr);
+ m_frameName = getAttribute(idAttributeName());
if (Frame* parentFrame = document()->frame())
m_frameName = parentFrame->tree()->uniqueChildName(m_frameName);
diff --git a/WebCore/html/HTMLImageElement.cpp b/WebCore/html/HTMLImageElement.cpp
index d353073..5a724db 100644
--- a/WebCore/html/HTMLImageElement.cpp
+++ b/WebCore/html/HTMLImageElement.cpp
@@ -131,7 +131,7 @@ void HTMLImageElement::parseMappedAttribute(MappedAttribute* attr)
document->addNamedItem(newName);
}
m_name = newName;
- } else if (attr->name() == idAttr) {
+ } else if (attr->name() == idAttributeName()) {
const AtomicString& newId = attr->value();
if (inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
diff --git a/WebCore/html/HTMLMapElement.cpp b/WebCore/html/HTMLMapElement.cpp
index 90204e0..2d623b2 100644
--- a/WebCore/html/HTMLMapElement.cpp
+++ b/WebCore/html/HTMLMapElement.cpp
@@ -78,9 +78,9 @@ bool HTMLMapElement::mapMouseEvent(int x, int y, const IntSize& size, HitTestRes
void HTMLMapElement::parseMappedAttribute(MappedAttribute* attr)
{
const QualifiedName& attrName = attr->name();
- if (attrName == idAttr || attrName == nameAttr) {
+ if (attrName == idAttributeName() || attrName == nameAttr) {
Document* doc = document();
- if (attrName == idAttr) {
+ if (attrName == idAttributeName()) {
// Call base class so that hasID bit gets set.
HTMLElement::parseMappedAttribute(attr);
if (doc->isHTMLDocument())
diff --git a/WebCore/html/HTMLNameCollection.cpp b/WebCore/html/HTMLNameCollection.cpp
index d5657da..eb88c02 100644
--- a/WebCore/html/HTMLNameCollection.cpp
+++ b/WebCore/html/HTMLNameCollection.cpp
@@ -63,7 +63,7 @@ Element* HTMLNameCollection::itemAfter(Element* previous) const
e->hasTagName(objectTag))
if (e->getAttribute(nameAttr) == m_name)
return e;
- if (e->getAttribute(idAttr) == m_name)
+ if (e->getAttribute(e->idAttributeName()) == m_name)
return e;
break;
case DocumentNamedItems:
@@ -74,14 +74,14 @@ Element* HTMLNameCollection::itemAfter(Element* previous) const
if (e->getAttribute(nameAttr) == m_name)
return e;
} else if (e->hasTagName(appletTag)) {
- if (e->getAttribute(nameAttr) == m_name || e->getAttribute(idAttr) == m_name)
+ if (e->getAttribute(nameAttr) == m_name || e->getAttribute(e->idAttributeName()) == m_name)
return e;
} else if (e->hasTagName(objectTag)) {
- if ((e->getAttribute(nameAttr) == m_name || e->getAttribute(idAttr) == m_name)
+ if ((e->getAttribute(nameAttr) == m_name || e->getAttribute(e->idAttributeName()) == m_name)
&& static_cast<HTMLObjectElement*>(e)->isDocNamedItem())
return e;
} else if (e->hasTagName(imgTag)) {
- if (e->getAttribute(nameAttr) == m_name || (e->getAttribute(idAttr) == m_name && e->hasAttribute(nameAttr)))
+ if (e->getAttribute(nameAttr) == m_name || (e->getAttribute(e->idAttributeName()) == m_name && e->hasAttribute(nameAttr)))
return e;
}
break;
diff --git a/WebCore/html/HTMLObjectElement.cpp b/WebCore/html/HTMLObjectElement.cpp
index d3ccfa4..7a6a14d 100644
--- a/WebCore/html/HTMLObjectElement.cpp
+++ b/WebCore/html/HTMLObjectElement.cpp
@@ -107,7 +107,7 @@ void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
document->addNamedItem(newName);
}
m_name = newName;
- } else if (attr->name() == idAttr) {
+ } else if (attr->name() == idAttributeName()) {
const AtomicString& newId = attr->value();
if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {
HTMLDocument* document = static_cast<HTMLDocument*>(this->document());
diff --git a/WebCore/html/HTMLParamElement.cpp b/WebCore/html/HTMLParamElement.cpp
index d5fc6e7..2b0637a 100644
--- a/WebCore/html/HTMLParamElement.cpp
+++ b/WebCore/html/HTMLParamElement.cpp
@@ -43,7 +43,7 @@ HTMLParamElement::~HTMLParamElement()
void HTMLParamElement::parseMappedAttribute(MappedAttribute* attr)
{
- if (attr->name() == idAttr) {
+ if (attr->name() == idAttributeName()) {
// Must call base class so that hasID bit gets set.
HTMLElement::parseMappedAttribute(attr);
if (document()->isHTMLDocument())
diff --git a/WebCore/loader/CachedFont.cpp b/WebCore/loader/CachedFont.cpp
index 9cf152d..51b1e97 100644
--- a/WebCore/loader/CachedFont.cpp
+++ b/WebCore/loader/CachedFont.cpp
@@ -165,7 +165,7 @@ SVGFontElement* CachedFont::getSVGFontById(const String& fontName) const
Node* node = list->item(i);
ASSERT(node);
- if (static_cast<Element*>(node)->getAttribute(HTMLNames::idAttr) != fontName)
+ if (static_cast<Element*>(node)->getAttribute(static_cast<Element*>(node)->idAttributeName()) != fontName)
continue;
ASSERT(node->hasTagName(SVGNames::fontTag));
diff --git a/WebCore/rendering/RenderLayerBacking.cpp b/WebCore/rendering/RenderLayerBacking.cpp
index 8c092c6..dcf129e 100644
--- a/WebCore/rendering/RenderLayerBacking.cpp
+++ b/WebCore/rendering/RenderLayerBacking.cpp
@@ -86,7 +86,7 @@ void RenderLayerBacking::createGraphicsLayer()
m_graphicsLayer->setName("Document Node");
else {
if (renderer()->node()->isHTMLElement() && renderer()->node()->hasID())
- m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->getAttribute(idAttr));
+ m_graphicsLayer->setName(renderer()->renderName() + String(" ") + static_cast<HTMLElement*>(renderer()->node())->getIDAttribute());
else
m_graphicsLayer->setName(renderer()->renderName());
}
diff --git a/WebCore/rendering/SVGRenderTreeAsText.cpp b/WebCore/rendering/SVGRenderTreeAsText.cpp
index 28e506a..5aa53a2 100644
--- a/WebCore/rendering/SVGRenderTreeAsText.cpp
+++ b/WebCore/rendering/SVGRenderTreeAsText.cpp
@@ -525,7 +525,7 @@ void writeRenderResources(TextStream& ts, Node* parent)
if (!resource)
continue;
- String elementId = svgElement->getAttribute(HTMLNames::idAttr);
+ String elementId = svgElement->getAttribute(svgElement->idAttributeName());
// FIXME: These names are lies!
if (resource->isPaintServer()) {
RefPtr<SVGPaintServer> paintServer = WTF::static_pointer_cast<SVGPaintServer>(resource);
diff --git a/WebCore/svg/SVGElement.cpp b/WebCore/svg/SVGElement.cpp
index 27e8c04..a0d2d00 100644
--- a/WebCore/svg/SVGElement.cpp
+++ b/WebCore/svg/SVGElement.cpp
@@ -234,7 +234,7 @@ void SVGElement::insertedIntoDocument()
StyledElement::insertedIntoDocument();
SVGDocumentExtensions* extensions = document()->accessSVGExtensions();
- String resourceId = SVGURIReference::getTarget(getAttribute(idAttr));
+ String resourceId = SVGURIReference::getTarget(getAttribute(idAttributeName()));
if (extensions->isPendingResource(resourceId)) {
std::auto_ptr<HashSet<SVGStyledElement*> > clients(extensions->removePendingResource(resourceId));
if (clients->isEmpty())
diff --git a/WebCore/svg/SVGStyledElement.cpp b/WebCore/svg/SVGStyledElement.cpp
index 4cf942a..c0cd5d9 100644
--- a/WebCore/svg/SVGStyledElement.cpp
+++ b/WebCore/svg/SVGStyledElement.cpp
@@ -189,7 +189,7 @@ bool SVGStyledElement::isKnownAttribute(const QualifiedName& attrName)
if (propId > 0)
return true;
- return (attrName == HTMLNames::idAttr || attrName == HTMLNames::styleAttr);
+ return (attrName == idAttributeName() || attrName == HTMLNames::styleAttr);
}
void SVGStyledElement::svgAttributeChanged(const QualifiedName& attrName)
diff --git a/WebCore/wml/WMLElement.cpp b/WebCore/wml/WMLElement.cpp
index 50b0fe4..3004aba 100644
--- a/WebCore/wml/WMLElement.cpp
+++ b/WebCore/wml/WMLElement.cpp
@@ -60,7 +60,7 @@ bool WMLElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry&
void WMLElement::parseMappedAttribute(MappedAttribute* attr)
{
- if (attr->name() == HTMLNames::idAttr
+ if (attr->name() == idAttributeName()
|| attr->name() == HTMLNames::classAttr
|| attr->name() == HTMLNames::styleAttr)
return StyledElement::parseMappedAttribute(attr);
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list