Commit a846bb47 authored by Philip Rogers's avatar Philip Rogers Committed by Commit Bot

[RLS] Remove scrollbar painting from FramePainter

This is all dead code.

Bug: 823365
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: I2b7e8281099435dc937ddf5f8e2e77749c5cbad7
Reviewed-on: https://chromium-review.googlesource.com/1103779Reviewed-by: default avatarSteve Kobes <skobes@chromium.org>
Commit-Queue: Philip Rogers <pdr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#568252}
parent 6cbeff65
......@@ -4,26 +4,20 @@
#include "third_party/blink/renderer/core/paint/frame_painter.h"
#include "third_party/blink/renderer/core/editing/markers/document_marker_controller.h"
#include "third_party/blink/renderer/core/frame/local_frame_view.h"
#include "third_party/blink/renderer/core/inspector/inspector_trace_events.h"
#include "third_party/blink/renderer/core/layout/layout_scrollbar_part.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/page/page.h"
#include "third_party/blink/renderer/core/paint/frame_paint_timing.h"
#include "third_party/blink/renderer/core/paint/paint_info.h"
#include "third_party/blink/renderer/core/paint/paint_layer.h"
#include "third_party/blink/renderer/core/paint/paint_layer_painter.h"
#include "third_party/blink/renderer/core/paint/scrollbar_painter.h"
#include "third_party/blink/renderer/core/paint/transform_recorder.h"
#include "third_party/blink/renderer/core/probe/core_probes.h"
#include "third_party/blink/renderer/platform/fonts/font_cache.h"
#include "third_party/blink/renderer/platform/graphics/graphics_context.h"
#include "third_party/blink/renderer/platform/graphics/graphics_layer.h"
#include "third_party/blink/renderer/platform/graphics/paint/clip_recorder.h"
#include "third_party/blink/renderer/platform/graphics/paint/drawing_recorder.h"
#include "third_party/blink/renderer/platform/graphics/paint/cull_rect.h"
#include "third_party/blink/renderer/platform/loader/fetch/memory_cache.h"
#include "third_party/blink/renderer/platform/scroll/scrollbar_theme.h"
namespace blink {
......@@ -47,25 +41,19 @@ void FramePainter::Paint(GraphicsContext& context,
document_dirty_rect.Intersect(visible_area_without_scrollbars);
document_dirty_rect.MoveBy(content_offset);
bool should_paint_contents = !document_dirty_rect.IsEmpty();
bool should_paint_scrollbars = !GetFrameView().ScrollbarsSuppressed() &&
(GetFrameView().HorizontalScrollbar() ||
GetFrameView().VerticalScrollbar());
if (!should_paint_contents && !should_paint_scrollbars)
if (document_dirty_rect.IsEmpty())
return;
if (should_paint_contents) {
TransformRecorder transform_recorder(
context, *GetFrameView().GetLayoutView(),
AffineTransform::Translation(
frame_view_location.X() - GetFrameView().ScrollX(),
frame_view_location.Y() - GetFrameView().ScrollY()));
ClipRecorder clip_recorder(context, *GetFrameView().GetLayoutView(),
DisplayItem::kClipFrameToVisibleContentRect,
GetFrameView().VisibleContentRect());
PaintContents(context, global_paint_flags, document_dirty_rect);
}
TransformRecorder transform_recorder(
context, *GetFrameView().GetLayoutView(),
AffineTransform::Translation(
frame_view_location.X() - GetFrameView().ScrollX(),
frame_view_location.Y() - GetFrameView().ScrollY()));
ClipRecorder clip_recorder(context, *GetFrameView().GetLayoutView(),
DisplayItem::kClipFrameToVisibleContentRect,
GetFrameView().VisibleContentRect());
PaintContents(context, global_paint_flags, document_dirty_rect);
}
void FramePainter::PaintContents(GraphicsContext& context,
......@@ -151,75 +139,6 @@ void FramePainter::PaintContents(GraphicsContext& context,
probe::didPaint(layout_view->GetFrame(), nullptr, context, LayoutRect(rect));
}
void FramePainter::PaintScrollbars(GraphicsContext& context,
const IntRect& rect) {
if (GetFrameView().HorizontalScrollbar() &&
!GetFrameView().LayerForHorizontalScrollbar())
PaintScrollbar(context, *GetFrameView().HorizontalScrollbar(), rect);
if (GetFrameView().VerticalScrollbar() &&
!GetFrameView().LayerForVerticalScrollbar())
PaintScrollbar(context, *GetFrameView().VerticalScrollbar(), rect);
if (!GetFrameView().LayerForScrollCorner() &&
GetFrameView().IsScrollCornerVisible())
PaintScrollCorner(context, GetFrameView().ScrollCornerRect());
}
void FramePainter::PaintScrollCorner(GraphicsContext& context,
const IntRect& corner_rect) {
if (const auto* scroll_corner = GetFrameView().ScrollCorner()) {
bool needs_background = GetFrameView().GetFrame().IsMainFrame();
if (needs_background &&
!DrawingRecorder::UseCachedDrawingIfPossible(
context, *scroll_corner, DisplayItem::kScrollbarBackground)) {
DrawingRecorder recorder(context, *scroll_corner,
DisplayItem::kScrollbarBackground);
context.FillRect(corner_rect, GetFrameView().BaseBackgroundColor());
}
ScrollbarPainter::PaintIntoRect(*scroll_corner, context,
corner_rect.Location(),
LayoutRect(corner_rect));
return;
}
ScrollbarTheme* theme = nullptr;
if (GetFrameView().HorizontalScrollbar()) {
theme = &GetFrameView().HorizontalScrollbar()->GetTheme();
} else if (GetFrameView().VerticalScrollbar()) {
theme = &GetFrameView().VerticalScrollbar()->GetTheme();
} else {
NOTREACHED();
}
const DisplayItemClient* client;
if (auto* graphics_layer = GetFrameView().LayerForScrollCorner())
client = graphics_layer;
else
client = GetFrameView().GetLayoutView();
theme->PaintScrollCorner(context, *client, corner_rect);
}
void FramePainter::PaintScrollbar(GraphicsContext& context,
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);
if (!to_fill.IsEmpty() &&
!DrawingRecorder::UseCachedDrawingIfPossible(
context, bar, DisplayItem::kScrollbarBackground)) {
DrawingRecorder recorder(context, bar, DisplayItem::kScrollbarBackground);
context.FillRect(to_fill, GetFrameView().BaseBackgroundColor());
}
}
bar.Paint(context, CullRect(rect));
}
const LocalFrameView& FramePainter::GetFrameView() {
DCHECK(frame_view_);
return *frame_view_;
......
......@@ -15,7 +15,6 @@ class CullRect;
class GraphicsContext;
class IntRect;
class LocalFrameView;
class Scrollbar;
class FramePainter {
STACK_ALLOCATED();
......@@ -25,13 +24,9 @@ class FramePainter {
: frame_view_(&frame_view) {}
void Paint(GraphicsContext&, const GlobalPaintFlags, const CullRect&);
void PaintScrollbars(GraphicsContext&, const IntRect&);
void PaintContents(GraphicsContext&, const GlobalPaintFlags, const IntRect&);
void PaintScrollCorner(GraphicsContext&, const IntRect& corner_rect);
private:
void PaintScrollbar(GraphicsContext&, Scrollbar&, const IntRect&);
const LocalFrameView& GetFrameView();
Member<const LocalFrameView> frame_view_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment