Title: [256747] branches/safari-609-branch
- Revision
- 256747
- Author
- [email protected]
- Date
- 2020-02-17 11:13:48 -0800 (Mon, 17 Feb 2020)
Log Message
Revert r256693. rdar://problem/59478981
Modified Paths
Diff
Modified: branches/safari-609-branch/Source/WebCore/ChangeLog (256746 => 256747)
--- branches/safari-609-branch/Source/WebCore/ChangeLog 2020-02-17 18:52:38 UTC (rev 256746)
+++ branches/safari-609-branch/Source/WebCore/ChangeLog 2020-02-17 19:13:48 UTC (rev 256747)
@@ -1,3 +1,7 @@
+2020-02-17 Alan Coon <[email protected]>
+
+ Revert r256693. rdar://problem/59478981
+
2020-02-17 Alex Christensen <[email protected]>
Fix build after r256689
Modified: branches/safari-609-branch/Source/WebCore/editing/EditingStyle.cpp (256746 => 256747)
--- branches/safari-609-branch/Source/WebCore/editing/EditingStyle.cpp 2020-02-17 18:52:38 UTC (rev 256746)
+++ branches/safari-609-branch/Source/WebCore/editing/EditingStyle.cpp 2020-02-17 19:13:48 UTC (rev 256747)
@@ -1366,30 +1366,6 @@
if (!computedStyle->m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor))
computedStyle->m_mutableStyle->setProperty(CSSPropertyBackgroundColor, CSSValueTransparent);
- RefPtr<EditingStyle> computedStyleOfElement;
- auto replaceSemanticColorWithComputedValue = [&](const CSSPropertyID id) {
- auto color = m_mutableStyle->propertyAsColor(id);
- if (!color || (color->isVisible() && !color->isSemantic()))
- return;
-
- if (!computedStyleOfElement)
- computedStyleOfElement = EditingStyle::create(&element, EditingPropertiesInEffect);
-
- if (!computedStyleOfElement->m_mutableStyle)
- return;
-
- auto computedValue = computedStyleOfElement->m_mutableStyle->getPropertyValue(id);
- if (!computedValue)
- return;
-
- m_mutableStyle->setProperty(id, computedValue);
- };
-
- // Replace semantic color identifiers like -apple-system-label with RGB values so that comparsions in getPropertiesNotIn below would work.
- replaceSemanticColorWithComputedValue(CSSPropertyColor);
- replaceSemanticColorWithComputedValue(CSSPropertyCaretColor);
- replaceSemanticColorWithComputedValue(CSSPropertyBackgroundColor);
-
removePropertiesInStyle(computedStyle->m_mutableStyle.get(), styleFromMatchedRules.get());
m_mutableStyle = getPropertiesNotIn(*m_mutableStyle, *computedStyle->m_mutableStyle);
}
@@ -1611,17 +1587,10 @@
if (!m_mutableStyle || !renderer || !renderer->style().hasAppleColorFilter())
return *this;
- auto colorForPropertyIfInvertible = [&](CSSPropertyID id) -> Optional<Color> {
- auto color = m_mutableStyle->propertyAsColor(id);
- if (!color || !color->isVisible() || color->isSemantic())
- return WTF::nullopt;
- return color;
- };
-
- auto color = colorForPropertyIfInvertible(CSSPropertyColor);
- auto caretColor = colorForPropertyIfInvertible(CSSPropertyCaretColor);
- auto backgroundColor = colorForPropertyIfInvertible(CSSPropertyBackgroundColor);
- if (!color && !caretColor && !backgroundColor)
+ bool hasColor = m_mutableStyle->getPropertyCSSValue(CSSPropertyColor);
+ bool hasCaretColor = m_mutableStyle->getPropertyCSSValue(CSSPropertyCaretColor);
+ bool hasBackgroundColor = m_mutableStyle->getPropertyCSSValue(CSSPropertyBackgroundColor);
+ if (!hasColor && !hasCaretColor && !hasBackgroundColor)
return *this;
auto styleWithInvertedColors = copy();
@@ -1634,13 +1603,13 @@
styleWithInvertedColors->m_mutableStyle->setProperty(propertyID, newColor.cssText());
};
- if (color)
+ if (hasColor)
invertedColor(CSSPropertyColor);
- if (caretColor)
+ if (hasCaretColor)
invertedColor(CSSPropertyCaretColor);
- if (backgroundColor)
+ if (hasBackgroundColor)
invertedColor(CSSPropertyBackgroundColor);
return styleWithInvertedColors;
Modified: branches/safari-609-branch/Tools/ChangeLog (256746 => 256747)
--- branches/safari-609-branch/Tools/ChangeLog 2020-02-17 18:52:38 UTC (rev 256746)
+++ branches/safari-609-branch/Tools/ChangeLog 2020-02-17 19:13:48 UTC (rev 256747)
@@ -1,3 +1,7 @@
+2020-02-17 Alan Coon <[email protected]>
+
+ Revert r256693. rdar://problem/59478981
+
2020-02-14 Russell Epstein <[email protected]>
Cherry-pick r256629. rdar://problem/59478949
Modified: branches/safari-609-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm (256746 => 256747)
--- branches/safari-609-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm 2020-02-17 18:52:38 UTC (rev 256746)
+++ branches/safari-609-branch/Tools/TestWebKitAPI/Tests/WebKitCocoa/PasteHTML.mm 2020-02-17 19:13:48 UTC (rev 256747)
@@ -420,42 +420,6 @@
EXPECT_WK_STREQ([webView stringByEvaluatingJavaScript:@"rich.querySelector('span').style.color"], @"rgb(101, 101, 101)");
}
-TEST(PasteHTML, TransformColorsOfDarkContentButNotSemanticColor)
-{
- auto webView = createWebViewWithCustomPasteboardDataSetting(true, true);
- [webView forceDarkMode];
-
- [webView synchronouslyLoadTestPageNamed:@"rich-color-filtered"];
-
- [webView stringByEvaluatingJavaScript:@"document.body.style.color = '-apple-system-label';"];
- writeHTMLToPasteboard(@"<span style='color: -apple-system-label'>hello</span><b style='color: #eee'>world</b>");
-
- [webView stringByEvaluatingJavaScript:@"selectRichText()"];
- [webView paste:nil];
-
-#if USE(APPKIT)
- EXPECT_WK_STREQ([webView stringByEvaluatingJavaScript:@"rich.innerHTML"], @"hello<b style=\"color: rgb(21, 21, 21);\">world</b>");
-#else
- EXPECT_WK_STREQ([webView stringByEvaluatingJavaScript:@"rich.innerHTML"],
- @"<span style=\"-webkit-text-size-adjust: auto;\">hello</span><b style=\"-webkit-text-size-adjust: auto; color: rgb(21, 21, 21);\">world</b>");
-#endif
-}
-
-TEST(PasteHTML, DoesNotTransformColorsOfLightContentDuringOutdent)
-{
- auto webView = createWebViewWithCustomPasteboardDataSetting(true, true);
- [webView forceDarkMode];
-
- [webView synchronouslyLoadTestPageNamed:@"rich-color-filtered"];
-
- [webView stringByEvaluatingJavaScript:@"document.body.style = `color: -apple-system-label; caret-color: -apple-system-secondary-label; background-color: -apple-system-text-background;`;"];
- [webView stringByEvaluatingJavaScript:@"rich.innerHTML = `<ul><li>hello</li><ul><li id='target'>world</li></ul></ul>`;"];
-
- [webView stringByEvaluatingJavaScript:@"getSelection().setPosition(target, 0); document.execCommand('outdent');"];
-
- EXPECT_WK_STREQ([webView stringByEvaluatingJavaScript:@"rich.innerHTML"], @"<ul><li>hello</li><li>world</li></ul>");
-}
-
#endif // ENABLE(DARK_MODE_CSS) && HAVE(OS_DARK_MODE_SUPPORT)
#endif // PLATFORM(COCOA)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes