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. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. |
4 * All rights reserved. | 4 * All rights reserved. |
5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 5 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |
6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> | 6 * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com> |
7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. | 7 * Copyright (C) 2011 Sencha, Inc. All rights reserved. |
8 * Copyright (C) 2015 Google Inc. All rights reserved. | 8 * Copyright (C) 2015 Google Inc. All rights reserved. |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
215 (property_id == CSSPropertyLeft || property_id == CSSPropertyRight) | 215 (property_id == CSSPropertyLeft || property_id == CSSPropertyRight) |
216 ? ToLayoutBox(layout_object) | 216 ? ToLayoutBox(layout_object) |
217 ->ContainingBlockLogicalWidthForContent() | 217 ->ContainingBlockLogicalWidthForContent() |
218 : ToLayoutBox(layout_object) | 218 : ToLayoutBox(layout_object) |
219 ->ContainingBlockLogicalHeightForGetComputedStyle(); | 219 ->ContainingBlockLogicalHeightForGetComputedStyle(); |
220 return ZoomAdjustedPixelValue(ValueForLength(offset, containing_block_size), | 220 return ZoomAdjustedPixelValue(ValueForLength(offset, containing_block_size), |
221 style); | 221 style); |
222 } | 222 } |
223 | 223 |
224 if (offset.IsAuto() && layout_object) { | 224 if (offset.IsAuto() && layout_object) { |
225 // "top:auto" and "top:0px" have very different meaning for sticky elements. | |
226 // Therefore "auto" should be returned regardless the opposite. | |
227 // https://crbug.com/703816. | |
228 if (layout_object->IsStickyPositioned()) | |
229 return CSSIdentifierValue::Create(CSSValueAuto); | |
flackr
2017/05/09 20:45:52
This extra condition should no longer be necessary
yigu
2017/05/09 21:08:06
Yes. Done.
| |
230 | |
225 // If the property applies to a positioned element and the resolved value of | 231 // If the property applies to a positioned element and the resolved value of |
226 // the display property is not none, the resolved value is the used value. | 232 // the display property is not none, the resolved value is the used value. |
227 if (layout_object->IsInFlowPositioned()) { | 233 if (layout_object->IsRelPositioned()) { |
228 // If e.g. left is auto and right is not auto, then left's computed value | 234 // If e.g. left is auto and right is not auto, then left's computed value |
229 // is negative right. So we get the opposite length unit and see if it is | 235 // is negative right. So we get the opposite length unit and see if it is |
230 // auto. | 236 // auto. |
231 if (opposite.IsAuto()) | 237 if (opposite.IsAuto()) |
232 return CSSPrimitiveValue::Create(0, | 238 return CSSPrimitiveValue::Create(0, |
233 CSSPrimitiveValue::UnitType::kPixels); | 239 CSSPrimitiveValue::UnitType::kPixels); |
234 | 240 |
235 if (opposite.IsPercentOrCalc()) { | 241 if (opposite.IsPercentOrCalc()) { |
236 if (layout_object->IsBox()) { | 242 if (layout_object->IsBox()) { |
237 LayoutUnit containing_block_size = | 243 LayoutUnit containing_block_size = |
(...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3745 case CSSPropertyAll: | 3751 case CSSPropertyAll: |
3746 return nullptr; | 3752 return nullptr; |
3747 default: | 3753 default: |
3748 break; | 3754 break; |
3749 } | 3755 } |
3750 NOTREACHED(); | 3756 NOTREACHED(); |
3751 return nullptr; | 3757 return nullptr; |
3752 } | 3758 } |
3753 | 3759 |
3754 } // namespace blink | 3760 } // namespace blink |
OLD | NEW |