Title: [183158] trunk/Source
Revision
183158
Author
[email protected]
Date
2015-04-22 19:14:45 -0700 (Wed, 22 Apr 2015)

Log Message

VisibleSelection should only accept Range by reference
https://bugs.webkit.org/show_bug.cgi?id=144047

Reviewed by Tim Horton.

Source/WebCore:

Update VisibleSelection to expect a Range reference argument, rather than a
Range*. Also update all uses of VisibleSelection to pass a reference instead
of a pointer.

No change in behavior, so new tests.

* editing/Editor.cpp:
(WebCore::Editor::selectionForCommand):
(WebCore::Editor::advanceToNextMisspelling):
(WebCore::Editor::markMisspellingsAfterTypingToWord):
(WebCore::Editor::markAndReplaceFor):
(WebCore::Editor::transpose):
(WebCore::Editor::findString):
(WebCore::Editor::rangeOfString):
* editing/FrameSelection.cpp:
(WebCore::FrameSelection::setSelectedRange):
* editing/SpellingCorrectionCommand.cpp:
(WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
* editing/VisibleSelection.cpp:
(WebCore::VisibleSelection::VisibleSelection):
* editing/VisibleSelection.h:
* editing/mac/EditorMac.mm:
(WebCore::Editor::replaceNodeFromPasteboard):
* page/DragController.cpp:
(WebCore::selectElement):
* page/TextIndicator.cpp:
(WebCore::TextIndicator::createWithRange):
* page/mac/EventHandlerMac.mm:
(WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
* rendering/SelectionSubtreeRoot.cpp:
(WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):

Source/WebKit/mac:

Update all uses of VisibleSelection to pass a Range reference instead
of a Range pointer.

* WebCoreSupport/WebContextMenuClient.mm:
(WebContextMenuClient::imageForCurrentSharingServicePickerItem):
* WebView/WebFrame.mm:
(-[WebFrame _selectNSRange:]):

Source/WebKit2:

Update all uses of VisibleSelection to pass a Range reference instead
of a Range pointer.

* WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
(WebKit::InjectedBundleRangeHandle::renderedImage):
* WebProcess/WebPage/FindController.cpp:
(WebKit::FindController::getImageForFindMatch):
(WebKit::FindController::selectFindMatch):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::insertTextAsync):
(WebKit::WebPage::setCompositionAsync):
* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::insertDictatedTextAsync):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (183157 => 183158)


--- trunk/Source/WebCore/ChangeLog	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/ChangeLog	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,3 +1,42 @@
+2015-04-22  Brent Fulgham  <[email protected]>
+
+        VisibleSelection should only accept Range by reference
+        https://bugs.webkit.org/show_bug.cgi?id=144047
+
+        Reviewed by Tim Horton.
+
+        Update VisibleSelection to expect a Range reference argument, rather than a
+        Range*. Also update all uses of VisibleSelection to pass a reference instead
+        of a pointer.
+
+        No change in behavior, so new tests.
+
+        * editing/Editor.cpp:
+        (WebCore::Editor::selectionForCommand):
+        (WebCore::Editor::advanceToNextMisspelling):
+        (WebCore::Editor::markMisspellingsAfterTypingToWord):
+        (WebCore::Editor::markAndReplaceFor):
+        (WebCore::Editor::transpose):
+        (WebCore::Editor::findString):
+        (WebCore::Editor::rangeOfString):
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::setSelectedRange):
+        * editing/SpellingCorrectionCommand.cpp:
+        (WebCore::SpellingCorrectionCommand::SpellingCorrectionCommand):
+        * editing/VisibleSelection.cpp:
+        (WebCore::VisibleSelection::VisibleSelection):
+        * editing/VisibleSelection.h:
+        * editing/mac/EditorMac.mm:
+        (WebCore::Editor::replaceNodeFromPasteboard):
+        * page/DragController.cpp:
+        (WebCore::selectElement):
+        * page/TextIndicator.cpp:
+        (WebCore::TextIndicator::createWithRange):
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::selectClosestWordFromHitTestResultBasedOnLookup):
+        * rendering/SelectionSubtreeRoot.cpp:
+        (WebCore::SelectionSubtreeRoot::adjustForVisibleSelection):
+
 2015-04-22  Roger Fong  <[email protected]>
 
         Audio controls should render with a black background.

