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

Unified Diff: third_party/WebKit/Source/core/frame/FrameView.cpp

Issue 2878573003: Initial skeleton of high-contrast mode. (Closed)
Patch Set: 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/frame/FrameView.cpp
diff --git a/third_party/WebKit/Source/core/frame/FrameView.cpp b/third_party/WebKit/Source/core/frame/FrameView.cpp
index cd578f3903f9ac16aa8302409e85ce03aed6351b..f3e44321aee8adaeda80a8e733aa22f810215c96 100644
--- a/third_party/WebKit/Source/core/frame/FrameView.cpp
+++ b/third_party/WebKit/Source/core/frame/FrameView.cpp
@@ -159,6 +159,24 @@ constexpr int kLetterPortraitPageHeight = 792;
namespace blink {
+namespace {
+
+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;
+}
+
+} // namespace
+
using namespace HTMLNames;
// The maximum number of updatePlugins iterations that should be done before
@@ -3266,6 +3284,9 @@ void FrameView::PaintTree() {
if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) {
if (GetLayoutView()->Layer()->NeedsRepaint()) {
GraphicsContext graphics_context(*paint_controller_);
+ HighContrastSettings high_contrast_settings =
+ InitHighContrastSettingsFromSettings(frame_->GetSettings());
+ graphics_context.SetHighContrast(high_contrast_settings);
if (RuntimeEnabledFeatures::printBrowserEnabled())
graphics_context.SetPrinting(true);
Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect()));
@@ -3311,7 +3332,9 @@ void FrameView::PaintTree() {
void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) {
DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
if (graphics_layer->DrawsContent()) {
- graphics_layer->Paint(nullptr);
+ HighContrastSettings high_contrast_settings =
+ InitHighContrastSettingsFromSettings(frame_->GetSettings());
+ graphics_layer->Paint(nullptr, &high_contrast_settings);
NotifyPaint(graphics_layer->GetPaintController());
}

Powered by Google App Engine
This is Rietveld 408576698