Assertion failure: !mRootContent->IsText(), at src/dom/events/ContentEventHandler.cpp:1202
Categories
(Core :: DOM: Events, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox-esr60 | --- | unaffected |
firefox64 | --- | wontfix |
firefox65 | --- | wontfix |
firefox66 | --- | fixed |
People
(Reporter: tsmith, Assigned: masayuki)
References
(Blocks 1 open bug)
Details
(Keywords: assertion, testcase)
Attachments
(2 files, 1 obsolete file)
Comment 1•6 years ago
|
||
Assignee | ||
Comment 2•6 years ago
|
||
Updated•6 years ago
|
Assignee | ||
Comment 3•6 years ago
|
||
Assignee | ||
Comment 4•6 years ago
|
||
Assignee | ||
Comment 5•6 years ago
|
||
Assignee | ||
Comment 6•6 years ago
|
||
Assignee | ||
Comment 7•6 years ago
|
||
Assignee | ||
Comment 8•6 years ago
|
||
Comment 9•6 years ago
|
||
Comment 10•6 years ago
|
||
Comment 11•6 years ago
|
||
Assignee | ||
Comment 12•6 years ago
|
||
Comment 13•6 years ago
|
||
Assignee | ||
Comment 14•6 years ago
|
||
Assignee | ||
Comment 15•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (JST, +0900)(sick) from comment #14)
(In reply to Emilio Cobos Álvarez (:emilio) from comment #13)
I don't think the anonymous node in <select> (or the options, which in the
test-case you can edit, lol) should be editable, right?Perhaps, yes it is. Editing ability of form controls is undefined.
nsFrameSelection already skips non-editable nodes inside an editable
selection fwiw (see ForceEditableRegion).I'll check it.
Hmm, in nsFrameSelection::MoveCaret(), nsIFrame::PeekOffset() returns an anonymous text node which is editable.
So, there are some issues here:
nsIFrame::GetExtremeCaretPosition()
callsnsIFrame::GetRangeForFrame()
even iftargetFrame.frame
has only anonymous children. Then,GetRangeForFrame()
returns anonymous children. Therefore,GetExtremeCaretPosition()
should avoid callingGetRangeForFrame()
in such case.- Anonymous children of <select> may be set to editable.
nsIFrame::PeekOffset()
may return different anonymous tree node.
Currently, my patch completely fixes only #1. Perhaps, only it should be fixed in another bug first because the other thing are really complicated and if we need to touch nsIFrame::PeekOffset()
, I don't have much time to do it for now.
Any ideas?
Comment 16•6 years ago
|
||
(In reply to Masayuki Nakano [:masayuki] (JST, +0900)(sick) from comment #15)
Hmm, in nsFrameSelection::MoveCaret(), nsIFrame::PeekOffset() returns an anonymous text node which is editable.
So looks to me that is the bug. Bug 805668 prevented these text nodes from being editable via contenteditable, but I don't see anything in nsINode::IsEditable that would prevent us from consider them editable from designMode. Looks to me like that is the bug.
I can take a closer look in the debugger, so not clearing ni? for now.
Comment 17•6 years ago
|
||
I took a closer look to this.
What do you think of https://hg.mozilla.org/try/rev/5663a9c2d81aa523e2f0c8dca1bae7db2339e39d Masayuki? I'm waiting for try atm, but I think it should be green.
It looks like a cleaner way to properly accomplish what nsIContent::UpdateEditableState is trying to do, and it of course makes the assertion go away.
I think we can still end up with the caret in the <select> element in other cases, but I think that's a different bug: nsComboboxControlFrame should have independent selection IMO, so something like this should do:
diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp
index 10a4c7861f91..f74d85c924ac 100644
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -113,12 +113,7 @@ nsComboboxControlFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell,
ComputedStyle* aStyle,
nsFrameState aStateFlags) {
nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame(aStyle);
-
- if (it) {
- // set the state flags (if any are provided)
- it->AddStateBits(aStateFlags);
- }
-
+ it->AddStateBits(aStateFlags | NS_FRAME_INDEPENDENT_SELECTION);
return it;
}
Assignee | ||
Comment 18•6 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #17)
I took a closer look to this.
What do you think of https://hg.mozilla.org/try/rev/5663a9c2d81aa523e2f0c8dca1bae7db2339e39d Masayuki? I'm waiting for try atm, but I think it should be green.
If this won't break <input type="text"> nor <textarea>, looks like reasonable change.
I think we can still end up with the caret in the <select> element in other cases, but I think that's a different bug: nsComboboxControlFrame should have independent selection IMO, so something like this should do:
diff --git a/layout/forms/nsComboboxControlFrame.cpp b/layout/forms/nsComboboxControlFrame.cpp index 10a4c7861f91..f74d85c924ac 100644 --- a/layout/forms/nsComboboxControlFrame.cpp +++ b/layout/forms/nsComboboxControlFrame.cpp @@ -113,12 +113,7 @@ nsComboboxControlFrame* NS_NewComboboxControlFrame(nsIPresShell* aPresShell, ComputedStyle* aStyle, nsFrameState aStateFlags) { nsComboboxControlFrame* it = new (aPresShell) nsComboboxControlFrame(aStyle); - - if (it) { - // set the state flags (if any are provided) - it->AddStateBits(aStateFlags); - } - + it->AddStateBits(aStateFlags | NS_FRAME_INDEPENDENT_SELECTION); return it; }
Looks like that nsListControlFrame also has the flag having independent selection, but actually it does not have nsISelectionController object too. So, it seems that this change must be fine.
Comment 19•6 years ago
|
||
Comment 20•6 years ago
|
||
So this is fully green except for one IME test which checks the IME state of an <input type="file"> inside contenteditable:
It sort of makes sense because <input type="file"> would get its behavior changed (the anonymous <button> would not get the NODE_IS_EDITABLE flag). But I'm not sure about the implications of failing that test.
And what's worse, the test passes locally even if it fails on automation (I'm on Linux as well).
Masayuki, do you know what that test is about? I don't have any idea about IME.
Is it acceptable to just update the expectation? If not, do you know how I could get to repro it or debug it? How is the "ime enabled" value computed? As I mention it passes locally here.
Comment 21•6 years ago
|
||
heh, you're faster reviewing than I am writing :-)
Assignee | ||
Comment 22•6 years ago
|
||
(In reply to Emilio Cobos Álvarez (:emilio) from comment #20)
So this is fully green except for one IME test which checks the IME state of an <input type="file"> inside contenteditable:
It sort of makes sense because <input type="file"> would get its behavior changed (the anonymous <button> would not get the NODE_IS_EDITABLE flag). But I'm not sure about the implications of failing that test.
I built your patch locally and try to check the behavior of <div contenteditable><input type="file"></div>
. Then, clicking the <input type="file">
element happens nothing. I mean, the file picker won't be opened, and not selected the element itself, etc. So, even when I type something after clicking it, nothing happens. In this case, i.e., no text inputtable situation, IME should be disabled. So, returning 0 is fine. So, expected value at here should be gUtils.IME_STATUS_DISABLED
.
(Note: Chrome behaves almost similar to the patched build, but opens the file picker when I click. Although this is another bug.)
And what's worse, the test passes locally even if it fails on automation (I'm on Linux as well).
Wow, really?? I have no idea what's going on...
Assignee | ||
Comment 23•6 years ago
|
||
Ah, might be kEnabledStateOnPasswordField
rather than gUtils.IME_STATUS_DISABLED
. Please check it on tryserver. (Even though the constant name is odd for <input type="file">
, but it's okay to keep using the name.)
Comment 24•6 years ago
|
||
Will do, thanks a lot!
Comment 25•6 years ago
|
||
Comment 26•6 years ago
|
||
bugherder |
Updated•6 years ago
|
Updated•5 years ago
|
Description
•