Corner of two scroll bars is white with dark mode enabled.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Jun 2018 01:21:13 +0000 (01:21 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 23 Jun 2018 01:21:13 +0000 (01:21 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186819
rdar://problem/40434350

Reviewed by Tim Horton.

Source/WebCore:

* Configurations/WebCore.xcconfig:
* WebCore.xcodeproj/project.pbxproj:
* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::paint): Added LocalDefaultSystemAppearance.
* page/Page.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::paintScrollCorner): Dropped ScrollView argument.
* platform/ScrollbarTheme.h:
(WebCore::ScrollbarTheme::paintScrollCorner): Ditto.
* platform/ScrollbarThemeComposite.cpp:
(WebCore::ScrollbarThemeComposite::paintScrollCorner): Deleted. Default is the same.
* platform/ScrollbarThemeComposite.h:
* platform/mac/LocalDefaultSystemAppearance.h:
* platform/mac/LocalDefaultSystemAppearance.mm:
(WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Added recursion early return.
(WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
* platform/mac/ScrollbarThemeMac.h:
* platform/mac/ScrollbarThemeMac.mm:
(WebCore::ScrollbarThemeMac::paintScrollCorner): Added.
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::paintScrollCorner): Call ScrollbarTheme::paintScrollCorner.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents): Added LocalDefaultSystemAppearance.
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::paintContents): Added LocalDefaultSystemAppearance.
* rendering/RenderScrollbarTheme.cpp:
(WebCore::RenderScrollbarTheme::paintScrollCorner): Call ScrollbarTheme::paintScrollCorner.
* rendering/RenderScrollbarTheme.h:
* svg/graphics/SVGImage.cpp:
(WebCore::SVGImage::draw): Added LocalDefaultSystemAppearance.

Source/WebCore/PAL:

* PAL.xcodeproj/project.pbxproj:
* pal/spi/mac/CoreUISPI.h: Added.
* pal/spi/mac/NSAppearanceSPI.h: Added.

Source/WebKit:

* UIProcess/mac/WKPrintingView.mm:
(-[WKPrintingView drawRect:]): Added LocalDefaultSystemAppearance.
* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.
* WebProcess/Plugins/PDF/PDFPlugin.mm:
(WebKit::PDFPlugin::paintControlForLayerInContext): Ditto. Dropped ScrollView argument.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::drawRect): Added LocalDefaultSystemAppearance.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@233116 268f45cc-cd09-0410-ab3c-d52691b4dbfc

28 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Configurations/WebCore.xcconfig
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/PAL.xcodeproj/project.pbxproj
Source/WebCore/PAL/pal/spi/mac/CoreUISPI.h [new file with mode: 0644]
Source/WebCore/PAL/pal/spi/mac/NSAppearanceSPI.h [new file with mode: 0644]
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/inspector/InspectorOverlay.cpp
Source/WebCore/page/Page.h
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollbarTheme.h
Source/WebCore/platform/ScrollbarThemeComposite.cpp
Source/WebCore/platform/ScrollbarThemeComposite.h
Source/WebCore/platform/mac/LocalDefaultSystemAppearance.h
Source/WebCore/platform/mac/LocalDefaultSystemAppearance.mm
Source/WebCore/platform/mac/ScrollbarThemeMac.h
Source/WebCore/platform/mac/ScrollbarThemeMac.mm
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderScrollbarTheme.cpp
Source/WebCore/rendering/RenderScrollbarTheme.h
Source/WebCore/svg/graphics/SVGImage.cpp
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/mac/WKPrintingView.mm
Source/WebKit/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp
Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.mm
Source/WebKit/WebProcess/WebPage/WebPage.cpp

