Skip to content
Permalink
Browse files
2010-04-27 Yuzo Fujishima <yuzo@google.com>
        Reviewed by Eric Seidel.

        Enhance CSS parser for Paged Media (Iteration 4)
        Implement page property parsing as specified at http://dev.w3.org/csswg/css3-page/#using-named-pages.
        https://bugs.webkit.org/show_bug.cgi?id=35853

        * printing/page-rule-css-text-expected.txt:
        * printing/page-rule-css-text.html:
2010-04-27  Yuzo Fujishima  <yuzo@google.com>

        Reviewed by Eric Seidel.

        Enhance CSS parser for Paged Media (Iteration 4)
        Implement page property parsing as specified at http://dev.w3.org/csswg/css3-page/#using-named-pages.
        https://bugs.webkit.org/show_bug.cgi?id=35853

        * css/CSSParser.cpp:
        (WebCore::CSSParser::parseValue):
        (WebCore::CSSParser::parsePage):
        * css/CSSParser.h:

Canonical link: https://commits.webkit.org/49655@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@58385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Yuzo Fujishima committed Apr 28, 2010
1 parent dfd4fc3 commit e3479423df099a65890aa8a1e3fb885e152062fb
@@ -1,3 +1,14 @@
2010-04-27 Yuzo Fujishima <yuzo@google.com>

Reviewed by Eric Seidel.

Enhance CSS parser for Paged Media (Iteration 4)
Implement page property parsing as specified at http://dev.w3.org/csswg/css3-page/#using-named-pages.
https://bugs.webkit.org/show_bug.cgi?id=35853

* printing/page-rule-css-text-expected.txt:
* printing/page-rule-css-text.html:

2010-04-27 Yuzo Fujishima <yuzo@google.com>

Reviewed by Dimitri Glazkov.
@@ -17,4 +17,8 @@
@page err_length_and_orientation { }
@page err_orientations { }
@page err_too_many_params { }
table { page: Rotated; }
div { page: auto; }
pre { }
p { }

@@ -63,6 +63,19 @@
size: a5 landscape auto;
}

table {
page: Rotated;
}
div {
page: Auto;
}
pre {
page: Auto Rotated; /* Invalid */
}
p {
page: 1cm; /* Invalid */
}

/* FIXME: Add the following once margin at-rule is implemented.
@page :first {
@@ -1,3 +1,16 @@
2010-04-27 Yuzo Fujishima <yuzo@google.com>

Reviewed by Eric Seidel.

Enhance CSS parser for Paged Media (Iteration 4)
Implement page property parsing as specified at http://dev.w3.org/csswg/css3-page/#using-named-pages.
https://bugs.webkit.org/show_bug.cgi?id=35853

* css/CSSParser.cpp:
(WebCore::CSSParser::parseValue):
(WebCore::CSSParser::parsePage):
* css/CSSParser.h:

2010-04-27 Yuzo Fujishima <yuzo@google.com>

Reviewed by Dimitri Glazkov.
@@ -1694,8 +1694,9 @@ bool CSSParser::parseValue(int propId, bool important)
return parseTransitionShorthand(important);
case CSSPropertyInvalid:
return false;
case CSSPropertyFontStretch:
case CSSPropertyPage:
return parsePage(propId, important);
case CSSPropertyFontStretch:
case CSSPropertyTextLineThrough:
case CSSPropertyTextOverline:
case CSSPropertyTextUnderline:
@@ -2112,6 +2113,28 @@ bool CSSParser::parse4Values(int propId, const int *properties, bool important)
return true;
}

// auto | <identifier>
bool CSSParser::parsePage(int propId, bool important)
{
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, CSSPrimitiveValue::createIdentifier(value->id), important);
return true;
} else if (value->id == 0 && value->unit == CSSPrimitiveValue::CSS_IDENT) {
addProperty(propId, CSSPrimitiveValue::create(value->string, CSSPrimitiveValue::CSS_STRING), important);
return true;
}
return false;
}

// <length>{1,2} | auto | [ <page-size> || [ portrait | landscape] ]
bool CSSParser::parseSize(int propId, bool important)
{
@@ -260,6 +260,7 @@ namespace WebCore {
Orientation,
};

bool parsePage(int propId, bool important);
bool parseSize(int propId, bool important);
SizeParameterType parseSizeParameter(CSSValueList* parsedValues, CSSParserValue* value, SizeParameterType prevParamType);

0 comments on commit e347942

Please sign in to comment.