WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-89081-20120622070529.patch (text/plain), 6.63 KB, created by
Shinya Kawanaka
on 2012-06-21 15:05:30 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Shinya Kawanaka
Created:
2012-06-21 15:05:30 PDT
Size:
6.63 KB
patch
obsolete
>Subversion Revision: 120924 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ab55b83f3c762ed60b4776596feb548eb42789d0..481a35ac2319a772f42955146c2cc0b15278a915 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2012-06-21 Shinya Kawanaka <shinyak@chromium.org> >+ >+ [Shadow][Editing] Assertion in VisibleSelection::adjuseSelectionToAvoidCrossingBoundaries() is triggered. >+ https://bugs.webkit.org/show_bug.cgi?id=89081 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ firstEditablePositionAfterPositionInRoot and lastEditablePositionBeforePositionInRoot did not >+ consider a case that an argument hiehestRoot can be in Shadow DOM. So when adjusting selection to >+ avoid crossing editing boundaries, VisiblePosition can break shadow boundaries, and it causes >+ an assertion trigger. >+ >+ By this patch, firstEditablePositionAfterPositionInRoot and lastEditablePositionBeforePositionInRoot will >+ adjust position to the tree scope of highestRoot instead of its parent tree scope. >+ >+ Test: editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html >+ >+ * editing/htmlediting.cpp: >+ (WebCore::firstEditablePositionAfterPositionInRoot): >+ (WebCore::lastEditablePositionBeforePositionInRoot): >+ > 2012-06-20 Hans Wennborg <hans@chromium.org> > > Speech JavaScript API: SpeechRecognition should hook up with ActiveDOMObject more >diff --git a/Source/WebCore/editing/htmlediting.cpp b/Source/WebCore/editing/htmlediting.cpp >index e959178e3629e64ffb138eaf858e1aec058c509c..d3fa219558a75b7cbdb971b7b11d266cf964f7b8 100644 >--- a/Source/WebCore/editing/htmlediting.cpp >+++ b/Source/WebCore/editing/htmlediting.cpp >@@ -259,11 +259,15 @@ VisiblePosition firstEditablePositionAfterPositionInRoot(const Position& positio > return firstPositionInNode(highestRoot); > > Position p = position; >- >- if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode()) >- if (shadowAncestor != p.deprecatedNode()) >- p = positionAfterNode(shadowAncestor); >- >+ >+ if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { >+ Node* shadowAncestor = highestRoot->treeScope()->ancestorInThisScope(p.deprecatedNode()); >+ if (!shadowAncestor) >+ return VisiblePosition(); >+ >+ p = positionAfterNode(shadowAncestor); >+ } >+ > while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot)) > p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(p.deprecatedNode()) : nextVisuallyDistinctCandidate(p); > >@@ -281,9 +285,11 @@ VisiblePosition lastEditablePositionBeforePositionInRoot(const Position& positio > > Position p = position; > >- if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode()) { >- if (shadowAncestor != p.deprecatedNode()) >- p = firstPositionInOrBeforeNode(shadowAncestor); >+ if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) { >+ Node* shadowAncestor = highestRoot->treeScope()->ancestorInThisScope(p.deprecatedNode()); >+ if (!shadowAncestor) >+ return VisiblePosition(); >+ p = firstPositionInOrBeforeNode(shadowAncestor); > } > > while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot)) >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 2c614d171fb275ea15fa6279f566412d6745258d..bf7bd54c9bf7ac601e419d6f6c0a1b6206e1e2c3 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,13 @@ >+2012-06-21 Shinya Kawanaka <shinyak@chromium.org> >+ >+ [Shadow][Editing] Assertion in VisibleSelection::adjuseSelectionToAvoidCrossingBoundaries() is triggered. >+ https://bugs.webkit.org/show_bug.cgi?id=89081 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * editing/shadow/adjusting-editing-boundary-with-table-in-shadow-expected.txt: Added. >+ * editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html: Added. >+ > 2012-06-21 Csaba Osztrogonác <ossy@webkit.org> > > [Qt] Unreviewed gardening, unskip now passing tests. >diff --git a/LayoutTests/editing/shadow/adjusting-editing-boundary-with-table-in-shadow-expected.txt b/LayoutTests/editing/shadow/adjusting-editing-boundary-with-table-in-shadow-expected.txt >new file mode 100644 >index 0000000000000000000000000000000000000000..8f19446c4e837d43e2ce936fdeaf1055e9c6c54f >--- /dev/null >+++ b/LayoutTests/editing/shadow/adjusting-editing-boundary-with-table-in-shadow-expected.txt >@@ -0,0 +1,4 @@ >+PASS >+Placing this sentence before table won't trigger an asertion. >+ >+Selecting around a table which is distributed from shadow subtree to nested shadow subtree will trigger an assertion. To try manually, select from "shadow 2" to around "after" and confirm a crash does not occur. >diff --git a/LayoutTests/editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html b/LayoutTests/editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html >new file mode 100644 >index 0000000000000000000000000000000000000000..e3202c21913df0d38f44c0f8d0449462208e25b3 >--- /dev/null >+++ b/LayoutTests/editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html >@@ -0,0 +1,40 @@ >+<!DOCTYPE html> >+<html> >+<body> >+<script src="../../fast/dom/shadow/resources/polyfill.js"></script> >+<script src="../../fast/dom/resources/event-sender-util.js"></script> >+ >+<div id="container" contenteditable> >+ <table border="1" id="host" contenteditable> >+ <tr><td>host 1</td></tr> >+ <tr><td>host 2</td></tr> >+ </table> >+</div> >+ >+<p>Placing this sentence before table won't trigger an asertion.</p> >+<p>Selecting around a table which is distributed from shadow subtree to nested shadow subtree will trigger an assertion. To try manually, select from "shadow 2" to around "after" and confirm a crash does not occur.</p> >+ >+<script> >+if (window.layoutTestController) >+ layoutTestController.dumpAsText(); >+ >+var shadowRoot = new WebKitShadowRoot(host); >+var div = document.createElement('div'); >+shadowRoot.appendChild(div); >+div.innerHTML = "<table border='1'><tr><td>shadow 1</td></tr><tr><td id='src'>shadow 2</td></tr></table>"; >+ >+var nestedShadowRoot = new WebKitShadowRoot(div); >+nestedShadowRoot.innerHTML = "<div contenteditable>before<shadow></shadow>after</div>"; >+ >+var src = shadowRoot.getElementById('src'); >+ >+eventSender.mouseMoveTo(src.offsetLeft + 10, src.offsetTop + src.offsetHeight / 2); >+eventSender.mouseDown(); >+internals.address(src); >+eventSender.mouseMoveTo(src.offsetLeft - 10, src.offsetTop + src.offsetHeight / 2); >+eventSender.mouseUp(); >+ >+container.innerHTML = "PASS"; >+</script> >+</body> >+</html>
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 89081
:
147526
|
148895
|
148903