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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutListBox.cpp

Issue 2416033003: Remove unsafe getFontMetrics methods (Closed)
Patch Set: 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/layout/LayoutListBox.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutListBox.cpp b/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
index 807d2266555478232eb8a169efd1616765c2efe8..7388ff3e1b80bd24322a524675e94ae7d806d8b2 100644
--- a/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutListBox.cpp
@@ -66,7 +66,10 @@ unsigned LayoutListBox::size() const {
}
LayoutUnit LayoutListBox::defaultItemHeight() const {
- return LayoutUnit(style()->getFontMetrics().height() + defaultPaddingBottom);
+ const SimpleFontData* fontData = style()->font().primaryFont();
+ if (!fontData)
+ return LayoutUnit();
+ return LayoutUnit(fontData->getFontMetrics().height() + defaultPaddingBottom);
}
LayoutUnit LayoutListBox::itemHeight() const {

Powered by Google App Engine
This is Rietveld 408576698