Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(921)

Unified Diff: sky/engine/core/css/resolver/StyleBuilderCustom.cpp

Issue 1078883003: remove 'page' and 'size' since those are for printing, and that's obsolete in our world now (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: merge with trunk Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sky/engine/core/css/parser/CSSPropertyParser.cpp ('k') | sky/engine/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/core/css/resolver/StyleBuilderCustom.cpp
diff --git a/sky/engine/core/css/resolver/StyleBuilderCustom.cpp b/sky/engine/core/css/resolver/StyleBuilderCustom.cpp
index 4fd7cb55501b71d8956024106fdb4913d1fdbfa9..eae59285b5183f4dd6eae27461f2594af871f146 100644
--- a/sky/engine/core/css/resolver/StyleBuilderCustom.cpp
+++ b/sky/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: {
- // <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())
« no previous file with comments | « sky/engine/core/css/parser/CSSPropertyParser.cpp ('k') | sky/engine/core/rendering/style/RenderStyle.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698