Cleanup: Use exceptionless Range::* methods rather than ignoring exceptions.
authormkwst@chromium.org <mkwst@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 10:13:50 +0000 (10:13 +0000)
committermkwst@chromium.org <mkwst@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Feb 2013 10:13:50 +0000 (10:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108773

Reviewed by Darin Adler.

We often call Range::{start,end}{Container,Offset} with an ExceptionCode
that's completely ignored. In these cases, we should simply use the
exceptionless version of the method instead.

* dom/DocumentMarkerController.cpp:
(WebCore::DocumentMarkerController::addMarker):
    Here, I also moved parameters onto one line to make the
    stylebot happy.
(WebCore::DocumentMarkerController::addTextMatchMarker):
(WebCore::DocumentMarkerController::setMarkersActive):
    Dropped ignored ExceptionCode variable entirely.
* accessibility/AccessibilityRenderObject.cpp:
(WebCore::AccessibilityRenderObject::visiblePositionForIndex):
    Can't drop the variable because of the selectNodeContents call.
* editing/Editor.cpp:
(WebCore::Editor::canDeleteRange):
    Dropped ignored ExceptionCode variable entirely.
(WebCore::Editor::advanceToNextMisspelling):
    Can't drop the variable because of setStart/setEnd.
* editing/EditorCommand.cpp:
(WebCore::unionDOMRanges):
    Can't drop the variable because of compareBoundaryPoints.
* editing/MarkupAccumulator.cpp:
(WebCore::MarkupAccumulator::appendNodeValue):
    Dropped ignored ExceptionCode variable entirely.
* editing/TextCheckingHelper.cpp:
(WebCore::TextCheckingParagraph::offsetAsRange):
(WebCore::TextCheckingHelper::findFirstMisspelling):
(WebCore::TextCheckingHelper::findFirstGrammarDetail):
(WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
* editing/markup.cpp:
(WebCore::StyledMarkupAccumulator::renderedText):
(WebCore::StyledMarkupAccumulator::stringValueForRange):
    Dropped ignored ExceptionCode variable entirely.
* editing/visible_units.cpp:
(WebCore::previousBoundary):
    Can't drop the variable due to many other calls.
* page/DOMSelection.cpp:
(WebCore::DOMSelection::deleteFromDocument):
(WebCore::DOMSelection::containsNode):
    For both these cases, the 'ASSERT(!ec)' after the statement I've
    edited only checked the last occurance of the exception: that is,
    if 'startXxx(ec)' threw an exception, it would be overwritten by
    the 'setBaseAndExtend()' or 'compareBoundaryPoints()' exception.
    Removing the exception parameters from the parameters' calls
    shouldn't effect behavior.
* platform/chromium/PasteboardChromium.cpp:
(WebCore::Pasteboard::writeSelection):
* platform/mac/HTMLConverter.mm:
(+[WebHTMLConverter editingAttributedStringFromRange:]):
* platform/win/ClipboardWin.cpp:
(WebCore::ClipboardWin::writeRange):
* platform/win/PasteboardWin.cpp:
(WebCore::Pasteboard::writeSelection):
* platform/wince/PasteboardWinCE.cpp:
(WebCore::Pasteboard::writeSelection):
    Dropped ignored ExceptionCode variable entirely.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141877 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/accessibility/AccessibilityRenderObject.cpp
Source/WebCore/dom/DocumentMarkerController.cpp
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/EditorCommand.cpp
Source/WebCore/editing/MarkupAccumulator.cpp
Source/WebCore/editing/TextCheckingHelper.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/editing/visible_units.cpp
Source/WebCore/page/DOMSelection.cpp
Source/WebCore/platform/chromium/PasteboardChromium.cpp
Source/WebCore/platform/mac/HTMLConverter.mm
Source/WebCore/platform/win/ClipboardWin.cpp
Source/WebCore/platform/win/PasteboardWin.cpp
Source/WebCore/platform/wince/PasteboardWinCE.cpp

index f941648..a146afd 100644 (file)
@@ -1,3 +1,68 @@
+2013-02-05  Mike West  <mkwst@chromium.org>
+
+        Cleanup: Use exceptionless Range::* methods rather than ignoring exceptions.
+        https://bugs.webkit.org/show_bug.cgi?id=108773
+
+        Reviewed by Darin Adler.
+
+        We often call Range::{start,end}{Container,Offset} with an ExceptionCode
+        that's completely ignored. In these cases, we should simply use the
+        exceptionless version of the method instead.
+
+        * dom/DocumentMarkerController.cpp:
+        (WebCore::DocumentMarkerController::addMarker):
+            Here, I also moved parameters onto one line to make the
+            stylebot happy.
+        (WebCore::DocumentMarkerController::addTextMatchMarker):
+        (WebCore::DocumentMarkerController::setMarkersActive):
+            Dropped ignored ExceptionCode variable entirely.
+        * accessibility/AccessibilityRenderObject.cpp:
+        (WebCore::AccessibilityRenderObject::visiblePositionForIndex):
+            Can't drop the variable because of the selectNodeContents call.
+        * editing/Editor.cpp:
+        (WebCore::Editor::canDeleteRange):
+            Dropped ignored ExceptionCode variable entirely.
+        (WebCore::Editor::advanceToNextMisspelling):
+            Can't drop the variable because of setStart/setEnd.
+        * editing/EditorCommand.cpp:
+        (WebCore::unionDOMRanges):
+            Can't drop the variable because of compareBoundaryPoints.
+        * editing/MarkupAccumulator.cpp:
+        (WebCore::MarkupAccumulator::appendNodeValue):
+            Dropped ignored ExceptionCode variable entirely.
+        * editing/TextCheckingHelper.cpp:
+        (WebCore::TextCheckingParagraph::offsetAsRange):
+        (WebCore::TextCheckingHelper::findFirstMisspelling):
+        (WebCore::TextCheckingHelper::findFirstGrammarDetail):
+        (WebCore::TextCheckingHelper::findFirstMisspellingOrBadGrammar):
+        * editing/markup.cpp:
+        (WebCore::StyledMarkupAccumulator::renderedText):
+        (WebCore::StyledMarkupAccumulator::stringValueForRange):
+            Dropped ignored ExceptionCode variable entirely.
+        * editing/visible_units.cpp:
+        (WebCore::previousBoundary):
+            Can't drop the variable due to many other calls.
+        * page/DOMSelection.cpp:
+        (WebCore::DOMSelection::deleteFromDocument):
+        (WebCore::DOMSelection::containsNode):
+            For both these cases, the 'ASSERT(!ec)' after the statement I've
+            edited only checked the last occurance of the exception: that is,
+            if 'startXxx(ec)' threw an exception, it would be overwritten by
+            the 'setBaseAndExtend()' or 'compareBoundaryPoints()' exception.
+            Removing the exception parameters from the parameters' calls
+            shouldn't effect behavior.
+        * platform/chromium/PasteboardChromium.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        * platform/mac/HTMLConverter.mm:
+        (+[WebHTMLConverter editingAttributedStringFromRange:]):
+        * platform/win/ClipboardWin.cpp:
+        (WebCore::ClipboardWin::writeRange):
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        * platform/wince/PasteboardWinCE.cpp:
+        (WebCore::Pasteboard::writeSelection):
+            Dropped ignored ExceptionCode variable entirely.
+
 2013-02-05  Yury Semikhatsky  <yurys@chromium.org>
 
         Web Inspector:  introduce Memory.getDOMCounters
index 4842753..19e963f 100644 (file)
@@ -1869,7 +1869,7 @@ VisiblePosition AccessibilityRenderObject::visiblePositionForIndex(int index) co
     range->selectNodeContents(node, ec);
     CharacterIterator it(range.get());
     it.advance(index - 1);
-    return VisiblePosition(Position(it.range()->endContainer(ec), it.range()->endOffset(ec), Position::PositionIsOffsetInAnchor), UPSTREAM);
+    return VisiblePosition(Position(it.range()->endContainer(), it.range()->endOffset(), Position::PositionIsOffsetInAnchor), UPSTREAM);
 }
     
 int AccessibilityRenderObject::indexForVisiblePosition(const VisiblePosition& pos) const
index b77d051..126c179 100644 (file)
@@ -64,9 +64,7 @@ void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerTyp
     // Use a TextIterator to visit the potentially multiple nodes the range covers.
     for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        int exception = 0;
-        addMarker(textPiece->startContainer(exception),
-                  DocumentMarker(type, textPiece->startOffset(exception), textPiece->endOffset(exception), description));
+        addMarker(textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset(), description));
     }
 }
 
