Skip to content

Commit

Permalink
Store less raw pointers in containers in Source/rendering/
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=261545

Reviewed by Darin Adler.

* Source/WTF/wtf/WeakHashMap.h:
* Source/WebCore/dom/Element.cpp:
(WebCore::layoutOverflowRectContainsAllDescendants):
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::adjustVerticalPageScrollStepForFixedContent):
* Source/WebCore/rendering/InlineBoxPainter.cpp:
(WebCore::InlineBoxPainter::paint):
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::insertIntoTrackedRendererMaps):
(WebCore::removeFromTrackedRendererMaps):
(WebCore::PositionedDescendantsMap::addDescendant):
(WebCore::PositionedDescendantsMap::removeDescendant):
(WebCore::PositionedDescendantsMap::removeContainingBlock):
(WebCore::PositionedDescendantsMap::positionedRenderers const):
(WebCore::removeBlockFromPercentageDescendantAndContainerMaps):
(WebCore::RenderBlock::~RenderBlock):
(WebCore::RenderBlock::blockWillBeDestroyed):
(WebCore::RenderBlock::hasRareData const):
(WebCore::getBlockRareData):
(WebCore::ensureBlockRareData):
(WebCore::RenderBlock::addOverflowFromPositionedObjects):
(WebCore::RenderBlock::dirtyForLayoutFromPercentageHeightDescendants):
(WebCore::RenderBlock::layoutPositionedObjects):
(WebCore::RenderBlock::markPositionedObjectsForLayout):
(WebCore::RenderBlock::paintObject):
(WebCore::RenderBlock::addContinuationWithOutline):
(WebCore::RenderBlock::paintsContinuationOutline):
(WebCore::RenderBlock::paintContinuationOutlines):
(WebCore::clipOutPositionedObjects):
(WebCore::RenderBlock::removePositionedObjects):
(WebCore::RenderBlock::percentHeightDescendants const):
(WebCore::RenderBlock::hasPercentHeightDescendant):
(WebCore::RenderBlock::checkPositionedObjectsNeedLayout):
* Source/WebCore/rendering/RenderBlock.h:
(WebCore::RenderBlock::hasPositionedObjects const):
(WebCore::RenderBlock::hasPercentHeightDescendants const):
* Source/WebCore/rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::rebuildFloatingObjectSetFromIntrudingFloats):
(WebCore::RenderBlockFlow::simplifiedNormalFlowLayout):
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::childHasPercentHeightDescendants const):
* Source/WebCore/rendering/RenderInline.cpp:
(WebCore::RenderInline::willBeDestroyed):
* Source/WebCore/rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::relayoutCellIfFlexed):
(WebCore::RenderTableSection::paintObject):
* Source/WebCore/rendering/SelectionRangeData.cpp:
(WebCore::SelectionRangeData::repaint const):

Canonical link: https://commits.webkit.org/268000@main
  • Loading branch information
cdumez committed Sep 14, 2023
1 parent 633de90 commit 8650e88
Show file tree
Hide file tree
Showing 21 changed files with 258 additions and 286 deletions.
2 changes: 1 addition & 1 deletion Source/WTF/wtf/WeakHashMap.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class WeakHashMap final {
return m_map.take(*keyImpl);
}

