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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 666493002: Remove updatePaintingInfoForFragments() and per-fragment shouldPaintContent flag. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: rebase master Created 6 years, 2 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 reserved. 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved.
3 * 3 *
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation.
5 * 5 *
6 * Other contributors: 6 * Other contributors:
7 * Robert O'Callahan <roc+@cs.cmu.edu> 7 * Robert O'Callahan <roc+@cs.cmu.edu>
8 * David Baron <dbaron@fas.harvard.edu> 8 * David Baron <dbaron@fas.harvard.edu>
9 * Christian Biesinger <cbiesinger@web.de> 9 * Christian Biesinger <cbiesinger@web.de>
10 * Randall Jesup <rjesup@wgate.com> 10 * Randall Jesup <rjesup@wgate.com>
(...skipping 1450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1461 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(*this)); 1461 m_scrollableArea = adoptPtr(new RenderLayerScrollableArea(*this));
1462 else 1462 else
1463 m_scrollableArea = nullptr; 1463 m_scrollableArea = nullptr;
1464 } 1464 }
1465 1465
1466 bool RenderLayer::hasOverflowControls() const 1466 bool RenderLayer::hasOverflowControls() const
1467 { 1467 {
1468 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); 1468 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE);
1469 } 1469 }
1470 1470
1471 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer* rootLayer, const LayoutRect& dirtyRect, 1471 void RenderLayer::collectFragments(LayerFragments& fragments, DirtyRectIntersect ionResult* intersectionResult, const RenderLayer* rootLayer, const LayoutRect& d irtyRect, ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy i nOverlayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, c onst LayoutPoint* offsetFromRoot, const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
1472 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverl ayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const L ayoutPoint* offsetFromRoot,
1473 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox)
1474 { 1472 {
1475 if (!enclosingPaginationLayer() || hasTransformRelatedProperty()) { 1473 if (!enclosingPaginationLayer() || hasTransformRelatedProperty()) {
1476 // For unpaginated layers, there is only one fragment. 1474 // For unpaginated layers, there is only one fragment.
1477 LayerFragment fragment; 1475 LayerFragment fragment;
1478 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl ayScrollbarSizeRelevancy, subPixelAccumulation); 1476 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl ayScrollbarSizeRelevancy, subPixelAccumulation);
1479 if (respectOverflowClip == IgnoreOverflowClip) 1477 if (respectOverflowClip == IgnoreOverflowClip)
1480 clipRectsContext.setIgnoreOverflowClip(); 1478 clipRectsContext.setIgnoreOverflowClip();
1481 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs etFromRoot); 1479 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs etFromRoot);
1482 fragments.append(fragment); 1480 fragments.append(fragment);
1481 if (intersectionResult)
1482 *intersectionResult = intersectsDamageRect(fragment.layerBounds, fra gment.backgroundRect.rect(), rootLayer, offsetFromRoot) ? IntersectingDirtyRect : NotIntersectingDirtyRect;
1483 return; 1483 return;
1484 } 1484 }
1485 1485
1486 // Compute our offset within the enclosing pagination layer. 1486 // Compute our offset within the enclosing pagination layer.
1487 LayoutPoint offsetWithinPaginatedLayer; 1487 LayoutPoint offsetWithinPaginatedLayer;
1488 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ; 1488 convertToLayerCoords(enclosingPaginationLayer(), offsetWithinPaginatedLayer) ;
1489 1489
1490 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate 1490 // Calculate clip rects relative to the enclosingPaginationLayer. The purpos e of this call is to determine our bounds clipped to intermediate
1491 // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that. 1491 // layers between us and the pagination context. It's important to minimize the number of fragments we need to create and this helps with that.
1492 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip RectsCacheSlot, inOverlayScrollbarSizeRelevancy); 1492 ClipRectsContext paginationClipRectsContext(enclosingPaginationLayer(), clip RectsCacheSlot, inOverlayScrollbarSizeRelevancy);
(...skipping 23 matching lines...) Expand all
1516 } else { 1516 } else {
1517 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPagi nationLayerFromRoot); 1517 enclosingPaginationLayer()->convertToLayerCoords(rootLayer, offsetOfPagi nationLayerFromRoot);
1518 } 1518 }
1519 LayoutRect dirtyRectInFlowThread(dirtyRect); 1519 LayoutRect dirtyRectInFlowThread(dirtyRect);
1520 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot); 1520 dirtyRectInFlowThread.moveBy(-offsetOfPaginationLayerFromRoot);
1521 1521
1522 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns 1522 // Tell the flow thread to collect the fragments. We pass enough information to create a minimal number of fragments based off the pages/columns
1523 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box. 1523 // that intersect the actual dirtyRect as well as the pages/columns that int ersect our layer's bounding box.
1524 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread); 1524 enclosingFlowThread->collectLayerFragments(fragments, layerBoundingBoxInFlow Thread, dirtyRectInFlowThread);
1525 1525
1526 if (fragments.isEmpty()) 1526 if (fragments.isEmpty()) {
chrishtr 2014/10/28 18:47:42 When would there ever be 0 fragments? Will this pa
chrishtr 2014/10/28 18:47:42 When would there ever be 0 fragments?
mstensho (USE GERRIT) 2014/10/28 20:08:21 Yes, only reachable by columns. There'll be no fra
1527 if (intersectionResult)
1528 *intersectionResult = NotIntersectingDirtyRect;
1527 return; 1529 return;
1530 }
1528 1531
1529 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents. 1532 // Get the parent clip rects of the pagination layer, since we need to inter sect with that when painting column contents.
1530 ClipRect ancestorClipRect = dirtyRect; 1533 ClipRect ancestorClipRect = dirtyRect;
1531 if (enclosingPaginationLayer()->parent()) { 1534 if (enclosingPaginationLayer()->parent()) {
1532 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl ayScrollbarSizeRelevancy); 1535 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl ayScrollbarSizeRelevancy);
1533 if (respectOverflowClip == IgnoreOverflowClip) 1536 if (respectOverflowClip == IgnoreOverflowClip)
1534 clipRectsContext.setIgnoreOverflowClip(); 1537 clipRectsContext.setIgnoreOverflowClip();
1535 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext); 1538 ancestorClipRect = enclosingPaginationLayer()->clipper().backgroundClipR ect(clipRectsContext);
1536 ancestorClipRect.intersect(dirtyRect); 1539 ancestorClipRect.intersect(dirtyRect);
1537 } 1540 }
1538 1541
1539 for (size_t i = 0; i < fragments.size(); ++i) { 1542 for (size_t i = 0; i < fragments.size(); ++i) {
1540 LayerFragment& fragment = fragments.at(i); 1543 LayerFragment& fragment = fragments.at(i);
1541 1544
1542 // Set our four rects with all clipping applied that was internal to the flow thread. 1545 // Set our four rects with all clipping applied that was internal to the flow thread.
1543 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f oregroundRectInFlowThread, outlineRectInFlowThread); 1546 fragment.setRects(layerBoundsInFlowThread, backgroundRectInFlowThread, f oregroundRectInFlowThread, outlineRectInFlowThread);
1544 1547
1545 // Shift to the root-relative physical position used when painting the f low thread in this fragment. 1548 // Shift to the root-relative physical position used when painting the f low thread in this fragment.
1546 fragment.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromR oot); 1549 fragment.moveBy(fragment.paginationOffset + offsetOfPaginationLayerFromR oot);
1547 1550
1548 // Intersect the fragment with our ancestor's background clip so that e. g., columns in an overflow:hidden block are 1551 // Intersect the fragment with our ancestor's background clip so that e. g., columns in an overflow:hidden block are
1549 // properly clipped by the overflow. 1552 // properly clipped by the overflow.
1550 fragment.intersect(ancestorClipRect.rect()); 1553 fragment.intersect(ancestorClipRect.rect());
1551 1554
1552 // Now intersect with our pagination clip. This will typically mean we'r e just intersecting the dirty rect with the column 1555 // Now intersect with our pagination clip. This will typically mean we'r e just intersecting the dirty rect with the column
1553 // clip, so the column clip ends up being all we apply. 1556 // clip, so the column clip ends up being all we apply.
1554 fragment.intersect(fragment.paginationClip); 1557 fragment.intersect(fragment.paginationClip);
1555 } 1558 }
1559 if (intersectionResult)
1560 *intersectionResult = IntersectingDirtyRect;
1556 } 1561 }
1557 1562
1558 static inline LayoutRect frameVisibleRect(RenderObject* renderer) 1563 static inline LayoutRect frameVisibleRect(RenderObject* renderer)
1559 { 1564 {
1560 FrameView* frameView = renderer->document().view(); 1565 FrameView* frameView = renderer->document().view();
1561 if (!frameView) 1566 if (!frameView)
1562 return LayoutRect(); 1567 return LayoutRect();
1563 1568
1564 return frameView->visibleContentRect(); 1569 return frameView->visibleContentRect();
1565 } 1570 }
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation, 1796 hitLayer = hitTestChildren(NormalFlowChildren, rootLayer, request, result, h itTestRect, hitTestLocation,
1792 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants); 1797 localTransformState.get(), zOffsetForDescendantsPtr, zOffset, unflattenedTransformState.get(), depthSortDescendants);
1793 if (hitLayer) { 1798 if (hitLayer) {
1794 if (!depthSortDescendants) 1799 if (!depthSortDescendants)
1795 return hitLayer; 1800 return hitLayer;
1796 candidateLayer = hitLayer; 1801 candidateLayer = hitLayer;
1797 } 1802 }
1798 1803
1799 // Collect the fragments. This will compute the clip rectangles for each lay er fragment. 1804 // Collect the fragments. This will compute the clip rectangles for each lay er fragment.
1800 LayerFragments layerFragments; 1805 LayerFragments layerFragments;
1801 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec ts, IncludeOverlayScrollbarSize); 1806 collectFragments(layerFragments, 0, rootLayer, hitTestRect, RootRelativeClip Rects, IncludeOverlayScrollbarSize);
1802 1807
1803 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra gments, hitTestLocation)) { 1808 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra gments, hitTestLocation)) {
1804 renderer()->updateHitTestResult(result, hitTestLocation.point()); 1809 renderer()->updateHitTestResult(result, hitTestLocation.point());
1805 return this; 1810 return this;
1806 } 1811 }
1807 1812
1808 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. Check 1813 // Next we want to see if the mouse pos is inside the child RenderObjects of the layer. Check
1809 // every fragment in reverse order. 1814 // every fragment in reverse order.
1810 if (isSelfPaintingLayer()) { 1815 if (isSelfPaintingLayer()) {
1811 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost. 1816 // Hit test with a temporary HitTestResult, because we only want to comm it to 'result' if we know we're frontmost.
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1875 return false; 1880 return false;
1876 } 1881 }
1877 1882
1878 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result, 1883 RenderLayer* RenderLayer::hitTestTransformedLayerInFragments(RenderLayer* rootLa yer, RenderLayer* containerLayer, const HitTestRequest& request, HitTestResult& result,
1879 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) 1884 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset)
1880 { 1885 {
1881 LayerFragments enclosingPaginationFragments; 1886 LayerFragments enclosingPaginationFragments;
1882 LayoutPoint offsetOfPaginationLayerFromRoot; 1887 LayoutPoint offsetOfPaginationLayerFromRoot;
1883 // FIXME: We're missing a sub-pixel offset here crbug.com/348728 1888 // FIXME: We're missing a sub-pixel offset here crbug.com/348728
1884 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RenderLayer::RootOfTransparencyClipBox, LayoutSize()); 1889 LayoutRect transformedExtent = transparencyClipBox(this, enclosingPagination Layer(), HitTestingTransparencyClipBox, RenderLayer::RootOfTransparencyClipBox, LayoutSize());
1885 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, r ootLayer, hitTestRect, 1890 enclosingPaginationLayer()->collectFragments(enclosingPaginationFragments, 0 , rootLayer, hitTestRect,
1886 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent); 1891 RootRelativeClipRects, IncludeOverlayScrollbarSize, RespectOverflowClip, &offsetOfPaginationLayerFromRoot, LayoutSize(), &transformedExtent);
1887 1892
1888 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) { 1893 for (int i = enclosingPaginationFragments.size() - 1; i >= 0; --i) {
1889 const LayerFragment& fragment = enclosingPaginationFragments.at(i); 1894 const LayerFragment& fragment = enclosingPaginationFragments.at(i);
1890 1895
1891 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and 1896 // Apply the page/column clip for this fragment, as well as any clips es tablished by layers in between us and
1892 // the enclosing pagination layer. 1897 // the enclosing pagination layer.
1893 LayoutRect clipRect = fragment.backgroundRect.rect(); 1898 LayoutRect clipRect = fragment.backgroundRect.rect();
1894 1899
1895 // Now compute the clips within a given fragment 1900 // Now compute the clips within a given fragment
(...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 } 2875 }
2871 } 2876 }
2872 2877
2873 void showLayerTree(const blink::RenderObject* renderer) 2878 void showLayerTree(const blink::RenderObject* renderer)
2874 { 2879 {
2875 if (!renderer) 2880 if (!renderer)
2876 return; 2881 return;
2877 showLayerTree(renderer->enclosingLayer()); 2882 showLayerTree(renderer->enclosingLayer());
2878 } 2883 }
2879 #endif 2884 #endif
OLDNEW
« Source/core/paint/LayerPainter.cpp ('K') | « Source/core/rendering/RenderLayer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698