index e1e781b..0f463e8 100644 (file)
@@ -1,3 +1,42 @@
+2018-06-22  Timothy Hatcher  <timothy@apple.com>
+
+        Corner of two scroll bars is white with dark mode enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=186819
+        rdar://problem/40434350
+
+        Reviewed by Tim Horton.
+
+        * Configurations/WebCore.xcconfig:
+        * WebCore.xcodeproj/project.pbxproj:
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::paint): Added LocalDefaultSystemAppearance.
+        * page/Page.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::paintScrollCorner): Dropped ScrollView argument.
+        * platform/ScrollbarTheme.h:
+        (WebCore::ScrollbarTheme::paintScrollCorner): Ditto.
+        * platform/ScrollbarThemeComposite.cpp:
+        (WebCore::ScrollbarThemeComposite::paintScrollCorner): Deleted. Default is the same.
+        * platform/ScrollbarThemeComposite.h:
+        * platform/mac/LocalDefaultSystemAppearance.h:
+        * platform/mac/LocalDefaultSystemAppearance.mm:
+        (WebCore::LocalDefaultSystemAppearance::LocalDefaultSystemAppearance): Added recursion early return.
+        (WebCore::LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance): Ditto.
+        * platform/mac/ScrollbarThemeMac.h:
+        * platform/mac/ScrollbarThemeMac.mm:
+        (WebCore::ScrollbarThemeMac::paintScrollCorner): Added.
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::paintScrollCorner): Call ScrollbarTheme::paintScrollCorner.
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintContents): Added LocalDefaultSystemAppearance.
+        * rendering/RenderLayerCompositor.cpp:
+        (WebCore::RenderLayerCompositor::paintContents): Added LocalDefaultSystemAppearance.
+        * rendering/RenderScrollbarTheme.cpp:
+        (WebCore::RenderScrollbarTheme::paintScrollCorner): Call ScrollbarTheme::paintScrollCorner.
+        * rendering/RenderScrollbarTheme.h:
+        * svg/graphics/SVGImage.cpp:
+        (WebCore::SVGImage::draw): Added LocalDefaultSystemAppearance.
+
 2018-06-22  Tim Horton  <timothy_horton@apple.com>
 
         Make it possible to add a border around loading or failed-to-load images
index 29b6806..29863fe 100644 (file)
@@ -80,6 +80,9 @@ WK_AUDIO_UNIT_LDFLAGS_macosx = -framework AudioUnit;
 WK_CARBON_LDFLAGS = $(WK_CARBON_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_CARBON_LDFLAGS_macosx = -framework Carbon;
 
+WK_CORE_UI_LDFLAGS = $(WK_CORE_UI_LDFLAGS_$(WK_PLATFORM_NAME));
+WK_CORE_UI_LDFLAGS_macosx = -framework CoreUI;
+
 WK_DATA_DETECTORS_CORE_LDFLAGS = $(WK_DATA_DETECTORS_CORE_LDFLAGS_$(WK_PLATFORM_NAME));
 WK_DATA_DETECTORS_CORE_LDFLAGS_macosx = -framework DataDetectorsCore;
 
@@ -126,7 +129,7 @@ WK_URL_FORMATTING_LDFLAGS = $(WK_URL_FORMATTING_LDFLAGS_$(WK_HAVE_URL_FORMATTING
 WK_URL_FORMATTING_LDFLAGS_YES = -framework URLFormatting;
 
 // FIXME: Reduce the number of allowable_clients <rdar://problem/31823969>
-OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_UNDEFINED_SYMBOLS_LDFLAGS) -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS)  $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_SYSTEM_PREVIEW_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
+OTHER_LDFLAGS = $(inherited) $(WK_RELOCATABLE_FRAMEWORK_LDFLAGS) $(WK_UNDEFINED_SYMBOLS_LDFLAGS) -lsqlite3 -lobjc -lANGLE -allowable_client WebCoreTestSupport -allowable_client WebKitLegacy -force_load $(BUILT_PRODUCTS_DIR)/libPAL.a -framework CFNetwork -framework CoreAudio -framework CoreGraphics -framework CoreText -framework Foundation -framework ImageIO -framework Metal $(OTHER_LDFLAGS_PLATFORM_$(WK_COCOA_TOUCH)) $(OTHER_LDFLAGS_PLATFORM_$(WK_PLATFORM_NAME)) $(WK_APPKIT_LDFLAGS) $(WK_APPSUPPORT_LDFLAGS) $(WK_AUDIO_UNIT_LDFLAGS) $(WK_CARBON_LDFLAGS) $(WK_CORE_UI_LDFLAGS) $(WK_DATA_DETECTORS_CORE_LDFLAGS) $(WK_DEVICE_IDENTITY_LDFLAGS) $(WK_GRAPHICS_SERVICES_LDFLAGS) $(WK_IOSURFACE_LDFLAGS) $(WK_LIBWEBRTC_LDFLAGS) $(WK_MOBILE_CORE_SERVICES_LDFLAGS) $(WK_MOBILE_GESTALT_LDFLAGS) $(WK_OPENGL_LDFLAGS) $(WK_SYSTEM_CONFIGURATION_LDFLAGS) $(WK_SYSTEM_PREVIEW_LDFLAGS) $(WK_URL_FORMATTING_LDFLAGS);
 
 OTHER_LDFLAGS_PLATFORM_cocoatouch = -allowable_client WebKit -allowable_client iTunesU -allowable_client Casablanca -allowable_client Remote -allowable_client TVBooks -allowable_client DumpRenderTree -allowable_client WebKitTestRunner -allowable_client TestWebKitAPI;
 OTHER_LDFLAGS_PLATFORM_macosx = -sub_library libobjc -umbrella WebKit;
index 84b85a8..e26a31e 100644 (file)
@@ -1,3 +1,15 @@
+2018-06-22  Timothy Hatcher  <timothy@apple.com>
+
+        Corner of two scroll bars is white with dark mode enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=186819
+        rdar://problem/40434350
+
+        Reviewed by Tim Horton.
+
+        * PAL.xcodeproj/project.pbxproj:
+        * pal/spi/mac/CoreUISPI.h: Added.
+        * pal/spi/mac/NSAppearanceSPI.h: Added.
+
 2018-06-21  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed attempt to fix the build after r233052.
index 1b00b16..446f2d0 100644 (file)
                1C09D0581E31C57E00725F18 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C09D0571E31C57E00725F18 /* config.h */; };
                1C4876D81F8D7F4E00CCEEBD /* Logging.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1C4876D61F8D7F4E00CCEEBD /* Logging.cpp */; };
                1C4876D91F8D7F4E00CCEEBD /* Logging.h in Headers */ = {isa = PBXBuildFile; fileRef = 1C4876D71F8D7F4E00CCEEBD /* Logging.h */; };
