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

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

Issue 671613003: Eliminate FontBuilder::initForStyleResolve. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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/css/resolver/FontBuilder.h ('k') | Source/core/css/resolver/FontBuilderTest.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 95576982313a4cd9db8c6c6114c709ef14a541f4..7f4d680f916a0fc056f7ac357f985c0e6061162a 100644
--- a/Source/core/css/resolver/FontBuilder.cpp
+++ b/Source/core/css/resolver/FontBuilder.cpp
@@ -60,25 +60,18 @@ private:
FontDescription m_fontDescription;
};
-FontBuilder::FontBuilder()
- : m_document(nullptr)
- , m_style(0)
+FontBuilder::FontBuilder(const Document& document)
+ : m_document(document)
+ , m_style(nullptr)
, m_fontDirty(false)
{
-}
-
-void FontBuilder::initForStyleResolve(const Document& document, RenderStyle* style)
-{
ASSERT(document.frame());
- m_document = &document;
- m_style = style;
- m_fontDirty = false;
}
void FontBuilder::setInitial(float effectiveZoom)
{
- ASSERT(m_document && m_document->settings());
- if (!m_document || !m_document->settings())
+ ASSERT(m_document.settings());
+ if (!m_document.settings())
return;
FontDescriptionChangeScope scope(this);
@@ -112,7 +105,7 @@ void FontBuilder::fromSystemFont(CSSValueID valueId, float effectiveZoom)
return;
// Make sure the rendering mode and printer font settings are updated.
- const Settings* settings = m_document->settings();
+ const Settings* settings = m_document.settings();
ASSERT(settings); // If we're doing style resolution, this document should always be in a frame and thus have settings
if (!settings)
return;
@@ -131,8 +124,7 @@ FontFamily FontBuilder::standardFontFamily() const
AtomicString FontBuilder::standardFontFamilyName() const
{
- ASSERT(m_document);
- Settings* settings = m_document->settings();
+ Settings* settings = m_document.settings();
if (settings)
return settings->genericFontFamilySettings().standard();
return AtomicString();
@@ -265,7 +257,7 @@ void FontBuilder::setSize(FontDescription& fontDescription, const FontDescriptio
float specifiedSize = size.value;
if (!specifiedSize && size.keyword)
- specifiedSize = FontSize::fontSizeForKeyword(m_document, size.keyword, fontDescription.fixedPitchFontType());
+ specifiedSize = FontSize::fontSizeForKeyword(&m_document, size.keyword, fontDescription.fixedPitchFontType());
if (specifiedSize < 0)
return;
@@ -283,10 +275,10 @@ float FontBuilder::getComputedSizeFromSpecifiedSize(FontDescription& fontDescrip
{
float zoomFactor = effectiveZoom;
// FIXME: Why is this here!!!!?!
- if (LocalFrame* frame = m_document->frame())
+ if (LocalFrame* frame = m_document.frame())
zoomFactor *= frame->textZoomFactor();
- return FontSize::getComputedSizeFromSpecifiedSize(m_document, zoomFactor, fontDescription.isAbsoluteSize(), specifiedSize);
+ return FontSize::getComputedSizeFromSpecifiedSize(&m_document, zoomFactor, fontDescription.isAbsoluteSize(), specifiedSize);
}
static void getFontAndGlyphOrientation(const RenderStyle* style, FontOrientation& fontOrientation, NonCJKGlyphOrientation& glyphOrientation)
@@ -365,9 +357,9 @@ void FontBuilder::checkForGenericFamilyChange(RenderStyle* style, const RenderSt
// multiplying by our scale factor.
float size;
if (scope.fontDescription().keywordSize()) {
- size = FontSize::fontSizeForKeyword(m_document, scope.fontDescription().keywordSize(), scope.fontDescription().fixedPitchFontType());
+ size = FontSize::fontSizeForKeyword(&m_document, scope.fontDescription().keywordSize(), scope.fontDescription().fixedPitchFontType());
} else {
- Settings* settings = m_document->settings();
+ Settings* settings = m_document.settings();
float fixedScaleFactor = (settings && settings->defaultFixedFontSize() && settings->defaultFontSize())
? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
: 1;
« no previous file with comments | « Source/core/css/resolver/FontBuilder.h ('k') | Source/core/css/resolver/FontBuilderTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698