Diff
Modified: trunk/LayoutTests/ChangeLog (198989 => 198990)
--- trunk/LayoutTests/ChangeLog 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/LayoutTests/ChangeLog 2016-04-03 20:19:47 UTC (rev 198990)
@@ -1,3 +1,13 @@
+2016-04-03 Antti Koivisto <[email protected]>
+
+ Shadow DOM: Slot style is not computed
+ https://bugs.webkit.org/show_bug.cgi?id=156144
+
+ Reviewed by Darin Adler.
+
+ * fast/shadow-dom/css-scoping-shadow-slot-style-expected.html: Added.
+ * fast/shadow-dom/css-scoping-shadow-slot-style.html: Added.
+
2016-04-03 Saam barati <[email protected]>
Implement Annex B.3.3 function hoisting rules for function code
Modified: trunk/LayoutTests/editing/execCommand/justify-right-then-indent-with-problematic-body-expected.txt (198989 => 198990)
--- trunk/LayoutTests/editing/execCommand/justify-right-then-indent-with-problematic-body-expected.txt 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/LayoutTests/editing/execCommand/justify-right-then-indent-with-problematic-body-expected.txt 2016-04-03 20:19:47 UTC (rev 198990)
@@ -1,3 +1,4 @@
Pass.
+
WebKit didn't Crash.
Added: trunk/LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-style-expected.html (0 => 198990)
--- trunk/LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-style-expected.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-style-expected.html 2016-04-03 20:19:47 UTC (rev 198990)
@@ -0,0 +1,7 @@
+<!DOCTYPE html>
+<html>
+<body>
+ <p>Test passes if you see a single 100px by 100px green box below.</p>
+ <div style="width: 100px; height: 100px; background: green;"></div>
+</body>
+</html>
Added: trunk/LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-style.html (0 => 198990)
--- trunk/LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-style.html (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/css-scoping-shadow-slot-style.html 2016-04-03 20:19:47 UTC (rev 198990)
@@ -0,0 +1,47 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>CSS Scoping - ensure that slot style is inherited by slotted children</title>
+ <link rel="author" title="Ryosuke Niwa" href=""
+ <link rel="help" href=""
+ <link rel="match" href=""
+</head>
+<body>
+ <style>
+ my-host, my-non-host {
+ display: block;
+ width: 100px;
+ height: 50px;
+ overflow: hidden;
+ background: red;
+ color: red;
+ }
+ div {
+ width: 100%;
+ height: 50%;
+ }
+ </style>
+ <p>Test passes if you see a single 100px by 100px green box below.</p>
+ <my-host>
+ <div slot="green" style="background: green;">FAIL</div>
+ <div slot="green" style="background: inherit;">FAIL</div>
+ </my-host>
+ <my-non-host>
+ <slot name="green" style="color: green; background: green">
+ <div slot="green" style="background: green;">FAIL</div>
+ <div slot="green" style="background: inherit;">FAIL</div>
+ </slot>
+ </my-non-host>
+ <script>
+
+ try {
+ var shadowHost = document.querySelector('my-host');
+ shadowRoot = shadowHost.attachShadow({mode: 'open'});
+ shadowRoot.innerHTML = '<slot name="green" style="color: green; background: green"></slot>';
+ } catch (exception) {
+ document.body.appendChild(document.createTextNode(exception));
+ }
+
+ </script>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (198989 => 198990)
--- trunk/Source/WebCore/ChangeLog 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/Source/WebCore/ChangeLog 2016-04-03 20:19:47 UTC (rev 198990)
@@ -1,3 +1,55 @@
+2016-04-03 Antti Koivisto <[email protected]>
+
+ Shadow DOM: Slot style is not computed
+ https://bugs.webkit.org/show_bug.cgi?id=156144
+
+ Reviewed by Darin Adler.
+
+ We don’t currently compute style for active slots. While slots have have implicit display:contents and don’t create
+ boxes themselves the style should still inherit to slotted children.
+
+ Basically
+
+ <slot style=“color:red”></slot>
+
+ should work as expected.
+
+ The implementation falls out from the new style resolve architecture and this patch mostly just removes the special
+ case code that prevented this from working.
+
+ Test: fast/shadow-dom/css-scoping-shadow-slot-style.html
+
+ * html/HTMLSlotElement.h:
+ (WebCore::hasImplicitDisplayContents):
+
+ Move to a shared location.
+
+ * style/RenderTreeUpdater.cpp:
+ (WebCore::RenderTreeUpdater::RenderTreeUpdater):
+ (WebCore::findRenderingRoot):
+ (WebCore::RenderTreeUpdater::updateRenderTree):
+
+ Remove the special case code. What remains is a display:contents test for rendererless elements.
+
+ (WebCore::RenderTreeUpdater::updateElementRenderer):
+
+ Don't create renderers for (implicit) display:contents.
+
+ (WebCore::hasDisplayContents): Deleted.
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::detachRenderTree):
+ (WebCore::Style::affectsRenderedSubtree):
+
+ Factor into a function.
+
+ (WebCore::Style::TreeResolver::resolveElement):
+
+ Remove the special case code.
+
+ (WebCore::Style::TreeResolver::resolveComposedTree):
+
+ Always resolve slots as we don't currently save their style.
+
2016-04-03 David Kilzer <[email protected]>
REGRESSION (r198653, r198864): http/tests/contentdispositionattachmentsandbox/referer-header-stripped*.html tests crashing due to unavailable SPI
Modified: trunk/Source/WebCore/html/HTMLSlotElement.h (198989 => 198990)
--- trunk/Source/WebCore/html/HTMLSlotElement.h 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/Source/WebCore/html/HTMLSlotElement.h 2016-04-03 20:19:47 UTC (rev 198990)
@@ -53,7 +53,18 @@
bool m_hasEnqueuedSlotChangeEvent { false };
};
+// Slots have implicit display:contents until it is supported for reals.
+inline bool hasImplicitDisplayContents(const Element& element) { return is<HTMLSlotElement>(element); }
+
}
+#else
+
+namespace WebCore {
+
+inline bool hasImplicitDisplayContents(const Element&) { return false; }
+
+}
+
#endif
#endif
Modified: trunk/Source/WebCore/style/RenderTreePosition.cpp (198989 => 198990)
--- trunk/Source/WebCore/style/RenderTreePosition.cpp 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/Source/WebCore/style/RenderTreePosition.cpp 2016-04-03 20:19:47 UTC (rev 198990)
@@ -89,7 +89,7 @@
while (it != end) {
auto& node = *it;
- bool hasDisplayContents = is<HTMLSlotElement>(node);
+ bool hasDisplayContents = is<Element>(node) && hasImplicitDisplayContents(downcast<Element>(node));
if (hasDisplayContents) {
it.traverseNext();
continue;
Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (198989 => 198990)
--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp 2016-04-03 20:19:47 UTC (rev 198990)
@@ -61,19 +61,13 @@
{
}
-// Slots have implicit display:contents until it is supported for reals.
-static bool hasDisplayContents(const Node& node)
-{
- return is<HTMLSlotElement>(node);
-}
-
static ContainerNode& findRenderingRoot(ContainerNode& node)
{
auto& document = node.document();
for (ComposedTreeAncestorIterator it(document, node), end(document); it != end; ++it) {
if (it->renderer())
return *it;
- ASSERT(hasDisplayContents(*it));
+ ASSERT(hasImplicitDisplayContents(downcast<Element>(*it)));
}
ASSERT_NOT_REACHED();
return document;
@@ -137,29 +131,20 @@
auto& element = downcast<Element>(node);
auto* elementUpdate = m_styleUpdate->elementUpdate(element);
-
- auto changeType = Style::NoChange;
- if (elementUpdate) {
- if (hasDisplayContents(element)) {
- if (!shouldCreateRenderer(element, renderTreePosition().parent())) {
- it.traverseNextSkippingChildren();
- continue;
- }
- pushParent(element, parent().styleChange);
- it.traverseNext();
- continue;
- }
-
- updateElementRenderer(element, *elementUpdate);
- changeType = elementUpdate->change;
+ if (!elementUpdate) {
+ it.traverseNextSkippingChildren();
+ continue;
}
- if (!element.renderer() || !elementUpdate) {
+ updateElementRenderer(element, *elementUpdate);
+
+ bool mayHaveRenderedDescendants = element.renderer() || (hasImplicitDisplayContents(element) && shouldCreateRenderer(element, renderTreePosition().parent()));
+ if (!mayHaveRenderedDescendants) {
it.traverseNextSkippingChildren();
continue;
}
- pushParent(element, changeType);
+ pushParent(element, elementUpdate ? elementUpdate->change : Style::NoChange);
it.traverseNext();
}
@@ -246,7 +231,7 @@
if (shouldTearDownRenderers)
detachRenderTree(element, Style::ReattachDetach);
- bool shouldCreateNewRenderer = !element.renderer() && update.style;
+ bool shouldCreateNewRenderer = !element.renderer() && update.style && !hasImplicitDisplayContents(element);
if (shouldCreateNewRenderer) {
if (element.hasCustomStyleResolveCallbacks())
element.willAttachRenderers();
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (198989 => 198990)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2016-04-03 19:45:05 UTC (rev 198989)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2016-04-03 20:19:47 UTC (rev 198990)
@@ -385,14 +385,29 @@
current.didDetachRenderers();
}
+static bool affectsRenderedSubtree(Element& element, const RenderStyle& newStyle)
+{
+ if (element.renderer())
+ return true;
+ if (newStyle.display() != NONE)
+ return true;
+ // FIXME: Make 'contents' an actual display property value.
+ if (hasImplicitDisplayContents(element))
+ return true;
+ if (element.rendererIsNeeded(newStyle))
+ return true;
+ if (element.shouldMoveToFlowThread(newStyle))
+ return true;
+ return false;
+}
+
ElementUpdate TreeResolver::resolveElement(Element& element)
{
auto newStyle = styleForElement(element, parent().style);
auto* renderer = element.renderer();
- bool affectsRenderedSubtree = renderer || newStyle->display() != NONE || element.rendererIsNeeded(newStyle) || element.shouldMoveToFlowThread(newStyle);
- if (!affectsRenderedSubtree)
+ if (!affectsRenderedSubtree(element, newStyle.get()))
return { };
ElementUpdate update;
@@ -599,7 +614,7 @@
ElementUpdate update;
update.style = element.renderStyle();
- bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling;
+ bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling || hasImplicitDisplayContents(element);
if (shouldResolve) {
#if PLATFORM(IOS)
CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(&element, element.renderStyle());
@@ -627,21 +642,6 @@
element.clearNeedsStyleRecalc();
}
-
-#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
- if (is<HTMLSlotElement>(element)) {
- // FIXME: We should compute style for the slot and use it as parent style.
- // Duplicate the style from the parent context.
- ElementUpdate slotUpdate;
- slotUpdate.style = parent.style.ptr();
- slotUpdate.change = update.change;
- if (!shouldResolve)
- m_update->addElement(element, parent.element, update);
- pushParent(element, slotUpdate);
- it.traverseNext();
- continue;
- }
-#endif
if (!update.style) {
resetStyleForNonRenderedDescendants(element);
element.clearChildNeedsStyleRecalc();