Changeset 32443 in webkit


Ignore:
Timestamp:
Apr 23, 2008, 11:25:10 AM (17 years ago)
Author:
justin.garcia@apple.com
Message:

WebCore:

2008-04-23 Justin Garcia <justin.garcia@apple.com>

Reviewed by Darin Adler.

<rdar://problem/5825350> OWA: Caret disappears when navigating with arrows keys in contenteditable div

  • editing/htmlediting.cpp: (WebCore::firstEditablePositionAfterPositionInRoot): Return a null VisiblePosition if this function moves out of highestRoot. Re-wrote so as to not duplicate code inside and outside of the while loop. (WebCore::lastEditablePositionBeforePositionInRoot): Ditto.

LayoutTests:

2008-04-23 Justin Garcia <justin.garcia@apple.com>

Reviewed by Darin Adler.

<rdar://problem/5825350> OWA: Caret disappears when navigating with arrows keys in contenteditable div

  • editing/selection/5825350-1-expected.txt: Added.
  • editing/selection/5825350-1.html: Added.
  • editing/selection/5825350-2-expected.txt: Added.
  • editing/selection/5825350-2.html: Added.
Location:
trunk
Files:
4 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r32439 r32443  
     12008-04-23  Justin Garcia  <justin.garcia@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/5825350> OWA: Caret disappears when navigating with arrows keys in contenteditable div
     6
     7        * editing/selection/5825350-1-expected.txt: Added.
     8        * editing/selection/5825350-1.html: Added.
     9        * editing/selection/5825350-2-expected.txt: Added.
     10        * editing/selection/5825350-2.html: Added.
     11
    1122008-04-23  Darin Adler  <darin@apple.com>
    213
  • trunk/WebCore/ChangeLog

    r32442 r32443  
     12008-04-23  Justin Garcia  <justin.garcia@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        <rdar://problem/5825350> OWA: Caret disappears when navigating with arrows keys in contenteditable div
     6
     7        * editing/htmlediting.cpp:
     8        (WebCore::firstEditablePositionAfterPositionInRoot): Return a null VisiblePosition if
     9        this function moves out of highestRoot.  Re-wrote so as to not duplicate code inside
     10        and outside of the while loop.
     11        (WebCore::lastEditablePositionBeforePositionInRoot): Ditto.
     12
    1132008-04-23  Daniel Zucker  <zucker@wake3.com>
    214
  • trunk/WebCore/editing/htmlediting.cpp

    r31851 r32443  
    243243VisiblePosition firstEditablePositionAfterPositionInRoot(const Position& position, Node* highestRoot)
    244244{
     245    // position falls before highestRoot.
    245246    if (comparePositions(position, Position(highestRoot, 0)) == -1 && highestRoot->isContentEditable())
    246247        return VisiblePosition(Position(highestRoot, 0));
    247    
    248     Position p = nextVisuallyDistinctCandidate(position);
    249     Node* root = editableRootForPosition(position);
    250     Node* shadowAncestor = root ? root->shadowAncestorNode() : 0;
    251     if (p.isNull() && root && (shadowAncestor != root))
    252         p = Position(shadowAncestor, maxDeepOffset(shadowAncestor));
    253     while (p.isNotNull() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot)) {
     248       
     249    Position p = position;
     250   
     251    if (Node* shadowAncestor = p.node()->shadowAncestorNode())
     252        if (shadowAncestor != p.node())
     253            p = Position(shadowAncestor, maxDeepOffset(shadowAncestor));
     254   
     255    while (p.node() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot))
    254256        p = isAtomicNode(p.node()) ? positionAfterNode(p.node()) : nextVisuallyDistinctCandidate(p);
    255        
    256         root = editableRootForPosition(position);
    257         shadowAncestor = root ? root->shadowAncestorNode() : 0;
    258         if (p.isNull() && root && (shadowAncestor != root))
    259             p = Position(shadowAncestor, maxDeepOffset(shadowAncestor));
    260     }
    261 
     257   
     258    if (p.node() && !p.node()->isDescendantOf(highestRoot))
     259        return VisiblePosition();
     260   
    262261    return VisiblePosition(p);
    263262}
     
    265264VisiblePosition lastEditablePositionBeforePositionInRoot(const Position& position, Node* highestRoot)
    266265{
     266    // When position falls after highestRoot, the result is easy to compute.
    267267    if (comparePositions(position, Position(highestRoot, maxDeepOffset(highestRoot))) == 1)
    268268        return VisiblePosition(Position(highestRoot, maxDeepOffset(highestRoot)));
    269    
    270     Position p = previousVisuallyDistinctCandidate(position);
    271     Node* root = editableRootForPosition(position);
    272     Node* shadowAncestor = root ? root->shadowAncestorNode() : 0;
    273     if (p.isNull() && root && (shadowAncestor != root))
    274         p = Position(shadowAncestor, 0);
    275     while (p.isNotNull() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot)) {
     269       
     270    Position p = position;
     271   
     272    if (Node* shadowAncestor = p.node()->shadowAncestorNode())
     273        if (shadowAncestor != p.node())
     274            p = Position(shadowAncestor, 0);
     275   
     276    while (p.node() && !isEditablePosition(p) && p.node()->isDescendantOf(highestRoot))
    276277        p = isAtomicNode(p.node()) ? positionBeforeNode(p.node()) : previousVisuallyDistinctCandidate(p);
    277        
    278         root = editableRootForPosition(position);
    279         shadowAncestor = root ? root->shadowAncestorNode() : 0;
    280         if (p.isNull() && root && (shadowAncestor != root))
    281             p = Position(shadowAncestor, 0);
    282     }
    283 
     278   
     279    if (p.node() && !p.node()->isDescendantOf(highestRoot))
     280        return VisiblePosition();
     281   
    284282    return VisiblePosition(p);
    285283}
Note: See TracChangeset for help on using the changeset viewer.