@@ -75,9 +73,7 @@ void DocumentMarkerController::addMarker(Range* range, DocumentMarker::MarkerTyp
     // Use a TextIterator to visit the potentially multiple nodes the range covers.
     for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        int exception = 0;
-        addMarker(textPiece->startContainer(exception),
-                  DocumentMarker(type, textPiece->startOffset(exception), textPiece->endOffset(exception)));
+        addMarker(textPiece->startContainer(), DocumentMarker(type, textPiece->startOffset(), textPiece->endOffset()));
     }
 
 }
@@ -98,16 +94,15 @@ void DocumentMarkerController::addTextMatchMarker(const Range* range, bool activ
     // Use a TextIterator to visit the potentially multiple nodes the range covers.
     for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
         RefPtr<Range> textPiece = markedText.range();
-        int exception = 0;
-        unsigned startOffset = textPiece->startOffset(exception);
-        unsigned endOffset = textPiece->endOffset(exception);
-        addMarker(textPiece->startContainer(exception), DocumentMarker(startOffset, endOffset, activeMatch));
+        unsigned startOffset = textPiece->startOffset();
+        unsigned endOffset = textPiece->endOffset();
+        addMarker(textPiece->startContainer(), DocumentMarker(startOffset, endOffset, activeMatch));
         if (endOffset > startOffset) {
             // Rendered rects for markers in WebKit are not populated until each time
             // the markers are painted. However, we need it to happen sooner, because
             // the whole purpose of tickmarks on the scrollbar is to show where
             // matches off-screen are (that haven't been painted yet).
-            Node* node = textPiece->startContainer(exception);
+            Node* node = textPiece->startContainer();
             Vector<DocumentMarker*> markers = markersFor(node);
             static_cast<RenderedDocumentMarker*>(markers[markers.size() - 1])->setRenderedRect(range->boundingBox());
         }
@@ -567,14 +562,14 @@ void DocumentMarkerController::setMarkersActive(Range* range, bool active)
         return;
     ASSERT(!m_markers.isEmpty());
 
-    ExceptionCode ec = 0;
-    Node* startContainer = range->startContainer(ec);
-    Node* endContainer = range->endContainer(ec);
+    Node* startContainer = range->startContainer();
+    Node* endContainer = range->endContainer();
 
     Node* pastLastNode = range->pastLastNode();
+
     for (Node* node = range->firstNode(); node != pastLastNode; node = NodeTraversal::next(node)) {
-        int startOffset = node == startContainer ? range->startOffset(ec) : 0;
-        int endOffset = node == endContainer ? range->endOffset(ec) : INT_MAX;
+        int startOffset = node == startContainer ? range->startOffset() : 0;
+        int endOffset = node == endContainer ? range->endOffset() : INT_MAX;
         setMarkersActive(node, startOffset, endOffset, active);
     }
 }