+               1CCEE4F520D871930047B097 /* CoreUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCEE4F420D871930047B097 /* CoreUISPI.h */; };
+               1CCEE4F720D8743F0047B097 /* NSAppearanceSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 1CCEE4F620D8743F0047B097 /* NSAppearanceSPI.h */; };
                2D02E93C2056FAA700A13797 /* AudioToolboxSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D02E93B2056FAA700A13797 /* AudioToolboxSPI.h */; };
                31308B1420A21705003FB929 /* SystemPreviewSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 31308B1320A21705003FB929 /* SystemPreviewSPI.h */; };
                570AB8F120AE2E8D00B8BE87 /* SecKeyProxySPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 570AB8F020AE2E8D00B8BE87 /* SecKeyProxySPI.h */; };
                1C4876DC1F8D7FC600CCEEBD /* LogMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LogMacros.h; sourceTree = "<group>"; };
                1C67CEA11E32EDA800F80F2E /* FeatureDefines.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = FeatureDefines.xcconfig; sourceTree = "<group>"; };
                1C67CEA21E32EE2600F80F2E /* Version.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = Version.xcconfig; sourceTree = "<group>"; };
+               1CCEE4F420D871930047B097 /* CoreUISPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CoreUISPI.h; sourceTree = "<group>"; };
+               1CCEE4F620D8743F0047B097 /* NSAppearanceSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSAppearanceSPI.h; sourceTree = "<group>"; };
                2D02E93B2056FAA700A13797 /* AudioToolboxSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AudioToolboxSPI.h; sourceTree = "<group>"; };
                31308B1320A21705003FB929 /* SystemPreviewSPI.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SystemPreviewSPI.h; sourceTree = "<group>"; };
                37119A7820CCB5FF002C6DC9 /* WebKitTargetConditionals.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = WebKitTargetConditionals.xcconfig; sourceTree = "<group>"; };
                        isa = PBXGroup;
                        children = (
                                0C7785701F45130F00F4EBB6 /* AVFoundationSPI.h */,
+                               1CCEE4F420D871930047B097 /* CoreUISPI.h */,
                                0C7785711F45130F00F4EBB6 /* DataDetectorsSPI.h */,
                                A102658D1F567E9D00B4C844 /* HIServicesSPI.h */,
                                A10265881F56747A00B4C844 /* HIToolboxSPI.h */,
                                0C7785731F45130F00F4EBB6 /* MediaRemoteSPI.h */,
                                A1F55DCE1F5528EC00EDB75F /* MetadataSPI.h */,
                                0C7785741F45130F00F4EBB6 /* NSAccessibilitySPI.h */,
