OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
10 * | 10 * |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 // Page dimensions in pixels at 72 DPI. | 152 // Page dimensions in pixels at 72 DPI. |
153 constexpr int kA4PortraitPageWidth = 595; | 153 constexpr int kA4PortraitPageWidth = 595; |
154 constexpr int kA4PortraitPageHeight = 842; | 154 constexpr int kA4PortraitPageHeight = 842; |
155 constexpr int kLetterPortraitPageWidth = 612; | 155 constexpr int kLetterPortraitPageWidth = 612; |
156 constexpr int kLetterPortraitPageHeight = 792; | 156 constexpr int kLetterPortraitPageHeight = 792; |
157 | 157 |
158 } // namespace | 158 } // namespace |
159 | 159 |
160 namespace blink { | 160 namespace blink { |
161 | 161 |
| 162 namespace { |
| 163 |
| 164 HighContrastSettings InitHighContrastSettingsFromSettings(Settings* settings) { |
| 165 HighContrastSettings result; |
| 166 if (settings) { |
| 167 result.mode = settings->GetHighContrastMode(); |
| 168 result.grayscale = settings->GetHighContrastGrayscale(); |
| 169 result.contrast = settings->GetHighContrastContrast(); |
| 170 } else { |
| 171 result.mode = HighContrastMode::kOff; |
| 172 result.grayscale = false; |
| 173 result.contrast = 0.0; |
| 174 } |
| 175 return result; |
| 176 } |
| 177 |
| 178 } // namespace |
| 179 |
162 using namespace HTMLNames; | 180 using namespace HTMLNames; |
163 | 181 |
164 // The maximum number of updatePlugins iterations that should be done before | 182 // The maximum number of updatePlugins iterations that should be done before |
165 // returning. | 183 // returning. |
166 static const unsigned kMaxUpdatePluginsIterations = 2; | 184 static const unsigned kMaxUpdatePluginsIterations = 2; |
167 static const double kResourcePriorityUpdateDelayAfterScroll = 0.250; | 185 static const double kResourcePriorityUpdateDelayAfterScroll = 0.250; |
168 | 186 |
169 static bool g_initial_track_all_paint_invalidations = false; | 187 static bool g_initial_track_all_paint_invalidations = false; |
170 | 188 |
171 FrameView::FrameView(LocalFrame& frame, IntRect frame_rect) | 189 FrameView::FrameView(LocalFrame& frame, IntRect frame_rect) |
(...skipping 3087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3259 | 3277 |
3260 LayoutViewItem view = GetLayoutViewItem(); | 3278 LayoutViewItem view = GetLayoutViewItem(); |
3261 ASSERT(!view.IsNull()); | 3279 ASSERT(!view.IsNull()); |
3262 ForAllNonThrottledFrameViews([](FrameView& frame_view) { | 3280 ForAllNonThrottledFrameViews([](FrameView& frame_view) { |
3263 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint); | 3281 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kInPaint); |
3264 }); | 3282 }); |
3265 | 3283 |
3266 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 3284 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
3267 if (GetLayoutView()->Layer()->NeedsRepaint()) { | 3285 if (GetLayoutView()->Layer()->NeedsRepaint()) { |
3268 GraphicsContext graphics_context(*paint_controller_); | 3286 GraphicsContext graphics_context(*paint_controller_); |
| 3287 HighContrastSettings high_contrast_settings = |
| 3288 InitHighContrastSettingsFromSettings(frame_->GetSettings()); |
| 3289 graphics_context.SetHighContrast(high_contrast_settings); |
3269 if (RuntimeEnabledFeatures::printBrowserEnabled()) | 3290 if (RuntimeEnabledFeatures::printBrowserEnabled()) |
3270 graphics_context.SetPrinting(true); | 3291 graphics_context.SetPrinting(true); |
3271 Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect())); | 3292 Paint(graphics_context, CullRect(LayoutRect::InfiniteIntRect())); |
3272 paint_controller_->CommitNewDisplayItems(LayoutSize()); | 3293 paint_controller_->CommitNewDisplayItems(LayoutSize()); |
3273 NotifyPaint(*paint_controller_); | 3294 NotifyPaint(*paint_controller_); |
3274 } | 3295 } |
3275 } else { | 3296 } else { |
3276 // A null graphics layer can occur for painting of SVG images that are not | 3297 // A null graphics layer can occur for painting of SVG images that are not |
3277 // parented into the main frame tree, or when the FrameView is the main | 3298 // parented into the main frame tree, or when the FrameView is the main |
3278 // frame view of a page overlay. The page overlay is in the layer tree of | 3299 // frame view of a page overlay. The page overlay is in the layer tree of |
(...skipping 25 matching lines...) Expand all Loading... |
3304 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kPaintClean); | 3325 frame_view.Lifecycle().AdvanceTo(DocumentLifecycle::kPaintClean); |
3305 LayoutViewItem layout_view_item = frame_view.GetLayoutViewItem(); | 3326 LayoutViewItem layout_view_item = frame_view.GetLayoutViewItem(); |
3306 if (!layout_view_item.IsNull()) | 3327 if (!layout_view_item.IsNull()) |
3307 layout_view_item.Layer()->ClearNeedsRepaintRecursively(); | 3328 layout_view_item.Layer()->ClearNeedsRepaintRecursively(); |
3308 }); | 3329 }); |
3309 } | 3330 } |
3310 | 3331 |
3311 void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) { | 3332 void FrameView::PaintGraphicsLayerRecursively(GraphicsLayer* graphics_layer) { |
3312 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); | 3333 DCHECK(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); |
3313 if (graphics_layer->DrawsContent()) { | 3334 if (graphics_layer->DrawsContent()) { |
3314 graphics_layer->Paint(nullptr); | 3335 HighContrastSettings high_contrast_settings = |
| 3336 InitHighContrastSettingsFromSettings(frame_->GetSettings()); |
| 3337 graphics_layer->Paint(nullptr, &high_contrast_settings); |
3315 NotifyPaint(graphics_layer->GetPaintController()); | 3338 NotifyPaint(graphics_layer->GetPaintController()); |
3316 } | 3339 } |
3317 | 3340 |
3318 if (GraphicsLayer* mask_layer = graphics_layer->MaskLayer()) | 3341 if (GraphicsLayer* mask_layer = graphics_layer->MaskLayer()) |
3319 PaintGraphicsLayerRecursively(mask_layer); | 3342 PaintGraphicsLayerRecursively(mask_layer); |
3320 if (GraphicsLayer* contents_clipping_mask_layer = | 3343 if (GraphicsLayer* contents_clipping_mask_layer = |
3321 graphics_layer->ContentsClippingMaskLayer()) | 3344 graphics_layer->ContentsClippingMaskLayer()) |
3322 PaintGraphicsLayerRecursively(contents_clipping_mask_layer); | 3345 PaintGraphicsLayerRecursively(contents_clipping_mask_layer); |
3323 | 3346 |
3324 for (auto& child : graphics_layer->Children()) | 3347 for (auto& child : graphics_layer->Children()) |
(...skipping 2058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5383 void FrameView::SetAnimationHost( | 5406 void FrameView::SetAnimationHost( |
5384 std::unique_ptr<CompositorAnimationHost> host) { | 5407 std::unique_ptr<CompositorAnimationHost> host) { |
5385 animation_host_ = std::move(host); | 5408 animation_host_ = std::move(host); |
5386 } | 5409 } |
5387 | 5410 |
5388 LayoutUnit FrameView::CaretWidth() const { | 5411 LayoutUnit FrameView::CaretWidth() const { |
5389 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); | 5412 return LayoutUnit(GetChromeClient()->WindowToViewportScalar(1)); |
5390 } | 5413 } |
5391 | 5414 |
5392 } // namespace blink | 5415 } // namespace blink |
OLD | NEW |