Index: third_party/WebKit/Source/core/page/Page.cpp |
diff --git a/third_party/WebKit/Source/core/page/Page.cpp b/third_party/WebKit/Source/core/page/Page.cpp |
index c587b9c432764e6330589cf8235ef912fcdad5e3..c903370b311f0f293d41c38bc0b1a0efe4a3fba0 100644 |
--- a/third_party/WebKit/Source/core/page/Page.cpp |
+++ b/third_party/WebKit/Source/core/page/Page.cpp |
@@ -39,6 +39,7 @@ |
#include "core/inspector/InspectorInstrumentation.h" |
#include "core/layout/LayoutView.h" |
#include "core/layout/TextAutosizer.h" |
+#include "core/layout/svg/SVGResourcesCache.h" |
#include "core/page/AutoscrollController.h" |
#include "core/page/ChromeClient.h" |
#include "core/page/ContextMenuController.h" |
@@ -48,7 +49,9 @@ |
#include "core/page/ValidationMessageClient.h" |
#include "core/page/scrolling/ScrollingCoordinator.h" |
#include "core/paint/PaintLayer.h" |
+#include "platform/graphics/ColorSpaceProfile.h" |
#include "platform/graphics/GraphicsLayer.h" |
+#include "platform/graphics/GraphicsScreen.h" |
#include "platform/plugins/PluginData.h" |
#include "platform/text/CompressibleString.h" |
#include "public/platform/Platform.h" |
@@ -335,11 +338,53 @@ void Page::setDeviceScaleFactor(float scaleFactor) |
void Page::setDeviceColorProfile(const Vector<char>& profile) |
{ |
- // FIXME: implement. |
+ if (!imageColorProfilesEnabled()) |
+ return; |
+ |
+ fprintf(stderr, "\nWebCore::Page %ld setDeviceColorProfile begins\n", (long int)this); |
+ fflush(stderr); |
+ |
+ RefPtr<ColorSpaceProfile> screen = screenColorProfile(Page::screenId(this)); |
+ setScreenColorProfile(Page::screenId(this), profile.data(), profile.size()); |
+ |
+ setCurrentScreenId(Page::screenId(this)); |
+ |
+ for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) { |
+ if (!frame->isLocalFrame()) |
+ continue; |
+ |
+ toLocalFrame(frame)->view()->invalidatePaintForTickmarks(); |
+ |
+ if (LayoutView* layoutView = toLocalFrame(frame)->document()->layoutView()) |
+ layoutView->invalidatePaintForViewAndCompositedLayers(true); |
+ |
+ // Clear the SVG image pattern cache: see crbug.com/531258 |
+ SVGResourcesCache::invalidateAllResources(*toLocalFrame(frame)->document()); |
+ |
+ RELEASE_ASSERT(currentScreenId() == Page::screenId(this)); |
+ } |
+ |
+ if (mainFrame() && mainFrame()->isLocalFrame()) |
+ animator().scheduleVisualUpdate(toLocalFrame(mainFrame())); |
+ |
+ fprintf(stderr, "WebCore::Page %ld setDeviceColorProfile ends\n\n", (long int)this); |
+ fflush(stderr); |
+ |
+ setCurrentScreenId(0); |
+ |
+ if (screen) |
+ pruneColorTransform(screen.get()); |
} |
void Page::resetDeviceColorProfileForTesting() |
{ |
+ if (imageColorProfilesEnabled()) { |
+ fprintf(stderr, "\nWebCore::Page %ld resetDeviceColorProfileForTesting\n", (long int)this); |
+ fflush(stderr); |
+ } |
+ |
+ removeScreenColorProfile(Page::screenId(this)); |
+ |
RuntimeEnabledFeatures::setImageColorProfilesEnabled(false); |
} |
@@ -593,6 +638,8 @@ void Page::willBeDestroyed() |
chromeClient().chromeDestroyed(); |
if (m_validationMessageClient) |
m_validationMessageClient->willBeDestroyed(); |
+ |
+ removeScreenColorProfile(Page::screenId(this)); |
m_mainFrame = nullptr; |
PageLifecycleNotifier::notifyContextDestroyed(); |