Bug 87463 - Assertion failure due to Position::upstream() and downstream() not considering shadow hosts as an atomic node and thus crossing editing boundaries
Summary: Assertion failure due to Position::upstream() and downstream() not considerin...
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: HTML Editing (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Web Components Team
URL:
Keywords:
Depends on:
Blocks: 82697
  Show dependency treegraph
 
Reported: 2012-05-24 23:04 PDT by Shinya Kawanaka
Modified: 2013-01-07 22:52 PST (History)
13 users (show)

See Also:


Attachments
Patch (10.17 KB, patch)
2012-05-28 04:47 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-01 (554.58 KB, application/zip)
2012-05-28 06:19 PDT, WebKit Review Bot
no flags Details
Patch (10.24 KB, patch)
2012-05-29 04:40 PDT, Shinya Kawanaka
no flags Details | Formatted Diff | Diff
WIP (9.17 KB, patch)
2012-05-31 00:01 PDT, Shinya Kawanaka
webkit.review.bot: commit-queue-
Details | Formatted Diff | Diff
Archive of layout-test-results from ec2-cr-linux-02 (636.74 KB, application/zip)
2012-05-31 06:28 PDT, WebKit Review Bot
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Shinya Kawanaka 2012-05-24 23:04:26 PDT
After m_start = m_start.downstream(), m_start might get into editing boundaries.
This bug will cause a lot of crashes editing with Shadow DOM.
Comment 1 Shinya Kawanaka 2012-05-24 23:39:04 PDT
I'm now making a patch. I'll submit it soon.
Comment 2 Ryosuke Niwa 2012-05-24 23:41:33 PDT
(In reply to comment #0)
> After m_start = m_start.downstream(), m_start might get into editing boundaries.

What do you mean by getting into editing boundaries? Are you saying that it erroneously crosses editing boundaries?
Comment 3 Shinya Kawanaka 2012-05-24 23:45:10 PDT
(In reply to comment #2)
> (In reply to comment #0)
> > After m_start = m_start.downstream(), m_start might get into editing boundaries.
> 
> What do you mean by getting into editing boundaries? Are you saying that it erroneously crosses editing boundaries?

Sorry for ambiguous term... Yes, you are right.
Comment 4 Shinya Kawanaka 2012-05-28 04:47:03 PDT
Created attachment 144334 [details]
Patch
Comment 5 WebKit Review Bot 2012-05-28 06:19:46 PDT
Comment on attachment 144334 [details]
Patch

Attachment 144334 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12841255

New failing tests:
editing/execCommand/delete-table-with-empty-contents.html
editing/selection/selection-plugin-clear-crash.html
editing/selection/4895428-4.html
editing/pasteboard/replacement-fragment-remove-unrendered-node-crash.html
Comment 6 WebKit Review Bot 2012-05-28 06:19:49 PDT
Created attachment 144344 [details]
Archive of layout-test-results from ec2-cr-linux-01

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-01  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 7 Gyuyoung Kim 2012-05-28 23:41:58 PDT
Comment on attachment 144334 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=144334&action=review

> Source/WebCore/dom/Position.cpp:93
> +    if (position.anchorType() == Position::PositionIsAfterAnchor) {

In my humble opinion, if this condition is changed to *if ~ else if* or *switch ~ case*, it seems to me "return position;" on line 100, line 110 can be removed.

> Source/WebCore/dom/Position.cpp:116
> +

It looks this is unneeded line.
Comment 8 Shinya Kawanaka 2012-05-29 04:40:33 PDT
Created attachment 144519 [details]
Patch
Comment 9 Build Bot 2012-05-29 04:53:11 PDT
Comment on attachment 144519 [details]
Patch

Attachment 144519 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/12840551
Comment 10 Build Bot 2012-05-29 04:53:22 PDT
Comment on attachment 144519 [details]
Patch

Attachment 144519 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/12839572
Comment 11 Early Warning System Bot 2012-05-29 05:03:02 PDT
Comment on attachment 144519 [details]
Patch

Attachment 144519 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/12849457
Comment 12 Gyuyoung Kim 2012-05-29 07:24:58 PDT
Comment on attachment 144519 [details]
Patch

Attachment 144519 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/12849497
Comment 13 Early Warning System Bot 2012-05-29 07:34:16 PDT
Comment on attachment 144519 [details]
Patch

Attachment 144519 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/12843524
Comment 14 WebKit Review Bot 2012-05-29 09:13:07 PDT
Comment on attachment 144519 [details]
Patch

Attachment 144519 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12850492
Comment 15 Ryosuke Niwa 2012-05-29 11:32:06 PDT
Comment on attachment 144519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=144519&action=review

> Source/WebCore/dom/Position.cpp:80
> +    Node* node = position.deprecatedNode();

Please try not to use deprecatedNode and/or anchorNode in new code unless you're explicitly checking the position's type.
See https://rniwa.com/2011-06-26/position-and-anchor-types/

> Source/WebCore/dom/Position.cpp:85
> +    if (node->parentNode() && node->parentNode()->rendererIsEditable() != node->parentNode()->rendererIsEditable())

When could node->parentNode()->rendererIsEditable() ever be different from node->parentNode()->rendererIsEditable()?
We definitely need a test case that executes this line. r- because of this.

> Source/WebCore/dom/Position.cpp:91
> +static PositionIterator visiblePositionIterator(const Position& position)

I don't understand what this function does. Please make the function name more descriptive of what it does.

> Source/WebCore/dom/Position.cpp:96
> +            return createLegacyEditingPosition(position.anchorNode(), caretMaxOffset(position.anchorNode()));

Please don't instantiate legacy positions. I think you're not fixing the bug properly if you have to instantiate legacy position here.

> Source/WebCore/dom/Position.cpp:109
> +    default:

In most cases, we prefer listing all values of enum in switch statements instead of using the default label.
Comment 16 Shinya Kawanaka 2012-05-31 00:01:42 PDT
Created attachment 145000 [details]
WIP
Comment 17 WebKit Review Bot 2012-05-31 06:28:29 PDT
Comment on attachment 145000 [details]
WIP

Attachment 145000 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/12861310

New failing tests:
editing/execCommand/delete-table-with-empty-contents.html
editing/selection/selection-plugin-clear-crash.html
editing/selection/4895428-4.html
editing/shadow/selection-crossing-editing-shadow-boundaries.html
Comment 18 WebKit Review Bot 2012-05-31 06:28:33 PDT
Created attachment 145076 [details]
Archive of layout-test-results from ec2-cr-linux-02

The attached test failures were seen while running run-webkit-tests on the chromium-ews.
Bot: ec2-cr-linux-02  Port: <class 'webkitpy.common.config.ports.ChromiumXVFBPort'>  Platform: Linux-2.6.35-28-virtual-x86_64-with-Ubuntu-10.10-maverick
Comment 19 Gyuyoung Kim 2012-05-31 18:24:42 PDT
Comment on attachment 145000 [details]
WIP

View in context: https://bugs.webkit.org/attachment.cgi?id=145000&action=review

> Source/WebCore/dom/Position.cpp:638
> +#if 0

I think it is better to write a comment to explain why below codes is disabled.

For example,
http://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp#L135

> Source/WebCore/dom/Position.cpp:765
> +#if 0

ditto.
Comment 20 Shinya Kawanaka 2012-05-31 18:44:30 PDT
(In reply to comment #19)
> (From update of attachment 145000 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=145000&action=review
> 
> > Source/WebCore/dom/Position.cpp:638
> > +#if 0
> 
> I think it is better to write a comment to explain why below codes is disabled.
> 
> For example,
> http://trac.webkit.org/browser/trunk/Source/WebKit2/UIProcess/qt/QtTapGestureRecognizer.cpp#L135
> 
> > Source/WebCore/dom/Position.cpp:765
> > +#if 0
> 
> ditto.

It's just a work-in-progress patch to use EWS. Sorry if confusing.
Comment 21 Shinya Kawanaka 2012-07-17 23:43:40 PDT
unassigned me for now. This is not only Shadow-related problem. I might attack this later though.