Commit 3d21dce2 authored by Chris Harrelson's avatar Chris Harrelson Committed by Commit Bot

Revert "[PE] Reduce copies of LayoutRect in PaintLayerClipper."

This reverts commit 484efec4.

Reason for revert: Makes performance worse on the bots, not better.
Unclear why.

Original change's description:
> [PE] Reduce copies of LayoutRect in PaintLayerClipper.
> 
> Bug: 798378
> Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
> Change-Id: Ic3c0b29430b06e76a3c81e654bc780e4a969592d
> Reviewed-on: https://chromium-review.googlesource.com/880403
> Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
> Reviewed-by: Stephen Chenney <schenney@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#532031}

TBR=chrishtr@chromium.org,schenney@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 798378
Change-Id: I8c6ec640efffe8cd7e2adaacd2ecc47d469794bb
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Reviewed-on: https://chromium-review.googlesource.com/891559Reviewed-by: default avatarChris Harrelson <chrishtr@chromium.org>
Reviewed-by: default avatarStephen Chenney <schenney@chromium.org>
Commit-Queue: Chris Harrelson <chrishtr@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532548}
parent 5d05338c
...@@ -1931,24 +1931,12 @@ PaintInvalidationReason LayoutBox::InvalidatePaint( ...@@ -1931,24 +1931,12 @@ PaintInvalidationReason LayoutBox::InvalidatePaint(
LayoutRect LayoutBox::OverflowClipRect( LayoutRect LayoutBox::OverflowClipRect(
const LayoutPoint& location, const LayoutPoint& location,
OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior) const { OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior) const {
LayoutRect clip_rect; if (RootScrollerUtil::IsEffective(*this))
CalculateOverflowClipRect(location, overlay_scrollbar_clip_behavior, return View()->ViewRect();
clip_rect);
return clip_rect;
}
void LayoutBox::CalculateOverflowClipRect(
const LayoutPoint& location,
OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior,
LayoutRect& clip_rect) const {
if (RootScrollerUtil::IsEffective(*this)) {
clip_rect = View()->ViewRect();
return;
}
// FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the property
// here. // here.
clip_rect = BorderBoxRect(); LayoutRect clip_rect = BorderBoxRect();
clip_rect.SetLocation(location + clip_rect.Location() + clip_rect.SetLocation(location + clip_rect.Location() +
LayoutSize(BorderLeft(), BorderTop())); LayoutSize(BorderLeft(), BorderTop()));
clip_rect.SetSize(clip_rect.Size() - clip_rect.SetSize(clip_rect.Size() -
...@@ -1959,6 +1947,8 @@ void LayoutBox::CalculateOverflowClipRect( ...@@ -1959,6 +1947,8 @@ void LayoutBox::CalculateOverflowClipRect(
if (HasControlClip()) if (HasControlClip())
clip_rect.Intersect(ControlClipRect(location)); clip_rect.Intersect(ControlClipRect(location));
return clip_rect;
} }
void LayoutBox::ExcludeScrollbars( void LayoutBox::ExcludeScrollbars(
......
...@@ -1046,18 +1046,12 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject { ...@@ -1046,18 +1046,12 @@ class CORE_EXPORT LayoutBox : public LayoutBoxModelObject {
// control clips or contain: paint. // control clips or contain: paint.
virtual bool ShouldClipOverflow() const; virtual bool ShouldClipOverflow() const;
// Returns same value as ApplyOverflowClipRect sets on its third argument. // Returns the intersection of all overflow clips which apply.
LayoutRect OverflowClipRect( virtual LayoutRect OverflowClipRect(
const LayoutPoint& location, const LayoutPoint& location,
OverlayScrollbarClipBehavior = kIgnorePlatformOverlayScrollbarSize) const; OverlayScrollbarClipBehavior = kIgnorePlatformOverlayScrollbarSize) const;
LayoutRect ClipRect(const LayoutPoint& location) const; LayoutRect ClipRect(const LayoutPoint& location) const;
// Sets |clip_rect| to be equal to the bounds of the element, intersected
// with all overflow clips which aply.
virtual void CalculateOverflowClipRect(const LayoutPoint& location,
OverlayScrollbarClipBehavior,
LayoutRect& clip_rect) const;
// Returns the combination of overflow clip, contain: paint clip and CSS clip // Returns the combination of overflow clip, contain: paint clip and CSS clip
// for this object. // for this object.
LayoutRect ClippingRect(const LayoutPoint& location) const; LayoutRect ClippingRect(const LayoutPoint& location) const;
......
...@@ -1473,21 +1473,19 @@ LayoutUnit LayoutTable::FirstLineBoxBaseline() const { ...@@ -1473,21 +1473,19 @@ LayoutUnit LayoutTable::FirstLineBoxBaseline() const {
return LayoutUnit(-1); return LayoutUnit(-1);
} }
void LayoutTable::CalculateOverflowClipRect( LayoutRect LayoutTable::OverflowClipRect(
const LayoutPoint& location, const LayoutPoint& location,
OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior, OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior) const {
LayoutRect& rect) const {
if (ShouldCollapseBorders()) { if (ShouldCollapseBorders()) {
// Though the outer halves of the collapsed borders are considered as the // Though the outer halves of the collapsed borders are considered as the
// the border area of the table by means of the box model, they are actually // the border area of the table by means of the box model, they are actually
// contents of the table and should not be clipped off. The overflow clip // contents of the table and should not be clipped off. The overflow clip
// rect is BorderBoxRect() + location. // rect is BorderBoxRect() + location.
rect = LayoutRect(location, Size()); return LayoutRect(location, Size());
return;
} }
LayoutBlock::CalculateOverflowClipRect(location, LayoutRect rect =
overlay_scrollbar_clip_behavior, rect); LayoutBlock::OverflowClipRect(location, overlay_scrollbar_clip_behavior);
// If we have a caption, expand the clip to include the caption. // If we have a caption, expand the clip to include the caption.
// FIXME: Technically this is wrong, but it's virtually impossible to fix this // FIXME: Technically this is wrong, but it's virtually impossible to fix this
...@@ -1505,6 +1503,8 @@ void LayoutTable::CalculateOverflowClipRect( ...@@ -1505,6 +1503,8 @@ void LayoutTable::CalculateOverflowClipRect(
rect.SetX(location.X()); rect.SetX(location.X());
} }
} }
return rect;
} }
bool LayoutTable::NodeAtPoint(HitTestResult& result, bool LayoutTable::NodeAtPoint(HitTestResult& result,
......
...@@ -470,9 +470,10 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock { ...@@ -470,9 +470,10 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
LayoutUnit ConvertStyleLogicalHeightToComputedHeight( LayoutUnit ConvertStyleLogicalHeightToComputedHeight(
const Length& style_logical_height) const; const Length& style_logical_height) const;
void CalculateOverflowClipRect(const LayoutPoint& location, LayoutRect OverflowClipRect(
OverlayScrollbarClipBehavior, const LayoutPoint& location,
LayoutRect&) const override; OverlayScrollbarClipBehavior =
kIgnorePlatformOverlayScrollbarSize) const override;
void AddOverflowFromChildren() override; void AddOverflowFromChildren() override;
......
...@@ -624,20 +624,19 @@ LayoutRect LayoutView::ViewRect() const { ...@@ -624,20 +624,19 @@ LayoutRect LayoutView::ViewRect() const {
return LayoutRect(); return LayoutRect();
} }
void LayoutView::CalculateOverflowClipRect( LayoutRect LayoutView::OverflowClipRect(
const LayoutPoint& location, const LayoutPoint& location,
OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior, OverlayScrollbarClipBehavior overlay_scrollbar_clip_behavior) const {
LayoutRect& rect) const { LayoutRect rect = ViewRect();
rect = ViewRect(); if (rect.IsEmpty())
if (rect.IsEmpty()) { return LayoutBox::OverflowClipRect(location,
LayoutBox::CalculateOverflowClipRect(location, overlay_scrollbar_clip_behavior);
overlay_scrollbar_clip_behavior, rect);
return;
}
rect.SetLocation(location); rect.SetLocation(location);
if (HasOverflowClip()) if (HasOverflowClip())
ExcludeScrollbars(rect, overlay_scrollbar_clip_behavior); ExcludeScrollbars(rect, overlay_scrollbar_clip_behavior);
return rect;
} }
void LayoutView::CalculateScrollbarModes(ScrollbarMode& h_mode, void LayoutView::CalculateScrollbarModes(ScrollbarMode& h_mode,
......
...@@ -153,10 +153,10 @@ class CORE_EXPORT LayoutView final : public LayoutBlockFlow { ...@@ -153,10 +153,10 @@ class CORE_EXPORT LayoutView final : public LayoutBlockFlow {
MapCoordinatesFlags mode = 0) const override; MapCoordinatesFlags mode = 0) const override;
LayoutRect ViewRect() const override; LayoutRect ViewRect() const override;
LayoutRect OverflowClipRect(
void CalculateOverflowClipRect(const LayoutPoint& location, const LayoutPoint& location,
OverlayScrollbarClipBehavior, OverlayScrollbarClipBehavior =
LayoutRect&) const override; kIgnorePlatformOverlayScrollbarSize) const override;
void CalculateScrollbarModes(ScrollbarMode& h_mode, void CalculateScrollbarModes(ScrollbarMode& h_mode,
ScrollbarMode& v_mode) const; ScrollbarMode& v_mode) const;
......
...@@ -50,8 +50,6 @@ class ClipRect { ...@@ -50,8 +50,6 @@ class ClipRect {
has_radius_ = rect.HasRadius(); has_radius_ = rect.HasRadius();
} }
LayoutRect& MutableRect() { return rect_; }
const LayoutRect& Rect() const { return rect_; } const LayoutRect& Rect() const { return rect_; }
bool HasRadius() const { return has_radius_; } bool HasRadius() const { return has_radius_; }
......
...@@ -331,10 +331,10 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper( ...@@ -331,10 +331,10 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper(
if (ShouldClipOverflow(context)) { if (ShouldClipOverflow(context)) {
LayoutBoxModelObject& layout_object = layer_.GetLayoutObject(); LayoutBoxModelObject& layout_object = layer_.GetLayoutObject();
ToLayoutBox(layout_object) foreground_rect =
.CalculateOverflowClipRect(layer_bounds.Location(), ToLayoutBox(layout_object)
context.overlay_scrollbar_clip_behavior, .OverflowClipRect(layer_bounds.Location(),
foreground_rect.MutableRect()); context.overlay_scrollbar_clip_behavior);
if (layout_object.StyleRef().HasBorderRadius()) if (layout_object.StyleRef().HasBorderRadius())
foreground_rect.SetHasRadius(true); foreground_rect.SetHasRadius(true);
foreground_rect.Intersect(background_rect); foreground_rect.Intersect(background_rect);
......
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