index ba6f60f..4d6f71f 100644 (file)
@@ -254,15 +254,15 @@ bool Editor::canDelete() const
 
 bool Editor::canDeleteRange(Range* range) const
 {
-    ExceptionCode ec = 0;
-    Node* startContainer = range->startContainer(ec);
-    Node* endContainer = range->endContainer(ec);
+    Node* startContainer = range->startContainer();
+    Node* endContainer = range->endContainer();
     if (!startContainer || !endContainer)
         return false;
     
     if (!startContainer->rendererIsEditable() || !endContainer->rendererIsEditable())
         return false;
-    
+
+    ExceptionCode ec;
     if (range->collapsed(ec)) {
         VisiblePosition start(range->startPosition(), DOWNSTREAM);
         VisiblePosition previous = start.previous();
@@ -1584,7 +1584,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
             setStart(spellingSearchRange.get(), endOfWord(oneBeforeStart));
         // else we were already at the start of the editable node
     }
-    
+
     if (spellingSearchRange->collapsed(ec))
         return; // nothing to search in
     
@@ -1595,8 +1595,8 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
     // We go to the end of our first range instead of the start of it, just to be sure
     // we don't get foiled by any word boundary problems at the start.  It means we might
     // do a tiny bit more searching.
-    Node* searchEndNodeAfterWrap = spellingSearchRange->endContainer(ec);
-    int searchEndOffsetAfterWrap = spellingSearchRange->endOffset(ec);
+    Node* searchEndNodeAfterWrap = spellingSearchRange->endContainer();
+    int searchEndOffsetAfterWrap = spellingSearchRange->endOffset();
     
     int misspellingOffset = 0;
     GrammarDetail grammarDetail;
@@ -1628,7 +1628,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
             // Stop looking at start of next misspelled word
             CharacterIterator chars(grammarSearchRange.get());
             chars.advance(misspellingOffset);
-            grammarSearchRange->setEnd(chars.range()->startContainer(ec), chars.range()->startOffset(ec), ec);
+            grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), ec);
         }
     
         if (isGrammarCheckingEnabled())
