Summary: | Implement parsing and animation support for offset shorthand | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Kiet Ho <kiet.ho> | ||||||||||||||||
Component: | CSS | Assignee: | Kiet Ho <kiet.ho> | ||||||||||||||||
Status: | RESOLVED FIXED | ||||||||||||||||||
Severity: | Normal | CC: | clopez, dino, esprehn+autocc, ews-watchlist, glenn, gyuyoung.kim, joepeck, jonlee, kyle.bavender, macpherson, menard, nmouchtaris, simon.fraser, webkit-bug-importer, youennf | ||||||||||||||||
Priority: | P2 | Keywords: | InRadar | ||||||||||||||||
Version: | Safari Technology Preview | ||||||||||||||||||
Hardware: | Unspecified | ||||||||||||||||||
OS: | Unspecified | ||||||||||||||||||
Bug Depends on: | 233108 | ||||||||||||||||||
Bug Blocks: | 203847 | ||||||||||||||||||
Attachments: |
|
Description
Kiet Ho
2021-11-14 13:39:55 PST
Created attachment 444318 [details]
WIP
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see https://trac.webkit.org/wiki/WPTExportProcess *** Bug 232760 has been marked as a duplicate of this bug. *** Created attachment 444324 [details]
WIP
Created attachment 444836 [details]
WIP
Still needs to figure out what is the correct serialization format. In particular, is it needed to make the serialization as short as possible? For example, Chrome and this patch serializes "auto none" to "auto none". However, "auto" is equivalent and shorter. On the other hand, "auto none reverse" must be serialized to "auto none reverse" and not "auto reverse", because according to the grammar, if offset-rotate is serialized, then so is offset-path. Created attachment 451649 [details]
Patch
Created attachment 451727 [details]
Patch
Comment on attachment 451727 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=451727&action=review > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:2640 > + { > + auto innerList = CSSValueList::createSpaceSeparated(); > + innerList->append(valueForPositionOrAuto(style, style.offsetPosition())); > + innerList->append(valueForPathOperation(style, style.offsetPath(), SVGPathConversion::ForceAbsolute)); > + innerList->append(CSSValuePool::singleton().createValue(style.offsetDistance(), style)); > + innerList->append(valueForOffsetRotate(style.offsetRotate())); > + > + outerList->append(WTFMove(innerList)); > + } Any reason for this being in its own scope? > Source/WebCore/css/StyleProperties.cpp:466 > +static bool isAutoKeyword(const CSSValue& value) > +{ > + if (!is<CSSPrimitiveValue>(value)) > + return false; > + > + auto& primitiveValue = downcast<CSSPrimitiveValue>(value); > + return primitiveValue.isValueID() && primitiveValue.valueID() == CSSValueAuto; > +} Is this really the first/only time we're checking for this keyword in the file? > Source/WebCore/css/StyleProperties.cpp:508 > + if (!offsetDistance.value() || !is<CSSPrimitiveValue>(offsetDistance.value())) Maybe a local variable for offsetDistance.value() to avoid calling it multiple times? > Source/WebCore/css/StyleProperties.cpp:527 > + if (!offsetRotate.value() || !is<CSSOffsetRotateValue>(offsetRotate.value())) Same with this .value() Created attachment 452096 [details]
Patch
(In reply to Dean Jackson from comment #10) > Comment on attachment 451727 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=451727&action=review > > > Source/WebCore/css/CSSComputedStyleDeclaration.cpp:2640 > > + { > > + auto innerList = CSSValueList::createSpaceSeparated(); > > + innerList->append(valueForPositionOrAuto(style, style.offsetPosition())); > > + innerList->append(valueForPathOperation(style, style.offsetPath(), SVGPathConversion::ForceAbsolute)); > > + innerList->append(CSSValuePool::singleton().createValue(style.offsetDistance(), style)); > > + innerList->append(valueForOffsetRotate(style.offsetRotate())); > > + > > + outerList->append(WTFMove(innerList)); > > + } > > Any reason for this being in its own scope? Fixed. > > > Source/WebCore/css/StyleProperties.cpp:466 > > +static bool isAutoKeyword(const CSSValue& value) > > +{ > > + if (!is<CSSPrimitiveValue>(value)) > > + return false; > > + > > + auto& primitiveValue = downcast<CSSPrimitiveValue>(value); > > + return primitiveValue.isValueID() && primitiveValue.valueID() == CSSValueAuto; > > +} > > Is this really the first/only time we're checking for this keyword in the > file? No reason for this to be its own function. > > > Source/WebCore/css/StyleProperties.cpp:508 > > + if (!offsetDistance.value() || !is<CSSPrimitiveValue>(offsetDistance.value())) > > Maybe a local variable for offsetDistance.value() to avoid calling it > multiple times? Fixed. > > > Source/WebCore/css/StyleProperties.cpp:527 > > + if (!offsetRotate.value() || !is<CSSOffsetRotateValue>(offsetRotate.value())) > > Same with this .value() Fixed. Created attachment 452109 [details]
Patch
Committed r289876 (247314@main): <https://commits.webkit.org/247314@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 452109 [details]. |