+                               1CCEE4F620D8743F0047B097 /* NSAppearanceSPI.h */,
                                0C7785751F45130F00F4EBB6 /* NSApplicationSPI.h */,
                                A1175B4A1F6B2D7E00C4B9F0 /* NSCellSPI.h */,
                                0C7785761F45130F00F4EBB6 /* NSEventSPI.h */,
                                0CF99CA91F738437007EE793 /* CoreMediaSoftLink.h in Headers */,
                                0C2DA0721F33CA8400DBC317 /* CoreMediaSPI.h in Headers */,
                                0C2DA1401F3BEB4900DBC317 /* CoreTextSPI.h in Headers */,
+                               1CCEE4F520D871930047B097 /* CoreUISPI.h in Headers */,
                                0C5AF9191F43A4C7002EAC02 /* CoreUISPI.h in Headers */,
                                1C09D0531E31C44100725F18 /* CryptoDigest.h in Headers */,
                                0C2DA1411F3BEB4900DBC317 /* DataDetectorsCoreSPI.h in Headers */,
                                0C5AF91E1F43A4C7002EAC02 /* MobileGestaltSPI.h in Headers */,
                                0C2DA1491F3BEB4900DBC317 /* NEFilterSourceSPI.h in Headers */,
                                0C77858D1F45130F00F4EBB6 /* NSAccessibilitySPI.h in Headers */,
+                               1CCEE4F720D8743F0047B097 /* NSAppearanceSPI.h in Headers */,
                                0C77858E1F45130F00F4EBB6 /* NSApplicationSPI.h in Headers */,
                                0C2DA14A1F3BEB4900DBC317 /* NSAttributedStringSPI.h in Headers */,
                                0C2DA14B1F3BEB4900DBC317 /* NSButtonCellSPI.h in Headers */,
diff --git a/Source/WebCore/PAL/pal/spi/mac/CoreUISPI.h b/Source/WebCore/PAL/pal/spi/mac/CoreUISPI.h
new file mode 100644 (file)
index 0000000..6898787
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2018 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#if USE(APPLE_INTERNAL_SDK)
+
+#include <CoreUI/CoreUI.h>
+
+#else
+
+extern const CFStringRef kCUIWidgetKey;
+extern const CFStringRef kCUIIsFlippedKey;
+
+extern const CFStringRef kCUIWidgetScrollBarTrackCorner;
+
+#endif
diff --git a/Source/WebCore/PAL/pal/spi/mac/NSAppearanceSPI.h b/Source/WebCore/PAL/pal/spi/mac/NSAppearanceSPI.h
new file mode 100644 (file)
index 0000000..17c1578
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (C) 2018 Apple Inc.  All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#if USE(APPKIT)
+
+@interface NSAppearance ()
+
+- (void)_drawInRect:(NSRect)rect context:(CGContextRef)context options:(NSDictionary *)options;
+
+@end
+
+#endif // USE(APPKIT)
index 7472160..ea6827d 100644 (file)
                43EDD67F1B485DBF00640E75 /* CombinedFiltersAlphabet.h in Headers */ = {isa = PBXBuildFile; fileRef = 43EDD67D1B485DBF00640E75 /* CombinedFiltersAlphabet.h */; settings = {ATTRIBUTES = (Private, ); }; };
                4415292E0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 4415292C0E1AE8A000C4A2D0 /* HTMLPlugInImageElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
                443918001A91B2F8006E04F2 /* QuickLookSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 443917FE1A91B2F8006E04F2 /* QuickLookSoftLink.h */; };
-               445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */ = {isa = PBXBuildFile; fileRef = 445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */; };
+               445775E520472F73008DCE5D /* LocalDefaultSystemAppearance.h in Headers */ = {isa = PBXBuildFile; fileRef = 445775E420472F73008DCE5D /* LocalDefaultSystemAppearance.h */; settings = {ATTRIBUTES = (Private, ); }; };
                445775EA2047303C008DCE5D /* LocalDefaultSystemAppearance.mm in Sources */ = {isa = PBXBuildFile; fileRef = 445775E92047303B008DCE5D /* LocalDefaultSystemAppearance.mm */; };
                4471710E205AF945000A116E /* MediaQueryParserContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 4471710C205AF945000A116E /* MediaQueryParserContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
                447958041643B49A001E0A7F /* ParsedContentType.h in Headers */ = {isa = PBXBuildFile; fileRef = 447958031643B47B001E0A7F /* ParsedContentType.h */; settings = {ATTRIBUTES = (Private, ); }; };
index 328218f..5bc0602 100644 (file)
@@ -59,6 +59,9 @@
 #include <JavaScriptCore/InspectorProtocolObjects.h>
 #include <wtf/JSONValues.h>
 
