| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 if (offset.isAuto() && layoutObject) { | 201 if (offset.isAuto() && layoutObject) { |
| 202 // If the property applies to a positioned element and the resolved valu
e of the display | 202 // If the property applies to a positioned element and the resolved valu
e of the display |
| 203 // property is not none, the resolved value is the used value. | 203 // property is not none, the resolved value is the used value. |
| 204 if (layoutObject->isInFlowPositioned()) { | 204 if (layoutObject->isInFlowPositioned()) { |
| 205 // If e.g. left is auto and right is not auto, then left's computed
value is negative right. | 205 // If e.g. left is auto and right is not auto, then left's computed
value is negative right. |
| 206 // So we get the opposite length unit and see if it is auto. | 206 // So we get the opposite length unit and see if it is auto. |
| 207 if (opposite.isAuto()) | 207 if (opposite.isAuto()) |
| 208 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType:
:Pixels); | 208 return CSSPrimitiveValue::create(0, CSSPrimitiveValue::UnitType:
:Pixels); |
| 209 | 209 |
| 210 if (opposite.hasPercent()) { | 210 if (opposite.hasPercent() || opposite.isCalculated()) { |
| 211 LayoutUnit containingBlockSize = | 211 if (layoutObject->isBox()) { |
| 212 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyR
ight) ? | 212 LayoutUnit containingBlockSize = |
| 213 toLayoutBox(layoutObject)->containingBlockLogicalWidthForCon
tent() : | 213 (propertyID == CSSPropertyLeft || propertyID == CSSPrope
rtyRight) ? |
| 214 toLayoutBox(layoutObject)->containingBlockLogicalHeightForGe
tComputedStyle(); | 214 toLayoutBox(layoutObject)->containingBlockLogicalWidthFo
rContent() : |
| 215 return zoomAdjustedPixelValue(-floatValueForLength(opposite, con
tainingBlockSize), style); | 215 toLayoutBox(layoutObject)->containingBlockLogicalHeightF
orGetComputedStyle(); |
| 216 return zoomAdjustedPixelValue(-floatValueForLength(opposite,
containingBlockSize), style); |
| 217 } |
| 218 // FIXME: fall back to auto for position:relative, display:inli
ne |
| 219 return CSSPrimitiveValue::createIdentifier(CSSValueAuto); |
| 216 } | 220 } |
| 217 return zoomAdjustedPixelValue(-opposite.pixels(), style); | 221 |
| 222 // Length doesn't provide operator -, so multiply by -1. |
| 223 opposite *= -1.f; |
| 224 return zoomAdjustedPixelValueForLength(opposite, style); |
| 218 } | 225 } |
| 219 | 226 |
| 220 if (layoutObject->isOutOfFlowPositioned()) { | 227 if (layoutObject->isOutOfFlowPositioned() && layoutObject->isBox()) { |
| 221 // For fixed and absolute positioned elements, the top, left, bottom
, and right | 228 // For fixed and absolute positioned elements, the top, left, bottom
, and right |
| 222 // are defined relative to the corresponding sides of the containing
block. | 229 // are defined relative to the corresponding sides of the containing
block. |
| 223 LayoutBlock* container = layoutObject->containingBlock(); | 230 LayoutBlock* container = layoutObject->containingBlock(); |
| 224 const LayoutBox* layoutBox = toLayoutBox(layoutObject); | 231 const LayoutBox* layoutBox = toLayoutBox(layoutObject); |
| 225 | 232 |
| 226 // clientOffset is the distance from this object's border edge to th
e container's | 233 // clientOffset is the distance from this object's border edge to th
e container's |
| 227 // padding edge. Thus it includes margins which we subtract below. | 234 // padding edge. Thus it includes margins which we subtract below. |
| 228 const LayoutSize clientOffset = | 235 const LayoutSize clientOffset = |
| 229 layoutBox->locationOffset() - LayoutSize(container->clientLeft()
, container->clientTop()); | 236 layoutBox->locationOffset() - LayoutSize(container->clientLeft()
, container->clientTop()); |
| 230 LayoutUnit position; | 237 LayoutUnit position; |
| (...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2999 case CSSPropertyAll: | 3006 case CSSPropertyAll: |
| 3000 return nullptr; | 3007 return nullptr; |
| 3001 default: | 3008 default: |
| 3002 break; | 3009 break; |
| 3003 } | 3010 } |
| 3004 ASSERT_NOT_REACHED(); | 3011 ASSERT_NOT_REACHED(); |
| 3005 return nullptr; | 3012 return nullptr; |
| 3006 } | 3013 } |
| 3007 | 3014 |
| 3008 } // namespace blink | 3015 } // namespace blink |
| OLD | NEW |