Changeset 220706 in webkit
- Timestamp:
- Aug 14, 2017 10:29:34 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 14 added
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r220699 r220706 1 2017-08-14 Daniel Bates <dabates@apple.com> 2 3 [css-ui] Implement caret-color support 4 https://bugs.webkit.org/show_bug.cgi?id=166572 5 <rdar://problem/33852589> 6 7 Reviewed by David Hyatt. 8 9 Add reference tests to ensure that we do not regress CSS property caret-color. 10 11 * TestExpectations: Unskip Web Platform Tests that now pass. 12 * editing/deleting/maintain-style-after-delete-expected.txt: Updated expected result. 13 * editing/inserting/insert-paragraph-with-font-and-background-color-expected.txt: Ditto. 14 * editing/pasteboard/do-not-copy-unnecessary-styles-2-expected.txt: Ditto. 15 * editing/pasteboard/onpaste-text-html-expected.txt: Ditto. 16 * editing/pasteboard/preserve-caret-color-expected.txt: Added. 17 * editing/pasteboard/preserve-caret-color.html: Added. 18 * editing/pasteboard/preserve-underline-color-expected.txt: 19 * fast/css/caret-color-auto-expected.html: Added. 20 * fast/css/caret-color-auto.html: Added. 21 * fast/css/caret-color-expected.html: Added. 22 * fast/css/caret-color-fallback-to-color-expected.html: Added. 23 * fast/css/caret-color-fallback-to-color.html: Added. 24 * fast/css/caret-color-inherit-expected.html: Added. 25 * fast/css/caret-color-inherit.html: Added. 26 * fast/css/caret-color-span-inside-editable-parent-expected.html: Added. 27 * fast/css/caret-color-span-inside-editable-parent.html: Added. 28 * fast/css/caret-color.html: Added. 29 * fast/events/before-input-events-prevent-drag-and-drop-expected.txt: Updated expected result. 30 * fast/events/input-events-paste-rich-datatransfer-expected.txt: Ditto. 31 * fast/events/ondrop-text-html-expected.txt: Ditto. 32 * fast/history/visited-link-caret-color-expected.html: Added. 33 * fast/history/visited-link-caret-color.html: Added. 34 * platform/ios/TestExpectations: Skip the tests on iOS as iOS does not enable 35 ENABLE(TEXT_CARET). UIKit renders the text insertion caret on iOS. 36 * platform/mac/editing/style/5065910-expected.txt: Updated expected result. 37 * platform/mac/editing/style/5084241-expected.png: Ditto. 38 * platform/mac/editing/style/5084241-expected.txt: Ditto. 39 * platform/ios-wk2/editing/style/5084241-expected.txt: Ditto. 40 1 41 2017-08-14 Zan Dobersek <zdobersek@igalia.com> 2 42 -
trunk/LayoutTests/TestExpectations
r220626 r220706 1433 1433 webkit.org/b/175288 imported/w3c/web-platform-tests/css/css-ui-3/outline-019.html [ ImageOnlyFailure ] 1434 1434 webkit.org/b/175290 imported/w3c/web-platform-tests/css/css-ui-3/text-overflow-005.html [ ImageOnlyFailure ] 1435 1436 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-001.html [ Failure ]1437 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-002.html [ Failure ]1438 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-003.html [ Failure ]1439 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-004.html [ Failure ]1440 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-005.html [ Failure ]1441 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-006.html [ Failure ]1442 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-007.html [ Failure ]1443 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-008.html [ Failure ]1444 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-009.html [ Failure ]1445 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-010.html [ Failure ]1446 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-011.html [ Failure ]1447 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-012.html [ Failure ]1448 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-013.html [ Failure ]1449 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-014.html [ Failure ]1450 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-015.html [ Failure ]1451 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-016.html [ Failure ]1452 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-017.html [ Failure ]1453 webkit.org/b/166572 imported/w3c/web-platform-tests/css/css-ui-3/caret-color-021.html [ Failure ] -
trunk/LayoutTests/editing/deleting/maintain-style-after-delete-expected.txt
r155425 r220706 5 5 | <font> 6 6 | color="#0000ff" 7 | "O<#selection-caret>" 7 | <span> 8 | style="caret-color: rgb(0, 0, 255);" 9 | "O<#selection-caret>" 8 10 9 11 Deleting the blue colored text and the preceding space and then inserting 'W'. 'W' should be not be in blue color in the following markup: -
trunk/LayoutTests/editing/inserting/insert-paragraph-with-font-and-background-color-expected.txt
r151612 r220706 16 16 | color="#1b6f11" 17 17 | <span> 18 | style=" background-color: rgb(191, 35, 28);"18 | style="caret-color: rgb(27, 111, 17); background-color: rgb(191, 35, 28);" 19 19 | "Bar<#selection-caret>" 20 20 | <br> -
trunk/LayoutTests/editing/pasteboard/do-not-copy-unnecessary-styles-2-expected.txt
r126656 r220706 4 4 You should not see any borders: 5 5 | <span> 6 | style="c olor: rgb(0, 0, 255); background-color: rgb(255, 255, 0);"6 | style="caret-color: rgb(0, 0, 255); color: rgb(0, 0, 255); background-color: rgb(255, 255, 0);" 7 7 | "Hello<#selection-caret>" -
trunk/LayoutTests/editing/pasteboard/onpaste-text-html-expected.txt
r207797 r220706 1 1 CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the clipboard during an onpaste event. 2 CONSOLE MESSAGE: line 23: text/html: <span style="c olor: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space"> </span></span>2 CONSOLE MESSAGE: line 23: text/html: <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the clipboard during an onpaste event.<span class="Apple-converted-space"> </span></span> 3 3 This test verifies that we can get text/html from the clipboard during an onpaste event. This test requires DRT. 4 4 Paste content in this div.This test verifies that we can get text/html from the clipboard during an onpaste event. -
trunk/LayoutTests/editing/pasteboard/preserve-underline-color-expected.txt
r126656 r220706 1 1 This test for a bug copy/pasting underlined text. The color of the underline should be the color of the element that has the text-decoration property. 2 2 | <span> 3 | style="c olor: rgb(255, 0, 0); text-decoration: underline;"3 | style="caret-color: rgb(255, 0, 0); color: rgb(255, 0, 0); text-decoration: underline;" 4 4 | "This should be underlined.<#selection-caret>" 5 5 | <br> -
trunk/LayoutTests/fast/events/before-input-events-prevent-drag-and-drop-expected.txt
r208014 r220706 8 8 HTML content: 9 9 10 <span style="c olor: rgb(0, 0, 0); font-family: monospace; font-size: 108px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: center; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">input events</span>10 <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-family: monospace; font-size: 108px; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: center; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">input events</span> -
trunk/LayoutTests/fast/events/input-events-paste-rich-datatransfer-expected.txt
r207841 r220706 3 3 destination after pasting (text/html): 4 4 | <b> 5 | style="c olor: rgb(255, 0, 0); font-family: -webkit-standard; font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;"5 | style="caret-color: rgb(255, 0, 0); color: rgb(255, 0, 0); font-family: -webkit-standard; font-style: normal; font-variant-caps: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;" 6 6 | "LayoutTests" 7 7 | <i> -
trunk/LayoutTests/fast/events/ondrop-text-html-expected.txt
r207797 r220706 1 1 CONSOLE MESSAGE: line 21: text/plain: This test verifies that we can get text/html from the drag object during an ondrop event. 2 CONSOLE MESSAGE: line 23: text/html: <span style="c olor: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the drag object during an ondrop event.<span class="Apple-converted-space"> </span></span>2 CONSOLE MESSAGE: line 23: text/html: <span style="caret-color: rgb(0, 0, 0); color: rgb(0, 0, 0); font-size: medium; font-style: normal; font-variant-caps: normal; font-weight: normal; letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none;">This test verifies that we can get text/html from the drag object during an ondrop event.<span class="Apple-converted-space"> </span></span> 3 3 This test verifies that we can get text/html from the drag object during an ondrop event. This test requires DRT. 4 4 PASS -
trunk/LayoutTests/platform/ios-wk2/editing/style/5084241-expected.txt
r220443 r220706 9 9 text run at (0,20) width 64: "text color." 10 10 RenderBlock {DIV} at (0,56) size 784x20 11 RenderInline {FONT} at (0,0) size 151x19 [color=#FF0000] 12 RenderText {#text} at (0,0) size 151x19 13 text run at (0,0) width 151: "This text should be red." 14 RenderInline {FONT} at (0,0) size 159x19 [color=#0000FF] 15 RenderText {#text} at (150,0) size 159x19 16 text run at (150,0) width 159: "This text should be blue." 11 RenderInline {SPAN} at (0,0) size 309x19 12 RenderInline {FONT} at (0,0) size 151x19 [color=#FF0000] 13 RenderText {#text} at (0,0) size 151x19 14 text run at (0,0) width 151: "This text should be red." 15 RenderInline {FONT} at (0,0) size 159x19 [color=#0000FF] 16 RenderText {#text} at (150,0) size 159x19 17 text run at (150,0) width 159: "This text should be blue." 17 18 RenderBlock (anonymous) at (0,76) size 784x0 18 caret: position 25 of child 0 {#text} of child 1 {FONT} of child 2 {DIV} of body19 caret: position 25 of child 0 {#text} of child 1 {FONT} of child 0 {SPAN} of child 2 {DIV} of body -
trunk/LayoutTests/platform/ios/TestExpectations
r220530 r220706 408 408 svg/animations/animations-paused-when-inserted-in-hidden-document.html [ Skip ] 409 409 svg/animations/animations-paused-when-inserted-in-hidden-document2.html [ Skip ] 410 411 # iOS does not enable ENABLE(TEXT_CARET). UIKit renders the text insertion caret. 412 fast/css/caret-color-fallback-to-color.html [ Skip ] 413 fast/css/caret-color-inherit.html [ Skip ] 414 fast/css/caret-color-span-inside-editable-parent.html [ Skip ] 415 fast/css/caret-color.html [ Skip ] 416 fast/history/visited-link-caret-color.html [ Skip ] 410 417 411 418 ### -
trunk/LayoutTests/platform/mac/editing/style/5065910-expected.txt
r177774 r220706 13 13 text run at (0,0) width 151: "This text should be red." 14 14 RenderBlock {DIV} at (0,18) size 784x18 15 RenderInline {FONT} at (0,0) size 127x18 [color=#0000FF] 16 RenderText {#text} at (0,0) size 127x18 17 text run at (0,0) width 127: "This text should be " 18 RenderInline {FONT} at (0,0) size 240x18 [color=#008000] 19 RenderText {#text} at (126,0) size 240x18 20 text run at (126,0) width 240: "a combination of green and blue, not " 21 RenderInline {FONT} at (0,0) size 25x18 [color=#0000FF] 22 RenderText {#text} at (365,0) size 25x18 23 text run at (365,0) width 25: "red." 24 caret: position 37 of child 0 {#text} of child 1 {FONT} of child 1 {DIV} of child 2 {DIV} of body 15 RenderInline {SPAN} at (0,0) size 390x18 16 RenderInline {FONT} at (0,0) size 127x18 [color=#0000FF] 17 RenderText {#text} at (0,0) size 127x18 18 text run at (0,0) width 127: "This text should be " 19 RenderInline {FONT} at (0,0) size 240x18 [color=#008000] 20 RenderText {#text} at (126,0) size 240x18 21 text run at (126,0) width 240: "a combination of green and blue, not " 22 RenderInline {FONT} at (0,0) size 25x18 [color=#0000FF] 23 RenderText {#text} at (365,0) size 25x18 24 text run at (365,0) width 25: "red." 25 caret: position 37 of child 0 {#text} of child 1 {FONT} of child 0 {SPAN} of child 1 {DIV} of child 2 {DIV} of body -
trunk/LayoutTests/platform/mac/editing/style/5084241-expected.txt
r177774 r220706 9 9 text run at (0,18) width 64: "text color." 10 10 RenderBlock {DIV} at (0,52) size 784x18 11 RenderInline {FONT} at (0,0) size 151x18 [color=#FF0000] 12 RenderText {#text} at (0,0) size 151x18 13 text run at (0,0) width 151: "This text should be red." 14 RenderInline {FONT} at (0,0) size 159x18 [color=#0000FF] 15 RenderText {#text} at (150,0) size 159x18 16 text run at (150,0) width 159: "This text should be blue." 17 caret: position 25 of child 0 {#text} of child 1 {FONT} of child 2 {DIV} of body 11 RenderInline {SPAN} at (0,0) size 309x18 12 RenderInline {FONT} at (0,0) size 151x18 [color=#FF0000] 13 RenderText {#text} at (0,0) size 151x18 14 text run at (0,0) width 151: "This text should be red." 15 RenderInline {FONT} at (0,0) size 159x18 [color=#0000FF] 16 RenderText {#text} at (150,0) size 159x18 17 text run at (150,0) width 159: "This text should be blue." 18 caret: position 25 of child 0 {#text} of child 1 {FONT} of child 0 {SPAN} of child 2 {DIV} of body -
trunk/Source/WebCore/ChangeLog
r220699 r220706 1 2017-08-14 Daniel Bates <dabates@apple.com> 2 3 [css-ui] Implement caret-color support 4 https://bugs.webkit.org/show_bug.cgi?id=166572 5 <rdar://problem/33852589> 6 7 Reviewed by David Hyatt. 8 9 Add support for the CSS property caret-color as per <https://www.w3.org/TR/css-ui-3/#caret-color> (02 March 2017). 10 The property caret-color specifies the color of the text insertion caret in an editable element, 11 say an HTML textarea element. 12 13 Unlike other CSS color properties caret-color can have value "auto" and this is its initial 14 value. Internally we treat value "auto" as an invalid caret color to simplify the code. 15 16 Tests: editing/pasteboard/preserve-caret-color.html 17 fast/css/caret-color-auto.html 18 fast/css/caret-color-fallback-to-color.html 19 fast/css/caret-color-inherit.html 20 fast/css/caret-color-span-inside-editable-parent.html 21 fast/css/caret-color.html 22 fast/history/visited-link-caret-color.html 23 24 * css/CSSComputedStyleDeclaration.cpp: 25 (WebCore::ComputedStyleExtractor::propertyValue): 26 * css/CSSProperties.json: Add property caret-color. We represent the initial "auto" Also, fix up 27 wording in a comment while I am here. 28 * css/StyleResolver.cpp: 29 (WebCore::isValidVisitedLinkProperty): Add caret-color to the list of properties that can be 30 applied to visited hyperlinks. 31 * css/parser/CSSParserFastPaths.cpp: 32 (WebCore::parseCaretColor): Added. 33 (WebCore::CSSParserFastPaths::maybeParseValue): Unlike other CSS color properties caret-color 34 can be defined to be "auto". We explicitly check if the property is caret-color and use 35 parseCaretColor() to parse its value. 36 * css/parser/CSSPropertyParser.cpp: 37 (WebCore::consumeCaretColor): Added. 38 (WebCore::CSSPropertyParser::parseSingleValue): Similar to the change to CSSParserFastPaths::maybeParseValue() 39 use a dedicated code path to parse caret-color. 40 * editing/EditingStyle.cpp: Preserve caret-color during editing operations. 41 * editing/FrameSelection.cpp: 42 (WebCore::CaretBase::paintCaret const): Modified code to query property caret-color instead of 43 color for the color of the text insertion caret. Always honor the caret-color of the editable 44 element if it is valid color. Note that "caret-color: auto" is treated as an invalid color 45 internally. A caret-color can have an invalid color if its inherits from the CSS color property 46 with an invalid color. If caret-color is a valid color then we take it to be the color of the 47 text insertion caret. Otherwise, we do what we do today and use a heuristic to determine the 48 color of the text-insertion caret. 49 (WebCore::disappearsIntoBackground): Deleted; moved logic into CaretBase::paintCaret(). 50 * page/animation/CSSPropertyAnimation.cpp: 51 (WebCore::CSSPropertyAnimationWrapperMap::CSSPropertyAnimationWrapperMap): Add property wrapper 52 to support animating caret-color. 53 * rendering/style/RenderStyle.cpp: 54 (WebCore::RenderStyle::changeRequiresRepaintIfTextOrBorderOrOutline const): Modified to consider 55 changes to caret color. 56 (WebCore::RenderStyle::colorIncludingFallback const): Modified to compute the appropriate 57 color for property caret-color with respect to an unvisited or visited link. 58 * rendering/style/RenderStyle.h: 59 (WebCore::RenderStyle::setCaretColor): Added. 60 (WebCore::RenderStyle::setVisitedLinkCaretColor): Added. 61 (WebCore::RenderStyle::caretColor const): Added. 62 (WebCore::RenderStyle::visitedLinkCaretColor const): Added. 63 * rendering/style/StyleRareInheritedData.cpp: 64 (WebCore::StyleRareInheritedData::StyleRareInheritedData): Modified to consider caret color. 65 (WebCore::StyleRareInheritedData::operator== const): Ditto. 66 * rendering/style/StyleRareInheritedData.h: 67 1 68 2017-08-14 Zan Dobersek <zdobersek@igalia.com> 2 69 -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r220354 r220706 138 138 CSSPropertyBoxSizing, 139 139 CSSPropertyCaptionSide, 140 CSSPropertyCaretColor, 140 141 CSSPropertyClear, 141 142 CSSPropertyClip, … … 2892 2893 case CSSPropertyCaptionSide: 2893 2894 return cssValuePool.createValue(style->captionSide()); 2895 case CSSPropertyCaretColor: 2896 return m_allowVisitedStyle ? cssValuePool.createColorValue(style->visitedDependentColor(CSSPropertyCaretColor)) : currentColorOrValidColor(style, style->caretColor()); 2894 2897 case CSSPropertyClear: 2895 2898 return cssValuePool.createValue(style->clear()); -
trunk/Source/WebCore/css/CSSProperties.json
r217272 r220706 90 90 "", 91 91 "* no-default-color:", 92 "Should only with used with \"VisitedLinkColorSupport\". It indicates that for",92 "Should only be used with \"VisitedLinkColorSupport\". It indicates that when", 93 93 "setting the inherited value, it will not fallback to using the parent's", 94 94 "\"color\" property if the inherited color is invalid.", … … 171 171 ], 172 172 "properties": { 173 "caret-color" : { 174 "inherited": true, 175 "codegen-properties": { 176 "initial": "invalidColor", 177 "visited-link-color-support": true 178 }, 179 "specification": { 180 "category": "css-ui", 181 "url": "https://drafts.csswg.org/css-ui-3/#propdef-caret-color" 182 } 183 }, 173 184 "color": { 174 185 "inherited": true, -
trunk/Source/WebCore/css/StyleResolver.cpp
r220207 r220706 1456 1456 case CSSPropertyBorderTopColor: 1457 1457 case CSSPropertyBorderBottomColor: 1458 case CSSPropertyCaretColor: 1458 1459 case CSSPropertyColor: 1459 1460 case CSSPropertyOutlineColor: -
trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp
r220382 r220706 1318 1318 } 1319 1319 1320 static RefPtr<CSSValue> parseCaretColor(const String& string, CSSParserMode parserMode) 1321 { 1322 ASSERT(!string.isEmpty()); 1323 CSSValueID valueID = cssValueKeywordID(string); 1324 if (valueID == CSSValueAuto) 1325 return CSSValuePool::singleton().createIdentifierValue(valueID); 1326 return CSSParserFastPaths::parseColor(string, parserMode); 1327 } 1328 1320 1329 RefPtr<CSSValue> CSSParserFastPaths::maybeParseValue(CSSPropertyID propertyID, const String& string, CSSParserMode parserMode) 1321 1330 { … … 1323 1332 if (result) 1324 1333 return result; 1334 if (propertyID == CSSPropertyCaretColor) 1335 return parseCaretColor(string, parserMode); 1325 1336 if (isColorPropertyID(propertyID)) 1326 1337 return parseColor(string, parserMode); -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r219642 r220706 1810 1810 return shape; 1811 1811 return nullptr; 1812 } 1813 1814 static RefPtr<CSSPrimitiveValue> consumeCaretColor(CSSParserTokenRange& range, CSSParserMode cssParserMode) 1815 { 1816 if (range.peek().id() == CSSValueAuto) 1817 return consumeIdent(range); 1818 return consumeColor(range, cssParserMode); 1812 1819 } 1813 1820 … … 4021 4028 case CSSPropertyColumnRuleColor: 4022 4029 return consumeColor(m_range, m_context.mode); 4030 case CSSPropertyCaretColor: 4031 return consumeCaretColor(m_range, m_context.mode); 4023 4032 case CSSPropertyColor: 4024 4033 case CSSPropertyBackgroundColor: -
trunk/Source/WebCore/editing/EditingStyle.cpp
r220531 r220706 59 59 // e.g. when a user inserts a new paragraph, all properties listed here must be copied to the new paragraph. 60 60 static const CSSPropertyID editingProperties[] = { 61 CSSPropertyCaretColor, 61 62 CSSPropertyColor, 62 63 CSSPropertyFontFamily, -
trunk/Source/WebCore/editing/FrameSelection.cpp
r218998 r220706 1714 1714 } 1715 1715 1716 #if ENABLE(TEXT_CARET)1717 static inline bool disappearsIntoBackground(const Color& foreground, const Color& background)1718 {1719 return background.blend(foreground) == background;1720 }1721 #endif1722 1723 1716 void CaretBase::paintCaret(Node* node, GraphicsContext& context, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const 1724 1717 { … … 1737 1730 Color caretColor = Color::black; 1738 1731 Element* element = is<Element>(*node) ? downcast<Element>(node) : node->parentElement(); 1739 Element* rootEditableElement = node->rootEditableElement();1740 1741 1732 if (element && element->renderer()) { 1742 bool setToRootEditableElement = false; 1743 if (rootEditableElement && rootEditableElement->renderer()) { 1744 const auto& rootEditableStyle = rootEditableElement->renderer()->style(); 1745 const auto& elementStyle = element->renderer()->style(); 1746 auto rootEditableBGColor = rootEditableStyle.visitedDependentColor(CSSPropertyBackgroundColor); 1747 auto elementBGColor = elementStyle.visitedDependentColor(CSSPropertyBackgroundColor); 1748 if (disappearsIntoBackground(elementBGColor, rootEditableBGColor)) { 1749 caretColor = rootEditableStyle.visitedDependentColor(CSSPropertyColor); 1750 setToRootEditableElement = true; 1733 auto computeCaretColor = [] (const RenderStyle& elementStyle, const RenderStyle* rootEditableStyle) { 1734 // CSS value "auto" is treated as an invalid color. 1735 if (!elementStyle.caretColor().isValid() && rootEditableStyle) { 1736 auto rootEditableBackgroundColor = rootEditableStyle->visitedDependentColor(CSSPropertyBackgroundColor); 1737 auto elementBackgroundColor = elementStyle.visitedDependentColor(CSSPropertyBackgroundColor); 1738 auto disappearsIntoBackground = rootEditableBackgroundColor.blend(elementBackgroundColor) == rootEditableBackgroundColor; 1739 if (disappearsIntoBackground) 1740 return rootEditableStyle->visitedDependentColor(CSSPropertyCaretColor); 1751 1741 } 1752 } 1753 if (!setToRootEditableElement) 1754 caretColor = element->renderer()->style().visitedDependentColor(CSSPropertyColor); 1742 return elementStyle.visitedDependentColor(CSSPropertyCaretColor); 1743 }; 1744 auto* rootEditableElement = node->rootEditableElement(); 1745 auto* rootEditableStyle = rootEditableElement && rootEditableElement->renderer() ? &rootEditableElement->renderer()->style() : nullptr; 1746 caretColor = computeCaretColor(element->renderer()->style(), rootEditableStyle); 1755 1747 } 1756 1748 -
trunk/Source/WebCore/page/animation/CSSPropertyAnimation.cpp
r220503 r220706 1494 1494 new LengthPropertyWrapper<Length>(CSSPropertyPaddingTop, &RenderStyle::paddingTop, &RenderStyle::setPaddingTop), 1495 1495 new LengthPropertyWrapper<Length>(CSSPropertyPaddingBottom, &RenderStyle::paddingBottom, &RenderStyle::setPaddingBottom), 1496 1497 new PropertyWrapperVisitedAffectedColor(CSSPropertyCaretColor, &RenderStyle::caretColor, &RenderStyle::setCaretColor, &RenderStyle::visitedLinkCaretColor, &RenderStyle::setVisitedLinkCaretColor), 1498 1496 1499 new PropertyWrapperVisitedAffectedColor(CSSPropertyColor, &RenderStyle::color, &RenderStyle::setColor, &RenderStyle::visitedLinkColor, &RenderStyle::setVisitedLinkColor), 1497 1500 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r220383 r220706 903 903 || m_rareInheritedData->textEmphasisColor != other.m_rareInheritedData->textEmphasisColor 904 904 || m_rareInheritedData->textEmphasisFill != other.m_rareInheritedData->textEmphasisFill 905 || m_rareInheritedData->strokeColor != other.m_rareInheritedData->strokeColor) 905 || m_rareInheritedData->strokeColor != other.m_rareInheritedData->strokeColor 906 || m_rareInheritedData->caretColor != other.m_rareInheritedData->caretColor) 906 907 return true; 907 908 … … 1750 1751 borderStyle = borderBottomStyle(); 1751 1752 break; 1753 case CSSPropertyCaretColor: 1754 result = visitedLink ? visitedLinkCaretColor() : caretColor(); 1755 break; 1752 1756 case CSSPropertyColor: 1753 1757 result = visitedLink ? visitedLinkColor() : color(); -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r219755 r220706 1037 1037 void setTextStrokeWidth(float w) { SET_VAR(m_rareInheritedData, textStrokeWidth, w); } 1038 1038 void setTextFillColor(const Color& c) { SET_VAR(m_rareInheritedData, textFillColor, c); } 1039 void setCaretColor(const Color& c) { SET_VAR(m_rareInheritedData, caretColor, c); } 1039 1040 void setOpacity(float f) { float v = clampTo<float>(f, 0, 1); SET_VAR(m_rareNonInheritedData, opacity, v); } 1040 1041 void setAppearance(ControlPart a) { SET_VAR(m_rareNonInheritedData, appearance, a); } … … 1696 1697 void setVisitedLinkTextFillColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextFillColor, v); } 1697 1698 void setVisitedLinkTextStrokeColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkTextStrokeColor, v); } 1699 void setVisitedLinkCaretColor(const Color& v) { SET_VAR(m_rareInheritedData, visitedLinkCaretColor, v); } 1698 1700 1699 1701 void inheritUnicodeBidiFrom(const RenderStyle* parent) { m_nonInheritedFlags.setUnicodeBidi(parent->m_nonInheritedFlags.unicodeBidi()); } … … 1716 1718 const Color& textFillColor() const { return m_rareInheritedData->textFillColor; } 1717 1719 const Color& textStrokeColor() const { return m_rareInheritedData->textStrokeColor; } 1720 const Color& caretColor() const { return m_rareInheritedData->caretColor; } 1718 1721 const Color& visitedLinkColor() const; 1719 1722 const Color& visitedLinkBackgroundColor() const { return m_rareNonInheritedData->visitedLinkBackgroundColor; } … … 1729 1732 const Color& visitedLinkTextFillColor() const { return m_rareInheritedData->visitedLinkTextFillColor; } 1730 1733 const Color& visitedLinkTextStrokeColor() const { return m_rareInheritedData->visitedLinkTextStrokeColor; } 1734 const Color& visitedLinkCaretColor() const { return m_rareInheritedData->visitedLinkCaretColor; } 1731 1735 1732 1736 const Color& stopColor() const { return svgStyle().stopColor(); } -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r219755 r220706 39 39 Color firstColor; 40 40 float firstFloat; 41 Color colors[ 7];41 Color colors[9]; 42 42 void* ownPtrs[1]; 43 43 AtomicString atomicStrings[5]; … … 161 161 , visitedLinkTextFillColor(o.visitedLinkTextFillColor) 162 162 , visitedLinkTextEmphasisColor(o.visitedLinkTextEmphasisColor) 163 , caretColor(o.caretColor) 164 , visitedLinkCaretColor(o.visitedLinkCaretColor) 163 165 , textShadow(o.textShadow ? std::make_unique<ShadowData>(*o.textShadow) : nullptr) 164 166 , cursorData(o.cursorData) … … 262 264 && visitedLinkTextFillColor == o.visitedLinkTextFillColor 263 265 && visitedLinkTextEmphasisColor == o.visitedLinkTextEmphasisColor 266 && caretColor == o.caretColor 267 && visitedLinkCaretColor == o.visitedLinkCaretColor 264 268 #if ENABLE(TOUCH_EVENTS) 265 269 && tapHighlightColor == o.tapHighlightColor -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r215261 r220706 67 67 Color visitedLinkTextStrokeColor; 68 68 Color visitedLinkTextFillColor; 69 Color visitedLinkTextEmphasisColor; 69 Color visitedLinkTextEmphasisColor; 70 71 Color caretColor; 72 Color visitedLinkCaretColor; 70 73 71 74 std::unique_ptr<ShadowData> textShadow; // Our text shadow information for shadowed text drawing.
Note: See TracChangeset
for help on using the changeset viewer.