Closed Bug 1278901 Opened 9 years ago Closed 6 years ago

Non-selectable text added to svg with javascript is initially selected

Categories

(Core :: SVG, defect, P3)

25 Branch
defect

Tracking

()

RESOLVED WORKSFORME
Tracking Status
firefox56 --- affected

People

(Reporter: shao.lo, Assigned: lochang)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached file test.htm
User Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:46.0) Gecko/20100101 Firefox/46.0 Build ID: 20160511223818 Steps to reproduce: When I add a text node to my document in response to a click it is sometimes selected/highlighted initially. The text is supposed to be unselectable. Actual results: With the attached html file, when I click outside the red rect the text is added correctly (without being selected). When I click inside the red rect the text appears selected. After clicking anywhere, the selection is removed and the text can no longer be selected. Expected results: The text should be added unselected (and unselectable) regardless of where the click is received.
Regression range: http://hg.mozilla.org/mozilla-central/pushloghtml?fromchange=cbb24a4a96af&tochange=d7553251cf43 Probably due to: Cameron McCormack — Bug 839955 - Enable new SVG text frames. r=roc
Component: Untriaged → SVG
Product: Firefox → Core
Version: 47 Branch → 25 Branch
Was in 46.01.1 as well (Windows and Ubuntu Linux)
Priority: -- → P3
Reproduced on Nightly56 and Beta55. The problem only appeared when we click into red rect area.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attached file testcase2
So this bug is not svg specific. In the test case, if you select all (ctrl+a) before the <div> element is inserted. The div with style -moz-user-select: none will still be selected as well.
Comment on attachment 8919976 [details] Bug 1278901 - Check whether mUserSelect of parent frame is none before painting the selection. Hi CJ, Could you give a feedback on the patch? Basically I just add a check of whether mUserSelect of the parent frame is none before painting the selection. Since the property -moz-user-select is not inherited. Although, I'm not sure why currently the selection is broken only if we insert an element with -moz-user-select:none afterward.
Attachment #8919976 - Flags: feedback?(cku)
Assignee: nobody → lochang
Status: NEW → ASSIGNED
Comment on attachment 8919976 [details] Bug 1278901 - Check whether mUserSelect of parent frame is none before painting the selection. ShouldDrawSelection is used by nsTextFrame::PaintText, so you will only change rendering part of "user-select". I think you probably should check why PaintTextWithSelection contains selection range in this test case
Attachment #8919976 - Flags: feedback?(cku) → feedback-

Seems OK now.

Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: