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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/sticky/sticky-top-auto-get-computedstyle-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
diff --git a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
index 9d4e5c14c0e8de4d66f367f8eff7ae977eaba06c..b65057c8393f3e3097efb039bcb3b3696f975d40 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -222,9 +222,15 @@ static CSSValue* ValueForPositionOffset(const ComputedStyle& style,
}
if (offset.IsAuto() && layout_object) {
+ // "top:auto" and "top:0px" have very different meaning for sticky elements.
+ // Therefore "auto" should be returned regardless the opposite.
+ // https://crbug.com/703816.
+ if (layout_object->IsStickyPositioned())
+ 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.
+
// If the property applies to a positioned element and the resolved value of
// the display property is not none, the resolved value is the used value.
- if (layout_object->IsInFlowPositioned()) {
+ if (layout_object->IsRelPositioned()) {
// If e.g. left is auto and right is not auto, then left's computed value
// is negative right. So we get the opposite length unit and see if it is
// auto.
« no previous file with comments | « third_party/WebKit/LayoutTests/fast/css/sticky/sticky-top-auto-get-computedstyle-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698