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