Modified: trunk/Source/WebCore/rendering/RenderListMarker.cpp (242920 => 242921)
--- trunk/Source/WebCore/rendering/RenderListMarker.cpp 2019-03-13 23:37:32 UTC (rev 242920)
+++ trunk/Source/WebCore/rendering/RenderListMarker.cpp 2019-03-13 23:46:05 UTC (rev 242921)
@@ -1121,7 +1121,7 @@
RenderListMarker::RenderListMarker(RenderListItem& listItem, RenderStyle&& style)
: RenderBox(listItem.document(), WTFMove(style), 0)
- , m_listItem(listItem)
+ , m_listItem(makeWeakPtr(listItem))
{
// init RenderObject attributes
setInline(true); // our object is Inline
@@ -1209,7 +1209,7 @@
if (selectionState() != SelectionNone) {
LayoutRect selRect = localSelectionRect();
selRect.moveBy(boxOrigin);
- context.fillRect(snappedIntRect(selRect), m_listItem.selectionBackgroundColor());
+ context.fillRect(snappedIntRect(selRect), m_listItem->selectionBackgroundColor());
}
return;
}
@@ -1217,7 +1217,7 @@
if (selectionState() != SelectionNone) {
LayoutRect selRect = localSelectionRect();
selRect.moveBy(boxOrigin);
- context.fillRect(snappedIntRect(selRect), m_listItem.selectionBackgroundColor());
+ context.fillRect(snappedIntRect(selRect), m_listItem->selectionBackgroundColor());
}
const Color color(style().visitedDependentColorWithColorFilter(CSSPropertyColor));
@@ -1342,7 +1342,7 @@
if (type == ListStyleType::Asterisks || type == ListStyleType::Footnotes)
context.drawText(font, textRun, textOrigin);
else {
- const UChar suffix = listMarkerSuffix(type, m_listItem.value());
+ const UChar suffix = listMarkerSuffix(type, m_listItem->value());
// Text is not arbitrary. We can judge whether it's RTL from the first character,
// and we only need to handle the direction U_RIGHT_TO_LEFT for now.
@@ -1381,12 +1381,12 @@
ASSERT(needsLayout());
LayoutUnit blockOffset;
- for (auto* ancestor = parentBox(); ancestor && ancestor != &m_listItem; ancestor = ancestor->parentBox())
+ for (auto* ancestor = parentBox(); ancestor && ancestor != m_listItem.get(); ancestor = ancestor->parentBox())
blockOffset += ancestor->logicalTop();
if (style().isLeftToRightDirection())
- m_lineOffsetForListItem = m_listItem.logicalLeftOffsetForLine(blockOffset, DoNotIndentText, 0_lu);
+ m_lineOffsetForListItem = m_listItem->logicalLeftOffsetForLine(blockOffset, DoNotIndentText, 0_lu);
else
- m_lineOffsetForListItem = m_listItem.logicalRightOffsetForLine(blockOffset, DoNotIndentText, 0_lu);
+ m_lineOffsetForListItem = m_listItem->logicalRightOffsetForLine(blockOffset, DoNotIndentText, 0_lu);
if (isImage()) {
updateMarginsAndContent();
@@ -1533,7 +1533,7 @@
case ListStyleType::UpperNorwegian:
case ListStyleType::UpperRoman:
case ListStyleType::Urdu:
- m_text = listMarkerText(type, m_listItem.value());
+ m_text = listMarkerText(type, m_listItem->value());
break;
}
}
@@ -1649,7 +1649,7 @@
else {
TextRun run = RenderBlock::constructTextRun(m_text, style());
LayoutUnit itemWidth = font.width(run);
- UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' };
+ UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' };
LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(suffixSpace, 2, style()));
logicalWidth = itemWidth + suffixSpaceWidth;
}
@@ -1732,7 +1732,7 @@
LayoutUnit RenderListMarker::lineHeight(bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
if (!isImage())
- return m_listItem.lineHeight(firstLine, direction, PositionOfInteriorLineBoxes);
+ return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLineBoxes);
return RenderBox::lineHeight(firstLine, direction, linePositionMode);
}
@@ -1739,7 +1739,7 @@
int RenderListMarker::baselinePosition(FontBaseline baselineType, bool firstLine, LineDirectionMode direction, LinePositionMode linePositionMode) const
{
if (!isImage())
- return m_listItem.baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
+ return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);
return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode);
}
@@ -1746,7 +1746,7 @@
String RenderListMarker::suffix() const
{
ListStyleType type = style().listStyleType();
- const UChar suffix = listMarkerSuffix(type, m_listItem.value());
+ const UChar suffix = listMarkerSuffix(type, m_listItem->value());
if (suffix == ' ')
return " "_str;
@@ -1766,7 +1766,7 @@
bool RenderListMarker::isInside() const
{
- return m_listItem.notInList() || style().listStylePosition() == ListStylePosition::Inside;
+ return m_listItem->notInList() || style().listStylePosition() == ListStylePosition::Inside;
}
FloatRect RenderListMarker::getRelativeMarkerRect()
@@ -1876,7 +1876,7 @@
const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(m_text, style());
float itemWidth = font.width(run);
- UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' };
+ UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' };
float suffixSpaceWidth = font.width(RenderBlock::constructTextRun(suffixSpace, 2, style()));
relativeRect = FloatRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height());
}