@@ -1662,7 +1662,7 @@ void Editor::advanceToNextMisspelling(bool startBeforeSelection)
                 // Stop looking at start of next misspelled word
                 CharacterIterator chars(grammarSearchRange.get());
                 chars.advance(misspellingOffset);
-                grammarSearchRange->setEnd(chars.range()->startContainer(ec), chars.range()->startOffset(ec), ec);
+                grammarSearchRange->setEnd(chars.range()->startContainer(), chars.range()->startOffset(), ec);
             }
 
             if (isGrammarCheckingEnabled())
index 30369b4..4733249 100644 (file)
@@ -272,7 +272,7 @@ static RefPtr<Range> unionDOMRanges(Range* a, Range* b)
     Range* end = a->compareBoundaryPoints(Range::END_TO_END, b, ec) <= 0 ? b : a;
     ASSERT(!ec);
 
-    return Range::create(a->startContainer(ec)->ownerDocument(), start->startContainer(ec), start->startOffset(ec), end->endContainer(ec), end->endOffset(ec));
+    return Range::create(a->ownerDocument(), start->startContainer(), start->startOffset(), end->endContainer(), end->endOffset());
 }
 
 // Execute command functions
index c34e548..e3abb95 100644 (file)
@@ -245,11 +245,10 @@ void MarkupAccumulator::appendNodeValue(StringBuilder& result, const Node* node,
     unsigned start = 0;
 
     if (range) {
-        ExceptionCode ec;
-        if (node == range->endContainer(ec))
-            length = range->endOffset(ec);
-        if (node == range->startContainer(ec)) {
-            start = range->startOffset(ec);
+        if (node == range->endContainer())
+            length = range->endOffset();
+        if (node == range->startContainer()) {
+            start = range->startOffset();
             length -= start;
         }
     }
index d553830..cd723b9 100644 (file)
@@ -183,10 +183,8 @@ bool TextCheckingParagraph::isEmpty() const
 PassRefPtr<Range> TextCheckingParagraph::offsetAsRange() const
 {
     ASSERT(m_checkingRange);
-    if (!m_offsetAsRange) {
-        ExceptionCode ec = 0;
-        m_offsetAsRange = Range::create(paragraphRange()->startContainer(ec)->document(), paragraphRange()->startPosition(), checkingRange()->startPosition());
-    }
+    if (!m_offsetAsRange)
+        m_offsetAsRange = Range::create(paragraphRange()->startContainer()->document(), paragraphRange()->startPosition(), checkingRange()->startPosition());
 
     return m_offsetAsRange;
 }
@@ -277,9 +275,7 @@ String TextCheckingHelper::findFirstMisspelling(int& firstMisspellingOffset, boo
                 }
 
                 // Store marker for misspelled word.
-                ExceptionCode ec = 0;
-                misspellingRange->startContainer(ec)->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
-                ASSERT(!ec);
+                misspellingRange->startContainer()->document()->markers()->addMarker(misspellingRange.get(), DocumentMarker::Spelling);
 
                 // Bail out if we're marking only the first misspelling, and not all instances.
                 if (!markAll)
@@ -320,7 +316,7 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
     int totalRangeLength = TextIterator::rangeLength(paragraphRange.get());
     setEnd(paragraphRange.get(), endOfParagraph(m_range->startPosition()));
     
-    RefPtr<Range> offsetAsRange = Range::create(paragraphRange->startContainer(ec)->document(), paragraphRange->startPosition(), m_range->startPosition());
+    RefPtr<Range> offsetAsRange = Range::create(paragraphRange->startContainer()->document(), paragraphRange->startPosition(), m_range->startPosition());
     int rangeStartOffset = TextIterator::rangeLength(offsetAsRange.get());
     int totalLengthProcessed = 0;
     
@@ -334,7 +330,7 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
         if (inSameParagraph(paragraphRange->startPosition(), m_range->endPosition())) {
             // Determine the character offset from the end of the original search range to the end of the paragraph,
             // since we will want to ignore results in this area.
-            RefPtr<Range> endOffsetAsRange = Range::create(paragraphRange->startContainer(ec)->document(), paragraphRange->startPosition(), m_range->endPosition());
+            RefPtr<Range> endOffsetAsRange = Range::create(paragraphRange->startContainer()->document(), paragraphRange->startPosition(), m_range->endPosition());
             currentEndOffset = TextIterator::rangeLength(endOffsetAsRange.get());
             lastIteration = true;
         }
@@ -387,7 +383,7 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
                 if (!misspelledWord.isEmpty() && (!checkGrammar || badGrammarPhrase.isEmpty() || spellingLocation <= grammarDetailLocation)) {
                     int spellingOffset = spellingLocation - currentStartOffset;
                     if (!firstIteration) {
-                        RefPtr<Range> paragraphOffsetAsRange = Range::create(paragraphRange->startContainer(ec)->document(), m_range->startPosition(), paragraphRange->startPosition());
+                        RefPtr<Range> paragraphOffsetAsRange = Range::create(paragraphRange->startContainer()->document(), m_range->startPosition(), paragraphRange->startPosition());
                         spellingOffset += TextIterator::rangeLength(paragraphOffsetAsRange.get());
                     }
                     outIsSpelling = true;
@@ -398,7 +394,7 @@ String TextCheckingHelper::findFirstMisspellingOrBadGrammar(bool checkGrammar, b
                 if (checkGrammar && !badGrammarPhrase.isEmpty()) {
                     int grammarPhraseOffset = grammarPhraseLocation - currentStartOffset;
                     if (!firstIteration) {
-                        RefPtr<Range> paragraphOffsetAsRange = Range::create(paragraphRange->startContainer(ec)->document(), m_range->startPosition(), paragraphRange->startPosition());
+                        RefPtr<Range> paragraphOffsetAsRange = Range::create(paragraphRange->startContainer()->document(), m_range->startPosition(), paragraphRange->startPosition());
                         grammarPhraseOffset += TextIterator::rangeLength(paragraphOffsetAsRange.get());
                     }
                     outIsSpelling = false;
@@ -442,9 +438,7 @@ int TextCheckingHelper::findFirstGrammarDetail(const Vector<GrammarDetail>& gram
         
         if (markAll) {
             RefPtr<Range> badGrammarRange = TextIterator::subrange(m_range.get(), badGrammarPhraseLocation - startOffset + detail->location, detail->length);
-            ExceptionCode ec = 0;
-            badGrammarRange->startContainer(ec)->document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription);
-            ASSERT(!ec);
+            badGrammarRange->startContainer()->document()->markers()->addMarker(badGrammarRange.get(), DocumentMarker::Grammar, detail->userDescription);
         }
         
         // Remember this detail only if it's earlier than our current candidate (the details aren't in a guaranteed order)
index 46b943b..12fbcda 100644 (file)
@@ -254,15 +254,14 @@ String StyledMarkupAccumulator::renderedText(const Node* node, const Range* rang
     if (!node->isTextNode())
         return String();
 
-    ExceptionCode ec;
     const Text* textNode = static_cast<const Text*>(node);
     unsigned startOffset = 0;
     unsigned endOffset = textNode->length();
 
-    if (range && node == range->startContainer(ec))
-        startOffset = range->startOffset(ec);
-    if (range && node == range->endContainer(ec))
-        endOffset = range->endOffset(ec);
+    if (range && node == range->startContainer())
+        startOffset = range->startOffset();
+    if (range && node == range->endContainer())
+        endOffset = range->endOffset();
 
     Position start = createLegacyEditingPosition(const_cast<Node*>(node), startOffset);
     Position end = createLegacyEditingPosition(const_cast<Node*>(node), endOffset);
@@ -275,11 +274,10 @@ String StyledMarkupAccumulator::stringValueForRange(const Node* node, const Rang
         return node->nodeValue();
 
     String str = node->nodeValue();
-    ExceptionCode ec;
-    if (node == range->endContainer(ec))
-        str.truncate(range->endOffset(ec));
-    if (node == range->startContainer(ec))
-        str.remove(0, range->startOffset(ec));
+    if (node == range->endContainer())
+        str.truncate(range->endOffset());
+    if (node == range->startContainer())
+        str.remove(0, range->startOffset());
     return str;
 }
 
index 673334d..42e70f7 100644 (file)
@@ -513,7 +513,7 @@ static VisiblePosition previousBoundary(const VisiblePosition& c, BoundarySearch
     if (!next)
         return VisiblePosition(it.atEnd() ? it.range()->startPosition() : pos, DOWNSTREAM);
 
-    Node* node = it.range()->startContainer(ec);
+    Node* node = it.range()->startContainer();
     if ((node->isTextNode() && static_cast<int>(next) <= node->maxCharacterOffset()) || (node->renderer() && node->renderer()->isBR() && !next))
         // The next variable contains a usable index into a text node
         return VisiblePosition(createLegacyEditingPosition(node, next), DOWNSTREAM);
index 062443a..e2d771a 100644 (file)
@@ -442,7 +442,7 @@ void DOMSelection::deleteFromDocument()
     selectedRange->deleteContents(ec);
     ASSERT(!ec);
 
-    setBaseAndExtent(selectedRange->startContainer(ec), selectedRange->startOffset(ec), selectedRange->startContainer(ec), selectedRange->startOffset(ec), ec);
+    setBaseAndExtent(selectedRange->startContainer(ec), selectedRange->startOffset(), selectedRange->startContainer(), selectedRange->startOffset(), ec);
     ASSERT(!ec);
 }
 
@@ -464,14 +464,14 @@ bool DOMSelection::containsNode(const Node* n, bool allowPartial) const
         return false;
 
     ExceptionCode ec = 0;
-    bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(ec), selectedRange->startOffset(ec), ec) >= 0 && !ec
-        && Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->endContainer(ec), selectedRange->endOffset(ec), ec) <= 0 && !ec;
+    bool nodeFullySelected = Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->startContainer(), selectedRange->startOffset(), ec) >= 0 && !ec
+        && Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->endContainer(), selectedRange->endOffset(), ec) <= 0 && !ec;
     ASSERT(!ec);
     if (nodeFullySelected)
         return true;
 
-    bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->endContainer(ec), selectedRange->endOffset(ec), ec) > 0 && !ec)
-        || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->startContainer(ec), selectedRange->startOffset(ec), ec) < 0 && !ec);
+    bool nodeFullyUnselected = (Range::compareBoundaryPoints(parentNode, nodeIndex, selectedRange->endContainer(), selectedRange->endOffset(), ec) > 0 && !ec)
+        || (Range::compareBoundaryPoints(parentNode, nodeIndex + 1, selectedRange->startContainer(), selectedRange->startOffset(), ec) < 0 && !ec);
     ASSERT(!ec);
     if (nodeFullyUnselected)
         return false;
