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

Unified Diff: Source/core/css/resolver/FontBuilder.cpp

Issue 712333004: Create the document font using normal FontBuilder calls. Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Recreate patch on new master. Created 5 years, 10 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/css/resolver/FontBuilder.h ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/css/resolver/FontBuilder.cpp
diff --git a/Source/core/css/resolver/FontBuilder.cpp b/Source/core/css/resolver/FontBuilder.cpp
index 7e1e8f055fc60b38e305d48dea86fdecdb024603..d9cd018a69fb1bbcd9fab6ed757512558d036c71 100644
--- a/Source/core/css/resolver/FontBuilder.cpp
+++ b/Source/core/css/resolver/FontBuilder.cpp
@@ -48,8 +48,8 @@ void FontBuilder::setInitial(float effectiveZoom)
if (!m_document.settings())
return;
- setFamilyDescription(m_fontDescription, FontBuilder::initialFamilyDescription());
- setSize(m_fontDescription, FontBuilder::initialSize());
+ setFamilyDescription(FontBuilder::initialFamilyDescription());
+ setSize(FontBuilder::initialSize());
}
void FontBuilder::didChangeEffectiveZoom()
@@ -108,7 +108,12 @@ AtomicString FontBuilder::genericFontFamilyName(FontDescription::GenericFamilyTy
void FontBuilder::setFamilyDescription(const FontDescription::FamilyDescription& familyDescription)
{
- setFamilyDescription(m_fontDescription, familyDescription);
+ set(PropertySetFlag::Family);
+
+ bool isInitial = familyDescription.genericFamily == FontDescription::StandardFamily && familyDescription.family.familyIsEmpty();
+
+ m_fontDescription.setGenericFamily(familyDescription.genericFamily);
+ m_fontDescription.setFamily(isInitial ? standardFontFamily() : familyDescription.family);
}
void FontBuilder::setWeight(FontWeight fontWeight)
@@ -120,7 +125,20 @@ void FontBuilder::setWeight(FontWeight fontWeight)
void FontBuilder::setSize(const FontDescription::Size& size)
{
- setSize(m_fontDescription, size);
+ float specifiedSize = size.value;
+
+ if (specifiedSize < 0)
+ return;
+
+ set(PropertySetFlag::Size);
+
+ // Overly large font sizes will cause crashes on some platforms (such as Windows).
+ // Cap font size here to make sure that doesn't happen.
+ specifiedSize = std::min(maximumAllowedFontSize, specifiedSize);
+
+ m_fontDescription.setKeywordSize(size.keyword);
+ m_fontDescription.setSpecifiedSize(specifiedSize);
+ m_fontDescription.setIsAbsoluteSize(size.isAbsolute);
}
void FontBuilder::setStretch(FontStretch fontStretch)
@@ -187,34 +205,6 @@ void FontBuilder::setFeatureSettings(PassRefPtr<FontFeatureSettings> settings)
m_fontDescription.setFeatureSettings(settings);
}
-void FontBuilder::setFamilyDescription(FontDescription& fontDescription, const FontDescription::FamilyDescription& familyDescription)
-{
- set(PropertySetFlag::Family);
-
- bool isInitial = familyDescription.genericFamily == FontDescription::StandardFamily && familyDescription.family.familyIsEmpty();
-
- fontDescription.setGenericFamily(familyDescription.genericFamily);
- fontDescription.setFamily(isInitial ? standardFontFamily() : familyDescription.family);
-}
-
-void FontBuilder::setSize(FontDescription& fontDescription, const FontDescription::Size& size)
-{
- float specifiedSize = size.value;
-
- if (specifiedSize < 0)
- return;
-
- set(PropertySetFlag::Size);
-
- // Overly large font sizes will cause crashes on some platforms (such as Windows).
- // Cap font size here to make sure that doesn't happen.
- specifiedSize = std::min(maximumAllowedFontSize, specifiedSize);
-
- fontDescription.setKeywordSize(size.keyword);
- fontDescription.setSpecifiedSize(specifiedSize);
- fontDescription.setIsAbsoluteSize(size.isAbsolute);
-}
-
float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescription, float effectiveZoom, float specifiedSize)
{
float zoomFactor = effectiveZoom;
@@ -377,24 +367,4 @@ void FontBuilder::createFont(PassRefPtrWillBeRawPtr<FontSelector> fontSelector,
m_flags = 0;
}
-void FontBuilder::createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector> fontSelector, RenderStyle* documentStyle)
-{
- FontDescription fontDescription = FontDescription();
- fontDescription.setLocale(documentStyle->locale());
- fontDescription.setScript(localeToScriptCodeForFontSelection(documentStyle->locale()));
-
- setFamilyDescription(fontDescription, FontBuilder::initialFamilyDescription());
- setSize(fontDescription, FontDescription::Size(FontSize::initialKeywordSize(), 0.0f, false));
- updateSpecifiedSize(fontDescription, documentStyle);
- updateComputedSize(fontDescription, documentStyle);
-
- FontOrientation fontOrientation;
- NonCJKGlyphOrientation glyphOrientation;
- getFontAndGlyphOrientation(documentStyle, fontOrientation, glyphOrientation);
- fontDescription.setOrientation(fontOrientation);
- fontDescription.setNonCJKGlyphOrientation(glyphOrientation);
- documentStyle->setFontDescription(fontDescription);
- documentStyle->font().update(fontSelector);
-}
-
}
« no previous file with comments | « Source/core/css/resolver/FontBuilder.h ('k') | Source/core/css/resolver/StyleResolver.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698