Title: [238155] trunk
Revision
238155
Author
[email protected]
Date
2018-11-13 17:15:24 -0800 (Tue, 13 Nov 2018)

Log Message

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.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (238154 => 238155)


--- trunk/LayoutTests/ChangeLog	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/LayoutTests/ChangeLog	2018-11-14 01:15:24 UTC (rev 238155)
@@ -1,3 +1,14 @@
+2018-11-13  Timothy Hatcher  <[email protected]>
+
+        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  <[email protected]>
 
         [WinCairo] Unreviewed layout test gardening.

Added: trunk/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt (0 => 238155)


--- trunk/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar-expected.txt	2018-11-14 01:15:24 UTC (rev 238155)
@@ -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 
+

Added: trunk/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html (0 => 238155)


--- trunk/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html	                        (rev 0)
+++ trunk/LayoutTests/css-dark-mode/supported-color-schemes-scrollbar.html	2018-11-14 01:15:24 UTC (rev 238155)
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+
+<!-- webkit-test-runner [ experimental:DarkModeCSSEnabled=true ] -->
+
+<script src=""
+<script src=""
+
+<style>
+body {
+    supported-color-schemes: light dark;
+}
+</style>
+
+<body></body>
+
+<script>
+function test_prop(element, prop, expected) {
+    assert_equals(window.getComputedStyle(element).getPropertyValue(prop), expected);
+}
+
+test(function() {
+    if (!window.internals)
+        return;
+    internals.settings.setUseDarkAppearance(true);
+}, "Set dark appearance");
+
+test(function() {
+    if (!window.internals)
+        return;
+    internals.setViewIsTransparent(true);
+}, "Set view to transparent");
+
+test(function() {
+    test_prop(document.body, "supported-color-schemes", "light dark");
+}, "Body Element supported color scheme is light and dark");
+
+test(function() {
+    test_prop(document.documentElement, "supported-color-schemes", "auto");
+}, "Document Element supported color scheme is auto");
+
+test(function() {
+    if (!window.internals)
+        return;
+    assert_equals(internals.scrollbarOverlayStyle(), "light");
+}, "Scrollbar overlay style is light");
+
+test(function() {
+    let styleElement = document.createElement("style");
+    styleElement.textContent = ":root { supported-color-schemes: light }";
+    document.head.appendChild(styleElement);
+}, "Set prefers-color-schemes: light on the document element");
+
+test(function() {
+    test_prop(document.body, "supported-color-schemes", "light dark");
+}, "Body Element supported color scheme is light and dark");
+
+test(function() {
+    test_prop(document.documentElement, "supported-color-schemes", "light");
+}, "Document Element supported color scheme is light");
+
+test(function() {
+    if (!window.internals)
+        return;
+    assert_equals(internals.scrollbarOverlayStyle(), "default");
+}, "Scrollbar overlay style is default");
+</script>

Modified: trunk/Source/WebCore/ChangeLog (238154 => 238155)


--- trunk/Source/WebCore/ChangeLog	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/ChangeLog	2018-11-14 01:15:24 UTC (rev 238155)
@@ -1,3 +1,42 @@
+2018-11-13  Timothy Hatcher  <[email protected]>
+
+        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  <[email protected]>
 
         [AppleWin] Unreviewed build fix after r238108.

Modified: trunk/Source/WebCore/css/CSSProperties.json (238154 => 238155)


--- trunk/Source/WebCore/css/CSSProperties.json	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/css/CSSProperties.json	2018-11-14 01:15:24 UTC (rev 238155)
@@ -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
             },

Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (238154 => 238155)


--- trunk/Source/WebCore/css/StyleBuilderCustom.h	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h	2018-11-14 01:15:24 UTC (rev 238155)
@@ -142,6 +142,10 @@
     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 @@
     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<CSSPropertyID property>
 inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleResolver, CSSValue& value)
 {

Modified: trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm (238154 => 238155)


--- trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/editing/cocoa/WebContentReaderCocoa.mm	2018-11-14 01:15:24 UTC (rev 238155)
@@ -135,8 +135,7 @@
 
 #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;

Modified: trunk/Source/WebCore/inspector/InspectorOverlay.cpp (238154 => 238155)


--- trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -184,7 +184,7 @@
     FrameView* view = overlayPage()->mainFrame().view();
 
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(view->renderView()->useDarkAppearance());
+    LocalDefaultSystemAppearance localAppearance(view->useDarkAppearance());
 #endif
 
     view->updateLayoutAndStyleIfNeededRecursive();

Modified: trunk/Source/WebCore/page/FrameView.cpp (238154 => 238155)


--- trunk/Source/WebCore/page/FrameView.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/page/FrameView.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -408,6 +408,8 @@
         backgroundColor.getHSL(hue, saturation, lightness);
         if (lightness <= .5 && backgroundColor.isVisible())
             computedOverlayStyle = ScrollbarOverlayStyleLight;
+        else if (!backgroundColor.isVisible() && useDarkAppearance())
+            computedOverlayStyle = ScrollbarOverlayStyleLight;
     }
 
     if (oldOverlayStyle != computedOverlayStyle)