Modified: trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm (183157 => 183158)


--- trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/accessibility/ios/WebAccessibilityObjectWrapperIOS.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2008, Apple Inc. All rights reserved.
+ * Copyright (C) 2008, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -2029,7 +2029,7 @@
     if (!range)
         return nil;
     
-    VisibleSelection selection = VisibleSelection(range.get(), DOWNSTREAM);
+    VisibleSelection selection = VisibleSelection(*range, DOWNSTREAM);
 
     VisiblePosition visiblePosition = selection.visibleStart();
     return [WebAccessibilityTextMarker textMarkerWithVisiblePosition:visiblePosition cache:m_object->axObjectCache()];

Modified: trunk/Source/WebCore/editing/Editor.cpp (183157 => 183158)


--- trunk/Source/WebCore/editing/Editor.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/editing/Editor.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2011, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2011, 2013-2015 Apple Inc. All rights reserved.
  * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
  *
  * Redistribution and use in source and binary forms, with or without
@@ -157,7 +157,7 @@
     HTMLTextFormControlElement* textFromControlOfTarget = is<HTMLTextFormControlElement>(*event->target()->toNode()) ? downcast<HTMLTextFormControlElement>(event->target()->toNode()) : nullptr;
     if (textFromControlOfTarget && (selection.start().isNull() || textFromControlOfTarget != textFormControlOfSelectionStart)) {
         if (RefPtr<Range> range = textFromControlOfTarget->selection())
-            return VisibleSelection(range.get(), DOWNSTREAM, selection.isDirectional());
+            return VisibleSelection(*range, DOWNSTREAM, selection.isDirectional());
     }
     return selection;
 }
@@ -2000,7 +2000,7 @@
         
         // FIXME 4859190: This gets confused with doubled punctuation at the end of a paragraph
         RefPtr<Range> badGrammarRange = TextIterator::subrange(grammarSearchRange.get(), grammarPhraseOffset + grammarDetail.location, grammarDetail.length);
-        m_frame.selection().setSelection(VisibleSelection(badGrammarRange.get(), SEL_DEFAULT_AFFINITY));
+        m_frame.selection().setSelection(VisibleSelection(*badGrammarRange, SEL_DEFAULT_AFFINITY));
         m_frame.selection().revealSelection();
         
         client()->updateSpellingUIWithGrammarString(badGrammarPhrase, grammarDetail);
@@ -2012,7 +2012,7 @@
         // a marker so we draw the red squiggle later.
         
         RefPtr<Range> misspellingRange = TextIterator::subrange(spellingSearchRange.get(), misspellingOffset, misspelledWord.length());
-        m_frame.selection().setSelection(VisibleSelection(misspellingRange.get(), DOWNSTREAM));
+        m_frame.selection().setSelection(VisibleSelection(*misspellingRange, DOWNSTREAM));
         m_frame.selection().revealSelection();
         
         client()->updateSpellingUIWithMisspelledWord(misspelledWord);
