[webkit-reviews] review granted: [Bug 216997] Add non-animated support for the CSS translate property : [Attachment 410233] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Thu Oct 1 12:20:03 PDT 2020


Simon Fraser (smfr) <simon.fraser at apple.com> has granted Antoine Quint
<graouts at apple.com>'s request for review:
Bug 216997: Add non-animated support for the CSS translate property
https://bugs.webkit.org/show_bug.cgi?id=216997

Attachment 410233: Patch

https://bugs.webkit.org/attachment.cgi?id=410233&action=review




--- Comment #18 from Simon Fraser (smfr) <simon.fraser at apple.com> ---
Comment on attachment 410233
  --> https://bugs.webkit.org/attachment.cgi?id=410233
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=410233&action=review

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:613
> +    // Inline renderers do not support transforms.
> +    if (!renderer || is<RenderInline>(*renderer) || !style.translate())

I feel like we must have code somewhere else that answers the question "does
this renderer support transforms", but I see you copied this from
computedTransform(). You should share more code with computedTransform() so you
don't copy-paste for scale and rotate also.

> Source/WebCore/css/CSSComputedStyleDeclaration.cpp:3544
> +	   case CSSPropertyTranslate:
> +	       return computedTranslate(renderer, style);

You're exposing the 'translate' property when cssIndividualTransformProperties
is disabled, which is a behavior change.

> Source/WebCore/css/parser/CSSPropertyParser.cpp:2047
> +    RefPtr<CSSValue> y = consumeLengthOrPercent(range, cssParserMode,
ValueRangeAll);
> +    if (!y)
> +	   return list;

How does this detect an invalid value like "0px junk"?

> Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h:59
> +    bool apply(TransformationMatrix& transform, const FloatSize&
borderBoxSize) const override

final

> Source/WebCore/platform/graphics/transforms/TranslateTransformOperation.h:61
> +	   transform.translate3d(x(borderBoxSize), y(borderBoxSize),
z(borderBoxSize));

z() doesn't care about box size. Not sure why it's written to take a rect; you
could fix.

> Source/WebCore/rendering/RenderObject.h:437
> +    bool hasTransform() const { return hasTransformRelatedProperty() &&
(style().hasTransform() || style().translate()); }

I see; hasTransformRelatedProperty is the fast bit check.

> Source/WebCore/rendering/style/StyleRareNonInheritedData.h:181
> +    RefPtr<TranslateTransformOperation> translate;

Should this be in StyleTransformData instead?

> Source/WebCore/svg/SVGGraphicsElement.cpp:78
> +    bool hasTransformStyle = style && style->hasTransform();

Bad name. "transform-style" is its own property.


More information about the webkit-reviews mailing list