index 3a2068a..a7f3635 100644 (file)
@@ -87,8 +87,7 @@ void Pasteboard::setSelectionMode(bool selectionMode)
 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
 {
     String html = createMarkup(selectedRange, 0, AnnotateForInterchange, false, ResolveNonLocalURLs);
-    ExceptionCode ec = 0;
-    KURL url = selectedRange->startContainer(ec)->document()->url();
+    KURL url = selectedRange->startContainer()->document()->url();
     String plainText = frame->editor()->selectedText();
 #if OS(WINDOWS)
     replaceNewlinesWithWindowsStyleNewlines(plainText);
index 2193b0d..7590f88 100644 (file)
@@ -1674,11 +1674,10 @@ static NSInteger _colCompare(id block1, id block2, void *)
 
     for (TextIterator it(range); !it.atEnd(); it.advance()) {
         RefPtr<Range> currentTextRange = it.range();
-        ExceptionCode ec = 0;
-        Node* startContainer = currentTextRange->startContainer(ec);
-        Node* endContainer = currentTextRange->endContainer(ec);
-        int startOffset = currentTextRange->startOffset(ec);
-        int endOffset = currentTextRange->endOffset(ec);
+        Node* startContainer = currentTextRange->startContainer();
+        Node* endContainer = currentTextRange->endContainer();
+        int startOffset = currentTextRange->startOffset();
+        int endOffset = currentTextRange->endOffset();
         
         if (startContainer == endContainer && (startOffset == endOffset - 1)) {
             Node* node = startContainer->childNode(startOffset);
index ef5bb30..c2f9964 100644 (file)
@@ -739,11 +739,10 @@ void ClipboardWin::writeRange(Range* selectedRange, Frame* frame)
 
     STGMEDIUM medium = {0};
     medium.tymed = TYMED_HGLOBAL;
-    ExceptionCode ec = 0;
 
     Vector<char> data;
     markupToCFHTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
-        selectedRange->startContainer(ec)->document()->url().string(), data);
+        selectedRange->startContainer()->document()->url().string(), data);
     medium.hGlobal = createGlobalData(data);
     if (medium.hGlobal && FAILED(m_writableDataObject->SetData(htmlFormat(), &medium, TRUE)))
         ::GlobalFree(medium.hGlobal);
index f9fe00d..1bd579f 100644 (file)
@@ -118,10 +118,9 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
 
     // Put CF_HTML format on the pasteboard 
     if (::OpenClipboard(m_owner)) {
-        ExceptionCode ec = 0;
         Vector<char> data;
         markupToCFHTML(createMarkup(selectedRange, 0, AnnotateForInterchange),
-            selectedRange->startContainer(ec)->document()->url().string(), data);
+            selectedRange->startContainer()->document()->url().string(), data);
         HGLOBAL cbData = createGlobalData(data);
         if (!::SetClipboardData(HTMLClipboardFormat, cbData))
             ::GlobalFree(cbData);
index cc8d18e..5ef3d2b 100644 (file)
@@ -115,9 +115,8 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
 
     // Put CF_HTML format on the pasteboard
     if (::OpenClipboard(m_owner)) {
-        ExceptionCode ec = 0;
         Vector<char> data;
-        markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer(ec)->document()->url(), data);
+        markupToCF_HTML(createMarkup(selectedRange, 0, AnnotateForInterchange), selectedRange->startContainer()->document()->url(), data);
         HGLOBAL cbData = createGlobalData(data);
         if (!::SetClipboardData(HTMLClipboardFormat, cbData))
             ::GlobalFree(cbData);