+#if PLATFORM(MAC)
+#include "LocalDefaultSystemAppearance.h"
+#endif
 
 namespace WebCore {
 
@@ -177,6 +180,10 @@ void InspectorOverlay::paint(GraphicsContext& context)
     if (!shouldShowOverlay())
         return;
 
+#if PLATFORM(MAC)
+    LocalDefaultSystemAppearance localAppearance(m_page.useSystemAppearance(), m_page.defaultAppearance());
+#endif
+
     GraphicsContextStateSaver stateSaver(context);
     FrameView* view = overlayPage()->mainFrame().view();
     view->updateLayoutAndStyleIfNeededRecursive();
index e88350a..f8f42d6 100644 (file)
@@ -342,7 +342,7 @@ public:
     bool useSystemAppearance() const { return m_useSystemAppearance; }
     WEBCORE_EXPORT void setUseSystemAppearance(bool);
     
-    bool defaultAppearance() const;
+    WEBCORE_EXPORT bool defaultAppearance() const;
     WEBCORE_EXPORT void setDefaultAppearance(bool);
 
 #if ENABLE(TEXT_AUTOSIZING)
index 4f53ad7..2211b52 100644 (file)
@@ -1122,7 +1122,7 @@ void ScrollView::scrollbarStyleChanged(ScrollbarStyle newStyle, bool forceUpdate
 
 void ScrollView::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
 {
-    ScrollbarTheme::theme().paintScrollCorner(this, context, cornerRect);
+    ScrollbarTheme::theme().paintScrollCorner(context, cornerRect);
 }
 
 void ScrollView::paintScrollbar(GraphicsContext& context, Scrollbar& bar, const IntRect& rect)
index b533d7f..b291d7a 100644 (file)
@@ -84,7 +84,7 @@ public:
 
     virtual void invalidatePart(Scrollbar&, ScrollbarPart) { }
 
-    virtual void paintScrollCorner(ScrollView*, GraphicsContext& context, const IntRect& cornerRect) { defaultPaintScrollCorner(context, cornerRect); }
+    virtual void paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect) { defaultPaintScrollCorner(context, cornerRect); }
     static void defaultPaintScrollCorner(GraphicsContext& context, const IntRect& cornerRect) { context.fillRect(cornerRect, Color::white); }
 
     virtual void paintTickmarks(GraphicsContext&, Scrollbar&, const IntRect&) { }
index 46d9ee6..00e5264 100644 (file)
@@ -260,11 +260,6 @@ int ScrollbarThemeComposite::trackLength(Scrollbar& scrollbar)
     return (scrollbar.orientation() == HorizontalScrollbar) ? constrainedTrackRect.width() : constrainedTrackRect.height();
 }
 
