зеркало из https://github.com/mozilla/gecko-dev.git
f8e66e0cdf
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 |
||
---|---|---|
.. | ||
bug344830_testembed.svg | ||
bug421839-2-page.html | ||
bug633762_iframe.html | ||
bug1174521.html | ||
chrome.ini | ||
file_BrokenImageReference.png | ||
file_Dolske.png | ||
file_IconTestServer.sjs | ||
file_LoadingImageReference.png | ||
file_SlowImage.sjs | ||
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 | ||
file_bug579767_1.html | ||
file_bug579767_2.html | ||
file_scroll_position_restore.html | ||
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 | ||
frame_selection_underline.css | ||
frame_selection_underline.xhtml | ||
mochitest.ini | ||
page_scroll_with_fixed_pos_window.html | ||
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 | ||
test_bug240933.html | ||
test_bug263683.html | ||
test_bug288789.html | ||
test_bug290397.html | ||
test_bug323656.html | ||
test_bug344830.html | ||
test_bug348681.html | ||
test_bug382429.html | ||
test_bug384527.html | ||
test_bug385751.html | ||
test_bug389630.html | ||
test_bug391747.html | ||
test_bug392746.html | ||
test_bug392923.html | ||
test_bug394173.html | ||
test_bug394239.html | ||
test_bug402380.html | ||
test_bug404872.html | ||
test_bug405178.html | ||
test_bug416168.html | ||
test_bug421436.html | ||
test_bug421839-1.html | ||
test_bug421839-2.html | ||
test_bug424627.html | ||
test_bug438840.html | ||
test_bug448860.html | ||
test_bug448987.html | ||
test_bug449653.html | ||
test_bug460532.html | ||
test_bug468167.html | ||
test_bug469613.xul | ||
test_bug469774.xul | ||
test_bug470212.html | ||
test_bug488417.html | ||
test_bug496275.html | ||
test_bug503813.html | ||
test_bug507902.html | ||
test_bug508115.xul | ||
test_bug514732-2.xul | ||
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 | ||
test_bug633762.html | ||
test_bug666225.html | ||
test_bug719503.html | ||
test_bug719515.html | ||
test_bug719518.html | ||
test_bug719523.html | ||
test_bug735641.html | ||
test_bug748961.html | ||
test_bug756984.html | ||
test_bug784410.html | ||
test_bug785324.html | ||
test_bug791616.html | ||
test_bug831780.html | ||
test_bug841361.html | ||
test_bug904810.html | ||
test_bug938772.html | ||
test_bug970363.html | ||
test_bug1062406.html | ||
test_bug1174521.html | ||
test_contained_plugin_transplant.html | ||
test_image_selection.html | ||
test_image_selection_2.html | ||
test_intrinsic_size_on_loading.html | ||
test_invalidate_during_plugin_paint.html | ||
test_movement_by_characters.html | ||
test_movement_by_words.html | ||
test_overflow_event.html | ||
test_page_scroll_with_fixed_pos.html | ||
test_plugin_clipping.xhtml | ||
test_plugin_clipping2.xhtml | ||
test_plugin_clipping_table.xhtml | ||
test_plugin_clipping_transformed.xhtml | ||
test_plugin_focus.html | ||
test_plugin_mouse_coords.html | ||
test_plugin_position.xhtml | ||
test_scroll_behavior.html | ||
test_scroll_position_restore.html | ||
test_selection_expanding.html | ||
test_selection_preventDefault.html | ||
test_selection_splitText-normalize.html | ||
test_selection_touchevents.html | ||
test_selection_underline.html | ||
test_taintedfilters.html |