| 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 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Lesser General Public | 9 * modify it under the terms of the GNU Lesser General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 #include "core/CSSPropertyNames.h" | 28 #include "core/CSSPropertyNames.h" |
| 29 #include "core/StylePropertyShorthand.h" | 29 #include "core/StylePropertyShorthand.h" |
| 30 #include "core/animation/DocumentAnimations.h" | 30 #include "core/animation/DocumentAnimations.h" |
| 31 #include "core/css/BasicShapeFunctions.h" | 31 #include "core/css/BasicShapeFunctions.h" |
| 32 #include "core/css/CSSAspectRatioValue.h" | 32 #include "core/css/CSSAspectRatioValue.h" |
| 33 #include "core/css/CSSBorderImage.h" | 33 #include "core/css/CSSBorderImage.h" |
| 34 #include "core/css/CSSFilterValue.h" | 34 #include "core/css/CSSFilterValue.h" |
| 35 #include "core/css/CSSFontFeatureValue.h" | 35 #include "core/css/CSSFontFeatureValue.h" |
| 36 #include "core/css/CSSFontValue.h" | 36 #include "core/css/CSSFontValue.h" |
| 37 #include "core/css/CSSFunctionValue.h" | 37 #include "core/css/CSSFunctionValue.h" |
| 38 #include "core/css/CSSGridLineNamesValue.h" | |
| 39 #include "core/css/CSSGridTemplateAreasValue.h" | |
| 40 #include "core/css/CSSLineBoxContainValue.h" | 38 #include "core/css/CSSLineBoxContainValue.h" |
| 41 #include "core/css/parser/BisonCSSParser.h" | 39 #include "core/css/parser/BisonCSSParser.h" |
| 42 #include "core/css/CSSPrimitiveValue.h" | 40 #include "core/css/CSSPrimitiveValue.h" |
| 43 #include "core/css/CSSPrimitiveValueMappings.h" | 41 #include "core/css/CSSPrimitiveValueMappings.h" |
| 44 #include "core/css/CSSPropertyMetadata.h" | 42 #include "core/css/CSSPropertyMetadata.h" |
| 45 #include "core/css/CSSSelector.h" | 43 #include "core/css/CSSSelector.h" |
| 46 #include "core/css/CSSShadowValue.h" | 44 #include "core/css/CSSShadowValue.h" |
| 47 #include "core/css/CSSTimingFunctionValue.h" | 45 #include "core/css/CSSTimingFunctionValue.h" |
| 48 #include "core/css/CSSTransformValue.h" | 46 #include "core/css/CSSTransformValue.h" |
| 49 #include "core/css/CSSValueList.h" | 47 #include "core/css/CSSValueList.h" |
| 50 #include "core/css/CSSValuePool.h" | 48 #include "core/css/CSSValuePool.h" |
| 51 #include "core/css/Pair.h" | 49 #include "core/css/Pair.h" |
| 52 #include "core/css/Rect.h" | 50 #include "core/css/Rect.h" |
| 53 #include "core/css/StylePropertySet.h" | 51 #include "core/css/StylePropertySet.h" |
| 54 #include "core/css/resolver/StyleResolver.h" | 52 #include "core/css/resolver/StyleResolver.h" |
| 55 #include "core/dom/Document.h" | 53 #include "core/dom/Document.h" |
| 56 #include "core/dom/ExceptionCode.h" | 54 #include "core/dom/ExceptionCode.h" |
| 57 #include "core/rendering/RenderBox.h" | 55 #include "core/rendering/RenderBox.h" |
| 58 #include "core/rendering/RenderGrid.h" | |
| 59 #include "core/rendering/style/ContentData.h" | 56 #include "core/rendering/style/ContentData.h" |
| 60 #include "core/rendering/style/RenderStyle.h" | 57 #include "core/rendering/style/RenderStyle.h" |
| 61 #include "core/rendering/style/ShadowList.h" | 58 #include "core/rendering/style/ShadowList.h" |
| 62 #include "core/rendering/style/ShapeValue.h" | 59 #include "core/rendering/style/ShapeValue.h" |
| 63 #include "platform/FontFamilyNames.h" | 60 #include "platform/FontFamilyNames.h" |
| 64 #include "platform/RuntimeEnabledFeatures.h" | 61 #include "platform/RuntimeEnabledFeatures.h" |
| 65 #include "platform/fonts/FontFeatureSettings.h" | 62 #include "platform/fonts/FontFeatureSettings.h" |
| 66 #include "wtf/text/StringBuilder.h" | 63 #include "wtf/text/StringBuilder.h" |
| 67 | 64 |
| 68 namespace blink { | 65 namespace blink { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 CSSPropertyFontKerning, | 123 CSSPropertyFontKerning, |
| 127 CSSPropertyFontSize, | 124 CSSPropertyFontSize, |
| 128 CSSPropertyFontStretch, | 125 CSSPropertyFontStretch, |
| 129 CSSPropertyFontStyle, | 126 CSSPropertyFontStyle, |
| 130 CSSPropertyFontVariant, | 127 CSSPropertyFontVariant, |
| 131 CSSPropertyFontVariantLigatures, | 128 CSSPropertyFontVariantLigatures, |
| 132 CSSPropertyFontWeight, | 129 CSSPropertyFontWeight, |
| 133 CSSPropertyHeight, | 130 CSSPropertyHeight, |
| 134 CSSPropertyImageRendering, | 131 CSSPropertyImageRendering, |
| 135 CSSPropertyIsolation, | 132 CSSPropertyIsolation, |
| 136 CSSPropertyJustifyItems, | |
| 137 CSSPropertyJustifySelf, | |
| 138 CSSPropertyLeft, | 133 CSSPropertyLeft, |
| 139 CSSPropertyLetterSpacing, | 134 CSSPropertyLetterSpacing, |
| 140 CSSPropertyLineHeight, | 135 CSSPropertyLineHeight, |
| 141 CSSPropertyListStyleImage, | 136 CSSPropertyListStyleImage, |
| 142 CSSPropertyListStylePosition, | 137 CSSPropertyListStylePosition, |
| 143 CSSPropertyListStyleType, | 138 CSSPropertyListStyleType, |
| 144 CSSPropertyMarginBottom, | 139 CSSPropertyMarginBottom, |
| 145 CSSPropertyMarginLeft, | 140 CSSPropertyMarginLeft, |
| 146 CSSPropertyMarginRight, | 141 CSSPropertyMarginRight, |
| 147 CSSPropertyMarginTop, | 142 CSSPropertyMarginTop, |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 CSSPropertyAlignContent, | 226 CSSPropertyAlignContent, |
| 232 CSSPropertyAlignItems, | 227 CSSPropertyAlignItems, |
| 233 CSSPropertyAlignSelf, | 228 CSSPropertyAlignSelf, |
| 234 CSSPropertyFlexBasis, | 229 CSSPropertyFlexBasis, |
| 235 CSSPropertyFlexGrow, | 230 CSSPropertyFlexGrow, |
| 236 CSSPropertyFlexShrink, | 231 CSSPropertyFlexShrink, |
| 237 CSSPropertyFlexDirection, | 232 CSSPropertyFlexDirection, |
| 238 CSSPropertyFlexWrap, | 233 CSSPropertyFlexWrap, |
| 239 CSSPropertyJustifyContent, | 234 CSSPropertyJustifyContent, |
| 240 CSSPropertyWebkitFontSmoothing, | 235 CSSPropertyWebkitFontSmoothing, |
| 241 CSSPropertyGridAutoColumns, | |
| 242 CSSPropertyGridAutoFlow, | |
| 243 CSSPropertyGridAutoRows, | |
| 244 CSSPropertyGridColumnEnd, | |
| 245 CSSPropertyGridColumnStart, | |
| 246 CSSPropertyGridTemplateAreas, | |
| 247 CSSPropertyGridTemplateColumns, | |
| 248 CSSPropertyGridTemplateRows, | |
| 249 CSSPropertyGridRowEnd, | |
| 250 CSSPropertyGridRowStart, | |
| 251 CSSPropertyWebkitHighlight, | 236 CSSPropertyWebkitHighlight, |
| 252 CSSPropertyWebkitHyphenateCharacter, | 237 CSSPropertyWebkitHyphenateCharacter, |
| 253 CSSPropertyWebkitLineBoxContain, | 238 CSSPropertyWebkitLineBoxContain, |
| 254 CSSPropertyWebkitLineBreak, | 239 CSSPropertyWebkitLineBreak, |
| 255 CSSPropertyWebkitLineClamp, | 240 CSSPropertyWebkitLineClamp, |
| 256 CSSPropertyWebkitLocale, | 241 CSSPropertyWebkitLocale, |
| 257 CSSPropertyWebkitMarginBeforeCollapse, | 242 CSSPropertyWebkitMarginBeforeCollapse, |
| 258 CSSPropertyWebkitMarginAfterCollapse, | 243 CSSPropertyWebkitMarginAfterCollapse, |
| 259 CSSPropertyWebkitMaskBoxImage, | 244 CSSPropertyWebkitMaskBoxImage, |
| 260 CSSPropertyWebkitMaskBoxImageOutset, | 245 CSSPropertyWebkitMaskBoxImageOutset, |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 default: | 725 default: |
| 741 filterValue = CSSFilterValue::create(CSSFilterValue::UnknownFilterOp
eration); | 726 filterValue = CSSFilterValue::create(CSSFilterValue::UnknownFilterOp
eration); |
| 742 break; | 727 break; |
| 743 } | 728 } |
| 744 list->append(filterValue.release()); | 729 list->append(filterValue.release()); |
| 745 } | 730 } |
| 746 | 731 |
| 747 return list.release(); | 732 return list.release(); |
| 748 } | 733 } |
| 749 | 734 |
| 750 static PassRefPtr<CSSValue> specifiedValueForGridTrackBreadth(const GridLength&
trackBreadth, const RenderStyle& style) | |
| 751 { | |
| 752 if (!trackBreadth.isLength()) | |
| 753 return cssValuePool().createValue(trackBreadth.flex(), CSSPrimitiveValue
::CSS_FR); | |
| 754 | |
| 755 const Length& trackBreadthLength = trackBreadth.length(); | |
| 756 if (trackBreadthLength.isAuto()) | |
| 757 return cssValuePool().createIdentifierValue(CSSValueAuto); | |
| 758 return zoomAdjustedPixelValueForLength(trackBreadthLength, style); | |
| 759 } | |
| 760 | |
| 761 static PassRefPtr<CSSValue> specifiedValueForGridTrackSize(const GridTrackSize&
trackSize, const RenderStyle& style) | |
| 762 { | |
| 763 switch (trackSize.type()) { | |
| 764 case LengthTrackSizing: | |
| 765 return specifiedValueForGridTrackBreadth(trackSize.length(), style); | |
| 766 case MinMaxTrackSizing: | |
| 767 RefPtr<CSSValueList> minMaxTrackBreadths = CSSValueList::createCommaSepa
rated(); | |
| 768 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
minTrackBreadth(), style)); | |
| 769 minMaxTrackBreadths->append(specifiedValueForGridTrackBreadth(trackSize.
maxTrackBreadth(), style)); | |
| 770 return CSSFunctionValue::create("minmax(", minMaxTrackBreadths); | |
| 771 } | |
| 772 ASSERT_NOT_REACHED(); | |
| 773 return nullptr; | |
| 774 } | |
| 775 | |
| 776 static void addValuesForNamedGridLinesAtIndex(const OrderedNamedGridLines& order
edNamedGridLines, size_t i, CSSValueList& list) | |
| 777 { | |
| 778 const Vector<String>& namedGridLines = orderedNamedGridLines.get(i); | |
| 779 if (namedGridLines.isEmpty()) | |
| 780 return; | |
| 781 | |
| 782 RefPtr<CSSGridLineNamesValue> lineNames = CSSGridLineNamesValue::create(); | |
| 783 for (size_t j = 0; j < namedGridLines.size(); ++j) | |
| 784 lineNames->append(cssValuePool().createValue(namedGridLines[j], CSSPrimi
tiveValue::CSS_STRING)); | |
| 785 list.append(lineNames.release()); | |
| 786 } | |
| 787 | |
| 788 static PassRefPtr<CSSValue> valueForGridTrackList(GridTrackSizingDirection direc
tion, RenderObject* renderer, const RenderStyle& style) | |
| 789 { | |
| 790 const Vector<GridTrackSize>& trackSizes = direction == ForColumns ? style.gr
idTemplateColumns() : style.gridTemplateRows(); | |
| 791 const OrderedNamedGridLines& orderedNamedGridLines = direction == ForColumns
? style.orderedNamedGridColumnLines() : style.orderedNamedGridRowLines(); | |
| 792 | |
| 793 // Handle the 'none' case here. | |
| 794 if (!trackSizes.size()) { | |
| 795 ASSERT(orderedNamedGridLines.isEmpty()); | |
| 796 return cssValuePool().createIdentifierValue(CSSValueNone); | |
| 797 } | |
| 798 | |
| 799 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | |
| 800 if (renderer && renderer->isRenderGrid()) { | |
| 801 const Vector<LayoutUnit>& trackPositions = direction == ForColumns ? toR
enderGrid(renderer)->columnPositions() : toRenderGrid(renderer)->rowPositions(); | |
| 802 // There are at least #tracks + 1 grid lines (trackPositions). Apart fro
m that, the grid container can generate implicit grid tracks, | |
| 803 // so we'll have more trackPositions than trackSizes as the latter only
contain the explicit grid. | |
| 804 ASSERT(trackPositions.size() - 1 >= trackSizes.size()); | |
| 805 | |
| 806 for (size_t i = 0; i < trackSizes.size(); ++i) { | |
| 807 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | |
| 808 list->append(zoomAdjustedPixelValue(trackPositions[i + 1] - trackPos
itions[i], style)); | |
| 809 } | |
| 810 } else { | |
| 811 for (size_t i = 0; i < trackSizes.size(); ++i) { | |
| 812 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, i, *list); | |
| 813 list->append(specifiedValueForGridTrackSize(trackSizes[i], style)); | |
| 814 } | |
| 815 } | |
| 816 // Those are the trailing <string>* allowed in the syntax. | |
| 817 addValuesForNamedGridLinesAtIndex(orderedNamedGridLines, trackSizes.size(),
*list); | |
| 818 return list.release(); | |
| 819 } | |
| 820 | |
| 821 static PassRefPtr<CSSValue> valueForGridPosition(const GridPosition& position) | |
| 822 { | |
| 823 if (position.isAuto()) | |
| 824 return cssValuePool().createIdentifierValue(CSSValueAuto); | |
| 825 | |
| 826 if (position.isNamedGridArea()) | |
| 827 return cssValuePool().createValue(position.namedGridLine(), CSSPrimitive
Value::CSS_STRING); | |
| 828 | |
| 829 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | |
| 830 if (position.isSpan()) { | |
| 831 list->append(cssValuePool().createIdentifierValue(CSSValueSpan)); | |
| 832 list->append(cssValuePool().createValue(position.spanPosition(), CSSPrim
itiveValue::CSS_NUMBER)); | |
| 833 } else | |
| 834 list->append(cssValuePool().createValue(position.integerPosition(), CSSP
rimitiveValue::CSS_NUMBER)); | |
| 835 | |
| 836 if (!position.namedGridLine().isNull()) | |
| 837 list->append(cssValuePool().createValue(position.namedGridLine(), CSSPri
mitiveValue::CSS_STRING)); | |
| 838 return list; | |
| 839 } | |
| 840 | |
| 841 static PassRefPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionDat
a::TransitionProperty& property) | 735 static PassRefPtr<CSSValue> createTransitionPropertyValue(const CSSTransitionDat
a::TransitionProperty& property) |
| 842 { | 736 { |
| 843 if (property.propertyType == CSSTransitionData::TransitionNone) | 737 if (property.propertyType == CSSTransitionData::TransitionNone) |
| 844 return cssValuePool().createIdentifierValue(CSSValueNone); | 738 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 845 if (property.propertyType == CSSTransitionData::TransitionAll) | 739 if (property.propertyType == CSSTransitionData::TransitionAll) |
| 846 return cssValuePool().createIdentifierValue(CSSValueAll); | 740 return cssValuePool().createIdentifierValue(CSSValueAll); |
| 847 if (property.propertyType == CSSTransitionData::TransitionUnknown) | 741 if (property.propertyType == CSSTransitionData::TransitionUnknown) |
| 848 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV
alue::CSS_STRING); | 742 return cssValuePool().createValue(property.propertyString, CSSPrimitiveV
alue::CSS_STRING); |
| 849 ASSERT(property.propertyType == CSSTransitionData::TransitionSingleProperty)
; | 743 ASSERT(property.propertyType == CSSTransitionData::TransitionSingleProperty)
; |
| 850 return cssValuePool().createValue(getPropertyNameString(property.propertyId)
, CSSPrimitiveValue::CSS_STRING); | 744 return cssValuePool().createValue(getPropertyNameString(property.propertyId)
, CSSPrimitiveValue::CSS_STRING); |
| (...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 | 1248 |
| 1355 static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle>
style, RenderObject* renderer) | 1249 static bool isLayoutDependent(CSSPropertyID propertyID, PassRefPtr<RenderStyle>
style, RenderObject* renderer) |
| 1356 { | 1250 { |
| 1357 // Some properties only depend on layout in certain conditions which | 1251 // Some properties only depend on layout in certain conditions which |
| 1358 // are specified in the main switch statement below. So we can avoid | 1252 // are specified in the main switch statement below. So we can avoid |
| 1359 // forcing layout in those conditions. The conditions in this switch | 1253 // forcing layout in those conditions. The conditions in this switch |
| 1360 // statement must remain in sync with the conditions in the main switch. | 1254 // statement must remain in sync with the conditions in the main switch. |
| 1361 // FIXME: Some of these cases could be narrowed down or optimized better. | 1255 // FIXME: Some of these cases could be narrowed down or optimized better. |
| 1362 switch (propertyID) { | 1256 switch (propertyID) { |
| 1363 case CSSPropertyBottom: | 1257 case CSSPropertyBottom: |
| 1364 case CSSPropertyGridTemplateColumns: | |
| 1365 case CSSPropertyGridTemplateRows: | |
| 1366 case CSSPropertyHeight: | 1258 case CSSPropertyHeight: |
| 1367 case CSSPropertyLeft: | 1259 case CSSPropertyLeft: |
| 1368 case CSSPropertyRight: | 1260 case CSSPropertyRight: |
| 1369 case CSSPropertyTop: | 1261 case CSSPropertyTop: |
| 1370 case CSSPropertyPerspectiveOrigin: | 1262 case CSSPropertyPerspectiveOrigin: |
| 1371 case CSSPropertyWebkitPerspectiveOrigin: | 1263 case CSSPropertyWebkitPerspectiveOrigin: |
| 1372 case CSSPropertyTransform: | 1264 case CSSPropertyTransform: |
| 1373 case CSSPropertyWebkitTransform: | 1265 case CSSPropertyWebkitTransform: |
| 1374 case CSSPropertyTransformOrigin: | 1266 case CSSPropertyTransformOrigin: |
| 1375 case CSSPropertyWebkitTransformOrigin: | 1267 case CSSPropertyWebkitTransformOrigin: |
| (...skipping 28 matching lines...) Expand all Loading... |
| 1404 PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle(CSSPrope
rtyID propertyID) const | 1296 PassRefPtr<RenderStyle> CSSComputedStyleDeclaration::computeRenderStyle(CSSPrope
rtyID propertyID) const |
| 1405 { | 1297 { |
| 1406 return m_node->computedStyle(m_pseudoElementSpecifier); | 1298 return m_node->computedStyle(m_pseudoElementSpecifier); |
| 1407 } | 1299 } |
| 1408 | 1300 |
| 1409 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) | 1301 static ItemPosition resolveAlignmentAuto(ItemPosition position, Node* element) |
| 1410 { | 1302 { |
| 1411 if (position != ItemPositionAuto) | 1303 if (position != ItemPositionAuto) |
| 1412 return position; | 1304 return position; |
| 1413 | 1305 |
| 1414 bool isFlexOrGrid = element && element->computedStyle() | 1306 bool isFlex = element && element->computedStyle() |
| 1415 && element->computedStyle()->isDisplayFlexibleOrGridBox(); | 1307 && element->computedStyle()->isDisplayFlexibleBox(); |
| 1416 | 1308 |
| 1417 return isFlexOrGrid ? ItemPositionStretch : ItemPositionStart; | 1309 return isFlex ? ItemPositionStretch : ItemPositionStart; |
| 1418 } | 1310 } |
| 1419 | 1311 |
| 1420 static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPo
sition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType posit
ionType) | 1312 static PassRefPtr<CSSValueList> valueForItemPositionWithOverflowAlignment(ItemPo
sition itemPosition, OverflowAlignment overflowAlignment, ItemPositionType posit
ionType) |
| 1421 { | 1313 { |
| 1422 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); | 1314 RefPtr<CSSValueList> result = CSSValueList::createSpaceSeparated(); |
| 1423 if (positionType == LegacyPosition) | 1315 if (positionType == LegacyPosition) |
| 1424 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); | 1316 result->append(CSSPrimitiveValue::createIdentifier(CSSValueLegacy)); |
| 1425 result->append(CSSPrimitiveValue::create(itemPosition)); | 1317 result->append(CSSPrimitiveValue::create(itemPosition)); |
| 1426 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) | 1318 if (itemPosition >= ItemPositionCenter && overflowAlignment != OverflowAlign
mentDefault) |
| 1427 result->append(CSSPrimitiveValue::create(overflowAlignment)); | 1319 result->append(CSSPrimitiveValue::create(overflowAlignment)); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1702 if (!featureSettings || !featureSettings->size()) | 1594 if (!featureSettings || !featureSettings->size()) |
| 1703 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1595 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1704 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); | 1596 RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated(); |
| 1705 for (unsigned i = 0; i < featureSettings->size(); ++i) { | 1597 for (unsigned i = 0; i < featureSettings->size(); ++i) { |
| 1706 const FontFeature& feature = featureSettings->at(i); | 1598 const FontFeature& feature = featureSettings->at(i); |
| 1707 RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::
create(feature.tag(), feature.value()); | 1599 RefPtr<CSSFontFeatureValue> featureValue = CSSFontFeatureValue::
create(feature.tag(), feature.value()); |
| 1708 list->append(featureValue.release()); | 1600 list->append(featureValue.release()); |
| 1709 } | 1601 } |
| 1710 return list.release(); | 1602 return list.release(); |
| 1711 } | 1603 } |
| 1712 case CSSPropertyGridAutoFlow: { | |
| 1713 RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated(); | |
| 1714 switch (style->gridAutoFlow()) { | |
| 1715 case AutoFlowRow: | |
| 1716 case AutoFlowRowDense: | |
| 1717 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); | |
| 1718 break; | |
| 1719 case AutoFlowColumn: | |
| 1720 case AutoFlowColumnDense: | |
| 1721 list->append(cssValuePool().createIdentifierValue(CSSValueColumn
)); | |
| 1722 break; | |
| 1723 case AutoFlowStackRow: | |
| 1724 case AutoFlowStackColumn: | |
| 1725 list->append(cssValuePool().createIdentifierValue(CSSValueStack)
); | |
| 1726 break; | |
| 1727 default: | |
| 1728 ASSERT_NOT_REACHED(); | |
| 1729 } | |
| 1730 | |
| 1731 switch (style->gridAutoFlow()) { | |
| 1732 case AutoFlowRowDense: | |
| 1733 case AutoFlowColumnDense: | |
| 1734 list->append(cssValuePool().createIdentifierValue(CSSValueDense)
); | |
| 1735 break; | |
| 1736 case AutoFlowStackRow: | |
| 1737 list->append(cssValuePool().createIdentifierValue(CSSValueRow)); | |
| 1738 break; | |
| 1739 case AutoFlowStackColumn: | |
| 1740 list->append(cssValuePool().createIdentifierValue(CSSValueColumn
)); | |
| 1741 break; | |
| 1742 default: | |
| 1743 // Do nothing. | |
| 1744 break; | |
| 1745 } | |
| 1746 | |
| 1747 return list.release(); | |
| 1748 } | |
| 1749 // Specs mention that getComputedStyle() should return the used value of
the property instead of the computed | |
| 1750 // one for grid-definition-{rows|columns} but not for the grid-auto-{row
s|columns} as things like | |
| 1751 // grid-auto-columns: 2fr; cannot be resolved to a value in pixels as th
e '2fr' means very different things | |
| 1752 // depending on the size of the explicit grid or the number of implicit
tracks added to the grid. See | |
| 1753 // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html | |
| 1754 case CSSPropertyGridAutoColumns: | |
| 1755 return specifiedValueForGridTrackSize(style->gridAutoColumns(), *sty
le); | |
| 1756 case CSSPropertyGridAutoRows: | |
| 1757 return specifiedValueForGridTrackSize(style->gridAutoRows(), *style)
; | |
| 1758 | |
| 1759 case CSSPropertyGridTemplateColumns: | |
| 1760 return valueForGridTrackList(ForColumns, renderer, *style); | |
| 1761 case CSSPropertyGridTemplateRows: | |
| 1762 return valueForGridTrackList(ForRows, renderer, *style); | |
| 1763 | |
| 1764 case CSSPropertyGridColumnStart: | |
| 1765 return valueForGridPosition(style->gridColumnStart()); | |
| 1766 case CSSPropertyGridColumnEnd: | |
| 1767 return valueForGridPosition(style->gridColumnEnd()); | |
| 1768 case CSSPropertyGridRowStart: | |
| 1769 return valueForGridPosition(style->gridRowStart()); | |
| 1770 case CSSPropertyGridRowEnd: | |
| 1771 return valueForGridPosition(style->gridRowEnd()); | |
| 1772 case CSSPropertyGridColumn: | |
| 1773 return valuesForGridShorthand(gridColumnShorthand()); | |
| 1774 case CSSPropertyGridRow: | |
| 1775 return valuesForGridShorthand(gridRowShorthand()); | |
| 1776 case CSSPropertyGridArea: | |
| 1777 return valuesForGridShorthand(gridAreaShorthand()); | |
| 1778 case CSSPropertyGridTemplate: | |
| 1779 return valuesForGridShorthand(gridTemplateShorthand()); | |
| 1780 case CSSPropertyGrid: | |
| 1781 return valuesForGridShorthand(gridShorthand()); | |
| 1782 case CSSPropertyGridTemplateAreas: | |
| 1783 if (!style->namedGridAreaRowCount()) { | |
| 1784 ASSERT(!style->namedGridAreaColumnCount()); | |
| 1785 return cssValuePool().createIdentifierValue(CSSValueNone); | |
| 1786 } | |
| 1787 | |
| 1788 return CSSGridTemplateAreasValue::create(style->namedGridArea(), sty
le->namedGridAreaRowCount(), style->namedGridAreaColumnCount()); | |
| 1789 | 1604 |
| 1790 case CSSPropertyHeight: | 1605 case CSSPropertyHeight: |
| 1791 if (renderer) { | 1606 if (renderer) { |
| 1792 // According to http://www.w3.org/TR/CSS2/visudet.html#the-heigh
t-property, | 1607 // According to http://www.w3.org/TR/CSS2/visudet.html#the-heigh
t-property, |
| 1793 // the "height" property does not apply for non-replaced inline
elements. | 1608 // the "height" property does not apply for non-replaced inline
elements. |
| 1794 if (!renderer->isReplaced() && renderer->isInline()) | 1609 if (!renderer->isReplaced() && renderer->isInline()) |
| 1795 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1610 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1796 return zoomAdjustedPixelValue(sizingBox(renderer).height(), *sty
le); | 1611 return zoomAdjustedPixelValue(sizingBox(renderer).height(), *sty
le); |
| 1797 } | 1612 } |
| 1798 return zoomAdjustedPixelValueForLength(style->height(), *style); | 1613 return zoomAdjustedPixelValueForLength(style->height(), *style); |
| 1799 case CSSPropertyWebkitHighlight: | 1614 case CSSPropertyWebkitHighlight: |
| 1800 if (style->highlight() == nullAtom) | 1615 if (style->highlight() == nullAtom) |
| 1801 return cssValuePool().createIdentifierValue(CSSValueNone); | 1616 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1802 return cssValuePool().createValue(style->highlight(), CSSPrimitiveVa
lue::CSS_STRING); | 1617 return cssValuePool().createValue(style->highlight(), CSSPrimitiveVa
lue::CSS_STRING); |
| 1803 case CSSPropertyWebkitHyphenateCharacter: | 1618 case CSSPropertyWebkitHyphenateCharacter: |
| 1804 if (style->hyphenationString().isNull()) | 1619 if (style->hyphenationString().isNull()) |
| 1805 return cssValuePool().createIdentifierValue(CSSValueAuto); | 1620 return cssValuePool().createIdentifierValue(CSSValueAuto); |
| 1806 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); | 1621 return cssValuePool().createValue(style->hyphenationString(), CSSPri
mitiveValue::CSS_STRING); |
| 1807 case CSSPropertyImageRendering: | 1622 case CSSPropertyImageRendering: |
| 1808 return CSSPrimitiveValue::create(style->imageRendering()); | 1623 return CSSPrimitiveValue::create(style->imageRendering()); |
| 1809 case CSSPropertyIsolation: | 1624 case CSSPropertyIsolation: |
| 1810 return cssValuePool().createValue(style->isolation()); | 1625 return cssValuePool().createValue(style->isolation()); |
| 1811 case CSSPropertyJustifyItems: | |
| 1812 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->justifyItems(), m_node.get()), style->justifyItemsOverflowAlignment(),
style->justifyItemsPositionType()); | |
| 1813 case CSSPropertyJustifySelf: | |
| 1814 return valueForItemPositionWithOverflowAlignment(resolveAlignmentAut
o(style->justifySelf(), m_node->parentNode()), style->justifySelfOverflowAlignme
nt(), NonLegacyPosition); | |
| 1815 case CSSPropertyLeft: | 1626 case CSSPropertyLeft: |
| 1816 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); | 1627 return valueForPositionOffset(*style, CSSPropertyLeft, renderer); |
| 1817 case CSSPropertyLetterSpacing: | 1628 case CSSPropertyLetterSpacing: |
| 1818 if (!style->letterSpacing()) | 1629 if (!style->letterSpacing()) |
| 1819 return cssValuePool().createIdentifierValue(CSSValueNormal); | 1630 return cssValuePool().createIdentifierValue(CSSValueNormal); |
| 1820 return zoomAdjustedPixelValue(style->letterSpacing(), *style); | 1631 return zoomAdjustedPixelValue(style->letterSpacing(), *style); |
| 1821 case CSSPropertyWebkitLineClamp: | 1632 case CSSPropertyWebkitLineClamp: |
| 1822 if (style->lineClamp().isNone()) | 1633 if (style->lineClamp().isNone()) |
| 1823 return cssValuePool().createIdentifierValue(CSSValueNone); | 1634 return cssValuePool().createIdentifierValue(CSSValueNone); |
| 1824 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); | 1635 return cssValuePool().createValue(style->lineClamp().value(), style-
>lineClamp().isPercentage() ? CSSPrimitiveValue::CSS_PERCENTAGE : CSSPrimitiveVa
lue::CSS_NUMBER); |
| (...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2634 if (showRight) | 2445 if (showRight) |
| 2635 list->append(rightValue.release()); | 2446 list->append(rightValue.release()); |
| 2636 if (showBottom) | 2447 if (showBottom) |
| 2637 list->append(bottomValue.release()); | 2448 list->append(bottomValue.release()); |
| 2638 if (showLeft) | 2449 if (showLeft) |
| 2639 list->append(leftValue.release()); | 2450 list->append(leftValue.release()); |
| 2640 | 2451 |
| 2641 return list.release(); | 2452 return list.release(); |
| 2642 } | 2453 } |
| 2643 | 2454 |
| 2644 PassRefPtr<CSSValueList> CSSComputedStyleDeclaration::valuesForGridShorthand(con
st StylePropertyShorthand& shorthand) const | |
| 2645 { | |
| 2646 RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated(); | |
| 2647 for (size_t i = 0; i < shorthand.length(); ++i) { | |
| 2648 RefPtr<CSSValue> value = getPropertyCSSValue(shorthand.properties()[i],
DoNotUpdateLayout); | |
| 2649 list->append(value.release()); | |
| 2650 } | |
| 2651 return list.release(); | |
| 2652 } | |
| 2653 | |
| 2654 PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyPropertiesI
nSet(const Vector<CSSPropertyID>& properties) const | 2455 PassRefPtr<MutableStylePropertySet> CSSComputedStyleDeclaration::copyPropertiesI
nSet(const Vector<CSSPropertyID>& properties) const |
| 2655 { | 2456 { |
| 2656 Vector<CSSProperty, 256> list; | 2457 Vector<CSSProperty, 256> list; |
| 2657 list.reserveInitialCapacity(properties.size()); | 2458 list.reserveInitialCapacity(properties.size()); |
| 2658 for (unsigned i = 0; i < properties.size(); ++i) { | 2459 for (unsigned i = 0; i < properties.size(); ++i) { |
| 2659 RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); | 2460 RefPtr<CSSValue> value = getPropertyCSSValue(properties[i]); |
| 2660 if (value) | 2461 if (value) |
| 2661 list.append(CSSProperty(properties[i], value.release(), false)); | 2462 list.append(CSSProperty(properties[i], value.release(), false)); |
| 2662 } | 2463 } |
| 2663 return MutableStylePropertySet::create(list.data(), list.size()); | 2464 return MutableStylePropertySet::create(list.data(), list.size()); |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2742 return list.release(); | 2543 return list.release(); |
| 2743 } | 2544 } |
| 2744 | 2545 |
| 2745 void CSSComputedStyleDeclaration::trace(Visitor* visitor) | 2546 void CSSComputedStyleDeclaration::trace(Visitor* visitor) |
| 2746 { | 2547 { |
| 2747 visitor->trace(m_node); | 2548 visitor->trace(m_node); |
| 2748 CSSStyleDeclaration::trace(visitor); | 2549 CSSStyleDeclaration::trace(visitor); |
| 2749 } | 2550 } |
| 2750 | 2551 |
| 2751 } // namespace blink | 2552 } // namespace blink |
| OLD | NEW |