Bug 72208 - [chromium] Fix scaleDelta zoom-out visibility rect bug
Summary: [chromium] Fix scaleDelta zoom-out visibility rect bug
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-12 00:45 PST by Alexandre Elias
Modified: 2011-11-17 13:22 PST (History)
7 users (show)

See Also:


Attachments
Patch (9.89 KB, patch)
2011-11-12 00:47 PST, Alexandre Elias
no flags Details | Formatted Diff | Diff
Patch (9.86 KB, patch)
2011-11-12 01:01 PST, Alexandre Elias
no flags Details | Formatted Diff | Diff
Patch (12.41 KB, patch)
2011-11-14 12:31 PST, Alexandre Elias
no flags Details | Formatted Diff | Diff
Patch (14.65 KB, patch)
2011-11-14 15:00 PST, Alexandre Elias
no flags Details | Formatted Diff | Diff
Patch (27.95 KB, patch)
2011-11-14 16:49 PST, Alexandre Elias
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alexandre Elias 2011-11-12 00:45:00 PST
[chromium] Fix scaleDelta zoom-out visibility rect bug
Comment 1 Alexandre Elias 2011-11-12 00:47:36 PST
Created attachment 114825 [details]
Patch
Comment 2 Alexandre Elias 2011-11-12 01:01:59 PST
Created attachment 114826 [details]
Patch
Comment 3 W. James MacLean 2011-11-14 05:13:58 PST
setDeltaScale() just seems to support a scale change, but zoomAnimatorTransform needs to support translation as well. Perhaps I'm missing something, but I don't see how that will work after this patch lands.

Also, we're currently trying to test double-tap for zoom, so it's a problem if this is being disabled in the upstream repo.
Comment 4 Alexandre Elias 2011-11-14 11:05:12 PST
OK, I didn't know it required translation.  From the point of view of what I'm doing, it makes the code less opaque not to have a generalized transform.

By the way, zoomAnimatorTransform should already be similarly glitchy upstream due to the scrolling layer being moved down several layers (so it cannot).  It does need a similar fix to what I did for pageScaleDelta.
Comment 5 Alexandre Elias 2011-11-14 12:31:34 PST
Created attachment 115006 [details]
Patch
Comment 6 Alexandre Elias 2011-11-14 12:35:18 PST
OK, I added a similar fix for zoomAnimatorTransform.  I kept them on different codepaths to make it easier to work separately, but zoomAnimatorTransform is now applied the same way.

