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

Unified Diff: third_party/WebKit/Source/core/testing/Internals.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/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 825503e5eef2d5bcaf59d1fc7305585e83bdd018..9a9f805b326316706d49dae5a171aa813d2625c3 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -2601,7 +2601,13 @@ int Internals::selectPopupItemStyleFontHeight(Node* node, int itemIndex) {
return false;
const ComputedStyle* itemStyle =
select.itemComputedStyle(*select.listItems()[itemIndex]);
- return itemStyle ? itemStyle->font().getFontMetrics().height() : 0;
+
+ if (itemStyle) {
+ const SimpleFontData* fontData = itemStyle->font().primaryFont();
+ DCHECK(fontData);
+ return fontData ? fontData->getFontMetrics().height() : 0;
+ }
+ return 0;
}
void Internals::resetTypeAheadSession(HTMLSelectElement* select) {

Powered by Google App Engine
This is Rietveld 408576698