Source/WebCore:
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Apr 2016 10:11:39 +0000 (10:11 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Apr 2016 10:11:39 +0000 (10:11 +0000)
commitfaf8a0e7b5545bd0719d8e950ffa8a0f6d21ea56
tree2859fd94b9f440877169ceac7a52c0b087435b8b
parent7685100cc18655f358c269cb7b95f44f0ed749f4
Source/WebCore:
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.

LayoutTests:
REGRESSION (r188591): thingiverse.com direct messaging UI is not rendered properly
https://bugs.webkit.org/show_bug.cgi?id=156241
<rdar://problem/25262213>

Patch by Myles C. Maxfield <mmaxfield@apple.com> on 2016-04-06
Reviewed by Simon Fraser.

* fast/text/zero-sized-fonts-expected.txt: Added.
* fast/text/zero-sized-fonts.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@199151 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
LayoutTests/ChangeLog
LayoutTests/platform/mac/TestExpectations
Source/WebCore/ChangeLog
Source/WebCore/css/CSSParser.cpp
Source/WebCore/css/CSSPrimitiveValueMappings.h
Source/WebCore/css/CSSValueKeywords.in
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/html.css
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/Element.h
Source/WebCore/dom/ElementAndTextDescendantIterator.h
Source/WebCore/dom/ElementRareData.h
Source/WebCore/html/HTMLSlotElement.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/style/RenderStyleConstants.h
Source/WebCore/style/RenderTreePosition.cpp
Source/WebCore/style/RenderTreeUpdater.cpp
Source/WebCore/style/StyleTreeResolver.cpp