Closed
Bug 989012
Opened 10 years ago
Closed 9 years ago
Cursor skips a character after going over images in contentEditable
Categories
(Core :: DOM: Selection, defect)
Tracking
()
RESOLVED
FIXED
mozilla38
People
(Reporter: roan.kattouw, Assigned: ehsan.akhgari)
References
(Regressed 1 open bug)
Details
Attachments
(3 files)
14.90 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
5.19 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
11.37 KB,
patch
|
roc
:
review+
|
Details | Diff | Splinter Review |
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:28.0) Gecko/20100101 Firefox/28.0 (Beta/Release) Build ID: 20140317233501 Steps to reproduce: Go to http://jsfiddle.net/VbL9g/1/ and step through each "Foo<img>Bar" sentence using the arrow keys. Actual results: For most images, the cursor is directly to the left of the image, pressing the right arrow key sends the cursor directly to the right of the image (from Foo|[image]Bar to Foo[image]|Bar). However, for the ones labeled "no src", the cursor goes one position too far (from Foo|[image]Bar to Foo[image]B|ar). This behavior looks like an attempt to ignore invisible images, but it ignores images that have a visible alt text and doesn't ignore images that have their dimensions set to 0x0. Expected results: The behavior should be consistent :) I would argue that invisible images should never be skipped (i.e. the cursor should always go from Foo|[image]Bar to Foo[image]|Bar), they're objects and they should occupy a cursor position even if they're not visible. This is how Chrome behaves. However, if Firefox decides that its behavior should be different from Chrome's and that invisible images should be skipped, it should at least correctly determine whether an image is invisible.
Comment 1•10 years ago
|
||
Confirmed with 2014-04-02-03-02-01-mozilla-central-firefox-31.0a1.en-US.linux-x86_64.
QA Whiteboard: [bugday-20140407]
Component: Untriaged → Editor
Product: Firefox → Core
Summary: Cursor skips over images in contentEditable → Cursor skips a character after going over images in contentEditable
Assignee | ||
Comment 3•9 years ago
|
||
I have fixes for the issues in comment 0. These fixes enable us to skip over all kinds of images no matter what their src and alt attributes are the same way. With these, we should behave the same as Chrome.
Assignee: nobody → ehsan
Component: Editor → Selection
Flags: needinfo?(ehsan)
Assignee | ||
Comment 4•9 years ago
|
||
The caret movement code already handles unselectable text frames if we happen to land in the middle of one in nsTextFrame::PeekOffsetCharacter/Word. However, when performing frame traversal to find the next frame to jump to, we don't remember if we skipped over an unselectable frame, which causes us to jump one offset too much when the caret is on the boundary of selectable and unselectable content. The test cases demonstrate the scenario. Note that an <img alt=foo> is implemented by adding a generated content to the inline frame representing it, so as far as the caret movement code is concerned, both test cases are treated similarly.
Attachment #8549702 -
Flags: review?(roc)
Assignee | ||
Comment 5•9 years ago
|
||
We do not want to traverse inside native anonymous elements, but we should still be able to skip over generated content, to avoid getting stuck on such images.
Attachment #8549704 -
Flags: review?(roc)
Assignee | ||
Comment 6•9 years ago
|
||
https://treeherder.mozilla.org/#/jobs?repo=try&revision=715d199752e0
Attachment #8549702 -
Flags: review?(roc) → review+
Attachment #8549704 -
Flags: review?(roc) → review+
Assignee | ||
Comment 7•9 years ago
|
||
This fixes the test failure on try. We want the behavior that part 1 implements only when moving the selection and not when extending it. I will fold this into part 1 when landing.
Attachment #8549929 -
Flags: review?(roc)
Assignee | ||
Comment 8•9 years ago
|
||
roc: ping? I'd like to land this before I leave for vacation...
Flags: needinfo?(roc)
Attachment #8549929 -
Flags: review?(roc) → review+
Assignee | ||
Comment 9•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/22fb05349a10 https://hg.mozilla.org/integration/mozilla-inbound/rev/9698f6f3f72e
Flags: needinfo?(roc)
Assignee | ||
Comment 10•9 years ago
|
||
Backed out because of Linux32 mochitest-a11y failure: https://hg.mozilla.org/integration/mozilla-inbound/rev/007fbd5bc4bd http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla-inbound-linux/1422390992/mozilla-inbound_ubuntu32_vm_test-mochitest-other-bm05-tests1-linux32-build1648.txt.gz
Flags: needinfo?(ehsan)
Assignee | ||
Comment 11•9 years ago
|
||
(In reply to :Ehsan Akhgari [Away: 1/29-2/20] (not reading bugmail, needinfo? me!) from comment #10) > Backed out because of Linux32 mochitest-a11y failure: > > https://hg.mozilla.org/integration/mozilla-inbound/rev/007fbd5bc4bd > http://ftp.mozilla.org/pub/mozilla.org/firefox/tinderbox-builds/mozilla- > inbound-linux/1422390992/mozilla-inbound_ubuntu32_vm_test-mochitest-other- > bm05-tests1-linux32-build1648.txt.gz Freaking implicit conversions :( <https://dxr.mozilla.org/mozilla-central/source/accessible/generic/HyperTextAccessible.cpp#513>
Flags: needinfo?(ehsan)
Assignee | ||
Comment 12•9 years ago
|
||
Try again: https://hg.mozilla.org/integration/mozilla-inbound/rev/39c448409484 https://hg.mozilla.org/integration/mozilla-inbound/rev/739b6b7ed6bc
Comment 13•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/39c448409484 https://hg.mozilla.org/mozilla-central/rev/739b6b7ed6bc
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla38
Depends on: 1127140
You need to log in
before you can comment on or make changes to this bug.
Description
•