WICG / layout-instability

A proposal for a Layout Instability specification
https://wicg.github.io/layout-instability/
Other
159 stars 27 forks source link

Allow transform with compensating offset change. #94

Closed skobes-chromium closed 3 years ago

skobes-chromium commented 3 years ago

Fixes #93


Preview | Diff

skobes-chromium commented 3 years ago

The current CL uses the following algorithm for move vector: move_vector = starting_point - old_starting_point; transform_indifferent_move_vector = transform_indifferent_move_vector - old_transform_indifferent_move_vector; if (abs(transform_indifferent_move_vector.x()) < abs(move_vector.x())) move_vector.x() = transform_indifferent_move_vector.x(); if (abs(transform_indifferent_move_vector.y()) < abs(move_vector.y())) move_vector.y() = transform_indifferent_move_vector.y();

Can't we just use move_vector then (if your CL knows both)?

I think the simplest approach is for the move vector to use only the "real" (i.e. transform-including) starting points, so that it corresponds most closely to what the user sees.

wangxianzhu commented 3 years ago

The current CL uses the following algorithm for move vector: move_vector = starting_point - old_starting_point; transform_indifferent_move_vector = transform_indifferent_move_vector - old_transform_indifferent_move_vector; if (abs(transform_indifferent_move_vector.x()) < abs(move_vector.x())) move_vector.x() = transform_indifferent_move_vector.x(); if (abs(transform_indifferent_move_vector.y()) < abs(move_vector.y())) move_vector.y() = transform_indifferent_move_vector.y();

Can't we just use move_vector then (if your CL knows both)?

I think the simplest approach is for the move vector to use only the "real" (i.e. transform-including) starting points, so that it corresponds most closely to what the user sees.

Using real starting points for move_vector SGTM.

The CL uses the algorithm so that PaintInvalidator can just pass one set of starting points to LayoutShiftTracker. LayoutShiftTracker then uses the starting points for both instability and shift distance. To calculate instability based on transform-indifferent starting points and shift distance based on real starting points, we need to add parameters in LayoutShiftTracker API. Will update the CL for this.