Chromium Code Reviews| 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() && layoutObject->isBox()) { |
| 211 LayoutUnit containingBlockSize = | 211 LayoutUnit containingBlockSize = |
| 212 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyR ight) ? | 212 (propertyID == CSSPropertyLeft || propertyID == CSSPropertyR ight) ? |
| 213 toLayoutBox(layoutObject)->containingBlockLogicalWidthForCon tent() : | 213 toLayoutBox(layoutObject)->containingBlockLogicalWidthForCon tent() : |
| 214 toLayoutBox(layoutObject)->containingBlockLogicalHeightForGe tComputedStyle(); | 214 toLayoutBox(layoutObject)->containingBlockLogicalHeightForGe tComputedStyle(); |
| 215 return zoomAdjustedPixelValue(-floatValueForLength(opposite, con tainingBlockSize), style); | 215 return zoomAdjustedPixelValue(-floatValueForLength(opposite, con tainingBlockSize), style); |
| 216 } | 216 } |
| 217 return zoomAdjustedPixelValue(-opposite.pixels(), style); | 217 // Length doesn't provide operator -, so multiply by -1. |
| 218 opposite *= -1.f; | |
|
Timothy Loh
2016/06/28 00:20:29
This looks like it might hit an ASSERT if the valu
Mr. Kevin
2016/06/28 00:55:52
Good catch. I'll see what I can come up with.
| |
| 219 return zoomAdjustedPixelValueForLength(opposite, style); | |
| 218 } | 220 } |
| 219 | 221 |
| 220 if (layoutObject->isOutOfFlowPositioned()) { | 222 if (layoutObject->isOutOfFlowPositioned() && layoutObject->isBox()) { |
| 221 // For fixed and absolute positioned elements, the top, left, bottom , and right | 223 // For fixed and absolute positioned elements, the top, left, bottom , and right |
| 222 // are defined relative to the corresponding sides of the containing block. | 224 // are defined relative to the corresponding sides of the containing block. |
| 223 LayoutBlock* container = layoutObject->containingBlock(); | 225 LayoutBlock* container = layoutObject->containingBlock(); |
| 224 const LayoutBox* layoutBox = toLayoutBox(layoutObject); | 226 const LayoutBox* layoutBox = toLayoutBox(layoutObject); |
| 225 | 227 |
| 226 // clientOffset is the distance from this object's border edge to th e container's | 228 // 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. | 229 // padding edge. Thus it includes margins which we subtract below. |
| 228 const LayoutSize clientOffset = | 230 const LayoutSize clientOffset = |
| 229 layoutBox->locationOffset() - LayoutSize(container->clientLeft() , container->clientTop()); | 231 layoutBox->locationOffset() - LayoutSize(container->clientLeft() , container->clientTop()); |
| 230 LayoutUnit position; | 232 LayoutUnit position; |
| (...skipping 2768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2999 case CSSPropertyAll: | 3001 case CSSPropertyAll: |
| 3000 return nullptr; | 3002 return nullptr; |
| 3001 default: | 3003 default: |
| 3002 break; | 3004 break; |
| 3003 } | 3005 } |
| 3004 ASSERT_NOT_REACHED(); | 3006 ASSERT_NOT_REACHED(); |
| 3005 return nullptr; | 3007 return nullptr; |
| 3006 } | 3008 } |
| 3007 | 3009 |
| 3008 } // namespace blink | 3010 } // namespace blink |
| OLD | NEW |