Chromium Code Reviews| Index: Source/core/editing/EditingStyle.cpp |
| diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp |
| index c0fdd1fb75bf2c76455952fe50cd93c9095a3841..543bbc6cfdb7a7ecd5ae90eddfd650cdd063ff1a 100644 |
| --- a/Source/core/editing/EditingStyle.cpp |
| +++ b/Source/core/editing/EditingStyle.cpp |
| @@ -143,7 +143,7 @@ static PassRefPtrWillBeRawPtr<MutableStylePropertySet> editingStyleFromComputedS |
| static PassRefPtrWillBeRawPtr<MutableStylePropertySet> getPropertiesNotIn(StylePropertySet* styleWithRedundantProperties, CSSStyleDeclaration* baseStyle); |
| enum LegacyFontSizeMode { AlwaysUseLegacyFontSize, UseLegacyFontSizeOnlyIfPixelValuesMatch }; |
| -static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode); |
| +static int legacyFontSizeFromCSSValue(Document*, CSSPrimitiveValue*, FixedPitchFontType, LegacyFontSizeMode); |
| static bool isTransparentColorValue(CSSValue*); |
| static bool hasTransparentBackgroundColor(CSSStyleDeclaration*); |
| static bool hasTransparentBackgroundColor(StylePropertySet*); |
| @@ -342,20 +342,20 @@ PassRefPtrWillBeRawPtr<CSSValue> HTMLFontSizeEquivalent::attributeValueAsCSSValu |
| float EditingStyle::NoFontDelta = 0.0f; |
| EditingStyle::EditingStyle() |
| - : m_shouldUseFixedDefaultFontSize(false) |
| + : m_shouldUseFixedDefaultFontSize(NonFixedPitchFont) |
| , m_fontSizeDelta(NoFontDelta) |
| { |
| } |
| EditingStyle::EditingStyle(Node* node, PropertiesToInclude propertiesToInclude) |
| - : m_shouldUseFixedDefaultFontSize(false) |
| + : m_shouldUseFixedDefaultFontSize(NonFixedPitchFont) |
| , m_fontSizeDelta(NoFontDelta) |
| { |
| init(node, propertiesToInclude); |
| } |
| EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propertiesToInclude) |
| - : m_shouldUseFixedDefaultFontSize(false) |
| + : m_shouldUseFixedDefaultFontSize(NonFixedPitchFont) |
| , m_fontSizeDelta(NoFontDelta) |
| { |
| init(position.deprecatedNode(), propertiesToInclude); |
| @@ -363,7 +363,7 @@ EditingStyle::EditingStyle(const Position& position, PropertiesToInclude propert |
| EditingStyle::EditingStyle(const StylePropertySet* style) |
| : m_mutableStyle(style ? style->mutableCopy() : nullptr) |
| - , m_shouldUseFixedDefaultFontSize(false) |
| + , m_shouldUseFixedDefaultFontSize(NonFixedPitchFont) |
| , m_fontSizeDelta(NoFontDelta) |
| { |
| extractFontSizeDelta(); |
| @@ -371,7 +371,7 @@ EditingStyle::EditingStyle(const StylePropertySet* style) |
| EditingStyle::EditingStyle(CSSPropertyID propertyID, const String& value) |
| : m_mutableStyle(nullptr) |
| - , m_shouldUseFixedDefaultFontSize(false) |
| + , m_shouldUseFixedDefaultFontSize(NonFixedPitchFont) |
| , m_fontSizeDelta(NoFontDelta) |
| { |
| setProperty(propertyID, value); |
| @@ -574,7 +574,7 @@ void EditingStyle::overrideWithStyle(const StylePropertySet* style) |
| void EditingStyle::clear() |
| { |
| m_mutableStyle.clear(); |
| - m_shouldUseFixedDefaultFontSize = false; |
| + m_shouldUseFixedDefaultFontSize = NonFixedPitchFont; |
| m_fontSizeDelta = NoFontDelta; |
| } |
| @@ -1434,7 +1434,7 @@ static void setTextDecorationProperty(MutableStylePropertySet* style, const CSSV |
| } |
| } |
| -void StyleChange::extractTextStyles(Document* document, MutableStylePropertySet* style, bool shouldUseFixedFontDefaultSize) |
| +void StyleChange::extractTextStyles(Document* document, MutableStylePropertySet* style, FixedPitchFontType fixedPitchFontType) |
| { |
| ASSERT(style); |
| @@ -1493,10 +1493,9 @@ void StyleChange::extractTextStyles(Document* document, MutableStylePropertySet* |
| style->removeProperty(CSSPropertyFontFamily); |
| if (RefPtrWillBeRawPtr<CSSValue> fontSize = style->getPropertyCSSValue(CSSPropertyFontSize)) { |
| - if (!fontSize->isPrimitiveValue()) |
| + if (!fontSize->isPrimitiveValue()) { |
| style->removeProperty(CSSPropertyFontSize); // Can't make sense of the number. Put no font size. |
| - else if (int legacyFontSize = legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(fontSize.get()), |
| - shouldUseFixedFontDefaultSize, UseLegacyFontSizeOnlyIfPixelValuesMatch)) { |
| + } else if (int legacyFontSize = legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(fontSize.get()), fixedPitchFontType, UseLegacyFontSizeOnlyIfPixelValuesMatch)) { |
| m_applyFontSize = String::number(legacyFontSize); |
| style->removeProperty(CSSPropertyFontSize); |
| } |
| @@ -1613,14 +1612,14 @@ static bool isCSSValueLength(CSSPrimitiveValue* value) |
| return value->isFontIndependentLength(); |
| } |
| -int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, bool shouldUseFixedFontDefaultSize, LegacyFontSizeMode mode) |
| +int legacyFontSizeFromCSSValue(Document* document, CSSPrimitiveValue* value, FixedPitchFontType fixedPitchFontType, LegacyFontSizeMode mode) |
| { |
| if (isCSSValueLength(value)) { |
| int pixelFontSize = value->getIntValue(CSSPrimitiveValue::CSS_PX); |
| - int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, shouldUseFixedFontDefaultSize); |
| + int legacyFontSize = FontSize::legacyFontSize(document, pixelFontSize, fixedPitchFontType); |
| // Use legacy font size only if pixel value matches exactly to that of legacy font size. |
| int cssPrimitiveEquivalent = legacyFontSize - 1 + CSSValueXSmall; |
| - if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(document, cssPrimitiveEquivalent, shouldUseFixedFontDefaultSize) == pixelFontSize) |
| + if (mode == AlwaysUseLegacyFontSize || FontSize::fontSizeForKeyword(document, static_cast<CSSValueID>(cssPrimitiveEquivalent), fixedPitchFontType) == pixelFontSize) |
|
Inactive
2014/06/26 19:43:11
nit: Maybe you can cast that one on the previous l
h.joshi
2014/06/27 06:55:27
Done.
|
| return legacyFontSize; |
| return 0; |