OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> | 2 * Copyright (C) 2004 Zack Rusin <zack@kde.org> |
3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc.
All rights reserved. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
7 * Copyright (C) 2015 Google Inc. All rights reserved. | 7 * Copyright (C) 2015 Google Inc. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 10 * modify it under the terms of the GNU Lesser General Public |
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1316 for (auto& coordinate : coordinates) { | 1316 for (auto& coordinate : coordinates) { |
1317 auto pair = CSSValueList::createSpaceSeparated(); | 1317 auto pair = CSSValueList::createSpaceSeparated(); |
1318 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); | 1318 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); |
1319 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); | 1319 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); |
1320 list->append(pair); | 1320 list->append(pair); |
1321 } | 1321 } |
1322 | 1322 |
1323 return list.release(); | 1323 return list.release(); |
1324 } | 1324 } |
1325 | 1325 |
| 1326 static EBreak mapToPageBreakValue(EBreak genericBreakValue) |
| 1327 { |
| 1328 switch (genericBreakValue) { |
| 1329 case BreakAvoidColumn: |
| 1330 case BreakColumn: |
| 1331 case BreakRecto: |
| 1332 case BreakVerso: |
| 1333 return BreakAuto; |
| 1334 case BreakLeft: |
| 1335 case BreakRight: |
| 1336 // TODO(mstensho): "left" and "right" should simply be mapped to that, n
ot "always", according to spec. |
| 1337 case BreakPage: |
| 1338 return BreakAlways; |
| 1339 case BreakAvoidPage: |
| 1340 return BreakAvoid; |
| 1341 default: |
| 1342 return genericBreakValue; |
| 1343 } |
| 1344 } |
| 1345 |
| 1346 static EBreak mapToColumnBreakValue(EBreak genericBreakValue) |
| 1347 { |
| 1348 switch (genericBreakValue) { |
| 1349 case BreakAvoidPage: |
| 1350 case BreakLeft: |
| 1351 case BreakPage: |
| 1352 case BreakRecto: |
| 1353 case BreakRight: |
| 1354 case BreakVerso: |
| 1355 return BreakAuto; |
| 1356 case BreakColumn: |
| 1357 return BreakAlways; |
| 1358 case BreakAvoidColumn: |
| 1359 return BreakAvoid; |
| 1360 default: |
| 1361 return genericBreakValue; |
| 1362 } |
| 1363 } |
| 1364 |
1326 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS
tring customPropertyName, const ComputedStyle& style) | 1365 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS
tring customPropertyName, const ComputedStyle& style) |
1327 { | 1366 { |
1328 StyleVariableData* variables = style.variables(); | 1367 StyleVariableData* variables = style.variables(); |
1329 if (!variables) | 1368 if (!variables) |
1330 return nullptr; | 1369 return nullptr; |
1331 | 1370 |
1332 CSSVariableData* data = variables->getVariable(customPropertyName); | 1371 CSSVariableData* data = variables->getVariable(customPropertyName); |
1333 if (!data) | 1372 if (!data) |
1334 return nullptr; | 1373 return nullptr; |
1335 | 1374 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1530 return zoomAdjustedPixelValue(style.columnGap(), style); | 1569 return zoomAdjustedPixelValue(style.columnGap(), style); |
1531 case CSSPropertyWebkitColumnRuleColor: | 1570 case CSSPropertyWebkitColumnRuleColor: |
1532 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style,
style.columnRuleColor()); | 1571 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style,
style.columnRuleColor()); |
1533 case CSSPropertyWebkitColumnRuleStyle: | 1572 case CSSPropertyWebkitColumnRuleStyle: |
1534 return cssValuePool().createValue(style.columnRuleStyle()); | 1573 return cssValuePool().createValue(style.columnRuleStyle()); |
1535 case CSSPropertyWebkitColumnRuleWidth: | 1574 case CSSPropertyWebkitColumnRuleWidth: |
1536 return zoomAdjustedPixelValue(style.columnRuleWidth(), style); | 1575 return zoomAdjustedPixelValue(style.columnRuleWidth(), style); |
1537 case CSSPropertyWebkitColumnSpan: | 1576 case CSSPropertyWebkitColumnSpan: |
1538 return cssValuePool().createIdentifierValue(style.columnSpan() ? CSSValu
eAll : CSSValueNone); | 1577 return cssValuePool().createIdentifierValue(style.columnSpan() ? CSSValu
eAll : CSSValueNone); |
1539 case CSSPropertyWebkitColumnBreakAfter: | 1578 case CSSPropertyWebkitColumnBreakAfter: |
1540 return cssValuePool().createValue(style.columnBreakAfter()); | 1579 return cssValuePool().createValue(mapToColumnBreakValue(style.breakAfter
())); |
1541 case CSSPropertyWebkitColumnBreakBefore: | 1580 case CSSPropertyWebkitColumnBreakBefore: |
1542 return cssValuePool().createValue(style.columnBreakBefore()); | 1581 return cssValuePool().createValue(mapToColumnBreakValue(style.breakBefor
e())); |
1543 case CSSPropertyWebkitColumnBreakInside: | 1582 case CSSPropertyWebkitColumnBreakInside: |
1544 return cssValuePool().createValue(style.columnBreakInside()); | 1583 return cssValuePool().createValue(mapToColumnBreakValue(style.breakInsid
e())); |
1545 case CSSPropertyWebkitColumnWidth: | 1584 case CSSPropertyWebkitColumnWidth: |
1546 if (style.hasAutoColumnWidth()) | 1585 if (style.hasAutoColumnWidth()) |
1547 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1586 return cssValuePool().createIdentifierValue(CSSValueAuto); |
1548 return zoomAdjustedPixelValue(style.columnWidth(), style); | 1587 return zoomAdjustedPixelValue(style.columnWidth(), style); |
1549 case CSSPropertyTabSize: | 1588 case CSSPropertyTabSize: |
1550 return cssValuePool().createValue( | 1589 return cssValuePool().createValue( |
1551 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP
rimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); | 1590 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP
rimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); |
1552 case CSSPropertyCursor: { | 1591 case CSSPropertyCursor: { |
1553 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | 1592 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; |
1554 CursorList* cursors = style.cursors(); | 1593 CursorList* cursors = style.cursors(); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1877 if (paddingBottom.isFixed() || !layoutObject || !layoutObject->isBox()) | 1916 if (paddingBottom.isFixed() || !layoutObject || !layoutObject->isBox()) |
1878 return zoomAdjustedPixelValueForLength(paddingBottom, style); | 1917 return zoomAdjustedPixelValueForLength(paddingBottom, style); |
1879 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingBottom(), style); | 1918 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingBottom(), style); |
1880 } | 1919 } |
1881 case CSSPropertyPaddingLeft: { | 1920 case CSSPropertyPaddingLeft: { |
1882 Length paddingLeft = style.paddingLeft(); | 1921 Length paddingLeft = style.paddingLeft(); |
1883 if (paddingLeft.isFixed() || !layoutObject || !layoutObject->isBox()) | 1922 if (paddingLeft.isFixed() || !layoutObject || !layoutObject->isBox()) |
1884 return zoomAdjustedPixelValueForLength(paddingLeft, style); | 1923 return zoomAdjustedPixelValueForLength(paddingLeft, style); |
1885 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingLeft(), style); | 1924 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingLeft(), style); |
1886 } | 1925 } |
| 1926 case CSSPropertyBreakAfter: |
| 1927 return cssValuePool().createValue(style.breakAfter()); |
| 1928 case CSSPropertyBreakBefore: |
| 1929 return cssValuePool().createValue(style.breakBefore()); |
| 1930 case CSSPropertyBreakInside: |
| 1931 return cssValuePool().createValue(style.breakInside()); |
1887 case CSSPropertyPageBreakAfter: | 1932 case CSSPropertyPageBreakAfter: |
1888 return cssValuePool().createValue(style.pageBreakAfter()); | 1933 return cssValuePool().createValue(mapToPageBreakValue(style.breakAfter()
)); |
1889 case CSSPropertyPageBreakBefore: | 1934 case CSSPropertyPageBreakBefore: |
1890 return cssValuePool().createValue(style.pageBreakBefore()); | 1935 return cssValuePool().createValue(mapToPageBreakValue(style.breakBefore(
))); |
1891 case CSSPropertyPageBreakInside: { | 1936 case CSSPropertyPageBreakInside: |
1892 EPageBreak pageBreak = style.pageBreakInside(); | 1937 return cssValuePool().createValue(mapToPageBreakValue(style.breakInside(
))); |
1893 ASSERT(pageBreak != PBALWAYS); | |
1894 if (pageBreak == PBALWAYS) | |
1895 return nullptr; | |
1896 return cssValuePool().createValue(style.pageBreakInside()); | |
1897 } | |
1898 case CSSPropertyPosition: | 1938 case CSSPropertyPosition: |
1899 return cssValuePool().createValue(style.position()); | 1939 return cssValuePool().createValue(style.position()); |
1900 case CSSPropertyQuotes: | 1940 case CSSPropertyQuotes: |
1901 if (!style.quotes()) { | 1941 if (!style.quotes()) { |
1902 // TODO(ramya.v): We should return the quote values that we're actua
lly using. | 1942 // TODO(ramya.v): We should return the quote values that we're actua
lly using. |
1903 return nullptr; | 1943 return nullptr; |
1904 } | 1944 } |
1905 if (style.quotes()->size()) { | 1945 if (style.quotes()->size()) { |
1906 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep
arated(); | 1946 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep
arated(); |
1907 for (int i = 0; i < style.quotes()->size(); i++) { | 1947 for (int i = 0; i < style.quotes()->size(); i++) { |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2713 case CSSPropertyAll: | 2753 case CSSPropertyAll: |
2714 return nullptr; | 2754 return nullptr; |
2715 default: | 2755 default: |
2716 break; | 2756 break; |
2717 } | 2757 } |
2718 ASSERT_NOT_REACHED(); | 2758 ASSERT_NOT_REACHED(); |
2719 return nullptr; | 2759 return nullptr; |
2720 } | 2760 } |
2721 | 2761 |
2722 } // namespace blink | 2762 } // namespace blink |
OLD | NEW |