Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Unified Diff: Source/core/paint/ListMarkerPainter.cpp

Issue 1152763006: Remove outdated list style types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix sorting Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/layout/LayoutListMarker.cpp ('k') | Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/ListMarkerPainter.cpp
diff --git a/Source/core/paint/ListMarkerPainter.cpp b/Source/core/paint/ListMarkerPainter.cpp
index 7caf6846ae117194f5e9f4208554c3ce2c8ffcc6..66008efbb4aa96e45666791fb568dd2464d42b1e 100644
--- a/Source/core/paint/ListMarkerPainter.cpp
+++ b/Source/core/paint/ListMarkerPainter.cpp
@@ -79,12 +79,8 @@ void ListMarkerPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pai
return;
case NoneListStyle:
return;
- case Afar:
- case Amharic:
- case AmharicAbegede:
case ArabicIndic:
case Armenian:
- case BinaryListStyle:
case Bengali:
case Cambodian:
case CJKIdeographic:
@@ -93,28 +89,16 @@ void ListMarkerPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pai
case DecimalLeadingZero:
case DecimalListStyle:
case Devanagari:
- case Ethiopic:
- case EthiopicAbegede:
- case EthiopicAbegedeAmEt:
- case EthiopicAbegedeGez:
- case EthiopicAbegedeTiEr:
- case EthiopicAbegedeTiEt:
- case EthiopicHalehameAaEr:
- case EthiopicHalehameAaEt:
- case EthiopicHalehameAmEt:
- case EthiopicHalehameGez:
- case EthiopicHalehameOmEt:
- case EthiopicHalehameSidEt:
- case EthiopicHalehameSoEt:
+ case EthiopicHalehame:
+ case EthiopicHalehameAm:
case EthiopicHalehameTiEr:
case EthiopicHalehameTiEt:
- case EthiopicHalehameTig:
case Georgian:
case Gujarati:
case Gurmukhi:
+ case Hebrew:
case Hangul:
case HangulConsonant:
- case Hebrew:
case Hiragana:
case HiraganaIroha:
case Kannada:
@@ -125,37 +109,21 @@ void ListMarkerPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pai
case LowerAlpha:
case LowerArmenian:
case LowerGreek:
- case LowerHexadecimal:
case LowerLatin:
- case LowerNorwegian:
case LowerRoman:
case Malayalam:
case Mongolian:
case Myanmar:
- case Octal:
case Oriya:
- case Oromo:
case Persian:
- case Sidama:
- case Somali:
case Telugu:
case Thai:
case Tibetan:
- case Tigre:
- case TigrinyaEr:
- case TigrinyaErAbegede:
- case TigrinyaEt:
- case TigrinyaEtAbegede:
case UpperAlpha:
case UpperArmenian:
- case UpperGreek:
- case UpperHexadecimal:
case UpperLatin:
- case UpperNorwegian:
case UpperRoman:
case Urdu:
- case Asterisks:
- case Footnotes:
break;
}
if (m_layoutListMarker.text().isEmpty())
@@ -179,38 +147,34 @@ void ListMarkerPainter::paint(const PaintInfo& paintInfo, const LayoutPoint& pai
textRunPaintInfo.bounds = marker;
IntPoint textOrigin = IntPoint(marker.x(), marker.y() + m_layoutListMarker.style()->fontMetrics().ascent());
- if (type == Asterisks || type == Footnotes) {
+ // Text is not arbitrary. We can judge whether it's RTL from the first character,
+ // and we only need to handle the direction RightToLeft for now.
+ bool textNeedsReversing = WTF::Unicode::direction(m_layoutListMarker.text()[0]) == WTF::Unicode::RightToLeft;
+ StringBuilder reversedText;
+ if (textNeedsReversing) {
+ unsigned length = m_layoutListMarker.text().length();
+ reversedText.reserveCapacity(length);
+ for (int i = length - 1; i >= 0; --i)
+ reversedText.append(m_layoutListMarker.text()[i]);
+ ASSERT(reversedText.length() == length);
+ textRun.setText(reversedText.toString());
+ }
+
+ const UChar suffix = m_layoutListMarker.listMarkerSuffix(type, m_layoutListMarker.listItem()->value());
+ UChar suffixStr[2] = {
+ m_layoutListMarker.style()->isLeftToRightDirection() ? suffix : static_cast<UChar>(' '),
+ m_layoutListMarker.style()->isLeftToRightDirection() ? static_cast<UChar>(' ') : suffix
+ };
+ TextRun suffixRun = constructTextRun(&m_layoutListMarker, font, suffixStr, 2, m_layoutListMarker.styleRef(), m_layoutListMarker.style()->direction());
+ TextRunPaintInfo suffixRunInfo(suffixRun);
+ suffixRunInfo.bounds = marker;
+
+ if (m_layoutListMarker.style()->isLeftToRightDirection()) {
context->drawText(font, textRunPaintInfo, textOrigin);
+ context->drawText(font, suffixRunInfo, textOrigin + IntSize(font.width(textRun), 0));
} else {
- // Text is not arbitrary. We can judge whether it's RTL from the first character,
- // and we only need to handle the direction RightToLeft for now.
- bool textNeedsReversing = WTF::Unicode::direction(m_layoutListMarker.text()[0]) == WTF::Unicode::RightToLeft;
- StringBuilder reversedText;
- if (textNeedsReversing) {
- unsigned length = m_layoutListMarker.text().length();
- reversedText.reserveCapacity(length);
- for (int i = length - 1; i >= 0; --i)
- reversedText.append(m_layoutListMarker.text()[i]);
- ASSERT(reversedText.length() == length);
- textRun.setText(reversedText.toString());
- }
-
- const UChar suffix = m_layoutListMarker.listMarkerSuffix(type, m_layoutListMarker.listItem()->value());
- UChar suffixStr[2] = {
- m_layoutListMarker.style()->isLeftToRightDirection() ? suffix : static_cast<UChar>(' '),
- m_layoutListMarker.style()->isLeftToRightDirection() ? static_cast<UChar>(' ') : suffix
- };
- TextRun suffixRun = constructTextRun(&m_layoutListMarker, font, suffixStr, 2, m_layoutListMarker.styleRef(), m_layoutListMarker.style()->direction());
- TextRunPaintInfo suffixRunInfo(suffixRun);
- suffixRunInfo.bounds = marker;
-
- if (m_layoutListMarker.style()->isLeftToRightDirection()) {
- context->drawText(font, textRunPaintInfo, textOrigin);
- context->drawText(font, suffixRunInfo, textOrigin + IntSize(font.width(textRun), 0));
- } else {
- context->drawText(font, suffixRunInfo, textOrigin);
- context->drawText(font, textRunPaintInfo, textOrigin + IntSize(font.width(suffixRun), 0));
- }
+ context->drawText(font, suffixRunInfo, textOrigin);
+ context->drawText(font, textRunPaintInfo, textOrigin + IntSize(font.width(suffixRun), 0));
}
}
« no previous file with comments | « Source/core/layout/LayoutListMarker.cpp ('k') | Source/core/style/ComputedStyleConstants.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698