| Index: third_party/WebKit/Source/core/paint/FramePainter.cpp
|
| diff --git a/third_party/WebKit/Source/core/paint/FramePainter.cpp b/third_party/WebKit/Source/core/paint/FramePainter.cpp
|
| index dad69700113834beb63a0f3a560e64801972239d..fe2644ac3a59ec2d472b61f0a9076801114843da 100644
|
| --- a/third_party/WebKit/Source/core/paint/FramePainter.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/FramePainter.cpp
|
| @@ -9,6 +9,7 @@
|
| #include "core/inspector/InspectorTraceEvents.h"
|
| #include "core/layout/LayoutView.h"
|
| #include "core/page/Page.h"
|
| +#include "core/paint/FramePaintTiming.h"
|
| #include "core/paint/LayoutObjectDrawingRecorder.h"
|
| #include "core/paint/PaintInfo.h"
|
| #include "core/paint/PaintLayer.h"
|
| @@ -27,8 +28,11 @@ namespace blink {
|
|
|
| bool FramePainter::in_paint_contents_ = false;
|
|
|
| -void FramePainter::Paint(GraphicsContext& context,
|
| - const GlobalPaintFlags global_paint_flags,
|
| +FramePainter::FramePainter(GraphicsContext& context,
|
| + const FrameView& frame_view)
|
| + : context_(context), frame_view_(&frame_view) {}
|
| +
|
| +void FramePainter::Paint(const GlobalPaintFlags global_paint_flags,
|
| const CullRect& rect) {
|
| GetFrameView().NotifyPageThatContentAreaWillPaint();
|
|
|
| @@ -56,28 +60,28 @@ void FramePainter::Paint(GraphicsContext& context,
|
| if (const PropertyTreeState* contents_state =
|
| frame_view_->TotalPropertyTreeStateForContents()) {
|
| PaintChunkProperties properties(
|
| - context.GetPaintController().CurrentPaintChunkProperties());
|
| + context_.GetPaintController().CurrentPaintChunkProperties());
|
| properties.property_tree_state = *contents_state;
|
| - scoped_paint_chunk_properties.emplace(context.GetPaintController(),
|
| + scoped_paint_chunk_properties.emplace(context_.GetPaintController(),
|
| *GetFrameView().GetLayoutView(),
|
| properties);
|
| }
|
| }
|
|
|
| TransformRecorder transform_recorder(
|
| - context, *GetFrameView().GetLayoutView(),
|
| + context_, *GetFrameView().GetLayoutView(),
|
| AffineTransform::Translation(
|
| GetFrameView().X() - GetFrameView().ScrollX(),
|
| GetFrameView().Y() - GetFrameView().ScrollY()));
|
|
|
| if (RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
|
| - PaintContents(context, global_paint_flags, document_dirty_rect);
|
| + PaintContents(global_paint_flags, document_dirty_rect);
|
| } else {
|
| - ClipRecorder clip_recorder(context, *GetFrameView().GetLayoutView(),
|
| + ClipRecorder clip_recorder(context_, *GetFrameView().GetLayoutView(),
|
| DisplayItem::kClipFrameToVisibleContentRect,
|
| GetFrameView().VisibleContentRect());
|
|
|
| - PaintContents(context, global_paint_flags, document_dirty_rect);
|
| + PaintContents(global_paint_flags, document_dirty_rect);
|
| }
|
| }
|
|
|
| @@ -98,33 +102,32 @@ void FramePainter::Paint(GraphicsContext& context,
|
| // contents state but we want to exclude the content-specific
|
| // properties. This prevents the scrollbars from scrolling, for example.
|
| PaintChunkProperties properties(
|
| - context.GetPaintController().CurrentPaintChunkProperties());
|
| + context_.GetPaintController().CurrentPaintChunkProperties());
|
| properties.property_tree_state.SetTransform(
|
| frame_view_->PreTranslation());
|
| properties.property_tree_state.SetClip(
|
| frame_view_->ContentClip()->Parent());
|
| properties.property_tree_state.SetEffect(contents_state->Effect());
|
| - scoped_paint_chunk_properties.emplace(context.GetPaintController(),
|
| + scoped_paint_chunk_properties.emplace(context_.GetPaintController(),
|
| *GetFrameView().GetLayoutView(),
|
| properties);
|
| }
|
| }
|
|
|
| TransformRecorder transform_recorder(
|
| - context, *GetFrameView().GetLayoutView(),
|
| + context_, *GetFrameView().GetLayoutView(),
|
| AffineTransform::Translation(GetFrameView().X(), GetFrameView().Y()));
|
|
|
| ClipRecorder recorder(
|
| - context, *GetFrameView().GetLayoutView(),
|
| + context_, *GetFrameView().GetLayoutView(),
|
| DisplayItem::kClipFrameScrollbars,
|
| IntRect(IntPoint(), visible_area_with_scrollbars.Size()));
|
|
|
| - PaintScrollbars(context, scroll_view_dirty_rect);
|
| + PaintScrollbars(scroll_view_dirty_rect);
|
| }
|
| }
|
|
|
| -void FramePainter::PaintContents(GraphicsContext& context,
|
| - const GlobalPaintFlags global_paint_flags,
|
| +void FramePainter::PaintContents(const GlobalPaintFlags global_paint_flags,
|
| const IntRect& rect) {
|
| Document* document = GetFrameView().GetFrame().GetDocument();
|
|
|
| @@ -147,6 +150,7 @@ void FramePainter::PaintContents(GraphicsContext& context,
|
| DCHECK(document->Lifecycle().GetState() >=
|
| DocumentLifecycle::kCompositingClean);
|
|
|
| + FramePaintTiming frame_paint_timing(context_, &GetFrameView().GetFrame());
|
| TRACE_EVENT1("devtools.timeline,rail", "Paint", "data",
|
| InspectorPaintEvent::Data(layout_view, LayoutRect(rect), 0));
|
|
|
| @@ -174,12 +178,12 @@ void FramePainter::PaintContents(GraphicsContext& context,
|
|
|
| float device_scale_factor = blink::DeviceScaleFactorDeprecated(
|
| root_layer->GetLayoutObject().GetFrame());
|
| - context.SetDeviceScaleFactor(device_scale_factor);
|
| + context_.SetDeviceScaleFactor(device_scale_factor);
|
|
|
| - layer_painter.Paint(context, LayoutRect(rect), local_paint_flags);
|
| + layer_painter.Paint(context_, LayoutRect(rect), local_paint_flags);
|
|
|
| if (root_layer->ContainsDirtyOverlayScrollbars())
|
| - layer_painter.PaintOverlayScrollbars(context, LayoutRect(rect),
|
| + layer_painter.PaintOverlayScrollbars(context_, LayoutRect(rect),
|
| local_paint_flags);
|
|
|
| // Regions may have changed as a result of the visibility/z-index of element
|
| @@ -194,40 +198,38 @@ void FramePainter::PaintContents(GraphicsContext& context,
|
| in_paint_contents_ = false;
|
| }
|
|
|
| - probe::didPaint(layout_view->GetFrame(), 0, context, LayoutRect(rect));
|
| + probe::didPaint(layout_view->GetFrame(), 0, context_, LayoutRect(rect));
|
| }
|
|
|
| -void FramePainter::PaintScrollbars(GraphicsContext& context,
|
| - const IntRect& rect) {
|
| +void FramePainter::PaintScrollbars(const IntRect& rect) {
|
| if (GetFrameView().HorizontalScrollbar() &&
|
| !GetFrameView().LayerForHorizontalScrollbar())
|
| - PaintScrollbar(context, *GetFrameView().HorizontalScrollbar(), rect);
|
| + PaintScrollbar(*GetFrameView().HorizontalScrollbar(), rect);
|
| if (GetFrameView().VerticalScrollbar() &&
|
| !GetFrameView().LayerForVerticalScrollbar())
|
| - PaintScrollbar(context, *GetFrameView().VerticalScrollbar(), rect);
|
| + PaintScrollbar(*GetFrameView().VerticalScrollbar(), rect);
|
|
|
| if (GetFrameView().LayerForScrollCorner() ||
|
| !GetFrameView().IsScrollCornerVisible()) {
|
| return;
|
| }
|
|
|
| - PaintScrollCorner(context, GetFrameView().ScrollCornerRect());
|
| + PaintScrollCorner(GetFrameView().ScrollCornerRect());
|
| }
|
|
|
| -void FramePainter::PaintScrollCorner(GraphicsContext& context,
|
| - const IntRect& corner_rect) {
|
| +void FramePainter::PaintScrollCorner(const IntRect& corner_rect) {
|
| if (GetFrameView().ScrollCorner()) {
|
| bool needs_background = GetFrameView().GetFrame().IsMainFrame();
|
| if (needs_background &&
|
| !LayoutObjectDrawingRecorder::UseCachedDrawingIfPossible(
|
| - context, *GetFrameView().GetLayoutView(),
|
| + context_, *GetFrameView().GetLayoutView(),
|
| DisplayItem::kScrollbarCorner)) {
|
| LayoutObjectDrawingRecorder drawing_recorder(
|
| - context, *GetFrameView().GetLayoutView(),
|
| + context_, *GetFrameView().GetLayoutView(),
|
| DisplayItem::kScrollbarCorner, FloatRect(corner_rect));
|
| - context.FillRect(corner_rect, GetFrameView().BaseBackgroundColor());
|
| + context_.FillRect(corner_rect, GetFrameView().BaseBackgroundColor());
|
| }
|
| - ScrollbarPainter::PaintIntoRect(*GetFrameView().ScrollCorner(), context,
|
| + ScrollbarPainter::PaintIntoRect(*GetFrameView().ScrollCorner(), context_,
|
| corner_rect.Location(),
|
| LayoutRect(corner_rect));
|
| return;
|
| @@ -243,25 +245,23 @@ void FramePainter::PaintScrollCorner(GraphicsContext& context,
|
| NOTREACHED();
|
| }
|
|
|
| - theme->PaintScrollCorner(context, *GetFrameView().GetLayoutView(),
|
| + theme->PaintScrollCorner(context_, *GetFrameView().GetLayoutView(),
|
| corner_rect);
|
| }
|
|
|
| -void FramePainter::PaintScrollbar(GraphicsContext& context,
|
| - Scrollbar& bar,
|
| - const IntRect& rect) {
|
| +void FramePainter::PaintScrollbar(Scrollbar& bar, const IntRect& rect) {
|
| bool needs_background =
|
| bar.IsCustomScrollbar() && GetFrameView().GetFrame().IsMainFrame();
|
| if (needs_background) {
|
| IntRect to_fill = bar.FrameRect();
|
| to_fill.Intersect(rect);
|
| - context.FillRect(to_fill, GetFrameView().BaseBackgroundColor());
|
| + context_.FillRect(to_fill, GetFrameView().BaseBackgroundColor());
|
| }
|
|
|
| - bar.Paint(context, CullRect(rect));
|
| + bar.Paint(context_, CullRect(rect));
|
| }
|
|
|
| -const FrameView& FramePainter::GetFrameView() {
|
| +const FrameView& FramePainter::GetFrameView() const {
|
| DCHECK(frame_view_);
|
| return *frame_view_;
|
| }
|
|
|