-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Parse and add experimental flag for content-visibility #1573
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
https://bugs.webkit.org/show_bug.cgi?id=236371 Reviewed by NOBODY (OOPS!). Parsing of the content-visibility property according to [1]. This is controlled the experimental flag CSSContentVisibilityEnabled. [1] https://www.w3.org/TR/css-contain-2/#content-visibility * LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-026-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-077-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/inheritance-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/parsing/content-visibility-computed-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/parsing/content-visibility-valid-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: * LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: * LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom/getComputedStyle-detached-subtree-expected.txt: * LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-cascade/all-prop-initial-xml-expected.txt: * Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml: * Source/WebCore/animation/CSSPropertyAnimation.cpp: (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): * Source/WebCore/css/CSSComputedStyleDeclaration.cpp: (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): * Source/WebCore/css/CSSPrimitiveValueMappings.h: (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): (WebCore::CSSPrimitiveValue::operator ContentVisibility const): * Source/WebCore/css/CSSProperties.json: * Source/WebCore/css/parser/CSSParserContext.cpp: (WebCore::operator==): (WebCore::add): * Source/WebCore/css/parser/CSSParserContext.h: * Source/WebCore/css/parser/CSSPropertyParser.cpp: (WebCore::consumeContentVisibility): (WebCore::CSSPropertyParser::parseSingleValue): * Source/WebCore/rendering/RenderObject.cpp: (WebCore::RenderObject::setLayoutContainmentApplies): (WebCore::RenderObject::RenderObjectRareData::RenderObjectRareData): * Source/WebCore/rendering/style/RenderStyle.h: (WebCore::RenderStyle::contentVisibility const): (WebCore::RenderStyle::contentVisibilityHidden const): (WebCore::RenderStyle::setContentVisibility): (WebCore::RenderStyle::initialContentVisibility): * Source/WebCore/rendering/style/RenderStyleConstants.h: * Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp: (WebCore::StyleRareNonInheritedData::StyleRareNonInheritedData): (WebCore::StyleRareNonInheritedData::operator== const): * Source/WebCore/rendering/style/StyleRareNonInheritedData.h:
https://bugs.webkit.org/show_bug.cgi?id=236710 Reviewed by NOBODY (OOPS!). This patch implements support for content-visibility: hidden [1]. It introduces ContentVisibilityData to keep track for Elements whether content-visibility is hidden and whether Elements should be skipped for painting and hit testing. To react to content-visibility property changes the RenderTreeUpdater is adapted. Note that content-visibility state will be maintained even when an Element has no render object attached (e.g. display: none). Several points in 4.3. Restrictions and Clarifications [2] are addressed too: - Intersection and Resize observer are adapted to skipped contents [4.3.1, 4.3.2] - scrollIntoView is adapted [4.3.5] - innerText is adapted [4.3.8] - tab-order navigation and focusing take skipped contents into account [3]. This change also fixes the r293943 optimization, for content-visibility we should rely on containsSize etc., not effectiveContainment. [1] https://drafts.csswg.org/css-contain/#using-cv-hidden [2] https://drafts.csswg.org/css-contain/#cv-notes [3] https://drafts.csswg.org/css-contain/#valdef-content-visibility-hidden * LayoutTests/TestExpectations: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-015-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-016-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-017-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-018-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-029-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-030-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-031-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-047-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-072-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-080-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-img-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-input-image-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-contain/content-visibility/content-visibility-svg-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-document-under-content-visibility-focus-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/the-embed-element/embed-document-under-content-visibility-gbcr-expected.txt: * Source/WebCore/dom/Document.cpp: (WebCore::computeIntersectionState): mark skipped content as not intersecting * Source/WebCore/dom/Element.cpp: (WebCore::Element::focus): skipped contents are not focusable (WebCore::Element::innerText): skipped content means empty innerText (WebCore::Element::isFocusableWithoutResolvingFullStyle const): make tab order navigation ignore skipped content (WebCore::Element::ensureContentVisibilityData): (WebCore::Element::contentVisibilityData const): (WebCore::Element::updateContentVisibilityData): (WebCore::Element::updateContentVisibility): (WebCore::Element::updateDescendantTopLayerElements): (WebCore::Element::isSkippedContent const): (WebCore::Element::shouldSkipContent const): * Source/WebCore/dom/Element.h: * Source/WebCore/dom/ElementRareData.cpp: * Source/WebCore/dom/ElementRareData.h: (WebCore::ElementRareData::contentVisibilityData const): (WebCore::ElementRareData::setContentVisibilityData): (WebCore::ElementRareData::useTypes const): * Source/WebCore/dom/TreeScope.cpp: (WebCore::TreeScope::nodeFromPoint): caretRangeFromPoint works even with content-visibility: hidden * Source/WebCore/editing/TextIterator.cpp: (WebCore::TextIterator::advance): skip hidden content * Source/WebCore/page/ResizeObservation.cpp: do not deliver resize observations for skipped content (WebCore::ResizeObservation::computeObservedSizes const): (WebCore::ResizeObservation::elementSizeChanged const): * Source/WebCore/page/ResizeObservation.h: * Source/WebCore/rendering/HitTestRequest.h: (WebCore::HitTestRequest::isProgrammatic const): * Source/WebCore/rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintContents): do not paint contents for c-v: hidden * Source/WebCore/rendering/RenderElement.cpp: (WebCore::RenderElement::shouldSkipContent const): * Source/WebCore/rendering/RenderElement.h: (WebCore::RenderElement::visibleToHitTesting const): mark skipped content as not visible to hit testing * Source/WebCore/rendering/RenderLayer.cpp: (WebCore::RenderLayer::computeHasVisibleContent const): (WebCore::RenderLayer::paintList): do not paint child layers of a c-v: hidden container (WebCore::RenderLayer::hitTestList): bail out of hit testing for skipped content * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateAfterDescendants): * Source/WebCore/rendering/RenderObject.cpp: (WebCore::RenderObject::scrollRectToVisible): do not scroll if the RenderObject is skipped content * Source/WebCore/rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::paint): do not paint contents for content-visibility: hidden * Source/WebCore/rendering/RenderWidget.cpp: (WebCore::RenderWidget::paint): do not paint contents for content-visibility: hidden * Source/WebCore/rendering/style/RenderStyle.h: (WebCore::RenderStyle::containsLayout const): (WebCore::RenderStyle::containsSize const): (WebCore::RenderStyle::containsInlineSize const): (WebCore::RenderStyle::containsSizeOrInlineSize const): (WebCore::RenderStyle::containsStyle const): (WebCore::RenderStyle::containsPaint const): (WebCore::RenderStyle::containsLayoutOrPaint const): * Source/WebCore/rendering/updating/RenderTreeUpdater.cpp: (WebCore::RenderTreeUpdater::updateElementRenderer): react to content-visibility style change * Source/WebCore/style/StyleTreeResolver.cpp: (WebCore::Style::affectsRenderedSubtree):
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
CSS
Cascading Style Sheets implementation
merging-blocked
Applied to prevent a change from being merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
708eb9e