@@ -2046,11 +2048,41 @@
     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<StyleColor::Options> 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)
 {
     if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()) {
@@ -3916,7 +3948,7 @@
 #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
 

Modified: trunk/Source/WebCore/page/FrameView.h (238154 => 238155)


--- trunk/Source/WebCore/page/FrameView.h	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/page/FrameView.h	2018-11-14 01:15:24 UTC (rev 238155)
@@ -35,6 +35,7 @@
 #include "PaintPhase.h"
 #include "RenderPtr.h"
 #include "ScrollView.h"
+#include "StyleColor.h"
 #include "TiledBacking.h"
 #include <memory>
 #include <wtf/Forward.h>
@@ -509,7 +510,8 @@
     bool isHandlingWheelEvent() const final;
     bool shouldSetCursor() const;
 
-    bool useDarkAppearance() const final;
+    WEBCORE_EXPORT bool useDarkAppearance() const final;
+    OptionSet<StyleColor::Options> styleColorOptions() const;
 
     // FIXME: Remove this method once plugin loading is decoupled from layout.
     void flushAnyPendingPostLayoutTasks();
@@ -735,6 +737,10 @@
     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 @@
     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;

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (238154 => 238155)


--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -955,7 +955,11 @@
     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<StyleDifferenceContextSensitiveProperty>& changedContextSensitiveProperties) const

Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (238154 => 238155)


--- trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h	2018-11-14 01:15:24 UTC (rev 238155)
@@ -638,6 +638,8 @@
 
 #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<TextOrientation>(m_rareInheritedData->textOrientation); }
@@ -1782,6 +1784,9 @@
         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 @@
         && 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

Modified: trunk/Source/WebCore/svg/graphics/SVGImage.cpp (238154 => 238155)


--- trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/svg/graphics/SVGImage.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -325,7 +325,7 @@
     }
 
 #if PLATFORM(MAC)
-    LocalDefaultSystemAppearance localAppearance(view->renderView()->useDarkAppearance());
+    LocalDefaultSystemAppearance localAppearance(view->useDarkAppearance());
 #endif
 
     view->paint(context, intersection(context.clipBounds(), enclosingIntRect(srcRect)));

Modified: trunk/Source/WebCore/testing/Internals.cpp (238154 => 238155)


--- trunk/Source/WebCore/testing/Internals.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/testing/Internals.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -1673,6 +1673,16 @@
     return DOMRect::create(frameView.visualViewportRect());
 }
 
+ExceptionOr<void> 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<void> Internals::setViewBaseBackgroundColor(const String& colorValue)
 {
     Document* document = contextDocument();
@@ -2491,6 +2501,26 @@
     return document->frame()->trackedRepaintRectsAsText();
 }
 
+ExceptionOr<String> 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<String> Internals::scrollingStateTreeAsText() const
 {
     Document* document = contextDocument();

Modified: trunk/Source/WebCore/testing/Internals.h (238154 => 238155)


--- trunk/Source/WebCore/testing/Internals.h	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/testing/Internals.h	2018-11-14 01:15:24 UTC (rev 238155)
@@ -244,6 +244,7 @@
     ExceptionOr<Ref<DOMRect>> layoutViewportRect();
     ExceptionOr<Ref<DOMRect>> visualViewportRect();
 
+    ExceptionOr<void> setViewIsTransparent(bool);
     ExceptionOr<void> setViewBaseBackgroundColor(const String& colorValue);
 
     ExceptionOr<void> setPagination(const String& mode, int gap, int pageLength);
@@ -347,6 +348,9 @@
     ExceptionOr<String> layerTreeAsText(Document&, unsigned short flags) const;
     ExceptionOr<uint64_t> layerIDForElement(Element&);
     ExceptionOr<String> repaintRectsAsText() const;
+
+    ExceptionOr<String> scrollbarOverlayStyle() const;
+
     ExceptionOr<String> scrollingStateTreeAsText() const;
     ExceptionOr<String> mainThreadScrollingReasons() const;
     ExceptionOr<Ref<DOMRectList>> nonFastScrollableRects() const;

Modified: trunk/Source/WebCore/testing/Internals.idl (238154 => 238155)


--- trunk/Source/WebCore/testing/Internals.idl	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebCore/testing/Internals.idl	2018-11-14 01:15:24 UTC (rev 238155)
@@ -262,6 +262,7 @@
     [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 @@
 
     [MayThrowException] unsigned long long layerIDForElement(Element element);
 
+    [MayThrowException] DOMString scrollbarOverlayStyle();
+
     [MayThrowException] DOMString scrollingStateTreeAsText();
     [MayThrowException] DOMString mainThreadScrollingReasons(); // FIXME: rename to synchronousScrollingReasons().
     [MayThrowException] DOMRectList nonFastScrollableRects();

Modified: trunk/Source/WebKit/ChangeLog (238154 => 238155)


--- trunk/Source/WebKit/ChangeLog	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebKit/ChangeLog	2018-11-14 01:15:24 UTC (rev 238155)
@@ -1,3 +1,16 @@
+2018-11-13  Timothy Hatcher  <[email protected]>
+
+        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  <[email protected]>
 
         [iOS] Do not show selection UI for editable elements with opacity near zero

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp (238154 => 238155)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -125,8 +125,7 @@
         return nullptr;
 
 #if PLATFORM(MAC)
-    RenderView* renderView = frameView->renderView();
-    LocalDefaultSystemAppearance localAppearance(renderView ? renderView->useDarkAppearance() : false);
+    LocalDefaultSystemAppearance localAppearance(frameView->useDarkAppearance());
 #endif
 
     Ref<Frame> protector(*frame);

Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (238154 => 238155)


--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-11-13 23:42:00 UTC (rev 238154)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp	2018-11-14 01:15:24 UTC (rev 238155)
@@ -1573,8 +1573,8 @@
 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);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to