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