typename ValueTraits::PeekType get(const KeyType& key)
typename ValueTraits::PeekType get(const KeyType& key) const
{
increaseOperationCountSinceLastCleanup();
auto* keyImpl = keyImplIfExists(key);
Expand Down
14 changes: 7 additions & 7 deletions Source/WebCore/dom/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1687,10 +1687,10 @@ static bool layoutOverflowRectContainsAllDescendants(const RenderBox& renderBox)

// If there are any position:fixed inside of us, game over.
if (auto* viewPositionedObjects = renderBox.view().positionedObjects()) {
for (auto* positionedBox : *viewPositionedObjects) {
if (positionedBox == &renderBox)
for (auto& positionedBox : *viewPositionedObjects) {
if (&positionedBox == &renderBox)
continue;
if (positionedBox->isFixedPositioned() && renderBox.element()->contains(positionedBox->element()))
if (positionedBox.isFixedPositioned() && renderBox.element()->contains(positionedBox.element()))
return false;
}
}
Expand All @@ -1703,10 +1703,10 @@ static bool layoutOverflowRectContainsAllDescendants(const RenderBox& renderBox)
// This renderer may have positioned descendants whose containing block is some ancestor.
if (auto* containingBlock = RenderObject::containingBlockForPositionType(PositionType::Absolute, renderBox)) {
if (auto* positionedObjects = containingBlock->positionedObjects()) {
for (auto* positionedBox : *positionedObjects) {
if (positionedBox == &renderBox)
for (auto& positionedBox : *positionedObjects) {
if (&positionedBox == &renderBox)
continue;
if (renderBox.element()->contains(positionedBox->element()))
if (renderBox.element()->contains(positionedBox.element()))
return false;
}
}
Expand Down Expand Up @@ -1738,7 +1738,7 @@ LayoutRect Element::absoluteEventBounds(bool& boundsIncludeAllDescendantElements
if (RenderFragmentedFlow* fragmentedFlow = box.enclosingFragmentedFlow()) {
bool wasFixed = false;
Vector<FloatQuad> quads;
if (fragmentedFlow->absoluteQuadsForBox(quads, &wasFixed, &box)) {
if (fragmentedFlow->absoluteQuadsForBox(quads, &wasFixed, box)) {
result = LayoutRect(unitedBoundingBoxes(quads));
computedBounds = true;
} else {
Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/page/LocalFrameView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4296,11 +4296,11 @@ float LocalFrameView::adjustVerticalPageScrollStepForFixedContent(float step)
float topObscuredArea = 0;
float bottomObscuredArea = 0;
for (const auto& positionedObject : *positionedObjects) {
const RenderStyle& style = positionedObject->style();
const RenderStyle& style = positionedObject.style();
if (style.position() != PositionType::Fixed || style.visibility() == Visibility::Hidden || !style.opacity())
continue;

FloatQuad contentQuad = positionedObject->absoluteContentQuad();
FloatQuad contentQuad = positionedObject.absoluteContentQuad();
if (!contentQuad.isRectilinear())
continue;

Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/rendering/InlineBoxPainter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ void InlineBoxPainter::paint()
if (containingBlockPaintsContinuationOutline) {
// Add ourselves to the containing block of the entire continuation so that it can
// paint us atomically.
containingBlock->addContinuationWithOutline(downcast<RenderInline>(renderer().element()->renderer()));
containingBlock->addContinuationWithOutline(*downcast<RenderInline>(renderer().element()->renderer()));
} else if (!inlineFlow.isContinuation())
m_paintInfo.outlineObjects->add(inlineFlow);

Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/rendering/LegacyLineLayout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2158,12 +2158,12 @@ void LegacyLineLayout::addOverflowFromInlineChildren()
m_flow.addLayoutOverflow(curr->paddedLayoutOverflowRect(endPadding));
RenderFragmentContainer* fragment = m_flow.enclosingFragmentedFlow() ? curr->containingFragment() : nullptr;
if (fragment)
fragment->addLayoutOverflowForBox(&m_flow, curr->paddedLayoutOverflowRect(endPadding));
fragment->addLayoutOverflowForBox(m_flow, curr->paddedLayoutOverflowRect(endPadding));
if (!m_flow.hasNonVisibleOverflow()) {
LayoutRect childVisualOverflowRect = curr->visualOverflowRect(curr->lineTop(), curr->lineBottom());
m_flow.addVisualOverflow(childVisualOverflowRect);
if (fragment)
fragment->addVisualOverflowForBox(&m_flow, childVisualOverflowRect);
fragment->addVisualOverflowForBox(m_flow, childVisualOverflowRect);
}
}
}
Expand Down
Loading

0 comments on commit 8650e88

Please sign in to comment.