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

Unified Diff: third_party/WebKit/Source/platform/fonts/FontDescription.cpp

Issue 2558053002: Add CSS support for font-variation-settings (Closed)
Patch Set: DCHECK corrected, newline removed. Created 4 years 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/platform/fonts/FontDescription.cpp
diff --git a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
index c2c2325ea1bba0075fb1699e7dcd19f2acd67aa8..f0012be0fcaa86e9ca0b66a52250b1af3a34eecd 100644
--- a/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
+++ b/third_party/WebKit/Source/platform/fonts/FontDescription.cpp
@@ -41,6 +41,7 @@ struct SameSizeAsFontDescription {
DISALLOW_NEW();
FontFamily familyList;
RefPtr<FontFeatureSettings> m_featureSettings;
+ RefPtr<FontVariationSettings> m_variationSettings;
AtomicString locale;
float sizes[6];
FieldsAsUnsignedType bitfields;
@@ -102,7 +103,10 @@ bool FontDescription::operator==(const FontDescription& other) const {
m_fieldsAsUnsigned.parts[1] == other.m_fieldsAsUnsigned.parts[1] &&
(m_featureSettings == other.m_featureSettings ||
(m_featureSettings && other.m_featureSettings &&
- *m_featureSettings == *other.m_featureSettings));
+ *m_featureSettings == *other.m_featureSettings)) &&
+ (m_variationSettings == other.m_variationSettings ||
+ (m_variationSettings && other.m_variationSettings &&
+ *m_variationSettings == *other.m_variationSettings));
}
FontWeight FontDescription::lighterWeight(FontWeight weight) {
@@ -307,6 +311,17 @@ unsigned FontDescription::styleHashWithoutFamilyList() const {
addToHash(hash, settings->at(i).value());
}
}
+ const FontVariationSettings* varSettings = variationSettings();
+ if (varSettings) {
+ unsigned numFeatures = varSettings->size();
+ for (unsigned i = 0; i < numFeatures; ++i) {
+ const AtomicString& tag = varSettings->at(i).tag();
+ for (unsigned j = 0; j < tag.length(); j++)
+ stringHasher.addCharacter(tag[j]);
+ addToHash(hash, varSettings->at(i).value());
+ }
+ }
+
if (m_locale) {
const AtomicString& locale = m_locale->localeString();
for (unsigned i = 0; i < locale.length(); i++)

Powered by Google App Engine
This is Rietveld 408576698