-void ScrollbarThemeComposite::paintScrollCorner(ScrollView*, GraphicsContext& context, const IntRect& cornerRect)
-{
-    context.fillRect(cornerRect, Color::white);
-}
-
 IntRect ScrollbarThemeComposite::thumbRect(Scrollbar& scrollbar)
 {
     if (!hasThumb(scrollbar))
index 8ea6910..432678a 100644 (file)
@@ -44,7 +44,6 @@ public:
     int thumbLength(Scrollbar&) override;
     int trackPosition(Scrollbar&) override;
     int trackLength(Scrollbar&) override;
-    void paintScrollCorner(ScrollView*, GraphicsContext&, const IntRect& cornerRect) override;
     void paintOverhangAreas(ScrollView&, GraphicsContext&, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) override;
 
     virtual bool hasButtons(Scrollbar&) = 0;
index dedd993..a1a1845 100644 (file)
@@ -39,8 +39,8 @@ namespace WebCore {
 class LocalDefaultSystemAppearance {
     WTF_MAKE_NONCOPYABLE(LocalDefaultSystemAppearance);
 public:
-    LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDefaultAppearance);
-    ~LocalDefaultSystemAppearance();
+    WEBCORE_EXPORT LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDefaultAppearance);
+    WEBCORE_EXPORT ~LocalDefaultSystemAppearance();
 private:
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
     RetainPtr<NSAppearance> m_savedSystemAppearance;
index bf9592d..1aba292 100644 (file)
 
 namespace WebCore {
 
+#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+static size_t recursionCount = 0;
+#endif
+
 LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppearance, bool useDefaultAppearance)
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    if (recursionCount++)
+        return;
+
     m_savedSystemAppearance = [NSAppearance currentAppearance];
     [NSAppearance setCurrentAppearance:[NSAppearance appearanceNamed:(!useSystemAppearance || useDefaultAppearance ? NSAppearanceNameAqua : NSAppearanceNameDarkAqua)]];
 #else
@@ -45,6 +52,9 @@ LocalDefaultSystemAppearance::LocalDefaultSystemAppearance(bool useSystemAppeara
 LocalDefaultSystemAppearance::~LocalDefaultSystemAppearance()
 {
 #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400
+    if (--recursionCount)
+        return;
+
     [NSAppearance setCurrentAppearance:m_savedSystemAppearance.get()];
 #endif
 }
index 10be376..3f0c0b5 100644 (file)
@@ -41,6 +41,7 @@ public:
     void updateEnabledState(Scrollbar&) override;
 
     bool paint(Scrollbar&, GraphicsContext&, const IntRect& damageRect) override;
+    void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) override;
 
     int scrollbarThickness(ScrollbarControlSize = RegularScrollbar, ScrollbarExpansionState = ScrollbarExpansionState::Expanded) override;
     
index 5c2ca3a..e2caa6e 100644 (file)
@@ -38,6 +38,8 @@
 #import "ScrollView.h"
 #import <Carbon/Carbon.h>
 #import <pal/spi/cg/CoreGraphicsSPI.h>
+#import <pal/spi/mac/CoreUISPI.h>
+#import <pal/spi/mac/NSAppearanceSPI.h>
 #import <pal/spi/mac/NSScrollerImpSPI.h>
 #import <wtf/BlockObjCExceptions.h>
 #import <wtf/HashMap.h>
@@ -554,7 +556,7 @@ bool ScrollbarThemeMac::paint(Scrollbar& scrollbar, GraphicsContext& context, co
         return true;
 
     SetForScope<bool> isCurrentlyDrawingIntoLayer(g_isCurrentlyDrawingIntoLayer, context.isCALayerContext());
-    
+
     GraphicsContextStateSaver stateSaver(context);
     context.clip(damageRect);
     context.translate(scrollbar.frameRect().location());
@@ -564,6 +566,15 @@ bool ScrollbarThemeMac::paint(Scrollbar& scrollbar, GraphicsContext& context, co
     return true;
 }
 
+void ScrollbarThemeMac::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
+{
+    LocalCurrentGraphicsContext localContext(context);
+
+    auto cornerDrawingOptions = @{ (__bridge NSString *)kCUIWidgetKey: (__bridge NSString *)kCUIWidgetScrollBarTrackCorner,
+        (__bridge NSString *)kCUIIsFlippedKey: (__bridge NSNumber *)kCFBooleanTrue };
+    [[NSAppearance currentAppearance] _drawInRect:cornerRect context:localContext.cgContext() options:cornerDrawingOptions];
+}
+
 #if ENABLE(RUBBER_BANDING)
 static RetainPtr<CGColorRef> linenBackgroundColor()
 {
index e107e44..c56048b 100644 (file)
@@ -3710,10 +3710,10 @@ void RenderLayer::paintScrollCorner(GraphicsContext& context, const IntPoint& pa
         return;
     }
 
-    // We don't want to paint white if we have overlay scrollbars, since we need
+    // We don't want to paint a corner if we have overlay scrollbars, since we need
     // to see what is behind it.
     if (!hasOverlayScrollbars())
-        context.fillRect(absRect, Color::white);
+        ScrollbarTheme::theme().paintScrollCorner(context, absRect);
 }
 
 void RenderLayer::drawPlatformResizerImage(GraphicsContext& context, const LayoutRect& resizerCornerRect)
index db39ab8..99550fe 100644 (file)
 #include "RuntimeApplicationChecks.h"
 #endif
 
+#if PLATFORM(MAC)
+#include "LocalDefaultSystemAppearance.h"
+#endif
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -2580,6 +2584,10 @@ void RenderLayerBacking::paintContents(const GraphicsLayer* graphicsLayer, Graph
     renderer().page().setIsPainting(true);
 #endif
 
+#if PLATFORM(MAC)
+    LocalDefaultSystemAppearance localAppearance(renderer().page().useSystemAppearance(), renderer().page().defaultAppearance());
+#endif
+
     // The dirtyRect is in the coords of the painting root.
     FloatRect adjustedClipRect = clip;
     adjustedClipRect.move(m_subpixelOffsetFromRenderer);
index be80cda..db16dda 100644 (file)
 #include "RenderScrollbar.h"
 #endif
 
+#if PLATFORM(MAC)
+#include "LocalDefaultSystemAppearance.h"
+#endif
+
 #if ENABLE(TREE_DEBUGGING)
 #include "RenderTreeAsText.h"
 #endif
@@ -2769,6 +2773,10 @@ void paintScrollbar(Scrollbar* scrollbar, GraphicsContext& context, const IntRec
 
 void RenderLayerCompositor::paintContents(const GraphicsLayer* graphicsLayer, GraphicsContext& context, GraphicsLayerPaintingPhase, const FloatRect& clip, GraphicsLayerPaintBehavior)
 {
+#if PLATFORM(MAC)
+    LocalDefaultSystemAppearance localAppearance(page().useSystemAppearance(), page().defaultAppearance());
+#endif
+
     IntRect pixelSnappedRectForIntegralPositionedItems = snappedIntRect(LayoutRect(clip));
     if (graphicsLayer == layerForHorizontalScrollbar())
         paintScrollbar(m_renderView.frameView().horizontalScrollbar(), context, pixelSnappedRectForIntegralPositionedItems);
index 1692ddc..36b71e3 100644 (file)
@@ -126,10 +126,9 @@ void RenderScrollbarTheme::didPaintScrollbar(GraphicsContext& context, Scrollbar
     }
 }
 
-void RenderScrollbarTheme::paintScrollCorner(ScrollView*, GraphicsContext& context, const IntRect& cornerRect)
+void RenderScrollbarTheme::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
 {
-    // FIXME: Implement.
-    context.fillRect(cornerRect, Color::white);
+    ScrollbarTheme::theme().paintScrollCorner(context, cornerRect);
 }
 
 void RenderScrollbarTheme::paintScrollbarBackground(GraphicsContext& context, Scrollbar& scrollbar)
index 6ed98a2..61c76f8 100644 (file)
@@ -43,7 +43,7 @@ public:
 
     bool supportsControlTints() const override { return true; }
 
-    void paintScrollCorner(ScrollView*, GraphicsContext&, const IntRect& cornerRect) override;
+    void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) override;
 
     ScrollbarButtonPressAction handleMousePressEvent(Scrollbar& scrollbar, const PlatformMouseEvent& event, ScrollbarPart pressedPart) override { return ScrollbarTheme::theme().handleMousePressEvent(scrollbar, event, pressedPart); }
 
index 58c25c6..2712c24 100644 (file)
 #include <JavaScriptCore/JSLock.h>
 #include <wtf/text/TextStream.h>
 
+#if PLATFORM(MAC)
+#include "LocalDefaultSystemAppearance.h"
+#endif
+
 #if USE(DIRECT2D)
 #include "COMPtr.h"
 #include <d2d1.h>
@@ -319,6 +323,10 @@ ImageDrawResult SVGImage::draw(GraphicsContext& context, const FloatRect& dstRec
             view->layoutContext().layout();
     }
 
+#if PLATFORM(MAC)
+    LocalDefaultSystemAppearance localAppearance(m_page->useSystemAppearance(), m_page->defaultAppearance());
+#endif
+
     view->paint(context, intersection(context.clipBounds(), enclosingIntRect(srcRect)));
 
     if (compositingRequiresTransparencyLayer)
index dd5eae1..b9d0355 100644 (file)
@@ -1,3 +1,20 @@
+2018-06-22  Timothy Hatcher  <timothy@apple.com>
+
+        Corner of two scroll bars is white with dark mode enabled.
+        https://bugs.webkit.org/show_bug.cgi?id=186819
+        rdar://problem/40434350
+
+        Reviewed by Tim Horton.
+
+        * UIProcess/mac/WKPrintingView.mm:
+        (-[WKPrintingView drawRect:]): Added LocalDefaultSystemAppearance.
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+        (WebKit::InjectedBundleRangeHandle::renderedImage): Ditto.
+        * WebProcess/Plugins/PDF/PDFPlugin.mm:
+        (WebKit::PDFPlugin::paintControlForLayerInContext): Ditto. Dropped ScrollView argument.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::drawRect): Added LocalDefaultSystemAppearance.
+
 2018-06-22  Tim Horton  <timothy_horton@apple.com>
 
         Make it possible to add a border around loading or failed-to-load images
index 934297f..6f699c9 100644 (file)
@@ -36,6 +36,7 @@
 #import "WebPageProxy.h"
 #import <PDFKit/PDFKit.h>
 #import <WebCore/GraphicsContext.h>
+#import <WebCore/LocalDefaultSystemAppearance.h>
 #import <WebCore/WebCoreObjCExtras.h>
 #import <wtf/RunLoop.h>
 
@@ -563,9 +564,12 @@ static CFStringRef linkDestinationName(PDFDocument *document, PDFDestination *de
 
     ASSERT(_printOperation == [NSPrintOperation currentOperation]);
 
-    if (!_webFrame->page())
+    auto* page = _webFrame->page();
+    if (!page)
         return;
 
+    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->defaultAppearance());
+
     if ([self _isPrintingPreview]) {
         [self _drawPreview:nsRect];
         return;
index 7bd6a42..23d05f0 100644 (file)
 #include <wtf/HashMap.h>
 #include <wtf/NeverDestroyed.h>
 
+#if PLATFORM(MAC)
+#include <WebCore/LocalDefaultSystemAppearance.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -120,6 +124,10 @@ RefPtr<WebImage> InjectedBundleRangeHandle::renderedImage(SnapshotOptions option
     if (!frameView)
         return nullptr;
 
+#if PLATFORM(MAC)
+    LocalDefaultSystemAppearance localAppearance(frame->page()->useSystemAppearance(), frame->page()->defaultAppearance());
+#endif
+
     Ref<Frame> protector(*frame);
 
     VisibleSelection oldSelection = frame->selection().selection();
index 203db1a..8388d7b 100644 (file)
 #import <pal/spi/mac/NSMenuSPI.h>
 #import <wtf/UUID.h>
 
+#if PLATFORM(MAC)
+#include <WebCore/LocalDefaultSystemAppearance.h>
+#endif
+
 using namespace WebCore;
 
 // Set overflow: hidden on the annotation container so <input> elements scrolled out of view don't show
@@ -1209,20 +1213,25 @@ void PDFPlugin::updateControlTints(GraphicsContext& graphicsContext)
 
 void PDFPlugin::paintControlForLayerInContext(CALayer *layer, CGContextRef context)
 {
+#if PLATFORM(MAC)
+    auto* page = webFrame()->coreFrame()->page();
+    LocalDefaultSystemAppearance localAppearance(page->useSystemAppearance(), page->defaultAppearance());
+#endif
+
     GraphicsContext graphicsContext(context);
     GraphicsContextStateSaver stateSaver(graphicsContext);
-    
+
     graphicsContext.setIsCALayerContext(true);
-    
+
     if (layer == m_scrollCornerLayer) {
         IntRect scrollCornerRect = this->scrollCornerRect();
         graphicsContext.translate(-scrollCornerRect.x(), -scrollCornerRect.y());
-        ScrollbarTheme::theme().paintScrollCorner(nullptr, graphicsContext, scrollCornerRect);
+        ScrollbarTheme::theme().paintScrollCorner(graphicsContext, scrollCornerRect);
         return;
     }
-    
+
     Scrollbar* scrollbar = nullptr;
-    
+
     if (layer == m_verticalScrollbarLayer)
         scrollbar = verticalScrollbar();
     else if (layer == m_horizontalScrollbarLayer)
@@ -1230,7 +1239,7 @@ void PDFPlugin::paintControlForLayerInContext(CALayer *layer, CGContextRef conte
 
     if (!scrollbar)
         return;
-    
+
     graphicsContext.translate(-scrollbar->x(), -scrollbar->y());
     scrollbar->paint(graphicsContext, scrollbar->frameRect());
 }
index 2a8c321..46e9f58 100644 (file)
 #include <pal/spi/cocoa/CoreTextSPI.h>
 #endif
 
+#if PLATFORM(MAC)
+#include <WebCore/LocalDefaultSystemAppearance.h>
+#endif
+
 #ifndef NDEBUG
 #include <wtf/RefCountedLeakCounter.h>
 #endif
@@ -1517,6 +1521,10 @@ void WebPage::scrollMainFrameIfNotAtMaxScrollPosition(const IntSize& scrollOffse
 
 void WebPage::drawRect(GraphicsContext& graphicsContext, const IntRect& rect)
 {
+#if PLATFORM(MAC)
+    LocalDefaultSystemAppearance localAppearance(m_page->useSystemAppearance(), m_page->defaultAppearance());
+#endif
+
     GraphicsContextStateSaver stateSaver(graphicsContext);
     graphicsContext.clip(rect);