Commit 8fe77902 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Remove friend classes from CullRect in favor of a public Rect() method.

Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Iac377bceee1a0aab36e9d70c854f4e1d82dc4631
Reviewed-on: https://chromium-review.googlesource.com/1141216Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#576241}
parent e0ff10ea
...@@ -197,7 +197,7 @@ void WebPluginContainerImpl::Paint(GraphicsContext& context, ...@@ -197,7 +197,7 @@ void WebPluginContainerImpl::Paint(GraphicsContext& context,
cc::PaintCanvas* canvas = context.Canvas(); cc::PaintCanvas* canvas = context.Canvas();
IntRect window_rect = ParentFrameView().ConvertToRootFrame(cull_rect.rect_); IntRect window_rect = ParentFrameView().ConvertToRootFrame(cull_rect.Rect());
web_plugin_->Paint(canvas, window_rect); web_plugin_->Paint(canvas, window_rect);
context.Restore(); context.Restore();
......
...@@ -31,7 +31,7 @@ void FramePainter::Paint(GraphicsContext& context, ...@@ -31,7 +31,7 @@ void FramePainter::Paint(GraphicsContext& context,
GetFrameView().NotifyPageThatContentAreaWillPaint(); GetFrameView().NotifyPageThatContentAreaWillPaint();
IntRect document_dirty_rect(rect.rect_); IntRect document_dirty_rect(rect.Rect());
document_dirty_rect.Intersect(GetFrameView().FrameRect()); document_dirty_rect.Intersect(GetFrameView().FrameRect());
document_dirty_rect.MoveBy(-GetFrameView().Location()); document_dirty_rect.MoveBy(-GetFrameView().Location());
......
...@@ -48,7 +48,7 @@ void GridPainter::PaintChildren(const PaintInfo& paint_info, ...@@ -48,7 +48,7 @@ void GridPainter::PaintChildren(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) { const LayoutPoint& paint_offset) {
DCHECK(!layout_grid_.NeedsLayout()); DCHECK(!layout_grid_.NeedsLayout());
LayoutRect local_visual_rect = LayoutRect(paint_info.GetCullRect().rect_); LayoutRect local_visual_rect = LayoutRect(paint_info.GetCullRect().Rect());
local_visual_rect.MoveBy(-paint_offset); local_visual_rect.MoveBy(-paint_offset);
Vector<LayoutUnit> column_positions = layout_grid_.ColumnPositions(); Vector<LayoutUnit> column_positions = layout_grid_.ColumnPositions();
......
...@@ -177,7 +177,7 @@ bool SVGPaintContext::ApplyFilterIfNecessary(SVGResources* resources) { ...@@ -177,7 +177,7 @@ bool SVGPaintContext::ApplyFilterIfNecessary(SVGResources* resources) {
// Because we cache the filter contents and do not invalidate on paint // Because we cache the filter contents and do not invalidate on paint
// invalidation rect changes, we need to paint the entire filter region // invalidation rect changes, we need to paint the entire filter region
// so elements outside the initial paint (due to scrolling, etc) paint. // so elements outside the initial paint (due to scrolling, etc) paint.
filter_paint_info_->cull_rect_.rect_ = LayoutRect::InfiniteIntRect(); filter_paint_info_->cull_rect_ = CullRect(LayoutRect::InfiniteIntRect());
return true; return true;
} }
......
...@@ -247,7 +247,7 @@ void SVGShapePainter::PaintMarker(const PaintInfo& paint_info, ...@@ -247,7 +247,7 @@ void SVGShapePainter::PaintMarker(const PaintInfo& paint_info,
// It's expensive to track the transformed paint cull rect for each // It's expensive to track the transformed paint cull rect for each
// marker so just disable culling. The shape paint call will already // marker so just disable culling. The shape paint call will already
// be culled if it is outside the paint info cull rect. // be culled if it is outside the paint info cull rect.
marker_paint_info.cull_rect_.rect_ = LayoutRect::InfiniteIntRect(); marker_paint_info.cull_rect_ = CullRect(LayoutRect::InfiniteIntRect());
SVGContainerPainter(marker).Paint(marker_paint_info); SVGContainerPainter(marker).Paint(marker_paint_info);
builder.EndRecording(*canvas); builder.EndRecording(*canvas);
......
...@@ -107,6 +107,18 @@ void TableSectionPainter::PaintCollapsedBorders(const PaintInfo& paint_info) { ...@@ -107,6 +107,18 @@ void TableSectionPainter::PaintCollapsedBorders(const PaintInfo& paint_info) {
} }
} }
LayoutRect TableSectionPainter::TableAlignedRect(
const PaintInfo& paint_info,
const LayoutPoint& paint_offset) {
LayoutRect local_cull_rect = LayoutRect(paint_info.GetCullRect().Rect());
local_cull_rect.MoveBy(-paint_offset);
LayoutRect table_aligned_rect =
layout_table_section_.LogicalRectForWritingModeAndDirection(
local_cull_rect);
return table_aligned_rect;
}
void TableSectionPainter::PaintCollapsedSectionBorders( void TableSectionPainter::PaintCollapsedSectionBorders(
const PaintInfo& paint_info) { const PaintInfo& paint_info) {
if (!layout_table_section_.NumRows() || if (!layout_table_section_.NumRows() ||
...@@ -118,14 +130,6 @@ void TableSectionPainter::PaintCollapsedSectionBorders( ...@@ -118,14 +130,6 @@ void TableSectionPainter::PaintCollapsedSectionBorders(
auto paint_offset = adjustment.PaintOffset(); auto paint_offset = adjustment.PaintOffset();
BoxClipper box_clipper(layout_table_section_, local_paint_info); BoxClipper box_clipper(layout_table_section_, local_paint_info);
LayoutRect local_visual_rect =
LayoutRect(local_paint_info.GetCullRect().rect_);
local_visual_rect.MoveBy(-paint_offset);
LayoutRect table_aligned_rect =
layout_table_section_.LogicalRectForWritingModeAndDirection(
local_visual_rect);
CellSpan dirtied_rows; CellSpan dirtied_rows;
CellSpan dirtied_columns; CellSpan dirtied_columns;
if (UNLIKELY( if (UNLIKELY(
...@@ -135,7 +139,8 @@ void TableSectionPainter::PaintCollapsedSectionBorders( ...@@ -135,7 +139,8 @@ void TableSectionPainter::PaintCollapsedSectionBorders(
dirtied_columns = layout_table_section_.FullTableEffectiveColumnSpan(); dirtied_columns = layout_table_section_.FullTableEffectiveColumnSpan();
} else { } else {
layout_table_section_.DirtiedRowsAndEffectiveColumns( layout_table_section_.DirtiedRowsAndEffectiveColumns(
table_aligned_rect, dirtied_rows, dirtied_columns); TableAlignedRect(paint_info, paint_offset), dirtied_rows,
dirtied_columns);
} }
if (dirtied_columns.Start() >= dirtied_columns.End()) if (dirtied_columns.Start() >= dirtied_columns.End())
...@@ -153,17 +158,11 @@ void TableSectionPainter::PaintCollapsedSectionBorders( ...@@ -153,17 +158,11 @@ void TableSectionPainter::PaintCollapsedSectionBorders(
void TableSectionPainter::PaintObject(const PaintInfo& paint_info, void TableSectionPainter::PaintObject(const PaintInfo& paint_info,
const LayoutPoint& paint_offset) { const LayoutPoint& paint_offset) {
LayoutRect local_visual_rect = LayoutRect(paint_info.GetCullRect().rect_);
local_visual_rect.MoveBy(-paint_offset);
LayoutRect table_aligned_rect =
layout_table_section_.LogicalRectForWritingModeAndDirection(
local_visual_rect);
CellSpan dirtied_rows; CellSpan dirtied_rows;
CellSpan dirtied_columns; CellSpan dirtied_columns;
layout_table_section_.DirtiedRowsAndEffectiveColumns( layout_table_section_.DirtiedRowsAndEffectiveColumns(
table_aligned_rect, dirtied_rows, dirtied_columns); TableAlignedRect(paint_info, paint_offset), dirtied_rows,
dirtied_columns);
PaintInfo paint_info_for_descendants = paint_info.ForDescendants(); PaintInfo paint_info_for_descendants = paint_info.ForDescendants();
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "third_party/blink/renderer/core/paint/paint_phase.h" #include "third_party/blink/renderer/core/paint/paint_phase.h"
#include "third_party/blink/renderer/core/style/shadow_data.h" #include "third_party/blink/renderer/core/style/shadow_data.h"
#include "third_party/blink/renderer/platform/geometry/layout_rect.h"
#include "third_party/blink/renderer/platform/wtf/allocator.h" #include "third_party/blink/renderer/platform/wtf/allocator.h"
namespace blink { namespace blink {
...@@ -40,6 +41,9 @@ class TableSectionPainter { ...@@ -40,6 +41,9 @@ class TableSectionPainter {
void PaintSection(const PaintInfo&); void PaintSection(const PaintInfo&);
void PaintCollapsedSectionBorders(const PaintInfo&); void PaintCollapsedSectionBorders(const PaintInfo&);
LayoutRect TableAlignedRect(const PaintInfo& paint_info,
const LayoutPoint& paint_offset);
const LayoutTableSection& layout_table_section_; const LayoutTableSection& layout_table_section_;
}; };
......
...@@ -41,6 +41,8 @@ class PLATFORM_EXPORT CullRect { ...@@ -41,6 +41,8 @@ class PLATFORM_EXPORT CullRect {
const IntRect& overflow_clip_rect, const IntRect& overflow_clip_rect,
const AffineTransform& local_to_parent_transform); const AffineTransform& local_to_parent_transform);
const IntRect& Rect() const { return rect_; }
String ToString() const { return rect_.ToString(); } String ToString() const { return rect_.ToString(); }
private: private:
...@@ -50,18 +52,7 @@ class PLATFORM_EXPORT CullRect { ...@@ -50,18 +52,7 @@ class PLATFORM_EXPORT CullRect {
friend class CullRectTest; friend class CullRectTest;
// TODO(chrishtr): temporary while we implement CullRect everywhere.
friend class FramePainter;
friend class GridPainter;
friend class SVGForeignObjectPainter;
friend class SVGInlineTextBoxPainter;
friend class SVGPaintContext;
friend class SVGRootInlineBoxPainter;
friend class SVGShapePainter;
friend class TableRowPainter;
friend class TableSectionPainter; friend class TableSectionPainter;
friend class ThemePainterMac;
friend class WebPluginContainerImpl;
}; };
inline bool operator==(const CullRect& a, const CullRect& b) { inline bool operator==(const CullRect& a, const CullRect& b) {
......
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