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

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

Issue 2416033003: Remove unsafe getFontMetrics methods (Closed)
Patch Set: Address wkroman suggestions Created 4 years, 2 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
Index: third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
diff --git a/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp b/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
index 867626938279b2802748dadaea8ad996e117ecdf..eb30da5223a8791a8efb5b415f3d8845dadaede8 100644
--- a/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
+++ b/third_party/WebKit/Source/core/paint/ListMarkerPainter.cpp
@@ -130,9 +130,11 @@ void ListMarkerPainter::paint(const PaintInfo& paintInfo,
TextRunPaintInfo textRunPaintInfo(textRun);
textRunPaintInfo.bounds = marker;
+ const SimpleFontData* fontData =
+ m_layoutListMarker.style()->font().primaryFont();
IntPoint textOrigin = IntPoint(
marker.x(),
- marker.y() + m_layoutListMarker.style()->getFontMetrics().ascent());
+ marker.y() + (fontData ? fontData->getFontMetrics().ascent() : 0));
// 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.

Powered by Google App Engine
This is Rietveld 408576698