Printing does not apply the right colors in all cases.
authortimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 May 2018 23:41:39 +0000 (23:41 +0000)
committertimothy@apple.com <timothy@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 May 2018 23:41:39 +0000 (23:41 +0000)
https://bugs.webkit.org/show_bug.cgi?id=186066
rdar://problem/40274975

Reviewed by Tim Horton.

* inspector/agents/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::setEmulatedMedia): Call RenderTheme::platformColorsDidChange
to invalidate the color cache.
* page/FrameView.cpp:
(WebCore::FrameView::adjustMediaTypeForPrinting): Ditto.
* page/Page.cpp:
(WebCore::Page::defaultAppearance const): Added. Use default when not screen.
* page/Page.h:
(WebCore::Page::defaultAppearance const): Deleted.

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

Source/WebCore/ChangeLog
Source/WebCore/inspector/agents/InspectorPageAgent.cpp
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h

index 75add1d..163e487 100644 (file)
@@ -1,3 +1,22 @@
+2018-05-29  Timothy Hatcher  <timothy@apple.com>
+
+        Printing does not apply the right colors in all cases.
+
+        https://bugs.webkit.org/show_bug.cgi?id=186066
+        rdar://problem/40274975
+
+        Reviewed by Tim Horton.
+
+        * inspector/agents/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::setEmulatedMedia): Call RenderTheme::platformColorsDidChange
+        to invalidate the color cache.
+        * page/FrameView.cpp:
+        (WebCore::FrameView::adjustMediaTypeForPrinting): Ditto.
+        * page/Page.cpp:
+        (WebCore::Page::defaultAppearance const): Added. Use default when not screen.
+        * page/Page.h:
+        (WebCore::Page::defaultAppearance const): Deleted.
+
 2018-05-29  Per Arne Vollan  <pvollan@apple.com>
 
         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>
index 58b7b6e..2e3b76d 100644 (file)
@@ -55,6 +55,7 @@
 #include "MemoryCache.h"
 #include "Page.h"
 #include "RenderObject.h"
+#include "RenderTheme.h"
 #include "ScriptController.h"
 #include "SecurityOrigin.h"
 #include "Settings.h"
@@ -785,8 +786,10 @@ void InspectorPageAgent::setEmulatedMedia(ErrorString&, const String& media)
         return;
 
     m_emulatedMedia = media;
-    Document* document = m_page.mainFrame().document();
-    if (document) {
+
+    RenderTheme::singleton().platformColorsDidChange();
+
+    if (auto document = m_page.mainFrame().document()) {
         document->styleScope().didChangeStyleSheetEnvironment();
         document->updateLayout();
     }
index 774be22..4827479 100644 (file)
@@ -1379,6 +1379,8 @@ void FrameView::adjustMediaTypeForPrinting(bool printing)
             setMediaType(m_mediaTypeWhenNotPrinting);
         m_mediaTypeWhenNotPrinting = String();
     }
+
+    RenderTheme::singleton().platformColorsDidChange();
 }
 
 bool FrameView::useSlowRepaints(bool considerOverlap) const
index f7cee2d..780582b 100644 (file)
@@ -2368,6 +2368,14 @@ void Page::setUnobscuredSafeAreaInsets(const FloatBoxExtent& insets)
     }
 }
 
+bool Page::defaultAppearance() const
+{
+    FrameView* view = mainFrame().view();
+    if (!view || !equalLettersIgnoringASCIICase(view->mediaType(), "screen"))
+        return true;
+    return m_defaultAppearance;
+}
+
 void Page::setFullscreenInsetTop(double inset)
 {
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
index 5cc15e8..2b6328a 100644 (file)
@@ -342,7 +342,7 @@ public:
     bool useSystemAppearance() const { return m_useSystemAppearance; }
     void setUseSystemAppearance(bool a) { m_useSystemAppearance = a; }
     
-    bool defaultAppearance() const { return m_defaultAppearance; }
+    bool defaultAppearance() const;
     void setDefaultAppearance(bool a) { m_defaultAppearance = a; }
 
 #if ENABLE(TEXT_AUTOSIZING)