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

Unified Diff: third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp

Issue 2870983002: Update return value of getComputedStyle for sticky elements (Closed)
Patch Set: 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
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..61fc55728919a5e585bc53c26a94f0b4c49ab354 100644
--- a/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
+++ b/third_party/WebKit/Source/core/css/ComputedStyleCSSValueMapping.cpp
@@ -222,6 +222,11 @@ 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.
flackr 2017/05/09 20:26:34 nit: Add a link to the bug for reference.
yigu 2017/05/09 20:43:58 Done.
+ if (layout_object->IsStickyPositioned())
+ return CSSIdentifierValue::Create(CSSValueAuto);
+
// 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()) {
flackr 2017/05/09 20:26:35 Sticky is in flow positioned, let's change this co
yigu 2017/05/09 20:43:58 Done.

Powered by Google App Engine
This is Rietveld 408576698