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

Side by Side Diff: third_party/WebKit/Source/core/paint/PaintLayerClipper.cpp

Issue 2692853016: Change PaintLayer::m_layoutObject to a reference. (Closed)
Patch Set: Added TODO Created 3 years, 10 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 unified diff | Download patch
OLDNEW
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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 static void applyClipRects(const ClipRectsContext& context, 72 static void applyClipRects(const ClipRectsContext& context,
73 const LayoutBoxModelObject& layoutObject, 73 const LayoutBoxModelObject& layoutObject,
74 LayoutPoint offset, 74 LayoutPoint offset,
75 ClipRects& clipRects) { 75 ClipRects& clipRects) {
76 DCHECK(layoutObject.isBox()); 76 DCHECK(layoutObject.isBox());
77 const LayoutBox& box = *toLayoutBox(&layoutObject); 77 const LayoutBox& box = *toLayoutBox(&layoutObject);
78 78
79 DCHECK(box.shouldClipOverflow() || box.hasClip()); 79 DCHECK(box.shouldClipOverflow() || box.hasClip());
80 LayoutView* view = box.view(); 80 LayoutView* view = box.view();
81 DCHECK(view); 81 DCHECK(view);
82 if (clipRects.fixed() && context.rootLayer->layoutObject() == view) 82 if (clipRects.fixed() && &context.rootLayer->layoutObject() == view)
83 offset -= LayoutSize(view->frameView()->getScrollOffset()); 83 offset -= LayoutSize(view->frameView()->getScrollOffset());
84 84
85 if (box.shouldClipOverflow()) { 85 if (box.shouldClipOverflow()) {
86 ClipRect newOverflowClip = 86 ClipRect newOverflowClip =
87 box.overflowClipRect(offset, context.overlayScrollbarClipBehavior); 87 box.overflowClipRect(offset, context.overlayScrollbarClipBehavior);
88 newOverflowClip.setHasRadius(box.styleRef().hasBorderRadius()); 88 newOverflowClip.setHasRadius(box.styleRef().hasBorderRadius());
89 clipRects.setOverflowClipRect( 89 clipRects.setOverflowClipRect(
90 intersection(newOverflowClip, clipRects.overflowClipRect())); 90 intersection(newOverflowClip, clipRects.overflowClipRect()));
91 if (box.isPositioned()) 91 if (box.isPositioned())
92 clipRects.setPosClipRect( 92 clipRects.setPosClipRect(
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 LayoutRect PaintLayerClipper::localClipRect( 202 LayoutRect PaintLayerClipper::localClipRect(
203 const PaintLayer& clippingRootLayer) const { 203 const PaintLayer& clippingRootLayer) const {
204 ClipRectsContext context(&clippingRootLayer, PaintingClipRects); 204 ClipRectsContext context(&clippingRootLayer, PaintingClipRects);
205 if (m_geometryMapper) { 205 if (m_geometryMapper) {
206 ClipRect clipRect = clipRectWithGeometryMapper(context, false); 206 ClipRect clipRect = clipRectWithGeometryMapper(context, false);
207 applyOverflowClipToBackgroundRectWithGeometryMapper(context, clipRect); 207 applyOverflowClipToBackgroundRectWithGeometryMapper(context, clipRect);
208 LayoutRect premappedRect = clipRect.rect(); 208 LayoutRect premappedRect = clipRect.rect();
209 209
210 // The rect now needs to be transformed to the local space of this 210 // The rect now needs to be transformed to the local space of this
211 // PaintLayer. 211 // PaintLayer.
212 premappedRect.moveBy(context.rootLayer->layoutObject()->paintOffset()); 212 premappedRect.moveBy(context.rootLayer->layoutObject().paintOffset());
213 213
214 const auto* clipRootLayerTransform = clippingRootLayer.layoutObject() 214 const auto* clipRootLayerTransform = clippingRootLayer.layoutObject()
215 ->paintProperties() 215 .paintProperties()
216 ->localBorderBoxProperties() 216 ->localBorderBoxProperties()
217 ->transform(); 217 ->transform();
218 const auto* layerTransform = m_layer.layoutObject() 218 const auto* layerTransform = m_layer.layoutObject()
219 ->paintProperties() 219 .paintProperties()
220 ->localBorderBoxProperties() 220 ->localBorderBoxProperties()
221 ->transform(); 221 ->transform();
222 FloatRect clippedRectInLocalSpace = 222 FloatRect clippedRectInLocalSpace =
223 m_geometryMapper->sourceToDestinationRect( 223 m_geometryMapper->sourceToDestinationRect(
224 FloatRect(premappedRect), clipRootLayerTransform, layerTransform); 224 FloatRect(premappedRect), clipRootLayerTransform, layerTransform);
225 clippedRectInLocalSpace.moveBy( 225 clippedRectInLocalSpace.moveBy(
226 -FloatPoint(m_layer.layoutObject()->paintOffset())); 226 -FloatPoint(m_layer.layoutObject().paintOffset()));
227 227
228 return LayoutRect(clippedRectInLocalSpace); 228 return LayoutRect(clippedRectInLocalSpace);
229 } 229 }
230 230
231 LayoutRect layerBounds; 231 LayoutRect layerBounds;
232 ClipRect backgroundRect, foregroundRect; 232 ClipRect backgroundRect, foregroundRect;
233 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()), 233 calculateRects(context, LayoutRect(LayoutRect::infiniteIntRect()),
234 layerBounds, backgroundRect, foregroundRect); 234 layerBounds, backgroundRect, foregroundRect);
235 235
236 LayoutRect clipRect = backgroundRect.rect(); 236 LayoutRect clipRect = backgroundRect.rect();
(...skipping 21 matching lines...) Expand all
258 } \ 258 } \
259 } while (false); 259 } while (false);
260 #endif 260 #endif
261 261
262 void PaintLayerClipper::mapLocalToRootWithGeometryMapper( 262 void PaintLayerClipper::mapLocalToRootWithGeometryMapper(
263 const ClipRectsContext& context, 263 const ClipRectsContext& context,
264 LayoutRect& rectToMap) const { 264 LayoutRect& rectToMap) const {
265 DCHECK(m_geometryMapper); 265 DCHECK(m_geometryMapper);
266 266
267 const auto* layerTransform = m_layer.layoutObject() 267 const auto* layerTransform = m_layer.layoutObject()
268 ->paintProperties() 268 .paintProperties()
269 ->localBorderBoxProperties() 269 ->localBorderBoxProperties()
270 ->transform(); 270 ->transform();
271 const auto* rootTransform = context.rootLayer->layoutObject() 271 const auto* rootTransform = context.rootLayer->layoutObject()
272 ->paintProperties() 272 .paintProperties()
273 ->localBorderBoxProperties() 273 ->localBorderBoxProperties()
274 ->transform(); 274 ->transform();
275 275
276 FloatRect localRect(rectToMap); 276 FloatRect localRect(rectToMap);
277 localRect.moveBy(FloatPoint(m_layer.layoutObject()->paintOffset())); 277 localRect.moveBy(FloatPoint(m_layer.layoutObject().paintOffset()));
278 rectToMap = LayoutRect(m_geometryMapper->sourceToDestinationRect( 278 rectToMap = LayoutRect(m_geometryMapper->sourceToDestinationRect(
279 localRect, layerTransform, rootTransform)); 279 localRect, layerTransform, rootTransform));
280 rectToMap.moveBy(-context.rootLayer->layoutObject()->paintOffset()); 280 rectToMap.moveBy(-context.rootLayer->layoutObject().paintOffset());
281 rectToMap.move(context.subPixelAccumulation); 281 rectToMap.move(context.subPixelAccumulation);
282 } 282 }
283 283
284 void PaintLayerClipper::calculateRectsWithGeometryMapper( 284 void PaintLayerClipper::calculateRectsWithGeometryMapper(
285 const ClipRectsContext& context, 285 const ClipRectsContext& context,
286 const LayoutRect& paintDirtyRect, 286 const LayoutRect& paintDirtyRect,
287 LayoutRect& layerBounds, 287 LayoutRect& layerBounds,
288 ClipRect& backgroundRect, 288 ClipRect& backgroundRect,
289 ClipRect& foregroundRect, 289 ClipRect& foregroundRect,
290 const LayoutPoint* offsetFromRoot) const { 290 const LayoutPoint* offsetFromRoot) const {
291 const auto* properties = m_layer.layoutObject()->paintProperties(); 291 const auto* properties = m_layer.layoutObject().paintProperties();
292 // TODO(chrishtr): fix the underlying bug that causes this situation. 292 // TODO(chrishtr): fix the underlying bug that causes this situation.
293 if (!properties) { 293 if (!properties) {
294 backgroundRect = ClipRect(LayoutRect(LayoutRect::infiniteIntRect())); 294 backgroundRect = ClipRect(LayoutRect(LayoutRect::infiniteIntRect()));
295 foregroundRect = ClipRect(LayoutRect(LayoutRect::infiniteIntRect())); 295 foregroundRect = ClipRect(LayoutRect(LayoutRect::infiniteIntRect()));
296 } else { 296 } else {
297 backgroundRect = clipRectWithGeometryMapper(context, false); 297 backgroundRect = clipRectWithGeometryMapper(context, false);
298 298
299 backgroundRect.move(context.subPixelAccumulation); 299 backgroundRect.move(context.subPixelAccumulation);
300 backgroundRect.intersect(paintDirtyRect); 300 backgroundRect.intersect(paintDirtyRect);
301 301
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 ClipRect& foregroundRect, 333 ClipRect& foregroundRect,
334 const LayoutPoint* offsetFromRoot) const { 334 const LayoutPoint* offsetFromRoot) const {
335 if (m_geometryMapper) { 335 if (m_geometryMapper) {
336 calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds, 336 calculateRectsWithGeometryMapper(context, paintDirtyRect, layerBounds,
337 backgroundRect, foregroundRect, 337 backgroundRect, foregroundRect,
338 offsetFromRoot); 338 offsetFromRoot);
339 return; 339 return;
340 } 340 }
341 341
342 bool isClippingRoot = &m_layer == context.rootLayer; 342 bool isClippingRoot = &m_layer == context.rootLayer;
343 LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); 343 LayoutBoxModelObject& layoutObject = m_layer.layoutObject();
344 344
345 if (!isClippingRoot && m_layer.parent()) { 345 if (!isClippingRoot && m_layer.parent()) {
346 backgroundRect = backgroundClipRect(context); 346 backgroundRect = backgroundClipRect(context);
347 backgroundRect.move(context.subPixelAccumulation); 347 backgroundRect.move(context.subPixelAccumulation);
348 backgroundRect.intersect(paintDirtyRect); 348 backgroundRect.intersect(paintDirtyRect);
349 } else { 349 } else {
350 backgroundRect = paintDirtyRect; 350 backgroundRect = paintDirtyRect;
351 } 351 }
352 352
353 foregroundRect = backgroundRect; 353 foregroundRect = backgroundRect;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 if (layoutObject.hasClip()) { 389 if (layoutObject.hasClip()) {
390 // Clip applies to *us* as well, so go ahead and update the damageRect. 390 // Clip applies to *us* as well, so go ahead and update the damageRect.
391 LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset); 391 LayoutRect newPosClip = toLayoutBox(layoutObject).clipRect(offset);
392 backgroundRect.intersect(newPosClip); 392 backgroundRect.intersect(newPosClip);
393 foregroundRect.intersect(newPosClip); 393 foregroundRect.intersect(newPosClip);
394 } 394 }
395 } 395 }
396 396
397 void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context, 397 void PaintLayerClipper::calculateClipRects(const ClipRectsContext& context,
398 ClipRects& clipRects) const { 398 ClipRects& clipRects) const {
399 const LayoutBoxModelObject& layoutObject = *m_layer.layoutObject(); 399 const LayoutBoxModelObject& layoutObject = m_layer.layoutObject();
400 if (!m_layer.parent() && 400 if (!m_layer.parent() &&
401 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) { 401 !RuntimeEnabledFeatures::rootLayerScrollingEnabled()) {
402 // The root layer's clip rect is always infinite. 402 // The root layer's clip rect is always infinite.
403 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect())); 403 clipRects.reset(LayoutRect(LayoutRect::infiniteIntRect()));
404 return; 404 return;
405 } 405 }
406 406
407 bool isClippingRoot = &m_layer == context.rootLayer; 407 bool isClippingRoot = &m_layer == context.rootLayer;
408 408
409 // For transformed layers, the root layer was shifted to be us, so there is no 409 // For transformed layers, the root layer was shifted to be us, so there is no
(...skipping 11 matching lines...) Expand all
421 421
422 adjustClipRectsForChildren(layoutObject, clipRects); 422 adjustClipRectsForChildren(layoutObject, clipRects);
423 423
424 if (shouldClipOverflow(context) || layoutObject.hasClip()) { 424 if (shouldClipOverflow(context) || layoutObject.hasClip()) {
425 // This offset cannot use convertToLayerCoords, because sometimes our 425 // This offset cannot use convertToLayerCoords, because sometimes our
426 // rootLayer may be across some transformed layer boundary, for example, in 426 // rootLayer may be across some transformed layer boundary, for example, in
427 // the PaintLayerCompositor overlapMap, where clipRects are needed in view 427 // the PaintLayerCompositor overlapMap, where clipRects are needed in view
428 // space. 428 // space.
429 applyClipRects(context, layoutObject, 429 applyClipRects(context, layoutObject,
430 LayoutPoint(layoutObject.localToAncestorPoint( 430 LayoutPoint(layoutObject.localToAncestorPoint(
431 FloatPoint(), context.rootLayer->layoutObject())), 431 FloatPoint(), &context.rootLayer->layoutObject())),
432 clipRects); 432 clipRects);
433 } 433 }
434 } 434 }
435 435
436 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects, 436 static ClipRect backgroundClipRectForPosition(const ClipRects& parentRects,
437 EPosition position) { 437 EPosition position) {
438 if (position == EPosition::kFixed) 438 if (position == EPosition::kFixed)
439 return parentRects.fixedClipRect(); 439 return parentRects.fixedClipRect();
440 440
441 if (position == EPosition::kAbsolute) 441 if (position == EPosition::kAbsolute)
442 return parentRects.posClipRect(); 442 return parentRects.posClipRect();
443 443
444 return parentRects.overflowClipRect(); 444 return parentRects.overflowClipRect();
445 } 445 }
446 446
447 ClipRect PaintLayerClipper::clipRectWithGeometryMapper( 447 ClipRect PaintLayerClipper::clipRectWithGeometryMapper(
448 const ClipRectsContext& context, 448 const ClipRectsContext& context,
449 bool isForeground) const { 449 bool isForeground) const {
450 DCHECK(m_geometryMapper); 450 DCHECK(m_geometryMapper);
451 const auto* properties = m_layer.layoutObject()->paintProperties(); 451 const auto* properties = m_layer.layoutObject().paintProperties();
452 DCHECK(properties && properties->localBorderBoxProperties()); 452 DCHECK(properties && properties->localBorderBoxProperties());
453 453
454 PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties(); 454 PropertyTreeState propertyTreeState = *properties->localBorderBoxProperties();
455 const auto* ancestorProperties = 455 const auto* ancestorProperties =
456 context.rootLayer->layoutObject()->paintProperties(); 456 context.rootLayer->layoutObject().paintProperties();
457 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties()); 457 DCHECK(ancestorProperties && ancestorProperties->localBorderBoxProperties());
458 PropertyTreeState destinationPropertyTreeState = 458 PropertyTreeState destinationPropertyTreeState =
459 *ancestorProperties->localBorderBoxProperties(); 459 *ancestorProperties->localBorderBoxProperties();
460 460
461 if (&m_layer == context.rootLayer) { 461 if (&m_layer == context.rootLayer) {
462 // Set the overflow clip for |propertyTreeState| so that it differs from 462 // Set the overflow clip for |propertyTreeState| so that it differs from
463 // |destinationPropertyTreeState| in its clip. 463 // |destinationPropertyTreeState| in its clip.
464 if (isForeground && context.respectOverflowClip == RespectOverflowClip && 464 if (isForeground && context.respectOverflowClip == RespectOverflowClip &&
465 properties->overflowClip()) 465 properties->overflowClip())
466 propertyTreeState.setClip(properties->overflowClip()); 466 propertyTreeState.setClip(properties->overflowClip());
(...skipping 10 matching lines...) Expand all
477 propertyTreeState.setClip(properties->overflowClip()); 477 propertyTreeState.setClip(properties->overflowClip());
478 } 478 }
479 479
480 FloatClipRect clippedRectInRootLayerSpace = 480 FloatClipRect clippedRectInRootLayerSpace =
481 m_geometryMapper->sourceToDestinationClipRect( 481 m_geometryMapper->sourceToDestinationClipRect(
482 propertyTreeState, destinationPropertyTreeState); 482 propertyTreeState, destinationPropertyTreeState);
483 ClipRect clipRect(LayoutRect(clippedRectInRootLayerSpace.rect())); 483 ClipRect clipRect(LayoutRect(clippedRectInRootLayerSpace.rect()));
484 if (clippedRectInRootLayerSpace.hasRadius()) 484 if (clippedRectInRootLayerSpace.hasRadius())
485 clipRect.setHasRadius(true); 485 clipRect.setHasRadius(true);
486 486
487 clipRect.moveBy(-context.rootLayer->layoutObject()->paintOffset()); 487 clipRect.moveBy(-context.rootLayer->layoutObject().paintOffset());
488 return clipRect; 488 return clipRect;
489 } 489 }
490 490
491 void PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper( 491 void PaintLayerClipper::applyOverflowClipToBackgroundRectWithGeometryMapper(
492 const ClipRectsContext& context, 492 const ClipRectsContext& context,
493 ClipRect& clip) const { 493 ClipRect& clip) const {
494 const LayoutObject& layoutObject = *m_layer.layoutObject(); 494 const LayoutObject& layoutObject = m_layer.layoutObject();
495 if (!shouldClipOverflow(context)) 495 if (!shouldClipOverflow(context))
496 return; 496 return;
497 LayoutRect layerBoundsWithVisualOverflow = 497 LayoutRect layerBoundsWithVisualOverflow =
498 layoutObject.isLayoutView() 498 layoutObject.isLayoutView()
499 ? toLayoutView(layoutObject).viewRect() 499 ? toLayoutView(layoutObject).viewRect()
500 : toLayoutBox(layoutObject).visualOverflowRect(); 500 : toLayoutBox(layoutObject).visualOverflowRect();
501 toLayoutBox(layoutObject) 501 toLayoutBox(layoutObject)
502 .flipForWritingMode( 502 .flipForWritingMode(
503 // PaintLayer are in physical coordinates, so the overflow has to be 503 // PaintLayer are in physical coordinates, so the overflow has to be
504 // flipped. 504 // flipped.
505 layerBoundsWithVisualOverflow); 505 layerBoundsWithVisualOverflow);
506 mapLocalToRootWithGeometryMapper(context, layerBoundsWithVisualOverflow); 506 mapLocalToRootWithGeometryMapper(context, layerBoundsWithVisualOverflow);
507 clip.intersect(layerBoundsWithVisualOverflow); 507 clip.intersect(layerBoundsWithVisualOverflow);
508 } 508 }
509 509
510 ClipRect PaintLayerClipper::backgroundClipRect( 510 ClipRect PaintLayerClipper::backgroundClipRect(
511 const ClipRectsContext& context) const { 511 const ClipRectsContext& context) const {
512 if (m_geometryMapper) { 512 if (m_geometryMapper) {
513 ClipRect backgroundClipRect = clipRectWithGeometryMapper(context, false); 513 ClipRect backgroundClipRect = clipRectWithGeometryMapper(context, false);
514 #ifdef CHECK_CLIP_RECTS 514 #ifdef CHECK_CLIP_RECTS
515 ClipRect testBackgroundClipRect = 515 ClipRect testBackgroundClipRect =
516 PaintLayerClipper(m_layer, nullptr).backgroundClipRect(context); 516 PaintLayerClipper(m_layer, nullptr).backgroundClipRect(context);
517 CHECK_RECTS_EQ(testBackgroundClipRect, backgroundClipRect); 517 CHECK_RECTS_EQ(testBackgroundClipRect, backgroundClipRect);
518 #endif 518 #endif
519 return backgroundClipRect; 519 return backgroundClipRect;
520 } 520 }
521 DCHECK(m_layer.parent()); 521 DCHECK(m_layer.parent());
522 LayoutView* layoutView = m_layer.layoutObject()->view(); 522 LayoutView* layoutView = m_layer.layoutObject().view();
523 DCHECK(layoutView); 523 DCHECK(layoutView);
524 524
525 RefPtr<ClipRects> parentClipRects = ClipRects::create(); 525 RefPtr<ClipRects> parentClipRects = ClipRects::create();
526 if (&m_layer == context.rootLayer) { 526 if (&m_layer == context.rootLayer) {
527 parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect())); 527 parentClipRects->reset(LayoutRect(LayoutRect::infiniteIntRect()));
528 } else { 528 } else {
529 PaintLayerClipper(*m_layer.parent(), m_geometryMapper) 529 PaintLayerClipper(*m_layer.parent(), m_geometryMapper)
530 .getOrCalculateClipRects(context, *parentClipRects); 530 .getOrCalculateClipRects(context, *parentClipRects);
531 } 531 }
532 532
533 ClipRect result = backgroundClipRectForPosition( 533 ClipRect result = backgroundClipRectForPosition(
534 *parentClipRects, m_layer.layoutObject()->styleRef().position()); 534 *parentClipRects, m_layer.layoutObject().styleRef().position());
535 535
536 // Note: infinite clipRects should not be scrolled here, otherwise they will 536 // Note: infinite clipRects should not be scrolled here, otherwise they will
537 // accidentally no longer be considered infinite. 537 // accidentally no longer be considered infinite.
538 if (parentClipRects->fixed() && 538 if (parentClipRects->fixed() &&
539 context.rootLayer->layoutObject() == layoutView && 539 &context.rootLayer->layoutObject() == layoutView &&
540 result != LayoutRect(LayoutRect::infiniteIntRect())) 540 result != LayoutRect(LayoutRect::infiniteIntRect()))
541 result.move(LayoutSize(layoutView->frameView()->getScrollOffset())); 541 result.move(LayoutSize(layoutView->frameView()->getScrollOffset()));
542 542
543 return result; 543 return result;
544 } 544 }
545 545
546 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context, 546 void PaintLayerClipper::getOrCalculateClipRects(const ClipRectsContext& context,
547 ClipRects& clipRects) const { 547 ClipRects& clipRects) const {
548 DCHECK(!m_geometryMapper); 548 DCHECK(!m_geometryMapper);
549 549
550 if (context.usesCache()) 550 if (context.usesCache())
551 clipRects = getClipRects(context); 551 clipRects = getClipRects(context);
552 else 552 else
553 calculateClipRects(context, clipRects); 553 calculateClipRects(context, clipRects);
554 } 554 }
555 555
556 bool PaintLayerClipper::shouldClipOverflow( 556 bool PaintLayerClipper::shouldClipOverflow(
557 const ClipRectsContext& context) const { 557 const ClipRectsContext& context) const {
558 if (!m_layer.layoutObject()->isBox()) 558 if (!m_layer.layoutObject().isBox())
559 return false; 559 return false;
560 const LayoutBox& box = *toLayoutBox(m_layer.layoutObject()); 560 const LayoutBox& box = toLayoutBox(m_layer.layoutObject());
561 561
562 if (!shouldRespectOverflowClip(context)) 562 if (!shouldRespectOverflowClip(context))
563 return false; 563 return false;
564 564
565 return box.shouldClipOverflow(); 565 return box.shouldClipOverflow();
566 } 566 }
567 567
568 bool PaintLayerClipper::shouldRespectOverflowClip( 568 bool PaintLayerClipper::shouldRespectOverflowClip(
569 const ClipRectsContext& context) const { 569 const ClipRectsContext& context) const {
570 if (&m_layer != context.rootLayer) 570 if (&m_layer != context.rootLayer)
(...skipping 15 matching lines...) Expand all
586 const LayoutSize& subpixelAccumulation) const { 586 const LayoutSize& subpixelAccumulation) const {
587 DCHECK(!m_geometryMapper); 587 DCHECK(!m_geometryMapper);
588 ClipRectsContext context(rootLayer, PaintingClipRects, 588 ClipRectsContext context(rootLayer, PaintingClipRects,
589 IgnoreOverlayScrollbarSize, subpixelAccumulation); 589 IgnoreOverlayScrollbarSize, subpixelAccumulation);
590 if (respectOverflowClip == IgnoreOverflowClip) 590 if (respectOverflowClip == IgnoreOverflowClip)
591 context.setIgnoreOverflowClip(); 591 context.setIgnoreOverflowClip();
592 return getClipRects(context); 592 return getClipRects(context);
593 } 593 }
594 594
595 } // namespace blink 595 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/PaintLayer.cpp ('k') | third_party/WebKit/Source/core/paint/PaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698