⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 109365 in webkit


Ignore:
Timestamp:
Mar 1, 2012, 10:43:56 AM (15 years ago)
Author:
cevans@google.com
Message:

Merge 108009
BUG=112542
Review URL: ​https://chromiumcodereview.appspot.com/9567015

Location:
branches/chromium/963
Files:
4 edited
2 copied

Legend:

Unmodified
Added
Removed
  • branches/chromium/963/Source/WebCore/editing/ApplyBlockElementCommand.cpp

    r95901 r109365  
    8181    ASSERT(!startOfSelection.isNull());
    8282    ASSERT(!endOfSelection.isNull());
    83     Element* startScope = 0;
    84     int startIndex = indexForVisiblePosition(startOfSelection, &startScope);
    85     Element* endScope = 0;
    86     int endIndex = indexForVisiblePosition(endOfSelection, &endScope);
     83    RefPtr<Element> startScope;
     84    int startIndex = indexForVisiblePosition(startOfSelection, startScope);
     85    RefPtr<Element> endScope;
     86    int endIndex = indexForVisiblePosition(endOfSelection, endScope);
    8787
    8888    formatSelection(startOfSelection, endOfSelection);
    … …  
    9494    ASSERT(startIndex <= endIndex);
    9595    if (startScope == endScope && startIndex >= 0 && startIndex <= endIndex) {
    96         VisiblePosition start(visiblePositionForIndex(startIndex, startScope));
    97         VisiblePosition end(visiblePositionForIndex(endIndex, endScope));
     96        VisiblePosition start(visiblePositionForIndex(startIndex, startScope.get()));
     97        VisiblePosition end(visiblePositionForIndex(endIndex, endScope.get()));
    9898        if (start.isNotNull() && end.isNotNull())
    9999            setEndingSelection(VisibleSelection(start, end, endingSelection().isDirectional()));
  • branches/chromium/963/Source/WebCore/editing/InsertListCommand.cpp

    r93134 r109365  
    153153                // the beginning of the document to the endOfSelection everytime this code is executed.
    154154                // But not using index is hard because there are so many ways we can lose selection inside doApplyForSingleParagraph.
    155                 Element* scope = 0;
    156                 int indexForEndOfSelection = indexForVisiblePosition(endOfSelection, &scope);
     155                RefPtr<Element> scope;
     156                int indexForEndOfSelection = indexForVisiblePosition(endOfSelection, scope);
    157157                doApplyForSingleParagraph(forceCreateList, listTag, currentSelection.get());
    158158                if (endOfSelection.isNull() || endOfSelection.isOrphan() || startOfLastParagraph.isNull() || startOfLastParagraph.isOrphan()) {
    159                     endOfSelection = visiblePositionForIndex(indexForEndOfSelection, scope);
     159                    endOfSelection = visiblePositionForIndex(indexForEndOfSelection, scope.get());
    160160                    // If endOfSelection is null, then some contents have been deleted from the document.
    161161                    // This should never happen and if it did, exit early immediately because we've lost the loop invariant.
  • branches/chromium/963/Source/WebCore/editing/htmlediting.cpp

    r99918 r109365  
    10711071// or these functions need to be changed to iterate using actual VisiblePositions.
    10721072// FIXME: Deploy these functions everywhere that TextIterators are used to convert between VisiblePositions and indices.
    1073 int indexForVisiblePosition(const VisiblePosition& visiblePosition, Element **scope)
     1073int indexForVisiblePosition(const VisiblePosition& visiblePosition, RefPtr<Element>& scope)
    10741074{
    10751075    if (visiblePosition.isNull())
    10761076        return 0;
    1077        
     1077
    10781078    Position p(visiblePosition.deepEquivalent());
    10791079    Document* document = p.anchorNode()->document();
    1080    
    1081     Element* root;
    10821080    Node* shadowRoot = p.anchorNode()->shadowTreeRootNode();
    1083    
     1081
    10841082    if (shadowRoot) {
    10851083        // Use the shadow root for form elements, since TextIterators will not enter shadow content.
    10861084        ASSERT(shadowRoot->isElementNode());
    1087         root = static_cast<Element*>(shadowRoot);
     1085        scope = static_cast<Element*>(shadowRoot);
    10881086    } else
    1089         root = document->documentElement();
    1090    
    1091     if (scope) {
    1092         ASSERT(!*scope);
    1093         *scope = root;
    1094     }
    1095    
    1096     RefPtr<Range> range = Range::create(document, firstPositionInNode(root), p.parentAnchoredEquivalent());
    1097    
     1087        scope = document->documentElement();
     1088
     1089    RefPtr<Range> range = Range::create(document, firstPositionInNode(scope.get()), p.parentAnchoredEquivalent());
     1090
    10981091    return TextIterator::rangeLength(range.get(), true);
    10991092}
  • branches/chromium/963/Source/WebCore/editing/htmlediting.h

    r99918 r109365  
    180180int comparePositions(const VisiblePosition&, const VisiblePosition&);
    181181
    182 int indexForVisiblePosition(const VisiblePosition&, Element **scope);
     182int indexForVisiblePosition(const VisiblePosition&, RefPtr<Element>& scope);
    183183VisiblePosition visiblePositionForIndex(int index, Element *scope);
    184184
Note: See TracChangeset for help on using the changeset viewer.