gecko-dev/layout/generic/test
Markus Stange f8e66e0cdf Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel
We want the maximum scroll position to be aligned with layer pixels. That way
we don't have to re-rasterize the scrolled contents once scrolling hits the
edge of the scrollable area.

Here's how we determine the maximum scroll position: We get the scroll port
rect, snapped to layer pixels. Then we get the scrolled rect and also snap
that to layer pixels. The maximum scroll position is set to the difference
between right/bottom edges of these rectangles.
Now the scrollable area is computed by adding this maximum scroll position
to the unsnapped scroll port size.
The underlying idea here is: Pretend we have overflow:visible so that the
scrolled contents start at (0, 0) relative to the scroll port and spill over
the scroll port edges. When these contents are rendered, their rendering is
snapped to layer pixels. We want those exact pixels to be accessible by
scrolling.

This way of computing the snapped scrollable area ensures that, if you scroll
to the maximum scroll position, the right/bottom edges of the rendered
scrolled contents line up exactly with the right/bottom edges of the scroll
port. The scrolled contents are neither cut off nor are they moved too far.
(This is something that no other browser engine gets completely right, see the
testcase in bug 1012752.)

There are also a few disadvantages to this solution. We snap to layer pixels,
and the size of a layer pixel can depend on the zoom level, the document
resolution, the current screen's scale factor, and CSS transforms. The snap
origin is the position of the reference frame. So a change to any of these
things can influence the scrollable area and the maximum scroll position.
This patch does not make us adjust the current scroll position in the event
that the maximum scroll position changes such that the current scroll position
would be out of range, unless there's a reflow of the scrolled contents. This
means that we can sometimes render a slightly inconsistent state where the
current scroll position exceeds the maximum scroll position. We can fix this
once it turns out to be a problem; I doubt that it will be a problem because
none of the other browsers seems to prevent this problem either.

The size of the scrollable area is exposed through the DOM properties
scrollWidth and scrollHeight. At the moment, these are integer properties, so
their value is rounded to the nearest CSS pixel. Before this patch, the
returned value would always be within 0.5 CSS pixels of the value that layout
computed for the content's scrollable overflow based on the CSS styles of the
contents.
Now that scrollWidth and scrollHeight also depend on pixel snapping, their
values can deviate by up to one layer pixel from what the page might expect
based on the styles of the contents. This change requires a few changes to
existing tests.
The fact that scrollWidth and scrollHeight can change based on the position of
the scrollable element and the zoom level / resolution may surprise some web
pages. However, this also seems to happen in Edge. Edge seems to always round
scrollWidth and scrollHeight upwards, possibly to their equivalent of layout
device pixels.

MozReview-Commit-ID: 3LFV7Lio4tG

