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 dac637d20e4d5dcfc021aebc504f1456fbc2820e..36702d3cb46d29f27d64e04fad874f4f67ed1797 100644 |
--- a/third_party/WebKit/Source/core/page/Page.cpp |
+++ b/third_party/WebKit/Source/core/page/Page.cpp |
@@ -40,6 +40,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" |
@@ -49,7 +50,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 "public/platform/Platform.h" |
@@ -328,11 +331,50 @@ void Page::setDeviceScaleFactor(float scaleFactor) |
void Page::setDeviceColorProfile(const Vector<char>& profile) |
{ |
- // FIXME: implement. |
+ if (!RuntimeEnabledFeatures::imageColorProfilesEnabled()) |
+ return; |
+ |
+ fprintf(stderr, "\nWebCore::Page %ld setDeviceColorProfile begins\n", (long int)this); |
+ fflush(stderr); |
+ |
+ RefPtr<ColorSpaceProfile> screen = screenColorProfile(reinterpret_cast<int64_t>(this)); |
+ setScreenColorProfile(reinterpret_cast<int64_t>(this), profile.data(), profile.size()); |
+ |
+ setCurrentScreenId(reinterpret_cast<int64_t>(this)); |
+ |
+ for (Frame* frame = mainFrame(); frame; frame = frame->tree().traverseNext()) { |
+ if (!frame->isLocalFrame()) |
+ continue; |
+ |
+ if (LayoutView* layoutView = toLocalFrame(frame)->document()->layoutView()) |
+ layoutView->invalidatePaintForViewAndCompositedLayers(true); |
+ |
+ // Clear the SVG pattern cache: see crbug.com/531258 |
+ SVGResourcesCache::invalidateAllResources(*toLocalFrame(frame)->document()); |
+ |
+ RELEASE_ASSERT(currentScreenId() == reinterpret_cast<int64_t>(this)); |
+ } |
+ |
+ animator().scheduleVisualUpdate(); |
+ |
+ 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 (RuntimeEnabledFeatures::imageColorProfilesEnabled()) { |
+ fprintf(stderr, "\nWebCore::Page %ld resetDeviceColorProfile\n", (long int)this); |
+ fflush(stderr); |
+ } |
+ |
+ removeScreenColorProfile(reinterpret_cast<int64_t>(this)); |
+ |
RuntimeEnabledFeatures::setImageColorProfilesEnabled(false); |
} |
@@ -599,6 +641,8 @@ void Page::willBeDestroyed() |
chromeClient().chromeDestroyed(); |
if (m_validationMessageClient) |
m_validationMessageClient->willBeDestroyed(); |
+ |
+ removeScreenColorProfile(reinterpret_cast<int64_t>(this)); |
m_mainFrame = nullptr; |
Page::notifyContextDestroyed(); |