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. |
| 4 * All rights reserved. |
4 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
5 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
6 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
7 * Copyright (C) 2015 Google Inc. All rights reserved. | 8 * Copyright (C) 2015 Google Inc. All rights reserved. |
8 * | 9 * |
9 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Lesser General Public | 11 * modify it under the terms of the GNU Lesser General Public |
11 * License as published by the Free Software Foundation; either | 12 * License as published by the Free Software Foundation; either |
12 * version 2 of the License, or (at your option) any later version. | 13 * version 2 of the License, or (at your option) any later version. |
13 * | 14 * |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 *CSSIdentifierValue::create(layer.backgroundYOrigin())); | 133 *CSSIdentifierValue::create(layer.backgroundYOrigin())); |
133 } | 134 } |
134 positionList->append( | 135 positionList->append( |
135 *zoomAdjustedPixelValueForLength(layer.yPosition(), style)); | 136 *zoomAdjustedPixelValueForLength(layer.yPosition(), style)); |
136 return positionList; | 137 return positionList; |
137 } | 138 } |
138 | 139 |
139 CSSValue* ComputedStyleCSSValueMapping::currentColorOrValidColor( | 140 CSSValue* ComputedStyleCSSValueMapping::currentColorOrValidColor( |
140 const ComputedStyle& style, | 141 const ComputedStyle& style, |
141 const StyleColor& color) { | 142 const StyleColor& color) { |
142 // This function does NOT look at visited information, so that computed style
doesn't expose that. | 143 // This function does NOT look at visited information, so that computed style |
| 144 // doesn't expose that. |
143 return CSSColorValue::create(color.resolve(style.color()).rgb()); | 145 return CSSColorValue::create(color.resolve(style.color()).rgb()); |
144 } | 146 } |
145 | 147 |
146 static CSSValue* valueForFillSize(const FillSize& fillSize, | 148 static CSSValue* valueForFillSize(const FillSize& fillSize, |
147 const ComputedStyle& style) { | 149 const ComputedStyle& style) { |
148 if (fillSize.type == Contain) | 150 if (fillSize.type == Contain) |
149 return CSSIdentifierValue::create(CSSValueContain); | 151 return CSSIdentifierValue::create(CSSValueContain); |
150 | 152 |
151 if (fillSize.type == Cover) | 153 if (fillSize.type == Cover) |
152 return CSSIdentifierValue::create(CSSValueCover); | 154 return CSSIdentifierValue::create(CSSValueCover); |
153 | 155 |
154 if (fillSize.size.height().isAuto()) | 156 if (fillSize.size.height().isAuto()) |
155 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); | 157 return zoomAdjustedPixelValueForLength(fillSize.size.width(), style); |
156 | 158 |
157 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 159 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
158 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); | 160 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.width(), style)); |
159 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.height(), style)); | 161 list->append(*zoomAdjustedPixelValueForLength(fillSize.size.height(), style)); |
160 return list; | 162 return list; |
161 } | 163 } |
162 | 164 |
163 static CSSValue* valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat) { | 165 static CSSValue* valueForFillRepeat(EFillRepeat xRepeat, EFillRepeat yRepeat) { |
164 // For backwards compatibility, if both values are equal, just return one of t
hem. And | 166 // For backwards compatibility, if both values are equal, just return one of |
165 // if the two values are equivalent to repeat-x or repeat-y, just return the s
horthand. | 167 // them. And if the two values are equivalent to repeat-x or repeat-y, just |
| 168 // return the shorthand. |
166 if (xRepeat == yRepeat) | 169 if (xRepeat == yRepeat) |
167 return CSSIdentifierValue::create(xRepeat); | 170 return CSSIdentifierValue::create(xRepeat); |
168 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) | 171 if (xRepeat == RepeatFill && yRepeat == NoRepeatFill) |
169 return CSSIdentifierValue::create(CSSValueRepeatX); | 172 return CSSIdentifierValue::create(CSSValueRepeatX); |
170 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) | 173 if (xRepeat == NoRepeatFill && yRepeat == RepeatFill) |
171 return CSSIdentifierValue::create(CSSValueRepeatY); | 174 return CSSIdentifierValue::create(CSSValueRepeatY); |
172 | 175 |
173 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 176 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
174 list->append(*CSSIdentifierValue::create(xRepeat)); | 177 list->append(*CSSIdentifierValue::create(xRepeat)); |
175 list->append(*CSSIdentifierValue::create(yRepeat)); | 178 list->append(*CSSIdentifierValue::create(yRepeat)); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 LayoutUnit containingBlockSize = | 222 LayoutUnit containingBlockSize = |
220 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyRight) | 223 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyRight) |
221 ? toLayoutBox(layoutObject)->containingBlockLogicalWidthForContent() | 224 ? toLayoutBox(layoutObject)->containingBlockLogicalWidthForContent() |
222 : toLayoutBox(layoutObject) | 225 : toLayoutBox(layoutObject) |
223 ->containingBlockLogicalHeightForGetComputedStyle(); | 226 ->containingBlockLogicalHeightForGetComputedStyle(); |
224 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize), | 227 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize), |
225 style); | 228 style); |
226 } | 229 } |
227 | 230 |
228 if (offset.isAuto() && layoutObject) { | 231 if (offset.isAuto() && layoutObject) { |
229 // If the property applies to a positioned element and the resolved value of
the display | 232 // If the property applies to a positioned element and the resolved value of |
230 // property is not none, the resolved value is the used value. | 233 // the display property is not none, the resolved value is the used value. |
231 if (layoutObject->isInFlowPositioned()) { | 234 if (layoutObject->isInFlowPositioned()) { |
232 // If e.g. left is auto and right is not auto, then left's computed value
is negative right. | 235 // If e.g. left is auto and right is not auto, then left's computed value |
233 // So we get the opposite length unit and see if it is auto. | 236 // is negative right. So we get the opposite length unit and see if it is |
| 237 // auto. |
234 if (opposite.isAuto()) | 238 if (opposite.isAuto()) |
235 return CSSPrimitiveValue::create(0, | 239 return CSSPrimitiveValue::create(0, |
236 CSSPrimitiveValue::UnitType::Pixels); | 240 CSSPrimitiveValue::UnitType::Pixels); |
237 | 241 |
238 if (opposite.isPercentOrCalc() || opposite.isCalculated()) { | 242 if (opposite.isPercentOrCalc() || opposite.isCalculated()) { |
239 if (layoutObject->isBox()) { | 243 if (layoutObject->isBox()) { |
240 LayoutUnit containingBlockSize = | 244 LayoutUnit containingBlockSize = |
241 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyRight) | 245 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyRight) |
242 ? toLayoutBox(layoutObject) | 246 ? toLayoutBox(layoutObject) |
243 ->containingBlockLogicalWidthForContent() | 247 ->containingBlockLogicalWidthForContent() |
244 : toLayoutBox(layoutObject) | 248 : toLayoutBox(layoutObject) |
245 ->containingBlockLogicalHeightForGetComputedStyle(); | 249 ->containingBlockLogicalHeightForGetComputedStyle(); |
246 return zoomAdjustedPixelValue( | 250 return zoomAdjustedPixelValue( |
247 -floatValueForLength(opposite, containingBlockSize), style); | 251 -floatValueForLength(opposite, containingBlockSize), style); |
248 } | 252 } |
249 // FIXME: fall back to auto for position:relative, display:inline | 253 // FIXME: fall back to auto for position:relative, display:inline |
250 return CSSIdentifierValue::create(CSSValueAuto); | 254 return CSSIdentifierValue::create(CSSValueAuto); |
251 } | 255 } |
252 | 256 |
253 // Length doesn't provide operator -, so multiply by -1. | 257 // Length doesn't provide operator -, so multiply by -1. |
254 opposite *= -1.f; | 258 opposite *= -1.f; |
255 return zoomAdjustedPixelValueForLength(opposite, style); | 259 return zoomAdjustedPixelValueForLength(opposite, style); |
256 } | 260 } |
257 | 261 |
258 if (layoutObject->isOutOfFlowPositioned() && layoutObject->isBox()) { | 262 if (layoutObject->isOutOfFlowPositioned() && layoutObject->isBox()) { |
259 // For fixed and absolute positioned elements, the top, left, bottom, and
right | 263 // For fixed and absolute positioned elements, the top, left, bottom, and |
260 // are defined relative to the corresponding sides of the containing block
. | 264 // right are defined relative to the corresponding sides of the containing |
| 265 // block. |
261 LayoutBlock* container = layoutObject->containingBlock(); | 266 LayoutBlock* container = layoutObject->containingBlock(); |
262 const LayoutBox* layoutBox = toLayoutBox(layoutObject); | 267 const LayoutBox* layoutBox = toLayoutBox(layoutObject); |
263 | 268 |
264 // clientOffset is the distance from this object's border edge to the cont
ainer's | 269 // clientOffset is the distance from this object's border edge to the |
265 // padding edge. Thus it includes margins which we subtract below. | 270 // container's padding edge. Thus it includes margins which we subtract |
| 271 // below. |
266 const LayoutSize clientOffset = | 272 const LayoutSize clientOffset = |
267 layoutBox->locationOffset() - | 273 layoutBox->locationOffset() - |
268 LayoutSize(container->clientLeft(), container->clientTop()); | 274 LayoutSize(container->clientLeft(), container->clientTop()); |
269 LayoutUnit position; | 275 LayoutUnit position; |
270 | 276 |
271 switch (propertyID) { | 277 switch (propertyID) { |
272 case CSSPropertyLeft: | 278 case CSSPropertyLeft: |
273 position = clientOffset.width() - layoutBox->marginLeft(); | 279 position = clientOffset.width() - layoutBox->marginLeft(); |
274 break; | 280 break; |
275 case CSSPropertyTop: | 281 case CSSPropertyTop: |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 496 |
491 return CSSReflectValue::create( | 497 return CSSReflectValue::create( |
492 direction, offset, valueForNinePieceImage(reflection->mask(), style)); | 498 direction, offset, valueForNinePieceImage(reflection->mask(), style)); |
493 } | 499 } |
494 | 500 |
495 static CSSValueList* valueForItemPositionWithOverflowAlignment( | 501 static CSSValueList* valueForItemPositionWithOverflowAlignment( |
496 const StyleSelfAlignmentData& data) { | 502 const StyleSelfAlignmentData& data) { |
497 CSSValueList* result = CSSValueList::createSpaceSeparated(); | 503 CSSValueList* result = CSSValueList::createSpaceSeparated(); |
498 if (data.positionType() == LegacyPosition) | 504 if (data.positionType() == LegacyPosition) |
499 result->append(*CSSIdentifierValue::create(CSSValueLegacy)); | 505 result->append(*CSSIdentifierValue::create(CSSValueLegacy)); |
500 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto'
flag to not just mean 'auto' prior to running the StyleAdjuster but also mean 'n
ormal' after running it. | 506 // To avoid needing to copy the RareNonInheritedData, we repurpose the 'auto' |
| 507 // flag to not just mean 'auto' prior to running the StyleAdjuster but also |
| 508 // mean 'normal' after running it. |
501 result->append(*CSSIdentifierValue::create( | 509 result->append(*CSSIdentifierValue::create( |
502 data.position() == ItemPositionAuto | 510 data.position() == ItemPositionAuto |
503 ? ComputedStyle::initialDefaultAlignment().position() | 511 ? ComputedStyle::initialDefaultAlignment().position() |
504 : data.position())); | 512 : data.position())); |
505 if (data.position() >= ItemPositionCenter && | 513 if (data.position() >= ItemPositionCenter && |
506 data.overflow() != OverflowAlignmentDefault) | 514 data.overflow() != OverflowAlignmentDefault) |
507 result->append(*CSSIdentifierValue::create(data.overflow())); | 515 result->append(*CSSIdentifierValue::create(data.overflow())); |
508 ASSERT(result->length() <= 2); | 516 ASSERT(result->length() <= 2); |
509 return result; | 517 return result; |
510 } | 518 } |
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
998 const Vector<GridTrackSize>& trackSizes = | 1006 const Vector<GridTrackSize>& trackSizes = |
999 isRowAxis ? style.gridTemplateColumns() : style.gridTemplateRows(); | 1007 isRowAxis ? style.gridTemplateColumns() : style.gridTemplateRows(); |
1000 const Vector<GridTrackSize>& autoRepeatTrackSizes = | 1008 const Vector<GridTrackSize>& autoRepeatTrackSizes = |
1001 isRowAxis ? style.gridAutoRepeatColumns() : style.gridAutoRepeatRows(); | 1009 isRowAxis ? style.gridAutoRepeatColumns() : style.gridAutoRepeatRows(); |
1002 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); | 1010 bool isLayoutGrid = layoutObject && layoutObject->isLayoutGrid(); |
1003 | 1011 |
1004 // Handle the 'none' case. | 1012 // Handle the 'none' case. |
1005 bool trackListIsEmpty = | 1013 bool trackListIsEmpty = |
1006 trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty(); | 1014 trackSizes.isEmpty() && autoRepeatTrackSizes.isEmpty(); |
1007 if (isLayoutGrid && trackListIsEmpty) { | 1015 if (isLayoutGrid && trackListIsEmpty) { |
1008 // For grids we should consider every listed track, whether implicitly or ex
plicitly | 1016 // For grids we should consider every listed track, whether implicitly or |
1009 // created. Empty grids have a sole grid line per axis. | 1017 // explicitly created. Empty grids have a sole grid line per axis. |
1010 auto& positions = isRowAxis ? toLayoutGrid(layoutObject)->columnPositions() | 1018 auto& positions = isRowAxis ? toLayoutGrid(layoutObject)->columnPositions() |
1011 : toLayoutGrid(layoutObject)->rowPositions(); | 1019 : toLayoutGrid(layoutObject)->rowPositions(); |
1012 trackListIsEmpty = positions.size() == 1; | 1020 trackListIsEmpty = positions.size() == 1; |
1013 } | 1021 } |
1014 | 1022 |
1015 if (trackListIsEmpty) | 1023 if (trackListIsEmpty) |
1016 return CSSIdentifierValue::create(CSSValueNone); | 1024 return CSSIdentifierValue::create(CSSValueNone); |
1017 | 1025 |
1018 size_t autoRepeatTotalTracks = | 1026 size_t autoRepeatTotalTracks = |
1019 isLayoutGrid | 1027 isLayoutGrid |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 IntRect box; | 1399 IntRect box; |
1392 if (layoutObject->isBox()) | 1400 if (layoutObject->isBox()) |
1393 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); | 1401 box = pixelSnappedIntRect(toLayoutBox(layoutObject)->borderBoxRect()); |
1394 | 1402 |
1395 TransformationMatrix transform; | 1403 TransformationMatrix transform; |
1396 style.applyTransform(transform, LayoutSize(box.size()), | 1404 style.applyTransform(transform, LayoutSize(box.size()), |
1397 ComputedStyle::ExcludeTransformOrigin, | 1405 ComputedStyle::ExcludeTransformOrigin, |
1398 ComputedStyle::ExcludeMotionPath, | 1406 ComputedStyle::ExcludeMotionPath, |
1399 ComputedStyle::ExcludeIndependentTransformProperties); | 1407 ComputedStyle::ExcludeIndependentTransformProperties); |
1400 | 1408 |
1401 // FIXME: Need to print out individual functions (https://bugs.webkit.org/show
_bug.cgi?id=23924) | 1409 // FIXME: Need to print out individual functions |
| 1410 // (https://bugs.webkit.org/show_bug.cgi?id=23924) |
1402 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1411 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1403 list->append(*valueForMatrixTransform(transform, style)); | 1412 list->append(*valueForMatrixTransform(transform, style)); |
1404 | 1413 |
1405 return list; | 1414 return list; |
1406 } | 1415 } |
1407 | 1416 |
1408 static CSSValue* createTransitionPropertyValue( | 1417 static CSSValue* createTransitionPropertyValue( |
1409 const CSSTransitionData::TransitionProperty& property) { | 1418 const CSSTransitionData::TransitionProperty& property) { |
1410 if (property.propertyType == CSSTransitionData::TransitionNone) | 1419 if (property.propertyType == CSSTransitionData::TransitionNone) |
1411 return CSSIdentifierValue::create(CSSValueNone); | 1420 return CSSIdentifierValue::create(CSSValueNone); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1784 case FilterOperation::BLUR: | 1793 case FilterOperation::BLUR: |
1785 filterValue = CSSFunctionValue::create(CSSValueBlur); | 1794 filterValue = CSSFunctionValue::create(CSSValueBlur); |
1786 filterValue->append(*zoomAdjustedPixelValue( | 1795 filterValue->append(*zoomAdjustedPixelValue( |
1787 toBlurFilterOperation(filterOperation)->stdDeviation().value(), | 1796 toBlurFilterOperation(filterOperation)->stdDeviation().value(), |
1788 style)); | 1797 style)); |
1789 break; | 1798 break; |
1790 case FilterOperation::DROP_SHADOW: { | 1799 case FilterOperation::DROP_SHADOW: { |
1791 DropShadowFilterOperation* dropShadowOperation = | 1800 DropShadowFilterOperation* dropShadowOperation = |
1792 toDropShadowFilterOperation(filterOperation); | 1801 toDropShadowFilterOperation(filterOperation); |
1793 filterValue = CSSFunctionValue::create(CSSValueDropShadow); | 1802 filterValue = CSSFunctionValue::create(CSSValueDropShadow); |
1794 // We want our computed style to look like that of a text shadow (has ne
ither spread nor inset style). | 1803 // We want our computed style to look like that of a text shadow (has |
| 1804 // neither spread nor inset style). |
1795 ShadowData shadow(dropShadowOperation->location(), | 1805 ShadowData shadow(dropShadowOperation->location(), |
1796 dropShadowOperation->stdDeviation(), 0, Normal, | 1806 dropShadowOperation->stdDeviation(), 0, Normal, |
1797 StyleColor(dropShadowOperation->getColor())); | 1807 StyleColor(dropShadowOperation->getColor())); |
1798 filterValue->append(*valueForShadowData(shadow, style, false)); | 1808 filterValue->append(*valueForShadowData(shadow, style, false)); |
1799 break; | 1809 break; |
1800 } | 1810 } |
1801 default: | 1811 default: |
1802 ASSERT_NOT_REACHED(); | 1812 ASSERT_NOT_REACHED(); |
1803 break; | 1813 break; |
1804 } | 1814 } |
1805 list->append(*filterValue); | 1815 list->append(*filterValue); |
1806 } | 1816 } |
1807 | 1817 |
1808 return list; | 1818 return list; |
1809 } | 1819 } |
1810 | 1820 |
1811 CSSValue* ComputedStyleCSSValueMapping::valueForFont( | 1821 CSSValue* ComputedStyleCSSValueMapping::valueForFont( |
1812 const ComputedStyle& style) { | 1822 const ComputedStyle& style) { |
1813 // Add a slash between size and line-height. | 1823 // Add a slash between size and line-height. |
1814 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated(); | 1824 CSSValueList* sizeAndLineHeight = CSSValueList::createSlashSeparated(); |
1815 sizeAndLineHeight->append(*valueForFontSize(style)); | 1825 sizeAndLineHeight->append(*valueForFontSize(style)); |
1816 sizeAndLineHeight->append(*valueForLineHeight(style)); | 1826 sizeAndLineHeight->append(*valueForLineHeight(style)); |
1817 | 1827 |
1818 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 1828 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
1819 list->append(*valueForFontStyle(style)); | 1829 list->append(*valueForFontStyle(style)); |
1820 | 1830 |
1821 // Check that non-initial font-variant subproperties are not conflicting with
this serialization. | 1831 // Check that non-initial font-variant subproperties are not conflicting with |
| 1832 // this serialization. |
1822 CSSValue* ligaturesValue = valueForFontVariantLigatures(style); | 1833 CSSValue* ligaturesValue = valueForFontVariantLigatures(style); |
1823 CSSValue* numericValue = valueForFontVariantNumeric(style); | 1834 CSSValue* numericValue = valueForFontVariantNumeric(style); |
1824 if (!ligaturesValue->equals(*CSSIdentifierValue::create(CSSValueNormal)) || | 1835 if (!ligaturesValue->equals(*CSSIdentifierValue::create(CSSValueNormal)) || |
1825 !numericValue->equals(*CSSIdentifierValue::create(CSSValueNormal))) | 1836 !numericValue->equals(*CSSIdentifierValue::create(CSSValueNormal))) |
1826 return nullptr; | 1837 return nullptr; |
1827 | 1838 |
1828 CSSIdentifierValue* capsValue = valueForFontVariantCaps(style); | 1839 CSSIdentifierValue* capsValue = valueForFontVariantCaps(style); |
1829 if (capsValue->getValueID() != CSSValueNormal && | 1840 if (capsValue->getValueID() != CSSValueNormal && |
1830 capsValue->getValueID() != CSSValueSmallCaps) | 1841 capsValue->getValueID() != CSSValueSmallCaps) |
1831 return nullptr; | 1842 return nullptr; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2347 case AutoFlowColumnDense: | 2358 case AutoFlowColumnDense: |
2348 list->append(*CSSIdentifierValue::create(CSSValueDense)); | 2359 list->append(*CSSIdentifierValue::create(CSSValueDense)); |
2349 break; | 2360 break; |
2350 default: | 2361 default: |
2351 // Do nothing. | 2362 // Do nothing. |
2352 break; | 2363 break; |
2353 } | 2364 } |
2354 | 2365 |
2355 return list; | 2366 return list; |
2356 } | 2367 } |
2357 // Specs mention that getComputedStyle() should return the used value of the
property instead of the computed | 2368 // Specs mention that getComputedStyle() should return the used value of the |
2358 // one for grid-template-{rows|columns} but not for the grid-auto-{rows|colu
mns} as things like | 2369 // property instead of the computed one for grid-template-{rows|columns} but |
2359 // grid-auto-columns: 2fr; cannot be resolved to a value in pixels as the '2
fr' means very different things | 2370 // not for the grid-auto-{rows|columns} as things like grid-auto-columns: |
2360 // depending on the size of the explicit grid or the number of implicit trac
ks added to the grid. See | 2371 // 2fr; cannot be resolved to a value in pixels as the '2fr' means very |
| 2372 // different things depending on the size of the explicit grid or the number |
| 2373 // of implicit tracks added to the grid. See |
2361 // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html | 2374 // http://lists.w3.org/Archives/Public/www-style/2013Nov/0014.html |
2362 case CSSPropertyGridAutoColumns: | 2375 case CSSPropertyGridAutoColumns: |
2363 return valueForGridTrackSizeList(ForColumns, style); | 2376 return valueForGridTrackSizeList(ForColumns, style); |
2364 case CSSPropertyGridAutoRows: | 2377 case CSSPropertyGridAutoRows: |
2365 return valueForGridTrackSizeList(ForRows, style); | 2378 return valueForGridTrackSizeList(ForRows, style); |
2366 | 2379 |
2367 case CSSPropertyGridTemplateColumns: | 2380 case CSSPropertyGridTemplateColumns: |
2368 return valueForGridTrackList(ForColumns, layoutObject, style); | 2381 return valueForGridTrackList(ForColumns, layoutObject, style); |
2369 case CSSPropertyGridTemplateRows: | 2382 case CSSPropertyGridTemplateRows: |
2370 return valueForGridTrackList(ForRows, layoutObject, style); | 2383 return valueForGridTrackList(ForRows, layoutObject, style); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2405 case CSSPropertyGridColumnGap: | 2418 case CSSPropertyGridColumnGap: |
2406 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style); | 2419 return zoomAdjustedPixelValueForLength(style.gridColumnGap(), style); |
2407 case CSSPropertyGridRowGap: | 2420 case CSSPropertyGridRowGap: |
2408 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style); | 2421 return zoomAdjustedPixelValueForLength(style.gridRowGap(), style); |
2409 case CSSPropertyGridGap: | 2422 case CSSPropertyGridGap: |
2410 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObject, | 2423 return valuesForShorthandProperty(gridGapShorthand(), style, layoutObject, |
2411 styledNode, allowVisitedStyle); | 2424 styledNode, allowVisitedStyle); |
2412 | 2425 |
2413 case CSSPropertyHeight: | 2426 case CSSPropertyHeight: |
2414 if (layoutObject) { | 2427 if (layoutObject) { |
2415 // According to http://www.w3.org/TR/CSS2/visudet.html#the-height-proper
ty, | 2428 // According to |
2416 // the "height" property does not apply for non-atomic inline elements. | 2429 // http://www.w3.org/TR/CSS2/visudet.html#the-height-property, the |
| 2430 // "height" property does not apply for non-atomic inline elements. |
2417 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline()) | 2431 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline()) |
2418 return CSSIdentifierValue::create(CSSValueAuto); | 2432 return CSSIdentifierValue::create(CSSValueAuto); |
2419 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), style); | 2433 return zoomAdjustedPixelValue(sizingBox(layoutObject).height(), style); |
2420 } | 2434 } |
2421 return zoomAdjustedPixelValueForLength(style.height(), style); | 2435 return zoomAdjustedPixelValueForLength(style.height(), style); |
2422 case CSSPropertyWebkitHighlight: | 2436 case CSSPropertyWebkitHighlight: |
2423 if (style.highlight() == nullAtom) | 2437 if (style.highlight() == nullAtom) |
2424 return CSSIdentifierValue::create(CSSValueNone); | 2438 return CSSIdentifierValue::create(CSSValueNone); |
2425 return CSSStringValue::create(style.highlight()); | 2439 return CSSStringValue::create(style.highlight()); |
2426 case CSSPropertyHyphens: | 2440 case CSSPropertyHyphens: |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2475 return zoomAdjustedPixelValueForLength(marginTop, style); | 2489 return zoomAdjustedPixelValueForLength(marginTop, style); |
2476 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginTop(), | 2490 return zoomAdjustedPixelValue(toLayoutBox(layoutObject)->marginTop(), |
2477 style); | 2491 style); |
2478 } | 2492 } |
2479 case CSSPropertyMarginRight: { | 2493 case CSSPropertyMarginRight: { |
2480 Length marginRight = style.marginRight(); | 2494 Length marginRight = style.marginRight(); |
2481 if (marginRight.isFixed() || !layoutObject || !layoutObject->isBox()) | 2495 if (marginRight.isFixed() || !layoutObject || !layoutObject->isBox()) |
2482 return zoomAdjustedPixelValueForLength(marginRight, style); | 2496 return zoomAdjustedPixelValueForLength(marginRight, style); |
2483 float value; | 2497 float value; |
2484 if (marginRight.isPercentOrCalc()) { | 2498 if (marginRight.isPercentOrCalc()) { |
2485 // LayoutBox gives a marginRight() that is the distance between the righ
t-edge of the child box | 2499 // LayoutBox gives a marginRight() that is the distance between the |
2486 // and the right-edge of the containing box, when display == EDisplay::B
lock. Let's calculate the absolute | 2500 // right-edge of the child box and the right-edge of the containing box, |
2487 // value of the specified margin-right % instead of relying on LayoutBox
's marginRight() value. | 2501 // when display == EDisplay::Block. Let's calculate the absolute value |
| 2502 // of the specified margin-right % instead of relying on LayoutBox's |
| 2503 // marginRight() value. |
2488 value = minimumValueForLength( | 2504 value = minimumValueForLength( |
2489 marginRight, toLayoutBox(layoutObject) | 2505 marginRight, toLayoutBox(layoutObject) |
2490 ->containingBlockLogicalWidthForContent()) | 2506 ->containingBlockLogicalWidthForContent()) |
2491 .toFloat(); | 2507 .toFloat(); |
2492 } else { | 2508 } else { |
2493 value = toLayoutBox(layoutObject)->marginRight().toFloat(); | 2509 value = toLayoutBox(layoutObject)->marginRight().toFloat(); |
2494 } | 2510 } |
2495 return zoomAdjustedPixelValue(value, style); | 2511 return zoomAdjustedPixelValue(value, style); |
2496 } | 2512 } |
2497 case CSSPropertyMarginBottom: { | 2513 case CSSPropertyMarginBottom: { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2616 case CSSPropertyPageBreakBefore: | 2632 case CSSPropertyPageBreakBefore: |
2617 return CSSIdentifierValue::create( | 2633 return CSSIdentifierValue::create( |
2618 mapToPageBreakValue(style.breakBefore())); | 2634 mapToPageBreakValue(style.breakBefore())); |
2619 case CSSPropertyPageBreakInside: | 2635 case CSSPropertyPageBreakInside: |
2620 return CSSIdentifierValue::create( | 2636 return CSSIdentifierValue::create( |
2621 mapToPageBreakValue(style.breakInside())); | 2637 mapToPageBreakValue(style.breakInside())); |
2622 case CSSPropertyPosition: | 2638 case CSSPropertyPosition: |
2623 return CSSIdentifierValue::create(style.position()); | 2639 return CSSIdentifierValue::create(style.position()); |
2624 case CSSPropertyQuotes: | 2640 case CSSPropertyQuotes: |
2625 if (!style.quotes()) { | 2641 if (!style.quotes()) { |
2626 // TODO(ramya.v): We should return the quote values that we're actually
using. | 2642 // TODO(ramya.v): We should return the quote values that we're actually |
| 2643 // using. |
2627 return nullptr; | 2644 return nullptr; |
2628 } | 2645 } |
2629 if (style.quotes()->size()) { | 2646 if (style.quotes()->size()) { |
2630 CSSValueList* list = CSSValueList::createSpaceSeparated(); | 2647 CSSValueList* list = CSSValueList::createSpaceSeparated(); |
2631 for (int i = 0; i < style.quotes()->size(); i++) { | 2648 for (int i = 0; i < style.quotes()->size(); i++) { |
2632 list->append( | 2649 list->append( |
2633 *CSSStringValue::create(style.quotes()->getOpenQuote(i))); | 2650 *CSSStringValue::create(style.quotes()->getOpenQuote(i))); |
2634 list->append( | 2651 list->append( |
2635 *CSSStringValue::create(style.quotes()->getCloseQuote(i))); | 2652 *CSSStringValue::create(style.quotes()->getCloseQuote(i))); |
2636 } | 2653 } |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2760 return nullptr; | 2777 return nullptr; |
2761 case CSSPropertyVisibility: | 2778 case CSSPropertyVisibility: |
2762 return CSSIdentifierValue::create(style.visibility()); | 2779 return CSSIdentifierValue::create(style.visibility()); |
2763 case CSSPropertyWhiteSpace: | 2780 case CSSPropertyWhiteSpace: |
2764 return CSSIdentifierValue::create(style.whiteSpace()); | 2781 return CSSIdentifierValue::create(style.whiteSpace()); |
2765 case CSSPropertyWidows: | 2782 case CSSPropertyWidows: |
2766 return CSSPrimitiveValue::create(style.widows(), | 2783 return CSSPrimitiveValue::create(style.widows(), |
2767 CSSPrimitiveValue::UnitType::Number); | 2784 CSSPrimitiveValue::UnitType::Number); |
2768 case CSSPropertyWidth: | 2785 case CSSPropertyWidth: |
2769 if (layoutObject) { | 2786 if (layoutObject) { |
2770 // According to http://www.w3.org/TR/CSS2/visudet.html#the-width-propert
y, | 2787 // According to |
| 2788 // http://www.w3.org/TR/CSS2/visudet.html#the-width-property, |
2771 // the "width" property does not apply for non-atomic inline elements. | 2789 // the "width" property does not apply for non-atomic inline elements. |
2772 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline()) | 2790 if (!layoutObject->isAtomicInlineLevel() && layoutObject->isInline()) |
2773 return CSSIdentifierValue::create(CSSValueAuto); | 2791 return CSSIdentifierValue::create(CSSValueAuto); |
2774 return zoomAdjustedPixelValue(sizingBox(layoutObject).width(), style); | 2792 return zoomAdjustedPixelValue(sizingBox(layoutObject).width(), style); |
2775 } | 2793 } |
2776 return zoomAdjustedPixelValueForLength(style.width(), style); | 2794 return zoomAdjustedPixelValueForLength(style.width(), style); |
2777 case CSSPropertyWillChange: | 2795 case CSSPropertyWillChange: |
2778 return valueForWillChange(style.willChangeProperties(), | 2796 return valueForWillChange(style.willChangeProperties(), |
2779 style.willChangeContents(), | 2797 style.willChangeContents(), |
2780 style.willChangeScrollPosition()); | 2798 style.willChangeScrollPosition()); |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2965 case CSSPropertyWebkitMaskBoxImageSlice: | 2983 case CSSPropertyWebkitMaskBoxImageSlice: |
2966 return valueForNinePieceImageSlice(style.maskBoxImage()); | 2984 return valueForNinePieceImageSlice(style.maskBoxImage()); |
2967 case CSSPropertyWebkitMaskBoxImageWidth: | 2985 case CSSPropertyWebkitMaskBoxImageWidth: |
2968 return valueForNinePieceImageQuad(style.maskBoxImage().borderSlices(), | 2986 return valueForNinePieceImageQuad(style.maskBoxImage().borderSlices(), |
2969 style); | 2987 style); |
2970 case CSSPropertyWebkitMaskBoxImageSource: | 2988 case CSSPropertyWebkitMaskBoxImageSource: |
2971 if (style.maskBoxImageSource()) | 2989 if (style.maskBoxImageSource()) |
2972 return style.maskBoxImageSource()->computedCSSValue(); | 2990 return style.maskBoxImageSource()->computedCSSValue(); |
2973 return CSSIdentifierValue::create(CSSValueNone); | 2991 return CSSIdentifierValue::create(CSSValueNone); |
2974 case CSSPropertyWebkitFontSizeDelta: | 2992 case CSSPropertyWebkitFontSizeDelta: |
2975 // Not a real style property -- used by the editing engine -- so has no co
mputed value. | 2993 // Not a real style property -- used by the editing engine -- so has no |
| 2994 // computed value. |
2976 return nullptr; | 2995 return nullptr; |
2977 case CSSPropertyWebkitMarginBottomCollapse: | 2996 case CSSPropertyWebkitMarginBottomCollapse: |
2978 case CSSPropertyWebkitMarginAfterCollapse: | 2997 case CSSPropertyWebkitMarginAfterCollapse: |
2979 return CSSIdentifierValue::create(style.marginAfterCollapse()); | 2998 return CSSIdentifierValue::create(style.marginAfterCollapse()); |
2980 case CSSPropertyWebkitMarginTopCollapse: | 2999 case CSSPropertyWebkitMarginTopCollapse: |
2981 case CSSPropertyWebkitMarginBeforeCollapse: | 3000 case CSSPropertyWebkitMarginBeforeCollapse: |
2982 return CSSIdentifierValue::create(style.marginBeforeCollapse()); | 3001 return CSSIdentifierValue::create(style.marginBeforeCollapse()); |
2983 case CSSPropertyPerspective: | 3002 case CSSPropertyPerspective: |
2984 if (!style.hasPerspective()) | 3003 if (!style.hasPerspective()) |
2985 return CSSIdentifierValue::create(CSSValueNone); | 3004 return CSSIdentifierValue::create(CSSValueNone); |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3269 list->append(*CSSIdentifierValue::create(CSSValueAuto)); | 3288 list->append(*CSSIdentifierValue::create(CSSValueAuto)); |
3270 list->append(*CSSPrimitiveValue::create( | 3289 list->append(*CSSPrimitiveValue::create( |
3271 style.offsetRotation().angle, CSSPrimitiveValue::UnitType::Degrees)); | 3290 style.offsetRotation().angle, CSSPrimitiveValue::UnitType::Degrees)); |
3272 return list; | 3291 return list; |
3273 } | 3292 } |
3274 | 3293 |
3275 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). | 3294 // Unimplemented CSS 3 properties (including CSS3 shorthand properties). |
3276 case CSSPropertyWebkitTextEmphasis: | 3295 case CSSPropertyWebkitTextEmphasis: |
3277 return nullptr; | 3296 return nullptr; |
3278 | 3297 |
3279 // Directional properties are resolved by resolveDirectionAwareProperty() be
fore the switch. | 3298 // Directional properties are resolved by resolveDirectionAwareProperty() |
| 3299 // before the switch. |
3280 case CSSPropertyWebkitBorderEnd: | 3300 case CSSPropertyWebkitBorderEnd: |
3281 case CSSPropertyWebkitBorderEndColor: | 3301 case CSSPropertyWebkitBorderEndColor: |
3282 case CSSPropertyWebkitBorderEndStyle: | 3302 case CSSPropertyWebkitBorderEndStyle: |
3283 case CSSPropertyWebkitBorderEndWidth: | 3303 case CSSPropertyWebkitBorderEndWidth: |
3284 case CSSPropertyWebkitBorderStart: | 3304 case CSSPropertyWebkitBorderStart: |
3285 case CSSPropertyWebkitBorderStartColor: | 3305 case CSSPropertyWebkitBorderStartColor: |
3286 case CSSPropertyWebkitBorderStartStyle: | 3306 case CSSPropertyWebkitBorderStartStyle: |
3287 case CSSPropertyWebkitBorderStartWidth: | 3307 case CSSPropertyWebkitBorderStartWidth: |
3288 case CSSPropertyWebkitBorderAfter: | 3308 case CSSPropertyWebkitBorderAfter: |
3289 case CSSPropertyWebkitBorderAfterColor: | 3309 case CSSPropertyWebkitBorderAfterColor: |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3579 case CSSPropertyAll: | 3599 case CSSPropertyAll: |
3580 return nullptr; | 3600 return nullptr; |
3581 default: | 3601 default: |
3582 break; | 3602 break; |
3583 } | 3603 } |
3584 ASSERT_NOT_REACHED(); | 3604 ASSERT_NOT_REACHED(); |
3585 return nullptr; | 3605 return nullptr; |
3586 } | 3606 } |
3587 | 3607 |
3588 } // namespace blink | 3608 } // namespace blink |
OLD | NEW |