From f64f580f1bceea7000915f73f6047d6a3cd7e116 Mon Sep 17 00:00:00 2001 From: Timothy Hatcher Date: Wed, 14 Nov 2018 01:15:24 +0000 Subject: [PATCH] Use a light scrollbar for transparent web views in dark mode. https://bugs.webkit.org/show_bug.cgi?id=191559 rdar://problem/46000489 Reviewed by Dean Jackson. Source/WebCore: Test: css-dark-mode/supported-color-schemes-scrollbar.html * css/CSSProperties.json: Marked supported-color-schemes as a custom Value. * css/StyleBuilderCustom.h: (WebCore::StyleBuilderCustom::applyValueSupportedColorSchemes): * editing/cocoa/WebContentReaderCocoa.mm: Use FrameView's useDarkAppearance(). (WebCore::createFragment): * inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::paint): Use FrameView's useDarkAppearance(). * page/FrameView.cpp: (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use a light scrollbar for transparent web views in dark mode. (WebCore::FrameView::rendererForSupportedColorSchemes const): Added. Return the body for document element renderer. (WebCore::FrameView::useDarkAppearance const): Use rendererForSupportedColorSchemes. (WebCore::FrameView::styleColorOptions const): Added. Ditto. * page/FrameView.h: * rendering/style/RenderStyle.cpp: (WebCore::rareInheritedDataChangeRequiresRepaint): Drive-by fix. Added supportedColorSchemes. * rendering/style/RenderStyle.h: (WebCore::RenderStyle::setHasExplicitlySetSupportedColorSchemes): Added. (WebCore::RenderStyle::hasExplicitlySetSupportedColorSchemes const): Added. (WebCore::RenderStyle::NonInheritedFlags::operator== const): Added supportedColorSchemes. * svg/graphics/SVGImage.cpp: (WebCore::SVGImage::draw): Use FrameView's useDarkAppearance(). * testing/Internals.cpp: (WebCore::Internals::setViewIsTransparent): Added. (WebCore::Internals::scrollbarOverlayStyle const): Added. * testing/Internals.h: * testing/Internals.idl: Added setViewIsTransparent and scrollbarOverlayStyle. Source/WebKit: * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance(). * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::drawRect): Ditto. LayoutTests: * css-dark-mode/supported-color-schemes-scrollbar-expected.txt: Added. * css-dark-mode/supported-color-schemes-scrollbar.html: Added. Canonical link: https://commits.webkit.org/206359@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@238155 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- LayoutTests/ChangeLog | 11 ++++ ...orted-color-schemes-scrollbar-expected.txt | 11 ++++ .../supported-color-schemes-scrollbar.html | 66 +++++++++++++++++++ Source/WebCore/ChangeLog | 39 +++++++++++ Source/WebCore/css/CSSProperties.json | 1 + Source/WebCore/css/StyleBuilderCustom.h | 12 ++++ .../editing/cocoa/WebContentReaderCocoa.mm | 3 +- Source/WebCore/inspector/InspectorOverlay.cpp | 2 +- Source/WebCore/page/FrameView.cpp | 36 +++++++++- Source/WebCore/page/FrameView.h | 11 +++- .../WebCore/rendering/style/RenderStyle.cpp | 6 +- Source/WebCore/rendering/style/RenderStyle.h | 8 +++ Source/WebCore/svg/graphics/SVGImage.cpp | 2 +- Source/WebCore/testing/Internals.cpp | 30 +++++++++ Source/WebCore/testing/Internals.h | 4 ++ Source/WebCore/testing/Internals.idl | 3 + Source/WebKit/ChangeLog | 13 ++++ .../DOM/InjectedBundleRangeHandle.cpp | 3 +- Source/WebKit/WebProcess/WebPage/WebPage.cpp | 4 +- 19 files changed, 253 insertions(+), 12 deletions(-) create mode 100644 LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt create mode 100644 LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 1cb854a8e6a2..96c3d3d07f2b 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,14 @@ +2018-11-13 Timothy Hatcher + + Use a light scrollbar for transparent web views in dark mode. + https://bugs.webkit.org/show_bug.cgi?id=191559 + rdar://problem/46000489 + + Reviewed by Dean Jackson. + + * css-dark-mode/supported-color-schemes-scrollbar-expected.txt: Added. + * css-dark-mode/supported-color-schemes-scrollbar.html: Added. + 2018-11-13 Ross Kirsling [WinCairo] Unreviewed layout test gardening. diff --git a/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt b/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt new file mode 100644 index 000000000000..074a0dbfa990 --- /dev/null +++ b/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt @@ -0,0 +1,11 @@ + +PASS Set dark appearance +PASS Set view to transparent +PASS Body Element supported color scheme is light and dark +PASS Document Element supported color scheme is auto +PASS Scrollbar overlay style is light +PASS Set prefers-color-schemes: light on the document element +PASS Body Element supported color scheme is light and dark +PASS Document Element supported color scheme is light +PASS Scrollbar overlay style is default + diff --git a/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html b/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html new file mode 100644 index 000000000000..b7d037b44c7b --- /dev/null +++ b/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html @@ -0,0 +1,66 @@ + + + + + + + + + + + + diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index f6f456f0a967..e8a8432eba25 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,42 @@ +2018-11-13 Timothy Hatcher + + Use a light scrollbar for transparent web views in dark mode. + https://bugs.webkit.org/show_bug.cgi?id=191559 + rdar://problem/46000489 + + Reviewed by Dean Jackson. + + Test: css-dark-mode/supported-color-schemes-scrollbar.html + + * css/CSSProperties.json: Marked supported-color-schemes as a custom Value. + * css/StyleBuilderCustom.h: + (WebCore::StyleBuilderCustom::applyValueSupportedColorSchemes): + * editing/cocoa/WebContentReaderCocoa.mm: Use FrameView's useDarkAppearance(). + (WebCore::createFragment): + * inspector/InspectorOverlay.cpp: + (WebCore::InspectorOverlay::paint): Use FrameView's useDarkAppearance(). + * page/FrameView.cpp: + (WebCore::FrameView::recalculateScrollbarOverlayStyle): Use a light scrollbar for + transparent web views in dark mode. + (WebCore::FrameView::rendererForSupportedColorSchemes const): Added. + Return the body for document element renderer. + (WebCore::FrameView::useDarkAppearance const): Use rendererForSupportedColorSchemes. + (WebCore::FrameView::styleColorOptions const): Added. Ditto. + * page/FrameView.h: + * rendering/style/RenderStyle.cpp: + (WebCore::rareInheritedDataChangeRequiresRepaint): Drive-by fix. Added supportedColorSchemes. + * rendering/style/RenderStyle.h: + (WebCore::RenderStyle::setHasExplicitlySetSupportedColorSchemes): Added. + (WebCore::RenderStyle::hasExplicitlySetSupportedColorSchemes const): Added. + (WebCore::RenderStyle::NonInheritedFlags::operator== const): Added supportedColorSchemes. + * svg/graphics/SVGImage.cpp: + (WebCore::SVGImage::draw): Use FrameView's useDarkAppearance(). + * testing/Internals.cpp: + (WebCore::Internals::setViewIsTransparent): Added. + (WebCore::Internals::scrollbarOverlayStyle const): Added. + * testing/Internals.h: + * testing/Internals.idl: Added setViewIsTransparent and scrollbarOverlayStyle. + 2018-11-13 Ross Kirsling [AppleWin] Unreviewed build fix after r238108. diff --git a/Source/WebCore/css/CSSProperties.json b/Source/WebCore/css/CSSProperties.json index 3540092e9712..fe012ba4b229 100644 --- a/Source/WebCore/css/CSSProperties.json +++ b/Source/WebCore/css/CSSProperties.json @@ -5723,6 +5723,7 @@ "codegen-properties": { "converter": "SupportedColorSchemes", "comment": "This is the second highest priority property, to ensure that its value can be checked when resolving colors.", + "custom": "Value", "enable-if": "ENABLE_DARK_MODE_CSS", "high-priority": true }, diff --git a/Source/WebCore/css/StyleBuilderCustom.h b/Source/WebCore/css/StyleBuilderCustom.h index c13ca8bf3539..4370218f955e 100644 --- a/Source/WebCore/css/StyleBuilderCustom.h +++ b/Source/WebCore/css/StyleBuilderCustom.h @@ -142,6 +142,10 @@ class StyleBuilderCustom { static void applyValueAlt(StyleResolver&, CSSValue&); static void applyValueWillChange(StyleResolver&, CSSValue&); +#if ENABLE(DARK_MODE_CSS) + static void applyValueSupportedColorSchemes(StyleResolver&, CSSValue&); +#endif + static void applyValueStrokeWidth(StyleResolver&, CSSValue&); static void applyValueStrokeColor(StyleResolver&, CSSValue&); @@ -827,6 +831,14 @@ inline void StyleBuilderCustom::applyValueWebkitTextZoom(StyleResolver& styleRes styleResolver.state().setFontDirty(true); } +#if ENABLE(DARK_MODE_CSS) +inline void StyleBuilderCustom::applyValueSupportedColorSchemes(StyleResolver& styleResolver, CSSValue& value) +{ + styleResolver.style()->setSupportedColorSchemes(StyleBuilderConverter::convertSupportedColorSchemes(styleResolver, value)); + styleResolver.style()->setHasExplicitlySetSupportedColorSchemes(true); +} +#endif + template inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleResolver, CSSValue& value) { diff --git a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm index d4207b9cf1c1..e4b90bdf2705 100644 --- a/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm +++ b/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm @@ -135,8 +135,7 @@ static FragmentAndResources createFragment(Frame& frame, NSAttributedString *str #if PLATFORM(MAC) auto* view = frame.view(); - auto* renderView = view ? view->renderView() : nullptr; - LocalDefaultSystemAppearance localAppearance(renderView ? renderView->useDarkAppearance() : false); + LocalDefaultSystemAppearance localAppearance(view ? view->useDarkAppearance() : false); #endif NSArray *subresources = nil; diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp index dec71e5fe840..053dad8ae475 100644 --- a/Source/WebCore/inspector/InspectorOverlay.cpp +++ b/Source/WebCore/inspector/InspectorOverlay.cpp @@ -184,7 +184,7 @@ void InspectorOverlay::paint(GraphicsContext& context) FrameView* view = overlayPage()->mainFrame().view(); #if PLATFORM(MAC) - LocalDefaultSystemAppearance localAppearance(view->renderView()->useDarkAppearance()); + LocalDefaultSystemAppearance localAppearance(view->useDarkAppearance()); #endif view->updateLayoutAndStyleIfNeededRecursive(); diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp index a4f58f81f53c..72aec25eaf36 100644 --- a/Source/WebCore/page/FrameView.cpp +++ b/Source/WebCore/page/FrameView.cpp @@ -408,6 +408,8 @@ void FrameView::recalculateScrollbarOverlayStyle() backgroundColor.getHSL(hue, saturation, lightness); if (lightness <= .5 && backgroundColor.isVisible()) computedOverlayStyle = ScrollbarOverlayStyleLight; + else if (!backgroundColor.isVisible() && useDarkAppearance()) + computedOverlayStyle = ScrollbarOverlayStyleLight; } if (oldOverlayStyle != computedOverlayStyle) @@ -2046,9 +2048,39 @@ bool FrameView::shouldSetCursor() const return page && page->isVisible() && page->focusController().isActive(); } +#if ENABLE(DARK_MODE_CSS) +RenderObject* FrameView::rendererForSupportedColorSchemes() const +{ + auto* document = frame().document(); + auto* documentElement = document ? document->documentElement() : nullptr; + auto* documentElementRenderer = documentElement ? documentElement->renderer() : nullptr; + if (documentElementRenderer && documentElementRenderer->style().hasExplicitlySetSupportedColorSchemes()) + return documentElementRenderer; + auto* bodyElement = document ? document->bodyOrFrameset() : nullptr; + return bodyElement ? bodyElement->renderer() : nullptr; +} +#endif + bool FrameView::useDarkAppearance() const { - return renderView()->useDarkAppearance(); +#if ENABLE(DARK_MODE_CSS) + if (auto* renderer = rendererForSupportedColorSchemes()) + return renderer->useDarkAppearance(); +#endif + if (auto* document = frame().document()) + return document->useDarkAppearance(nullptr); + return false; +} + +OptionSet FrameView::styleColorOptions() const +{ +#if ENABLE(DARK_MODE_CSS) + if (auto* renderer = rendererForSupportedColorSchemes()) + return renderer->styleColorOptions(); +#endif + if (auto* document = frame().document()) + return document->styleColorOptions(nullptr); + return { }; } bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) @@ -3916,7 +3948,7 @@ void FrameView::paintScrollCorner(GraphicsContext& context, const IntRect& corne #if PLATFORM(MAC) // If dark appearance is used or the overlay style is light (because of a dark page background), set the dark apppearance. // Keep this in sync with ScrollAnimatorMac's effectiveAppearanceForScrollerImp:. - bool useDarkAppearance = renderView()->useDarkAppearance() || scrollbarOverlayStyle() == WebCore::ScrollbarOverlayStyleLight; + bool useDarkAppearance = this->useDarkAppearance() || scrollbarOverlayStyle() == WebCore::ScrollbarOverlayStyleLight; LocalDefaultSystemAppearance localAppearance(useDarkAppearance); #endif diff --git a/Source/WebCore/page/FrameView.h b/Source/WebCore/page/FrameView.h index 14f2d514ad55..f3bd04eb67d9 100644 --- a/Source/WebCore/page/FrameView.h +++ b/Source/WebCore/page/FrameView.h @@ -35,6 +35,7 @@ #include "PaintPhase.h" #include "RenderPtr.h" #include "ScrollView.h" +#include "StyleColor.h" #include "TiledBacking.h" #include #include @@ -509,7 +510,8 @@ class FrameView final : public ScrollView { bool isHandlingWheelEvent() const final; bool shouldSetCursor() const; - bool useDarkAppearance() const final; + WEBCORE_EXPORT bool useDarkAppearance() const final; + OptionSet styleColorOptions() const; // FIXME: Remove this method once plugin loading is decoupled from layout. void flushAnyPendingPostLayoutTasks(); @@ -735,6 +737,10 @@ class FrameView final : public ScrollView { void unobscuredContentSizeChanged() final; #endif +#if ENABLE(DARK_MODE_CSS) + RenderObject* rendererForSupportedColorSchemes() const; +#endif + bool usesCompositedScrolling() const final; bool usesAsyncScrolling() const final; bool usesMockScrollAnimator() const final; @@ -826,6 +832,9 @@ class FrameView final : public ScrollView { bool m_firstLayoutCallbackPending; bool m_isTransparent; +#if ENABLE(DARK_MODE_CSS) + bool m_usesDarkAppearance { false }; +#endif Color m_baseBackgroundColor; IntSize m_lastViewportSize; float m_lastZoomFactor; diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp index 0b6b55b77b10..7ba109155299 100644 --- a/Source/WebCore/rendering/style/RenderStyle.cpp +++ b/Source/WebCore/rendering/style/RenderStyle.cpp @@ -955,7 +955,11 @@ static bool rareInheritedDataChangeRequiresRepaint(const StyleRareInheritedData& return first.userModify != second.userModify || first.userSelect != second.userSelect || first.appleColorFilter != second.appleColorFilter - || first.imageRendering != second.imageRendering; + || first.imageRendering != second.imageRendering +#if ENABLE(DARK_MODE_CSS) + || first.supportedColorSchemes != second.supportedColorSchemes +#endif + ; } bool RenderStyle::changeRequiresRepaint(const RenderStyle& other, OptionSet& changedContextSensitiveProperties) const diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h index 8555d0b9f624..3acb1c9a8276 100644 --- a/Source/WebCore/rendering/style/RenderStyle.h +++ b/Source/WebCore/rendering/style/RenderStyle.h @@ -638,6 +638,8 @@ class RenderStyle { #if ENABLE(DARK_MODE_CSS) StyleSupportedColorSchemes supportedColorSchemes() const { return m_rareInheritedData->supportedColorSchemes; } + void setHasExplicitlySetSupportedColorSchemes(bool v) { m_nonInheritedFlags.hasExplicitlySetSupportedColorSchemes = v; } + bool hasExplicitlySetSupportedColorSchemes() const { return m_nonInheritedFlags.hasExplicitlySetSupportedColorSchemes; }; #endif TextOrientation textOrientation() const { return static_cast(m_rareInheritedData->textOrientation); } @@ -1782,6 +1784,9 @@ class RenderStyle { unsigned hasExplicitlySetDirection : 1; unsigned hasExplicitlySetWritingMode : 1; unsigned hasExplicitlySetTextAlign : 1; +#if ENABLE(DARK_MODE_CSS) + unsigned hasExplicitlySetSupportedColorSchemes : 1; +#endif unsigned hasViewportUnits : 1; unsigned hasExplicitlyInheritedProperties : 1; // Explicitly inherits a non-inherited property. unsigned isUnique : 1; // Style cannot be shared. @@ -1908,6 +1913,9 @@ inline bool RenderStyle::NonInheritedFlags::operator==(const NonInheritedFlags& && hasExplicitlySetDirection == other.hasExplicitlySetDirection && hasExplicitlySetWritingMode == other.hasExplicitlySetWritingMode && hasExplicitlySetTextAlign == other.hasExplicitlySetTextAlign +#if ENABLE(DARK_MODE_CSS) + && hasExplicitlySetSupportedColorSchemes == other.hasExplicitlySetSupportedColorSchemes +#endif && hasViewportUnits == other.hasViewportUnits && hasExplicitlyInheritedProperties == other.hasExplicitlyInheritedProperties && isUnique == other.isUnique diff --git a/Source/WebCore/svg/graphics/SVGImage.cpp b/Source/WebCore/svg/graphics/SVGImage.cpp index 06097eccbbe3..af4f1e11df73 100644 --- a/Source/WebCore/svg/graphics/SVGImage.cpp +++ b/Source/WebCore/svg/graphics/SVGImage.cpp @@ -325,7 +325,7 @@ ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec } #if PLATFORM(MAC) - LocalDefaultSystemAppearance localAppearance(view->renderView()->useDarkAppearance()); + LocalDefaultSystemAppearance localAppearance(view->useDarkAppearance()); #endif view->paint(context, intersection(context.clipBounds(), enclosingIntRect(srcRect))); diff --git a/Source/WebCore/testing/Internals.cpp b/Source/WebCore/testing/Internals.cpp index 46dbccb6898b..8a3205155d4d 100644 --- a/Source/WebCore/testing/Internals.cpp +++ b/Source/WebCore/testing/Internals.cpp @@ -1673,6 +1673,16 @@ ExceptionOr> Internals::visualViewportRect() return DOMRect::create(frameView.visualViewportRect()); } +ExceptionOr Internals::setViewIsTransparent(bool transparent) +{ + Document* document = contextDocument(); + if (!document || !document->view()) + return Exception { InvalidAccessError }; + Color backgroundColor = transparent ? Color::transparent : Color::white; + document->view()->updateBackgroundRecursively(backgroundColor, transparent); + return { }; +} + ExceptionOr Internals::setViewBaseBackgroundColor(const String& colorValue) { Document* document = contextDocument(); @@ -2491,6 +2501,26 @@ ExceptionOr Internals::repaintRectsAsText() const return document->frame()->trackedRepaintRectsAsText(); } +ExceptionOr Internals::scrollbarOverlayStyle() const +{ + Document* document = contextDocument(); + if (!document || !document->view()) + return Exception { InvalidAccessError }; + + auto& frameView = *document->view(); + switch (frameView.scrollbarOverlayStyle()) { + case ScrollbarOverlayStyleDefault: + return "default"_str; + case ScrollbarOverlayStyleDark: + return "dark"_str; + case ScrollbarOverlayStyleLight: + return "light"_str; + } + + ASSERT_NOT_REACHED(); + return "unknown"_str; +} + ExceptionOr Internals::scrollingStateTreeAsText() const { Document* document = contextDocument(); diff --git a/Source/WebCore/testing/Internals.h b/Source/WebCore/testing/Internals.h index 11cfb7678471..7da674f9acc2 100644 --- a/Source/WebCore/testing/Internals.h +++ b/Source/WebCore/testing/Internals.h @@ -244,6 +244,7 @@ class Internals final : public RefCounted, private ContextDestruction ExceptionOr> layoutViewportRect(); ExceptionOr> visualViewportRect(); + ExceptionOr setViewIsTransparent(bool); ExceptionOr setViewBaseBackgroundColor(const String& colorValue); ExceptionOr setPagination(const String& mode, int gap, int pageLength); @@ -347,6 +348,9 @@ class Internals final : public RefCounted, private ContextDestruction ExceptionOr layerTreeAsText(Document&, unsigned short flags) const; ExceptionOr layerIDForElement(Element&); ExceptionOr repaintRectsAsText() const; + + ExceptionOr scrollbarOverlayStyle() const; + ExceptionOr scrollingStateTreeAsText() const; ExceptionOr mainThreadScrollingReasons() const; ExceptionOr> nonFastScrollableRects() const; diff --git a/Source/WebCore/testing/Internals.idl b/Source/WebCore/testing/Internals.idl index 6b66bf33f96b..edb83bca35f7 100644 --- a/Source/WebCore/testing/Internals.idl +++ b/Source/WebCore/testing/Internals.idl @@ -262,6 +262,7 @@ enum CompositingPolicy { [MayThrowException] DOMRect layoutViewportRect(); [MayThrowException] DOMRect visualViewportRect(); + [MayThrowException] void setViewIsTransparent(boolean trnasparent); [MayThrowException] void setViewBaseBackgroundColor(DOMString colorValue); [MayThrowException] void setPagination(DOMString mode, long gap, optional long pageLength = 0); @@ -372,6 +373,8 @@ enum CompositingPolicy { [MayThrowException] unsigned long long layerIDForElement(Element element); + [MayThrowException] DOMString scrollbarOverlayStyle(); + [MayThrowException] DOMString scrollingStateTreeAsText(); [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons(). [MayThrowException] DOMRectList nonFastScrollableRects(); diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index b734f95a23b0..2f9f2d81db0b 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,16 @@ +2018-11-13 Timothy Hatcher + + Use a light scrollbar for transparent web views in dark mode. + https://bugs.webkit.org/show_bug.cgi?id=191559 + rdar://problem/46000489 + + Reviewed by Dean Jackson. + + * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp: + (WebKit::InjectedBundleRangeHandle::renderedImage): Use FrameView's useDarkAppaearance(). + * WebProcess/WebPage/WebPage.cpp: + (WebKit::WebPage::drawRect): Ditto. + 2018-11-13 Wenson Hsieh [iOS] Do not show selection UI for editable elements with opacity near zero diff --git a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp index 4bfdd7f9f4c4..e99f3570d0e3 100644 --- a/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp +++ b/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp @@ -125,8 +125,7 @@ RefPtr InjectedBundleRangeHandle::renderedImage(SnapshotOptions option return nullptr; #if PLATFORM(MAC) - RenderView* renderView = frameView->renderView(); - LocalDefaultSystemAppearance localAppearance(renderView ? renderView->useDarkAppearance() : false); + LocalDefaultSystemAppearance localAppearance(frameView->useDarkAppearance()); #endif Ref protector(*frame); diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp index 63bca22da453..9e3739553953 100644 --- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp @@ -1573,8 +1573,8 @@ void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffse void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect) { #if PLATFORM(MAC) - RenderView* renderView = m_page->mainFrame().view()->renderView(); - LocalDefaultSystemAppearance localAppearance(renderView ? renderView->useDarkAppearance() : false); + FrameView* mainFrameView = m_page->mainFrame().view(); + LocalDefaultSystemAppearance localAppearance(mainFrameView ? mainFrameView->useDarkAppearance() : false); #endif GraphicsContextStateSaver stateSaver(graphicsContext);