Diff
Modified: trunk/LayoutTests/ChangeLog (191228 => 191229)
--- trunk/LayoutTests/ChangeLog 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/LayoutTests/ChangeLog 2015-10-16 23:48:45 UTC (rev 191229)
@@ -1,3 +1,18 @@
+2015-10-16 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r191204.
+ https://bugs.webkit.org/show_bug.cgi?id=150263
+
+ This change is causing existing tests to fail (Requested by
+ ryanhaddad on #webkit).
+
+ Reverted changeset:
+
+ "Computed style should work correctly with slotted elements
+ that have display:none"
+ https://bugs.webkit.org/show_bug.cgi?id=150237
+ http://trac.webkit.org/changeset/191204
+
2015-10-16 Brady Eidson <beid...@apple.com>
Fix flakey test that was added for:
Modified: trunk/LayoutTests/editing/style/apply-style-atomic-expected.txt (191228 => 191229)
--- trunk/LayoutTests/editing/style/apply-style-atomic-expected.txt 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/LayoutTests/editing/style/apply-style-atomic-expected.txt 2015-10-16 23:48:45 UTC (rev 191229)
@@ -2,18 +2,19 @@
| <a>
| href=""
| "<#selection-anchor>1"
-| <progress>
-| <a>
-| style=""
-| "2"
-| <shadow:root>
-| <div>
-| pseudo="-webkit-progress-inner-element"
-| shadow:pseudoId="-webkit-progress-inner-element"
+| <progress>
+| <a>
+| style=""
+| "2"
+| <shadow:root>
| <div>
-| pseudo="-webkit-progress-bar"
-| shadow:pseudoId="-webkit-progress-bar"
+| pseudo="-webkit-progress-inner-element"
+| shadow:pseudoId="-webkit-progress-inner-element"
| <div>
-| pseudo="-webkit-progress-value"
-| style="width: -100%;"
-| shadow:pseudoId="-webkit-progress-value"
+| pseudo="-webkit-progress-bar"
+| shadow:pseudoId="-webkit-progress-bar"
+| <div>
+| pseudo="-webkit-progress-value"
+| style="width: -100%;"
+| shadow:pseudoId="-webkit-progress-value"
+| <#selection-focus>
Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt (191228 => 191229)
--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element-expected.txt 2015-10-16 23:48:45 UTC (rev 191229)
@@ -51,10 +51,10 @@
PASS Expected '0px' for padding in the computed style for element with id testBeforeAfterInline and pseudo-element :before and got '0px'
PASS Expected '0px' for margin in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got '0px'
PASS Expected '10px 20px 30px 40px' for padding in the computed style for element with id testBeforeAfterInline and pseudo-element :after and got '10px 20px 30px 40px'
-PASS Expected '100px' for width in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :after and got '100px'
-PASS Expected '100px' for height in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :after and got '100px'
-PASS Expected '100px' for width in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :before and got '100px'
-PASS Expected '100px' for height in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :before and got '100px'
+PASS Expected '' for width in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :after and got ''
+PASS Expected '' for height in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :after and got ''
+PASS Expected '' for width in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :before and got ''
+PASS Expected '' for height in the computed style for element with id testBeforeAfterDisplayNone and pseudo-element :before and got ''
PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element null and got 'rgb(165, 42, 42)'
PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :first-line and got 'rgb(165, 42, 42)'
PASS Expected 'rgb(165, 42, 42)' for color in the computed style for element with id testNoPseudoElement and pseudo-element :first-letter and got 'rgb(165, 42, 42)'
Modified: trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html (191228 => 191229)
--- trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/LayoutTests/fast/css/getComputedStyle/getComputedStyle-with-pseudo-element.html 2015-10-16 23:48:45 UTC (rev 191229)
@@ -168,10 +168,10 @@
{ 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':before', 'property' : 'padding', 'expectedValue' : '0px' },
{ 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'margin', 'expectedValue' : '0px' },
{ 'elementId' : 'testBeforeAfterInline', 'pseudoElement' : ':after', 'property' : 'padding', 'expectedValue' : '10px 20px 30px 40px' },
- { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':after', 'property' : 'width', 'expectedValue' : '100px' },
- { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':after', 'property' : 'height', 'expectedValue' : '100px' },
- { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':before', 'property' : 'width', 'expectedValue' : '100px' },
- { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':before', 'property' : 'height', 'expectedValue' : '100px' },
+ { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':after', 'property' : 'width', 'expectedValue' : '' },
+ { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':after', 'property' : 'height', 'expectedValue' : '' },
+ { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':before', 'property' : 'width', 'expectedValue' : '' },
+ { 'elementId' : 'testBeforeAfterDisplayNone', 'pseudoElement' : ':before', 'property' : 'height', 'expectedValue' : '' },
{ 'elementId' : 'testNoPseudoElement', 'pseudoElement' : null, 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
{ 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':first-line', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
{ 'elementId' : 'testNoPseudoElement', 'pseudoElement' : ':first-letter', 'property' : 'color', 'expectedValue' : 'rgb(165, 42, 42)' },
Deleted: trunk/LayoutTests/fast/shadow-dom/computed-style-display-none-expected.txt (191228 => 191229)
--- trunk/LayoutTests/fast/shadow-dom/computed-style-display-none-expected.txt 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/LayoutTests/fast/shadow-dom/computed-style-display-none-expected.txt 2015-10-16 23:48:45 UTC (rev 191229)
@@ -1,10 +0,0 @@
-Ensure tha slotted elements with display:none inherit their style via shadow tree
-
-On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
-
-
-PASS getComputedStyle(hostChild).color is "rgb(0, 128, 0)"
-PASS successfullyParsed is true
-
-TEST COMPLETE
-
Deleted: trunk/LayoutTests/fast/shadow-dom/computed-style-display-none.html (191228 => 191229)
--- trunk/LayoutTests/fast/shadow-dom/computed-style-display-none.html 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/LayoutTests/fast/shadow-dom/computed-style-display-none.html 2015-10-16 23:48:45 UTC (rev 191229)
@@ -1,24 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
-<meta charset="utf-8">
-<script src=""
-</head>
-<style>
-my-host { display: none; color: red; }
-</style>
-<body>
-<my-host><my-host-child></my-host-child></my-host>
-<script>
-description("Ensure tha slotted elements with display:none inherit their style via shadow tree");
-
-var host = document.querySelector("my-host");
-var shadowRoot = host.attachShadow({ mode: "closed"});
-shadowRoot.innerHTML = "<style>div { color: green }</style><div><slot></slot></div>";
-
-hostChild = document.querySelector("my-host-child");
-shouldBeEqualToString("getComputedStyle(hostChild).color", "rgb(0, 128, 0)");
-</script>
-<script src=""
-</body>
-</html>
Modified: trunk/Source/WebCore/ChangeLog (191228 => 191229)
--- trunk/Source/WebCore/ChangeLog 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/Source/WebCore/ChangeLog 2015-10-16 23:48:45 UTC (rev 191229)
@@ -1,3 +1,18 @@
+2015-10-16 Commit Queue <commit-qu...@webkit.org>
+
+ Unreviewed, rolling out r191204.
+ https://bugs.webkit.org/show_bug.cgi?id=150263
+
+ This change is causing existing tests to fail (Requested by
+ ryanhaddad on #webkit).
+
+ Reverted changeset:
+
+ "Computed style should work correctly with slotted elements
+ that have display:none"
+ https://bugs.webkit.org/show_bug.cgi?id=150237
+ http://trac.webkit.org/changeset/191204
+
2015-10-16 Alex Christensen <achristen...@webkit.org>
Disabled content blockers should not block any loads
Modified: trunk/Source/WebCore/dom/Document.cpp (191228 => 191229)
--- trunk/Source/WebCore/dom/Document.cpp 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/Source/WebCore/dom/Document.cpp 2015-10-16 23:48:45 UTC (rev 191229)
@@ -1954,15 +1954,15 @@
m_ignorePendingStylesheets = oldIgnore;
}
-Ref<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Element& element, RenderStyle* parentStyle)
+Ref<RenderStyle> Document::styleForElementIgnoringPendingStylesheets(Element* element)
{
- ASSERT(&element.document() == this);
+ ASSERT_ARG(element, &element->document() == this);
// On iOS request delegates called during styleForElement may result in re-entering WebKit and killing the style resolver.
ResourceLoadScheduler::Suspender suspender(*platformStrategies()->loaderStrategy()->resourceLoadScheduler());
TemporaryChange<bool> change(m_ignorePendingStylesheets, true);
- return element.resolveStyle(parentStyle);
+ return ensureStyleResolver().styleForElement(element, element->parentNode() ? element->parentNode()->computedStyle() : nullptr);
}
bool Document::updateLayoutIfDimensionsOutOfDate(Element& element, DimensionsCheck dimensionsCheck)
Modified: trunk/Source/WebCore/dom/Document.h (191228 => 191229)
--- trunk/Source/WebCore/dom/Document.h 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/Source/WebCore/dom/Document.h 2015-10-16 23:48:45 UTC (rev 191229)
@@ -570,7 +570,7 @@
};
WEBCORE_EXPORT void updateLayoutIgnorePendingStylesheets(RunPostLayoutTasks = RunPostLayoutTasks::Asynchronously);
- Ref<RenderStyle> styleForElementIgnoringPendingStylesheets(Element&, RenderStyle* parentStyle);
+ Ref<RenderStyle> styleForElementIgnoringPendingStylesheets(Element*);
// Returns true if page box (margin boxes and page borders) is visible.
WEBCORE_EXPORT bool isPageBoxVisible(int pageIndex);
Modified: trunk/Source/WebCore/dom/Element.cpp (191228 => 191229)
--- trunk/Source/WebCore/dom/Element.cpp 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/Source/WebCore/dom/Element.cpp 2015-10-16 23:48:45 UTC (rev 191229)
@@ -33,7 +33,6 @@
#include "ChromeClient.h"
#include "ClientRect.h"
#include "ClientRectList.h"
-#include "ComposedTreeAncestorIterator.h"
#include "ContainerNodeAlgorithms.h"
#include "DOMTokenList.h"
#include "Dictionary.h"
@@ -2435,79 +2434,44 @@
ensureElementRareData().setMinimumSizeForResizing(size);
}
-static PseudoElement* beforeOrAfterPseudoElement(Element& host, PseudoId pseudoElementSpecifier)
+static PseudoElement* beforeOrAfterPseudoElement(Element* host, PseudoId pseudoElementSpecifier)
{
switch (pseudoElementSpecifier) {
case BEFORE:
- return host.beforePseudoElement();
+ return host->beforePseudoElement();
case AFTER:
- return host.afterPseudoElement();
+ return host->afterPseudoElement();
default:
- return nullptr;
+ return 0;
}
}
-RenderStyle* Element::existingComputedStyle()
-{
- if (RenderStyle* renderTreeStyle = renderStyle())
- return renderTreeStyle;
-
- if (hasRareData())
- return elementRareData()->computedStyle();
-
- return nullptr;
-}
-
-RenderStyle& Element::resolveComputedStyle()
-{
- ASSERT(inDocument());
- ASSERT(!existingComputedStyle());
-
- Deque<Element*, 32> elementsRequiringComputedStyle({ this });
- RenderStyle* previousStyle = nullptr;
-
- // Collect ancestors until we find one that has style.
- auto composedAncestors = composedTreeAncestors(*this);
- for (auto& ancestor : composedAncestors) {
- if (!is<Element>(ancestor))
- break;
- auto& ancestorElement = downcast<Element>(ancestor);
- elementsRequiringComputedStyle.prepend(&ancestorElement);
- if (auto* existingStyle = ancestorElement.existingComputedStyle()) {
- previousStyle = existingStyle;
- break;
- }
- }
-
- // Resolve and cache styles starting from the most distant ancestor.
- for (auto* element : elementsRequiringComputedStyle) {
- auto style = document().styleForElementIgnoringPendingStylesheets(*element, previousStyle);
- previousStyle = style.ptr();
- ElementRareData& rareData = element->ensureElementRareData();
- rareData.setComputedStyle(WTF::move(style));
- }
-
- return *previousStyle;
-}
-
RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier)
{
- if (PseudoElement* pseudoElement = beforeOrAfterPseudoElement(*this, pseudoElementSpecifier))
+ if (PseudoElement* pseudoElement = beforeOrAfterPseudoElement(this, pseudoElementSpecifier))
return pseudoElement->computedStyle();
- auto* style = existingComputedStyle();
- if (!style) {
- if (!inDocument())
- return nullptr;
- style = &resolveComputedStyle();
+ // FIXME: Find and use the renderer from the pseudo element instead of the actual element so that the 'length'
+ // properties, which are only known by the renderer because it did the layout, will be correct and so that the
+ // values returned for the ":selection" pseudo-element will be correct.
+ if (RenderStyle* usedStyle = renderStyle()) {
+ if (pseudoElementSpecifier) {
+ RenderStyle* cachedPseudoStyle = usedStyle->getCachedPseudoStyle(pseudoElementSpecifier);
+ return cachedPseudoStyle ? cachedPseudoStyle : usedStyle;
+ }
+ return usedStyle;
}
- if (pseudoElementSpecifier) {
- if (auto* cachedPseudoStyle = style->getCachedPseudoStyle(pseudoElementSpecifier))
- style = cachedPseudoStyle;
+ if (!inDocument()) {
+ // FIXME: Try to do better than this. Ensure that styleForElement() works for elements that are not in the
+ // document tree and figure out when to destroy the computed style for such elements.
+ return nullptr;
}
- return style;
+ ElementRareData& data = ""
+ if (!data.computedStyle())
+ data.setComputedStyle(document().styleForElementIgnoringPendingStylesheets(this));
+ return pseudoElementSpecifier ? data.computedStyle()->getCachedPseudoStyle(pseudoElementSpecifier) : data.computedStyle();
}
void Element::setStyleAffectedByEmpty()
Modified: trunk/Source/WebCore/dom/Element.h (191228 => 191229)
--- trunk/Source/WebCore/dom/Element.h 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/Source/WebCore/dom/Element.h 2015-10-16 23:48:45 UTC (rev 191229)
@@ -573,9 +573,6 @@
void removeShadowRoot();
- RenderStyle* existingComputedStyle();
- RenderStyle& resolveComputedStyle();
-
bool rareDataStyleAffectedByEmpty() const;
bool rareDataChildrenAffectedByHover() const;
bool rareDataChildrenAffectedByActive() const;
Modified: trunk/Source/WebCore/dom/Node.cpp (191228 => 191229)
--- trunk/Source/WebCore/dom/Node.cpp 2015-10-16 23:47:10 UTC (rev 191228)
+++ trunk/Source/WebCore/dom/Node.cpp 2015-10-16 23:48:45 UTC (rev 191229)
@@ -1006,10 +1006,11 @@
RenderStyle* Node::computedStyle(PseudoId pseudoElementSpecifier)
{
- auto* composedParent = composedTreeAncestors(*this).first();
- if (!composedParent)
- return nullptr;
- return composedParent->computedStyle(pseudoElementSpecifier);
+ for (Node* node = this; node; node = node->parentOrShadowHostNode()) {
+ if (is<Element>(*node))
+ return downcast<Element>(*node).computedStyle(pseudoElementSpecifier);
+ }
+ return nullptr;
}
int Node::maxCharacterOffset() const