Changeset 234064 in webkit
- Timestamp:
- Jul 20, 2018 2:10:40 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 21 edited
- 4 copied
- 2 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r234061 r234064 1 2018-07-20 Ryosuke Niwa <rniwa@apple.com> 2 3 Picking a color from the color panel for typing attributes needs to inverse transform through color-filter 4 https://bugs.webkit.org/show_bug.cgi?id=187846 5 6 Reviewed by Simon Fraser. 7 8 Added tests to make sure foreground or background colors specified in execCommand don't get inverted. 9 10 Fixed the test which was asserting that textInputController.attributedSubstringFromRange doesn't invert the color 11 since that's exactly what WebKit embedders uses to compute the style for color pickers. 12 13 Added new tests for copy & paste case using textInputController.legacyAttributedString. 14 15 * editing/execCommand/set-backColor-with-color-filter-from-scripts-expected.txt: Added. 16 * editing/execCommand/set-backColor-with-color-filter-from-scripts.html: Added. 17 * editing/execCommand/set-foreColor-with-color-filter-from-scripts-expected.txt: Added. 18 * editing/execCommand/set-foreColor-with-color-filter-from-scripts.html: Added. 19 * editing/mac/attributed-string/attrib-string-range-with-color-filter-expected.txt: 20 * editing/mac/attributed-string/attrib-string-range-with-color-filter.html: This test uses attributedSubstringFromRange, 21 which implemented using editingAttributedStringFromRange in WebCore. Since this is exactly what WebKit embedders uses 22 to compute the current style of the selected text, we need to invert the color here. This API's main clinet is input methods 23 so this shouldn't affect other editing operations, in particular, copy and paste, which uses HTMLConverter. 24 * editing/mac/attributed-string/attribute-string-for-copy-with-color-filter-expected.txt: Added. 25 * editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html: Added. Make sure the attributed string 26 generated for copy & paste does not invert foreground or background colors via textInputController.legacyAttributedString. 27 This is testing HTMLConverter, not editingAttributedStringFromRange, used by WebKit embedders and input methods. 28 * editing/mac/attributed-string/attributed-string-for-typing-with-color-filter-expected.txt: 29 * editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html: Added background color in the test. 30 * editing/style/set-backColor-with-color-filter-expected.txt: Added. 31 * editing/style/set-backColor-with-color-filter.html: Added. 32 * editing/style/set-foreColor-with-color-filter-expected.txt: Renamed from exec-command-foreColor-with-color-filter-expected.txt. 33 * editing/style/set-foreColor-with-color-filter.html: Renamed from exec-command-foreColor-with-color-filter.html. 34 Updated the test to use testRunner.execCommand which uses CommandFromMenuOrKeyBinding in applyCommandToFrame since we're 35 trying to test the code path taken by WebKit embedders and font panel here. 36 1 37 2018-07-20 Chris Dumez <cdumez@apple.com> 2 38 -
trunk/LayoutTests/editing/execCommand/set-backColor-with-color-filter-from-scripts.html
r234063 r234064 1 1 <!DOCTYPE html><!-- webkit-test-runner [ enableColorFilter=true ] --> 2 2 <html> 3 <head>4 <title>Setting the foreground color should invert the color through -apple-color-filter</title>5 <script src="../../resources/dump-as-markup.js"></script>6 </head>7 3 <body> 8 4 <div id="test" style="-apple-color-filter: apple-invert-lightness()" contenteditable>hello world</div> 5 <script src="../../resources/dump-as-markup.js"></script> 9 6 <script> 7 Markup.description('Setting the background color should invert the color through -apple-color-filter'); 8 10 9 window.getSelection().setPosition(test, 0); 11 10 window.getSelection().modify('extend', 'forward', 'word'); 12 11 window.getSelection().modify('extend', 'forward', 'word'); 13 document.execCommand(' foreColor', false, '#224433');14 Markup.dump('test', '"world" should be #ecfffd');12 document.execCommand('backColor', false, '#224433'); 13 Markup.dump('test', `"world" should be #224433 / rgb(${0x22}, ${0x44}, ${0x33})`); 15 14 16 15 </script> -
trunk/LayoutTests/editing/execCommand/set-foreColor-with-color-filter-from-scripts.html
r234063 r234064 1 1 <!DOCTYPE html><!-- webkit-test-runner [ enableColorFilter=true ] --> 2 2 <html> 3 <head>4 <title>Setting the foreground color should invert the color through -apple-color-filter</title>5 <script src="../../resources/dump-as-markup.js"></script>6 </head>7 3 <body> 8 4 <div id="test" style="-apple-color-filter: apple-invert-lightness()" contenteditable>hello world</div> 5 <script src="../../resources/dump-as-markup.js"></script> 9 6 <script> 7 Markup.description('Setting the foreground color should not invert the color through -apple-color-filter'); 8 10 9 window.getSelection().setPosition(test, 0); 11 10 window.getSelection().modify('extend', 'forward', 'word'); 12 11 window.getSelection().modify('extend', 'forward', 'word'); 13 12 document.execCommand('foreColor', false, '#224433'); 14 Markup.dump('test', '"world" should be # ecfffd');13 Markup.dump('test', '"world" should be #224433'); 15 14 16 15 </script> -
trunk/LayoutTests/editing/mac/attributed-string/attrib-string-range-with-color-filter-expected.txt
r234005 r234064 1 Test that an NSAttributedString from a range doesn't convertcolors through -apple-color-filter.1 Test that an NSAttributedString from a range converts colors through -apple-color-filter. 2 2 3 3 [is t] 4 NSColor: # cccccc (sRGB)4 NSColor: #5c5c5c (sRGB) 5 5 NSFont: Times-Roman 16.00 pt. 6 6 -
trunk/LayoutTests/editing/mac/attributed-string/attrib-string-range-with-color-filter.html
r234005 r234064 2 2 <div id="target" style="color: #CCC; -apple-color-filter: apple-invert-lightness();"contenteditable>This text is light gray</div> 3 3 <p> 4 Test that an NSAttributedString from a range doesn't convertcolors through -apple-color-filter.4 Test that an NSAttributedString from a range converts colors through -apple-color-filter. 5 5 </p> 6 6 <script src="resources/dump-attributed-string.js"></script> -
trunk/LayoutTests/editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html
r234063 r234064 1 1 <!DOCTYPE html><!-- webkit-test-runner [ enableColorFilter=true ] --> 2 <div id="target" style="color: # CCC; -apple-color-filter: apple-invert-lightness();"contenteditable>This text is light gray</div>2 <div id="target" style="color: #ccc; background: #369; -apple-color-filter: apple-invert-lightness();" contenteditable>This text is light gray</div> 3 3 <p> 4 Test that an NSAttributedString f rom a rangedoesn't convert colors through -apple-color-filter.4 Test that an NSAttributedString for copy doesn't convert colors through -apple-color-filter. 5 5 </p> 6 6 <script src="resources/dump-attributed-string.js"></script> … … 21 21 target.focus(); 22 22 23 var attributedString = textInputController.attributedSubstringFromRange(2, 4); 23 const range = new Range; 24 range.setStart(target.firstChild, 2); 25 range.setEnd(target.firstChild, 4); 26 27 var attributedString = textInputController.legacyAttributedString(range); 24 28 var serializedString = serializeAttributedString(attributedString); 25 29 log(serializedString); -
trunk/LayoutTests/editing/mac/attributed-string/attributed-string-for-typing-with-color-filter-expected.txt
r234005 r234064 1 1 Some text here 2 2 Input: 3 <div id="editor" style="-apple-color-filter: apple-invert-lightness(); color: rgba(20, 20, 20, 0.4); " contenteditable="">Some text here</div>3 <div id="editor" style="-apple-color-filter: apple-invert-lightness(); color: rgba(20, 20, 20, 0.4); background: #ccc;" contenteditable="">Some text here</div> 4 4 5 5 Output: 6 6 [ ] 7 NSBackgroundColor: #5c5c5c (sRGB) 7 8 NSColor: rgba(239, 239, 239, 0.4) (sRGB) 8 9 NSFont: Times-Roman 16.00 pt. -
trunk/LayoutTests/editing/mac/attributed-string/attributed-string-for-typing-with-color-filter.html
r234014 r234064 9 9 <body> 10 10 11 <div id="editor" style="-apple-color-filter: apple-invert-lightness(); color: rgba(20, 20, 20, 0.4); " contenteditable>Some text here</div>11 <div id="editor" style="-apple-color-filter: apple-invert-lightness(); color: rgba(20, 20, 20, 0.4); background: #ccc;" contenteditable>Some text here</div> 12 12 <pre id="result">This test requires DumpRenderTree</pre> 13 13 <script type="text/javascript"> -
trunk/LayoutTests/editing/style/set-backColor-with-color-filter.html
r234063 r234064 1 1 <!DOCTYPE html><!-- webkit-test-runner [ enableColorFilter=true ] --> 2 2 <html> 3 <head>4 <title>Setting the foreground color should invert the color through -apple-color-filter</title>5 <script src="../../resources/dump-as-markup.js"></script>6 </head>7 3 <body> 8 4 <div id="test" style="-apple-color-filter: apple-invert-lightness()" contenteditable>hello world</div> 5 <script src="../../resources/dump-as-markup.js"></script> 9 6 <script> 7 8 Markup.description('Setting the background color should invert the color through -apple-color-filter'); 9 10 10 window.getSelection().setPosition(test, 0); 11 11 window.getSelection().modify('extend', 'forward', 'word'); 12 12 window.getSelection().modify('extend', 'forward', 'word'); 13 document.execCommand('foreColor', false, '#224433'); 14 Markup.dump('test', '"world" should be #ecfffd'); 13 if (window.testRunner) 14 testRunner.execCommand('backColor', false, '#224433'); 15 else 16 document.write('This test requires WebKitTestRunner or DumpRenderTree'); 17 18 Markup.dump('test', `"world" should be #ecfffd / rgb(${0xec}, ${0xff}, ${0xfd})`); 15 19 16 20 </script> -
trunk/LayoutTests/editing/style/set-foreColor-with-color-filter-expected.txt
r234063 r234064 1 Setting the foreground color should invert the color through -apple-color-filter 1 2 2 3 "world" should be #ecfffd: -
trunk/LayoutTests/editing/style/set-foreColor-with-color-filter.html
r234063 r234064 1 1 <!DOCTYPE html><!-- webkit-test-runner [ enableColorFilter=true ] --> 2 2 <html> 3 <head>4 <title>Setting the foreground color should invert the color through -apple-color-filter</title>5 <script src="../../resources/dump-as-markup.js"></script>6 </head>7 3 <body> 8 4 <div id="test" style="-apple-color-filter: apple-invert-lightness()" contenteditable>hello world</div> 5 <script src="../../resources/dump-as-markup.js"></script> 9 6 <script> 7 8 Markup.description('Setting the foreground color should invert the color through -apple-color-filter'); 9 10 10 window.getSelection().setPosition(test, 0); 11 11 window.getSelection().modify('extend', 'forward', 'word'); 12 12 window.getSelection().modify('extend', 'forward', 'word'); 13 document.execCommand('foreColor', false, '#224433'); 13 if (window.testRunner) 14 testRunner.execCommand('foreColor', false, '#224433'); 15 else 16 document.write('This test requires WebKitTestRunner or DumpRenderTree'); 17 14 18 Markup.dump('test', '"world" should be #ecfffd'); 15 19 -
trunk/LayoutTests/platform/mac-sierra/editing/mac/attributed-string/attrib-string-range-with-color-filter-expected.txt
r234005 r234064 1 Test that an NSAttributedString from a range doesn't convertcolors through -apple-color-filter.1 Test that an NSAttributedString from a range converts colors through -apple-color-filter. 2 2 3 3 [is t] 4 NSColor: # cccccc (NSCustomColorSpace)4 NSColor: #5c5c5c (NSCustomColorSpace) 5 5 NSFont: Times-Roman 16.00 pt. 6 6 -
trunk/LayoutTests/platform/mac-sierra/editing/mac/attributed-string/attributed-string-for-typing-with-color-filter-expected.txt
r234041 r234064 1 1 Some text here 2 2 Input: 3 <div id="editor" style="-apple-color-filter: apple-invert-lightness(); color: rgba(20, 20, 20, 0.4); " contenteditable="">Some text here</div>3 <div id="editor" style="-apple-color-filter: apple-invert-lightness(); color: rgba(20, 20, 20, 0.4); background: #ccc;" contenteditable="">Some text here</div> 4 4 5 5 Output: 6 6 [ ] 7 NSBackgroundColor: #5c5c5c (NSCustomColorSpace) 7 8 NSColor: rgba(239, 239, 239, 0.4) (NSCustomColorSpace) 8 9 NSFont: Times-Roman 16.00 pt. -
trunk/LayoutTests/platform/win/TestExpectations
r234005 r234064 99 99 webkit.org/b/173281 http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-insecure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html [ Skip ] 100 100 webkit.org/b/173281 http/tests/security/mixedContent/secure-redirect-to-secure-redirect-to-basic-auth-secure-image-allowCrossOriginSubresourcesToAskForCredentials.https.html [ Skip ] 101 webkit.org/b/173281 editing/style/exec-command-foreColor-with-color-filter.html [ Skip ] 101 webkit.org/b/173281 editing/style/set-foreColor-with-color-filter.html [ Skip ] 102 webkit.org/b/173281 editing/style/set-backColor-with-color-filter.html [ Skip ] 102 103 103 104 # TODO HW filters not yet supported on Windows -
trunk/Source/WebCore/ChangeLog
r234055 r234064 1 2018-07-20 Ryosuke Niwa <rniwa@apple.com> 2 3 Picking a color from the color panel for typing attributes needs to inverse transform through color-filter 4 https://bugs.webkit.org/show_bug.cgi?id=187846 5 6 Reviewed by Simon Fraser. 7 8 This patch refines the color inversion for editing introduced in r234005 so that font panels and WebKit embedders 9 can get and set inverted colors using attributed strings for a selected text in an editable region. 10 11 More specifically, when font panels or WebKit embedders set a font color or a background color via WebView's 12 _applyStyleToSelection and _applyEditingStyleToSelection, WebKit would automatically invert the color before inserting 13 into DOM so that the color visible to the user matches that's given to WebKit. Conversely, 14 [WebView attributedSubstringFromRange:nsRange] now return the color visible to the user, i.e. the color after 15 the color filter had been applied, so that some WebKit embedders can present the visually identical color to the user. 16 17 Because DOM never sees the color filter's effect in the computed style, etc... this patch reverts the change made to 18 StyleChange in r234005 to avoid inverting the color passed to execCommand. This makes editing apps which is unaware 19 of the dark mode or -apple-color-filter continue to function (because the color picker implemented in DOM will be 20 applied of the same color filter before being presented to the user). 21 22 Finally, this patch introduces a testing hook in applyCommandToFrame so that executing foreColor or backColor with 23 the soruce of CommandFromMenuOrKeyBinding would trigger the same code path as the one taken by Objective-C 24 25 Tests: editing/execCommand/set-backColor-with-color-filter-from-scripts.html 26 editing/execCommand/set-foreColor-with-color-filter-from-scripts.html 27 editing/mac/attributed-string/attribute-string-for-copy-with-color-filter.html 28 editing/style/set-backColor-with-color-filter.html 29 editing/style/set-foreColor-with-color-filter.html 30 31 * editing/EditingStyle.cpp: 32 (WebCore::EditingStyle::inverseTransformColorIfNeeded): Added. 33 (WebCore::StyleChange::StyleChange): Revert the change made in r234005 since this code is also used by execCommand 34 which is not desirable, and won't work for background color. 35 (WebCore::StyleChange::extractTextStyles): Ditto. 36 * editing/EditingStyle.h: 37 * editing/Editor.cpp: 38 (WebCore::Editor::applyStyle): 39 (WebCore::Editor::applyStyleToSelection): Call EditingStyle::inverseTransformColorIfNeeded when ColorFilterMode is 40 set to InvertColor. 41 * editing/Editor.h: 42 * editing/EditorCommand.cpp: 43 (WebCore::applyCommandToFrame): Added the aforementioned testing hook. 44 * editing/cocoa/HTMLConverter.mm: 45 (WebCore::editingAttributedStringFromRange): Take the color filtr into account. Some WebKit embedders use this 46 function to compute the font color in the selected text. Note that this function is mostly used for input methods 47 so the color doesn't really matter, and its implementation is distinct from that of HTMLConverter. 48 1 49 2018-07-19 Jer Noble <jer.noble@apple.com> 2 50 -
trunk/Source/WebCore/editing/EditingStyle.cpp
r234005 r234064 1539 1539 } 1540 1540 1541 Ref<EditingStyle> EditingStyle::inverseTransformColorIfNeeded(Element& element) 1542 { 1543 auto* renderer = element.renderer(); 1544 if (!m_mutableStyle || !renderer || !renderer->style().hasAppleColorFilter()) 1545 return *this; 1546 1547 bool hasColor = m_mutableStyle->getPropertyCSSValue(CSSPropertyColor); 1548 bool hasBackgroundColor = m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); 1549 if (!hasColor && !hasBackgroundColor) 1550 return *this; 1551 1552 auto styleWithInvertedColors = copy(); 1553 ASSERT(styleWithInvertedColors->m_mutableStyle); 1554 1555 const auto& colorFilter = renderer->style().appleColorFilter(); 1556 auto invertedColor = [&](CSSPropertyID propertyID) { 1557 Color newColor = cssValueToColor(extractPropertyValue(*m_mutableStyle, propertyID).get()); 1558 colorFilter.inverseTransformColor(newColor); 1559 styleWithInvertedColors->m_mutableStyle->setProperty(propertyID, newColor.cssText()); 1560 }; 1561 1562 if (hasColor) 1563 invertedColor(CSSPropertyColor); 1564 1565 if (hasBackgroundColor) 1566 invertedColor(CSSPropertyBackgroundColor); 1567 1568 return styleWithInvertedColors; 1569 } 1570 1541 1571 static void reconcileTextDecorationProperties(MutableStyleProperties* style) 1542 1572 { … … 1581 1611 bool shouldStyleWithCSS = document->frame()->editor().shouldStyleWithCSS(); 1582 1612 if (!shouldStyleWithCSS) 1583 extractTextStyles(document, * node, *mutableStyle, computedStyle.useFixedFontDefaultSize());1613 extractTextStyles(document, *mutableStyle, computedStyle.useFixedFontDefaultSize()); 1584 1614 1585 1615 bool shouldAddUnderline = style->underlineChange() == TextDecorationChange::Add; … … 1654 1684 } 1655 1685 1656 void StyleChange::extractTextStyles(Document* document, Node& startNode,MutableStyleProperties& style, bool shouldUseFixedFontDefaultSize)1686 void StyleChange::extractTextStyles(Document* document, MutableStyleProperties& style, bool shouldUseFixedFontDefaultSize) 1657 1687 { 1658 1688 if (identifierForStyleProperty(style, CSSPropertyFontWeight) == CSSValueBold) { … … 1698 1728 1699 1729 if (style.getPropertyCSSValue(CSSPropertyColor)) { 1700 Color newColor = textColorFromStyle(style); 1701 1702 if (startNode.renderer() && startNode.renderer()->style().hasAppleColorFilter()) 1703 startNode.renderer()->style().appleColorFilter().inverseTransformColor(newColor); 1704 1705 m_applyFontColor = newColor.serialized(); 1730 m_applyFontColor = Color(textColorFromStyle(style)).serialized(); 1706 1731 style.removeProperty(CSSPropertyColor); 1707 1732 } -
trunk/Source/WebCore/editing/EditingStyle.h
r234005 r234064 169 169 static WritingDirection textDirectionForSelection(const VisibleSelection&, EditingStyle* typingStyle, bool& hasNestedOrMultipleEmbeddings); 170 170 171 Ref<EditingStyle> inverseTransformColorIfNeeded(Element&); 172 171 173 private: 172 174 EditingStyle(); … … 223 225 } 224 226 private: 225 void extractTextStyles(Document*, Node& startNode,MutableStyleProperties&, bool shouldUseFixedFontDefaultSize);227 void extractTextStyles(Document*, MutableStyleProperties&, bool shouldUseFixedFontDefaultSize); 226 228 227 229 RefPtr<MutableStyleProperties> m_cssStyle; -
trunk/Source/WebCore/editing/Editor.cpp
r233434 r234064 893 893 { 894 894 if (style) 895 applyStyle(EditingStyle::create(style), editingAction );896 } 897 898 void Editor::applyStyle(RefPtr<EditingStyle>&& style, EditAction editingAction )895 applyStyle(EditingStyle::create(style), editingAction, ColorFilterMode::UseOriginalColor); 896 } 897 898 void Editor::applyStyle(RefPtr<EditingStyle>&& style, EditAction editingAction, ColorFilterMode colorFilterMode) 899 899 { 900 900 if (!style) … … 911 911 return; 912 912 913 Ref<EditingStyle> styleToApply = colorFilterMode == ColorFilterMode::InvertColor ? style->inverseTransformColorIfNeeded(*element) : style.releaseNonNull(); 914 913 915 switch (selectionType) { 914 916 case VisibleSelection::CaretSelection: 915 computeAndSetTypingStyle( *style, editingAction);917 computeAndSetTypingStyle(styleToApply.get(), editingAction); 916 918 break; 917 919 case VisibleSelection::RangeSelection: 918 ApplyStyleCommand::create(document(), style .get(), editingAction)->apply();920 ApplyStyleCommand::create(document(), styleToApply.ptr(), editingAction)->apply(); 919 921 break; 920 922 default: … … 963 965 } 964 966 965 void Editor::applyStyleToSelection(Ref<EditingStyle>&& style, EditAction editingAction )967 void Editor::applyStyleToSelection(Ref<EditingStyle>&& style, EditAction editingAction, ColorFilterMode colorFilterMode) 966 968 { 967 969 if (style->isEmpty() || !canEditRichly()) … … 972 974 return; 973 975 974 applyStyle(WTFMove(style), editingAction );976 applyStyle(WTFMove(style), editingAction, colorFilterMode); 975 977 } 976 978 -
trunk/Source/WebCore/editing/Editor.h
r233434 r234064 217 217 218 218 WEBCORE_EXPORT void applyStyle(StyleProperties*, EditAction = EditActionUnspecified); 219 void applyStyle(RefPtr<EditingStyle>&&, EditAction); 219 enum class ColorFilterMode { InvertColor, UseOriginalColor }; 220 void applyStyle(RefPtr<EditingStyle>&&, EditAction, ColorFilterMode); 220 221 void applyParagraphStyle(StyleProperties*, EditAction = EditActionUnspecified); 221 222 WEBCORE_EXPORT void applyStyleToSelection(StyleProperties*, EditAction); 222 WEBCORE_EXPORT void applyStyleToSelection(Ref<EditingStyle>&&, EditAction );223 WEBCORE_EXPORT void applyStyleToSelection(Ref<EditingStyle>&&, EditAction, ColorFilterMode); 223 224 void applyParagraphStyleToSelection(StyleProperties*, EditAction); 224 225 -
trunk/Source/WebCore/editing/EditorCommand.cpp
r233122 r234064 101 101 switch (source) { 102 102 case CommandFromMenuOrKeyBinding: 103 frame.editor().applyStyleToSelection(WTFMove(style), action); 103 // Use InvertColor for testing purposes. foreColor and backColor are never triggered with CommandFromMenuOrKeyBinding outside DRT/WTR. 104 frame.editor().applyStyleToSelection(WTFMove(style), action, Editor::ColorFilterMode::InvertColor); 104 105 return true; 105 106 case CommandFromDOM: 106 107 case CommandFromDOMWithUserInterface: 107 frame.editor().applyStyle(WTFMove(style), EditActionUnspecified );108 frame.editor().applyStyle(WTFMove(style), EditActionUnspecified, Editor::ColorFilterMode::UseOriginalColor); 108 109 return true; 109 110 } -
trunk/Source/WebCore/editing/cocoa/HTMLConverter.mm
r233833 r234064 2515 2515 [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFont().platformData().size()] forKey:NSFontAttributeName]; 2516 2516 2517 Color foregroundColor = style.visitedDependentColor (CSSPropertyColor);2517 Color foregroundColor = style.visitedDependentColorWithColorFilter(CSSPropertyColor); 2518 2518 if (foregroundColor.isVisible()) 2519 2519 [attrs.get() setObject:nsColor(foregroundColor) forKey:NSForegroundColorAttributeName]; … … 2521 2521 [attrs.get() removeObjectForKey:NSForegroundColorAttributeName]; 2522 2522 2523 Color backgroundColor = style.visitedDependentColor (CSSPropertyBackgroundColor);2523 Color backgroundColor = style.visitedDependentColorWithColorFilter(CSSPropertyBackgroundColor); 2524 2524 if (backgroundColor.isVisible()) 2525 2525 [attrs.get() setObject:nsColor(backgroundColor) forKey:NSBackgroundColorAttributeName]; -
trunk/Source/WebKitLegacy/mac/ChangeLog
r233869 r234064 1 2018-07-20 Ryosuke Niwa <rniwa@apple.com> 2 3 Picking a color from the color panel for typing attributes needs to inverse transform through color-filter 4 https://bugs.webkit.org/show_bug.cgi?id=187846 5 6 Reviewed by Simon Fraser. 7 8 Invert the filtered font and background colors when using font panels, font pasteboard, and other Objective-C APIs. 9 10 * WebView/WebHTMLView.mm: 11 (-[WebHTMLView _applyStyleToSelection:withUndoAction:]): Share code with _applyEditingStyleToSelection. 12 (-[WebHTMLView _applyEditingStyleToSelection:withUndoAction:]): 13 1 14 2018-07-11 Dean Jackson <dino@apple.com> 2 15 -
trunk/Source/WebKitLegacy/mac/WebView/WebHTMLView.mm
r233079 r234064 5205 5205 - (void)_applyStyleToSelection:(DOMCSSStyleDeclaration *)style withUndoAction:(EditAction)undoAction 5206 5206 { 5207 if (Frame* coreFrame = core([self _frame])) { 5208 // FIXME: We shouldn't have to make a copy here. We want callers of this function to work directly with StyleProperties eventually. 5209 Ref<MutableStyleProperties> properties(core(style)->copyProperties()); 5210 coreFrame->editor().applyStyleToSelection(properties.ptr(), undoAction); 5211 } 5207 [self _applyEditingStyleToSelection:EditingStyle::create(core(style)) withUndoAction:undoAction]; 5212 5208 } 5213 5209 … … 5215 5211 { 5216 5212 if (Frame* coreFrame = core([self _frame])) 5217 coreFrame->editor().applyStyleToSelection(WTFMove(editingStyle), undoAction );5213 coreFrame->editor().applyStyleToSelection(WTFMove(editingStyle), undoAction, Editor::ColorFilterMode::InvertColor); 5218 5214 } 5219 5215 -
trunk/Tools/ChangeLog
r234063 r234064 1 2018-07-20 Ryosuke Niwa <rniwa@apple.com> 2 3 Picking a color from the color panel for typing attributes needs to inverse transform through color-filter 4 https://bugs.webkit.org/show_bug.cgi?id=187846 5 6 Reviewed by Simon Fraser. 7 8 Fixed the bug that testRunner.execCommand was using the second argument as the value. 9 10 The second argument, aShowDefaultUI, should always be ignored in testRunner.execCommand, 11 and the third argument should be used as the value. DumpRenderTree's implementation does this already. 12 13 * WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl: 14 * WebKitTestRunner/InjectedBundle/TestRunner.cpp: 15 (WTR::TestRunner::execCommand): 16 * WebKitTestRunner/InjectedBundle/TestRunner.h: 17 1 18 2018-07-20 Dean Jackson <dino@apple.com> 2 19 -
trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/TestRunner.idl
r233888 r234064 98 98 // Special DOM functions. 99 99 void clearBackForwardList(); 100 void execCommand(DOMString name, DOMString argument);100 void execCommand(DOMString name, DOMString showUI, DOMString value); 101 101 boolean isCommandEnabled(DOMString name); 102 102 unsigned long windowCount(); -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp
r233888 r234064 292 292 } 293 293 294 void TestRunner::execCommand(JSStringRef name, JSStringRef argument)295 { 296 WKBundlePageExecuteEditingCommand(InjectedBundle::singleton().page()->page(), toWK(name).get(), toWK( argument).get());294 void TestRunner::execCommand(JSStringRef name, JSStringRef showUI, JSStringRef value) 295 { 296 WKBundlePageExecuteEditingCommand(InjectedBundle::singleton().page()->page(), toWK(name).get(), toWK(value).get()); 297 297 } 298 298 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r233888 r234064 136 136 // Special DOM functions. 137 137 void clearBackForwardList(); 138 void execCommand(JSStringRef name, JSStringRef argument);138 void execCommand(JSStringRef name, JSStringRef showUI, JSStringRef value); 139 139 bool isCommandEnabled(JSStringRef name); 140 140 unsigned windowCount();
Note: See TracChangeset
for help on using the changeset viewer.