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

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

Issue 715633006: Remove FontDescriptionChangeScope, and let FontBuilder partially apply values. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix size/family ordering. Created 6 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: Source/core/css/resolver/FontBuilder.h
diff --git a/Source/core/css/resolver/FontBuilder.h b/Source/core/css/resolver/FontBuilder.h
index 09efe4066af8dd8a1ddcf97f8397c8d20e5be44d..418860e50938c41555dd65951d82e4dd78d405af 100644
--- a/Source/core/css/resolver/FontBuilder.h
+++ b/Source/core/css/resolver/FontBuilder.h
@@ -35,22 +35,17 @@ class CSSValue;
class FontSelector;
class RenderStyle;
-class FontDescriptionChangeScope;
-
class FontBuilder {
STACK_ALLOCATED();
WTF_MAKE_NONCOPYABLE(FontBuilder);
public:
FontBuilder(const Document&);
- void setFontDescription(const FontDescription& fd) { m_fontDescription = fd; }
- const FontDescription& fontDescription() const { return m_fontDescription; }
-
void setInitial(float effectiveZoom);
- void didChangeFontParameters(bool);
-
- void inheritFrom(const FontDescription&);
+ void didChangeEffectiveZoom(bool);
+ void didChangeTextOrientation(bool);
+ void didChangeWritingMode(bool);
rune 2015/02/03 12:25:40 I would have removed the bool parameters and check
andersr 2015/02/03 15:35:08 Done.
FontFamily standardFontFamily() const;
AtomicString standardFontFamilyName() const;
@@ -70,14 +65,11 @@ public:
void setFontSmoothing(FontSmoothingMode);
// FIXME: These need to just vend a Font object eventually.
- void createFont(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle*, const RenderStyle* parentStyle);
+ void createFont(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle*);
void createFontForDocument(PassRefPtrWillBeRawPtr<FontSelector>, RenderStyle*);
- // FIXME: These should not be necessary eventually.
- void setFontDirty(bool fontDirty) { m_fontDirty = fontDirty; }
- // FIXME: This is only used by an ASSERT in StyleResolver. Remove?
- bool fontDirty() const { return m_fontDirty; }
+ bool fontDirty() const { return m_flags; }
static FontDescription::FamilyDescription initialFamilyDescription() { return FontDescription::FamilyDescription(initialGenericFamily()); }
static FontFeatureSettings* initialFeatureSettings() { return nullptr; }
@@ -92,16 +84,14 @@ public:
static FontStretch initialStretch() { return FontStretchNormal; }
static FontWeight initialWeight() { return FontWeightNormal; }
- friend class FontDescriptionChangeScope;
-
private:
void setFamilyDescription(FontDescription&, const FontDescription::FamilyDescription&);
void setSize(FontDescription&, const FontDescription::Size&);
- void checkForOrientationChange(RenderStyle*);
+ void updateOrientation(FontDescription&, RenderStyle*);
// This function fixes up the default font size if it detects that the current generic font family has changed. -dwh
- void checkForGenericFamilyChange(RenderStyle*, const RenderStyle* parentStyle);
- void updateComputedSize(RenderStyle*, const RenderStyle* parentStyle);
+ void checkForGenericFamilyChange(const FontDescription&, FontDescription&);
+ void updateSpecifiedSize(FontDescription&, RenderStyle*);
void updateComputedSize(FontDescription&, RenderStyle*);
float getComputedSizeFromSpecifiedSize(FontDescription&, float effectiveZoom, float specifiedSize);
@@ -109,12 +99,29 @@ private:
const Document& m_document;
FontDescription m_fontDescription;
- // Fontbuilder is responsbile for creating the Font()
- // object on RenderStyle from various other font-related
- // properties on RenderStyle. Whenever one of those
- // is changed, FontBuilder tracks the need to update
- // style->font() with this bool.
- bool m_fontDirty;
+ enum class IsSetFlag {
rune 2015/02/03 12:25:40 How about something more descriptive like Descript
andersr 2015/02/03 15:35:08 Do you mean DescriptionFlag?
+ Weight,
+ Size,
+ Stretch,
+ Family,
+ FeatureSettings,
+ Script,
+ Style,
+ Variant,
+ VariantLigatures,
+ TextRendering,
+ Kerning,
+ FontSmoothing,
+
+ EffectiveZoom,
+ TextOrientation,
+ WritingMode
+ };
+
+ void set(IsSetFlag flag) { m_flags |= (1 << unsigned(flag)); }
+ bool isSet(IsSetFlag flag) const { return m_flags & (1 << unsigned(flag)); }
+
+ unsigned m_flags;
};
}

Powered by Google App Engine
This is Rietveld 408576698