Diff
Modified: trunk/Source/WebCore/ChangeLog (290224 => 290225)
--- trunk/Source/WebCore/ChangeLog 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/ChangeLog 2022-02-20 14:17:30 UTC (rev 290225)
@@ -1,3 +1,36 @@
+2022-02-20 Alan Bujtas <[email protected]>
+
+ RenderBox::flipForWritingModeForChild should take const RenderBox& as the child renderer
+ https://bugs.webkit.org/show_bug.cgi?id=236895
+
+ Reviewed by Antti Koivisto.
+
+ * rendering/LegacyInlineElementBox.cpp:
+ (WebCore::LegacyInlineElementBox::paint):
+ (WebCore::LegacyInlineElementBox::nodeAtPoint):
+ * rendering/RenderBlock.cpp:
+ (WebCore::RenderBlock::paintChild):
+ (WebCore::RenderBlock::hitTestContents):
+ (WebCore::RenderBlock::paintExcludedChildrenInBorder):
+ (WebCore::RenderBlock::hitTestExcludedChildrenInBorder):
+ * rendering/RenderBlockFlow.cpp:
+ (WebCore::RenderBlockFlow::paintColumnRules):
+ * rendering/RenderBox.cpp:
+ (WebCore::RenderBox::flipForWritingModeForChild const):
+ (WebCore::RenderBox::topLeftLocation const):
+ * rendering/RenderBox.h:
+ * rendering/RenderFlexibleBox.cpp:
+ (WebCore::RenderFlexibleBox::hitTestChildren):
+ * rendering/RenderTable.cpp:
+ (WebCore::RenderTable::paintObject):
+ (WebCore::RenderTable::nodeAtPoint):
+ * rendering/RenderTableRow.cpp:
+ (WebCore::RenderTableRow::nodeAtPoint):
+ * rendering/RenderTableSection.cpp:
+ (WebCore::RenderTableSection::paintCell):
+ (WebCore::RenderTableSection::paintObject):
+ (WebCore::RenderTableSection::nodeAtPoint):
+
2022-02-19 Chris Dumez <[email protected]>
Optimize DOM storage event dispatch
Modified: trunk/Source/WebCore/rendering/LegacyInlineElementBox.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/LegacyInlineElementBox.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/LegacyInlineElementBox.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -76,7 +76,7 @@
LayoutPoint childPoint = paintOffset;
if (is<RenderBox>(renderer()) && parent()->renderer().style().isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
- childPoint = renderer().containingBlock()->flipForWritingModeForChild(&downcast<RenderBox>(renderer()), childPoint);
+ childPoint = renderer().containingBlock()->flipForWritingModeForChild(downcast<RenderBox>(renderer()), childPoint);
renderer().paintAsInlineBlock(paintInfo, childPoint);
}
@@ -89,7 +89,7 @@
// specification.)
LayoutPoint childPoint = accumulatedOffset;
if (is<RenderBox>(renderer()) && parent()->renderer().style().isFlippedBlocksWritingMode()) // Faster than calling containingBlock().
- childPoint = renderer().containingBlock()->flipForWritingModeForChild(&downcast<RenderBox>(renderer()), childPoint);
+ childPoint = renderer().containingBlock()->flipForWritingModeForChild(downcast<RenderBox>(renderer()), childPoint);
return renderer().hitTest(request, result, locationInContainer, childPoint);
}
Modified: trunk/Source/WebCore/rendering/RenderBlock.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderBlock.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderBlock.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -1195,7 +1195,7 @@
}
}
- LayoutPoint childPoint = flipForWritingModeForChild(&child, paintOffset);
+ LayoutPoint childPoint = flipForWritingModeForChild(child, paintOffset);
if (!child.hasSelfPaintingLayer() && !child.isFloating()) {
if (paintType == PaintAsInlineBlock)
child.paintAsInlineBlock(paintInfoForChild, childPoint);
@@ -2102,7 +2102,7 @@
if (hitTestAction == HitTestChildBlockBackgrounds)
childHitTest = HitTestChildBlockBackground;
for (auto* child = lastChildBox(); child; child = child->previousSiblingBox()) {
- LayoutPoint childPoint = flipForWritingModeForChild(child, accumulatedOffset);
+ LayoutPoint childPoint = flipForWritingModeForChild(*child, accumulatedOffset);
if (!child->hasSelfPaintingLayer() && !child->isFloating() && child->nodeAtPoint(request, result, locationInContainer, childPoint, childHitTest))
return true;
}
@@ -3467,7 +3467,7 @@
if (!box || !box->isExcludedFromNormalLayout() || box->hasSelfPaintingLayer())
return;
- LayoutPoint childPoint = flipForWritingModeForChild(box, paintOffset);
+ LayoutPoint childPoint = flipForWritingModeForChild(*box, paintOffset);
box->paintAsInlineBlock(paintInfo, childPoint);
}
@@ -3483,7 +3483,7 @@
HitTestAction childHitTest = hitTestAction;
if (hitTestAction == HitTestChildBlockBackgrounds)
childHitTest = HitTestChildBlockBackground;
- LayoutPoint childPoint = flipForWritingModeForChild(legend, accumulatedOffset);
+ LayoutPoint childPoint = flipForWritingModeForChild(*legend, accumulatedOffset);
return legend->nodeAtPoint(request, result, locationInContainer, childPoint, childHitTest);
}
Modified: trunk/Source/WebCore/rendering/RenderBlockFlow.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderBlockFlow.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -2157,7 +2157,7 @@
// Iterate over our children and paint the column rules as needed.
for (auto& columnSet : childrenOfType<RenderMultiColumnSet>(*this)) {
- LayoutPoint childPoint = columnSet.location() + flipForWritingModeForChild(&columnSet, point);
+ LayoutPoint childPoint = columnSet.location() + flipForWritingModeForChild(columnSet, point);
columnSet.paintColumnRules(paintInfo, childPoint);
}
}
Modified: trunk/Source/WebCore/rendering/RenderBox.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderBox.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderBox.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -5266,7 +5266,7 @@
return adjustedPositionRelativeToOffsetParent(topLeftLocation()).y();
}
-LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox* child, const LayoutPoint& point) const
+LayoutPoint RenderBox::flipForWritingModeForChild(const RenderBox& child, const LayoutPoint& point) const
{
if (!style().isFlippedBlocksWritingMode())
return point;
@@ -5274,8 +5274,8 @@
// The child is going to add in its x() and y(), so we have to make sure it ends up in
// the right place.
if (isHorizontalWritingMode())
- return LayoutPoint(point.x(), point.y() + height() - child->height() - (2 * child->y()));
- return LayoutPoint(point.x() + width() - child->width() - (2 * child->x()), point.y());
+ return LayoutPoint(point.x(), point.y() + height() - child.height() - (2 * child.y()));
+ return LayoutPoint(point.x() + width() - child.width() - (2 * child.x()), point.y());
}
void RenderBox::flipForWritingMode(LayoutRect& rect) const
@@ -5336,7 +5336,7 @@
RenderBlock* containerBlock = containingBlock();
if (!containerBlock || containerBlock == this)
return location();
- return containerBlock->flipForWritingModeForChild(this, location());
+ return containerBlock->flipForWritingModeForChild(*this, location());
}
LayoutSize RenderBox::topLeftLocationOffset() const
Modified: trunk/Source/WebCore/rendering/RenderBox.h (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderBox.h 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderBox.h 2022-02-20 14:17:30 UTC (rev 290225)
@@ -583,7 +583,7 @@
LayoutUnit offsetLeft() const override;
LayoutUnit offsetTop() const override;
- LayoutPoint flipForWritingModeForChild(const RenderBox* child, const LayoutPoint&) const;
+ LayoutPoint flipForWritingModeForChild(const RenderBox& child, const LayoutPoint&) const;
LayoutUnit flipForWritingMode(LayoutUnit position) const; // The offset is in the block direction (y for horizontal writing modes, x for vertical writing modes).
LayoutPoint flipForWritingMode(const LayoutPoint&) const;
LayoutSize flipForWritingMode(const LayoutSize&) const;
Modified: trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderFlexibleBox.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -345,7 +345,7 @@
for (auto* child : reversedOrderIteratorForHitTesting) {
if (child->hasSelfPaintingLayer())
continue;
- auto childPoint = flipForWritingModeForChild(child, scrolledOffset);
+ auto childPoint = flipForWritingModeForChild(*child, scrolledOffset);
if (child->hitTest(request, result, locationInContainer, childPoint)) {
updateHitTestResult(result, flipForWritingMode(toLayoutPoint(locationInContainer.point() - adjustedLocation)));
return true;
Modified: trunk/Source/WebCore/rendering/RenderTable.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderTable.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderTable.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -738,7 +738,7 @@
for (auto& box : childrenOfType<RenderBox>(*this)) {
if (!box.hasSelfPaintingLayer() && (box.isTableSection() || box.isTableCaption())) {
- LayoutPoint childPoint = flipForWritingModeForChild(&box, paintOffset);
+ LayoutPoint childPoint = flipForWritingModeForChild(box, paintOffset);
box.paint(info, childPoint);
}
}
@@ -752,7 +752,7 @@
for (size_t i = 0; i < count; ++i) {
m_currentBorder = &m_collapsedBorders[i];
for (RenderTableSection* section = bottomSection(); section; section = sectionAbove(section)) {
- LayoutPoint childPoint = flipForWritingModeForChild(section, paintOffset);
+ LayoutPoint childPoint = flipForWritingModeForChild(*section, paintOffset);
section->paint(info, childPoint);
}
}
@@ -1569,7 +1569,7 @@
if (!hasNonVisibleOverflow() || locationInContainer.intersects(overflowClipRect(adjustedLocation, nullptr))) {
for (RenderObject* child = lastChild(); child; child = child->previousSibling()) {
if (is<RenderBox>(*child) && !downcast<RenderBox>(*child).hasSelfPaintingLayer() && (child->isTableSection() || child->isTableCaption())) {
- LayoutPoint childPoint = flipForWritingModeForChild(downcast<RenderBox>(child), adjustedLocation);
+ LayoutPoint childPoint = flipForWritingModeForChild(*downcast<RenderBox>(child), adjustedLocation);
if (child->nodeAtPoint(request, result, locationInContainer, childPoint, action)) {
updateHitTestResult(result, toLayoutPoint(locationInContainer.point() - childPoint));
return true;
Modified: trunk/Source/WebCore/rendering/RenderTableRow.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderTableRow.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderTableRow.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -195,7 +195,7 @@
// table-specific hit-test method (which we should do for performance reasons anyway),
// then we can remove this check.
if (!cell->hasSelfPaintingLayer()) {
- LayoutPoint cellPoint = flipForWritingModeForChild(cell, accumulatedOffset);
+ LayoutPoint cellPoint = flipForWritingModeForChild(*cell, accumulatedOffset);
if (cell->nodeAtPoint(request, result, locationInContainer, cellPoint, action)) {
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(cellPoint));
return true;
Modified: trunk/Source/WebCore/rendering/RenderTableSection.cpp (290224 => 290225)
--- trunk/Source/WebCore/rendering/RenderTableSection.cpp 2022-02-20 13:14:51 UTC (rev 290224)
+++ trunk/Source/WebCore/rendering/RenderTableSection.cpp 2022-02-20 14:17:30 UTC (rev 290225)
@@ -933,7 +933,7 @@
void RenderTableSection::paintCell(RenderTableCell* cell, PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
- LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset);
+ LayoutPoint cellPoint = flipForWritingModeForChild(*cell, paintOffset);
PaintPhase paintPhase = paintInfo.phase;
RenderTableRow& row = downcast<RenderTableRow>(*cell->parent());
@@ -1229,7 +1229,7 @@
shouldPaintRowGroupBorder = false;
}
- LayoutPoint cellPoint = flipForWritingModeForChild(cell, paintOffset);
+ LayoutPoint cellPoint = flipForWritingModeForChild(*cell, paintOffset);
cell->paintCollapsedBorders(paintInfo, cellPoint);
}
}
@@ -1291,7 +1291,7 @@
if (paintInfo.phase == PaintPhase::CollapsedTableBorders) {
for (unsigned i = cells.size(); i > 0; --i) {
- LayoutPoint cellPoint = flipForWritingModeForChild(cells[i - 1], paintOffset);
+ LayoutPoint cellPoint = flipForWritingModeForChild(*cells[i - 1], paintOffset);
cells[i - 1]->paintCollapsedBorders(paintInfo, cellPoint);
}
} else {
@@ -1465,7 +1465,7 @@
// table-specific hit-test method (which we should do for performance reasons anyway),
// then we can remove this check.
if (!row->hasSelfPaintingLayer()) {
- LayoutPoint childPoint = flipForWritingModeForChild(row, adjustedLocation);
+ LayoutPoint childPoint = flipForWritingModeForChild(*row, adjustedLocation);
if (row->nodeAtPoint(request, result, locationInContainer, childPoint, action)) {
updateHitTestResult(result, toLayoutPoint(locationInContainer.point() - childPoint));
return true;
@@ -1496,7 +1496,7 @@
for (unsigned i = current.cells.size() ; i; ) {
--i;
RenderTableCell* cell = current.cells[i];
- LayoutPoint cellPoint = flipForWritingModeForChild(cell, adjustedLocation);
+ LayoutPoint cellPoint = flipForWritingModeForChild(*cell, adjustedLocation);
if (static_cast<RenderObject*>(cell)->nodeAtPoint(request, result, locationInContainer, cellPoint, action)) {
updateHitTestResult(result, locationInContainer.point() - toLayoutSize(cellPoint));
return true;