@@ -2229,7 +2229,7 @@
 
     // If autocorrected word is non empty, replace the misspelled word by this word.
     if (!autocorrectedString.isEmpty()) {
-        VisibleSelection newSelection(misspellingRange.get(), DOWNSTREAM);
+        VisibleSelection newSelection(*misspellingRange, DOWNSTREAM);
         if (newSelection != m_frame.selection().selection()) {
             if (!m_frame.selection().shouldChangeSelection(newSelection))
                 return;
@@ -2517,7 +2517,7 @@
                 continue;
             }
 
-            VisibleSelection selectionToReplace(rangeToReplace.get(), DOWNSTREAM);
+            VisibleSelection selectionToReplace(*rangeToReplace, DOWNSTREAM);
             if (selectionToReplace != m_frame.selection().selection()) {
                 if (!m_frame.selection().shouldChangeSelection(selectionToReplace))
                     continue;
@@ -2800,7 +2800,7 @@
     RefPtr<Range> range = makeRange(previous, next);
     if (!range)
         return;
-    VisibleSelection newSelection(range.get(), DOWNSTREAM);
+    VisibleSelection newSelection(*range, DOWNSTREAM);
 
     // Transpose the two characters.
     String text = plainText(range.get());
@@ -3049,7 +3049,7 @@
     if (!resultRange)
         return false;
 
-    m_frame.selection().setSelection(VisibleSelection(resultRange.get(), DOWNSTREAM));
+    m_frame.selection().setSelection(VisibleSelection(*resultRange, DOWNSTREAM));
 
     if (!(options & DoNotRevealSelection))
         m_frame.selection().revealSelection();
@@ -3099,7 +3099,7 @@
     // If we started in the reference range and the found range exactly matches the reference range, find again.
     // Build a selection with the found range to remove collapsed whitespace.
     // Compare ranges instead of selection objects to ignore the way that the current selection was made.
-    if (startInReferenceRange && areRangesEqual(VisibleSelection(resultRange.get()).toNormalizedRange().get(), referenceRange)) {
+    if (startInReferenceRange && areRangesEqual(VisibleSelection(*resultRange).toNormalizedRange().get(), referenceRange)) {
         searchRange = rangeOfContents(document());
         if (forward)
             searchRange->setStart(referenceRange->endPosition());

Modified: trunk/Source/WebCore/editing/FrameSelection.cpp (183157 => 183158)


--- trunk/Source/WebCore/editing/FrameSelection.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/editing/FrameSelection.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2008, 2009, 2010, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004, 2008, 2009, 2010, 2014-2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1720,7 +1720,7 @@
         return false;
     ASSERT(&range->startContainer()->document() == &range->endContainer()->document());
 
-    VisibleSelection newSelection(range, affinity);
+    VisibleSelection newSelection(*range, affinity);
 
 #if PLATFORM(IOS)
     // FIXME: Why do we need this check only in iOS?
@@ -2169,7 +2169,7 @@
     RefPtr<Range> range = elementRangeContainingCaretSelection();
     if (!range)
         return;
-    VisibleSelection selection(range.get(), DOWNSTREAM);
+    VisibleSelection selection(*range, DOWNSTREAM);
     setSelection(selection);
 }
 
@@ -2387,7 +2387,7 @@
     ASSERT(!ec);
     resultRange->setEnd(node, location + length, ec);
     ASSERT(!ec);
-    VisibleSelection selection = VisibleSelection(resultRange.get(), SEL_DEFAULT_AFFINITY);
+    VisibleSelection selection = VisibleSelection(*resultRange, SEL_DEFAULT_AFFINITY);
     setSelection(selection, true);
 }
 

Modified: trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp (183157 => 183158)


--- trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/editing/SpellingCorrectionCommand.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2011, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -84,7 +84,7 @@
 SpellingCorrectionCommand::SpellingCorrectionCommand(PassRefPtr<Range> rangeToBeCorrected, const String& correction)
     : CompositeEditCommand(rangeToBeCorrected->startContainer()->document())
     , m_rangeToBeCorrected(rangeToBeCorrected)
-    , m_selectionToBeCorrected(m_rangeToBeCorrected.get())
+    , m_selectionToBeCorrected(*m_rangeToBeCorrected)
     , m_correction(correction)
 {
 }

Modified: trunk/Source/WebCore/editing/VisibleSelection.cpp (183157 => 183158)


--- trunk/Source/WebCore/editing/VisibleSelection.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/editing/VisibleSelection.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2005, 2006 Apple Inc.  All rights reserved.
+ * Copyright (C) 2004, 2005, 2006, 2015 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -84,9 +84,9 @@
     validate();
 }
 
-VisibleSelection::VisibleSelection(const Range* range, EAffinity affinity, bool isDirectional)
-    : m_base(range->startPosition())
-    , m_extent(range->endPosition())
+VisibleSelection::VisibleSelection(const Range& range, EAffinity affinity, bool isDirectional)
+    : m_base(range.startPosition())
+    , m_extent(range.endPosition())
     , m_affinity(affinity)
     , m_isDirectional(isDirectional)
 {

Modified: trunk/Source/WebCore/editing/VisibleSelection.h (183157 => 183158)


--- trunk/Source/WebCore/editing/VisibleSelection.h	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/editing/VisibleSelection.h	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004 Apple Inc.  All rights reserved.
+ * Copyright (C) 2004, 2015 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -45,7 +45,7 @@
     VisibleSelection(const Position&, EAffinity, bool isDirectional = false);
     VisibleSelection(const Position&, const Position&, EAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false);
 
-    WEBCORE_EXPORT VisibleSelection(const Range*, EAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false);
+    WEBCORE_EXPORT VisibleSelection(const Range&, EAffinity = SEL_DEFAULT_AFFINITY, bool isDirectional = false);
     
     WEBCORE_EXPORT VisibleSelection(const VisiblePosition&, bool isDirectional = false);
     WEBCORE_EXPORT VisibleSelection(const VisiblePosition&, const VisiblePosition&, bool isDirectional = false);

Modified: trunk/Source/WebCore/editing/mac/EditorMac.mm (183157 => 183158)


--- trunk/Source/WebCore/editing/mac/EditorMac.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/editing/mac/EditorMac.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -273,7 +273,7 @@
         return;
 
     RefPtr<Range> range = Range::create(node->document(), Position(node, Position::PositionIsBeforeAnchor), Position(node, Position::PositionIsAfterAnchor));
-    m_frame.selection().setSelection(VisibleSelection(range.get()), FrameSelection::DoNotSetFocus);
+    m_frame.selection().setSelection(VisibleSelection(*range), FrameSelection::DoNotSetFocus);
 
     Pasteboard pasteboard(pasteboardName);
 

Modified: trunk/Source/WebCore/page/DragController.cpp (183157 => 183158)


--- trunk/Source/WebCore/page/DragController.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/page/DragController.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007, 2009, 2010, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2007, 2009, 2010, 2013, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -706,7 +706,7 @@
 {
     RefPtr<Range> range = element.document().createRange();
     range->selectNode(&element);
-    element.document().frame()->selection().setSelection(VisibleSelection(range.get(), DOWNSTREAM));
+    element.document().frame()->selection().setSelection(VisibleSelection(*range, DOWNSTREAM));
 }
 
 static IntPoint dragLocForDHTMLDrag(const IntPoint& mouseDraggedPoint, const IntPoint& dragOrigin, const IntPoint& dragImageOffset, bool isLinkImage)

Modified: trunk/Source/WebCore/page/TextIndicator.cpp (183157 => 183158)


--- trunk/Source/WebCore/page/TextIndicator.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/page/TextIndicator.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -98,7 +98,7 @@
         return nullptr;
 
     VisibleSelection oldSelection = frame->selection().selection();
-    frame->selection().setSelection(&range);
+    frame->selection().setSelection(range);
 
     RefPtr<TextIndicator> indicator = TextIndicator::createWithSelectionInFrame(*frame, presentationTransition);
 

Modified: trunk/Source/WebCore/page/mac/EventHandlerMac.mm (183157 => 183158)


--- trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/page/mac/EventHandlerMac.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1017,7 +1017,7 @@
 
     NSDictionary *options = nil;
     if (RefPtr<Range> range = rangeForDictionaryLookupAtHitTestResult(result, &options))
-        return VisibleSelection(range.get());
+        return VisibleSelection(*range);
 
     return VisibleSelection();
 }

Modified: trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp (183157 => 183158)


--- trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebCore/rendering/SelectionSubtreeRoot.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,7 +57,7 @@
     Position endPosition = createLegacyEditingPosition(m_selectionSubtreeData.selectionEnd()->node(), m_selectionSubtreeData.selectionEndPos());
 
     RefPtr<Range> range = Range::create(document, startPosition.parentAnchoredEquivalent(), endPosition.parentAnchoredEquivalent());
-    VisibleSelection selection(range.get());
+    VisibleSelection selection(*range);
     Position startPos = selection.start();
     Position candidate = startPos.downstream();
     if (candidate.isCandidate())

Modified: trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm (183157 => 183158)


--- trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit/ios/WebCoreSupport/WebFrameIOS.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -134,7 +134,7 @@
 {
     Frame *frame = [self coreFrame];
     Range *markedTextRange = frame->editor().compositionRange().get();
-    VisibleSelection markedTextRangeSelection = VisibleSelection(markedTextRange);
+    VisibleSelection markedTextRangeSelection = markedTextRange ? VisibleSelection(*markedTextRange) : VisibleSelection();
 
     IntRect result;
 

Modified: trunk/Source/WebKit/mac/ChangeLog (183157 => 183158)


--- trunk/Source/WebKit/mac/ChangeLog	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit/mac/ChangeLog	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,3 +1,18 @@
+2015-04-22  Brent Fulgham  <[email protected]>
+
+        VisibleSelection should only accept Range by reference
+        https://bugs.webkit.org/show_bug.cgi?id=144047
+
+        Reviewed by Tim Horton.
+
+        Update all uses of VisibleSelection to pass a Range reference instead
+        of a Range pointer.
+
+        * WebCoreSupport/WebContextMenuClient.mm:
+        (WebContextMenuClient::imageForCurrentSharingServicePickerItem):
+        * WebView/WebFrame.mm:
+        (-[WebFrame _selectNSRange:]):
+
 2015-04-22  Eric Carlson  <[email protected]>
 
         [Mac] Device picker menu is positioned incorrectly in WK1

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm (183157 => 183158)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebContextMenuClient.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2006, 2007, 2008, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -471,7 +471,7 @@
 
     VisibleSelection oldSelection = frameView->frame().selection().selection();
     RefPtr<Range> range = Range::create(node->document(), Position(node, Position::PositionIsBeforeAnchor), Position(node, Position::PositionIsAfterAnchor));
-    frameView->frame().selection().setSelection(VisibleSelection(range.get()), FrameSelection::DoNotSetFocus);
+    frameView->frame().selection().setSelection(VisibleSelection(*range), FrameSelection::DoNotSetFocus);
 
     PaintBehavior oldPaintBehavior = frameView->paintBehavior();
     frameView->setPaintBehavior(PaintBehaviorSelectionOnly);

Modified: trunk/Source/WebKit/mac/WebView/WebFrame.mm (183157 => 183158)


--- trunk/Source/WebKit/mac/WebView/WebFrame.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit/mac/WebView/WebFrame.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2005, 2006, 2007, 2008, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -1154,7 +1154,7 @@
 {
     RefPtr<Range> domRange = [self _convertToDOMRange:range];
     if (domRange)
-        _private->coreFrame->selection().setSelection(VisibleSelection(domRange.get(), SEL_DEFAULT_AFFINITY));
+        _private->coreFrame->selection().setSelection(VisibleSelection(*domRange, SEL_DEFAULT_AFFINITY));
 }
 
 - (BOOL)_isDisplayingStandaloneImage
@@ -1245,7 +1245,7 @@
 {
     RefPtr<Range> domRange = [self _convertToDOMRange:range];
     if (domRange) {
-        const VisibleSelection& newSelection = VisibleSelection(domRange.get(), SEL_DEFAULT_AFFINITY);
+        const VisibleSelection& newSelection = VisibleSelection(*domRange, SEL_DEFAULT_AFFINITY);
         _private->coreFrame->selection().setSelection(newSelection, 0);
         
         _private->coreFrame->editor().ensureLastEditCommandHasCurrentSelectionIfOpenForMoreTyping();

Modified: trunk/Source/WebKit2/ChangeLog (183157 => 183158)


--- trunk/Source/WebKit2/ChangeLog	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit2/ChangeLog	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,3 +1,24 @@
+2015-04-22  Brent Fulgham  <[email protected]>
+
+        VisibleSelection should only accept Range by reference
+        https://bugs.webkit.org/show_bug.cgi?id=144047
+
+        Reviewed by Tim Horton.
+
+        Update all uses of VisibleSelection to pass a Range reference instead
+        of a Range pointer.
+
+        * WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp:
+        (WebKit::InjectedBundleRangeHandle::renderedImage):
+        * WebProcess/WebPage/FindController.cpp:
+        (WebKit::FindController::getImageForFindMatch):
+        (WebKit::FindController::selectFindMatch):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::insertTextAsync):
+        (WebKit::WebPage::setCompositionAsync):
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::insertDictatedTextAsync):
+
 2015-04-22  Anders Carlsson  <[email protected]>
 
         Add WK_ARRAY and WK_SET annotations

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp (183157 => 183158)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/DOM/InjectedBundleRangeHandle.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -114,7 +114,7 @@
         return nullptr;
 
     VisibleSelection oldSelection = frame->selection().selection();
-    frame->selection().setSelection(VisibleSelection(m_range.get()));
+    frame->selection().setSelection(VisibleSelection(*m_range));
 
     float scaleFactor = (options & SnapshotOptionsExcludeDeviceScaleFactor) ? 1 : frame->page()->deviceScaleFactor();
     IntRect paintRect = enclosingIntRect(m_range->boundingRect());

Modified: trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp (183157 => 183158)


--- trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit2/WebProcess/WebPage/FindController.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010, 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -270,7 +270,7 @@
         return;
 
     VisibleSelection oldSelection = frame->selection().selection();
-    frame->selection().setSelection(VisibleSelection(m_findMatches[matchIndex].get()));
+    frame->selection().setSelection(VisibleSelection(*m_findMatches[matchIndex]));
 
     RefPtr<ShareableBitmap> selectionSnapshot = WebFrame::fromCoreFrame(*frame)->createSelectionSnapshot();
 
@@ -295,7 +295,7 @@
     Frame* frame = m_findMatches[matchIndex]->startContainer()->document().frame();
     if (!frame)
         return;
-    frame->selection().setSelection(VisibleSelection(m_findMatches[matchIndex].get()));
+    frame->selection().setSelection(VisibleSelection(*m_findMatches[matchIndex]));
 }
 
 void FindController::hideFindUI()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (183157 => 183158)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2015-04-23 02:14:45 UTC (rev 183158)
@@ -4211,7 +4211,7 @@
     if (replacementEditingRange.location != notFound) {
         RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
         if (replacementRange)
-            frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+            frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
     }
     
     if (registerUndoGroup)
@@ -4301,7 +4301,8 @@
         RefPtr<Range> replacementRange;
         if (replacementEditingRange.location != notFound) {
             replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
-            frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+            if (replacementRange)
+                frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
         }
 
         frame.editor().setComposition(text, underlines, selection.location, selection.location + selection.length);
@@ -4359,7 +4360,7 @@
     ASSERT_WITH_MESSAGE(selectionRange, "Invalid selection: [%lld:%lld] in text of length %d", static_cast<long long>(selectionStart), static_cast<long long>(selectionLength), scope->innerText().length());
 
     if (selectionRange) {
-        VisibleSelection selection(selectionRange.get(), SEL_DEFAULT_AFFINITY);
+        VisibleSelection selection(*selectionRange, SEL_DEFAULT_AFFINITY);
         targetFrame->selection().setSelection(selection);
     }
     send(Messages::WebPageProxy::EditorStateChanged(editorState()));
@@ -4380,7 +4381,7 @@
         Element* scope = targetFrame->selection().selection().rootEditableElement();
         RefPtr<Range> replacementRange = TextIterator::rangeFromLocationAndLength(scope, replacementStart, replacementLength);
         targetFrame->editor().setIgnoreCompositionSelectionChange(true);
-        targetFrame->selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+        targetFrame->selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
         targetFrame->editor().setIgnoreCompositionSelectionChange(false);
     }
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm (183157 => 183158)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2015-04-23 02:12:44 UTC (rev 183157)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm	2015-04-23 02:14:45 UTC (rev 183158)
@@ -284,7 +284,8 @@
         RefPtr<Range> replacementRange;
         if (replacementEditingRange.location != notFound) {
             replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
-            frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+            if (replacementRange)
+                frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
         }
 
         frame.editor().setComposition(text, underlines, selectionRange.location, selectionRange.location + selectionRange.length);
@@ -307,7 +308,7 @@
     if (replacementEditingRange.location != notFound) {
         RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
         if (replacementRange)
-            frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+            frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
     }
 
     if (!frame.editor().hasComposition()) {
@@ -329,7 +330,7 @@
     if (replacementEditingRange.location != notFound) {
         RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
         if (replacementRange)
-            frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+            frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
     }
 
     ASSERT(!frame.editor().hasComposition());
@@ -444,7 +445,7 @@
     if (replacementEditingRange.location != notFound) {
         RefPtr<Range> replacementRange = rangeFromEditingRange(frame, replacementEditingRange);
         if (replacementRange)
-            frame.selection().setSelection(VisibleSelection(replacementRange.get(), SEL_DEFAULT_AFFINITY));
+            frame.selection().setSelection(VisibleSelection(*replacementRange, SEL_DEFAULT_AFFINITY));
     }
 
     if (registerUndoGroup)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to