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

Unified Diff: Source/core/rendering/RenderTheme.cpp

Issue 677103002: Expand system font values during property parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove isExpandedShorthandForAll. Created 6 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 | « Source/core/rendering/RenderTheme.h ('k') | Source/core/rendering/RenderThemeChromiumFontProvider.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderTheme.cpp
diff --git a/Source/core/rendering/RenderTheme.cpp b/Source/core/rendering/RenderTheme.cpp
index b150048a564f303cdd7ad83b48a5835f45ed66cc..f07705b80733f7292781595312792a7370615a39 100644
--- a/Source/core/rendering/RenderTheme.cpp
+++ b/Source/core/rendering/RenderTheme.cpp
@@ -940,6 +940,64 @@ void RenderTheme::platformColorsDidChange()
Page::scheduleForcedStyleRecalcForAllPages();
}
+static FontDescription& getCachedFontDescription(CSSValueID systemFontID)
+{
+ DEFINE_STATIC_LOCAL(FontDescription, caption, ());
+ DEFINE_STATIC_LOCAL(FontDescription, icon, ());
+ DEFINE_STATIC_LOCAL(FontDescription, menu, ());
+ DEFINE_STATIC_LOCAL(FontDescription, messageBox, ());
+ DEFINE_STATIC_LOCAL(FontDescription, smallCaption, ());
+ DEFINE_STATIC_LOCAL(FontDescription, statusBar, ());
+ DEFINE_STATIC_LOCAL(FontDescription, webkitMiniControl, ());
+ DEFINE_STATIC_LOCAL(FontDescription, webkitSmallControl, ());
+ DEFINE_STATIC_LOCAL(FontDescription, webkitControl, ());
+ DEFINE_STATIC_LOCAL(FontDescription, defaultDescription, ());
+ switch (systemFontID) {
+ case CSSValueCaption:
+ return caption;
+ case CSSValueIcon:
+ return icon;
+ case CSSValueMenu:
+ return menu;
+ case CSSValueMessageBox:
+ return messageBox;
+ case CSSValueSmallCaption:
+ return smallCaption;
+ case CSSValueStatusBar:
+ return statusBar;
+ case CSSValueWebkitMiniControl:
+ return webkitMiniControl;
+ case CSSValueWebkitSmallControl:
+ return webkitSmallControl;
+ case CSSValueWebkitControl:
+ return webkitControl;
+ case CSSValueNone:
+ return defaultDescription;
+ default:
+ ASSERT_NOT_REACHED();
+ return defaultDescription;
+ }
+}
+
+void RenderTheme::systemFont(CSSValueID systemFontID, FontDescription& fontDescription)
+{
+ fontDescription = getCachedFontDescription(systemFontID);
+ if (fontDescription.isAbsoluteSize())
+ return;
+
+ FontStyle fontStyle = FontStyleNormal;
+ FontWeight fontWeight = FontWeightNormal;
+ float fontSize = 0;
+ AtomicString fontFamily;
+ systemFont(systemFontID, fontStyle, fontWeight, fontSize, fontFamily);
+ fontDescription.setStyle(fontStyle);
+ fontDescription.setWeight(fontWeight);
+ fontDescription.setSpecifiedSize(fontSize);
+ fontDescription.setIsAbsoluteSize(true);
+ fontDescription.firstFamily().setFamily(fontFamily);
+ fontDescription.setGenericFamily(FontDescription::NoFamily);
+}
+
Color RenderTheme::systemColor(CSSValueID cssValueId) const
{
switch (cssValueId) {
« no previous file with comments | « Source/core/rendering/RenderTheme.h ('k') | Source/core/rendering/RenderThemeChromiumFontProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698