Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(650)

Unified Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 2822653003: [SPInvalidation] Micro-optimize PaintLayerClipper::calculateRects (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
index 6aa997cb1f083039c7f65042cb7cfb7409366aa0..90c0a35dc0525451b968f6a51301cfee96d5e48b 100644
--- a/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
+++ b/third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp
@@ -266,6 +266,13 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper(
ClipRect& background_rect,
ClipRect& foreground_rect,
const LayoutPoint* offset_from_root) const {
+ LayoutPoint offset;
+ if (offset_from_root)
+ offset = *offset_from_root;
+ else
+ layer_.ConvertToLayerCoords(context.root_layer, offset);
+ layer_bounds = LayoutRect(offset, LayoutSize(layer_.size()));
+
// TODO(chrishtr): fix the underlying bug that causes this situation.
if (!layer_.GetLayoutObject().PaintProperties() &&
!layer_.GetLayoutObject().LocalBorderBoxProperties()) {
@@ -276,18 +283,23 @@ void PaintLayerClipper::CalculateRectsWithGeometryMapper(
background_rect.Move(context.sub_pixel_accumulation);
background_rect.Intersect(paint_dirty_rect);
- CalculateForegroundClipRectWithGeometryMapper(context, foreground_rect);
- foreground_rect.Move(context.sub_pixel_accumulation);
- foreground_rect.Intersect(paint_dirty_rect);
+ foreground_rect = background_rect;
+ LayoutBoxModelObject& layout_object = layer_.GetLayoutObject();
+ if (ShouldClipOverflow(context)) {
+ LayoutRect overflow_and_clip_rect =
+ ToLayoutBox(layout_object)
+ .OverflowClipRect(offset, context.overlay_scrollbar_clip_behavior);
trchen 2017/04/14 23:35:35 Should it be (offset + context.sub_pixel_accumulat
chrishtr 2017/04/14 23:51:56 Do you mean I should adjust OverflowClipRect() by
trchen 2017/04/15 00:09:51 Hmmmmm. That looks very weird indeed. The non-GM
+ foreground_rect.Intersect(overflow_and_clip_rect);
+ if (layout_object.StyleRef().HasBorderRadius())
+ foreground_rect.SetHasRadius(true);
+ }
+
+ if (layout_object.HasClip()) {
trchen 2017/04/14 23:35:35 nit: When constructed from bottom-up, apply CSS cl
chrishtr 2017/04/14 23:51:56 Done, except now it technically disagrees with non
+ LayoutRect new_pos_clip = ToLayoutBox(layout_object).ClipRect(offset);
trchen 2017/04/14 23:35:35 Ditto. (offset + context.sub_pixel_accumulation)?
chrishtr 2017/04/14 23:51:56 Same answer as above.
+ foreground_rect.Intersect(new_pos_clip);
+ }
}
- LayoutPoint offset;
- if (offset_from_root)
- offset = *offset_from_root;
- else
- layer_.ConvertToLayerCoords(context.root_layer, offset);
- layer_bounds = LayoutRect(offset, LayoutSize(layer_.size()));
-
#ifdef CHECK_CLIP_RECTS
ClipRect testBackgroundRect, testForegroundRect;
LayoutRect testLayerBounds;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698