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 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 for (auto& coordinate : coordinates) { | 1346 for (auto& coordinate : coordinates) { |
1347 auto pair = CSSValueList::createSpaceSeparated(); | 1347 auto pair = CSSValueList::createSpaceSeparated(); |
1348 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); | 1348 pair->append(zoomAdjustedPixelValueForLength(coordinate.x(), style)); |
1349 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); | 1349 pair->append(zoomAdjustedPixelValueForLength(coordinate.y(), style)); |
1350 list->append(pair); | 1350 list->append(pair); |
1351 } | 1351 } |
1352 | 1352 |
1353 return list.release(); | 1353 return list.release(); |
1354 } | 1354 } |
1355 | 1355 |
| 1356 static EBreak mapToPageBreakValue(EBreak genericBreakValue) |
| 1357 { |
| 1358 switch (genericBreakValue) { |
| 1359 case BreakAvoidColumn: |
| 1360 case BreakColumn: |
| 1361 case BreakRecto: |
| 1362 case BreakVerso: |
| 1363 return BreakAuto; |
| 1364 case BreakLeft: |
| 1365 case BreakRight: |
| 1366 // TODO(mstensho): "left" and "right" should simply be mapped to that, n
ot "always", according to spec. |
| 1367 case BreakPage: |
| 1368 return BreakAlways; |
| 1369 case BreakAvoidPage: |
| 1370 return BreakAvoid; |
| 1371 default: |
| 1372 return genericBreakValue; |
| 1373 } |
| 1374 } |
| 1375 |
| 1376 static EBreak mapToColumnBreakValue(EBreak genericBreakValue) |
| 1377 { |
| 1378 switch (genericBreakValue) { |
| 1379 case BreakAvoidPage: |
| 1380 case BreakLeft: |
| 1381 case BreakPage: |
| 1382 case BreakRecto: |
| 1383 case BreakRight: |
| 1384 case BreakVerso: |
| 1385 return BreakAuto; |
| 1386 case BreakColumn: |
| 1387 return BreakAlways; |
| 1388 case BreakAvoidColumn: |
| 1389 return BreakAvoid; |
| 1390 default: |
| 1391 return genericBreakValue; |
| 1392 } |
| 1393 } |
| 1394 |
1356 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS
tring customPropertyName, const ComputedStyle& style) | 1395 PassRefPtrWillBeRawPtr<CSSValue> ComputedStyleCSSValueMapping::get(const AtomicS
tring customPropertyName, const ComputedStyle& style) |
1357 { | 1396 { |
1358 StyleVariableData* variables = style.variables(); | 1397 StyleVariableData* variables = style.variables(); |
1359 if (!variables) | 1398 if (!variables) |
1360 return nullptr; | 1399 return nullptr; |
1361 | 1400 |
1362 CSSVariableData* data = variables->getVariable(customPropertyName); | 1401 CSSVariableData* data = variables->getVariable(customPropertyName); |
1363 if (!data) | 1402 if (!data) |
1364 return nullptr; | 1403 return nullptr; |
1365 | 1404 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1560 return zoomAdjustedPixelValue(style.columnGap(), style); | 1599 return zoomAdjustedPixelValue(style.columnGap(), style); |
1561 case CSSPropertyWebkitColumnRuleColor: | 1600 case CSSPropertyWebkitColumnRuleColor: |
1562 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style,
style.columnRuleColor()); | 1601 return allowVisitedStyle ? cssValuePool().createColorValue(style.visited
DependentColor(CSSPropertyOutlineColor).rgb()) : currentColorOrValidColor(style,
style.columnRuleColor()); |
1563 case CSSPropertyWebkitColumnRuleStyle: | 1602 case CSSPropertyWebkitColumnRuleStyle: |
1564 return cssValuePool().createValue(style.columnRuleStyle()); | 1603 return cssValuePool().createValue(style.columnRuleStyle()); |
1565 case CSSPropertyWebkitColumnRuleWidth: | 1604 case CSSPropertyWebkitColumnRuleWidth: |
1566 return zoomAdjustedPixelValue(style.columnRuleWidth(), style); | 1605 return zoomAdjustedPixelValue(style.columnRuleWidth(), style); |
1567 case CSSPropertyWebkitColumnSpan: | 1606 case CSSPropertyWebkitColumnSpan: |
1568 return cssValuePool().createIdentifierValue(style.columnSpan() ? CSSValu
eAll : CSSValueNone); | 1607 return cssValuePool().createIdentifierValue(style.columnSpan() ? CSSValu
eAll : CSSValueNone); |
1569 case CSSPropertyWebkitColumnBreakAfter: | 1608 case CSSPropertyWebkitColumnBreakAfter: |
1570 return cssValuePool().createValue(style.columnBreakAfter()); | 1609 return cssValuePool().createValue(mapToColumnBreakValue(style.breakAfter
())); |
1571 case CSSPropertyWebkitColumnBreakBefore: | 1610 case CSSPropertyWebkitColumnBreakBefore: |
1572 return cssValuePool().createValue(style.columnBreakBefore()); | 1611 return cssValuePool().createValue(mapToColumnBreakValue(style.breakBefor
e())); |
1573 case CSSPropertyWebkitColumnBreakInside: | 1612 case CSSPropertyWebkitColumnBreakInside: |
1574 return cssValuePool().createValue(style.columnBreakInside()); | 1613 return cssValuePool().createValue(mapToColumnBreakValue(style.breakInsid
e())); |
1575 case CSSPropertyWebkitColumnWidth: | 1614 case CSSPropertyWebkitColumnWidth: |
1576 if (style.hasAutoColumnWidth()) | 1615 if (style.hasAutoColumnWidth()) |
1577 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1616 return cssValuePool().createIdentifierValue(CSSValueAuto); |
1578 return zoomAdjustedPixelValue(style.columnWidth(), style); | 1617 return zoomAdjustedPixelValue(style.columnWidth(), style); |
1579 case CSSPropertyTabSize: | 1618 case CSSPropertyTabSize: |
1580 return cssValuePool().createValue( | 1619 return cssValuePool().createValue( |
1581 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP
rimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); | 1620 style.tabSize().getPixelSize(1.0), style.tabSize().isSpaces() ? CSSP
rimitiveValue::UnitType::Number : CSSPrimitiveValue::UnitType::Pixels); |
1582 case CSSPropertyCursor: { | 1621 case CSSPropertyCursor: { |
1583 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; | 1622 RefPtrWillBeRawPtr<CSSValueList> list = nullptr; |
1584 CursorList* cursors = style.cursors(); | 1623 CursorList* cursors = style.cursors(); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1907 if (paddingBottom.isFixed() || !layoutObject || !layoutObject->isBox()) | 1946 if (paddingBottom.isFixed() || !layoutObject || !layoutObject->isBox()) |
1908 return zoomAdjustedPixelValueForLength(paddingBottom, style); | 1947 return zoomAdjustedPixelValueForLength(paddingBottom, style); |
1909 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingBottom(), style); | 1948 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingBottom(), style); |
1910 } | 1949 } |
1911 case CSSPropertyPaddingLeft: { | 1950 case CSSPropertyPaddingLeft: { |
1912 Length paddingLeft = style.paddingLeft(); | 1951 Length paddingLeft = style.paddingLeft(); |
1913 if (paddingLeft.isFixed() || !layoutObject || !layoutObject->isBox()) | 1952 if (paddingLeft.isFixed() || !layoutObject || !layoutObject->isBox()) |
1914 return zoomAdjustedPixelValueForLength(paddingLeft, style); | 1953 return zoomAdjustedPixelValueForLength(paddingLeft, style); |
1915 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingLeft(), style); | 1954 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->computedCSSPadd
ingLeft(), style); |
1916 } | 1955 } |
| 1956 case CSSPropertyBreakAfter: |
| 1957 return cssValuePool().createValue(style.breakAfter()); |
| 1958 case CSSPropertyBreakBefore: |
| 1959 return cssValuePool().createValue(style.breakBefore()); |
| 1960 case CSSPropertyBreakInside: |
| 1961 return cssValuePool().createValue(style.breakInside()); |
1917 case CSSPropertyPageBreakAfter: | 1962 case CSSPropertyPageBreakAfter: |
1918 return cssValuePool().createValue(style.pageBreakAfter()); | 1963 return cssValuePool().createValue(mapToPageBreakValue(style.breakAfter()
)); |
1919 case CSSPropertyPageBreakBefore: | 1964 case CSSPropertyPageBreakBefore: |
1920 return cssValuePool().createValue(style.pageBreakBefore()); | 1965 return cssValuePool().createValue(mapToPageBreakValue(style.breakBefore(
))); |
1921 case CSSPropertyPageBreakInside: { | 1966 case CSSPropertyPageBreakInside: |
1922 EPageBreak pageBreak = style.pageBreakInside(); | 1967 return cssValuePool().createValue(mapToPageBreakValue(style.breakInside(
))); |
1923 ASSERT(pageBreak != PBALWAYS); | |
1924 if (pageBreak == PBALWAYS) | |
1925 return nullptr; | |
1926 return cssValuePool().createValue(style.pageBreakInside()); | |
1927 } | |
1928 case CSSPropertyPosition: | 1968 case CSSPropertyPosition: |
1929 return cssValuePool().createValue(style.position()); | 1969 return cssValuePool().createValue(style.position()); |
1930 case CSSPropertyQuotes: | 1970 case CSSPropertyQuotes: |
1931 if (!style.quotes()) { | 1971 if (!style.quotes()) { |
1932 // TODO(ramya.v): We should return the quote values that we're actua
lly using. | 1972 // TODO(ramya.v): We should return the quote values that we're actua
lly using. |
1933 return nullptr; | 1973 return nullptr; |
1934 } | 1974 } |
1935 if (style.quotes()->size()) { | 1975 if (style.quotes()->size()) { |
1936 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep
arated(); | 1976 RefPtrWillBeRawPtr<CSSValueList> list = CSSValueList::createSpaceSep
arated(); |
1937 for (int i = 0; i < style.quotes()->size(); i++) { | 1977 for (int i = 0; i < style.quotes()->size(); i++) { |
(...skipping 796 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2734 case CSSPropertyAll: | 2774 case CSSPropertyAll: |
2735 return nullptr; | 2775 return nullptr; |
2736 default: | 2776 default: |
2737 break; | 2777 break; |
2738 } | 2778 } |
2739 ASSERT_NOT_REACHED(); | 2779 ASSERT_NOT_REACHED(); |
2740 return nullptr; | 2780 return nullptr; |
2741 } | 2781 } |
2742 | 2782 |
2743 } // namespace blink | 2783 } // namespace blink |
OLD | NEW |