Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(747)

Side by Side Diff: Source/core/css/LayoutStyleCSSValueMapping.cpp

Issue 1007623003: Fix incorrect percentage top for positioned elements. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 offset = style.top(); 156 offset = style.top();
157 break; 157 break;
158 case CSSPropertyBottom: 158 case CSSPropertyBottom:
159 offset = style.bottom(); 159 offset = style.bottom();
160 break; 160 break;
161 default: 161 default:
162 return nullptr; 162 return nullptr;
163 } 163 }
164 164
165 if (offset.isPercent() && renderer && renderer->isBox()) { 165 if (offset.isPercent() && renderer && renderer->isBox()) {
166 // http://www.w3.org/TR/CSS21/visudet.html#containing-block-details
167 AvailableLogicalHeightType heightType = (style.position() == AbsolutePos ition) ? IncludePadding : ExcludeMarginBorderPadding;
166 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope rtyID == CSSPropertyRight) ? 168 LayoutUnit containingBlockSize = (propertyID == CSSPropertyLeft || prope rtyID == CSSPropertyRight) ?
167 toLayoutBox(renderer)->containingBlockLogicalWidthForContent() : 169 toLayoutBox(renderer)->containingBlockLogicalWidthForContent() :
168 toLayoutBox(renderer)->containingBlockLogicalHeightForContent(Exclud eMarginBorderPadding); 170 toLayoutBox(renderer)->containingBlockLogicalHeightForContent(height Type);
169 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize ), style); 171 return zoomAdjustedPixelValue(valueForLength(offset, containingBlockSize ), style);
170 } 172 }
171 if (offset.isAuto()) { 173 if (offset.isAuto()) {
172 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined. 174 // FIXME: It's not enough to simply return "auto" values for one offset if the other side is defined.
173 // In other words if left is auto and right is not auto, then left's com puted value is negative right(). 175 // In other words if left is auto and right is not auto, then left's com puted value is negative right().
174 // So we should get the opposite length unit and see if it is auto. 176 // So we should get the opposite length unit and see if it is auto.
175 return cssValuePool().createIdentifierValue(CSSValueAuto); 177 return cssValuePool().createIdentifierValue(CSSValueAuto);
176 } 178 }
177 179
178 return zoomAdjustedPixelValueForLength(offset, style); 180 return zoomAdjustedPixelValueForLength(offset, style);
(...skipping 2387 matching lines...) Expand 10 before | Expand all | Expand 10 after
2566 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style); 2568 return zoomAdjustedPixelValueForLength(svgStyle.ry(), style);
2567 2569
2568 case CSSPropertyAll: 2570 case CSSPropertyAll:
2569 return nullptr; 2571 return nullptr;
2570 } 2572 }
2571 ASSERT_NOT_REACHED(); 2573 ASSERT_NOT_REACHED();
2572 return nullptr; 2574 return nullptr;
2573 } 2575 }
2574 2576
2575 } 2577 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698