| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/paint/FramePainter.h" | 5 #include "core/paint/FramePainter.h" |
| 6 | 6 |
| 7 #include "core/editing/markers/DocumentMarkerController.h" | 7 #include "core/editing/markers/DocumentMarkerController.h" |
| 8 #include "core/frame/FrameView.h" | 8 #include "core/frame/FrameView.h" |
| 9 #include "core/inspector/InspectorTraceEvents.h" | 9 #include "core/inspector/InspectorTraceEvents.h" |
| 10 #include "core/layout/LayoutView.h" | 10 #include "core/layout/LayoutView.h" |
| 11 #include "core/page/Page.h" | 11 #include "core/page/Page.h" |
| 12 #include "core/paint/FramePaintTiming.h" |
| 12 #include "core/paint/LayoutObjectDrawingRecorder.h" | 13 #include "core/paint/LayoutObjectDrawingRecorder.h" |
| 13 #include "core/paint/PaintInfo.h" | 14 #include "core/paint/PaintInfo.h" |
| 14 #include "core/paint/PaintLayer.h" | 15 #include "core/paint/PaintLayer.h" |
| 15 #include "core/paint/PaintLayerPainter.h" | 16 #include "core/paint/PaintLayerPainter.h" |
| 16 #include "core/paint/ScrollbarPainter.h" | 17 #include "core/paint/ScrollbarPainter.h" |
| 17 #include "core/paint/TransformRecorder.h" | 18 #include "core/paint/TransformRecorder.h" |
| 18 #include "core/probe/CoreProbes.h" | 19 #include "core/probe/CoreProbes.h" |
| 19 #include "platform/fonts/FontCache.h" | 20 #include "platform/fonts/FontCache.h" |
| 20 #include "platform/graphics/GraphicsContext.h" | 21 #include "platform/graphics/GraphicsContext.h" |
| 21 #include "platform/graphics/paint/ClipRecorder.h" | 22 #include "platform/graphics/paint/ClipRecorder.h" |
| 22 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" | 23 #include "platform/graphics/paint/ScopedPaintChunkProperties.h" |
| 23 #include "platform/loader/fetch/MemoryCache.h" | 24 #include "platform/loader/fetch/MemoryCache.h" |
| 24 #include "platform/scroll/ScrollbarTheme.h" | 25 #include "platform/scroll/ScrollbarTheme.h" |
| 25 | 26 |
| 26 namespace blink { | 27 namespace blink { |
| 27 | 28 |
| 28 bool FramePainter::in_paint_contents_ = false; | 29 bool FramePainter::in_paint_contents_ = false; |
| 29 | 30 |
| 30 void FramePainter::Paint(GraphicsContext& context, | 31 FramePainter::FramePainter(GraphicsContext& context, |
| 31 const GlobalPaintFlags global_paint_flags, | 32 const FrameView& frame_view) |
| 33 : context_(context), frame_view_(&frame_view) {} |
| 34 |
| 35 void FramePainter::Paint(const GlobalPaintFlags global_paint_flags, |
| 32 const CullRect& rect) { | 36 const CullRect& rect) { |
| 33 GetFrameView().NotifyPageThatContentAreaWillPaint(); | 37 GetFrameView().NotifyPageThatContentAreaWillPaint(); |
| 34 | 38 |
| 35 IntRect document_dirty_rect = rect.rect_; | 39 IntRect document_dirty_rect = rect.rect_; |
| 36 IntRect visible_area_without_scrollbars( | 40 IntRect visible_area_without_scrollbars( |
| 37 GetFrameView().Location(), GetFrameView().VisibleContentRect().Size()); | 41 GetFrameView().Location(), GetFrameView().VisibleContentRect().Size()); |
| 38 document_dirty_rect.Intersect(visible_area_without_scrollbars); | 42 document_dirty_rect.Intersect(visible_area_without_scrollbars); |
| 39 document_dirty_rect.MoveBy(-GetFrameView().Location() + | 43 document_dirty_rect.MoveBy(-GetFrameView().Location() + |
| 40 GetFrameView().ScrollOffsetInt()); | 44 GetFrameView().ScrollOffsetInt()); |
| 41 | 45 |
| 42 bool should_paint_contents = !document_dirty_rect.IsEmpty(); | 46 bool should_paint_contents = !document_dirty_rect.IsEmpty(); |
| 43 bool should_paint_scrollbars = !GetFrameView().ScrollbarsSuppressed() && | 47 bool should_paint_scrollbars = !GetFrameView().ScrollbarsSuppressed() && |
| 44 (GetFrameView().HorizontalScrollbar() || | 48 (GetFrameView().HorizontalScrollbar() || |
| 45 GetFrameView().VerticalScrollbar()); | 49 GetFrameView().VerticalScrollbar()); |
| 46 if (!should_paint_contents && !should_paint_scrollbars) | 50 if (!should_paint_contents && !should_paint_scrollbars) |
| 47 return; | 51 return; |
| 48 | 52 |
| 49 if (should_paint_contents) { | 53 if (should_paint_contents) { |
| 50 // TODO(pdr): Creating frame paint properties here will not be needed once | 54 // TODO(pdr): Creating frame paint properties here will not be needed once |
| 51 // settings()->rootLayerScrolls() is enabled. | 55 // settings()->rootLayerScrolls() is enabled. |
| 52 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. | 56 // TODO(pdr): Make this conditional on the rootLayerScrolls setting. |
| 53 Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; | 57 Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; |
| 54 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && | 58 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled() && |
| 55 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 59 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 56 if (const PropertyTreeState* contents_state = | 60 if (const PropertyTreeState* contents_state = |
| 57 frame_view_->TotalPropertyTreeStateForContents()) { | 61 frame_view_->TotalPropertyTreeStateForContents()) { |
| 58 PaintChunkProperties properties( | 62 PaintChunkProperties properties( |
| 59 context.GetPaintController().CurrentPaintChunkProperties()); | 63 context_.GetPaintController().CurrentPaintChunkProperties()); |
| 60 properties.property_tree_state = *contents_state; | 64 properties.property_tree_state = *contents_state; |
| 61 scoped_paint_chunk_properties.emplace(context.GetPaintController(), | 65 scoped_paint_chunk_properties.emplace(context_.GetPaintController(), |
| 62 *GetFrameView().GetLayoutView(), | 66 *GetFrameView().GetLayoutView(), |
| 63 properties); | 67 properties); |
| 64 } | 68 } |
| 65 } | 69 } |
| 66 | 70 |
| 67 TransformRecorder transform_recorder( | 71 TransformRecorder transform_recorder( |
| 68 context, *GetFrameView().GetLayoutView(), | 72 context_, *GetFrameView().GetLayoutView(), |
| 69 AffineTransform::Translation( | 73 AffineTransform::Translation( |
| 70 GetFrameView().X() - GetFrameView().ScrollX(), | 74 GetFrameView().X() - GetFrameView().ScrollX(), |
| 71 GetFrameView().Y() - GetFrameView().ScrollY())); | 75 GetFrameView().Y() - GetFrameView().ScrollY())); |
| 72 | 76 |
| 73 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { | 77 if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { |
| 74 PaintContents(context, global_paint_flags, document_dirty_rect); | 78 PaintContents(global_paint_flags, document_dirty_rect); |
| 75 } else { | 79 } else { |
| 76 ClipRecorder clip_recorder(context, *GetFrameView().GetLayoutView(), | 80 ClipRecorder clip_recorder(context_, *GetFrameView().GetLayoutView(), |
| 77 DisplayItem::kClipFrameToVisibleContentRect, | 81 DisplayItem::kClipFrameToVisibleContentRect, |
| 78 GetFrameView().VisibleContentRect()); | 82 GetFrameView().VisibleContentRect()); |
| 79 | 83 |
| 80 PaintContents(context, global_paint_flags, document_dirty_rect); | 84 PaintContents(global_paint_flags, document_dirty_rect); |
| 81 } | 85 } |
| 82 } | 86 } |
| 83 | 87 |
| 84 if (should_paint_scrollbars) { | 88 if (should_paint_scrollbars) { |
| 85 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); | 89 DCHECK(!RuntimeEnabledFeatures::rootLayerScrollingEnabled()); |
| 86 IntRect scroll_view_dirty_rect = rect.rect_; | 90 IntRect scroll_view_dirty_rect = rect.rect_; |
| 87 IntRect visible_area_with_scrollbars( | 91 IntRect visible_area_with_scrollbars( |
| 88 GetFrameView().Location(), | 92 GetFrameView().Location(), |
| 89 GetFrameView().VisibleContentRect(kIncludeScrollbars).Size()); | 93 GetFrameView().VisibleContentRect(kIncludeScrollbars).Size()); |
| 90 scroll_view_dirty_rect.Intersect(visible_area_with_scrollbars); | 94 scroll_view_dirty_rect.Intersect(visible_area_with_scrollbars); |
| 91 scroll_view_dirty_rect.MoveBy(-GetFrameView().Location()); | 95 scroll_view_dirty_rect.MoveBy(-GetFrameView().Location()); |
| 92 | 96 |
| 93 Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; | 97 Optional<ScopedPaintChunkProperties> scoped_paint_chunk_properties; |
| 94 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { | 98 if (RuntimeEnabledFeatures::slimmingPaintV2Enabled()) { |
| 95 if (const PropertyTreeState* contents_state = | 99 if (const PropertyTreeState* contents_state = |
| 96 frame_view_->TotalPropertyTreeStateForContents()) { | 100 frame_view_->TotalPropertyTreeStateForContents()) { |
| 97 // The scrollbar's property nodes are similar to the frame view's | 101 // The scrollbar's property nodes are similar to the frame view's |
| 98 // contents state but we want to exclude the content-specific | 102 // contents state but we want to exclude the content-specific |
| 99 // properties. This prevents the scrollbars from scrolling, for example. | 103 // properties. This prevents the scrollbars from scrolling, for example. |
| 100 PaintChunkProperties properties( | 104 PaintChunkProperties properties( |
| 101 context.GetPaintController().CurrentPaintChunkProperties()); | 105 context_.GetPaintController().CurrentPaintChunkProperties()); |
| 102 properties.property_tree_state.SetTransform( | 106 properties.property_tree_state.SetTransform( |
| 103 frame_view_->PreTranslation()); | 107 frame_view_->PreTranslation()); |
| 104 properties.property_tree_state.SetClip( | 108 properties.property_tree_state.SetClip( |
| 105 frame_view_->ContentClip()->Parent()); | 109 frame_view_->ContentClip()->Parent()); |
| 106 properties.property_tree_state.SetEffect(contents_state->Effect()); | 110 properties.property_tree_state.SetEffect(contents_state->Effect()); |
| 107 scoped_paint_chunk_properties.emplace(context.GetPaintController(), | 111 scoped_paint_chunk_properties.emplace(context_.GetPaintController(), |
| 108 *GetFrameView().GetLayoutView(), | 112 *GetFrameView().GetLayoutView(), |
| 109 properties); | 113 properties); |
| 110 } | 114 } |
| 111 } | 115 } |
| 112 | 116 |
| 113 TransformRecorder transform_recorder( | 117 TransformRecorder transform_recorder( |
| 114 context, *GetFrameView().GetLayoutView(), | 118 context_, *GetFrameView().GetLayoutView(), |
| 115 AffineTransform::Translation(GetFrameView().X(), GetFrameView().Y())); | 119 AffineTransform::Translation(GetFrameView().X(), GetFrameView().Y())); |
| 116 | 120 |
| 117 ClipRecorder recorder( | 121 ClipRecorder recorder( |
| 118 context, *GetFrameView().GetLayoutView(), | 122 context_, *GetFrameView().GetLayoutView(), |
| 119 DisplayItem::kClipFrameScrollbars, | 123 DisplayItem::kClipFrameScrollbars, |
| 120 IntRect(IntPoint(), visible_area_with_scrollbars.Size())); | 124 IntRect(IntPoint(), visible_area_with_scrollbars.Size())); |
| 121 | 125 |
| 122 PaintScrollbars(context, scroll_view_dirty_rect); | 126 PaintScrollbars(scroll_view_dirty_rect); |
| 123 } | 127 } |
| 124 } | 128 } |
| 125 | 129 |
| 126 void FramePainter::PaintContents(GraphicsContext& context, | 130 void FramePainter::PaintContents(const GlobalPaintFlags global_paint_flags, |
| 127 const GlobalPaintFlags global_paint_flags, | |
| 128 const IntRect& rect) { | 131 const IntRect& rect) { |
| 129 Document* document = GetFrameView().GetFrame().GetDocument(); | 132 Document* document = GetFrameView().GetFrame().GetDocument(); |
| 130 | 133 |
| 131 if (GetFrameView().ShouldThrottleRendering() || !document->IsActive()) | 134 if (GetFrameView().ShouldThrottleRendering() || !document->IsActive()) |
| 132 return; | 135 return; |
| 133 | 136 |
| 134 LayoutView* layout_view = GetFrameView().GetLayoutView(); | 137 LayoutView* layout_view = GetFrameView().GetLayoutView(); |
| 135 if (!layout_view) { | 138 if (!layout_view) { |
| 136 DLOG(ERROR) << "called FramePainter::paint with nil layoutObject"; | 139 DLOG(ERROR) << "called FramePainter::paint with nil layoutObject"; |
| 137 return; | 140 return; |
| 138 } | 141 } |
| 139 | 142 |
| 140 // TODO(crbug.com/590856): It's still broken when we choose not to crash when | 143 // TODO(crbug.com/590856): It's still broken when we choose not to crash when |
| 141 // the check fails. | 144 // the check fails. |
| 142 if (!GetFrameView().CheckDoesNotNeedLayout()) | 145 if (!GetFrameView().CheckDoesNotNeedLayout()) |
| 143 return; | 146 return; |
| 144 | 147 |
| 145 // TODO(wangxianzhu): The following check should be stricter, but currently | 148 // TODO(wangxianzhu): The following check should be stricter, but currently |
| 146 // this is blocked by the svg root issue (crbug.com/442939). | 149 // this is blocked by the svg root issue (crbug.com/442939). |
| 147 DCHECK(document->Lifecycle().GetState() >= | 150 DCHECK(document->Lifecycle().GetState() >= |
| 148 DocumentLifecycle::kCompositingClean); | 151 DocumentLifecycle::kCompositingClean); |
| 149 | 152 |
| 153 FramePaintTiming frame_paint_timing(context_, &GetFrameView().GetFrame()); |
| 150 TRACE_EVENT1("devtools.timeline,rail", "Paint", "data", | 154 TRACE_EVENT1("devtools.timeline,rail", "Paint", "data", |
| 151 InspectorPaintEvent::Data(layout_view, LayoutRect(rect), 0)); | 155 InspectorPaintEvent::Data(layout_view, LayoutRect(rect), 0)); |
| 152 | 156 |
| 153 bool is_top_level_painter = !in_paint_contents_; | 157 bool is_top_level_painter = !in_paint_contents_; |
| 154 in_paint_contents_ = true; | 158 in_paint_contents_ = true; |
| 155 | 159 |
| 156 FontCachePurgePreventer font_cache_purge_preventer; | 160 FontCachePurgePreventer font_cache_purge_preventer; |
| 157 | 161 |
| 158 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint | 162 // TODO(jchaffraix): GlobalPaintFlags should be const during a paint |
| 159 // phase. Thus we should set this flag upfront (crbug.com/510280). | 163 // phase. Thus we should set this flag upfront (crbug.com/510280). |
| 160 GlobalPaintFlags local_paint_flags = global_paint_flags; | 164 GlobalPaintFlags local_paint_flags = global_paint_flags; |
| 161 if (document->Printing()) | 165 if (document->Printing()) |
| 162 local_paint_flags |= | 166 local_paint_flags |= |
| 163 kGlobalPaintFlattenCompositingLayers | kGlobalPaintPrinting; | 167 kGlobalPaintFlattenCompositingLayers | kGlobalPaintPrinting; |
| 164 | 168 |
| 165 PaintLayer* root_layer = layout_view->Layer(); | 169 PaintLayer* root_layer = layout_view->Layer(); |
| 166 | 170 |
| 167 #if DCHECK_IS_ON() | 171 #if DCHECK_IS_ON() |
| 168 layout_view->AssertSubtreeIsLaidOut(); | 172 layout_view->AssertSubtreeIsLaidOut(); |
| 169 LayoutObject::SetLayoutNeededForbiddenScope forbid_set_needs_layout( | 173 LayoutObject::SetLayoutNeededForbiddenScope forbid_set_needs_layout( |
| 170 root_layer->GetLayoutObject()); | 174 root_layer->GetLayoutObject()); |
| 171 #endif | 175 #endif |
| 172 | 176 |
| 173 PaintLayerPainter layer_painter(*root_layer); | 177 PaintLayerPainter layer_painter(*root_layer); |
| 174 | 178 |
| 175 float device_scale_factor = blink::DeviceScaleFactorDeprecated( | 179 float device_scale_factor = blink::DeviceScaleFactorDeprecated( |
| 176 root_layer->GetLayoutObject().GetFrame()); | 180 root_layer->GetLayoutObject().GetFrame()); |
| 177 context.SetDeviceScaleFactor(device_scale_factor); | 181 context_.SetDeviceScaleFactor(device_scale_factor); |
| 178 | 182 |
| 179 layer_painter.Paint(context, LayoutRect(rect), local_paint_flags); | 183 layer_painter.Paint(context_, LayoutRect(rect), local_paint_flags); |
| 180 | 184 |
| 181 if (root_layer->ContainsDirtyOverlayScrollbars()) | 185 if (root_layer->ContainsDirtyOverlayScrollbars()) |
| 182 layer_painter.PaintOverlayScrollbars(context, LayoutRect(rect), | 186 layer_painter.PaintOverlayScrollbars(context_, LayoutRect(rect), |
| 183 local_paint_flags); | 187 local_paint_flags); |
| 184 | 188 |
| 185 // Regions may have changed as a result of the visibility/z-index of element | 189 // Regions may have changed as a result of the visibility/z-index of element |
| 186 // changing. | 190 // changing. |
| 187 if (document->AnnotatedRegionsDirty()) | 191 if (document->AnnotatedRegionsDirty()) |
| 188 GetFrameView().UpdateDocumentAnnotatedRegions(); | 192 GetFrameView().UpdateDocumentAnnotatedRegions(); |
| 189 | 193 |
| 190 if (is_top_level_painter) { | 194 if (is_top_level_painter) { |
| 191 // Everything that happens after paintContents completions is considered | 195 // Everything that happens after paintContents completions is considered |
| 192 // to be part of the next frame. | 196 // to be part of the next frame. |
| 193 GetMemoryCache()->UpdateFramePaintTimestamp(); | 197 GetMemoryCache()->UpdateFramePaintTimestamp(); |
| 194 in_paint_contents_ = false; | 198 in_paint_contents_ = false; |
| 195 } | 199 } |
| 196 | 200 |
| 197 probe::didPaint(layout_view->GetFrame(), 0, context, LayoutRect(rect)); | 201 probe::didPaint(layout_view->GetFrame(), 0, context_, LayoutRect(rect)); |
| 198 } | 202 } |
| 199 | 203 |
| 200 void FramePainter::PaintScrollbars(GraphicsContext& context, | 204 void FramePainter::PaintScrollbars(const IntRect& rect) { |
| 201 const IntRect& rect) { | |
| 202 if (GetFrameView().HorizontalScrollbar() && | 205 if (GetFrameView().HorizontalScrollbar() && |
| 203 !GetFrameView().LayerForHorizontalScrollbar()) | 206 !GetFrameView().LayerForHorizontalScrollbar()) |
| 204 PaintScrollbar(context, *GetFrameView().HorizontalScrollbar(), rect); | 207 PaintScrollbar(*GetFrameView().HorizontalScrollbar(), rect); |
| 205 if (GetFrameView().VerticalScrollbar() && | 208 if (GetFrameView().VerticalScrollbar() && |
| 206 !GetFrameView().LayerForVerticalScrollbar()) | 209 !GetFrameView().LayerForVerticalScrollbar()) |
| 207 PaintScrollbar(context, *GetFrameView().VerticalScrollbar(), rect); | 210 PaintScrollbar(*GetFrameView().VerticalScrollbar(), rect); |
| 208 | 211 |
| 209 if (GetFrameView().LayerForScrollCorner() || | 212 if (GetFrameView().LayerForScrollCorner() || |
| 210 !GetFrameView().IsScrollCornerVisible()) { | 213 !GetFrameView().IsScrollCornerVisible()) { |
| 211 return; | 214 return; |
| 212 } | 215 } |
| 213 | 216 |
| 214 PaintScrollCorner(context, GetFrameView().ScrollCornerRect()); | 217 PaintScrollCorner(GetFrameView().ScrollCornerRect()); |
| 215 } | 218 } |
| 216 | 219 |
| 217 void FramePainter::PaintScrollCorner(GraphicsContext& context, | 220 void FramePainter::PaintScrollCorner(const IntRect& corner_rect) { |
| 218 const IntRect& corner_rect) { | |
| 219 if (GetFrameView().ScrollCorner()) { | 221 if (GetFrameView().ScrollCorner()) { |
| 220 bool needs_background = GetFrameView().GetFrame().IsMainFrame(); | 222 bool needs_background = GetFrameView().GetFrame().IsMainFrame(); |
| 221 if (needs_background && | 223 if (needs_background && |
| 222 !LayoutObjectDrawingRecorder::UseCachedDrawingIfPossible( | 224 !LayoutObjectDrawingRecorder::UseCachedDrawingIfPossible( |
| 223 context, *GetFrameView().GetLayoutView(), | 225 context_, *GetFrameView().GetLayoutView(), |
| 224 DisplayItem::kScrollbarCorner)) { | 226 DisplayItem::kScrollbarCorner)) { |
| 225 LayoutObjectDrawingRecorder drawing_recorder( | 227 LayoutObjectDrawingRecorder drawing_recorder( |
| 226 context, *GetFrameView().GetLayoutView(), | 228 context_, *GetFrameView().GetLayoutView(), |
| 227 DisplayItem::kScrollbarCorner, FloatRect(corner_rect)); | 229 DisplayItem::kScrollbarCorner, FloatRect(corner_rect)); |
| 228 context.FillRect(corner_rect, GetFrameView().BaseBackgroundColor()); | 230 context_.FillRect(corner_rect, GetFrameView().BaseBackgroundColor()); |
| 229 } | 231 } |
| 230 ScrollbarPainter::PaintIntoRect(*GetFrameView().ScrollCorner(), context, | 232 ScrollbarPainter::PaintIntoRect(*GetFrameView().ScrollCorner(), context_, |
| 231 corner_rect.Location(), | 233 corner_rect.Location(), |
| 232 LayoutRect(corner_rect)); | 234 LayoutRect(corner_rect)); |
| 233 return; | 235 return; |
| 234 } | 236 } |
| 235 | 237 |
| 236 ScrollbarTheme* theme = nullptr; | 238 ScrollbarTheme* theme = nullptr; |
| 237 | 239 |
| 238 if (GetFrameView().HorizontalScrollbar()) { | 240 if (GetFrameView().HorizontalScrollbar()) { |
| 239 theme = &GetFrameView().HorizontalScrollbar()->GetTheme(); | 241 theme = &GetFrameView().HorizontalScrollbar()->GetTheme(); |
| 240 } else if (GetFrameView().VerticalScrollbar()) { | 242 } else if (GetFrameView().VerticalScrollbar()) { |
| 241 theme = &GetFrameView().VerticalScrollbar()->GetTheme(); | 243 theme = &GetFrameView().VerticalScrollbar()->GetTheme(); |
| 242 } else { | 244 } else { |
| 243 NOTREACHED(); | 245 NOTREACHED(); |
| 244 } | 246 } |
| 245 | 247 |
| 246 theme->PaintScrollCorner(context, *GetFrameView().GetLayoutView(), | 248 theme->PaintScrollCorner(context_, *GetFrameView().GetLayoutView(), |
| 247 corner_rect); | 249 corner_rect); |
| 248 } | 250 } |
| 249 | 251 |
| 250 void FramePainter::PaintScrollbar(GraphicsContext& context, | 252 void FramePainter::PaintScrollbar(Scrollbar& bar, const IntRect& rect) { |
| 251 Scrollbar& bar, | |
| 252 const IntRect& rect) { | |
| 253 bool needs_background = | 253 bool needs_background = |
| 254 bar.IsCustomScrollbar() && GetFrameView().GetFrame().IsMainFrame(); | 254 bar.IsCustomScrollbar() && GetFrameView().GetFrame().IsMainFrame(); |
| 255 if (needs_background) { | 255 if (needs_background) { |
| 256 IntRect to_fill = bar.FrameRect(); | 256 IntRect to_fill = bar.FrameRect(); |
| 257 to_fill.Intersect(rect); | 257 to_fill.Intersect(rect); |
| 258 context.FillRect(to_fill, GetFrameView().BaseBackgroundColor()); | 258 context_.FillRect(to_fill, GetFrameView().BaseBackgroundColor()); |
| 259 } | 259 } |
| 260 | 260 |
| 261 bar.Paint(context, CullRect(rect)); | 261 bar.Paint(context_, CullRect(rect)); |
| 262 } | 262 } |
| 263 | 263 |
| 264 const FrameView& FramePainter::GetFrameView() { | 264 const FrameView& FramePainter::GetFrameView() const { |
| 265 DCHECK(frame_view_); | 265 DCHECK(frame_view_); |
| 266 return *frame_view_; | 266 return *frame_view_; |
| 267 } | 267 } |
| 268 | 268 |
| 269 } // namespace blink | 269 } // namespace blink |
| OLD | NEW |