Diff
Modified: trunk/LayoutTests/ChangeLog (199153 => 199154)
--- trunk/LayoutTests/ChangeLog 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/LayoutTests/ChangeLog 2016-04-07 10:29:15 UTC (rev 199154)
@@ -1,3 +1,15 @@
+2016-04-07 Antti Koivisto <[email protected]>
+
+ Shadow DOM: Implement display: contents for slots
+ https://bugs.webkit.org/show_bug.cgi?id=149439
+ <rdar://problem/22731922>
+
+ Reviewed by Ryosuke Niwa.
+
+ * platform/mac/TestExpectations:
+
+ Enable fast/shadow-dom/css-scoping-shadow-slot-display-override.html, the test for overriding slot display value.
+
2016-04-07 Sergio Villar Senin <[email protected]>
[css-grid] Content box incorrectly used as non-auto min-height
@@ -226,18 +238,6 @@
2016-04-06 Antti Koivisto <[email protected]>
- Shadow DOM: Implement display: contents for slots
- https://bugs.webkit.org/show_bug.cgi?id=149439
- <rdar://problem/22731922>
-
- Reviewed by Ryosuke Niwa.
-
- * platform/mac/TestExpectations:
-
- Enable fast/shadow-dom/css-scoping-shadow-slot-display-override.html, the test for overriding slot display value.
-
-2016-04-06 Antti Koivisto <[email protected]>
-
REGRESSION(r196629): Messages text size only changes for sending text, conversation text size does not change
https://bugs.webkit.org/show_bug.cgi?id=156287
<rdar://problem/24264756>
Modified: trunk/LayoutTests/platform/mac/TestExpectations (199153 => 199154)
--- trunk/LayoutTests/platform/mac/TestExpectations 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/LayoutTests/platform/mac/TestExpectations 2016-04-07 10:29:15 UTC (rev 199154)
@@ -1229,7 +1229,6 @@
webkit.org/b/148695 fast/shadow-dom [ Pass ]
webkit.org/b/149440 fast/shadow-dom/css-scoping-shadow-host-functional-rule.html [ ImageOnlyFailure ]
-webkit.org/b/149441 fast/shadow-dom/css-scoping-shadow-slot-display-override.html [ ImageOnlyFailure ]
# Touch events is not enabled on Mac
webkit.org/b/149592 fast/shadow-dom/touch-event-ios.html [ Failure ]
Modified: trunk/Source/WebCore/ChangeLog (199153 => 199154)
--- trunk/Source/WebCore/ChangeLog 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/ChangeLog 2016-04-07 10:29:15 UTC (rev 199154)
@@ -1,3 +1,91 @@
+2016-04-07 Antti Koivisto <[email protected]>
+
+ Shadow DOM: Implement display: contents for slots
+ https://bugs.webkit.org/show_bug.cgi?id=149439
+ <rdar://problem/22731922>
+
+ Reviewed by Ryosuke Niwa.
+
+ This patch adds support for value 'contents' of the 'display' property for <slot> elements only. The value is ignored
+ for other elements for now. With this display value the element does not generate a box for itself but its descendants
+ generate them normally.
+
+ Slots already have implicit "display: contents". With this patch the value comes from the user agent stylesheet and can
+ be overriden by the author.
+
+ * css/CSSParser.cpp:
+ (WebCore::isValidKeywordPropertyAndValue):
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ * css/CSSValueKeywords.in:
+
+ Suport parsing display: contents.
+
+ * css/StyleResolver.cpp:
+ (WebCore::equivalentBlockDisplay):
+ (WebCore::StyleResolver::adjustRenderStyle):
+
+ Disallow for non-slots for now.
+
+ * css/html.css:
+ (slot):
+
+ Add "slot { display: contents }" to the UA sheet.
+
+ * dom/Element.cpp:
+ (WebCore::Element::resolveStyle):
+ (WebCore::Element::hasDisplayContents):
+ (WebCore::Element::setHasDisplayContents):
+
+ Add a rare data bit for elements with display:contents (as we don't save the RenderStyle for them).
+
+ (WebCore::Element::rendererIsNeeded):
+
+ Don't need renderer for display:contents.
+
+ (WebCore::Element::createElementRenderer):
+ * dom/Element.h:
+ (WebCore::Element::isVisibleInViewportChanged):
+ * dom/ElementAndTextDescendantIterator.h:
+ (WebCore::ElementAndTextDescendantIterator::operator!):
+ (WebCore::ElementAndTextDescendantIterator::operator bool):
+ (WebCore::ElementAndTextDescendantIterator::ElementAndTextDescendantIterator):
+ (WebCore::ElementAndTextDescendantIterator::operator==):
+ (WebCore::ElementAndTextDescendantIterator::operator!=):
+
+ Support initializing ElementAndTextDescendantIterator with root==current so that m_current is not nulled.
+ This is needed for ComposedTreeIterator to be initialized correctly when root is a slot and the current node
+ is a slotted node. The case happens in RenderTreePosition::previousSiblingRenderer when slot display is overriden
+ to something else than 'contents'.
+
+ * dom/ElementRareData.h:
+ (WebCore::ElementRareData::hasDisplayContents):
+ (WebCore::ElementRareData::setHasDisplayContents):
+ (WebCore::ElementRareData::ElementRareData):
+ * rendering/RenderElement.cpp:
+ (WebCore::RenderElement::createFor):
+ * rendering/style/RenderStyleConstants.h:
+ * style/RenderTreePosition.cpp:
+ (WebCore::RenderTreePosition::nextSiblingRenderer):
+
+ Test for dynamic display:contents.
+
+ * style/RenderTreeUpdater.cpp:
+ (WebCore::findRenderingRoot):
+ (WebCore::RenderTreeUpdater::updateRenderTree):
+ (WebCore::RenderTreeUpdater::updateElementRenderer):
+
+ Test for dynamic display:contents.
+
+ * style/StyleTreeResolver.cpp:
+ (WebCore::Style::affectsRenderedSubtree):
+
+ No need for special case.
+
+ (WebCore::Style::TreeResolver::resolveComposedTree):
+
+ Test for dynamic display:contents.
+
2016-04-07 Sergio Villar Senin <[email protected]>
[css-grid] Content box incorrectly used as non-auto min-height
Modified: trunk/Source/WebCore/css/CSSParser.cpp (199153 => 199154)
--- trunk/Source/WebCore/css/CSSParser.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -669,8 +669,8 @@
// inline | block | list-item | inline-block | table |
// inline-table | table-row-group | table-header-group | table-footer-group | table-row |
// table-column-group | table-column | table-cell | table-caption | -webkit-box | -webkit-inline-box | none | inherit
- // flex | -webkit-flex | inline-flex | -webkit-inline-flex | -webkit-grid | -webkit-inline-grid
- if ((valueID >= CSSValueInline && valueID <= CSSValueWebkitInlineFlex) || valueID == CSSValueNone)
+ // flex | -webkit-flex | inline-flex | -webkit-inline-flex | -webkit-grid | -webkit-inline-grid | contents
+ if ((valueID >= CSSValueInline && valueID <= CSSValueContents) || valueID == CSSValueNone)
return true;
#if ENABLE(CSS_GRID_LAYOUT)
if (valueID == CSSValueWebkitGrid || valueID == CSSValueWebkitInlineGrid)
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (199153 => 199154)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2016-04-07 10:29:15 UTC (rev 199154)
@@ -1388,6 +1388,9 @@
case NONE:
m_value.valueID = CSSValueNone;
break;
+ case CONTENTS:
+ m_value.valueID = CSSValueContents;
+ break;
}
}
Modified: trunk/Source/WebCore/css/CSSValueKeywords.in (199153 => 199154)
--- trunk/Source/WebCore/css/CSSValueKeywords.in 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/css/CSSValueKeywords.in 2016-04-07 10:29:15 UTC (rev 199154)
@@ -417,6 +417,7 @@
-webkit-flex
inline-flex
-webkit-inline-flex
+contents
-webkit-grid
-webkit-inline-grid
//none
@@ -1184,7 +1185,7 @@
// will-change
scroll-position
-contents
+//contents
#if defined(ENABLE_TOUCH_EVENTS) && ENABLE_TOUCH_EVENTS
// touch-action
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (199153 => 199154)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -723,6 +723,7 @@
case TABLE_COLUMN:
case TABLE_CELL:
case TABLE_CAPTION:
+ case CONTENTS:
return BLOCK;
case NONE:
ASSERT_NOT_REACHED();
@@ -765,6 +766,15 @@
style.setOriginalDisplay(style.display());
if (style.display() != NONE) {
+ if (style.display() == CONTENTS) {
+ // FIXME: Enable for all elements.
+ bool elementSupportsDisplayContents = false;
+#if ENABLE(SHADOW_DOM) || ENABLE(DETAILS_ELEMENT)
+ elementSupportsDisplayContents = is<HTMLSlotElement>(e);
+#endif
+ if (!elementSupportsDisplayContents)
+ style.setDisplay(INLINE);
+ }
// If we have a <td> that specifies a float property, in quirks mode we just drop the float
// property.
// Sites also commonly use display:inline/block on <td>s and <table>s. In quirks mode we force
Modified: trunk/Source/WebCore/css/html.css (199153 => 199154)
--- trunk/Source/WebCore/css/html.css 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/css/html.css 2016-04-07 10:29:15 UTC (rev 199154)
@@ -1223,6 +1223,10 @@
unicode-bidi: bidi-override;
}
+slot {
+ display: contents;
+}
+
#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
applet, embed, object, img {
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
Modified: trunk/Source/WebCore/dom/Element.cpp (199153 => 199154)
--- trunk/Source/WebCore/dom/Element.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/dom/Element.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -1375,6 +1375,18 @@
return styleResolver().styleForElement(*this, parentStyle);
}
+bool Element::hasDisplayContents() const
+{
+ return hasRareData() && elementRareData()->hasDisplayContents();
+}
+
+void Element::setHasDisplayContents(bool value)
+{
+ if (hasDisplayContents() == value)
+ return;
+ ensureElementRareData().setHasDisplayContents(value);
+}
+
// Returns true is the given attribute is an event handler.
// We consider an event handler any attribute that begins with "on".
// It is a simple solution that has the advantage of not requiring any
@@ -1478,7 +1490,7 @@
bool Element::rendererIsNeeded(const RenderStyle& style)
{
- return style.display() != NONE;
+ return style.display() != NONE && style.display() != CONTENTS;
}
RenderPtr<RenderElement> Element::createElementRenderer(Ref<RenderStyle>&& style, const RenderTreePosition&)
Modified: trunk/Source/WebCore/dom/Element.h (199153 => 199154)
--- trunk/Source/WebCore/dom/Element.h 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/dom/Element.h 2016-04-07 10:29:15 UTC (rev 199154)
@@ -501,6 +501,9 @@
StyleResolver& styleResolver();
ElementStyle resolveStyle(RenderStyle* parentStyle);
+ bool hasDisplayContents() const;
+ void setHasDisplayContents(bool);
+
virtual void isVisibleInViewportChanged() { }
using ContainerNode::setAttributeEventListener;
Modified: trunk/Source/WebCore/dom/ElementAndTextDescendantIterator.h (199153 => 199154)
--- trunk/Source/WebCore/dom/ElementAndTextDescendantIterator.h 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/dom/ElementAndTextDescendantIterator.h 2016-04-07 10:29:15 UTC (rev 199154)
@@ -50,8 +50,8 @@
bool operator==(const ElementAndTextDescendantIterator& other) const;
bool operator!=(const ElementAndTextDescendantIterator& other) const;
- bool operator!() const { return !m_current; }
- explicit operator bool() const { return m_current; }
+ bool operator!() const { return !m_depth; }
+ explicit operator bool() const { return m_depth; }
void dropAssertions();
@@ -115,7 +115,7 @@
}
inline ElementAndTextDescendantIterator::ElementAndTextDescendantIterator(ContainerNode& root, Node* current)
- : m_current(current != &root ? current : nullptr)
+ : m_current(current)
#if !ASSERT_DISABLED
, m_assertions(m_current)
#endif
@@ -123,6 +123,8 @@
if (!m_current)
return;
ASSERT(isElementOrText(*m_current));
+ if (m_current == &root)
+ return;
Vector<Node*, 20> ancestorStack;
auto* ancestor = m_current->parentNode();
@@ -285,7 +287,7 @@
inline bool ElementAndTextDescendantIterator::operator==(const ElementAndTextDescendantIterator& other) const
{
ASSERT(!m_assertions.domTreeHasMutated());
- return m_current == other.m_current;
+ return m_current == other.m_current || (!m_depth && !other.m_depth);
}
inline bool ElementAndTextDescendantIterator::operator!=(const ElementAndTextDescendantIterator& other) const
Modified: trunk/Source/WebCore/dom/ElementRareData.h (199153 => 199154)
--- trunk/Source/WebCore/dom/ElementRareData.h 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/dom/ElementRareData.h 2016-04-07 10:29:15 UTC (rev 199154)
@@ -107,6 +107,9 @@
bool hasPendingResources() const { return m_hasPendingResources; }
void setHasPendingResources(bool has) { m_hasPendingResources = has; }
+ bool hasDisplayContents() const { return m_hasDisplayContents; }
+ void setHasDisplayContents(bool value) { m_hasDisplayContents = value; }
+
private:
int m_tabIndex;
unsigned short m_childIndex;
@@ -126,6 +129,7 @@
unsigned m_childrenAffectedByLastChildRules : 1;
unsigned m_childrenAffectedByBackwardPositionalRules : 1;
unsigned m_childrenAffectedByPropertyBasedBackwardPositionalRules : 1;
+ unsigned m_hasDisplayContents : 1;
RegionOversetState m_regionOversetState;
@@ -166,6 +170,7 @@
, m_childrenAffectedByLastChildRules(false)
, m_childrenAffectedByBackwardPositionalRules(false)
, m_childrenAffectedByPropertyBasedBackwardPositionalRules(false)
+ , m_hasDisplayContents(false)
, m_regionOversetState(RegionUndefined)
, m_minimumSizeForResizing(defaultMinimumSizeForResizing())
{
@@ -193,6 +198,7 @@
inline void ElementRareData::resetComputedStyle()
{
m_computedStyle = nullptr;
+ m_hasDisplayContents = false;
setStyleAffectedByEmpty(false);
setChildIndex(0);
}
Modified: trunk/Source/WebCore/html/HTMLSlotElement.h (199153 => 199154)
--- trunk/Source/WebCore/html/HTMLSlotElement.h 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/html/HTMLSlotElement.h 2016-04-07 10:29:15 UTC (rev 199154)
@@ -53,18 +53,7 @@
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/rendering/RenderElement.cpp (199153 => 199154)
--- trunk/Source/WebCore/rendering/RenderElement.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/rendering/RenderElement.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -161,6 +161,7 @@
switch (style.get().display()) {
case NONE:
+ case CONTENTS:
return nullptr;
case INLINE:
return createRenderer<RenderInline>(element, WTFMove(style));
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (199153 => 199154)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2016-04-07 10:29:15 UTC (rev 199154)
@@ -563,6 +563,7 @@
TABLE_COLUMN_GROUP, TABLE_COLUMN, TABLE_CELL,
TABLE_CAPTION, BOX, INLINE_BOX,
FLEX, WEBKIT_FLEX, INLINE_FLEX, WEBKIT_INLINE_FLEX,
+ CONTENTS,
#if ENABLE(CSS_GRID_LAYOUT)
GRID, INLINE_GRID,
#endif
Modified: trunk/Source/WebCore/style/RenderTreePosition.cpp (199153 => 199154)
--- trunk/Source/WebCore/style/RenderTreePosition.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/style/RenderTreePosition.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -89,7 +89,7 @@
while (it != end) {
auto& node = *it;
- bool hasDisplayContents = is<Element>(node) && hasImplicitDisplayContents(downcast<Element>(node));
+ bool hasDisplayContents = is<Element>(node) && downcast<Element>(node).hasDisplayContents();
if (hasDisplayContents) {
it.traverseNext();
continue;
Modified: trunk/Source/WebCore/style/RenderTreeUpdater.cpp (199153 => 199154)
--- trunk/Source/WebCore/style/RenderTreeUpdater.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/style/RenderTreeUpdater.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -68,7 +68,7 @@
for (auto& ancestor : composedTreeAncestors(node)) {
if (ancestor.renderer())
return &ancestor;
- if (!hasImplicitDisplayContents(ancestor))
+ if (!ancestor.hasDisplayContents())
return nullptr;
}
return &node.document();
@@ -151,7 +151,7 @@
updateElementRenderer(element, *elementUpdate);
- bool mayHaveRenderedDescendants = element.renderer() || (hasImplicitDisplayContents(element) && shouldCreateRenderer(element, renderTreePosition().parent()));
+ bool mayHaveRenderedDescendants = element.renderer() || (element.hasDisplayContents() && shouldCreateRenderer(element, renderTreePosition().parent()));
if (!mayHaveRenderedDescendants) {
it.traverseNextSkippingChildren();
continue;
@@ -244,7 +244,10 @@
if (shouldTearDownRenderers)
tearDownRenderers(element, TeardownType::KeepHoverAndActive);
- bool shouldCreateNewRenderer = !element.renderer() && update.style && !hasImplicitDisplayContents(element);
+ bool hasDisplayContest = update.style && update.style->display() == CONTENTS;
+ element.setHasDisplayContents(hasDisplayContest);
+
+ bool shouldCreateNewRenderer = !element.renderer() && update.style && !hasDisplayContest;
if (shouldCreateNewRenderer) {
if (element.hasCustomStyleResolveCallbacks())
element.willAttachRenderers();
Modified: trunk/Source/WebCore/style/StyleTreeResolver.cpp (199153 => 199154)
--- trunk/Source/WebCore/style/StyleTreeResolver.cpp 2016-04-07 10:23:53 UTC (rev 199153)
+++ trunk/Source/WebCore/style/StyleTreeResolver.cpp 2016-04-07 10:29:15 UTC (rev 199154)
@@ -172,9 +172,6 @@
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))
@@ -376,7 +373,7 @@
ElementUpdate update;
update.style = element.renderStyle();
- bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling || hasImplicitDisplayContents(element);
+ bool shouldResolve = parent.change >= Inherit || element.needsStyleRecalc() || shouldResolveForPseudoElement || affectedByPreviousSibling || element.hasDisplayContents();
if (shouldResolve) {
#if PLATFORM(IOS)
CheckForVisibilityChangeOnRecalcStyle checkForVisibilityChange(&element, element.renderStyle());