255 void RenderListItem::computePreferredLogicalWidths() 256 { 257 // FIXME: RenderListMarker::updateMargins() mutates margin style which affects preferred widths. 258 if (m_marker && m_marker->preferredLogicalWidthsDirty()) 259 m_marker->updateMarginsAndContent(); 260 261 RenderBlockFlow::computePreferredLogicalWidths(); 262 } 263 264 void RenderListItem::positionListMarker() 265 { 266 if (!m_marker || !m_marker->parent() || !m_marker->parent()->isBox()) 267 return; 268 269 if (m_marker->isInside() || !m_marker->inlineBoxWrapper()) 270 return; 271 272 LayoutUnit markerOldLogicalLeft = m_marker->logicalLeft(); 273 LayoutUnit blockOffset = 0; 274 LayoutUnit lineOffset = 0; 275 for (RenderBox* o = m_marker->parentBox(); o != this; o = o->parentBox()) { 276 blockOffset += o->logicalTop(); 277 lineOffset += o->logicalLeft(); 278 } 279 280 bool adjustOverflow = false; 281 LayoutUnit markerLogicalLeft; 282 bool hitSelfPaintingLayer = false; 283 284 const RootInlineBox& rootBox = m_marker->inlineBoxWrapper()->root(); 285 LayoutUnit lineTop = rootBox.lineTop(); 286 LayoutUnit lineBottom = rootBox.lineBottom(); 287 288 // FIXME: Need to account for relative positioning in the layout overflow. 289 if (style().isLeftToRightDirection()) { 290 markerLogicalLeft = m_marker->lineOffsetForListItem() - lineOffset - paddingStart() - borderStart() + m_marker->marginStart(); 291 m_marker->inlineBoxWrapper()->adjustLineDirectionPosition(markerLogicalLeft - markerOldLogicalLeft); 292 for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) { 293 LayoutRect newLogicalVisualOverflowRect = box->logicalVisualOverflowRect(lineTop, lineBottom); 294 LayoutRect newLogicalLayoutOverflowRect = box->logicalLayoutOverflowRect(lineTop, lineBottom); 295 if (markerLogicalLeft < newLogicalVisualOverflowRect.x() && !hitSelfPaintingLayer) { 296 newLogicalVisualOverflowRect.setWidth(newLogicalVisualOverflowRect.maxX() - markerLogicalLeft); 297 newLogicalVisualOverflowRect.setX(markerLogicalLeft); | 255 void RenderListItem::computePreferredLogicalWidths() 256 { 257 // FIXME: RenderListMarker::updateMargins() mutates margin style which affects preferred widths. 258 if (m_marker && m_marker->preferredLogicalWidthsDirty()) 259 m_marker->updateMarginsAndContent(); 260 261 RenderBlockFlow::computePreferredLogicalWidths(); 262 } 263 264 void RenderListItem::positionListMarker() 265 { 266 if (!m_marker || !m_marker->parent() || !m_marker->parent()->isBox()) 267 return; 268 269 if (m_marker->isInside() || !m_marker->inlineBoxWrapper()) 270 return; 271 272 LayoutUnit markerOldLogicalLeft = m_marker->logicalLeft(); 273 LayoutUnit blockOffset = 0; 274 LayoutUnit lineOffset = 0; 275 for (auto* ancestor = m_marker->parentBox(); ancestor && ancestor != this; ancestor = ancestor->parentBox()) { 276 blockOffset += ancestor->logicalTop(); 277 lineOffset += ancestor->logicalLeft(); 278 } 279 280 bool adjustOverflow = false; 281 LayoutUnit markerLogicalLeft; 282 bool hitSelfPaintingLayer = false; 283 284 const RootInlineBox& rootBox = m_marker->inlineBoxWrapper()->root(); 285 LayoutUnit lineTop = rootBox.lineTop(); 286 LayoutUnit lineBottom = rootBox.lineBottom(); 287 288 // FIXME: Need to account for relative positioning in the layout overflow. 289 if (style().isLeftToRightDirection()) { 290 markerLogicalLeft = m_marker->lineOffsetForListItem() - lineOffset - paddingStart() - borderStart() + m_marker->marginStart(); 291 m_marker->inlineBoxWrapper()->adjustLineDirectionPosition(markerLogicalLeft - markerOldLogicalLeft); 292 for (InlineFlowBox* box = m_marker->inlineBoxWrapper()->parent(); box; box = box->parent()) { 293 LayoutRect newLogicalVisualOverflowRect = box->logicalVisualOverflowRect(lineTop, lineBottom); 294 LayoutRect newLogicalLayoutOverflowRect = box->logicalLayoutOverflowRect(lineTop, lineBottom); 295 if (markerLogicalLeft < newLogicalVisualOverflowRect.x() && !hitSelfPaintingLayer) { 296 newLogicalVisualOverflowRect.setWidth(newLogicalVisualOverflowRect.maxX() - markerLogicalLeft); 297 newLogicalVisualOverflowRect.setX(markerLogicalLeft); |