--HG--
extra : histedit_source : 5390eeebfe9a2791d9ac8e91ec1dfec4ec7b4118
2016-06-02 15:41:51 -04:00
..
bug344830_testembed.svg
bug421839-2-page.html
bug633762_iframe.html
bug1174521.html Bug 1174521 - Backout the second part of bug 1143570 to fix the regression; r=roc 2015-06-17 17:45:51 -04:00
chrome.ini Bug 1255262 - convert test_selection_preventDefault.html to mochitest. r=smaug. 2016-03-10 11:11:41 +08:00
file_BrokenImageReference.png
file_Dolske.png
file_IconTestServer.sjs Bug 946065 - Part 10: Move content/media/ to dom/. r=peterv 2014-10-25 20:24:36 +03:00
file_LoadingImageReference.png
file_SlowImage.sjs Bug 1205027 - Only size <img> to broken-image size if it's actually broken. r=dholbert 2016-06-03 07:05:46 +09:00
file_bug448987.html
file_bug448987_notref.html
file_bug448987_ref.html
file_bug449653_1.html
file_bug449653_1_ref.html
file_bug514732_1.html
file_bug514732_helper.html
file_bug514732_window.xul Bug 945781 - Remove ChromePowers.js. r=jmaher 2014-07-14 23:40:49 +02:00
file_bug579767_1.html
file_bug579767_2.html
file_scroll_position_restore.html Bug 1269539 - Ensure that the scroll position is restored properly on reloading a page which loads incrementally. r=tnikkel 2016-05-03 10:40:20 -04:00
file_taintedfilters_feDisplacementMap-tainted-1.svg
file_taintedfilters_feDisplacementMap-tainted-2.svg
file_taintedfilters_feDisplacementMap-tainted-3.svg
file_taintedfilters_feDisplacementMap-tainted-ref.svg
file_taintedfilters_feDisplacementMap-untainted-1.svg
file_taintedfilters_feDisplacementMap-untainted-2.svg
file_taintedfilters_feDisplacementMap-untainted-ref.svg
file_taintedfilters_red-flood-for-feImage-cors.svg
file_taintedfilters_red-flood-for-feImage-cors.svg^headers^
file_taintedfilters_red-flood-for-feImage.svg
frame_selection_underline-ref.xhtml Bug 825004 - Part 1: Unprefix CSS3 Text Decoration. r=dbaron 2014-11-18 19:23:09 +09:00
frame_selection_underline.css
frame_selection_underline.xhtml
mochitest.ini Bug 1205027 - Only size <img> to broken-image size if it's actually broken. r=dholbert 2016-06-03 07:05:46 +09:00
page_scroll_with_fixed_pos_window.html Bug 1081272 - Include position and transform when computing header/footer size [r=tn] 2015-11-12 16:55:02 -08:00
plugin_clipping_helper.xhtml
plugin_clipping_helper2.xhtml
plugin_clipping_helper_table.xhtml
plugin_clipping_helper_transformed.xhtml
plugin_clipping_lib.js
plugin_focus_helper.html
selection_expanding_xbl.xml
test_backspace_delete.xul Bug 1034337: Test deletion on direction-change boundaries with the pref bidi.edit.delete_immediately set to both true and false, r=ehsan 2014-09-19 00:18:47 -07:00
test_bug240933.html
test_bug263683.html
test_bug288789.html
test_bug290397.html Bug 1207495 - Remove use of expression closure from layout/. r=bz 2015-09-23 18:40:36 +09:00
test_bug323656.html
test_bug344830.html
test_bug348681.html Bug 1254991 - Port test_bug348681.html to mochitest-plain so that it runs under e10s; r=mrbkap 2016-03-09 16:41:51 -05:00
test_bug382429.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug384527.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug385751.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug389630.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug391747.html Bug 1027268 - Fix for Bug 1027268 - Intermittent test_bug391747.html | uncaught exception. r=mats 2014-07-01 16:26:36 +02:00
test_bug392746.html
test_bug392923.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug394173.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug394239.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug402380.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug404872.html
test_bug405178.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug416168.html
test_bug421436.html backout c3f1ab75ea51 (bug 421436) for regressing bug 439462 2014-05-22 15:10:20 -07:00
test_bug421839-1.html
test_bug421839-2.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug424627.html
test_bug438840.html
test_bug448860.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug448987.html
test_bug449653.html
test_bug460532.html Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_bug468167.html
test_bug469613.xul Bug 1207495 - Remove use of expression closure from layout/. r=bz 2015-09-23 18:40:36 +09:00
test_bug469774.xul Bug 475981, remove titles from a bunch of tests, fixing box wrapped in a block warnings,r=neil 2014-04-04 13:11:12 -04:00
test_bug470212.html Bug 1055040 - Send mouse events base on canvas position and enable this test case on all B2G builds. r=ehsan 2014-08-19 19:38:00 -04:00
test_bug488417.html
test_bug496275.html Bug 1067788 - Part 4: Update test_bug496275.html. Add setCaretBidiLevel method to Selection. r=smontagu r=ehsan 2015-05-22 00:37:16 -04:00
test_bug503813.html
test_bug507902.html
test_bug508115.xul Bug 475981, remove titles from a bunch of tests, fixing box wrapped in a block warnings,r=neil 2014-04-04 13:11:12 -04:00
test_bug514732-2.xul Bug 475981, remove titles from a bunch of tests, fixing box wrapped in a block warnings,r=neil 2014-04-04 13:11:12 -04:00
test_bug514732.html
test_bug522632.html
test_bug524925.html
test_bug527306.html
test_bug579767.html
test_bug589621.html
test_bug589623.html
test_bug597333.html
test_bug632379.xul Bug 1207914: Add some debug logging to mochitest test_bug632379.xul, to help diagnose its timeouts. 2016-01-20 10:09:05 -08:00
test_bug633762.html Bug 1135091 - convert remaining SpecialPowers.setBoolPref to pushPrefEnv, p=anishchandran94@gmail.com, r=jmaher, mwargers 2015-03-03 08:46:35 -05:00
test_bug666225.html Bug 1263785 - Kill off the deprecated nsINode::GetCurrentDoc. r=baku 2016-03-31 12:46:32 +01:00
test_bug719503.html
test_bug719515.html
test_bug719518.html
test_bug719523.html
test_bug735641.html
test_bug748961.html
test_bug756984.html Bug 1263909 - Enhance test_bug756984.html to cover edit actions. r=masayuki 2016-04-13 10:35:00 +02:00
test_bug784410.html Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel 2016-06-02 15:41:51 -04:00
test_bug785324.html
test_bug791616.html Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel 2016-06-02 15:41:51 -04:00
test_bug831780.html
test_bug841361.html
test_bug904810.html Bug 931668 - Part 23: Change a few test assertion expectations. r=dbaron 2014-09-05 13:48:48 +10:00
test_bug938772.html
test_bug970363.html Bug 970363 - Fix selection moving over readonly elements in contenteditble blocks. r=roc 2014-03-12 07:45:01 -06:00
test_bug1062406.html Bug 1062406 - Part 2 - Tests. r=bz 2014-09-09 11:34:00 +02:00
test_bug1174521.html Bug 1174521 - Backout the second part of bug 1143570 to fix the regression; r=roc 2015-06-17 17:45:51 -04:00
test_contained_plugin_transplant.html
test_image_selection.html
test_image_selection_2.html
test_intrinsic_size_on_loading.html Bug 1205027 - Only size <img> to broken-image size if it's actually broken. r=dholbert 2016-06-03 07:05:46 +09:00
test_invalidate_during_plugin_paint.html Bug 1213710 part 3 - Remove enableTestPlugin.js files and make the tests reference plugin-utils.js directly. r=bsmedberg 2015-11-17 09:54:12 +11:00
test_movement_by_characters.html Bug 756984 - Collapse the selection on the last text node on the line, skipping br and inline frames when clicking past the end of line; r=roc,ehsan 2015-03-27 20:04:29 -04:00
test_movement_by_words.html Bug 1066756 - Include characters with Unicode category Sk (modifier symbol) in double-click word selection. r=mats 2014-09-15 17:19:24 +01:00
test_overflow_event.html Bug 981637: Make overflow events fire correctly in UpdateOverflow codepath. r=mats 2014-03-16 07:21:42 +08:00
test_page_scroll_with_fixed_pos.html Bug 1084321 - Remove b2g app meta viewport work-around. r=kats,roc 2014-11-04 17:15:30 +00:00
test_plugin_clipping.xhtml
test_plugin_clipping2.xhtml
test_plugin_clipping_table.xhtml
test_plugin_clipping_transformed.xhtml
test_plugin_focus.html Bug 1262050 - Remove unneeded assertion and update test annotations accordingly. r=jimm 2016-04-08 12:11:44 -04:00
test_plugin_mouse_coords.html Bug 1213710 part 3 - Remove enableTestPlugin.js files and make the tests reference plugin-utils.js directly. r=bsmedberg 2015-11-17 09:54:12 +11:00
test_plugin_position.xhtml Bug 649012 - Fail mochitest-plains which use flaky timeouts (setTimeout(x) for x > 0); r=ted 2014-12-11 13:34:40 -05:00
test_scroll_behavior.html Fix tests that depend on synchronous scrolling. (bug 1140293, r=mstange,masayuki,kgilbert) 2015-04-13 00:51:43 -04:00
test_scroll_position_restore.html Bug 1269539 - Ensure that the scroll position is restored properly on reloading a page which loads incrementally. r=tnikkel 2016-05-03 10:40:20 -04:00
test_selection_expanding.html
test_selection_preventDefault.html Bug 1255262 - convert test_selection_preventDefault.html to mochitest. r=smaug. 2016-03-10 11:11:41 +08:00
test_selection_splitText-normalize.html
test_selection_touchevents.html
test_selection_underline.html Bug 1261195 - Make the Windows fuzzing in test_selection_underline.html conditional on D2D being enabled. r=mattwoodrow 2016-04-01 08:25:27 -04:00
test_taintedfilters.html