Diff
Modified: trunk/LayoutTests/ChangeLog (109178 => 109179)
--- trunk/LayoutTests/ChangeLog 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/ChangeLog 2012-02-29 01:43:50 UTC (rev 109179)
@@ -1,3 +1,20 @@
+2012-02-27 MORITA Hajime <[email protected]>
+
+ <content> element should behave as HTMLUnknownElement outside of a shadow DOM subtree
+ https://bugs.webkit.org/show_bug.cgi?id=79551
+
+ Reviewed by Dimitri Glazkov.
+
+ * fast/dom/shadow/content-element-outside-shadow-style-expected.html: Added.
+ * fast/dom/shadow/content-element-outside-shadow-style.html: Added.
+ * fast/dom/shadow/content-element-outside-shadow.html:
+ * platform/efl/Skipped:
+ * platform/gtk/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * platform/wk2/Skipped:
+
2012-02-28 Gavin Barraclough <[email protected]>
[[Get]]/[[Put]] for primitives should not wrap on strict accessor call
Added: trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style-expected.html (0 => 109179)
--- trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style-expected.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style-expected.html 2012-02-29 01:43:50 UTC (rev 109179)
@@ -0,0 +1,18 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+span {
+ color: blue;
+}
+</style>
+</head>
+<body>
+ <div>
+ <span>Should be colored blue.</span>
+ </div>
+ <div>
+ <div>Should have no cool color.</div>
+ <div>Should have no cool color either.</div>
+ </div>
+</body>
Property changes on: trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style-expected.html
___________________________________________________________________
Added: svn:eol-style
Added: trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style.html (0 => 109179)
--- trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style.html (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style.html 2012-02-29 01:43:50 UTC (rev 109179)
@@ -0,0 +1,31 @@
+<!DOCTYPE html>
+<html>
+<head>
+<style>
+content {
+ color: blue;
+}
+</style>
+</head>
+<body>
+ <div>
+ <content>Should be colored blue.</content>
+ </div>
+ <div>
+ <div id="hostWithChild">Should have no cool color.</div>
+ <content id="toBeMoved">Should have no cool color either.</content>
+ <div id="hostEmpty"></div>
+ </div>
+<script>
+// Ensures that distributed shadow child isn't effected by the style.
+var hostWithChild = document.getElementById("hostWithChild");
+var shadowForHostWithChild = new WebKitShadowRoot(hostWithChild);
+shadowForHostWithChild.appendChild(document.createElement("content"));
+
+// Also ensures that dynamically moved <content> elements do work.
+var hostEmpty = document.getElementById("hostEmpty");
+var shadowForHostEmpty = new WebKitShadowRoot(hostEmpty);
+shadowForHostEmpty.appendChild(document.getElementById("toBeMoved"));
+
+</script>
+</body>
Property changes on: trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow-style.html
___________________________________________________________________
Added: svn:eol-style
Modified: trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow.html (109178 => 109179)
--- trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow.html 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/fast/dom/shadow/content-element-outside-shadow.html 2012-02-29 01:43:50 UTC (rev 109179)
@@ -18,17 +18,17 @@
var cases = [
["<div><content></content></div>",
- "<div></div>"],
+ "<div><unknown></unknown></div>"],
["<div><content>Here is a text.</content></div>",
- "<div>Here is a text.</div>"],
+ "<div><unknown>Here is a text.</unknown></div>"],
["<div><content><div>Here is a </div><div>series of</div><div>blocks</div></content></div>",
- "<div><div>Here is a </div><div>series of</div><div>blocks</div></div>"],
+ "<div><unknown><div>Here is a </div><div>series of</div><div>blocks</div></unknown></div>"],
["<div><content><span>Here is a<span><span>series of</span><span>inlines.</span></content></div>",
- "<div><span>Here is a<span><span>series of</span><span>inlines.</span></div>"],
+ "<div><unknown><span>Here is a<span><span>series of</span><span>inlines.</span></unknown></div>"],
["<div><content>Here is a <content>nested content</content> inside content.</content></div>",
- "<div>Here is a <" + "!-- --" + ">nested content<" + "!-- --" + "> inside content.</div>"],
+ "<div><unknown>Here is a <unknown>nested content</unknown> inside content.</unknown></div>"],
["<div><content>Here is a <div>block and <content>nested content</content> inside the block</div>.</content></div>",
- "<div>Here is a <div>block and <!" + "-- --" + ">nested content<!" + "-- --" + "> inside the block</div>.</div>"]
+ "<div><unknown>Here is a <div>block and <unknown>nested content</unknown> inside the block</div>.</unknown></div>"]
];
var targetContainer = document.getElementById("targetContainer");
@@ -41,6 +41,7 @@
targetContainer.innerHTML = targetMarkup;
comparisonContainer.innerHTML = expectedMarkup;
targetRenderTree = removeContainerLines(window.internals.elementRenderTreeAsText(targetContainer));
+ targetRenderTree = targetRenderTree.replace(/CONTENT/g, "UNKNOWN");
comparisonRenderTree = removeContainerLines(window.internals.elementRenderTreeAsText(comparisonContainer));
debug(escapeHTML(targetMarkup));
shouldBe("targetRenderTree", "comparisonRenderTree");
Modified: trunk/LayoutTests/platform/efl/Skipped (109178 => 109179)
--- trunk/LayoutTests/platform/efl/Skipped 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/platform/efl/Skipped 2012-02-29 01:43:50 UTC (rev 109179)
@@ -2087,6 +2087,7 @@
# ENABLE(SHADOW_DOM) is disabled.
fast/dom/shadow/content-element-api.html
fast/dom/shadow/content-element-outside-shadow.html
+fast/dom/shadow/content-element-outside-shadow-style.html
fast/dom/shadow/shadow-root-js-api.html
fast/dom/shadow/shadow-disable.html
fast/dom/shadow/shadow-root-attached.html
Modified: trunk/LayoutTests/platform/mac/Skipped (109178 => 109179)
--- trunk/LayoutTests/platform/mac/Skipped 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/platform/mac/Skipped 2012-02-29 01:43:50 UTC (rev 109179)
@@ -425,6 +425,7 @@
# ENABLE(SHADOW_DOM) is disabled.
fast/dom/shadow/content-element-api.html
fast/dom/shadow/content-element-outside-shadow.html
+fast/dom/shadow/content-element-outside-shadow-style.html
fast/dom/shadow/shadow-root-js-api.html
fast/dom/shadow/shadow-disable.html
fast/dom/shadow/shadow-root-attached.html
Modified: trunk/LayoutTests/platform/qt/Skipped (109178 => 109179)
--- trunk/LayoutTests/platform/qt/Skipped 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/platform/qt/Skipped 2012-02-29 01:43:50 UTC (rev 109179)
@@ -161,6 +161,7 @@
# ENABLE(SHADOW_DOM) is disabled.
fast/dom/shadow/content-element-api.html
fast/dom/shadow/content-element-outside-shadow.html
+fast/dom/shadow/content-element-outside-shadow-style.html
fast/dom/shadow/iframe-shadow.html
fast/dom/shadow/shadow-root-js-api.html
fast/dom/shadow/shadow-disable.html
Modified: trunk/LayoutTests/platform/win/Skipped (109178 => 109179)
--- trunk/LayoutTests/platform/win/Skipped 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/platform/win/Skipped 2012-02-29 01:43:50 UTC (rev 109179)
@@ -1451,6 +1451,7 @@
# ENABLE(SHADOW_DOM) is disabled.
fast/dom/shadow/content-element-api.html
fast/dom/shadow/content-element-outside-shadow.html
+fast/dom/shadow/content-element-outside-shadow-style.html
fast/dom/shadow/shadow-root-js-api.html
fast/dom/shadow/shadow-disable.html
fast/dom/shadow/shadow-root-attached.html
Modified: trunk/LayoutTests/platform/wk2/Skipped (109178 => 109179)
--- trunk/LayoutTests/platform/wk2/Skipped 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/LayoutTests/platform/wk2/Skipped 2012-02-29 01:43:50 UTC (rev 109179)
@@ -1065,6 +1065,7 @@
# ENABLE(SHADOW_DOM) is disabled.
fast/dom/shadow/content-element-api.html
fast/dom/shadow/content-element-outside-shadow.html
+fast/dom/shadow/content-element-outside-shadow-style.html
fast/dom/shadow/shadow-root-js-api.html
fast/dom/shadow/shadow-disable.html
fast/dom/shadow/shadow-root-attached.html
Modified: trunk/Source/WebCore/ChangeLog (109178 => 109179)
--- trunk/Source/WebCore/ChangeLog 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/ChangeLog 2012-02-29 01:43:50 UTC (rev 109179)
@@ -1,3 +1,35 @@
+2012-02-27 MORITA Hajime <[email protected]>
+
+ <content> element should behave as HTMLUnknownElement outside of a shadow DOM subtree
+ https://bugs.webkit.org/show_bug.cgi?id=79551
+
+ Reviewed by Dimitri Glazkov.
+
+ The problem happened because HTMLContentElement doesn't create renderer anytime.
+
+ This change allows it to create a renderer unless the HTMLContentElement is shadowed.
+ Since this could happen not only on <content> but also on upcoming <shadow>,
+ the corresponding part of the code is pulled up to InsertionPoint.
+
+ Tests: fast/dom/shadow/content-element-outside-shadow-style-expected.html
+ fast/dom/shadow/content-element-outside-shadow-style.html
+
+ * dom/NodeRenderingContext.cpp:
+ (WebCore::NodeRenderingContext::NodeRenderingContext):
+ * dom/ShadowRoot.h:
+ (WebCore):
+ (WebCore::TreeScope::isShadowRoot):
+ * dom/TreeScope.h:
+ (TreeScope):
+ * html/shadow/HTMLContentElement.h:
+ * html/shadow/InsertionPoint.cpp:
+ (WebCore::InsertionPoint::isShadowBoundary):
+ (WebCore):
+ * html/shadow/InsertionPoint.h:
+ (InsertionPoint):
+ (WebCore::isShadowBoundary):
+ (WebCore):
+
2012-02-28 Daniel Cheng <[email protected]>
Clipboard::getData should return an empty string instead of undefined
Modified: trunk/Source/WebCore/dom/NodeRenderingContext.cpp (109178 => 109179)
--- trunk/Source/WebCore/dom/NodeRenderingContext.cpp 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/dom/NodeRenderingContext.cpp 2012-02-29 01:43:50 UTC (rev 109179)
@@ -87,7 +87,7 @@
return;
}
- if (isInsertionPoint(parent)) {
+ if (isShadowBoundary(parent)) {
if (toInsertionPoint(parent)->hasSelection())
m_phase = AttachingNotFallbacked;
else
Modified: trunk/Source/WebCore/dom/ShadowRoot.h (109178 => 109179)
--- trunk/Source/WebCore/dom/ShadowRoot.h 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/dom/ShadowRoot.h 2012-02-29 01:43:50 UTC (rev 109179)
@@ -102,6 +102,12 @@
return const_cast<ShadowRoot*>(toShadowRoot(static_cast<const Node*>(node)));
}
+// Put this TreeScope method here to inline it.
+inline bool TreeScope::isShadowRoot() const
+{
+ return m_rootNode->isShadowRoot();
+}
+
} // namespace
#endif
Modified: trunk/Source/WebCore/dom/TreeScope.h (109178 => 109179)
--- trunk/Source/WebCore/dom/TreeScope.h 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/dom/TreeScope.h 2012-02-29 01:43:50 UTC (rev 109179)
@@ -60,6 +60,7 @@
void addNodeListCache() { ++m_numNodeListCaches; }
void removeNodeListCache() { ASSERT(m_numNodeListCaches > 0); --m_numNodeListCaches; }
bool hasNodeListCaches() const { return m_numNodeListCaches; }
+ bool isShadowRoot() const;
// Find first anchor with the given name.
// First searches for an element with the given ID, but if that fails, then looks
Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.h (109178 => 109179)
--- trunk/Source/WebCore/html/shadow/HTMLContentElement.h 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.h 2012-02-29 01:43:50 UTC (rev 109179)
@@ -63,9 +63,6 @@
private:
virtual bool isContentElement() const { return true; }
- virtual bool rendererIsNeeded(const NodeRenderingContext&) { return false; }
- virtual RenderObject* createRenderer(RenderArena*, RenderStyle*) { return 0; }
-
virtual void parseAttribute(Attribute*) OVERRIDE;
};
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (109178 => 109179)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp 2012-02-29 01:43:50 UTC (rev 109179)
@@ -31,6 +31,8 @@
#include "config.h"
#include "InsertionPoint.h"
+#include "ShadowRoot.h"
+
namespace WebCore {
InsertionPoint::InsertionPoint(const QualifiedName& tagName, Document* document)
@@ -43,4 +45,16 @@
{
}
+bool InsertionPoint::isShadowBoundary() const
+{
+ if (TreeScope* scope = treeScope())
+ return scope->isShadowRoot();
+ return false;
+}
+
+bool InsertionPoint::rendererIsNeeded(const NodeRenderingContext& context)
+{
+ return !isShadowBoundary() && HTMLElement::rendererIsNeeded(context);
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (109178 => 109179)
--- trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-02-29 01:40:13 UTC (rev 109178)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h 2012-02-29 01:43:50 UTC (rev 109179)
@@ -42,9 +42,12 @@
const HTMLContentSelectionList* selections() const { return &m_selections; }
bool hasSelection() const { return m_selections.first(); }
+ bool isShadowBoundary() const;
protected:
InsertionPoint(const QualifiedName&, Document*);
+ virtual bool rendererIsNeeded(const NodeRenderingContext&) OVERRIDE;
+
HTMLContentSelectionList m_selections;
};
@@ -64,6 +67,13 @@
return static_cast<InsertionPoint*>(node);
}
+inline bool isShadowBoundary(Node* node)
+{
+ if (!isInsertionPoint(node))
+ return false;
+ return toInsertionPoint(node)->isShadowBoundary();
+}
+
} // namespace WebCore
#endif // InsertionPoint_h