Closed Bug 772679 Opened 12 years ago Closed 12 years ago

subpixel shifting causes visible shift of some lines on second scroll operation to hit bottom of page

Categories

(Core :: Web Painting, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla17
Tracking Status
firefox15 + wontfix
firefox16 + fixed

People

(Reporter: dbaron, Assigned: roc)

References

(Depends on 1 open bug)

Details

(Keywords: regression)

Attachments

(5 files, 1 obsolete file)

Steps to reproduce: 1. load bug 763838 (or anything else long, really) 2. hit the [End] key 3. hit the up arrow key 4. hit the down arrow key 5. hit the down arrow key again Expected results: after step 5: no change Actual results: after step 5: some lines shift and others don't I see this on Linux, and have been for a while (months?), and find it pretty annoying.
Blocks: 681192
Er, now that I look through the other dependencies of bug 681192, this is probably a duplicate of bug 756400 or bug 767710 (neither of which has "bottom" in the bug summary, but both probably should).
This is probably what's happening. So let's say the maximum scroll position is 6010.4 pixels. Hitting end scrolls us to 6010.4. Hitting the up arrow goes to say 6000.4, but we then round that to the nearest dev pixel and scroll to 6000. Down arrow goes to 6010, down arrow again goes to 6010.4. Is there a reason we don't want to restrict to dev pixels even when scrolling to the end?
(In reply to Timothy Nikkel (:tn) from comment #3) > This is probably what's happening. So let's say the maximum scroll position > is 6010.4 pixels. Hitting end scrolls us to 6010.4. Hitting the up arrow > goes to say 6000.4, but we then round that to the nearest dev pixel and > scroll to 6000. Such rounding should not happen, we should be staying at 6000.4.
Attached patch fix (obsolete) (deleted) — Splinter Review
I need to come up with a test for this.
Assignee: nobody → roc
Attachment #640925 - Flags: review?(tnikkel)
Does this also fix it if you scroll from the top rather than using the [End] key? (comment 4 wouldn't, I think, but this seems different.)
Comment on attachment 640925 [details] [diff] [review] fix >+ // Convert the result to layer pixels --- coordinates in the space of >+ // a ThebesLayer. >+ // aCurrentLayerOffset is the coordinates of the top-left of the scrolled frame, >+ // in ThebesLayer space. >+ double layerVal = (aRes*aDesired)/aAppUnitsPerPixel + aCurrentLayerOffset; Adding aCurrentLayerOffset is the right thing to do here, not subtracting?
Attachment #640925 - Flags: review?(tnikkel) → review+
(In reply to David Baron [:dbaron] from comment #6) > Does this also fix it if you scroll from the top rather than using the [End] > key? (comment 4 wouldn't, I think, but this seems different.) I'm not sure exactly what you mean. When you scroll down gently to the end, the last scroll operation may indeed scroll by a subpixel amount causing lines to move by a pixel relative to each other. However, that would normally happen in the same repaint as the whole page moves by some number of pixels, so I would expect it to be quite difficult to see.
(In reply to Timothy Nikkel (:tn) from comment #7) > >+ // Convert the result to layer pixels --- coordinates in the space of > >+ // a ThebesLayer. > >+ // aCurrentLayerOffset is the coordinates of the top-left of the scrolled frame, > >+ // in ThebesLayer space. > >+ double layerVal = (aRes*aDesired)/aAppUnitsPerPixel + aCurrentLayerOffset; > > Adding aCurrentLayerOffset is the right thing to do here, not subtracting? Yes. The comment was supposed to make that clear.
Attached patch fix v2 (deleted) — Splinter Review
This is the patch, completely rewritten.
Attachment #640925 - Attachment is obsolete: true
Attachment #647027 - Flags: review?(tnikkel)
Attached patch Mark Mac test as passing (deleted) — Splinter Review
This patch makes the existing test pass on Mac.
Attachment #647028 - Flags: review?(tnikkel) → review+
Comment on attachment 647027 [details] [diff] [review] fix v2 >diff --git a/gfx/2d/BaseRect.h b/gfx/2d/BaseRect.h >--- a/gfx/2d/BaseRect.h >+++ b/gfx/2d/BaseRect.h This hunk seems unrelated? I can't see it being used anywhere in this patch. Sorry for the delay.
Attachment #647027 - Flags: review?(tnikkel) → review+
(In reply to Timothy Nikkel (:tn) from comment #16) > >diff --git a/gfx/2d/BaseRect.h b/gfx/2d/BaseRect.h > >--- a/gfx/2d/BaseRect.h > >+++ b/gfx/2d/BaseRect.h > > This hunk seems unrelated? I can't see it being used anywhere in this patch. Good point. Removed.
Thanks. Probably just a silly bug. We do this: if (f->GetStateBits() & NS_FRAME_HAS_CONTAINER_LAYER) { nsTArray<DisplayItemData>* array = GetDisplayItemDataArrayForFrame(f); And assume array is non-null. Of course it's possible for a frame to have NS_FRAME_HAS_CONTAINER_LAYER and not have any display items ... the root frame will probably fall into this category! https://tbpl.mozilla.org/?tree=Try&rev=ac925b233cac
Attached patch fix crash (deleted) — Splinter Review
Attachment #649033 - Flags: review?(tnikkel)
Attachment #649033 - Flags: review?(tnikkel) → review+
It seems test_offsets.js fails because the mochitest viewport has been zoomed, causing the scrolling code to select a subpixel offset for the scroll operation. Rounding the change in getBoundingClientRect().top/.left should hide the subpixel choices and make the test pass. https://tbpl.mozilla.org/?tree=Try&rev=281dc4834850
Attached patch fix test (deleted) — Splinter Review
Attachment #649150 - Flags: review?(tnikkel)
Attachment #649150 - Flags: review?(tnikkel) → review+
Blocks: 776381
No longer depends on: 776381
Comment on attachment 647027 [details] [diff] [review] fix v2 Review of attachment 647027 [details] [diff] [review]: ----------------------------------------------------------------- Not very risky, fixes a subtle but annoying issue. Also speeds up scrolling in some situations.
Attachment #647027 - Flags: approval-mozilla-aurora?
Comment on attachment 647028 [details] [diff] [review] Testcase for this bug Review of attachment 647028 [details] [diff] [review]: ----------------------------------------------------------------- Not very risky, fixes a subtle but annoying issue. Also speeds up scrolling in some situations.
Attachment #647028 - Flags: approval-mozilla-aurora?
Comment on attachment 647029 [details] [diff] [review] Mark Mac test as passing Review of attachment 647029 [details] [diff] [review]: ----------------------------------------------------------------- Not very risky, fixes a subtle but annoying issue. Also speeds up scrolling in some situations.
Attachment #647029 - Flags: approval-mozilla-aurora?
Comment on attachment 649033 [details] [diff] [review] fix crash Review of attachment 649033 [details] [diff] [review]: ----------------------------------------------------------------- Not very risky, fixes a subtle but annoying issue. Also speeds up scrolling in some situations.
Attachment #649033 - Flags: approval-mozilla-aurora?
Comment on attachment 649150 [details] [diff] [review] fix test Review of attachment 649150 [details] [diff] [review]: ----------------------------------------------------------------- Not very risky, fixes a subtle but annoying issue. Also speeds up scrolling in some situations.
Attachment #649150 - Flags: approval-mozilla-aurora?
Attachment #647027 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #647028 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #647029 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #649033 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Attachment #649150 - Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
Depends on: 782546
This has been approved for Aurora for 5 days, please land to that branch. Wontfixing for Beta at this point since we've already gone to build for beta 5 and we won't take this so late in the Beta cycle.
Component: Layout: View Rendering → Layout: Web Painting
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: