Diff
Modified: trunk/LayoutTests/ChangeLog (203042 => 203043)
--- trunk/LayoutTests/ChangeLog 2016-07-10 21:46:34 UTC (rev 203042)
+++ trunk/LayoutTests/ChangeLog 2016-07-10 23:28:06 UTC (rev 203043)
@@ -1,3 +1,18 @@
+2016-07-10 Chris Dumez <[email protected]>
+
+ adoptNode() changes css class to lowercase for document loaded with XHR responseType = "document"
+ https://bugs.webkit.org/show_bug.cgi?id=159555
+ <rdar://problem/27252541>
+
+ Reviewed by Benjamin Poulain.
+
+ Add test coverage.
+
+ * fast/dom/Document/adoptNode-quirks-mismatch2-expected.txt: Added.
+ * fast/dom/Document/adoptNode-quirks-mismatch2.html: Added.
+ * fast/dom/Document/resources/document-noquirks-class.html: Added.
+ * fast/dom/Document/resources/document-noquirks-id.html: Added.
+
2016-07-10 Caio Lima <[email protected]>
ECMAScript 2016: %TypedArray%.prototype.includes implementation
Added: trunk/LayoutTests/fast/dom/Document/adoptNode-quirks-mismatch2-expected.txt (0 => 203043)
--- trunk/LayoutTests/fast/dom/Document/adoptNode-quirks-mismatch2-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/adoptNode-quirks-mismatch2-expected.txt 2016-07-10 23:28:06 UTC (rev 203043)
@@ -0,0 +1,14 @@
+Tests that Document.adoptNode() properly deals with the documents having a different quirks mode
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+MyClass
+
+MyId
+
+PASS window.getComputedStyle(container.lastChild).color is "rgb(0, 128, 0)"
+PASS window.getComputedStyle(container.lastChild).color is "rgb(0, 128, 0)"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/fast/dom/Document/adoptNode-quirks-mismatch2.html (0 => 203043)
--- trunk/LayoutTests/fast/dom/Document/adoptNode-quirks-mismatch2.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/adoptNode-quirks-mismatch2.html 2016-07-10 23:28:06 UTC (rev 203043)
@@ -0,0 +1,55 @@
+<html>
+<head>
+<script src=""
+<style>
+.myclass, #myid
+{
+ color: green;
+ font-weight: bold;
+}
+</style>
+</head>
+<body>
+<div id="description"></div>
+<div id="container"></div>
+<div id="console"></div>
+<script>
+description("Tests that Document.adoptNode() properly deals with the documents having a different quirks mode");
+jsTestIsAsync = true;
+
+var tests = ["resources/document-noquirks-class.html", "resources/document-noquirks-id.html"];
+var currentTest = -1;
+
+function documentLoaded()
+{
+ var parsedBodyChild = this.response.body.children[0];
+
+ var container = document.getElementById("container");
+ container.appendChild(document.adoptNode(parsedBodyChild));
+
+ shouldBeEqualToString("window.getComputedStyle(container.lastChild).color", "rgb(0, 128, 0)");
+
+ runNextTest();
+}
+
+function runNextTest()
+{
+ currentTest++;
+ if (currentTest >= tests.length) {
+ finishJSTest();
+ return;
+ }
+
+ var xhr = new XMLHttpRequest();
+ xhr.responseType = "document";
+ xhr.addEventListener("load", documentLoaded);
+ xhr.open("GET", tests[currentTest], true);
+
+ xhr.send();
+}
+
+runNextTest();
+</script>
+<script src=""
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/Document/resources/document-noquirks-class.html (0 => 203043)
--- trunk/LayoutTests/fast/dom/Document/resources/document-noquirks-class.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/resources/document-noquirks-class.html 2016-07-10 23:28:06 UTC (rev 203043)
@@ -0,0 +1,8 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div class="myClass">
+<p>MyClass</p>
+</div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/dom/Document/resources/document-noquirks-id.html (0 => 203043)
--- trunk/LayoutTests/fast/dom/Document/resources/document-noquirks-id.html (rev 0)
+++ trunk/LayoutTests/fast/dom/Document/resources/document-noquirks-id.html 2016-07-10 23:28:06 UTC (rev 203043)
@@ -0,0 +1,8 @@
+<!DOCTYPE hml>
+<html>
+<body>
+<div id="myId">
+<p>MyId</p>
+</div>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (203042 => 203043)
--- trunk/Source/WebCore/ChangeLog 2016-07-10 21:46:34 UTC (rev 203042)
+++ trunk/Source/WebCore/ChangeLog 2016-07-10 23:28:06 UTC (rev 203043)
@@ -1,3 +1,20 @@
+2016-07-10 Chris Dumez <[email protected]>
+
+ adoptNode() changes css class to lowercase for document loaded with XHR responseType = "document"
+ https://bugs.webkit.org/show_bug.cgi?id=159555
+ <rdar://problem/27252541>
+
+ Reviewed by Benjamin Poulain.
+
+ Follow-up on r203018 which was incomplete. We need to update ElementData's
+ m_classNames / m_idForStyleResolution when the source document is in strict
+ mode and the destination document is in quirks mode as well.
+
+ Test: fast/dom/Document/adoptNode-quirks-mismatch2.html
+
+ * dom/Element.cpp:
+ (WebCore::Element::didMoveToNewDocument):
+
2016-07-10 Sam Weinig <[email protected]>
Rename isEmojiModifier to isEmojiFitzpatrickModifier to better capture its function
Modified: trunk/Source/WebCore/dom/Element.cpp (203042 => 203043)
--- trunk/Source/WebCore/dom/Element.cpp 2016-07-10 21:46:34 UTC (rev 203042)
+++ trunk/Source/WebCore/dom/Element.cpp 2016-07-10 23:28:06 UTC (rev 203043)
@@ -1458,8 +1458,8 @@
{
Node::didMoveToNewDocument(oldDocument);
- if (oldDocument->inQuirksMode() && !document().inQuirksMode()) {
- // ElementData::m_classNames or ElementData::m_idForStyleResolution have folded case, we need to update them.
+ if (oldDocument->inQuirksMode() != document().inQuirksMode()) {
+ // ElementData::m_classNames or ElementData::m_idForStyleResolution need to be updated with the right case.
if (hasID())
attributeChanged(idAttr, nullAtom, getIdAttribute());
if (hasClass())