Changeset 281685 in webkit
- Timestamp:
- Aug 26, 2021 9:58:53 PM (11 months ago)
- Location:
- trunk
- Files:
-
- 12 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/editing/caret/caret-color.html (modified) (1 diff)
-
LayoutTests/editing/caret/color-span-inside-editable-background-expected.html (modified) (1 diff)
-
LayoutTests/editing/caret/color-span-inside-editable-expected.html (modified) (1 diff)
-
LayoutTests/fast/css/caret-color-auto-expected.html (modified) (1 diff)
-
LayoutTests/platform/ios-wk2/editing/caret/caret-color-expected.png (modified) (previous)
-
LayoutTests/platform/ios/editing/caret/caret-color-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac/editing/caret/caret-color-expected.png (modified) (previous)
-
LayoutTests/platform/mac/editing/caret/caret-color-expected.txt (modified) (1 diff)
-
LayoutTests/platform/win/editing/caret/caret-color-expected.txt (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/editing/FrameSelection.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r281683 r281685 1 2021-08-26 Joone Hur <joone@webkit.org> 2 3 Caret should respect text background color 4 https://bugs.webkit.org/show_bug.cgi?id=117493 5 6 Reviewed by Ryosuke Niwa. 7 8 Rebaselined caret rendering tests. 9 10 * editing/caret/caret-color.html: 11 * editing/caret/color-span-inside-editable-background-expected.html: 12 * editing/caret/color-span-inside-editable-expected.html: 13 * fast/css/caret-color-auto-expected.html: 14 * platform/ios-wk2/editing/caret/caret-color-expected.png: 15 * platform/ios/editing/caret/caret-color-expected.txt: 16 * platform/mac/editing/caret/caret-color-expected.png: 17 * platform/mac/editing/caret/caret-color-expected.txt: 18 * platform/win/editing/caret/caret-color-expected.txt: 19 1 20 2021-08-26 Simon Fraser <simon.fraser@apple.com> 2 21 -
trunk/LayoutTests/editing/caret/caret-color.html
r152612 r281685 17 17 </head> 18 18 <body> 19 <p>This tests to make sure that the caret is visible in the black background by getting the caret color from the color of the element(span) containing the text, not the parentelement(div) that has the contentEditable attribute.19 <p>This tests to make sure that the caret is visible in the black background by getting the caret color from the color of the element(span) containing the text, not the root editable element(div) that has the contentEditable attribute. 20 20 </p> 21 <div contenteditable id="root" class="editing" >22 <span id="test" style="color: white ; background-color: black">Where is my caret?</span>21 <div contenteditable id="root" class="editing" style="background-color: black" > 22 <span id="test" style="color: white">Where is my caret?</span> 23 23 </div> 24 24 -
trunk/LayoutTests/editing/caret/color-span-inside-editable-background-expected.html
r175152 r281685 1 1 This test makes sure that carets in content editable divs with a background color specified remain black even if there is a span inside them with a foreground color specified. 2 2 <div style="width: 505px; height: 505px; overflow: hidden;"> 3 <div style="width: 50px; height: 500px; background-color: black"></div>3 <div style="width: 50px; height: 500px; background-color: red"></div> 4 4 </div> -
trunk/LayoutTests/editing/caret/color-span-inside-editable-expected.html
r173246 r281685 1 1 This test makes sure that carets in content editable divs remain black even if there is a span inside them with a foreground color specified. 2 2 <div style="width: 505px; height: 505px; overflow: hidden;"> 3 <div style="width: 50px; height: 500px; background-color: black"></div>3 <div style="width: 50px; height: 500px; background-color: red"></div> 4 4 </div> -
trunk/LayoutTests/fast/css/caret-color-auto-expected.html
r220706 r281685 12 12 background-color: white; 13 13 color: red; 14 caret-color: green;14 caret-color: red; 15 15 transform-origin: left top; 16 16 transform: scale(50, 50); -
trunk/LayoutTests/platform/ios/editing/caret/caret-color-expected.txt
r179104 r281685 12 12 RenderText {#text} at (0,0) size 754x39 13 13 text run at (0,0) width 754: "This tests to make sure that the caret is visible in the black background by getting the caret color from the color of the" 14 text run at (0,20) width 6 38: "element(span) containing the text, not the parentelement(div) that has the contentEditable attribute."15 RenderBlock {DIV} at (0,56) size 784x20 16 RenderInline {SPAN} at (0,0) size 124x19 [color=#FFFFFF] [bgcolor=#000000]14 text run at (0,20) width 679: "element(span) containing the text, not the root editable element(div) that has the contentEditable attribute." 15 RenderBlock {DIV} at (0,56) size 784x20 [bgcolor=#000000] 16 RenderInline {SPAN} at (0,0) size 124x19 [color=#FFFFFF] 17 17 RenderText {#text} at (0,0) size 124x19 18 18 text run at (0,0) width 124: "Where is my caret?" -
trunk/LayoutTests/platform/mac/editing/caret/caret-color-expected.txt
r177774 r281685 12 12 RenderText {#text} at (0,0) size 754x36 13 13 text run at (0,0) width 754: "This tests to make sure that the caret is visible in the black background by getting the caret color from the color of the" 14 text run at (0,18) width 6 38: "element(span) containing the text, not the parentelement(div) that has the contentEditable attribute."15 RenderBlock {DIV} at (0,52) size 784x18 16 RenderInline {SPAN} at (0,0) size 124x18 [color=#FFFFFF] [bgcolor=#000000]14 text run at (0,18) width 679: "element(span) containing the text, not the root editable element(div) that has the contentEditable attribute." 15 RenderBlock {DIV} at (0,52) size 784x18 [bgcolor=#000000] 16 RenderInline {SPAN} at (0,0) size 124x18 [color=#FFFFFF] 17 17 RenderText {#text} at (0,0) size 124x18 18 18 text run at (0,0) width 124: "Where is my caret?" -
trunk/LayoutTests/platform/win/editing/caret/caret-color-expected.txt
r152736 r281685 1 EDITING DELEGATE: shouldBeginEditingInDOMRange:range from 0 of DIV > BODY > HTML > #document to 3 of DIV > BODY > HTML > #document 2 EDITING DELEGATE: webViewDidBeginEditing:WebViewDidBeginEditingNotification 3 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 4 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 5 EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification 1 6 layer at (0,0) size 800x600 2 7 RenderView at (0,0) size 800x600 … … 7 12 RenderText {#text} at (0,0) size 735x36 8 13 text run at (0,0) width 735: "This tests to make sure that the caret is visible in the black background by getting the caret color from the color of the" 9 text run at (0,18) width 6 21: "element(span) containing the text, not the parentelement(div) that has the contentEditable attribute."10 RenderBlock {DIV} at (0,52) size 784x18 11 RenderInline {SPAN} at (0,0) size 121x18 [color=#FFFFFF] [bgcolor=#000000]14 text run at (0,18) width 660: "element(span) containing the text, not the root editable element(div) that has the contentEditable attribute." 15 RenderBlock {DIV} at (0,52) size 784x18 [bgcolor=#000000] 16 RenderInline {SPAN} at (0,0) size 121x18 [color=#FFFFFF] 12 17 RenderText {#text} at (0,0) size 121x18 13 18 text run at (0,0) width 121: "Where is my caret?" -
trunk/Source/WebCore/ChangeLog
r281683 r281685 1 2021-08-26 Joone Hur <joone@webkit.org> 2 3 Caret should respect text background color 4 https://bugs.webkit.org/show_bug.cgi?id=117493 5 6 Reviewed by Ryosuke Niwa. 7 8 An earlier fix for caret color, which we are now improving, was this commit: 9 https://trac.webkit.org/changeset/152612/webkit 10 11 This patch allows the caret to become visible in the black background 12 by getting the caret color from the element containing 13 the text, not the root editable element that has the contentEditable attribute. 14 15 * editing/FrameSelection.cpp: 16 (WebCore::CaretBase::computeCaretColor): 17 1 18 2021-08-26 Simon Fraser <simon.fraser@apple.com> 2 19 -
trunk/Source/WebCore/editing/FrameSelection.cpp
r280872 r281685 1791 1791 return elementStyle.caretColor(); 1792 1792 #else 1793 auto* rootEditableElement = node ? node->rootEditableElement() : nullptr;1794 auto* rootEditableStyle = rootEditableElement && rootEditableElement->renderer() ? &rootEditableElement->renderer()->style() : nullptr;1793 RefPtr parentElement = node ? node->parentElement() : nullptr; 1794 auto* parentStyle = parentElement && parentElement->renderer() ? &parentElement->renderer()->style() : nullptr; 1795 1795 // CSS value "auto" is treated as an invalid color. 1796 if (!elementStyle.caretColor().isValid() && rootEditableStyle) {1797 auto rootEditableBackgroundColor = rootEditableStyle->visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor);1796 if (!elementStyle.caretColor().isValid() && parentStyle) { 1797 auto parentBackgroundColor = parentStyle->visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor); 1798 1798 auto elementBackgroundColor = elementStyle.visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor); 1799 auto disappearsIntoBackground = blendSourceOver( rootEditableBackgroundColor, elementBackgroundColor) == rootEditableBackgroundColor;1799 auto disappearsIntoBackground = blendSourceOver(parentBackgroundColor, elementBackgroundColor) == parentBackgroundColor; 1800 1800 if (disappearsIntoBackground) 1801 return rootEditableStyle->visitedDependentColorWithColorFilter(CSSPropertyCaretColor);1801 return parentStyle->visitedDependentColorWithColorFilter(CSSPropertyCaretColor); 1802 1802 } 1803 1803 return elementStyle.visitedDependentColorWithColorFilter(CSSPropertyCaretColor);
Note: See TracChangeset
for help on using the changeset viewer.