Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
| 3 * reserved. | 3 * reserved. |
| 4 * | 4 * |
| 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 6 * | 6 * |
| 7 * Other contributors: | 7 * Other contributors: |
| 8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
| 10 * Christian Biesinger <cbiesinger@web.de> | 10 * Christian Biesinger <cbiesinger@web.de> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 } while (false); | 259 } while (false); |
| 260 #endif | 260 #endif |
| 261 | 261 |
| 262 void PaintLayerClipper::CalculateRectsWithGeometryMapper( | 262 void PaintLayerClipper::CalculateRectsWithGeometryMapper( |
| 263 const ClipRectsContext& context, | 263 const ClipRectsContext& context, |
| 264 const LayoutRect& paint_dirty_rect, | 264 const LayoutRect& paint_dirty_rect, |
| 265 LayoutRect& layer_bounds, | 265 LayoutRect& layer_bounds, |
| 266 ClipRect& background_rect, | 266 ClipRect& background_rect, |
| 267 ClipRect& foreground_rect, | 267 ClipRect& foreground_rect, |
| 268 const LayoutPoint* offset_from_root) const { | 268 const LayoutPoint* offset_from_root) const { |
| 269 LayoutPoint offset; | |
| 270 if (offset_from_root) | |
| 271 offset = *offset_from_root; | |
| 272 else | |
| 273 layer_.ConvertToLayerCoords(context.root_layer, offset); | |
| 274 layer_bounds = LayoutRect(offset, LayoutSize(layer_.size())); | |
| 275 | |
| 269 // TODO(chrishtr): fix the underlying bug that causes this situation. | 276 // TODO(chrishtr): fix the underlying bug that causes this situation. |
| 270 if (!layer_.GetLayoutObject().PaintProperties() && | 277 if (!layer_.GetLayoutObject().PaintProperties() && |
| 271 !layer_.GetLayoutObject().LocalBorderBoxProperties()) { | 278 !layer_.GetLayoutObject().LocalBorderBoxProperties()) { |
| 272 background_rect = ClipRect(LayoutRect(LayoutRect::InfiniteIntRect())); | 279 background_rect = ClipRect(LayoutRect(LayoutRect::InfiniteIntRect())); |
| 273 foreground_rect = ClipRect(LayoutRect(LayoutRect::InfiniteIntRect())); | 280 foreground_rect = ClipRect(LayoutRect(LayoutRect::InfiniteIntRect())); |
| 274 } else { | 281 } else { |
| 275 CalculateBackgroundClipRectWithGeometryMapper(context, background_rect); | 282 CalculateBackgroundClipRectWithGeometryMapper(context, background_rect); |
| 276 background_rect.Move(context.sub_pixel_accumulation); | 283 background_rect.Move(context.sub_pixel_accumulation); |
| 277 background_rect.Intersect(paint_dirty_rect); | 284 background_rect.Intersect(paint_dirty_rect); |
| 278 | 285 |
| 279 CalculateForegroundClipRectWithGeometryMapper(context, foreground_rect); | 286 foreground_rect = background_rect; |
| 280 foreground_rect.Move(context.sub_pixel_accumulation); | 287 LayoutBoxModelObject& layout_object = layer_.GetLayoutObject(); |
| 281 foreground_rect.Intersect(paint_dirty_rect); | 288 if (ShouldClipOverflow(context)) { |
| 289 LayoutRect overflow_and_clip_rect = | |
| 290 ToLayoutBox(layout_object) | |
| 291 .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
| |
| 292 foreground_rect.Intersect(overflow_and_clip_rect); | |
| 293 if (layout_object.StyleRef().HasBorderRadius()) | |
| 294 foreground_rect.SetHasRadius(true); | |
| 295 } | |
| 296 | |
| 297 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
| |
| 298 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.
| |
| 299 foreground_rect.Intersect(new_pos_clip); | |
| 300 } | |
| 282 } | 301 } |
| 283 | 302 |
| 284 LayoutPoint offset; | |
| 285 if (offset_from_root) | |
| 286 offset = *offset_from_root; | |
| 287 else | |
| 288 layer_.ConvertToLayerCoords(context.root_layer, offset); | |
| 289 layer_bounds = LayoutRect(offset, LayoutSize(layer_.size())); | |
| 290 | |
| 291 #ifdef CHECK_CLIP_RECTS | 303 #ifdef CHECK_CLIP_RECTS |
| 292 ClipRect testBackgroundRect, testForegroundRect; | 304 ClipRect testBackgroundRect, testForegroundRect; |
| 293 LayoutRect testLayerBounds; | 305 LayoutRect testLayerBounds; |
| 294 PaintLayerClipper(m_layer, nullptr) | 306 PaintLayerClipper(m_layer, nullptr) |
| 295 .calculateRects(context, paintDirtyRect, testLayerBounds, | 307 .calculateRects(context, paintDirtyRect, testLayerBounds, |
| 296 testBackgroundRect, testForegroundRect, offsetFromRoot); | 308 testBackgroundRect, testForegroundRect, offsetFromRoot); |
| 297 CHECK_RECTS_EQ(testBackgroundRect, backgroundRect); | 309 CHECK_RECTS_EQ(testBackgroundRect, backgroundRect); |
| 298 CHECK_RECTS_EQ(testForegroundRect, foregroundRect); | 310 CHECK_RECTS_EQ(testForegroundRect, foregroundRect); |
| 299 CHECK_RECTS_EQ(testLayerBounds, layerBounds); | 311 CHECK_RECTS_EQ(testLayerBounds, layerBounds); |
| 300 #endif | 312 #endif |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 632 DCHECK(!use_geometry_mapper_); | 644 DCHECK(!use_geometry_mapper_); |
| 633 ClipRectsContext context(root_layer, kPaintingClipRects, | 645 ClipRectsContext context(root_layer, kPaintingClipRects, |
| 634 kIgnorePlatformOverlayScrollbarSize, | 646 kIgnorePlatformOverlayScrollbarSize, |
| 635 subpixel_accumulation); | 647 subpixel_accumulation); |
| 636 if (respect_overflow_clip == kIgnoreOverflowClip) | 648 if (respect_overflow_clip == kIgnoreOverflowClip) |
| 637 context.SetIgnoreOverflowClip(); | 649 context.SetIgnoreOverflowClip(); |
| 638 return GetClipRects(context); | 650 return GetClipRects(context); |
| 639 } | 651 } |
| 640 | 652 |
| 641 } // namespace blink | 653 } // namespace blink |
| OLD | NEW |