Title: [232278] trunk/Source/WebCore
Revision
232278
Author
[email protected]
Date
2018-05-29 16:41:39 -0700 (Tue, 29 May 2018)

Log Message

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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (232277 => 232278)


--- trunk/Source/WebCore/ChangeLog	2018-05-29 23:28:41 UTC (rev 232277)
+++ trunk/Source/WebCore/ChangeLog	2018-05-29 23:41:39 UTC (rev 232278)
@@ -1,3 +1,22 @@
+2018-05-29  Timothy Hatcher  <[email protected]>
+
+        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  <[email protected]>
 
         Create typedef for HashMap<PlatformDisplayID, ScreenProperties>

Modified: trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp (232277 => 232278)


--- trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2018-05-29 23:28:41 UTC (rev 232277)
+++ trunk/Source/WebCore/inspector/agents/InspectorPageAgent.cpp	2018-05-29 23:41:39 UTC (rev 232278)
@@ -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 @@
         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();
     }

Modified: trunk/Source/WebCore/page/FrameView.cpp (232277 => 232278)


--- trunk/Source/WebCore/page/FrameView.cpp	2018-05-29 23:28:41 UTC (rev 232277)
+++ trunk/Source/WebCore/page/FrameView.cpp	2018-05-29 23:41:39 UTC (rev 232278)
@@ -1379,6 +1379,8 @@
             setMediaType(m_mediaTypeWhenNotPrinting);
         m_mediaTypeWhenNotPrinting = String();
     }
+
+    RenderTheme::singleton().platformColorsDidChange();
 }
 
 bool FrameView::useSlowRepaints(bool considerOverlap) const

Modified: trunk/Source/WebCore/page/Page.cpp (232277 => 232278)


--- trunk/Source/WebCore/page/Page.cpp	2018-05-29 23:28:41 UTC (rev 232277)
+++ trunk/Source/WebCore/page/Page.cpp	2018-05-29 23:41:39 UTC (rev 232278)
@@ -2368,6 +2368,14 @@
     }
 }
 
+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()) {

Modified: trunk/Source/WebCore/page/Page.h (232277 => 232278)


--- trunk/Source/WebCore/page/Page.h	2018-05-29 23:28:41 UTC (rev 232277)
+++ trunk/Source/WebCore/page/Page.h	2018-05-29 23:41:39 UTC (rev 232278)
@@ -342,7 +342,7 @@
     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)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to