Changeset 262133 in webkit
- Timestamp:
- May 25, 2020 5:27:12 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r262132 r262133 1 2020-05-25 Simon Fraser <simon.fraser@apple.com> 2 3 Use an Optional<> for LayerFragment::boundingBox 4 https://bugs.webkit.org/show_bug.cgi?id=212358 5 6 Reviewed by Zalan Bujtas. 7 8 Replace a bool + LayoutRect with Optional<LayoutRect>. 9 10 * rendering/LayerFragment.h: 11 (WebCore::LayerFragment::setRects): 12 (WebCore::LayerFragment::moveBy): 13 (WebCore::LayerFragment::intersect): 14 * rendering/RenderLayer.cpp: 15 (WebCore::RenderLayer::collectFragments): 16 (WebCore::RenderLayer::updatePaintingInfoForFragments): 17 (WebCore::RenderLayer::calculateClipRects const): 18 * rendering/RenderLayer.h: 19 1 20 2020-05-25 Simon Fraser <simon.fraser@apple.com> 2 21 -
trunk/Source/WebCore/rendering/LayerFragment.h
r208668 r262133 34 34 LayerFragment() = default; 35 35 36 void setRects(const LayoutRect& bounds, const ClipRect& background, const ClipRect& foreground, const LayoutRect*bbox)36 void setRects(const LayoutRect& bounds, const ClipRect& background, const ClipRect& foreground, const Optional<LayoutRect>& bbox) 37 37 { 38 38 layerBounds = bounds; 39 39 backgroundRect = background; 40 40 foregroundRect = foreground; 41 if (bbox) { 42 boundingBox = *bbox; 43 hasBoundingBox = true; 44 } 41 boundingBox = bbox; 45 42 } 46 43 … … 51 48 foregroundRect.moveBy(offset); 52 49 paginationClip.moveBy(offset); 53 boundingBox.moveBy(offset); 50 if (boundingBox) 51 boundingBox->moveBy(offset); 54 52 } 55 53 … … 58 56 backgroundRect.intersect(rect); 59 57 foregroundRect.intersect(rect); 60 boundingBox.intersect(rect); 58 if (boundingBox) 59 boundingBox->intersect(rect); 61 60 } 62 61 … … 68 67 69 68 bool shouldPaintContent = false; 70 bool hasBoundingBox = false; 69 Optional<LayoutRect> boundingBox; 70 71 71 LayoutRect layerBounds; 72 72 ClipRect backgroundRect; 73 73 ClipRect foregroundRect; 74 LayoutRect boundingBox;75 74 76 75 // Unique to paginated fragments. The physical translation to apply to shift the layer when painting/hit-testing. -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r262128 r262133 4875 4875 4876 4876 // Set our four rects with all clipping applied that was internal to the flow thread. 4877 fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, &layerBoundingBoxInFragmentedFlow);4877 fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, layerBoundingBoxInFragmentedFlow); 4878 4878 4879 4879 // Shift to the root-relative physical position used when painting the flow thread in this fragment. … … 4918 4918 for (auto& fragment : fragments) { 4919 4919 // Set our four rects with all clipping applied that was internal to the flow thread. 4920 fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, &layerBoundingBoxInFragmentedFlow);4920 fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, layerBoundingBoxInFragmentedFlow); 4921 4921 4922 4922 // Shift to the root-relative physical position used when painting the flow thread in this fragment. … … 4943 4943 if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) { 4944 4944 LayoutSize newOffsetFromRoot = offsetFromRoot + fragment.paginationOffset; 4945 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, newOffsetFromRoot, fragment. hasBoundingBox ? &fragment.boundingBox : 0);4945 fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, newOffsetFromRoot, fragment.boundingBox); 4946 4946 } 4947 4947 } … … 5996 5996 } 5997 5997 5998 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const LayoutRect*cachedBoundingBox) const5998 bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const Optional<LayoutRect>& cachedBoundingBox) const 5999 5999 { 6000 6000 // Always examine the canvas and the root. -
trunk/Source/WebCore/rendering/RenderLayer.h
r261575 r262133 734 734 735 735 // Pass offsetFromRoot if known. 736 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const LayoutRect* cachedBoundingBox = nullptr) const;736 bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const Optional<LayoutRect>& cachedBoundingBox = WTF::nullopt) const; 737 737 738 738 enum CalculateLayerBoundsFlag {
Note: See TracChangeset
for help on using the changeset viewer.