RESOLVED FIXED 142411
CSS scroll-snap-destination and scroll-snap-coordinate are not honoring position values
https://bugs.webkit.org/show_bug.cgi?id=142411
Summary CSS scroll-snap-destination and scroll-snap-coordinate are not honoring posit...
Brent Fulgham
Reported 2015-03-06 14:16:22 PST
The CSS specification for "scroll-snap-coordinate" and "scroll-snap-destination" (see <http://dev.w3.org/csswg/css-snappoints/#propdef-scroll-snap-coordinate> and <http://dev.w3.org/csswg/css-snappoints/#propdef-scroll-snap-destination>) state that the value of these properties are <position>. This means the following are allowed: <position> = [ [ left | center | right | top | bottom | <percentage> | <length> ] | [ left | center | right | <percentage> | <length> ] [ top | center | bottom | <percentage> | <length> ] | [ center | [ left | right ] [ <percentage> | <length> ]? ] && [ center | [ top | bottom ] [ <percentage> | <length> ]? ] ] We currently only support percentage and length values.
Attachments
Patch (34.79 KB, patch)
2015-03-09 17:12 PDT, Brent Fulgham
no flags
Patch (49.35 KB, patch)
2015-03-10 13:59 PDT, Brent Fulgham
simon.fraser: review+
Radar WebKit Bug Importer
Comment 1 2015-03-06 14:17:53 PST
Brent Fulgham
Comment 2 2015-03-09 17:12:22 PDT
Simon Fraser (smfr)
Comment 3 2015-03-09 18:34:35 PDT
Comment on attachment 248294 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248294&action=review > Source/WebCore/css/CSSParser.cpp:3358 > + if (xAxisValue.id == CSSValueLeft || xAxisValue.id == CSSValueCenter || xAxisValue.id == CSSValueRight) { > + int percent = 0; > + if (xAxisValue.id == CSSValueRight) > + percent = 100; > + else if (xAxisValue.id == CSSValueCenter) > + percent = 50; > + cssValueX = cssValuePool().createValue(percent, CSSPrimitiveValue::CSS_PERCENTAGE); > + } else { > + ValueWithCalculation valueXWithCalculation(xAxisValue); > + if (!validateUnit(valueXWithCalculation, FPercent | FLength)) > + return false; > + cssValueX = createPrimitiveNumericValue(valueXWithCalculation); > + } > + > + if (yAxisValue.id == CSSValueTop || yAxisValue.id == CSSValueBottom || yAxisValue.id == CSSValueCenter) { > + int percent = 0; > + if (yAxisValue.id == CSSValueBottom) > + percent = 100; > + else if (yAxisValue.id == CSSValueCenter) > + percent = 50; > + cssValueY = cssValuePool().createValue(percent, CSSPrimitiveValue::CSS_PERCENTAGE); > + } else { > + ValueWithCalculation valueYWithCalculation(yAxisValue); > + if (!validateUnit(valueYWithCalculation, FPercent | FLength)) > + return false; > + cssValueY = createPrimitiveNumericValue(valueYWithCalculation); > + } Can't we share code with other things that take positions? > WebKit.xcworkspace/xcshareddata/xcschemes/All Source (target WebProcess).xcscheme:215 > + <MacroExpansion> > + <BuildableReference > + BuildableIdentifier = "primary" > + BlueprintIdentifier = "14F271BD18EA3963008C152F" > + BuildableName = "libbmalloc.a" > + BlueprintName = "bmalloc" > + ReferencedContainer = "container:Source/bmalloc/bmalloc.xcodeproj"> > + </BuildableReference> > + </MacroExpansion> You shouldn't commit changes to this file. > LayoutTests/css3/scroll-snap/scroll-snap-position-values.html:24 > + .noInitial { > + -webkit-scroll-snap-type: mandatory; > + -webkit-scroll-snap-points-x: repeat(100%); > + -webkit-scroll-snap-points-y: repeat(100%); You should test that -webkit-calc() works in these properties too.
Brent Fulgham
Comment 4 2015-03-10 13:59:03 PDT
Simon Fraser (smfr)
Comment 5 2015-03-10 14:49:49 PDT
Comment on attachment 248355 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=248355&action=review > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:1113 > + list.get().append(zoomAdjustedPixelValueForLength(destination.width(), &style)); > + list.get().append(zoomAdjustedPixelValueForLength(destination.height(), &style)); This change makes me think you should test span points under page zoom. > Source/WebCore/css/LengthRepeat.h:45 > - static PassRefPtr<LengthRepeat> create(PassRefPtr<CSSPrimitiveValue> interval) { return adoptRef(new LengthRepeat(interval)); } > + static PassRefPtr<LengthRepeat> create(PassRefPtr<CSSValue> interval) { return adoptRef(new LengthRepeat(interval)); } > > PassRefPtr<LengthRepeat> cloneForCSSOM() const { return create(interval()); } > > - CSSPrimitiveValue* interval() const { return m_interval.get(); } > + CSSValue* interval() const { return m_interval.get(); } > > - void setInterval(PassRefPtr<CSSPrimitiveValue> interval) { m_interval = interval; } > + void setInterval(PassRefPtr<CSSValue> interval) { m_interval = interval; } This change isn't explained in the changelog.
Brent Fulgham
Comment 6 2015-03-10 16:20:05 PDT
Note You need to log in before you can comment on or make changes to this bug.