Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Go to file
Markus Stange ebb461c874 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 : rebase_source : 3e4e0b60493397e61283aa1d7fd93d7c197dec29
extra : source : d43c2d5e87f31ff47d7f3ada66c3f5f27cef84a9
2016-08-04 23:51:58 -04:00
accessible Bug 1246447 - crash in mozilla::a11y::DocAccessible::ARIAAttributeChanged, r=yzen 2016-08-04 10:49:21 -04:00
addon-sdk Bug 1288440 P4 Test that sdk/window/events does not leak existing windows. r=gabor 2016-07-22 06:26:49 -07:00
b2g Bug 1284674 - Remove NUWA r=cyu 2016-08-02 14:54:00 +02:00
browser Bug 1288979: Always convert badge background color to a ColorTuple. r=aswan 2016-08-04 14:50:52 -07:00
build Backout 1fcb956172cd (bug 1291229) for Android build bustage on a CLOSED TREE 2016-08-04 20:42:36 -04:00
caps Bug 709991 - Fire onerror instead of throwing on network errors for async XHRs. r=bz 2016-07-30 00:24:56 -04:00
chrome Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
config Bug 1255628 - Replace and/or remove some graphics-related calls in AndroidBridge with NDK equivalents r=jchen 2016-08-04 09:23:34 -05:00
db/sqlite3 Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
devtools merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
docshell Bug 1289890 - Change nsCOMArray::ReplaceObjectAt() return type from "bool" to "void", since it always succeeds. r=froyndnj 2016-08-02 16:20:00 +02:00
dom Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel 2016-08-04 23:51:58 -04:00
editor Bug 1195722 - Follow-up to keep the accessible caret disabled on some reftests that require it. r=me on a CLOSED TREE 2016-08-03 15:59:04 -04:00
embedding Bug 1286472: Replace owner with triggeringPrincipal within docshell. r=bz 2016-07-28 09:20:41 +02:00
extensions Bug 1285885 - Turn off PROMPT_ACTION permission hack for non-b2g builds. r=amarchesini 2016-08-01 14:45:41 +02:00
gfx Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel 2016-08-04 23:51:58 -04:00
gradle/wrapper Bug 1263390 - Use Gradle 2.10 and Android Gradle plugin 2.0. r=mcomella 2016-04-19 20:01:38 +02:00
hal merge mozilla-inbound to mozilla-central a=merge 2016-07-22 11:58:02 +02:00
image Bug 1291033 (Part 2) - Ensure atomicity of ISurfaceProvider locking changes. r=dholbert 2016-08-04 18:47:43 -07:00
intl Bug 1284406 part 3 - Export ICU headers in include/unicode. r=glandium 2016-07-20 15:00:13 +10:00
ipc Generate template-friendly value readers for IPDL unions. (bug 1288259 part 1, r?=billm) 2016-08-04 11:13:38 -07:00
js Bug 1292040 - Baldr: MIPS: Fix load HeapReg and GlobalReg from TlsData. r=luke 2016-08-05 09:04:02 +08:00
layout Bug 1012752 - Snap scrolled area to layer pixels. r=tnikkel 2016-08-04 23:51:58 -04:00
media Bug 1201363 - MediaStreamVideoSink for MediaPipelineTransmit case. r=jesup 2016-05-31 14:59:13 +08:00
memory Bug 1284674 - Remove NUWA r=cyu 2016-08-02 14:54:00 +02:00
mfbt Bug 1197324 - add format-string checking attribute to snprintf_literal. r=froydnj 2016-08-03 14:37:31 +02:00
mobile merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
modules Backed out 3 changesets (bug 1213990) for problems in browser_ext_pageAction_context.js a=bustage CLOSED TREE 2016-08-03 13:49:50 -07:00
mozglue merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
netwerk merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
nsprpub Bug 1257250 - pr_getnameforidentity bounds check and locking r=ted.mielczarek 2016-03-15 17:44:17 -04:00
other-licenses Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
parser Backed out changeset 8f1980fa5bee (bug 1280584) for artifact build bustage a=backout 2016-07-26 10:40:30 -07:00
probes Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
python Backed out 7 changesets (bug 1231764) for apparently causing linux debug wpt bustage 2016-08-03 16:27:06 -07:00
rdf Bug 1277106 - Part 2: Expand MOZ_UTF16() strings to u"" string literals. r=Waldo 2016-07-20 22:03:25 -07:00
release/docker Bug 1266039 - Generate release promotion specific docker images as a part of release promotion process r=Callek a=release DONTBUILD 2016-04-20 17:03:09 -04:00
security merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
services Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2016-08-01 07:09:05 -07:00
startupcache Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
storage Bug 1287739: Always set 'len' variable in storage test, r=mak 2016-07-20 16:12:31 +02:00
taskcluster merge fx-team to mozilla-central a=merge 2016-08-04 15:54:27 +02:00
testing Bug 1291312 - Update web-platform-tests expected data to revision 7a6a5c9f436730f86123e6f48a44bf1b7ba5654f, a=testonly 2016-08-04 23:34:07 +01:00
toolkit Bug 1291199: Retry subprocess perf tests on failure. r=aswan 2016-08-02 15:37:34 -07:00
tools merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
uriloader Bug 373621 - Make mime-type of PDF not overridable. r=bz 2016-07-28 20:20:42 +10:00
view Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
widget Bug 1292288 - Don't hold both the effects lock and the GL lock at the same time in PrepareWindowEffects to avoid deadlock. r=mstange 2016-08-05 11:33:06 +12:00
xpcom merge mozilla-inbound to mozilla-central a=merge 2016-08-04 15:55:50 +02:00
xpfe Bug 1261842 - Add methods to nsIDocShellTreeOwner for sizing the primary content. r=smaug 2016-07-14 16:31:41 -04:00
.clang-format
.clang-format-ignore
.eslintignore Bug 1287827 - Part 2. Build changes for removing Loop. r=glandium 2016-07-30 08:48:29 +01:00
.eslintrc Bug 1245916: Unify eslint global discovery rules. r=pbrosset 2016-02-05 11:37:50 -08:00
.flake8 Bug 1283129 - Flake8 linter is accidentally linting some eslint related .lint files, r=maja_zf 2016-06-29 10:37:27 -04:00
.gdbinit bug 985566 - add some pretty printers to .gdbinit r=froydnj r=glandium 2016-06-02 13:33:07 -04:00
.gdbinit_python bug 985566 - add some pretty printers to .gdbinit r=froydnj r=glandium 2016-06-02 13:33:07 -04:00
.gitignore Bug 1287827 - Part 2. Build changes for removing Loop. r=glandium 2016-07-30 08:48:29 +01:00
.hgignore Bug 1287827 - Part 2. Build changes for removing Loop. r=glandium 2016-07-30 08:48:29 +01:00
.hgtags No bug - Tagging mozilla-central 465d150bc8be5bbf9f02a8607d4552b6a5e1697c with FIREFOX_AURORA_50_BASE a=release DONTBUILD CLOSED TREE 2016-08-01 07:05:25 -07:00
.lldbinit Bug 1254128 - Make the Mozilla .lldbinit use the full path for topsrcdir. r=sparky 2016-03-01 16:36:08 +00:00
.taskcluster.yml Bug 1291070 - Tag and use decision image 0.1.4; r=dustin 2016-08-01 18:09:09 -07:00
.ycm_extra_conf.py Bug 1283340: python: fix .ycm_extra_conf.py for python 3 r=gps 2016-06-29 18:15:46 -07:00
aclocal.m4 merge mozilla-inbound to mozilla-central a=merge 2016-07-27 16:35:44 +02:00
Android.mk
AUTHORS
build.gradle Bug 1268453 - Use Android Gradle plugin 2.1. r=mcomella 2016-04-29 14:48:43 +02:00
client.mk Bug 1278415 - Ensure MOZ_CURRENT_PROJECT is set when running make directly in objdir. r=gps 2016-06-16 11:43:30 +09:00
client.py
CLOBBER Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2016-08-01 07:09:05 -07:00
configure.in Bug 1250294 - Make configure a Python script that invokes the old configure.sh. r=ted 2016-02-25 07:22:33 +09:00
configure.py Bug 1285860 - Add python/mozbuild at beginning of sys.path; r=glandium 2016-07-11 10:42:11 -07:00
GNUmakefile
gradle.properties Bug 1218370 - Use Gradle daemon in srcdir builds. r=me 2015-10-26 09:28:14 -07:00
gradlew Bug 1123416 - Part 1: Make topsrcdir a valid Gradle project root. r=sebastian 2015-10-21 15:07:55 -07:00
LEGAL
LICENSE
mach Bug 1279020 - [mach] Follow symlinked mach binary when searching for a srcdir, r=gps 2016-06-09 17:20:02 -04:00
Makefile.in Bug 1275111 - Move artifact download/install into its own tier; r=glandium 2016-06-01 13:48:53 -04:00
moz.build Bug 1286877 - do not set c-basic-offset for python-mode; r=gps 2016-07-14 10:16:42 -06:00
moz.configure Bug 1290044 - Moved NSIS configure to Python. r=glandium 2016-07-28 17:39:24 -07:00
mozilla-config.h.in Bug 1231314 - Turn mozilla-config.h and js-confdefs.h into CONFIGURE_DEFINE_FILES. r=gps 2015-12-15 08:06:11 +09:00
old-configure.in merge fx-team to mozilla-central a=merge 2016-08-03 17:01:16 +02:00
README.txt
settings.gradle Bug 1233882 - Fold base Gradle project into app Gradle project. r=sebastian,mcomella 2016-02-17 19:25:54 -08:00
test.mozbuild Bug 1229233 - Add a (incomplete) end-to-end build test. r=gps 2015-12-01 13:57:52 +09:00

An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:

    https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure

For information on how to build Mozilla from the source code, see:

    http://developer.mozilla.org/en/docs/Build_Documentation

To have your bug fix / feature added to Mozilla, you should create a patch and
submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:

    http://developer.mozilla.org/en/docs/Creating_a_patch
    http://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree

If you have a question about developing Mozilla, and can't find the solution
on http://developer.mozilla.org, you can try asking your question in a
mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]

You can download nightly development builds from the Mozilla FTP server.
Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy. Firefox nightlies, for example, can be found at:

    https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
            - or -
    http://nightly.mozilla.org/