Bug#875571: a11y: getCharacterExtents returns 0, 0 coordinates when text is empty
Samuel Thibault
sthibault at debian.org
Tue Sep 12 10:26:03 UTC 2017
Package: firefox-esr
Version: 52.3.0esr-2
Severity: normal
Tags: upstream a11y patch
Owner: bugs at hypra.fr
User: bugs at hypra.fr
Usertags: hypra
Forwarded: https://bugzilla.mozilla.org/show_bug.cgi?id=1319273
Hello,
For bug tracking in Debian, here is an upstream bug report. I have
attached the testcase and the patch proposed to upstream.
> Steps to reproduce:
>
> I have attached a small python script written by Ksamak that mimics a very basic screen magnifier tracking focus location.
>
> While running it, run firefox, press control-L to access the URL widget, empty it with backspace
>
>
> Actual results:
>
> The python script reports
>
> position: 0,0 size 0:0
>
>
> Expected results:
>
> It should have reported at least the coordinates of the widget, just like it does when it is not empty.
Samuel
-- Package-specific info:
-- Extensions information
Name: Adblock Plus
Location: ${PROFILE_EXTENSIONS}/{d10d0bf8-f5b5-c8b4-a8b2-2b9879e08c5d}.xpi
Status: enabled
Name: Application Update Service Helper
Location: ${PROFILE_EXTENSIONS}/aushelper at mozilla.org.xpi
Status: enabled
Name: Calomel SSL Validation
Location: ${PROFILE_EXTENSIONS}/calomelsslvalidation at calomel.org.xpi
Status: enabled
Name: Default theme
Location: /usr/lib/firefox-esr/browser/extensions/{972ce4c6-7e08-4474-a285-3208198ce6fd}.xpi
Package: firefox-esr
Status: enabled
Name: En-têtes HTTP en direct
Location: ${PROFILE_EXTENSIONS}/{8f8fe09b-0bd3-4470-bc1b-8cad42b8203a}
Status: enabled
Name: GNU LibreJS
Location: ${PROFILE_EXTENSIONS}/jid1-KtlZuoiikVfFew at jetpack.xpi
Status: user-disabled
Name: It's All Text!
Location: ${PROFILE_EXTENSIONS}/itsalltext at docwhat.gerf.org
Status: enabled
Name: Lilo
Location: ${PROFILE_EXTENSIONS}/jid1-zmgYgiQPXJtjNA at jetpack.xpi
Status: enabled
Name: Multi-process staged rollout
Location: ${PROFILE_EXTENSIONS}/e10srollout at mozilla.org.xpi
Status: enabled
Name: Pocket
Location: ${PROFILE_EXTENSIONS}/firefox at getpocket.com.xpi
Status: enabled
Name: SixOrNot
Location: ${PROFILE_EXTENSIONS}/sixornot at entropy.me.uk.xpi
Status: enabled
Name: Web Compat
Location: ${PROFILE_EXTENSIONS}/webcompat at mozilla.org.xpi
Status: enabled
-- Plugins information
Name: GNOME Shell Integration
Location: /usr/lib/mozilla/plugins/libgnome-shell-browser-plugin.so
Package: gnome-shell
Status: enabled
Name: IcedTea-Web Plugin (using IcedTea-Web 1.6.2 (1.6.2-3.1))
Location: /usr/lib/jvm/java-8-openjdk-amd64/jre/lib/amd64/IcedTeaPlugin.so
Package: icedtea-8-plugin:amd64
Status: disabled
Name: Shockwave Flash
Location: /usr/lib/gnash/libgnashplugin.so
Package: browser-plugin-gnash
Status: enabled
-- Addons package information
ii browser-plugin 0.8.11~git20 amd64 GNU Shockwave Flash (SWF) player
ii firefox-esr 52.3.0esr-2 amd64 Mozilla Firefox web browser - Ext
ii gnome-shell 3.22.3-3 amd64 graphical shell for the GNOME des
ii icedtea-8-plug 1.6.2-3.1 amd64 web browser plugin based on OpenJ
-- System Information:
Debian Release: buster/sid
APT prefers testing
APT policy: (990, 'testing'), (500, 'unstable-debug'), (500, 'testing-debug'), (500, 'stable-debug'), (500, 'buildd-unstable'), (500, 'unstable'), (500, 'stable'), (500, 'oldstable'), (1, 'experimental-debug'), (1, 'buildd-experimental'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386
Kernel: Linux 4.13.0 (SMP w/4 CPU cores)
Locale: LANG=fr_FR.UTF-8, LC_CTYPE=fr_FR.UTF-8 (charmap=UTF-8), LANGUAGE=fr_FR.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages firefox-esr depends on:
ii debianutils 4.8.2
ii fontconfig 2.12.3-0.2
ii libasound2 1.1.3-5
ii libatk1.0-0 2.24.0-1
ii libc6 2.24-17
ii libcairo-gobject2 1.14.10-1
ii libcairo2 1.14.10-1
ii libdbus-1-3 1.11.16+really1.10.22-1
ii libdbus-glib-1-2 0.108-2
ii libevent-2.1-6 2.1.8-stable-4
ii libffi6 3.2.1-6
ii libfontconfig1 2.12.3-0.2
ii libfreetype6 2.8-0.2
ii libgcc1 1:7.2.0-3
ii libgdk-pixbuf2.0-0 2.36.5-2
ii libglib2.0-0 2.53.6-1
ii libgtk-3-0 3.22.19-1
ii libgtk2.0-0 2.24.31-2
ii libhunspell-1.6-0 1.6.1-2
ii libjsoncpp1 1.7.4-3
ii libnspr4 2:4.16-1
ii libnss3 2:3.32-2
ii libpango-1.0-0 1.40.11-1
ii libsqlite3-0 3.20.1-1
ii libstartup-notification0 0.12-4+b2
ii libstdc++6 7.2.0-3
ii libvpx4 1.6.1-3
ii libx11-6 2:1.6.4-3
ii libx11-xcb1 2:1.6.4-3
ii libxcb-shm0 1.12-1
ii libxcb1 1.12-1
ii libxcomposite1 1:0.4.4-2
ii libxdamage1 1:1.1.4-3
ii libxext6 2:1.3.3-1+b2
ii libxfixes3 1:5.0.3-1
ii libxrender1 1:0.9.10-1
ii libxt6 1:1.1.5-1
ii procps 2:3.3.12-3
ii zlib1g 1:1.2.8.dfsg-5
firefox-esr recommends no packages.
Versions of packages firefox-esr suggests:
ii fonts-lmodern 2.004.5-3
ii fonts-stix [otf-stix] 1.1.1-4
ii libcanberra0 0.30-3
ii libgssapi-krb5-2 1.15.1-2
pn mozplugger <none>
-- no debconf information
--
Samuel
<O> Ça peut être une madeleine à sous munitions (avec des composants,
par exemple)
-+- #runtime -+-
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test.py
Type: text/x-python
Size: 1381 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-mozilla-maintainers/attachments/20170912/7cab5fff/attachment.py>
-------------- next part --------------
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1250,7 +1250,26 @@ HyperTextAccessible::TextBounds(int32_t
NS_ERROR("Wrong in offset");
return nsIntRect();
}
+ bool stripRight = false, stripLeft = false;
+ if (CharacterCount() == 0)
+ // Empty content, use our own bound to at least get x,y coordinates
+ return GetFrame()->GetScreenRect();
+
+ if (startOffset == endOffset) {
+ // Non-empty content, but empty selection
+ if (startOffset == 0) {
+ // At the beginning of text. Get rectangle of the first character and
+ // strip its right part.
+ endOffset = 1;
+ stripRight = true;
+ } else {
+ // Not at the beginning of the text. Get rectangle of the character on
+ // the left of the empty selection, and strip its left part.
+ startOffset = startOffset - 1;
+ stripLeft = true;
+ }
+ }
int32_t childIdx = GetChildIndexAtOffset(startOffset);
if (childIdx == -1)
@@ -1282,6 +1301,15 @@ HyperTextAccessible::TextBounds(int32_t
}
nsAccUtils::ConvertScreenCoordsTo(&bounds.x, &bounds.y, aCoordType, this);
+
+ // Strip for empty selections
+ if (stripLeft) {
+ bounds.x = bounds.x + bounds.width;
+ bounds.width = 0;
+ }
+ if (stripRight) {
+ bounds.width = 0;
+ }
return bounds;
}
More information about the pkg-mozilla-maintainers
mailing list