Changeset 276236 in webkit
- Timestamp:
- Apr 18, 2021, 11:32:12 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/images/image-extraction/image-overlay-with-selection-styles-expected.html (added)
-
LayoutTests/fast/images/image-extraction/image-overlay-with-selection-styles.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/html/shadow/imageOverlay.css (modified) (1 diff)
-
Source/WebCore/rendering/RenderElement.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r276235 r276236 1 2021-04-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Selected image overlay text should never be visible 4 https://bugs.webkit.org/show_bug.cgi?id=224734 5 <rdar://problem/76806399> 6 7 Reviewed by Darin Adler. 8 9 Add a new layout test. 10 11 * fast/images/image-extraction/image-overlay-with-selection-styles-expected.html: Added. 12 * fast/images/image-extraction/image-overlay-with-selection-styles.html: Added. 13 1 14 2021-04-18 Rob Buis <rbuis@igalia.com> 2 15 -
trunk/Source/WebCore/ChangeLog
r276235 r276236 1 2021-04-18 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Selected image overlay text should never be visible 4 https://bugs.webkit.org/show_bug.cgi?id=224734 5 <rdar://problem/76806399> 6 7 Reviewed by Darin Adler. 8 9 Make a slight adjustment to the UA stylesheet to ensure that image overlay text is never visible. See below for 10 more details. 11 12 Test: fast/images/image-extraction/image-overlay-with-selection-styles.html 13 14 * html/shadow/imageOverlay.css: 15 (div.image-overlay-text::selection): 16 17 Enforce selected text styles for image overlay text. 18 19 * rendering/RenderElement.cpp: 20 (WebCore::RenderElement::selectionPseudoStyle const): 21 22 Make an additional adjustment when computing selection pseudo styles for UA shadow root content. Currently, for 23 elements inside a UA shadow root, we always immediately ascend to the shadow host; this means that `::selection` 24 pseudo selectors currently don't work in UA stylesheets, since they're skipped when resolving styles, upon 25 painting selected text. 26 27 To fix this, we can let the element's own pseudo styles take precedence over the shadow host's renderer in the 28 case where we have a selection pseudo style. While we're here, also replace a few raw pointers with `RefPtr`. 29 1 30 2021-04-18 Rob Buis <rbuis@igalia.com> 2 31 -
trunk/Source/WebCore/html/shadow/imageOverlay.css
r276026 r276236 39 39 overflow: hidden; 40 40 } 41 42 div.image-overlay-text::selection { 43 color: transparent; 44 background-color: highlight; 45 } -
trunk/Source/WebCore/rendering/RenderElement.cpp
r275478 r276236 1530 1530 return nullptr; 1531 1531 1532 if (ShadowRoot* root = element()->containingShadowRoot()) { 1532 if (auto selectionStyle = getUncachedPseudoStyle({ PseudoId::Selection })) { 1533 // We intentionally return the pseudo selection style here if it exists before ascending to 1534 // the shadow host element. This allows us to apply selection pseudo styles in user agent 1535 // shadow roots, instead of always deferring to the shadow host's selection pseudo style. 1536 return selectionStyle; 1537 } 1538 1539 if (auto root = makeRefPtr(element()->containingShadowRoot())) { 1533 1540 if (root->mode() == ShadowRootMode::UserAgent) { 1534 auto * currentElement = element()->shadowHost();1541 auto currentElement = makeRefPtr(element()->shadowHost()); 1535 1542 // When an element has display: contents, this element doesn't have a renderer 1536 1543 // and its children will render as children of the parent element. … … 1542 1549 } 1543 1550 1544 return getUncachedPseudoStyle({ PseudoId::Selection });1551 return nullptr; 1545 1552 } 1546 1553
Note:
See TracChangeset
for help on using the changeset viewer.