diff options
Diffstat (limited to 'WebCore/rendering/RenderListMarker.cpp')
-rw-r--r-- | WebCore/rendering/RenderListMarker.cpp | 50 |
1 files changed, 34 insertions, 16 deletions
diff --git a/WebCore/rendering/RenderListMarker.cpp b/WebCore/rendering/RenderListMarker.cpp index 7b33c3d..18811df 100644 --- a/WebCore/rendering/RenderListMarker.cpp +++ b/WebCore/rendering/RenderListMarker.cpp @@ -1274,13 +1274,12 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty) void RenderListMarker::layout() { ASSERT(needsLayout()); - ASSERT(!prefWidthsDirty()); - + if (isImage()) { setWidth(m_image->imageSize(this, style()->effectiveZoom()).width()); setHeight(m_image->imageSize(this, style()->effectiveZoom()).height()); } else { - setWidth(minPrefWidth()); + setWidth(minPreferredLogicalWidth()); setHeight(style()->font().height()); } @@ -1308,9 +1307,9 @@ void RenderListMarker::imageChanged(WrappedImagePtr o, const IntRect*) repaint(); } -void RenderListMarker::calcPrefWidths() +void RenderListMarker::computePreferredLogicalWidths() { - ASSERT(prefWidthsDirty()); + ASSERT(preferredLogicalWidthsDirty()); m_text = ""; @@ -1321,8 +1320,8 @@ void RenderListMarker::calcPrefWidths() // until we support the CSS3 marker pseudoclass to allow control over the width and height of the marker box. int bulletWidth = font.ascent() / 2; m_image->setImageContainerSize(IntSize(bulletWidth, bulletWidth)); - m_minPrefWidth = m_maxPrefWidth = m_image->imageSize(this, style()->effectiveZoom()).width(); - setPrefWidthsDirty(false); + m_minPreferredLogicalWidth = m_maxPreferredLogicalWidth = m_image->imageSize(this, style()->effectiveZoom()).width(); + setPreferredLogicalWidthsDirty(false); updateMargins(); return; } @@ -1428,10 +1427,10 @@ void RenderListMarker::calcPrefWidths() break; } - m_minPrefWidth = width; - m_maxPrefWidth = width; + m_minPreferredLogicalWidth = width; + m_maxPreferredLogicalWidth = width; - setPrefWidthsDirty(false); + setPreferredLogicalWidthsDirty(false); updateMargins(); } @@ -1455,9 +1454,9 @@ void RenderListMarker::updateMargins() case Square: if (style()->direction() == LTR) { marginLeft = -1; - marginRight = font.ascent() - minPrefWidth() + 1; + marginRight = font.ascent() - minPreferredLogicalWidth() + 1; } else { - marginLeft = font.ascent() - minPrefWidth() + 1; + marginLeft = font.ascent() - minPreferredLogicalWidth() + 1; marginRight = -1; } break; @@ -1467,7 +1466,7 @@ void RenderListMarker::updateMargins() } else { if (style()->direction() == LTR) { if (isImage()) - marginLeft = -minPrefWidth() - cMarkerPadding; + marginLeft = -minPreferredLogicalWidth() - cMarkerPadding; else { int offset = font.ascent() * 2 / 3; switch (style()->listStyleType()) { @@ -1479,7 +1478,7 @@ void RenderListMarker::updateMargins() case NoneListStyle: break; default: - marginLeft = m_text.isEmpty() ? 0 : -minPrefWidth() - offset / 2; + marginLeft = m_text.isEmpty() ? 0 : -minPreferredLogicalWidth() - offset / 2; } } } else { @@ -1491,7 +1490,7 @@ void RenderListMarker::updateMargins() case Disc: case Circle: case Square: - marginLeft = offset + cMarkerPadding + 1 - minPrefWidth(); + marginLeft = offset + cMarkerPadding + 1 - minPreferredLogicalWidth(); break; case NoneListStyle: break; @@ -1500,7 +1499,7 @@ void RenderListMarker::updateMargins() } } } - marginRight = -marginLeft - minPrefWidth(); + marginRight = -marginLeft - minPreferredLogicalWidth(); } style()->setMarginLeft(Length(marginLeft, Fixed)); @@ -1523,6 +1522,25 @@ int RenderListMarker::baselinePosition(bool, bool) const return height(); } +String RenderListMarker::suffix() const +{ + EListStyleType type = style()->listStyleType(); + const UChar suffix = listMarkerSuffix(type, m_listItem->value()); + + Vector<UChar> resultVector; + resultVector.append(suffix); + + // If the suffix is not ' ', an extra space is needed + if (suffix != ' ') { + if (style()->direction() == LTR) + resultVector.append(' '); + else + resultVector.prepend(' '); + } + + return String::adopt(resultVector); +} + bool RenderListMarker::isInside() const { return m_listItem->notInList() || style()->listStylePosition() == INSIDE; |