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

Unified Diff: third_party/WebKit/Source/web/ExternalPopupMenu.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
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Font.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/web/ExternalPopupMenu.cpp
diff --git a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
index 7f397c2da8b95f213994e4bc5e15eb8307b554d9..70ea218ae0d8df4a61f6f863981b20e21f900047 100644
--- a/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
+++ b/third_party/WebKit/Source/web/ExternalPopupMenu.cpp
@@ -258,7 +258,9 @@ void ExternalPopupMenu::getPopupMenuInfo(WebPopupMenuInfo& info,
const ComputedStyle& menuStyle = ownerElement.computedStyle()
? *ownerElement.computedStyle()
: *ownerElement.ensureComputedStyle();
- info.itemHeight = menuStyle.font().getFontMetrics().height();
+ const SimpleFontData* fontData = menuStyle.font().primaryFont();
+ DCHECK(fontData);
+ info.itemHeight = fontData ? fontData->getFontMetrics().height() : 0;
info.itemFontSize =
static_cast<int>(menuStyle.font().getFontDescription().computedSize());
info.selectedIndex = toExternalPopupMenuItemIndex(
« no previous file with comments | « third_party/WebKit/Source/platform/fonts/Font.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698