Diff
Modified: trunk/Source/WebCore/ChangeLog (262132 => 262133)
--- trunk/Source/WebCore/ChangeLog 2020-05-26 00:26:39 UTC (rev 262132)
+++ trunk/Source/WebCore/ChangeLog 2020-05-26 00:27:12 UTC (rev 262133)
@@ -1,5 +1,24 @@
2020-05-25 Simon Fraser <[email protected]>
+ Use an Optional<> for LayerFragment::boundingBox
+ https://bugs.webkit.org/show_bug.cgi?id=212358
+
+ Reviewed by Zalan Bujtas.
+
+ Replace a bool + LayoutRect with Optional<LayoutRect>.
+
+ * rendering/LayerFragment.h:
+ (WebCore::LayerFragment::setRects):
+ (WebCore::LayerFragment::moveBy):
+ (WebCore::LayerFragment::intersect):
+ * rendering/RenderLayer.cpp:
+ (WebCore::RenderLayer::collectFragments):
+ (WebCore::RenderLayer::updatePaintingInfoForFragments):
+ (WebCore::RenderLayer::calculateClipRects const):
+ * rendering/RenderLayer.h:
+
+2020-05-25 Simon Fraser <[email protected]>
+
Make isTableRow() an inline function
https://bugs.webkit.org/show_bug.cgi?id=212360
Modified: trunk/Source/WebCore/rendering/LayerFragment.h (262132 => 262133)
--- trunk/Source/WebCore/rendering/LayerFragment.h 2020-05-26 00:26:39 UTC (rev 262132)
+++ trunk/Source/WebCore/rendering/LayerFragment.h 2020-05-26 00:27:12 UTC (rev 262133)
@@ -33,15 +33,12 @@
public:
LayerFragment() = default;
- void setRects(const LayoutRect& bounds, const ClipRect& background, const ClipRect& foreground, const LayoutRect* bbox)
+ void setRects(const LayoutRect& bounds, const ClipRect& background, const ClipRect& foreground, const Optional<LayoutRect>& bbox)
{
layerBounds = bounds;
backgroundRect = background;
foregroundRect = foreground;
- if (bbox) {
- boundingBox = *bbox;
- hasBoundingBox = true;
- }
+ boundingBox = bbox;
}
void moveBy(const LayoutPoint& offset)
@@ -50,7 +47,8 @@
backgroundRect.moveBy(offset);
foregroundRect.moveBy(offset);
paginationClip.moveBy(offset);
- boundingBox.moveBy(offset);
+ if (boundingBox)
+ boundingBox->moveBy(offset);
}
void intersect(const LayoutRect& rect)
@@ -57,7 +55,8 @@
{
backgroundRect.intersect(rect);
foregroundRect.intersect(rect);
- boundingBox.intersect(rect);
+ if (boundingBox)
+ boundingBox->intersect(rect);
}
void intersect(const ClipRect& clipRect)
@@ -67,11 +66,11 @@
}
bool shouldPaintContent = false;
- bool hasBoundingBox = false;
+ Optional<LayoutRect> boundingBox;
+
LayoutRect layerBounds;
ClipRect backgroundRect;
ClipRect foregroundRect;
- LayoutRect boundingBox;
// Unique to paginated fragments. The physical translation to apply to shift the layer when painting/hit-testing.
LayoutSize paginationOffset;
Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (262132 => 262133)
--- trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-05-26 00:26:39 UTC (rev 262132)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp 2020-05-26 00:27:12 UTC (rev 262133)
@@ -4874,7 +4874,7 @@
LayerFragment& fragment = fragments.at(i);
// Set our four rects with all clipping applied that was internal to the flow thread.
- fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, &layerBoundingBoxInFragmentedFlow);
+ fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, layerBoundingBoxInFragmentedFlow);
// Shift to the root-relative physical position used when painting the flow thread in this fragment.
fragment.moveBy(toLayoutPoint(ancestorFragment.paginationOffset + fragment.paginationOffset + offsetWithinParentPaginatedLayer));
@@ -4917,7 +4917,7 @@
for (auto& fragment : fragments) {
// Set our four rects with all clipping applied that was internal to the flow thread.
- fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, &layerBoundingBoxInFragmentedFlow);
+ fragment.setRects(layerBoundsInFragmentedFlow, backgroundRectInFragmentedFlow, foregroundRectInFragmentedFlow, layerBoundingBoxInFragmentedFlow);
// Shift to the root-relative physical position used when painting the flow thread in this fragment.
fragment.moveBy(toLayoutPoint(fragment.paginationOffset + offsetOfPaginationLayerFromRoot));
@@ -4942,7 +4942,7 @@
fragment.shouldPaintContent = shouldPaintContent;
if (this != localPaintingInfo.rootLayer || !(localPaintFlags & PaintLayerPaintingOverflowContents)) {
LayoutSize newOffsetFromRoot = offsetFromRoot + fragment.paginationOffset;
- fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, newOffsetFromRoot, fragment.hasBoundingBox ? &fragment.boundingBox : 0);
+ fragment.shouldPaintContent &= intersectsDamageRect(fragment.layerBounds, fragment.backgroundRect.rect(), localPaintingInfo.rootLayer, newOffsetFromRoot, fragment.boundingBox);
}
}
}
@@ -5995,7 +5995,7 @@
renderer().repaintRectangle(rect);
}
-bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const LayoutRect* cachedBoundingBox) const
+bool RenderLayer::intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const Optional<LayoutRect>& cachedBoundingBox) const
{
// Always examine the canvas and the root.
// FIXME: Could eliminate the isDocumentElementRenderer() check if we fix background painting so that the RenderView
Modified: trunk/Source/WebCore/rendering/RenderLayer.h (262132 => 262133)
--- trunk/Source/WebCore/rendering/RenderLayer.h 2020-05-26 00:26:39 UTC (rev 262132)
+++ trunk/Source/WebCore/rendering/RenderLayer.h 2020-05-26 00:27:12 UTC (rev 262133)
@@ -733,7 +733,7 @@
bool clipCrossesPaintingBoundary() const;
// Pass offsetFromRoot if known.
- bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const LayoutRect* cachedBoundingBox = nullptr) const;
+ bool intersectsDamageRect(const LayoutRect& layerBounds, const LayoutRect& damageRect, const RenderLayer* rootLayer, const LayoutSize& offsetFromRoot, const Optional<LayoutRect>& cachedBoundingBox = WTF::nullopt) const;
enum CalculateLayerBoundsFlag {
IncludeSelfTransform = 1 << 0,