-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for css content-visibility: hidden
https://bugs.webkit.org/show_bug.cgi?id=236710 Reviewed by Antti Koivisto. This patch implements support for content-visibility: hidden [1]. It introduces the fake inherited property effectiveSkipsContent to keep track for Elements whether content-visibility is hidden and whether elements should be skipped for painting and hit testing. Several points in 4.3. Restrictions and Clarifications [2] are addressed too: - scrollIntoView is adapted [4.3.5] - tab-order navigation and focusing take skipped contents into account [3]. [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-035-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-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/css/css-sizing/contain-intrinsic-size/auto-006-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-009-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-010-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/Element.cpp: (WebCore::Element::isFocusable const): skipped contents are not focusable * Source/WebCore/page/FrameView.cpp: (WebCore::FrameView::scrollRectToVisible): do not scroll if the RenderObject is skipped content * Source/WebCore/rendering/RenderBlock.cpp: (WebCore::RenderBlock::paintContents): do not paint contents for c-v: hidden * Source/WebCore/rendering/RenderElement.h: (WebCore::RenderElement::visibleToHitTesting const): mark skipped content as not visible to hit testing (WebCore::RenderElement::shouldApplyLayoutContainment const): c-v: hidden forces containment (WebCore::RenderElement::shouldApplyPaintContainment const): c-v: hidden forces containment (WebCore::RenderElement::shouldApplyLayoutOrPaintContainment const): c-v: hidden forces containment (WebCore::RenderElement::shouldApplySizeContainment const): c-v: hidden forces containment (WebCore::RenderElement::shouldApplyInlineSizeContainment const): c-v: hidden forces containment (WebCore::RenderElement::shouldApplySizeOrInlineSizeContainment const): c-v: hidden forces containment (WebCore::RenderElement::shouldApplyStyleContainment const): c-v: hidden forces containment * Source/WebCore/rendering/RenderLayer.cpp: (WebCore::RenderLayer::paintList): do not paint child layers of a c-v: hidden container * Source/WebCore/rendering/RenderLayerBacking.cpp: (WebCore::RenderLayerBacking::updateAfterDescendants): * Source/WebCore/rendering/RenderObject.cpp: (WebCore::RenderObject::isSkippedContent const): (WebCore::RenderObject::shouldSkipContent const): * Source/WebCore/rendering/RenderObject.h: * 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::effectiveSkipsContent const): (WebCore::RenderStyle::setEffectiveSkipsContent): * Source/WebCore/rendering/style/StyleRareInheritedData.cpp: (WebCore::StyleRareInheritedData::StyleRareInheritedData): (WebCore::StyleRareInheritedData::operator== const): * Source/WebCore/rendering/style/StyleRareInheritedData.h: * Source/WebCore/style/StyleAdjuster.cpp: (WebCore::Style::Adjuster::adjust const):
- Loading branch information
Showing
32 changed files
with
87 additions
and
91 deletions.
There are no files selected for viewing
This file contains 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
2 changes: 1 addition & 1 deletion
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-015-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Content Visibility: hit testing assert_equals: center hits outer expected "outer" but got "inner" | ||
PASS Content Visibility: hit testing | ||
|
2 changes: 1 addition & 1 deletion
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-016-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Content Visibility: hit testing (composited) assert_equals: center hits outer expected "outer" but got "inner" | ||
PASS Content Visibility: hit testing (composited) | ||
|
2 changes: 1 addition & 1 deletion
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-017-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Content Visibility: hit testing (composited child) assert_equals: center hits outer expected "outer" but got "inner" | ||
PASS Content Visibility: hit testing (composited child) | ||
|
2 changes: 1 addition & 1 deletion
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-018-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Content Visibility: hit testing (composited with a composited child) assert_equals: center hits outer expected "outer" but got "inner" | ||
PASS Content Visibility: hit testing (composited with a composited child) | ||
|
4 changes: 1 addition & 3 deletions
4
...web-platform-tests/css/css-contain/content-visibility/content-visibility-029-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,4 @@ | ||
This text should be visible. | ||
This text should not be visible. | ||
This text is also not visible. | ||
|
||
FAIL innerText on locked element. assert_equals: expected "This text should be visible." but got "This text should be visible.\nThis text should not be visible.\nThis text is also not visible." | ||
FAIL innerText on locked element. assert_equals: expected "This text should be visible." but got "This text should be visible.\n" | ||
|
2 changes: 1 addition & 1 deletion
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-035-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
|
||
FAIL Testing focus and force layout on element with hidden flat-tree ancestor assert_not_equals: got disallowed value Element node <input id="slotted" type="text"></input> | ||
PASS Testing focus and force layout on element with hidden flat-tree ancestor | ||
|
2 changes: 1 addition & 1 deletion
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-038-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Measure Forced Layout assert_equals: spacer forced expected 8 but got 108 | ||
FAIL Measure Forced Layout assert_equals: spacer when visible expected 108 but got 8 | ||
|
3 changes: 1 addition & 2 deletions
3
...web-platform-tests/css/css-contain/content-visibility/content-visibility-047-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
|
||
|
||
|
||
|
||
FAIL Tab order navigation skips hidden subtrees assert_equals: expected Element node <input id="five" type="text"></input> but got Element node <input id="two" type="text"></input> | ||
PASS Tab order navigation skips hidden subtrees | ||
|
6 changes: 3 additions & 3 deletions
6
...web-platform-tests/css/css-contain/content-visibility/content-visibility-072-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
|
||
PASS one.getBoundingClientRect(): | ||
FAIL two.getBoundingClientRect(): assert_equals: y expected 3007 but got 3041 | ||
FAIL three.getBoundingClientRect(): assert_equals: y expected 3007 but got 3075 | ||
FAIL four.getBoundingClientRect(): assert_equals: y expected 3007 but got 3109 | ||
FAIL five.getBoundingClientRect(): assert_equals: y expected 3007 but got 3143 | ||
FAIL three.getBoundingClientRect(): assert_equals: y expected 3007 but got 3041 | ||
FAIL four.getBoundingClientRect(): assert_equals: y expected 3007 but got 3041 | ||
FAIL five.getBoundingClientRect(): assert_equals: y expected 3007 but got 3041 | ||
|
4 changes: 0 additions & 4 deletions
4
...web-platform-tests/css/css-contain/content-visibility/content-visibility-img-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,3 @@ | ||
|
||
|
||
|
||
|
||
|
||
PASS c-v:hidden <img> layout APIs shouldn't return zero when accessed from script. | ||
|
2 changes: 0 additions & 2 deletions
2
...form-tests/css/css-contain/content-visibility/content-visibility-input-image-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
|
||
|
||
|
||
PASS <input type=image> should return nonzero values for width and height in a c-v:hidden subtree. | ||
|
2 changes: 0 additions & 2 deletions
2
...web-platform-tests/css/css-contain/content-visibility/content-visibility-svg-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
Hello World! | ||
Hello World Again! | ||
|
||
PASS getBBox() should return nonzero values in a c-v:hidden subtree. | ||
|
34 changes: 17 additions & 17 deletions
34
...ported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-006-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,19 @@ | ||
|
||
FAIL Basic usage assert_equals: Size containment with no last remembered size - clientWidth expected 1 but got 100 | ||
FAIL Last remembered size can be 0 assert_equals: Using last remembered size - clientWidth expected 0 but got 100 | ||
FAIL Last remembered size can be set to 0 after losing display:none assert_equals: Using the new last remembered size - clientWidth expected 0 but got 100 | ||
FAIL Last remembered size is logical assert_equals: Using last remembered size - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size survives box destruction assert_equals: Still using last remembered size - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size survives display type changes assert_equals: Using last remembered size - clientWidth expected 100 but got 0 | ||
FAIL Losing cis:auto removes last remembered size assert_equals: Basic size containment - clientWidth expected 0 but got 100 | ||
FAIL Losing cis:auto removes last remembered size even if size doesn't change assert_equals: Size containment with no last remembered size - clientWidth expected 1 but got 100 | ||
FAIL Losing cis:auto removes last remembered size immediately assert_equals: Basic size containment - clientWidth expected 0 but got 100 | ||
FAIL Losing cis:auto during display:none doesn't remove last remembered size assert_equals: Using last remembered size - clientWidth expected 100 but got 75 | ||
FAIL Lack of cis:auto during box creation removes last remembered size assert_equals: Using last remembered size - clientWidth expected 100 but got 75 | ||
FAIL Last remembered size can be removed synchronously assert_equals: Using last remembered size - clientWidth expected 100 but got 75 | ||
PASS Disconnected element can briefly keep last remembered size | ||
FAIL Disconnected element ends up losing last remembered size assert_equals: Using last remembered size - clientWidth expected 100 but got 75 | ||
FAIL Disconnected element ends up losing last remembered size even if size was 0x0 assert_equals: Size containment with no last remembered size - clientWidth expected 1 but got 0 | ||
FAIL Last remembered size survives becoming inline assert_equals: Still using previous last remembered size - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size can be set to 0x0 after losing display:inline assert_equals: Last remembered size is now 0x0 - clientWidth expected 0 but got 100 | ||
FAIL Basic usage assert_equals: Sizing normally - clientWidth expected 100 but got 1 | ||
FAIL Last remembered size can be 0 assert_equals: Using last remembered size - clientHeight expected 0 but got 2 | ||
FAIL Last remembered size can be set to 0 after losing display:none assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size is logical assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size survives box destruction assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size survives display type changes assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Losing cis:auto removes last remembered size assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Losing cis:auto removes last remembered size even if size doesn't change assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Losing cis:auto removes last remembered size immediately assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Losing cis:auto during display:none doesn't remove last remembered size assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Lack of cis:auto during box creation removes last remembered size assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Last remembered size can be removed synchronously assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Disconnected element can briefly keep last remembered size assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
FAIL Disconnected element ends up losing last remembered size assert_equals: Sizing normally - clientWidth expected 100 but got 0 | ||
PASS Disconnected element ends up losing last remembered size even if size was 0x0 | ||
FAIL Last remembered size survives becoming inline assert_equals: Still using previous last remembered size - clientWidth expected 100 but got 1 | ||
FAIL Last remembered size can be set to 0x0 after losing display:inline assert_equals: Last remembered size is now 0x0 - clientHeight expected 0 but got 2 | ||
|
4 changes: 2 additions & 2 deletions
4
...ported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-009-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
|
||
FAIL Only recording last remembered inline size assert_equals: Using last remembered inline size - clientWidth expected 100 but got 0 | ||
FAIL Only recording last remembered block size assert_equals: Using last remembered block size - clientWidth expected 2 but got 0 | ||
FAIL Only recording last remembered inline size assert_equals: Using last remembered inline size - clientWidth expected 100 but got 2 | ||
FAIL Only recording last remembered block size assert_equals: Using last remembered block size - clientHeight expected 50 but got 1 | ||
FAIL contain:inline-size prevents recording last remembered inline size assert_equals: Size containment for inline axis - clientWidth expected 20 but got 0 | ||
FAIL contain:inline-size can keep previous last remembered inline size assert_equals: Size containment for inline axis - clientWidth expected 20 but got 0 | ||
|
4 changes: 2 additions & 2 deletions
4
...ported/w3c/web-platform-tests/css/css-sizing/contain-intrinsic-size/auto-010-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
|
||
FAIL Last remembered size supports multiple fragments assert_equals: Using last remembered size - fragment #1 width expected 50 but got 0 | ||
FAIL Last remembered size is updated when 2nd fragment changes size assert_equals: Using updated last remembered size - fragment #1 width expected 50 but got 0 | ||
FAIL Last remembered size supports multiple fragments assert_equals: Using last remembered size - fragment #1 height expected 150 but got 1 | ||
FAIL Last remembered size is updated when 2nd fragment changes size assert_equals: Using updated last remembered size - fragment #1 height expected 175 but got 1 | ||
|
1 change: 0 additions & 1 deletion
1
...dded-content/the-embed-element/embed-document-under-content-visibility-focus-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
|
||
PASS ensure onload happens | ||
|
1 change: 0 additions & 1 deletion
1
...edded-content/the-embed-element/embed-document-under-content-visibility-gbcr-expected.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
|
||
PASS ensure onload happens | ||
|
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.