| Index: third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
|
| index 4cfd8afcafbd21988558ef6f9c19e09fe46f7817..ccc679d31610635f76db81a8ac679ce122bae9a9 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutListMarker.cpp
|
| @@ -65,12 +65,16 @@ LayoutListMarker* LayoutListMarker::createAnonymous(LayoutListItem* item) {
|
|
|
| LayoutSize LayoutListMarker::imageBulletSize() const {
|
| ASSERT(isImage());
|
| + const SimpleFontData* fontData = style()->font().primaryFont();
|
| + DCHECK(fontData);
|
| + if (!fontData)
|
| + return LayoutSize();
|
|
|
| // FIXME: This is a somewhat arbitrary default width. Generated images for
|
| // markers really won't become particularly useful until we support the CSS3
|
| // marker pseudoclass to allow control over the width and height of the
|
| // marker box.
|
| - LayoutUnit bulletWidth = style()->getFontMetrics().ascent() / LayoutUnit(2);
|
| + LayoutUnit bulletWidth = fontData->getFontMetrics().ascent() / LayoutUnit(2);
|
| return m_image->imageSize(*this, style()->effectiveZoom(),
|
| LayoutSize(bulletWidth, bulletWidth));
|
| }
|
| @@ -141,8 +145,11 @@ void LayoutListMarker::layout() {
|
| setWidth(imageSize.width());
|
| setHeight(imageSize.height());
|
| } else {
|
| + const SimpleFontData* fontData = style()->font().primaryFont();
|
| + DCHECK(fontData);
|
| setLogicalWidth(minPreferredLogicalWidth());
|
| - setLogicalHeight(LayoutUnit(style()->getFontMetrics().height()));
|
| + setLogicalHeight(
|
| + LayoutUnit(fontData ? fontData->getFontMetrics().height() : 0));
|
| }
|
|
|
| setMarginStart(LayoutUnit());
|
| @@ -234,6 +241,10 @@ void LayoutListMarker::computePreferredLogicalWidths() {
|
| }
|
|
|
| const Font& font = style()->font();
|
| + const SimpleFontData* fontData = font.primaryFont();
|
| + DCHECK(fontData);
|
| + if (!fontData)
|
| + return;
|
|
|
| LayoutUnit logicalWidth;
|
| switch (getListStyleCategory()) {
|
| @@ -241,7 +252,7 @@ void LayoutListMarker::computePreferredLogicalWidths() {
|
| break;
|
| case ListStyleCategory::Symbol:
|
| logicalWidth =
|
| - LayoutUnit((font.getFontMetrics().ascent() * 2 / 3 + 1) / 2 + 2);
|
| + LayoutUnit((fontData->getFontMetrics().ascent() * 2 / 3 + 1) / 2 + 2);
|
| break;
|
| case ListStyleCategory::Language:
|
| logicalWidth = getWidthOfTextWithSuffix();
|
| @@ -257,7 +268,11 @@ void LayoutListMarker::computePreferredLogicalWidths() {
|
| }
|
|
|
| void LayoutListMarker::updateMargins() {
|
| - const FontMetrics& fontMetrics = style()->getFontMetrics();
|
| + const SimpleFontData* fontData = style()->font().primaryFont();
|
| + DCHECK(fontData);
|
| + if (!fontData)
|
| + return;
|
| + const FontMetrics& fontMetrics = fontData->getFontMetrics();
|
|
|
| LayoutUnit marginStart;
|
| LayoutUnit marginEnd;
|
| @@ -422,13 +437,18 @@ IntRect LayoutListMarker::getRelativeMarkerRect() const {
|
| }
|
|
|
| IntRect relativeRect;
|
| + const SimpleFontData* fontData = style()->font().primaryFont();
|
| + DCHECK(fontData);
|
| + if (!fontData)
|
| + return relativeRect;
|
| +
|
| switch (getListStyleCategory()) {
|
| case ListStyleCategory::None:
|
| return IntRect();
|
| case ListStyleCategory::Symbol: {
|
| // TODO(wkorman): Review and clean up/document the calculations below.
|
| // http://crbug.com/543193
|
| - const FontMetrics& fontMetrics = style()->getFontMetrics();
|
| + const FontMetrics& fontMetrics = fontData->getFontMetrics();
|
| int ascent = fontMetrics.ascent();
|
| int bulletWidth = (ascent * 2 / 3 + 1) / 2;
|
| relativeRect = IntRect(1, 3 * (ascent - ascent * 2 / 3) / 2, bulletWidth,
|
| @@ -436,7 +456,7 @@ IntRect LayoutListMarker::getRelativeMarkerRect() const {
|
| } break;
|
| case ListStyleCategory::Language:
|
| relativeRect = IntRect(0, 0, getWidthOfTextWithSuffix().toInt(),
|
| - style()->font().getFontMetrics().height());
|
| + fontData->getFontMetrics().height());
|
| break;
|
| }
|
|
|
|
|