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

Side by Side Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 2870983002: Update return value of getComputedStyle for sticky elements (Closed)
Patch Set: nit Created 3 years, 7 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. 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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 // If the property applies to a positioned element and the resolved value of 225 // 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. 226 // the display property is not none, the resolved value is the used value.
227 if (layout_object->IsInFlowPositioned()) { 227 // According to https://crbug.com/703816, "top:auto" and "top:0px" have very
flackr 2017/05/09 21:21:41 nit: Let's just say something to the effect of "Po
yigu 2017/05/09 21:35:20 Done.
228 // different meaning for sticky elements. Therefore "auto" should be
229 // returned regardless the opposite. Hence we only check IsRelPositioned
230 // instead of IsInflowPositioned so StickyPositioned element can be handled
231 // implicitly.
232 if (layout_object->IsRelPositioned()) {
228 // If e.g. left is auto and right is not auto, then left's computed value 233 // 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 234 // is negative right. So we get the opposite length unit and see if it is
230 // auto. 235 // auto.
231 if (opposite.IsAuto()) 236 if (opposite.IsAuto())
232 return CSSPrimitiveValue::Create(0, 237 return CSSPrimitiveValue::Create(0,
233 CSSPrimitiveValue::UnitType::kPixels); 238 CSSPrimitiveValue::UnitType::kPixels);
234 239
235 if (opposite.IsPercentOrCalc()) { 240 if (opposite.IsPercentOrCalc()) {
236 if (layout_object->IsBox()) { 241 if (layout_object->IsBox()) {
237 LayoutUnit containing_block_size = 242 LayoutUnit containing_block_size =
(...skipping 3507 matching lines...) Expand 10 before | Expand all | Expand 10 after
3745 case CSSPropertyAll: 3750 case CSSPropertyAll:
3746 return nullptr; 3751 return nullptr;
3747 default: 3752 default:
3748 break; 3753 break;
3749 } 3754 }
3750 NOTREACHED(); 3755 NOTREACHED();
3751 return nullptr; 3756 return nullptr;
3752 } 3757 }
3753 3758
3754 } // namespace blink 3759 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698