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

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

Issue 2671853003: [SPInvalidation] Use GeometryMapper in PaintLayerClipper for paint. (Closed)
Patch Set: none 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 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 273
274 void PaintLayer::setSubpixelAccumulation(const LayoutSize& size) { 274 void PaintLayer::setSubpixelAccumulation(const LayoutSize& size) {
275 if (m_rareData || !size.isZero()) 275 if (m_rareData || !size.isZero())
276 ensureRareData().subpixelAccumulation = size; 276 ensureRareData().subpixelAccumulation = size;
277 } 277 }
278 278
279 void PaintLayer::updateLayerPositionsAfterLayout() { 279 void PaintLayer::updateLayerPositionsAfterLayout() {
280 TRACE_EVENT0("blink,benchmark", 280 TRACE_EVENT0("blink,benchmark",
281 "PaintLayer::updateLayerPositionsAfterLayout"); 281 "PaintLayer::updateLayerPositionsAfterLayout");
282 282
283 clipper().clearClipRectsIncludingDescendants(); 283 clipper(false).clearClipRectsIncludingDescendants();
284 updateLayerPositionRecursive(); 284 updateLayerPositionRecursive();
285 285
286 { 286 {
287 // FIXME: Remove incremental compositing updates after fixing the 287 // FIXME: Remove incremental compositing updates after fixing the
288 // chicken/egg issues, https://crbug.com/343756 288 // chicken/egg issues, https://crbug.com/343756
289 DisableCompositingQueryAsserts disabler; 289 DisableCompositingQueryAsserts disabler;
290 updatePaginationRecursive(enclosingPaginationLayer()); 290 updatePaginationRecursive(enclosingPaginationLayer());
291 } 291 }
292 } 292 }
293 293
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root())); 361 (!ancestorScrollingLayer() || ancestorScrollingLayer() == root()));
362 } 362 }
363 363
364 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const { 364 bool PaintLayer::scrollsWithRespectTo(const PaintLayer* other) const {
365 if (sticksToViewport() != other->sticksToViewport()) 365 if (sticksToViewport() != other->sticksToViewport())
366 return true; 366 return true;
367 return ancestorScrollingLayer() != other->ancestorScrollingLayer(); 367 return ancestorScrollingLayer() != other->ancestorScrollingLayer();
368 } 368 }
369 369
370 void PaintLayer::updateLayerPositionsAfterOverflowScroll() { 370 void PaintLayer::updateLayerPositionsAfterOverflowScroll() {
371 clipper().clearClipRectsIncludingDescendants(); 371 clipper(false).clearClipRectsIncludingDescendants();
372 updateLayerPositionRecursive(); 372 updateLayerPositionRecursive();
373 } 373 }
374 374
375 void PaintLayer::updateTransformationMatrix() { 375 void PaintLayer::updateTransformationMatrix() {
376 if (TransformationMatrix* transform = this->transform()) { 376 if (TransformationMatrix* transform = this->transform()) {
377 LayoutBox* box = layoutBox(); 377 LayoutBox* box = layoutBox();
378 DCHECK(box); 378 DCHECK(box);
379 transform->makeIdentity(); 379 transform->makeIdentity();
380 box->style()->applyTransform( 380 box->style()->applyTransform(
381 *transform, box->size(), ComputedStyle::IncludeTransformOrigin, 381 *transform, box->size(), ComputedStyle::IncludeTransformOrigin,
(...skipping 16 matching lines...) Expand all
398 398
399 bool hadTransform = transform(); 399 bool hadTransform = transform();
400 if (hasTransform != hadTransform) { 400 if (hasTransform != hadTransform) {
401 if (hasTransform) 401 if (hasTransform)
402 ensureRareData().transform = TransformationMatrix::create(); 402 ensureRareData().transform = TransformationMatrix::create();
403 else 403 else
404 m_rareData->transform.reset(); 404 m_rareData->transform.reset();
405 405
406 // PaintLayers with transforms act as clip rects roots, so clear the cached 406 // PaintLayers with transforms act as clip rects roots, so clear the cached
407 // clip rects here. 407 // clip rects here.
408 clipper().clearClipRectsIncludingDescendants(); 408 clipper(false).clearClipRectsIncludingDescendants();
409 } else if (hasTransform) { 409 } else if (hasTransform) {
410 clipper().clearClipRectsIncludingDescendants(AbsoluteClipRects); 410 clipper(false).clearClipRectsIncludingDescendants(AbsoluteClipRects);
411 } 411 }
412 412
413 updateTransformationMatrix(); 413 updateTransformationMatrix();
414 414
415 if (had3DTransform != has3DTransform()) 415 if (had3DTransform != has3DTransform())
416 markAncestorChainForDescendantDependentFlagsUpdate(); 416 markAncestorChainForDescendantDependentFlagsUpdate();
417 417
418 if (FrameView* frameView = layoutObject()->document().view()) 418 if (FrameView* frameView = layoutObject()->document().view())
419 frameView->setNeedsUpdateWidgetGeometries(); 419 frameView->setNeedsUpdateWidgetGeometries();
420 } 420 }
(...skipping 901 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 didSetPaintInvalidation = true; 1322 didSetPaintInvalidation = true;
1323 } 1323 }
1324 } 1324 }
1325 1325
1326 if (!didSetPaintInvalidation && isSelfPaintingLayer()) { 1326 if (!didSetPaintInvalidation && isSelfPaintingLayer()) {
1327 if (PaintLayer* enclosingSelfPaintingLayer = 1327 if (PaintLayer* enclosingSelfPaintingLayer =
1328 m_parent->enclosingSelfPaintingLayer()) 1328 m_parent->enclosingSelfPaintingLayer())
1329 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this); 1329 enclosingSelfPaintingLayer->mergeNeedsPaintPhaseFlagsFrom(*this);
1330 } 1330 }
1331 1331
1332 clipper().clearClipRectsIncludingDescendants(); 1332 clipper(false).clearClipRectsIncludingDescendants();
1333 1333
1334 PaintLayer* nextSib = nextSibling(); 1334 PaintLayer* nextSib = nextSibling();
1335 1335
1336 // Now walk our kids and reattach them to our parent. 1336 // Now walk our kids and reattach them to our parent.
1337 PaintLayer* current = m_first; 1337 PaintLayer* current = m_first;
1338 while (current) { 1338 while (current) {
1339 PaintLayer* next = current->nextSibling(); 1339 PaintLayer* next = current->nextSibling();
1340 removeChild(current); 1340 removeChild(current);
1341 m_parent->addChild(current, nextSib); 1341 m_parent->addChild(current, nextSib);
1342 1342
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1386 } 1386 }
1387 } 1387 }
1388 1388
1389 if (!didSetPaintInvalidation && isSelfPaintingLayer() && m_parent) { 1389 if (!didSetPaintInvalidation && isSelfPaintingLayer() && m_parent) {
1390 if (PaintLayer* enclosingSelfPaintingLayer = 1390 if (PaintLayer* enclosingSelfPaintingLayer =
1391 m_parent->enclosingSelfPaintingLayer()) 1391 m_parent->enclosingSelfPaintingLayer())
1392 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer); 1392 mergeNeedsPaintPhaseFlagsFrom(*enclosingSelfPaintingLayer);
1393 } 1393 }
1394 1394
1395 // Clear out all the clip rects. 1395 // Clear out all the clip rects.
1396 clipper().clearClipRectsIncludingDescendants(); 1396 clipper(false).clearClipRectsIncludingDescendants();
1397 } 1397 }
1398 1398
1399 // Returns the layer reached on the walk up towards the ancestor. 1399 // Returns the layer reached on the walk up towards the ancestor.
1400 static inline const PaintLayer* accumulateOffsetTowardsAncestor( 1400 static inline const PaintLayer* accumulateOffsetTowardsAncestor(
1401 const PaintLayer* layer, 1401 const PaintLayer* layer,
1402 const PaintLayer* ancestorLayer, 1402 const PaintLayer* ancestorLayer,
1403 LayoutPoint& location) { 1403 LayoutPoint& location) {
1404 DCHECK(ancestorLayer != layer); 1404 DCHECK(ancestorLayer != layer);
1405 1405
1406 const LayoutBoxModelObject* layoutObject = layer->layoutObject(); 1406 const LayoutBoxModelObject* layoutObject = layer->layoutObject();
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || 1509 return m_scrollableArea && (m_scrollableArea->hasScrollbar() ||
1510 m_scrollableArea->scrollCorner() || 1510 m_scrollableArea->scrollCorner() ||
1511 layoutObject()->style()->resize() != RESIZE_NONE); 1511 layoutObject()->style()->resize() != RESIZE_NONE);
1512 } 1512 }
1513 1513
1514 void PaintLayer::appendSingleFragmentIgnoringPagination( 1514 void PaintLayer::appendSingleFragmentIgnoringPagination(
1515 PaintLayerFragments& fragments, 1515 PaintLayerFragments& fragments,
1516 const PaintLayer* rootLayer, 1516 const PaintLayer* rootLayer,
1517 const LayoutRect& dirtyRect, 1517 const LayoutRect& dirtyRect,
1518 ClipRectsCacheSlot clipRectsCacheSlot, 1518 ClipRectsCacheSlot clipRectsCacheSlot,
1519 bool useGeometryMapper,
1519 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, 1520 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior,
1520 ShouldRespectOverflowClipType respectOverflowClip, 1521 ShouldRespectOverflowClipType respectOverflowClip,
1521 const LayoutPoint* offsetFromRoot, 1522 const LayoutPoint* offsetFromRoot,
1522 const LayoutSize& subPixelAccumulation) { 1523 const LayoutSize& subPixelAccumulation) {
1523 PaintLayerFragment fragment; 1524 PaintLayerFragment fragment;
1524 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, 1525 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot,
1525 overlayScrollbarClipBehavior, 1526 overlayScrollbarClipBehavior,
1526 subPixelAccumulation); 1527 subPixelAccumulation);
1527 if (respectOverflowClip == IgnoreOverflowClip) 1528 if (respectOverflowClip == IgnoreOverflowClip)
1528 clipRectsContext.setIgnoreOverflowClip(); 1529 clipRectsContext.setIgnoreOverflowClip();
1529 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds, 1530 clipper(useGeometryMapper)
1530 fragment.backgroundRect, fragment.foregroundRect, 1531 .calculateRects(clipRectsContext, dirtyRect, fragment.layerBounds,
1531 offsetFromRoot); 1532 fragment.backgroundRect, fragment.foregroundRect,
1533 offsetFromRoot);
1532 fragments.push_back(fragment); 1534 fragments.push_back(fragment);
1533 } 1535 }
1534 1536
1535 bool PaintLayer::shouldFragmentCompositedBounds( 1537 bool PaintLayer::shouldFragmentCompositedBounds(
1536 const PaintLayer* compositingLayer) const { 1538 const PaintLayer* compositingLayer) const {
1537 // Composited layers may not be fragmented. 1539 // Composited layers may not be fragmented.
1538 return enclosingPaginationLayer() && 1540 return enclosingPaginationLayer() &&
1539 !compositingLayer->enclosingPaginationLayer(); 1541 !compositingLayer->enclosingPaginationLayer();
1540 } 1542 }
1541 1543
1542 void PaintLayer::collectFragments( 1544 void PaintLayer::collectFragments(
1543 PaintLayerFragments& fragments, 1545 PaintLayerFragments& fragments,
1544 const PaintLayer* rootLayer, 1546 const PaintLayer* rootLayer,
1545 const LayoutRect& dirtyRect, 1547 const LayoutRect& dirtyRect,
1546 ClipRectsCacheSlot clipRectsCacheSlot, 1548 ClipRectsCacheSlot clipRectsCacheSlot,
1549 bool useGeometryMapper,
1547 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior, 1550 OverlayScrollbarClipBehavior overlayScrollbarClipBehavior,
1548 ShouldRespectOverflowClipType respectOverflowClip, 1551 ShouldRespectOverflowClipType respectOverflowClip,
1549 const LayoutPoint* offsetFromRoot, 1552 const LayoutPoint* offsetFromRoot,
1550 const LayoutSize& subPixelAccumulation, 1553 const LayoutSize& subPixelAccumulation,
1551 const LayoutRect* layerBoundingBox) { 1554 const LayoutRect* layerBoundingBox) {
1552 if (!enclosingPaginationLayer()) { 1555 if (!enclosingPaginationLayer()) {
1553 // For unpaginated layers, there is only one fragment. 1556 // For unpaginated layers, there is only one fragment.
1554 appendSingleFragmentIgnoringPagination( 1557 appendSingleFragmentIgnoringPagination(
1555 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, 1558 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, useGeometryMapper,
1556 overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot, 1559 overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot,
1557 subPixelAccumulation); 1560 subPixelAccumulation);
1558 return; 1561 return;
1559 } 1562 }
1560 1563
1561 if (!shouldFragmentCompositedBounds(rootLayer)) { 1564 if (!shouldFragmentCompositedBounds(rootLayer)) {
1562 appendSingleFragmentIgnoringPagination( 1565 appendSingleFragmentIgnoringPagination(
1563 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, 1566 fragments, rootLayer, dirtyRect, clipRectsCacheSlot, useGeometryMapper,
1564 overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot, 1567 overlayScrollbarClipBehavior, respectOverflowClip, offsetFromRoot,
1565 subPixelAccumulation); 1568 subPixelAccumulation);
1566 return; 1569 return;
1567 } 1570 }
1568 1571
1569 // Compute our offset within the enclosing pagination layer. 1572 // Compute our offset within the enclosing pagination layer.
1570 LayoutPoint offsetWithinPaginatedLayer; 1573 LayoutPoint offsetWithinPaginatedLayer;
1571 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer); 1574 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer);
1572 1575
1573 // Calculate clip rects relative to the enclosingPaginationLayer. The purpose 1576 // Calculate clip rects relative to the enclosingPaginationLayer. The purpose
1574 // of this call is to determine our bounds clipped to intermediate layers 1577 // of this call is to determine our bounds clipped to intermediate layers
1575 // between us and the pagination context. It's important to minimize the 1578 // between us and the pagination context. It's important to minimize the
1576 // number of fragments we need to create and this helps with that. 1579 // number of fragments we need to create and this helps with that.
1577 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), 1580 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(),
1578 clipRectsCacheSlot, 1581 clipRectsCacheSlot,
1579 overlayScrollbarClipBehavior); 1582 overlayScrollbarClipBehavior);
1580 if (respectOverflowClip == IgnoreOverflowClip) 1583 if (respectOverflowClip == IgnoreOverflowClip)
1581 paginationClipRectsContext.setIgnoreOverflowClip(); 1584 paginationClipRectsContext.setIgnoreOverflowClip();
1582 LayoutRect layerBoundsInFlowThread; 1585 LayoutRect layerBoundsInFlowThread;
1583 ClipRect backgroundRectInFlowThread; 1586 ClipRect backgroundRectInFlowThread;
1584 ClipRect foregroundRectInFlowThread; 1587 ClipRect foregroundRectInFlowThread;
1585 clipper().calculateRects( 1588 clipper(useGeometryMapper)
1586 paginationClipRectsContext, LayoutRect(LayoutRect::infiniteIntRect()), 1589 .calculateRects(paginationClipRectsContext,
1587 layerBoundsInFlowThread, backgroundRectInFlowThread, 1590 LayoutRect(LayoutRect::infiniteIntRect()),
1588 foregroundRectInFlowThread, &offsetWithinPaginatedLayer); 1591 layerBoundsInFlowThread, backgroundRectInFlowThread,
1592 foregroundRectInFlowThread, &offsetWithinPaginatedLayer);
1589 1593
1590 // Take our bounding box within the flow thread and clip it. 1594 // Take our bounding box within the flow thread and clip it.
1591 LayoutRect layerBoundingBoxInFlowThread = 1595 LayoutRect layerBoundingBoxInFlowThread =
1592 layerBoundingBox ? *layerBoundingBox 1596 layerBoundingBox ? *layerBoundingBox
1593 : physicalBoundingBox(offsetWithinPaginatedLayer); 1597 : physicalBoundingBox(offsetWithinPaginatedLayer);
1594 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect()); 1598 layerBoundingBoxInFlowThread.intersect(backgroundRectInFlowThread.rect());
1595 1599
1596 LayoutFlowThread* enclosingFlowThread = 1600 LayoutFlowThread* enclosingFlowThread =
1597 toLayoutFlowThread(enclosingPaginationLayer()->layoutObject()); 1601 toLayoutFlowThread(enclosingPaginationLayer()->layoutObject());
1598 // Visual offset from the root layer to the nearest fragmentation context. 1602 // Visual offset from the root layer to the nearest fragmentation context.
(...skipping 30 matching lines...) Expand all
1629 // intersect with that when painting column contents. 1633 // intersect with that when painting column contents.
1630 ClipRect ancestorClipRect = dirtyRect; 1634 ClipRect ancestorClipRect = dirtyRect;
1631 if (const PaintLayer* paginationParentLayer = 1635 if (const PaintLayer* paginationParentLayer =
1632 enclosingPaginationLayer()->parent()) { 1636 enclosingPaginationLayer()->parent()) {
1633 const PaintLayer* ancestorLayer = 1637 const PaintLayer* ancestorLayer =
1634 rootLayerIsInsidePaginationLayer ? paginationParentLayer : rootLayer; 1638 rootLayerIsInsidePaginationLayer ? paginationParentLayer : rootLayer;
1635 ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot, 1639 ClipRectsContext clipRectsContext(ancestorLayer, clipRectsCacheSlot,
1636 overlayScrollbarClipBehavior); 1640 overlayScrollbarClipBehavior);
1637 if (respectOverflowClip == IgnoreOverflowClip) 1641 if (respectOverflowClip == IgnoreOverflowClip)
1638 clipRectsContext.setIgnoreOverflowClip(); 1642 clipRectsContext.setIgnoreOverflowClip();
1639 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipRect( 1643 ancestorClipRect = enclosingPaginationLayer()
1640 clipRectsContext); 1644 ->clipper(useGeometryMapper)
1645 .backgroundClipRect(clipRectsContext);
1641 if (rootLayerIsInsidePaginationLayer) 1646 if (rootLayerIsInsidePaginationLayer)
1642 ancestorClipRect.moveBy( 1647 ancestorClipRect.moveBy(
1643 -rootLayer->visualOffsetFromAncestor(ancestorLayer)); 1648 -rootLayer->visualOffsetFromAncestor(ancestorLayer));
1644 ancestorClipRect.intersect(dirtyRect); 1649 ancestorClipRect.intersect(dirtyRect);
1645 } 1650 }
1646 1651
1647 const LayoutSize subPixelAccumulationIfNeeded = 1652 const LayoutSize subPixelAccumulationIfNeeded =
1648 offsetFromRoot ? subPixelAccumulation : LayoutSize(); 1653 offsetFromRoot ? subPixelAccumulation : LayoutSize();
1649 for (; !iterator.atEnd(); iterator.advance()) { 1654 for (; !iterator.atEnd(); iterator.advance()) {
1650 PaintLayerFragment fragment; 1655 PaintLayerFragment fragment;
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1881 1886
1882 // Apply a transform if we have one. 1887 // Apply a transform if we have one.
1883 if (transform() && !appliedTransform) { 1888 if (transform() && !appliedTransform) {
1884 if (enclosingPaginationLayer()) 1889 if (enclosingPaginationLayer())
1885 return hitTestTransformedLayerInFragments( 1890 return hitTestTransformedLayerInFragments(
1886 rootLayer, containerLayer, result, hitTestRect, hitTestLocation, 1891 rootLayer, containerLayer, result, hitTestRect, hitTestLocation,
1887 transformState, zOffset, clipRectsCacheSlot); 1892 transformState, zOffset, clipRectsCacheSlot);
1888 1893
1889 // Make sure the parent's clip rects have been calculated. 1894 // Make sure the parent's clip rects have been calculated.
1890 if (parent()) { 1895 if (parent()) {
1891 ClipRect clipRect = clipper().backgroundClipRect( 1896 ClipRect clipRect = clipper(false).backgroundClipRect(
1892 ClipRectsContext(rootLayer, clipRectsCacheSlot, 1897 ClipRectsContext(rootLayer, clipRectsCacheSlot,
1893 ExcludeOverlayScrollbarSizeForHitTesting)); 1898 ExcludeOverlayScrollbarSizeForHitTesting));
1894 // Go ahead and test the enclosing clip now. 1899 // Go ahead and test the enclosing clip now.
1895 if (!clipRect.intersects(hitTestLocation)) 1900 if (!clipRect.intersects(hitTestLocation))
1896 return nullptr; 1901 return nullptr;
1897 } 1902 }
1898 1903
1899 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result, 1904 return hitTestLayerByApplyingTransform(rootLayer, containerLayer, result,
1900 hitTestRect, hitTestLocation, 1905 hitTestRect, hitTestLocation,
1901 transformState, zOffset); 1906 transformState, zOffset);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1986 if (!depthSortDescendants) 1991 if (!depthSortDescendants)
1987 return hitLayer; 1992 return hitLayer;
1988 candidateLayer = hitLayer; 1993 candidateLayer = hitLayer;
1989 } 1994 }
1990 1995
1991 // Collect the fragments. This will compute the clip rectangles for each layer 1996 // Collect the fragments. This will compute the clip rectangles for each layer
1992 // fragment. 1997 // fragment.
1993 PaintLayerFragments layerFragments; 1998 PaintLayerFragments layerFragments;
1994 if (appliedTransform) 1999 if (appliedTransform)
1995 appendSingleFragmentIgnoringPagination( 2000 appendSingleFragmentIgnoringPagination(
1996 layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, 2001 layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, false,
1997 ExcludeOverlayScrollbarSizeForHitTesting); 2002 ExcludeOverlayScrollbarSizeForHitTesting);
1998 else 2003 else
1999 collectFragments(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot, 2004 collectFragments(layerFragments, rootLayer, hitTestRect, clipRectsCacheSlot,
2000 ExcludeOverlayScrollbarSizeForHitTesting); 2005 false, ExcludeOverlayScrollbarSizeForHitTesting);
2001 2006
2002 if (m_scrollableArea && 2007 if (m_scrollableArea &&
2003 m_scrollableArea->hitTestResizerInFragments(layerFragments, 2008 m_scrollableArea->hitTestResizerInFragments(layerFragments,
2004 hitTestLocation)) { 2009 hitTestLocation)) {
2005 layoutObject()->updateHitTestResult(result, hitTestLocation.point()); 2010 layoutObject()->updateHitTestResult(result, hitTestLocation.point());
2006 return this; 2011 return this;
2007 } 2012 }
2008 2013
2009 // Next we want to see if the mouse pos is inside the child LayoutObjects of 2014 // Next we want to see if the mouse pos is inside the child LayoutObjects of
2010 // the layer. Check every fragment in reverse order. 2015 // the layer. Check every fragment in reverse order.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
2105 double* zOffset, 2110 double* zOffset,
2106 ClipRectsCacheSlot clipRectsCacheSlot) { 2111 ClipRectsCacheSlot clipRectsCacheSlot) {
2107 PaintLayerFragments enclosingPaginationFragments; 2112 PaintLayerFragments enclosingPaginationFragments;
2108 LayoutPoint offsetOfPaginationLayerFromRoot; 2113 LayoutPoint offsetOfPaginationLayerFromRoot;
2109 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 2114 // FIXME: We're missing a sub-pixel offset here crbug.com/348728
2110 LayoutRect transformedExtent = transparencyClipBox( 2115 LayoutRect transformedExtent = transparencyClipBox(
2111 this, enclosingPaginationLayer(), HitTestingTransparencyClipBox, 2116 this, enclosingPaginationLayer(), HitTestingTransparencyClipBox,
2112 PaintLayer::RootOfTransparencyClipBox, LayoutSize()); 2117 PaintLayer::RootOfTransparencyClipBox, LayoutSize());
2113 enclosingPaginationLayer()->collectFragments( 2118 enclosingPaginationLayer()->collectFragments(
2114 enclosingPaginationFragments, rootLayer, hitTestRect, clipRectsCacheSlot, 2119 enclosingPaginationFragments, rootLayer, hitTestRect, clipRectsCacheSlot,
2115 ExcludeOverlayScrollbarSizeForHitTesting, RespectOverflowClip, 2120 false, ExcludeOverlayScrollbarSizeForHitTesting, RespectOverflowClip,
2116 &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); 2121 &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
2117 2122
2118 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { 2123 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
2119 const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i); 2124 const PaintLayerFragment& fragment = enclosingPaginationFragments.at(i);
2120 2125
2121 // Apply the page/column clip for this fragment, as well as any clips 2126 // Apply the page/column clip for this fragment, as well as any clips
2122 // established by layers in between us and the enclosing pagination layer. 2127 // established by layers in between us and the enclosing pagination layer.
2123 LayoutRect clipRect = fragment.backgroundRect.rect(); 2128 LayoutRect clipRect = fragment.backgroundRect.rect();
2124 2129
2125 // Now compute the clips within a given fragment 2130 // Now compute the clips within a given fragment
2126 if (parent() != enclosingPaginationLayer()) { 2131 if (parent() != enclosingPaginationLayer()) {
2127 enclosingPaginationLayer()->convertToLayerCoords( 2132 enclosingPaginationLayer()->convertToLayerCoords(
2128 rootLayer, offsetOfPaginationLayerFromRoot); 2133 rootLayer, offsetOfPaginationLayerFromRoot);
2129 LayoutRect parentClipRect = 2134 LayoutRect parentClipRect =
2130 clipper() 2135 clipper(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled())
2131 .backgroundClipRect(ClipRectsContext( 2136 .backgroundClipRect(ClipRectsContext(
2132 enclosingPaginationLayer(), clipRectsCacheSlot, 2137 enclosingPaginationLayer(), clipRectsCacheSlot,
2133 ExcludeOverlayScrollbarSizeForHitTesting)) 2138 ExcludeOverlayScrollbarSizeForHitTesting))
2134 .rect(); 2139 .rect();
2135 parentClipRect.moveBy(fragment.paginationOffset + 2140 parentClipRect.moveBy(fragment.paginationOffset +
2136 offsetOfPaginationLayerFromRoot); 2141 offsetOfPaginationLayerFromRoot);
2137 clipRect.intersect(parentClipRect); 2142 clipRect.intersect(parentClipRect);
2138 } 2143 }
2139 2144
2140 if (!hitTestLocation.intersects(clipRect)) 2145 if (!hitTestLocation.intersects(clipRect))
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
2504 // and hit-testing, and should not contribute to the bounding box. The 2509 // and hit-testing, and should not contribute to the bounding box. The
2505 // LayoutMultiColumnSets will contribute the correct size for the layout 2510 // LayoutMultiColumnSets will contribute the correct size for the layout
2506 // content of the multicol container. 2511 // content of the multicol container.
2507 if (layoutObject()->isLayoutFlowThread()) 2512 if (layoutObject()->isLayoutFlowThread())
2508 return LayoutRect(); 2513 return LayoutRect();
2509 2514
2510 const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded(); 2515 const_cast<PaintLayer*>(this)->stackingNode()->updateLayerListsIfNeeded();
2511 2516
2512 // If there is a clip applied by an ancestor to this PaintLayer but below or 2517 // If there is a clip applied by an ancestor to this PaintLayer but below or
2513 // equal to |ancestorLayer|, apply that clip. 2518 // equal to |ancestorLayer|, apply that clip.
2514 LayoutRect result = clipper().localClipRect(compositedLayer); 2519 LayoutRect result = clipper(false).localClipRect(compositedLayer);
2515 2520
2516 result.intersect(physicalBoundingBox(LayoutPoint())); 2521 result.intersect(physicalBoundingBox(LayoutPoint()));
2517 2522
2518 expandRectForStackingChildren(compositedLayer, result, options); 2523 expandRectForStackingChildren(compositedLayer, result, options);
2519 2524
2520 // Only enlarge by the filter outsets if we know the filter is going to be 2525 // Only enlarge by the filter outsets if we know the filter is going to be
2521 // rendered in software. Accelerated filters will handle their own outsets. 2526 // rendered in software. Accelerated filters will handle their own outsets.
2522 if (paintsWithFilters()) 2527 if (paintsWithFilters())
2523 result = mapLayoutRectForFilter(result); 2528 result = mapLayoutRectForFilter(result);
2524 2529
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
2938 updateSelfPaintingLayer(); 2943 updateSelfPaintingLayer();
2939 2944
2940 updateTransform(oldStyle, layoutObject()->styleRef()); 2945 updateTransform(oldStyle, layoutObject()->styleRef());
2941 updateFilters(oldStyle, layoutObject()->styleRef()); 2946 updateFilters(oldStyle, layoutObject()->styleRef());
2942 updateClipPath(oldStyle, layoutObject()->styleRef()); 2947 updateClipPath(oldStyle, layoutObject()->styleRef());
2943 2948
2944 setNeedsCompositingInputsUpdate(); 2949 setNeedsCompositingInputsUpdate();
2945 layoutObject()->setNeedsPaintPropertyUpdate(); 2950 layoutObject()->setNeedsPaintPropertyUpdate();
2946 } 2951 }
2947 2952
2953 PaintLayerClipper PaintLayer::clipper(bool useGeometryMapper) const {
pdr. 2017/02/10 20:51:07 Can you add an enum for UseGeometryMapper to make
chrishtr 2017/02/10 22:56:36 Done.
2954 GeometryMapper* geometryMapper = nullptr;
2955 if (useGeometryMapper) {
2956 DCHECK(RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled());
2957 if (FrameView* frameView = m_layoutObject->document().view())
2958 geometryMapper = frameView->geometryMapper();
2959 }
2960 return PaintLayerClipper(*this, geometryMapper);
2961 }
2962
2948 bool PaintLayer::scrollsOverflow() const { 2963 bool PaintLayer::scrollsOverflow() const {
2949 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea()) 2964 if (PaintLayerScrollableArea* scrollableArea = this->getScrollableArea())
2950 return scrollableArea->scrollsOverflow(); 2965 return scrollableArea->scrollsOverflow();
2951 2966
2952 return false; 2967 return false;
2953 } 2968 }
2954 2969
2955 FilterOperations PaintLayer::addReflectionToFilterOperations( 2970 FilterOperations PaintLayer::addReflectionToFilterOperations(
2956 const ComputedStyle& style) const { 2971 const ComputedStyle& style) const {
2957 FilterOperations filterOperations = style.filter(); 2972 FilterOperations filterOperations = style.filter();
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 } 3206 }
3192 3207
3193 void showLayerTree(const blink::LayoutObject* layoutObject) { 3208 void showLayerTree(const blink::LayoutObject* layoutObject) {
3194 if (!layoutObject) { 3209 if (!layoutObject) {
3195 LOG(INFO) << "Cannot showLayerTree. Root is (nil)"; 3210 LOG(INFO) << "Cannot showLayerTree. Root is (nil)";
3196 return; 3211 return;
3197 } 3212 }
3198 showLayerTree(layoutObject->enclosingLayer()); 3213 showLayerTree(layoutObject->enclosingLayer());
3199 } 3214 }
3200 #endif 3215 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698