Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(786)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp

Issue 2878573003: Initial skeleton of high-contrast mode. (Closed)
Patch Set: Don't pass settings to GraphicsLayer, address other feedback from chrishtr Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
index 05fc565f04bfc5cc77cfeccef5166c84a748d180..3d47b2baf004e5a866f9abc911916bc5d05db7c3 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp
@@ -5,6 +5,8 @@
#include "core/paint/PaintLayerPainter.h"
#include "core/frame/FrameView.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
#include "core/layout/LayoutView.h"
#include "core/paint/ClipPathClipper.h"
#include "core/paint/FilterPainter.h"
@@ -29,6 +31,21 @@
namespace blink {
+static HighContrastSettings InitHighContrastSettingsFromSettings(
+ Settings* settings) {
+ HighContrastSettings result;
+ if (settings) {
+ result.mode = settings->GetHighContrastMode();
+ result.grayscale = settings->GetHighContrastGrayscale();
+ result.contrast = settings->GetHighContrastContrast();
+ } else {
+ result.mode = HighContrastMode::kOff;
+ result.grayscale = false;
+ result.contrast = 0.0;
+ }
+ return result;
+}
+
static inline bool ShouldSuppressPaintingLayer(const PaintLayer& layer) {
// Avoid painting descendants of the root layer when stylesheets haven't
// loaded. This avoids some FOUC. It's ok not to draw, because later on, when
@@ -273,6 +290,13 @@ PaintResult PaintLayerPainter::PaintLayerContents(
if (paint_layer_.GetLayoutObject().GetFrameView()->ShouldThrottleRendering())
return result;
+ HighContrastSettings high_contrast_settings =
+ InitHighContrastSettingsFromSettings(paint_layer_.GetLayoutObject()
+ .GetFrameView()
+ ->GetFrame()
+ .GetSettings());
+ context.SetHighContrast(high_contrast_settings);
+
Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties;
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() &&
RuntimeEnabledFeatures::rootLayerScrollingEnabled() &&

Powered by Google App Engine
This is Rietveld 408576698