(Minor: I also removed the option to have a gray background when zoomAnimatorTransform is active.  Now that the clip-rect is no longer buggy, we should never see the glClear color anyway, since it will draw tiles -- checkerboard if necessary -- all over the screen.)
Comment 7 James Robinson 2011-11-14 13:34:00 PST
(In reply to comment #3)
> setDeltaScale() just seems to support a scale change, but zoomAnimatorTransform needs to support translation as well.

Can you expand a bit on why?  That seems wrong, translations should be an orthogonal concept to zoom - you typically want to change the scroll offsets when zooming but that's handled by separate code.
Comment 8 James Robinson 2011-11-14 14:51:43 PST
Comment on attachment 115006 [details]
Patch

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

> Source/WebCore/ChangeLog:30
> +>2011-11-14  Pavel Feldman  <pfeldman@google.com>

something went awry here, there's a leading > on this line

> Source/WebCore/platform/graphics/chromium/LayerChromium.h:125
> +    TransformationMatrix zoomAnimatorTransform() const { return TransformationMatrix(); }

hmmm, so main thread layers never have a non-identify zoomAnimatorTransform? How does the test hookup work then - that used to manipulate the zoomAnimatorTransform on CCLayerTreeHost directly.

> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h:123
> +    void setZoomAnimatorTransform(const TransformationMatrix&);
> +    const TransformationMatrix& zoomAnimatorTransform() const { return m_zoomAnimatorTransform; }

can you update CCLayerImplTest for this property?

> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h:164
> +    float scaleDelta() const { return m_scaleDelta; }
> +    void setScaleDelta(float);

same here - please update CCLayerImplTest

> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:199
> +    // LT = Tr[origin] * M[zoomAnimator] * S[scaleDelta] * Tr[origin2anchor]

the old comments grew the expression in the comment as the subsequent components were added, but this one seems to have the first three components in the comments before any modifications have taken place. I think this first comment should just be "LT = Tr[origin] * M[zoomAnimator]"
Comment 9 Alexandre Elias 2011-11-14 14:59:56 PST
Comment on attachment 115006 [details]
Patch

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

>> Source/WebCore/ChangeLog:30
>> +>2011-11-14  Pavel Feldman  <pfeldman@google.com>
> 
> something went awry here, there's a leading > on this line

Fixed

>> Source/WebCore/platform/graphics/chromium/LayerChromium.h:125
>> +    TransformationMatrix zoomAnimatorTransform() const { return TransformationMatrix(); }
> 
> hmmm, so main thread layers never have a non-identify zoomAnimatorTransform? How does the test hookup work then - that used to manipulate the zoomAnimatorTransform on CCLayerTreeHost directly.

It still manipulates CCLayerTreeHost directly, and then CCLayerTreeHostImpl pushes it to the CCLayerImpl.  This call is just to make the template happy.

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h:123
>> +    const TransformationMatrix& zoomAnimatorTransform() const { return m_zoomAnimatorTransform; }
> 
> can you update CCLayerImplTest for this property?

Done

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerImpl.h:164
>> +    void setScaleDelta(float);
> 
> same here - please update CCLayerImplTest

Done

>> Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostCommon.cpp:199
>> +    // LT = Tr[origin] * M[zoomAnimator] * S[scaleDelta] * Tr[origin2anchor]
> 
> the old comments grew the expression in the comment as the subsequent components were added, but this one seems to have the first three components in the comments before any modifications have taken place. I think this first comment should just be "LT = Tr[origin] * M[zoomAnimator]"

Fixed
Comment 10 Alexandre Elias 2011-11-14 15:00:56 PST
Created attachment 115037 [details]
Patch
Comment 11 Alexandre Elias 2011-11-14 16:49:37 PST
Created attachment 115060 [details]
Patch
Comment 12 Alexandre Elias 2011-11-14 16:52:01 PST
The zoom animator layout tests were causing problems, as they're covering a non-impl-thread side codepath that is never really used in practice, and the scroll layer isn't available from non-impl side.  After talking it over with James, I removed the tests -- sorry about that.  For testing impl-side changes, we'll have to focus more on unit tests.
Comment 13 James Robinson 2011-11-14 18:38:19 PST
Comment on attachment 115060 [details]
Patch

R=me.
Comment 14 WebKit Review Bot 2011-11-14 20:08:36 PST
Comment on attachment 115060 [details]
Patch

Clearing flags on attachment: 115060

Committed r100235: <http://trac.webkit.org/changeset/100235>
Comment 15 WebKit Review Bot 2011-11-14 20:08:41 PST
All reviewed patches have been landed.  Closing bug.
Comment 16 W. James MacLean 2011-11-17 12:43:03 PST
(In reply to comment #6)
> OK, I added a similar fix for zoomAnimatorTransform.  I kept them on different codepaths to make it easier to work separately, but zoomAnimatorTransform is now applied the same way.
> 
> (Minor: I also removed the option to have a gray background when zoomAnimatorTransform is active.  Now that the clip-rect is no longer buggy, we should never see the glClear color anyway, since it will draw tiles -- checkerboard if necessary -- all over the screen.)

Correct me if I'm wrong, but doesn't this only work if the set of tiles currently being zoomed is enough to fill the screen? For example, if we zoom out (shrink the page), there may be regions that don't have tiles, and those won't get checkerboards?
Comment 17 W. James MacLean 2011-11-17 12:45:38 PST
(In reply to comment #7)
> (In reply to comment #3)
> > setDeltaScale() just seems to support a scale change, but zoomAnimatorTransform needs to support translation as well.
> 
> Can you expand a bit on why?  That seems wrong, translations should be an orthogonal concept to zoom - you typically want to change the scroll offsets when zooming but that's handled by separate code.

The zoom animator only redraws existing textures, so pageScale doesn't change during the animation. If I remember correctly, given the mis-match between page scale and the zoom animation, scrolling does not work correctly *during* the animation.

When the final page scale is set, we use an animation-less scroll to align the content around the zoom point.
Comment 18 James Robinson 2011-11-17 12:47:18 PST
(In reply to comment #16)
> (In reply to comment #6)
> > OK, I added a similar fix for zoomAnimatorTransform.  I kept them on different codepaths to make it easier to work separately, but zoomAnimatorTransform is now applied the same way.
> > 
> > (Minor: I also removed the option to have a gray background when zoomAnimatorTransform is active.  Now that the clip-rect is no longer buggy, we should never see the glClear color anyway, since it will draw tiles -- checkerboard if necessary -- all over the screen.)
> 
> Correct me if I'm wrong, but doesn't this only work if the set of tiles currently being zoomed is enough to fill the screen? For example, if we zoom out (shrink the page), there may be regions that don't have tiles, and those won't get checkerboards?

The entire viewport has tiles, so unless you allow the user to zoom out such that more than the viewport is visible (which you won't) this isn't an issue.
Comment 19 James Robinson 2011-11-17 12:47:46 PST
(In reply to comment #17)
> (In reply to comment #7)
> > (In reply to comment #3)
> > > setDeltaScale() just seems to support a scale change, but zoomAnimatorTransform needs to support translation as well.
> > 
> > Can you expand a bit on why?  That seems wrong, translations should be an orthogonal concept to zoom - you typically want to change the scroll offsets when zooming but that's handled by separate code.
> 
> The zoom animator only redraws existing textures, so pageScale doesn't change during the animation. If I remember correctly, given the mis-match between page scale and the zoom animation, scrolling does not work correctly *during* the animation.

Right, that's why you need to adjust the scroll offsets when adjusting the scale during the animation.'

> 
> When the final page scale is set, we use an animation-less scroll to align the content around the zoom point.

Correct.
Comment 20 Alexandre Elias 2011-11-17 12:48:53 PST
(In reply to comment #16)
> Correct me if I'm wrong, but doesn't this only work if the set of tiles currently being zoomed is enough to fill the screen? For example, if we zoom out (shrink the page), there may be regions that don't have tiles, and those won't get checkerboards?

We aren't implementing checkerboards by first applying them to tiles, then painting them -- that would be wasteful of RAM as well as having the problem you mention.  Checkerboarding is done by fallback "virtual" tiles that are drawn by a shader whenever no tile is available.  So as long as request to draw a tile is issued for every visible area on the screen, we will fill the screen with either valid content or checkerboard.
Comment 21 W. James MacLean 2011-11-17 13:22:14 PST
(In reply to comment #20)
> (In reply to comment #16)
> > Correct me if I'm wrong, but doesn't this only work if the set of tiles currently being zoomed is enough to fill the screen? For example, if we zoom out (shrink the page), there may be regions that don't have tiles, and those won't get checkerboards?
> 
> We aren't implementing checkerboards by first applying them to tiles, then painting them -- that would be wasteful of RAM as well as having the problem you mention.  Checkerboarding is done by fallback "virtual" tiles that are drawn by a shader whenever no tile is available.  So as long as request to draw a tile is issued for every visible area on the screen, we will fill the screen with either valid content or checkerboard.

Ahh, OK. I knew it was virtual tiles, but I wasn't sure they would propagate everywhere during the zoom animation.