WebKit Bugzilla
Attachment 373544 Details for
Bug 199534
: Mail's use of punchOutWhiteBackgroundsInDarkMode not working on iOS
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199534-20190705151121.patch (text/plain), 7.27 KB, created by
Timothy Hatcher
on 2019-07-05 15:11:21 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Timothy Hatcher
Created:
2019-07-05 15:11:21 PDT
Size:
7.27 KB
patch
obsolete
>Subversion Revision: 247180 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index bdc0b32c4b672dc6b455f682eb2d5653d8858f65..fc4880f2ab34e428a23e5fdbcd7d7dbb8502fe66 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,25 @@ >+2019-07-05 Timothy Hatcher <timothy@apple.com> >+ >+ Mail's use of punchOutWhiteBackgroundsInDarkMode not working on iOS. >+ https://bugs.webkit.org/show_bug.cgi?id=199534 >+ rdar://problem/52586836 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Tests: css3/color-filters/punch-out-white-backgrounds.html >+ >+ * dom/Document.cpp: >+ (WebCore::Document::compositeOperatorForBackgroundColor const): Added. >+ Use CompositeDestinationOut for transparent frames, otherwise CompositeDestinationIn. >+ * dom/Document.h: >+ * rendering/InlineFlowBox.cpp: >+ (WebCore::InlineFlowBox::paintBoxDecorations): Use compositeOperatorForBackgroundColor. >+ * rendering/RenderBox.cpp: >+ (WebCore::RenderBox::paintRootBoxFillLayers): Ditto. >+ (WebCore::RenderBox::paintBackground): Ditto. >+ * rendering/RenderTableCell.cpp: >+ (WebCore::RenderTableCell::paintBackgroundsBehindCell): Ditto. >+ > 2019-07-05 Ryosuke Niwa <rniwa@webkit.org> > > [iOS] Crash in WebKit::WebPage::positionInformation via Range::startPosition >diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp >index 78e59127508d98f97539858761b4dd3649e2aad2..5cfdaafbed4e2cfc09ab9bfd88a6d2ce7b95d430 100644 >--- a/Source/WebCore/dom/Document.cpp >+++ b/Source/WebCore/dom/Document.cpp >@@ -6977,6 +6977,20 @@ OptionSet<StyleColor::Options> Document::styleColorOptions(const RenderStyle* st > return options; > } > >+CompositeOperator Document::compositeOperatorForBackgroundColor(const Color& color, const RenderObject& renderer) const >+{ >+ if (LIKELY(!settings().punchOutWhiteBackgroundsInDarkMode() || !Color::isWhiteColor(color) || !renderer.useDarkAppearance())) >+ return CompositeSourceOver; >+ >+ auto* frameView = view(); >+ if (!frameView) >+ return CompositeSourceOver; >+ >+ // Mail on macOS uses a transparent view, and on iOS it is an opaque view. We need to >+ // use different composite modes to get the right results in this case. >+ return frameView->isTransparent() ? CompositeDestinationOut : CompositeDestinationIn; >+} >+ > void Document::didAssociateFormControl(Element& element) > { > auto* page = this->page(); >diff --git a/Source/WebCore/dom/Document.h b/Source/WebCore/dom/Document.h >index a1c8b14ca9605559a12538abac4c8cf0c75a1a39..7893248d9bc5edfaa3a635614940dc8348cb0594 100644 >--- a/Source/WebCore/dom/Document.h >+++ b/Source/WebCore/dom/Document.h >@@ -39,6 +39,7 @@ > #include "FontSelectorClient.h" > #include "FrameDestructionObserver.h" > #include "GenericTaskQueue.h" >+#include "GraphicsTypes.h" > #include "MediaProducer.h" > #include "MutationObserver.h" > #include "OrientationNotifier.h" >@@ -568,6 +569,7 @@ public: > WEBCORE_EXPORT bool useDarkAppearance(const RenderStyle*) const; > > OptionSet<StyleColor::Options> styleColorOptions(const RenderStyle*) const; >+ CompositeOperator compositeOperatorForBackgroundColor(const Color&, const RenderObject&) const; > > WEBCORE_EXPORT Ref<Range> createRange(); > >diff --git a/Source/WebCore/rendering/InlineFlowBox.cpp b/Source/WebCore/rendering/InlineFlowBox.cpp >index 4fe793117bb41c6e7135108d001654888ba6243a..2a1bc289b43c25d751bac0a77032713e0c609730 100644 >--- a/Source/WebCore/rendering/InlineFlowBox.cpp >+++ b/Source/WebCore/rendering/InlineFlowBox.cpp >@@ -1369,11 +1369,8 @@ void InlineFlowBox::paintBoxDecorations(PaintInfo& paintInfo, const LayoutPoint& > if (!renderer().boxShadowShouldBeAppliedToBackground(adjustedPaintoffset, BackgroundBleedNone, this)) > paintBoxShadow(paintInfo, lineStyle, Normal, paintRect); > >- Color color = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor); >- >- CompositeOperator compositeOp = CompositeSourceOver; >- if (renderer().document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(color) && renderer().useDarkAppearance()) >- compositeOp = CompositeDestinationOut; >+ auto color = lineStyle.visitedDependentColor(CSSPropertyBackgroundColor); >+ auto compositeOp = renderer().document().compositeOperatorForBackgroundColor(color, renderer()); > > color = lineStyle.colorByApplyingColorFilter(color); > >diff --git a/Source/WebCore/rendering/RenderBox.cpp b/Source/WebCore/rendering/RenderBox.cpp >index c7ed22358b01d2b94f526a95090a857ae26f8fb7..21deb88eb1a94297d766ccd3120f72d777be33f3 100644 >--- a/Source/WebCore/rendering/RenderBox.cpp >+++ b/Source/WebCore/rendering/RenderBox.cpp >@@ -1257,12 +1257,8 @@ void RenderBox::paintRootBoxFillLayers(const PaintInfo& paintInfo) > return; > > auto& style = rootBackgroundRenderer->style(); >- > auto color = style.visitedDependentColor(CSSPropertyBackgroundColor); >- >- CompositeOperator compositeOp = CompositeSourceOver; >- if (document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(color) && useDarkAppearance()) >- compositeOp = CompositeDestinationOut; >+ auto compositeOp = document().compositeOperatorForBackgroundColor(color, *this); > > paintFillLayers(paintInfo, style.colorByApplyingColorFilter(color), style.backgroundLayers(), view().backgroundRect(), BackgroundBleedNone, compositeOp, rootBackgroundRenderer); > } >@@ -1393,11 +1389,8 @@ void RenderBox::paintBackground(const PaintInfo& paintInfo, const LayoutRect& pa > if (backgroundIsKnownToBeObscured(paintRect.location()) && !boxShadowShouldBeAppliedToBackground(paintRect.location(), bleedAvoidance)) > return; > >- Color backgroundColor = style().visitedDependentColor(CSSPropertyBackgroundColor); >- >- CompositeOperator compositeOp = CompositeSourceOver; >- if (document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(backgroundColor) && useDarkAppearance()) >- compositeOp = CompositeDestinationOut; >+ auto backgroundColor = style().visitedDependentColor(CSSPropertyBackgroundColor); >+ auto compositeOp = document().compositeOperatorForBackgroundColor(backgroundColor, *this); > > paintFillLayers(paintInfo, style().colorByApplyingColorFilter(backgroundColor), style().backgroundLayers(), paintRect, bleedAvoidance, compositeOp); > } >diff --git a/Source/WebCore/rendering/RenderTableCell.cpp b/Source/WebCore/rendering/RenderTableCell.cpp >index 7fc230c313840e39f2c9b019f5d38690cd54a75c..51a1103fe22bbe587e48aad49bfd5096f8673ac9 100644 >--- a/Source/WebCore/rendering/RenderTableCell.cpp >+++ b/Source/WebCore/rendering/RenderTableCell.cpp >@@ -1287,10 +1287,8 @@ void RenderTableCell::paintBackgroundsBehindCell(PaintInfo& paintInfo, const Lay > const auto& style = backgroundObject->style(); > auto& bgLayer = style.backgroundLayers(); > >- CompositeOperator compositeOp = CompositeSourceOver; >- Color color = style.visitedDependentColor(CSSPropertyBackgroundColor); >- if (document().settings().punchOutWhiteBackgroundsInDarkMode() && Color::isWhiteColor(color) && useDarkAppearance()) >- compositeOp = CompositeDestinationOut; >+ auto color = style.visitedDependentColor(CSSPropertyBackgroundColor); >+ auto compositeOp = document().compositeOperatorForBackgroundColor(color, *this); > > color = style.colorByApplyingColorFilter(color); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199534
: 373544