remove 'page' and 'size' since those are for printing, and that's obsolete in our world now

Also it seems we're not parsing @page rules anyway, so this was presumably dead code.

R=eseidel@chromium.org

Review URL: https://codereview.chromium.org/1078883003
This commit is contained in:
Hixie 2015-04-09 15:07:21 -07:00
parent 51e1b37ba2
commit 64a36de094
8 changed files with 0 additions and 295 deletions

View File

@ -2052,11 +2052,6 @@ PassRefPtr<CSSValue> 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:

View File

@ -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

View File

@ -448,8 +448,6 @@ bool CSSPropertyParser::parseValue(CSSPropertyID propId)
RefPtr<CSSValue> parsedValue = nullptr;
switch (propId) {
case CSSPropertySize: // <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
return parseSize(propId);
case CSSPropertyClip: // <shape> | 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 | <identifier>
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;
}
// <length>{1,2} | auto | [ <page-size> || [ 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<CSSValueList> 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<CSSValue> CSSPropertyParser::parseAttr(CSSParserValueList* args)
{
if (args->size() != 1)

View File

@ -222,18 +222,6 @@ private:
PassRefPtr<CSSBasicShape> parseInsetRoundedCorners(PassRefPtr<CSSBasicShapeInset>, 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*);

View File

@ -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: {
// <length>{2} | <page-size> <orientation>
if (!inspector.first()->isPrimitiveValue() || !inspector.second()->isPrimitiveValue())
return;
CSSPrimitiveValue* first = toCSSPrimitiveValue(inspector.first());
CSSPrimitiveValue* second = toCSSPrimitiveValue(inspector.second());
if (first->isLength()) {
// <length>{2}
if (!second->isLength())
return;
width = first->computeLength<Length>(state.cssToLengthConversionData());
height = second->computeLength<Length>(state.cssToLengthConversionData());
} else {
// <page-size> <orientation>
// The value order is guaranteed. See BisonCSSParser::parseSizeParameter.
if (!getPageSizeFromName(first, second, width, height))
return;
}
pageSizeType = PAGE_SIZE_RESOLVED;
break;
}
case 1: {
// <length> | auto | <page-size> | [ portrait | landscape]
if (!inspector.first()->isPrimitiveValue())
return;
CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(inspector.first());
if (primitiveValue->isLength()) {
// <length>
pageSizeType = PAGE_SIZE_RESOLVED;
width = height = primitiveValue->computeLength<Length>(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:
// <page-size>
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())

View File

@ -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<PageSizeType>(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); }

View File

@ -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

View File

@ -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<CSSAnimationData> m_animations;
OwnPtr<CSSTransitionData> m_transitions;
LengthSize m_pageSize;
RefPtr<ClipPathOperation> 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