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

Side by Side Diff: third_party/WebKit/Source/core/layout/compositing/CompositedLayerMapping.cpp

Issue 2878573003: Initial skeleton of high-contrast mode. (Closed)
Patch Set: Move to CompositedLayerMapping::DoPaintTask and add unit test Created 3 years, 6 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved. 2 * Copyright (C) 2009, 2010, 2011 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 } 155 }
156 156
157 static inline bool IsAcceleratedContents(LayoutObject& layout_object) { 157 static inline bool IsAcceleratedContents(LayoutObject& layout_object) {
158 return IsCompositedCanvas(layout_object) || 158 return IsCompositedCanvas(layout_object) ||
159 (layout_object.IsEmbeddedObject() && 159 (layout_object.IsEmbeddedObject() &&
160 ToLayoutEmbeddedObject(layout_object) 160 ToLayoutEmbeddedObject(layout_object)
161 .RequiresAcceleratedCompositing()) || 161 .RequiresAcceleratedCompositing()) ||
162 layout_object.IsVideo(); 162 layout_object.IsVideo();
163 } 163 }
164 164
165 static HighContrastSettings InitHighContrastSettingsFromSettings(
166 Settings* settings) {
167 HighContrastSettings result;
168 if (settings) {
169 result.mode = settings->GetHighContrastMode();
170 result.grayscale = settings->GetHighContrastGrayscale();
171 result.contrast = settings->GetHighContrastContrast();
172 } else {
173 result.mode = HighContrastMode::kOff;
174 result.grayscale = false;
175 result.contrast = 0.0;
176 }
177 return result;
178 }
179
165 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer) 180 CompositedLayerMapping::CompositedLayerMapping(PaintLayer& layer)
166 : owning_layer_(layer), 181 : owning_layer_(layer),
167 content_offset_in_compositing_layer_dirty_(false), 182 content_offset_in_compositing_layer_dirty_(false),
168 pending_update_scope_(kGraphicsLayerUpdateNone), 183 pending_update_scope_(kGraphicsLayerUpdateNone),
169 is_main_frame_layout_view_layer_(false), 184 is_main_frame_layout_view_layer_(false),
170 background_layer_paints_fixed_root_background_(false), 185 background_layer_paints_fixed_root_background_(false),
171 scrolling_contents_are_empty_(false), 186 scrolling_contents_are_empty_(false),
172 background_paints_onto_scrolling_contents_layer_(false), 187 background_paints_onto_scrolling_contents_layer_(false),
173 background_paints_onto_graphics_layer_(false), 188 background_paints_onto_graphics_layer_(false),
174 draws_background_onto_content_layer_(false) { 189 draws_background_onto_content_layer_(false) {
(...skipping 2907 matching lines...) Expand 10 before | Expand all | Expand 10 after
3082 #if DCHECK_IS_ON() 3097 #if DCHECK_IS_ON()
3083 if (!GetLayoutObject().View()->GetFrame() || 3098 if (!GetLayoutObject().View()->GetFrame() ||
3084 !GetLayoutObject().View()->GetFrame()->ShouldThrottleRendering()) 3099 !GetLayoutObject().View()->GetFrame()->ShouldThrottleRendering())
3085 paint_info.paint_layer->GetLayoutObject().AssertSubtreeIsLaidOut(); 3100 paint_info.paint_layer->GetLayoutObject().AssertSubtreeIsLaidOut();
3086 #endif 3101 #endif
3087 3102
3088 float device_scale_factor = blink::DeviceScaleFactorDeprecated( 3103 float device_scale_factor = blink::DeviceScaleFactorDeprecated(
3089 paint_info.paint_layer->GetLayoutObject().GetFrame()); 3104 paint_info.paint_layer->GetLayoutObject().GetFrame());
3090 context.SetDeviceScaleFactor(device_scale_factor); 3105 context.SetDeviceScaleFactor(device_scale_factor);
3091 3106
3107 HighContrastSettings high_contrast_settings =
3108 InitHighContrastSettingsFromSettings(
3109 GetLayoutObject().GetFrame()->GetSettings());
chrishtr 2017/06/05 16:35:18 Can GetSettings ever return nullptr? If not then p
dmazzoni 2017/06/06 05:23:24 Looks like there's no way it can return nullptr, s
3110 context.SetHighContrast(high_contrast_settings);
3111
3092 if (paint_info.paint_layer->GetCompositingState() != 3112 if (paint_info.paint_layer->GetCompositingState() !=
3093 kPaintsIntoGroupedBacking) { 3113 kPaintsIntoGroupedBacking) {
3094 // FIXME: GraphicsLayers need a way to split for multicol. 3114 // FIXME: GraphicsLayers need a way to split for multicol.
3095 PaintLayerPaintingInfo painting_info( 3115 PaintLayerPaintingInfo painting_info(
3096 paint_info.paint_layer, LayoutRect(dirty_rect), kGlobalPaintNormalPhase, 3116 paint_info.paint_layer, LayoutRect(dirty_rect), kGlobalPaintNormalPhase,
3097 paint_info.paint_layer->SubpixelAccumulation()); 3117 paint_info.paint_layer->SubpixelAccumulation());
3098 PaintLayerPainter(*paint_info.paint_layer) 3118 PaintLayerPainter(*paint_info.paint_layer)
3099 .PaintLayerContents(context, painting_info, paint_layer_flags); 3119 .PaintLayerContents(context, painting_info, paint_layer_flags);
3100 3120
3101 if (paint_info.paint_layer->ContainsDirtyOverlayScrollbars()) 3121 if (paint_info.paint_layer->ContainsDirtyOverlayScrollbars())
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after
3663 } else if (graphics_layer == decoration_outline_layer_.get()) { 3683 } else if (graphics_layer == decoration_outline_layer_.get()) {
3664 name = "Decoration Layer"; 3684 name = "Decoration Layer";
3665 } else { 3685 } else {
3666 NOTREACHED(); 3686 NOTREACHED();
3667 } 3687 }
3668 3688
3669 return name; 3689 return name;
3670 } 3690 }
3671 3691
3672 } // namespace blink 3692 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698