WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
113007
Unable to insert a paragraph in between some text whose previous sibling is a non-editable block.
https://bugs.webkit.org/show_bug.cgi?id=113007
Summary
Unable to insert a paragraph in between some text whose previous sibling is a...
Arpita Bahuguna
Reported
2013-03-21 23:11:51 PDT
Created
attachment 194449
[details]
Testpage Fetch the attached testpage and try to insert a line break in between the second line of text, i.e. in between "Trytoinsertlinebreakinmiddleofthisline". The text is not broken as expected and a new paragraph is also not inserted. This causes an assert in comparePositions() function in htmlediting.cpp (ASSERT(commonScope);)
Attachments
Testpage
(129 bytes, text/html)
2013-03-21 23:11 PDT
,
Arpita Bahuguna
no flags
Details
Patch
(5.05 KB, patch)
2013-03-22 01:02 PDT
,
Arpita Bahuguna
no flags
Details
Formatted Diff
Diff
Patch
(5.37 KB, patch)
2013-03-22 02:50 PDT
,
Arpita Bahuguna
no flags
Details
Formatted Diff
Diff
Patch
(5.45 KB, patch)
2013-03-25 01:37 PDT
,
Arpita Bahuguna
no flags
Details
Formatted Diff
Diff
Patch
(5.30 KB, patch)
2013-03-26 01:38 PDT
,
Arpita Bahuguna
no flags
Details
Formatted Diff
Diff
Show Obsolete
(3)
View All
Add attachment
proposed patch, testcase, etc.
Arpita Bahuguna
Comment 1
2013-03-22 01:02:16 PDT
Created
attachment 194464
[details]
Patch
Ryosuke Niwa
Comment 2
2013-03-22 01:12:56 PDT
Comment on
attachment 194464
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=194464&action=review
> Source/WebCore/ChangeLog:15 > + improper position computation.
What kind of improper position?
> Source/WebCore/ChangeLog:26 > + If the current node's renderer doesn't exist, it's next > + sibling should be sought.
Why?
> LayoutTests/editing/inserting/insert-paragraph-between-text.html:6 > +<div contenteditable="false">1</div>Trytoinsertlinebreakinmiddleofthisline</div>
Can we use CamelCase in "Trytoinsertlinebreakinmiddleofthisline"?
Arpita Bahuguna
Comment 3
2013-03-22 02:14:38 PDT
(In reply to
comment #2
)
> (From update of
attachment 194464
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=194464&action=review
>
Hi Ryosuke, thanks for the review!
> > Source/WebCore/ChangeLog:15 > > + improper position computation. > > What kind of improper position? >
Got it! Apologize for my careless interpretation. Uploading another patch.
> > Source/WebCore/ChangeLog:26 > > + If the current node's renderer doesn't exist, it's next > > + sibling should be sought. > > Why? > > > LayoutTests/editing/inserting/insert-paragraph-between-text.html:6 > > +<div contenteditable="false">1</div>Trytoinsertlinebreakinmiddleofthisline</div> > > Can we use CamelCase in "Trytoinsertlinebreakinmiddleofthisline"?
Will do.
Arpita Bahuguna
Comment 4
2013-03-22 02:50:42 PDT
Created
attachment 194489
[details]
Patch
Ryosuke Niwa
Comment 5
2013-03-22 08:52:51 PDT
Comment on
attachment 194489
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=194489&action=review
> Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp:375 > + visiblePos = positionBeforeNode(n);
I would have preferred to declare another local variable rather than re-using visiblePos. As confusingly named as visiblePos is, visiblePos is supposed to be VisiblePosition of the insertion point.
> LayoutTests/editing/inserting/insert-paragraph-between-text-expected.txt:1 > +Testcase for bug <
https://bugs.webkit.org/show_bug.cgi?id=113007
> 113007: Unable to insert a paragraph in between some text whose previous sibling is a non-editable block.
We can use shorthand URL
https://webkit.org/b/113007
. Also, We probably don't have both bug URL and the bug id.
> LayoutTests/editing/inserting/insert-paragraph-between-text.html:12 > +var sel = window.getSelection();
Please don't use abbreviations like sel. Spell out the whole word.
> LayoutTests/editing/inserting/insert-paragraph-between-text.html:13 > +sel.setPosition(test, 3);
More standardized way to do this is to use collapse instead. setPosition is a WebKit extension. Instead of saying 3, maybe we should just use test.childNodes.length?
Arpita Bahuguna
Comment 6
2013-03-25 01:37:11 PDT
Created
attachment 194800
[details]
Patch
Arpita Bahuguna
Comment 7
2013-03-25 05:50:08 PDT
(In reply to
comment #5
)
> (From update of
attachment 194489
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=194489&action=review
>
Hi rniwa! Many thanks for the r+ !
> > Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp:375 > > + visiblePos = positionBeforeNode(n); > > I would have preferred to declare another local variable rather than re-using visiblePos. > As confusingly named as visiblePos is, visiblePos is supposed to be VisiblePosition of the insertion point. >
Have used another local variable: posBeforeNode (for want of a better and more appropriate alternative).
> > LayoutTests/editing/inserting/insert-paragraph-between-text-expected.txt:1 > > +Testcase for bug <
https://bugs.webkit.org/show_bug.cgi?id=113007
> 113007: Unable to insert a paragraph in between some text whose previous sibling is a non-editable block. > > We can use shorthand URL
https://webkit.org/b/113007
. Also, We probably don't have both bug URL and the bug id. >
Done
> > LayoutTests/editing/inserting/insert-paragraph-between-text.html:12 > > +var sel = window.getSelection(); > > Please don't use abbreviations like sel. Spell out the whole word. > > > LayoutTests/editing/inserting/insert-paragraph-between-text.html:13 > > +sel.setPosition(test, 3); > > More standardized way to do this is to use collapse instead. setPosition is a WebKit extension. > Instead of saying 3, maybe we should just use test.childNodes.length?
Done
Ryosuke Niwa
Comment 8
2013-03-25 13:26:13 PDT
Comment on
attachment 194800
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=194800&action=review
> Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp:374 > + VisiblePosition posBeforeNode;
Please spell out position instead of using abbreviations like "pos". I know the existing code uses it but we're trying to remove that usage.
> Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp:376 > + posBeforeNode = positionBeforeNode(n);
Can't we declare VisiblePosition here?
> Source/WebCore/editing/InsertParagraphSeparatorCommand.cpp:378 > + if (!posBeforeNode.isNull()) { > + if (comparePositions(VisiblePosition(insertionPosition), posBeforeNode) <= 0)
These two if-statements could be combined.
> LayoutTests/editing/inserting/insert-paragraph-between-text.html:18 > +Markup.description('Testcase for bug
https://webkit.org/b/113007
: Unable to insert a paragraph in between some text whose previous sibling is a non-editable block.\n'+ > +'The test has passed if three lines are displayed instead of two, with the last line consisting of the letter "e".');
I would prefer seeing this description before the test code so that I can read it before reading the test code.
Arpita Bahuguna
Comment 9
2013-03-26 01:38:09 PDT
Created
attachment 195027
[details]
Patch
Build Bot
Comment 10
2013-03-26 04:15:31 PDT
Comment on
attachment 195027
[details]
Patch
Attachment 195027
[details]
did not pass win-ews (win): Output:
http://webkit-commit-queue.appspot.com/results/17209936
WebKit Review Bot
Comment 11
2013-03-26 04:40:03 PDT
Comment on
attachment 195027
[details]
Patch Clearing flags on attachment: 195027 Committed
r146867
: <
http://trac.webkit.org/changeset/146867
>
WebKit Review Bot
Comment 12
2013-03-26 04:40:06 PDT
All reviewed patches have been landed. Closing bug.
Arpita Bahuguna
Comment 13
2013-03-26 04:47:41 PDT
The win bot failure is due to: fast/text/custom-font-data-crash.html -> crashed It seems to be unrelated to this fix (which is specifically for inserting a paragraph in some editable content). Also, win-bot failure results for other patches such as for #113233 [
http://webkit-commit-queue.appspot.com/results/17310196
] and #113275 [
http://webkit-commit-queue.appspot.com/results/17246524
] show the same crash failure.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug