diff --git a/engine/core/css/CSSComputedStyleDeclaration.cpp b/engine/core/css/CSSComputedStyleDeclaration.cpp index 196a263aa49..f5844b2743e 100644 --- a/engine/core/css/CSSComputedStyleDeclaration.cpp +++ b/engine/core/css/CSSComputedStyleDeclaration.cpp @@ -2052,11 +2052,6 @@ PassRefPtr CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert case CSSPropertyUnicodeRange: break; - /* Other unimplemented properties */ - case CSSPropertyPage: // for @page - case CSSPropertySize: // for @page - break; - /* Unimplemented -webkit- properties */ case CSSPropertyWebkitBorderRadius: case CSSPropertyWebkitPerspectiveOriginX: diff --git a/engine/core/css/CSSProperties.in b/engine/core/css/CSSProperties.in index e4404aefc29..820ac7b445f 100644 --- a/engine/core/css/CSSProperties.in +++ b/engine/core/css/CSSProperties.in @@ -254,9 +254,6 @@ position // LAYOUT right animatable, initial=initialOffset, converter=convertLengthOrAuto -// OBSOLETE -size custom_all - tab-size inherited, type_name=unsigned text-align inherited, custom_value text-align-last runtime_flag=CSS3Text, inherited, type_name=TextAlignLast @@ -453,16 +450,9 @@ z-index animatable, type_name=unsigned, custom_all // LAYOUT -webkit-max-logical-height direction_aware - -// Properties that we ignore in the StyleBuilder. -// FIXME: We should see if any of these should actually be unreachable - // OBSOLETE orientation builder_skip -// OBSOLETE -page builder_skip - // OBSOLETE src builder_skip diff --git a/engine/core/css/parser/CSSPropertyParser.cpp b/engine/core/css/parser/CSSPropertyParser.cpp index 2647d832434..190f3aa71c8 100644 --- a/engine/core/css/parser/CSSPropertyParser.cpp +++ b/engine/core/css/parser/CSSPropertyParser.cpp @@ -448,8 +448,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId) RefPtr parsedValue = nullptr; switch (propId) { - case CSSPropertySize: // {1,2} | auto | [ || [ portrait | landscape] ] - return parseSize(propId); case CSSPropertyClip: // | auto | inherit if (id == CSSValueAuto) @@ -1075,8 +1073,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId) return parseTransitionShorthand(propId); case CSSPropertyInvalid: return false; - case CSSPropertyPage: - return parsePage(propId); // CSS Text Layout Module Level 3: Vertical writing support case CSSPropertyWebkitTextEmphasis: return parseShorthand(propId, webkitTextEmphasisShorthand()); @@ -1553,101 +1549,6 @@ bool CSSPropertyParser::parse4Values(CSSPropertyID propId, const CSSPropertyID * return true; } -// auto | -bool CSSPropertyParser::parsePage(CSSPropertyID propId) -{ - ASSERT(propId == CSSPropertyPage); - - if (m_valueList->size() != 1) - return false; - - CSSParserValue* value = m_valueList->current(); - if (!value) - return false; - - if (value->id == CSSValueAuto) { - addProperty(propId, cssValuePool().createIdentifierValue(value->id)); - return true; - } else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) { - addProperty(propId, createPrimitiveStringValue(value)); - return true; - } - return false; -} - -// {1,2} | auto | [ || [ portrait | landscape] ] -bool CSSPropertyParser::parseSize(CSSPropertyID propId) -{ - ASSERT(propId == CSSPropertySize); - - if (m_valueList->size() > 2) - return false; - - CSSParserValue* value = m_valueList->current(); - if (!value) - return false; - - RefPtr parsedValues = CSSValueList::createSpaceSeparated(); - - // First parameter. - SizeParameterType paramType = parseSizeParameter(parsedValues.get(), value, None); - if (paramType == None) - return false; - - // Second parameter, if any. - value = m_valueList->next(); - if (value) { - paramType = parseSizeParameter(parsedValues.get(), value, paramType); - if (paramType == None) - return false; - } - - addProperty(propId, parsedValues.release()); - return true; -} - -CSSPropertyParser::SizeParameterType CSSPropertyParser::parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType) -{ - switch (value->id) { - case CSSValueAuto: - if (prevParamType == None) { - parsedValues->append(cssValuePool().createIdentifierValue(value->id)); - return Auto; - } - return None; - case CSSValueLandscape: - case CSSValuePortrait: - if (prevParamType == None || prevParamType == PageSize) { - parsedValues->append(cssValuePool().createIdentifierValue(value->id)); - return Orientation; - } - return None; - case CSSValueA3: - case CSSValueA4: - case CSSValueA5: - case CSSValueB4: - case CSSValueB5: - case CSSValueLedger: - case CSSValueLegal: - case CSSValueLetter: - if (prevParamType == None || prevParamType == Orientation) { - // Normalize to Page Size then Orientation order by prepending. - // This is not specified by the CSS3 Paged Media specification, but for simpler processing later (StyleResolver::applyPageSizeProperty). - parsedValues->prepend(cssValuePool().createIdentifierValue(value->id)); - return PageSize; - } - return None; - case 0: - if (validUnit(value, FLength | FNonNeg) && (prevParamType == None || prevParamType == Length)) { - parsedValues->append(createPrimitiveNumericValue(value)); - return Length; - } - return None; - default: - return None; - } -} - PassRefPtr CSSPropertyParser::parseAttr(CSSParserValueList* args) { if (args->size() != 1) diff --git a/engine/core/css/parser/CSSPropertyParser.h b/engine/core/css/parser/CSSPropertyParser.h index 114a604f530..a996f7bac9c 100644 --- a/engine/core/css/parser/CSSPropertyParser.h +++ b/engine/core/css/parser/CSSPropertyParser.h @@ -222,18 +222,6 @@ private: PassRefPtr parseInsetRoundedCorners(PassRefPtr, CSSParserValueList*); - enum SizeParameterType { - None, - Auto, - Length, - PageSize, - Orientation, - }; - - bool parsePage(CSSPropertyID propId); - bool parseSize(CSSPropertyID propId); - SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue*, SizeParameterType prevParamType); - bool parseFontFaceSrcURI(CSSValueList*); bool parseFontFaceSrcLocal(CSSValueList*); diff --git a/engine/core/css/resolver/StyleBuilderCustom.cpp b/engine/core/css/resolver/StyleBuilderCustom.cpp index 4fd7cb55501..eae59285b51 100644 --- a/engine/core/css/resolver/StyleBuilderCustom.cpp +++ b/engine/core/css/resolver/StyleBuilderCustom.cpp @@ -192,151 +192,6 @@ void StyleBuilderFunctions::applyValueCSSPropertyOutlineStyle(StyleResolverState state.style()->setOutlineStyle(*primitiveValue); } -static Length mmLength(double mm) { return Length(mm * cssPixelsPerMillimeter, Fixed); } -static Length inchLength(double inch) { return Length(inch * cssPixelsPerInch, Fixed); } -static bool getPageSizeFromName(CSSPrimitiveValue* pageSizeName, CSSPrimitiveValue* pageOrientation, Length& width, Length& height) -{ - DEFINE_STATIC_LOCAL(Length, a5Width, (mmLength(148))); - DEFINE_STATIC_LOCAL(Length, a5Height, (mmLength(210))); - DEFINE_STATIC_LOCAL(Length, a4Width, (mmLength(210))); - DEFINE_STATIC_LOCAL(Length, a4Height, (mmLength(297))); - DEFINE_STATIC_LOCAL(Length, a3Width, (mmLength(297))); - DEFINE_STATIC_LOCAL(Length, a3Height, (mmLength(420))); - DEFINE_STATIC_LOCAL(Length, b5Width, (mmLength(176))); - DEFINE_STATIC_LOCAL(Length, b5Height, (mmLength(250))); - DEFINE_STATIC_LOCAL(Length, b4Width, (mmLength(250))); - DEFINE_STATIC_LOCAL(Length, b4Height, (mmLength(353))); - DEFINE_STATIC_LOCAL(Length, letterWidth, (inchLength(8.5))); - DEFINE_STATIC_LOCAL(Length, letterHeight, (inchLength(11))); - DEFINE_STATIC_LOCAL(Length, legalWidth, (inchLength(8.5))); - DEFINE_STATIC_LOCAL(Length, legalHeight, (inchLength(14))); - DEFINE_STATIC_LOCAL(Length, ledgerWidth, (inchLength(11))); - DEFINE_STATIC_LOCAL(Length, ledgerHeight, (inchLength(17))); - - if (!pageSizeName) - return false; - - switch (pageSizeName->getValueID()) { - case CSSValueA5: - width = a5Width; - height = a5Height; - break; - case CSSValueA4: - width = a4Width; - height = a4Height; - break; - case CSSValueA3: - width = a3Width; - height = a3Height; - break; - case CSSValueB5: - width = b5Width; - height = b5Height; - break; - case CSSValueB4: - width = b4Width; - height = b4Height; - break; - case CSSValueLetter: - width = letterWidth; - height = letterHeight; - break; - case CSSValueLegal: - width = legalWidth; - height = legalHeight; - break; - case CSSValueLedger: - width = ledgerWidth; - height = ledgerHeight; - break; - default: - return false; - } - - if (pageOrientation) { - switch (pageOrientation->getValueID()) { - case CSSValueLandscape: - std::swap(width, height); - break; - case CSSValuePortrait: - // Nothing to do. - break; - default: - return false; - } - } - return true; -} - -void StyleBuilderFunctions::applyInitialCSSPropertySize(StyleResolverState&) { } -void StyleBuilderFunctions::applyInheritCSSPropertySize(StyleResolverState&) { } -void StyleBuilderFunctions::applyValueCSSPropertySize(StyleResolverState& state, CSSValue* value) -{ - state.style()->resetPageSizeType(); - Length width; - Length height; - PageSizeType pageSizeType = PAGE_SIZE_AUTO; - CSSValueListInspector inspector(value); - switch (inspector.length()) { - case 2: { - // {2} | - if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue()) - return; - CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first()); - CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second()); - if (first->isLength()) { - // {2} - if (!second->isLength()) - return; - width = first->computeLength(state.cssToLengthConversionData()); - height = second->computeLength(state.cssToLengthConversionData()); - } else { - // - // The value order is guaranteed. See BisonCSSParser::parseSizeParameter. - if (!getPageSizeFromName(first, second, width, height)) - return; - } - pageSizeType = PAGE_SIZE_RESOLVED; - break; - } - case 1: { - // | auto | | [ portrait | landscape] - if (!inspector.first()->isPrimitiveValue()) - return; - CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first()); - if (primitiveValue->isLength()) { - // - pageSizeType = PAGE_SIZE_RESOLVED; - width = height = primitiveValue->computeLength(state.cssToLengthConversionData()); - } else { - switch (primitiveValue->getValueID()) { - case 0: - return; - case CSSValueAuto: - pageSizeType = PAGE_SIZE_AUTO; - break; - case CSSValuePortrait: - pageSizeType = PAGE_SIZE_AUTO_PORTRAIT; - break; - case CSSValueLandscape: - pageSizeType = PAGE_SIZE_AUTO_LANDSCAPE; - break; - default: - // - pageSizeType = PAGE_SIZE_RESOLVED; - if (!getPageSizeFromName(primitiveValue, 0, width, height)) - return; - } - } - break; - } - default: - return; - } - state.style()->setPageSizeType(pageSizeType); - state.style()->setPageSize(LengthSize(width, height)); -} - void StyleBuilderFunctions::applyValueCSSPropertyTextAlign(StyleResolverState& state, CSSValue* value) { if (!value->isPrimitiveValue()) diff --git a/engine/core/rendering/style/RenderStyle.h b/engine/core/rendering/style/RenderStyle.h index 8fde02cc1b3..f19d2eeeef3 100644 --- a/engine/core/rendering/style/RenderStyle.h +++ b/engine/core/rendering/style/RenderStyle.h @@ -676,8 +676,6 @@ public: bool hasPerspective() const { return rareNonInheritedData->m_perspective > 0; } const Length& perspectiveOriginX() const { return rareNonInheritedData->m_perspectiveOriginX; } const Length& perspectiveOriginY() const { return rareNonInheritedData->m_perspectiveOriginY; } - const LengthSize& pageSize() const { return rareNonInheritedData->m_pageSize; } - PageSizeType pageSizeType() const { return static_cast(rareNonInheritedData->m_pageSizeType); } LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; } Color tapHighlightColor() const { return rareInheritedData->tapHighlightColor; } @@ -961,9 +959,6 @@ public: void setPerspective(float p) { SET_VAR(rareNonInheritedData, m_perspective, p); } void setPerspectiveOriginX(const Length& l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginX, l); } void setPerspectiveOriginY(const Length& l) { SET_VAR(rareNonInheritedData, m_perspectiveOriginY, l); } - void setPageSize(const LengthSize& s) { SET_VAR(rareNonInheritedData, m_pageSize, s); } - void setPageSizeType(PageSizeType t) { SET_VAR(rareNonInheritedData, m_pageSizeType, t); } - void resetPageSizeType() { SET_VAR(rareNonInheritedData, m_pageSizeType, PAGE_SIZE_AUTO); } void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); } void setTapHighlightColor(const Color& c) { SET_VAR(rareInheritedData, tapHighlightColor, c); } diff --git a/engine/core/rendering/style/StyleRareNonInheritedData.cpp b/engine/core/rendering/style/StyleRareNonInheritedData.cpp index ca4c4d70da3..55bd752959d 100644 --- a/engine/core/rendering/style/StyleRareNonInheritedData.cpp +++ b/engine/core/rendering/style/StyleRareNonInheritedData.cpp @@ -37,12 +37,10 @@ StyleRareNonInheritedData::StyleRareNonInheritedData() , m_perspective(RenderStyle::initialPerspective()) , m_perspectiveOriginX(RenderStyle::initialPerspectiveOriginX()) , m_perspectiveOriginY(RenderStyle::initialPerspectiveOriginY()) - , m_pageSize() , m_clipPath(RenderStyle::initialClipPath()) , m_textDecorationColor(StyleColor::currentColor()) , m_order(RenderStyle::initialOrder()) , m_objectPosition(RenderStyle::initialObjectPosition()) - , m_pageSizeType(PAGE_SIZE_AUTO) , m_transformStyle3D(RenderStyle::initialTransformStyle3D()) , m_backfaceVisibility(RenderStyle::initialBackfaceVisibility()) , m_alignContent(RenderStyle::initialAlignContent()) @@ -83,12 +81,10 @@ StyleRareNonInheritedData::StyleRareNonInheritedData(const StyleRareNonInherited , m_boxShadow(o.m_boxShadow) , m_animations(o.m_animations ? CSSAnimationData::create(*o.m_animations) : nullptr) , m_transitions(o.m_transitions ? CSSTransitionData::create(*o.m_transitions) : nullptr) - , m_pageSize(o.m_pageSize) , m_clipPath(o.m_clipPath) , m_textDecorationColor(o.m_textDecorationColor) , m_order(o.m_order) , m_objectPosition(o.m_objectPosition) - , m_pageSizeType(o.m_pageSizeType) , m_transformStyle3D(o.m_transformStyle3D) , m_backfaceVisibility(o.m_backfaceVisibility) , m_alignContent(o.m_alignContent) @@ -133,12 +129,10 @@ bool StyleRareNonInheritedData::operator==(const StyleRareNonInheritedData& o) c && shadowDataEquivalent(o) && animationDataEquivalent(o) && transitionDataEquivalent(o) - && m_pageSize == o.m_pageSize && m_clipPath == o.m_clipPath && m_textDecorationColor == o.m_textDecorationColor && m_order == o.m_order && m_objectPosition == o.m_objectPosition - && m_pageSizeType == o.m_pageSizeType && m_transformStyle3D == o.m_transformStyle3D && m_backfaceVisibility == o.m_backfaceVisibility && m_alignContent == o.m_alignContent diff --git a/engine/core/rendering/style/StyleRareNonInheritedData.h b/engine/core/rendering/style/StyleRareNonInheritedData.h index 98c9cad07c0..c8996fc6809 100644 --- a/engine/core/rendering/style/StyleRareNonInheritedData.h +++ b/engine/core/rendering/style/StyleRareNonInheritedData.h @@ -50,16 +50,6 @@ class StyleFlexibleBoxData; class StyleTransformData; class StyleWillChangeData; -// Page size type. -// StyleRareNonInheritedData::m_pageSize is meaningful only when -// StyleRareNonInheritedData::m_pageSizeType is PAGE_SIZE_RESOLVED. -enum PageSizeType { - PAGE_SIZE_AUTO, // size: auto - PAGE_SIZE_AUTO_LANDSCAPE, // size: landscape - PAGE_SIZE_AUTO_PORTRAIT, // size: portrait - PAGE_SIZE_RESOLVED // Size is fully resolved. -}; - // This struct is for rarely used non-inherited CSS3, CSS2, and WebKit-specific properties. // By grouping them together, we save space, and only allocate this object when someone // actually uses one of these properties. @@ -101,8 +91,6 @@ public: OwnPtr m_animations; OwnPtr m_transitions; - LengthSize m_pageSize; - RefPtr m_clipPath; StyleColor m_textDecorationColor; @@ -111,7 +99,6 @@ public: LengthPoint m_objectPosition; - unsigned m_pageSizeType : 2; // PageSizeType unsigned m_transformStyle3D : 1; // ETransformStyle3D unsigned m_backfaceVisibility : 1; // EBackfaceVisibility