Changeset 244004 in webkit
- Timestamp:
- Apr 8, 2019, 5:38:52 AM (7 years ago)
- Location:
- releases/WebKitGTK/webkit-2.24/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
rendering/RenderListMarker.cpp (modified) (12 diffs)
-
rendering/RenderListMarker.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
releases/WebKitGTK/webkit-2.24/Source/WebCore/ChangeLog
r244003 r244004 1 2019-03-13 Zalan Bujtas <zalan@apple.com> 2 3 [WeakPtr] RenderListMarker::m_listItem should be a WeakPtr 4 https://bugs.webkit.org/show_bug.cgi?id=195704 5 <rdar://problem/48486278> 6 7 Reviewed by Simon Fraser. 8 9 * rendering/RenderListMarker.cpp: 10 (WebCore::RenderListMarker::RenderListMarker): 11 (WebCore::RenderListMarker::paint): 12 (WebCore::RenderListMarker::layout): 13 (WebCore::RenderListMarker::updateContent): 14 (WebCore::RenderListMarker::computePreferredLogicalWidths): 15 (WebCore::RenderListMarker::lineHeight const): 16 (WebCore::RenderListMarker::baselinePosition const): 17 (WebCore::RenderListMarker::suffix const): 18 (WebCore::RenderListMarker::isInside const): 19 (WebCore::RenderListMarker::getRelativeMarkerRect): 20 * rendering/RenderListMarker.h: 21 1 22 2019-03-13 Zalan Bujtas <zalan@apple.com> 2 23 -
releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderListMarker.cpp
r240641 r244004 1122 1122 RenderListMarker::RenderListMarker(RenderListItem& listItem, RenderStyle&& style) 1123 1123 : RenderBox(listItem.document(), WTFMove(style), 0) 1124 , m_listItem( listItem)1124 , m_listItem(makeWeakPtr(listItem)) 1125 1125 { 1126 1126 // init RenderObject attributes … … 1210 1210 LayoutRect selRect = localSelectionRect(); 1211 1211 selRect.moveBy(boxOrigin); 1212 context.fillRect(snappedIntRect(selRect), m_listItem .selectionBackgroundColor());1212 context.fillRect(snappedIntRect(selRect), m_listItem->selectionBackgroundColor()); 1213 1213 } 1214 1214 return; … … 1218 1218 LayoutRect selRect = localSelectionRect(); 1219 1219 selRect.moveBy(boxOrigin); 1220 context.fillRect(snappedIntRect(selRect), m_listItem .selectionBackgroundColor());1220 context.fillRect(snappedIntRect(selRect), m_listItem->selectionBackgroundColor()); 1221 1221 } 1222 1222 … … 1343 1343 context.drawText(font, textRun, textOrigin); 1344 1344 else { 1345 const UChar suffix = listMarkerSuffix(type, m_listItem .value());1345 const UChar suffix = listMarkerSuffix(type, m_listItem->value()); 1346 1346 1347 1347 // Text is not arbitrary. We can judge whether it's RTL from the first character, … … 1382 1382 1383 1383 LayoutUnit blockOffset; 1384 for (auto* ancestor = parentBox(); ancestor && ancestor != &m_listItem; ancestor = ancestor->parentBox())1384 for (auto* ancestor = parentBox(); ancestor && ancestor != m_listItem.get(); ancestor = ancestor->parentBox()) 1385 1385 blockOffset += ancestor->logicalTop(); 1386 1386 if (style().isLeftToRightDirection()) 1387 m_lineOffsetForListItem = m_listItem .logicalLeftOffsetForLine(blockOffset, DoNotIndentText, 0_lu);1387 m_lineOffsetForListItem = m_listItem->logicalLeftOffsetForLine(blockOffset, DoNotIndentText, 0_lu); 1388 1388 else 1389 m_lineOffsetForListItem = m_listItem .logicalRightOffsetForLine(blockOffset, DoNotIndentText, 0_lu);1389 m_lineOffsetForListItem = m_listItem->logicalRightOffsetForLine(blockOffset, DoNotIndentText, 0_lu); 1390 1390 1391 1391 if (isImage()) { … … 1534 1534 case ListStyleType::UpperRoman: 1535 1535 case ListStyleType::Urdu: 1536 m_text = listMarkerText(type, m_listItem .value());1536 m_text = listMarkerText(type, m_listItem->value()); 1537 1537 break; 1538 1538 } … … 1650 1650 TextRun run = RenderBlock::constructTextRun(m_text, style()); 1651 1651 LayoutUnit itemWidth = font.width(run); 1652 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem .value()), ' ' };1652 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' }; 1653 1653 LayoutUnit suffixSpaceWidth = font.width(RenderBlock::constructTextRun(suffixSpace, 2, style())); 1654 1654 logicalWidth = itemWidth + suffixSpaceWidth; … … 1733 1733 { 1734 1734 if (!isImage()) 1735 return m_listItem .lineHeight(firstLine, direction, PositionOfInteriorLineBoxes);1735 return m_listItem->lineHeight(firstLine, direction, PositionOfInteriorLineBoxes); 1736 1736 return RenderBox::lineHeight(firstLine, direction, linePositionMode); 1737 1737 } … … 1740 1740 { 1741 1741 if (!isImage()) 1742 return m_listItem .baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes);1742 return m_listItem->baselinePosition(baselineType, firstLine, direction, PositionOfInteriorLineBoxes); 1743 1743 return RenderBox::baselinePosition(baselineType, firstLine, direction, linePositionMode); 1744 1744 } … … 1747 1747 { 1748 1748 ListStyleType type = style().listStyleType(); 1749 const UChar suffix = listMarkerSuffix(type, m_listItem .value());1749 const UChar suffix = listMarkerSuffix(type, m_listItem->value()); 1750 1750 1751 1751 if (suffix == ' ') … … 1767 1767 bool RenderListMarker::isInside() const 1768 1768 { 1769 return m_listItem .notInList() || style().listStylePosition() == ListStylePosition::Inside;1769 return m_listItem->notInList() || style().listStylePosition() == ListStylePosition::Inside; 1770 1770 } 1771 1771 … … 1877 1877 TextRun run = RenderBlock::constructTextRun(m_text, style()); 1878 1878 float itemWidth = font.width(run); 1879 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem .value()), ' ' };1879 UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem->value()), ' ' }; 1880 1880 float suffixSpaceWidth = font.width(RenderBlock::constructTextRun(suffixSpace, 2, style())); 1881 1881 relativeRect = FloatRect(0, 0, itemWidth + suffixSpaceWidth, font.fontMetrics().height()); -
releases/WebKitGTK/webkit-2.24/Source/WebCore/rendering/RenderListMarker.h
r232178 r244004 48 48 void updateMarginsAndContent(); 49 49 50 #if !ASSERT_DISABLED51 RenderListItem& listItem() const { return m_listItem; }52 #endif53 54 50 private: 55 51 void willBeDestroyed() override; … … 91 87 String m_text; 92 88 RefPtr<StyleImage> m_image; 93 RenderListItem&m_listItem;89 WeakPtr<RenderListItem> m_listItem; 94 90 LayoutUnit m_lineOffsetForListItem; 95 91 };
Note:
See TracChangeset
for help on using the changeset viewer.