Changeset 120991 in webkit


Ignore:
Timestamp:
Jun 21, 2012, 7:02:38 PM (13 years ago)
Author:
shinyak@chromium.org
Message:

[Shadow][Editing] Assertion in VisibleSelection::adjuseSelectionToAvoidCrossingBoundaries() is triggered.
https://bugs.webkit.org/show_bug.cgi?id=89081

Reviewed by Ryosuke Niwa.

Source/WebCore:

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):

LayoutTests:

  • editing/shadow/adjusting-editing-boundary-with-table-in-shadow-expected.txt: Added.
  • editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html: Added.
Location:
trunk
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r120990 r120991  
     12012-06-21  Shinya Kawanaka  <shinyak@chromium.org>
     2
     3        [Shadow][Editing] Assertion in VisibleSelection::adjuseSelectionToAvoidCrossingBoundaries() is triggered.
     4        https://bugs.webkit.org/show_bug.cgi?id=89081
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        * editing/shadow/adjusting-editing-boundary-with-table-in-shadow-expected.txt: Added.
     9        * editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html: Added.
     10
    1112012-06-21  Gregg Tavares  <gman@google.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r120988 r120991  
     12012-06-21  Shinya Kawanaka  <shinyak@chromium.org>
     2
     3        [Shadow][Editing] Assertion in VisibleSelection::adjuseSelectionToAvoidCrossingBoundaries() is triggered.
     4        https://bugs.webkit.org/show_bug.cgi?id=89081
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        firstEditablePositionAfterPositionInRoot and lastEditablePositionBeforePositionInRoot did not
     9        consider a case that an argument hiehestRoot can be in Shadow DOM. So when adjusting selection to
     10        avoid crossing editing boundaries, VisiblePosition can break shadow boundaries, and it causes
     11        an assertion trigger.
     12
     13        By this patch, firstEditablePositionAfterPositionInRoot and lastEditablePositionBeforePositionInRoot will
     14        adjust position to the tree scope of highestRoot instead of its parent tree scope.
     15
     16        Test: editing/shadow/adjusting-editing-boundary-with-table-in-shadow.html
     17
     18        * editing/htmlediting.cpp:
     19        (WebCore::firstEditablePositionAfterPositionInRoot):
     20        (WebCore::lastEditablePositionBeforePositionInRoot):
     21
    1222012-06-21  Andrey Kosyakov  <caseq@chromium.org>
    223
  • trunk/Source/WebCore/editing/htmlediting.cpp

    r120896 r120991  
    260260
    261261    Position p = position;
    262    
    263     if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode())
    264         if (shadowAncestor != p.deprecatedNode())
    265             p = positionAfterNode(shadowAncestor);
    266    
     262
     263    if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
     264        Node* shadowAncestor = highestRoot->treeScope()->ancestorInThisScope(p.deprecatedNode());
     265        if (!shadowAncestor)
     266            return VisiblePosition();
     267
     268        p = positionAfterNode(shadowAncestor);
     269    }
     270
    267271    while (p.deprecatedNode() && !isEditablePosition(p) && p.deprecatedNode()->isDescendantOf(highestRoot))
    268272        p = isAtomicNode(p.deprecatedNode()) ? positionInParentAfterNode(p.deprecatedNode()) : nextVisuallyDistinctCandidate(p);
     
    282286    Position p = position;
    283287
    284     if (Node* shadowAncestor = p.deprecatedNode()->shadowAncestorNode()) {
    285         if (shadowAncestor != p.deprecatedNode())
    286             p = firstPositionInOrBeforeNode(shadowAncestor);
     288    if (position.deprecatedNode()->treeScope() != highestRoot->treeScope()) {
     289        Node* shadowAncestor = highestRoot->treeScope()->ancestorInThisScope(p.deprecatedNode());
     290        if (!shadowAncestor)
     291            return VisiblePosition();
     292
     293        p = firstPositionInOrBeforeNode(shadowAncestor);
    287294    }
    288295   
Note: See TracChangeset for help on using the changeset viewer.