Commit 77d5c0cd authored by yuzo@google.com's avatar yuzo@google.com
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:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@58385 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 734dc152
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 {
......
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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment