From ca96d732def2dba62a1d7b15ca76fbbdfa4e4f33 Mon Sep 17 00:00:00 2001 From: Elliott Sprehn Date: Mon, 15 Dec 2014 17:29:04 -0800 Subject: [PATCH] Remove REM units. The code to make them dynamically update was already removed when Document::inheritHtmlAndBodyElementStyles was removed. We might want to add them back later, but probably in a different way, so lets remove the code for now to make refactoring the style system easier. R=eseidel@chromium.org Review URL: https://codereview.chromium.org/788883005 --- .../DeferredLegacyStyleInterpolation.cpp | 1 - engine/core/css/CSSCalculationValue.cpp | 2 -- engine/core/css/CSSGradientValue.cpp | 3 +-- engine/core/css/CSSMatrix.cpp | 2 +- engine/core/css/CSSPrimitiveValue.cpp | 20 ------------------- engine/core/css/CSSPrimitiveValue.h | 6 ++---- engine/core/css/CSSToLengthConversionData.cpp | 3 +-- engine/core/css/CSSToLengthConversionData.h | 5 +---- engine/core/css/MediaQueryExp.cpp | 1 - engine/core/css/MediaValues.cpp | 1 - engine/core/css/MediaValuesTest.cpp | 1 - engine/core/css/StyleSheetContents.cpp | 3 +-- engine/core/css/StyleSheetContents.h | 4 ---- engine/core/css/parser/CSSGrammar.y | 6 ------ engine/core/css/parser/CSSPropertyParser.cpp | 1 - engine/core/css/parser/CSSTokenizer-in.cpp | 3 --- .../css/resolver/ElementResolveContext.cpp | 8 -------- .../core/css/resolver/ElementResolveContext.h | 2 -- engine/core/css/resolver/FontBuilder.cpp | 4 ++-- engine/core/css/resolver/FontBuilder.h | 2 +- .../core/css/resolver/StyleBuilderCustom.cpp | 2 +- .../core/css/resolver/StyleResolverState.cpp | 2 +- engine/core/css/resolver/StyleResolverState.h | 1 - engine/core/dom/Document.cpp | 12 ----------- .../core/dom/DocumentStyleSheetCollection.cpp | 2 -- .../dom/ShadowTreeStyleSheetCollection.cpp | 1 - engine/core/dom/StyleEngine.cpp | 3 --- engine/core/dom/StyleEngine.h | 5 ----- .../dom/TreeScopeStyleSheetCollection.cpp | 15 -------------- .../core/dom/TreeScopeStyleSheetCollection.h | 5 ----- 30 files changed, 12 insertions(+), 114 deletions(-) diff --git a/engine/core/animation/DeferredLegacyStyleInterpolation.cpp b/engine/core/animation/DeferredLegacyStyleInterpolation.cpp index 83839ea8a1f..ccafb0bbd1c 100644 --- a/engine/core/animation/DeferredLegacyStyleInterpolation.cpp +++ b/engine/core/animation/DeferredLegacyStyleInterpolation.cpp @@ -66,7 +66,6 @@ bool DeferredLegacyStyleInterpolation::interpolationRequiresStyleResolve(const C primitiveValue.accumulateLengthArray(lengthArray); return lengthArray[CSSPrimitiveValue::UnitTypeFontSize] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeFontXSize] != 0 - || lengthArray[CSSPrimitiveValue::UnitTypeRootFontSize] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeZeroCharacterWidth] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeViewportWidth] != 0 || lengthArray[CSSPrimitiveValue::UnitTypeViewportHeight] != 0 diff --git a/engine/core/css/CSSCalculationValue.cpp b/engine/core/css/CSSCalculationValue.cpp index e2c65264be4..efb54bda945 100644 --- a/engine/core/css/CSSCalculationValue.cpp +++ b/engine/core/css/CSSCalculationValue.cpp @@ -62,7 +62,6 @@ static CalculationCategory unitCategory(CSSPrimitiveValue::UnitType type) case CSSPrimitiveValue::CSS_IN: case CSSPrimitiveValue::CSS_PT: case CSSPrimitiveValue::CSS_PC: - case CSSPrimitiveValue::CSS_REMS: case CSSPrimitiveValue::CSS_CHS: case CSSPrimitiveValue::CSS_VW: case CSSPrimitiveValue::CSS_VH: @@ -93,7 +92,6 @@ static bool hasDoubleValue(CSSPrimitiveValue::UnitType type) case CSSPrimitiveValue::CSS_EMS: case CSSPrimitiveValue::CSS_EXS: case CSSPrimitiveValue::CSS_CHS: - case CSSPrimitiveValue::CSS_REMS: case CSSPrimitiveValue::CSS_PX: case CSSPrimitiveValue::CSS_CM: case CSSPrimitiveValue::CSS_MM: diff --git a/engine/core/css/CSSGradientValue.cpp b/engine/core/css/CSSGradientValue.cpp index 850c33f4b54..f4f2d0e9204 100644 --- a/engine/core/css/CSSGradientValue.cpp +++ b/engine/core/css/CSSGradientValue.cpp @@ -61,8 +61,7 @@ PassRefPtr CSSGradientValue::image(RenderObject* renderer, const IntSize& // We need to create an image. RefPtr gradient; - RenderStyle* rootStyle = renderer->document().documentElement()->renderStyle(); - CSSToLengthConversionData conversionData(renderer->style(), rootStyle, renderer->view()); + CSSToLengthConversionData conversionData(renderer->style(), renderer->view()); if (isLinearGradientValue()) gradient = toCSSLinearGradientValue(this)->createGradient(conversionData, size); else diff --git a/engine/core/css/CSSMatrix.cpp b/engine/core/css/CSSMatrix.cpp index 41333fa7c72..bb0cb42eb86 100644 --- a/engine/core/css/CSSMatrix.cpp +++ b/engine/core/css/CSSMatrix.cpp @@ -68,7 +68,7 @@ void CSSMatrix::setMatrixValue(const String& string, ExceptionState& exceptionSt DEFINE_STATIC_REF(RenderStyle, defaultStyle, RenderStyle::createDefaultStyle()); TransformOperations operations; - if (!TransformBuilder::createTransformOperations(value.get(), CSSToLengthConversionData(defaultStyle, defaultStyle, 0), operations)) { + if (!TransformBuilder::createTransformOperations(value.get(), CSSToLengthConversionData(defaultStyle, 0), operations)) { exceptionState.throwDOMException(SyntaxError, "Failed to interpret '" + string + "' as a transformation operation."); return; } diff --git a/engine/core/css/CSSPrimitiveValue.cpp b/engine/core/css/CSSPrimitiveValue.cpp index 982c544e60c..d087be4e9cd 100644 --- a/engine/core/css/CSSPrimitiveValue.cpp +++ b/engine/core/css/CSSPrimitiveValue.cpp @@ -76,7 +76,6 @@ static inline bool isValidCSSUnitTypeForDoubleConversion(CSSPrimitiveValue::Unit case CSSPrimitiveValue::CSS_PT: case CSSPrimitiveValue::CSS_PX: case CSSPrimitiveValue::CSS_RAD: - case CSSPrimitiveValue::CSS_REMS: case CSSPrimitiveValue::CSS_CHS: case CSSPrimitiveValue::CSS_S: case CSSPrimitiveValue::CSS_TURN: @@ -134,7 +133,6 @@ StringToUnitTable createStringToUnitTable() table.set(String("vh"), CSSPrimitiveValue::CSS_VH); table.set(String("vmax"), CSSPrimitiveValue::CSS_VMIN); table.set(String("vmin"), CSSPrimitiveValue::CSS_VMAX); - table.set(String("rem"), CSSPrimitiveValue::CSS_REMS); table.set(String("fr"), CSSPrimitiveValue::CSS_FR); table.set(String("turn"), CSSPrimitiveValue::CSS_TURN); table.set(String("ch"), CSSPrimitiveValue::CSS_CHS); @@ -460,7 +458,6 @@ void CSSPrimitiveValue::cleanup() case CSS_PERCENTAGE: case CSS_EMS: case CSS_EXS: - case CSS_REMS: case CSS_CHS: case CSS_PX: case CSS_CM: @@ -575,7 +572,6 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c return m_value.calc->computeLengthPx(conversionData); const RenderStyle& style = conversionData.style(); - const RenderStyle* rootStyle = conversionData.rootStyle(); bool computingFontSize = conversionData.computingFontSize(); double factor; @@ -593,12 +589,6 @@ double CSSPrimitiveValue::computeLengthDouble(const CSSToLengthConversionData& c else factor = (computingFontSize ? style.fontDescription().specifiedSize() : style.fontDescription().computedSize()) / 2.0; break; - case CSS_REMS: - if (rootStyle) - factor = computingFontSize ? rootStyle->fontDescription().specifiedSize() : rootStyle->fontDescription().computedSize(); - else - factor = 1.0; - break; case CSS_CHS: factor = style.fontMetrics().zeroWidth(); break; @@ -840,9 +830,6 @@ bool CSSPrimitiveValue::unitTypeToLengthUnitType(UnitType unitType, LengthUnitTy case CSSPrimitiveValue::CSS_EXS: lengthType = UnitTypeFontXSize; return true; - case CSSPrimitiveValue::CSS_REMS: - lengthType = UnitTypeRootFontSize; - return true; case CSSPrimitiveValue::CSS_CHS: lengthType = UnitTypeZeroCharacterWidth; return true; @@ -875,8 +862,6 @@ CSSPrimitiveValue::UnitType CSSPrimitiveValue::lengthUnitTypeToUnitType(LengthUn return CSSPrimitiveValue::CSS_EMS; case UnitTypeFontXSize: return CSSPrimitiveValue::CSS_EXS; - case UnitTypeRootFontSize: - return CSSPrimitiveValue::CSS_REMS; case UnitTypeZeroCharacterWidth: return CSSPrimitiveValue::CSS_CHS; case UnitTypePercentage: @@ -1012,8 +997,6 @@ const char* CSSPrimitiveValue::unitTypeToString(UnitType type) return "em"; case CSS_EXS: return "ex"; - case CSS_REMS: - return "rem"; case CSS_CHS: return "ch"; case CSS_PX: @@ -1103,7 +1086,6 @@ String CSSPrimitiveValue::customCSSText(CSSTextFormattingFlags formattingFlag) c case CSS_PERCENTAGE: case CSS_EMS: case CSS_EXS: - case CSS_REMS: case CSS_CHS: case CSS_PX: case CSS_CM: @@ -1218,7 +1200,6 @@ PassRefPtr CSSPrimitiveValue::cloneForCSSOM() const case CSS_PERCENTAGE: case CSS_EMS: case CSS_EXS: - case CSS_REMS: case CSS_CHS: case CSS_PX: case CSS_CM: @@ -1277,7 +1258,6 @@ bool CSSPrimitiveValue::equals(const CSSPrimitiveValue& other) const case CSS_PERCENTAGE: case CSS_EMS: case CSS_EXS: - case CSS_REMS: case CSS_PX: case CSS_CM: case CSS_DPPX: diff --git a/engine/core/css/CSSPrimitiveValue.h b/engine/core/css/CSSPrimitiveValue.h index e81ba10074c..7390a7e05aa 100644 --- a/engine/core/css/CSSPrimitiveValue.h +++ b/engine/core/css/CSSPrimitiveValue.h @@ -113,7 +113,7 @@ public: // These are from CSS3 Values and Units, but that isn't a finished standard yet CSS_TURN = 107, - CSS_REMS = 108, + // CSS_REMS = 108, CSS_CHS = 109, // This is used by the CSS Shapes draft @@ -135,7 +135,6 @@ public: UnitTypePercentage, UnitTypeFontSize, UnitTypeFontXSize, - UnitTypeRootFontSize, UnitTypeZeroCharacterWidth, UnitTypeViewportWidth, UnitTypeViewportHeight, @@ -177,14 +176,13 @@ public: { return m_primitiveUnitType == CSS_EMS || m_primitiveUnitType == CSS_EXS - || m_primitiveUnitType == CSS_REMS || m_primitiveUnitType == CSS_CHS; } bool isViewportPercentageLength() const { return isViewportPercentageLength(static_cast(m_primitiveUnitType)); } static bool isViewportPercentageLength(UnitType type) { return type >= CSS_VW && type <= CSS_VMAX; } static bool isLength(UnitType type) { - return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_REMS || type == CSS_CHS || isViewportPercentageLength(type); + return (type >= CSS_EMS && type <= CSS_PC) || type == CSS_CHS || isViewportPercentageLength(type); } bool isLength() const { return isLength(primitiveType()); } bool isNumber() const { return primitiveType() == CSS_NUMBER; } diff --git a/engine/core/css/CSSToLengthConversionData.cpp b/engine/core/css/CSSToLengthConversionData.cpp index 5b1d7c44b07..ea0e42b813e 100644 --- a/engine/core/css/CSSToLengthConversionData.cpp +++ b/engine/core/css/CSSToLengthConversionData.cpp @@ -36,9 +36,8 @@ namespace blink { -CSSToLengthConversionData::CSSToLengthConversionData(const RenderStyle* style, const RenderStyle* rootStyle, const RenderView* renderView, bool computingFontSize) +CSSToLengthConversionData::CSSToLengthConversionData(const RenderStyle* style, const RenderView* renderView, bool computingFontSize) : m_style(style) - , m_rootStyle(rootStyle) , m_viewportWidth(renderView ? renderView->layoutViewportWidth() : 0) , m_viewportHeight(renderView ? renderView->layoutViewportHeight() : 0) , m_computingFontSize(computingFontSize) diff --git a/engine/core/css/CSSToLengthConversionData.h b/engine/core/css/CSSToLengthConversionData.h index 7b71e68097e..2e52af6209a 100644 --- a/engine/core/css/CSSToLengthConversionData.h +++ b/engine/core/css/CSSToLengthConversionData.h @@ -41,10 +41,9 @@ class RenderView; class CSSToLengthConversionData { public: - CSSToLengthConversionData(const RenderStyle* currStyle, const RenderStyle* rootStyle, const RenderView*, bool computingFontSize = false); + CSSToLengthConversionData(const RenderStyle* currStyle, const RenderView*, bool computingFontSize = false); const RenderStyle& style() const { return *m_style; } - const RenderStyle* rootStyle() const { return m_rootStyle; } bool computingFontSize() const { return m_computingFontSize; } // Accessing these marks the style as having viewport units @@ -54,11 +53,9 @@ public: double viewportMaxPercent() const; void setStyle(const RenderStyle* style) { m_style = style; } - void setRootStyle(const RenderStyle* rootStyle) { m_rootStyle = rootStyle; } private: const RenderStyle* m_style; - const RenderStyle* m_rootStyle; float m_viewportWidth; float m_viewportHeight; bool m_computingFontSize; diff --git a/engine/core/css/MediaQueryExp.cpp b/engine/core/css/MediaQueryExp.cpp index 51d6c4830ce..d04a1234e87 100644 --- a/engine/core/css/MediaQueryExp.cpp +++ b/engine/core/css/MediaQueryExp.cpp @@ -86,7 +86,6 @@ static bool positiveLengthUnit(const int unit) case CSSPrimitiveValue::CSS_IN: case CSSPrimitiveValue::CSS_PT: case CSSPrimitiveValue::CSS_PC: - case CSSPrimitiveValue::CSS_REMS: case CSSPrimitiveValue::CSS_CHS: return true; } diff --git a/engine/core/css/MediaValues.cpp b/engine/core/css/MediaValues.cpp index cc7b42d6c5b..d317b41cec4 100644 --- a/engine/core/css/MediaValues.cpp +++ b/engine/core/css/MediaValues.cpp @@ -136,7 +136,6 @@ bool MediaValues::computeLengthImpl(double value, CSSPrimitiveValue::UnitType ty double factor = 0; switch (type) { case CSSPrimitiveValue::CSS_EMS: - case CSSPrimitiveValue::CSS_REMS: factor = defaultFontSize; break; case CSSPrimitiveValue::CSS_PX: diff --git a/engine/core/css/MediaValuesTest.cpp b/engine/core/css/MediaValuesTest.cpp index 92106958e39..62d2033c4f0 100644 --- a/engine/core/css/MediaValuesTest.cpp +++ b/engine/core/css/MediaValuesTest.cpp @@ -27,7 +27,6 @@ TEST(MediaValuesTest, Basic) TestCase testCases[] = { { 40.0, CSSPrimitiveValue::CSS_PX, 16, 300, 300, true, 40 }, { 40.0, CSSPrimitiveValue::CSS_EMS, 16, 300, 300, true, 640 }, - { 40.0, CSSPrimitiveValue::CSS_REMS, 16, 300, 300, true, 640 }, { 40.0, CSSPrimitiveValue::CSS_EXS, 16, 300, 300, true, 320 }, { 40.0, CSSPrimitiveValue::CSS_CHS, 16, 300, 300, true, 320 }, { 43.0, CSSPrimitiveValue::CSS_VW, 16, 848, 976, true, 364 }, diff --git a/engine/core/css/StyleSheetContents.cpp b/engine/core/css/StyleSheetContents.cpp index 5b38d0f2479..77fd6697d28 100644 --- a/engine/core/css/StyleSheetContents.cpp +++ b/engine/core/css/StyleSheetContents.cpp @@ -36,8 +36,7 @@ namespace blink { StyleSheetContents::StyleSheetContents(const CSSParserContext& context) - : m_usesRemUnits(false) - , m_hasMediaQueries(false) + : m_hasMediaQueries(false) , m_parserContext(context) { } diff --git a/engine/core/css/StyleSheetContents.h b/engine/core/css/StyleSheetContents.h index 5419f26f39b..85d45210ff4 100644 --- a/engine/core/css/StyleSheetContents.h +++ b/engine/core/css/StyleSheetContents.h @@ -55,12 +55,9 @@ public: bool parseString(const String&); void parserAppendRule(PassRefPtr); - void parserSetUsesRemUnits(bool b) { m_usesRemUnits = b; } const Vector >& childRules() const { return m_childRules; } - bool usesRemUnits() const { return m_usesRemUnits; } - void registerClient(CSSStyleSheet*); void unregisterClient(CSSStyleSheet*); @@ -75,7 +72,6 @@ public: private: explicit StyleSheetContents(const CSSParserContext&); - bool m_usesRemUnits : 1; bool m_hasMediaQueries : 1; OwnPtr m_ruleSet; diff --git a/engine/core/css/parser/CSSGrammar.y b/engine/core/css/parser/CSSGrammar.y index 3c35fbd7ac9..ac7cedf540e 100644 --- a/engine/core/css/parser/CSSGrammar.y +++ b/engine/core/css/parser/CSSGrammar.y @@ -200,7 +200,6 @@ inline static CSSParserValue makeIdentValue(CSSParserString string) %token SUPPORTS_AND %token SUPPORTS_OR -%token REMS %token CHS %token EMS %token EXS @@ -1302,11 +1301,6 @@ unary_term: | KHERTZ { $$.setFromNumber($1, CSSPrimitiveValue::CSS_KHZ); } | EMS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_EMS); } | EXS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_EXS); } - | REMS { - $$.setFromNumber($1, CSSPrimitiveValue::CSS_REMS); - if (parser->m_styleSheet) - parser->m_styleSheet->parserSetUsesRemUnits(true); - } | CHS { $$.setFromNumber($1, CSSPrimitiveValue::CSS_CHS); } | VW { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VW); } | VH { $$.setFromNumber($1, CSSPrimitiveValue::CSS_VH); } diff --git a/engine/core/css/parser/CSSPropertyParser.cpp b/engine/core/css/parser/CSSPropertyParser.cpp index 6833f73b53d..c142bafcd32 100644 --- a/engine/core/css/parser/CSSPropertyParser.cpp +++ b/engine/core/css/parser/CSSPropertyParser.cpp @@ -248,7 +248,6 @@ bool CSSPropertyParser::validUnit(CSSParserValue* value, Units unitflags, CSSPar b = (unitflags & FPercent); break; case CSSPrimitiveValue::CSS_EMS: - case CSSPrimitiveValue::CSS_REMS: case CSSPrimitiveValue::CSS_CHS: case CSSPrimitiveValue::CSS_EXS: case CSSPrimitiveValue::CSS_PX: diff --git a/engine/core/css/parser/CSSTokenizer-in.cpp b/engine/core/css/parser/CSSTokenizer-in.cpp index b4e47e51d4b..246d25a553f 100644 --- a/engine/core/css/parser/CSSTokenizer-in.cpp +++ b/engine/core/css/parser/CSSTokenizer-in.cpp @@ -843,9 +843,6 @@ inline void CSSTokenizer::detectNumberToken(CharacterType* type, int length) CASE("rad") { m_token = RADS; } - CASE("rem") { - m_token = REMS; - } CASE("s") { m_token = SECS; } diff --git a/engine/core/css/resolver/ElementResolveContext.cpp b/engine/core/css/resolver/ElementResolveContext.cpp index b3e85b2176a..fe7a7905a42 100644 --- a/engine/core/css/resolver/ElementResolveContext.cpp +++ b/engine/core/css/resolver/ElementResolveContext.cpp @@ -31,7 +31,6 @@ namespace blink { ElementResolveContext::ElementResolveContext(const Document& document) : m_element(nullptr) , m_parentNode(nullptr) - , m_rootElementStyle(document.documentElement() ? document.documentElement()->renderStyle() : document.renderStyle()) , m_distributedToInsertionPoint(false) { } @@ -43,13 +42,6 @@ ElementResolveContext::ElementResolveContext(Element& element) NodeRenderingTraversal::ParentDetails parentDetails; m_parentNode = NodeRenderingTraversal::parent(&element, &parentDetails); m_distributedToInsertionPoint = parentDetails.insertionPoint(); - - const Document& document = element.document(); - Node* documentElement = document.documentElement(); - RenderStyle* documentStyle = document.renderStyle(); - m_rootElementStyle = documentElement && element != documentElement ? documentElement->renderStyle() : documentStyle; - if (!m_rootElementStyle) - m_rootElementStyle = documentStyle; } } // namespace blink diff --git a/engine/core/css/resolver/ElementResolveContext.h b/engine/core/css/resolver/ElementResolveContext.h index da475c88f77..0e360c85e38 100644 --- a/engine/core/css/resolver/ElementResolveContext.h +++ b/engine/core/css/resolver/ElementResolveContext.h @@ -42,13 +42,11 @@ public: Element* element() const { return m_element; } const ContainerNode* parentNode() const { return m_parentNode; } - const RenderStyle* rootElementStyle() const { return m_rootElementStyle; } bool distributedToInsertionPoint() const { return m_distributedToInsertionPoint; } private: RawPtr m_element; RawPtr m_parentNode; - RenderStyle* m_rootElementStyle; bool m_distributedToInsertionPoint; }; diff --git a/engine/core/css/resolver/FontBuilder.cpp b/engine/core/css/resolver/FontBuilder.cpp index 47df2c78bb1..de3960ac6ca 100644 --- a/engine/core/css/resolver/FontBuilder.cpp +++ b/engine/core/css/resolver/FontBuilder.cpp @@ -276,7 +276,7 @@ static float smallerFontSize(float size) } // FIXME: Have to pass RenderStyles here for calc/computed values. This shouldn't be neecessary. -void FontBuilder::setFontSizeValue(CSSValue* value, RenderStyle* parentStyle, const RenderStyle* rootElementStyle) +void FontBuilder::setFontSizeValue(CSSValue* value, RenderStyle* parentStyle) { if (!value->isPrimitiveValue()) return; @@ -328,7 +328,7 @@ void FontBuilder::setFontSizeValue(CSSValue* value, RenderStyle* parentStyle, co // If we have viewport units the conversion will mark the parent style as having viewport units. bool parentHasViewportUnits = parentStyle->hasViewportUnits(); parentStyle->setHasViewportUnits(false); - CSSToLengthConversionData conversionData(parentStyle, rootElementStyle, m_document->renderView(), true); + CSSToLengthConversionData conversionData(parentStyle, m_document->renderView(), true); if (primitiveValue->isLength()) size = primitiveValue->computeLength(conversionData); else if (primitiveValue->isCalculatedPercentageWithLength()) diff --git a/engine/core/css/resolver/FontBuilder.h b/engine/core/css/resolver/FontBuilder.h index 290e0c47b03..811b246952b 100644 --- a/engine/core/css/resolver/FontBuilder.h +++ b/engine/core/css/resolver/FontBuilder.h @@ -59,7 +59,7 @@ public: void setFontSizeInitial(); void setFontSizeInherit(const FontDescription&); - void setFontSizeValue(CSSValue*, RenderStyle* parentStyle, const RenderStyle* rootElementStyle); + void setFontSizeValue(CSSValue*, RenderStyle* parentStyle); void setWeight(FontWeight); void setStretch(FontStretch); diff --git a/engine/core/css/resolver/StyleBuilderCustom.cpp b/engine/core/css/resolver/StyleBuilderCustom.cpp index ec3494cb926..495d0f3ad38 100644 --- a/engine/core/css/resolver/StyleBuilderCustom.cpp +++ b/engine/core/css/resolver/StyleBuilderCustom.cpp @@ -186,7 +186,7 @@ void StyleBuilderFunctions::applyInheritCSSPropertyFontSize(StyleResolverState& void StyleBuilderFunctions::applyValueCSSPropertyFontSize(StyleResolverState& state, CSSValue* value) { - state.fontBuilder().setFontSizeValue(value, state.parentStyle(), state.rootElementStyle()); + state.fontBuilder().setFontSizeValue(value, state.parentStyle()); } void StyleBuilderFunctions::applyValueCSSPropertyLineHeight(StyleResolverState& state, CSSValue* value) diff --git a/engine/core/css/resolver/StyleResolverState.cpp b/engine/core/css/resolver/StyleResolverState.cpp index d087471747c..fed37ead088 100644 --- a/engine/core/css/resolver/StyleResolverState.cpp +++ b/engine/core/css/resolver/StyleResolverState.cpp @@ -33,7 +33,7 @@ StyleResolverState::StyleResolverState(Document& document, Element* element, Ren : m_elementContext(element ? ElementResolveContext(*element) : ElementResolveContext(document)) , m_document(document) , m_style(nullptr) - , m_cssToLengthConversionData(0, rootElementStyle(), document.renderView()) + , m_cssToLengthConversionData(0, document.renderView()) , m_parentStyle(parentStyle) , m_lineHeightValue(nullptr) , m_styleMap(*this, m_elementStyleResources) diff --git a/engine/core/css/resolver/StyleResolverState.h b/engine/core/css/resolver/StyleResolverState.h index ea9061c7830..ab81f2744c8 100644 --- a/engine/core/css/resolver/StyleResolverState.h +++ b/engine/core/css/resolver/StyleResolverState.h @@ -53,7 +53,6 @@ public: // These are all just pass-through methods to ElementResolveContext. Element* element() const { return m_elementContext.element(); } const ContainerNode* parentNode() const { return m_elementContext.parentNode(); } - const RenderStyle* rootElementStyle() const { return m_elementContext.rootElementStyle(); } bool distributedToInsertionPoint() const { return m_elementContext.distributedToInsertionPoint(); } diff --git a/engine/core/dom/Document.cpp b/engine/core/dom/Document.cpp index bef4928943c..05f9916a1dd 100644 --- a/engine/core/dom/Document.cpp +++ b/engine/core/dom/Document.cpp @@ -1078,9 +1078,6 @@ void Document::updateRenderTree(StyleRecalcChange change) // re-attaching our containing iframe, which when asked HTMLFrameElementBase::isURLAllowed // hits a null-dereference due to security code always assuming the document has a SecurityOrigin. - if (m_elemSheet && m_elemSheet->contents()->usesRemUnits()) - m_styleEngine->setUsesRemUnit(true); - updateStyle(change); // As a result of the style recalculation, the currently hovered element might have been @@ -1573,15 +1570,6 @@ void Document::updateBaseURL() if (!m_baseURL.isValid()) m_baseURL = KURL(); - - // FIXME(sky): remove? - if (m_elemSheet) { - // Element sheet is silly. It never contains anything. - bool usesRemUnits = m_elemSheet->contents()->usesRemUnits(); - m_elemSheet = CSSStyleSheet::create(this, m_baseURL); - // FIXME: So we are not really the parser. The right fix is to eliminate the element sheet completely. - m_elemSheet->contents()->parserSetUsesRemUnits(usesRemUnits); - } } void Document::didLoadAllImports() diff --git a/engine/core/dom/DocumentStyleSheetCollection.cpp b/engine/core/dom/DocumentStyleSheetCollection.cpp index f0ff039aa65..3d4526ab26d 100644 --- a/engine/core/dom/DocumentStyleSheetCollection.cpp +++ b/engine/core/dom/DocumentStyleSheetCollection.cpp @@ -76,8 +76,6 @@ void DocumentStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine) document().setNeedsStyleRecalc(SubtreeStyleChange); collection.swap(*this); - - updateUsesRemUnits(); } } diff --git a/engine/core/dom/ShadowTreeStyleSheetCollection.cpp b/engine/core/dom/ShadowTreeStyleSheetCollection.cpp index 37b359c4ba6..8d73870e33e 100644 --- a/engine/core/dom/ShadowTreeStyleSheetCollection.cpp +++ b/engine/core/dom/ShadowTreeStyleSheetCollection.cpp @@ -70,7 +70,6 @@ void ShadowTreeStyleSheetCollection::updateActiveStyleSheets(StyleEngine* engine toShadowRoot(treeScope().rootNode()).host()->setNeedsStyleRecalc(SubtreeStyleChange); collection.swap(*this); - updateUsesRemUnits(); } } diff --git a/engine/core/dom/StyleEngine.cpp b/engine/core/dom/StyleEngine.cpp index 0f4d91a2c1a..0dcf2015dc1 100644 --- a/engine/core/dom/StyleEngine.cpp +++ b/engine/core/dom/StyleEngine.cpp @@ -47,7 +47,6 @@ StyleEngine::StyleEngine(Document& document) , m_isMaster(!document.importsController() || document.importsController()->master() == &document) , m_documentStyleSheetCollection(DocumentStyleSheetCollection::create(document)) , m_documentScopeDirty(true) - , m_usesRemUnits(false) , m_ignorePendingStylesheets(false) // We don't need to create CSSFontSelector for imported document or // HTMLTemplateElement's document, because those documents have no frame. @@ -236,8 +235,6 @@ void StyleEngine::updateActiveStyleSheets() } m_activeTreeScopes.removeAll(treeScopesRemoved); - m_usesRemUnits = documentStyleSheetCollection()->usesRemUnits(); - m_dirtyTreeScopes.clear(); m_documentScopeDirty = false; } diff --git a/engine/core/dom/StyleEngine.h b/engine/core/dom/StyleEngine.h index 1a2912b21f4..0cdb36266f8 100644 --- a/engine/core/dom/StyleEngine.h +++ b/engine/core/dom/StyleEngine.h @@ -88,9 +88,6 @@ public: // FIXME(sky): Remove this and ::first-line. bool usesFirstLineRules() const { return false; } - bool usesRemUnits() const { return m_usesRemUnits; } - void setUsesRemUnit(bool b) { m_usesRemUnits = b; } - void didRemoveShadowRoot(ShadowRoot*); void appendActiveAuthorStyleSheets(); @@ -181,8 +178,6 @@ private: TreeScopeSet m_dirtyTreeScopes; TreeScopeSet m_activeTreeScopes; - bool m_usesRemUnits; - bool m_ignorePendingStylesheets; OwnPtr m_resolver; diff --git a/engine/core/dom/TreeScopeStyleSheetCollection.cpp b/engine/core/dom/TreeScopeStyleSheetCollection.cpp index 0d0c39264f7..d11a655a55f 100644 --- a/engine/core/dom/TreeScopeStyleSheetCollection.cpp +++ b/engine/core/dom/TreeScopeStyleSheetCollection.cpp @@ -38,7 +38,6 @@ namespace blink { TreeScopeStyleSheetCollection::TreeScopeStyleSheetCollection(TreeScope& treeScope) : m_treeScope(treeScope) - , m_usesRemUnits(false) { } @@ -68,18 +67,4 @@ void TreeScopeStyleSheetCollection::clearMediaQueryRuleSetStyleSheets() } } -static bool styleSheetsUseRemUnits(const Vector >& sheets) -{ - for (unsigned i = 0; i < sheets.size(); ++i) { - if (sheets[i]->contents()->usesRemUnits()) - return true; - } - return false; -} - -void TreeScopeStyleSheetCollection::updateUsesRemUnits() -{ - m_usesRemUnits = styleSheetsUseRemUnits(m_activeAuthorStyleSheets); -} - } diff --git a/engine/core/dom/TreeScopeStyleSheetCollection.h b/engine/core/dom/TreeScopeStyleSheetCollection.h index 5909ac03a63..c0782376d5e 100644 --- a/engine/core/dom/TreeScopeStyleSheetCollection.h +++ b/engine/core/dom/TreeScopeStyleSheetCollection.h @@ -52,8 +52,6 @@ public: void removeStyleSheetCandidateNode(Node*, ContainerNode* scopingNode); bool hasStyleSheetCandidateNodes() const { return !m_styleSheetCandidateNodes.isEmpty(); } - bool usesRemUnits() const { return m_usesRemUnits; } - DocumentOrderedList& styleSheetCandidateNodes() { return m_styleSheetCandidateNodes; } void clearMediaQueryRuleSetStyleSheets(); @@ -70,11 +68,8 @@ protected: Additive }; - void updateUsesRemUnits(); - protected: RawPtr m_treeScope; - bool m_usesRemUnits; DocumentOrderedList m_styleSheetCandidateNodes; };