| Index: third_party/WebKit/Source/core/editing/Editor.cpp
 | 
| diff --git a/third_party/WebKit/Source/core/editing/Editor.cpp b/third_party/WebKit/Source/core/editing/Editor.cpp
 | 
| index 6442a0edea0c8b807bd04a65aa84be8f16b92fee..d91cc9a407494c2a135ba2927e428f2043485bca 100644
 | 
| --- a/third_party/WebKit/Source/core/editing/Editor.cpp
 | 
| +++ b/third_party/WebKit/Source/core/editing/Editor.cpp
 | 
| @@ -122,7 +122,7 @@ VisibleSelection Editor::selectionForCommand(Event* event)
 | 
|      HTMLTextFormControlElement* textFormControlOfSelectionStart = enclosingTextFormControl(selection.start());
 | 
|      HTMLTextFormControlElement* textFromControlOfTarget = isHTMLTextFormControlElement(*event->target()->toNode()) ? toHTMLTextFormControlElement(event->target()->toNode()) : 0;
 | 
|      if (textFromControlOfTarget && (selection.start().isNull() || textFromControlOfTarget != textFormControlOfSelectionStart)) {
 | 
| -        if (RefPtrWillBeRawPtr<Range> range = textFromControlOfTarget->selection())
 | 
| +        if (RawPtr<Range> range = textFromControlOfTarget->selection())
 | 
|              return VisibleSelection(EphemeralRange(range.get()), TextAffinity::Downstream, selection.isDirectional());
 | 
|      }
 | 
|      return selection;
 | 
| @@ -353,7 +353,7 @@ void Editor::pasteAsPlainText(const String& pastingText, bool smartReplace)
 | 
|      target->dispatchEvent(TextEvent::createForPlainTextPaste(frame().domWindow(), pastingText, smartReplace));
 | 
|  }
 | 
|  
 | 
| -void Editor::pasteAsFragment(PassRefPtrWillBeRawPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
 | 
| +void Editor::pasteAsFragment(RawPtr<DocumentFragment> pastingFragment, bool smartReplace, bool matchStyle)
 | 
|  {
 | 
|      Element* target = findEventTargetFromSelection();
 | 
|      if (!target)
 | 
| @@ -390,7 +390,7 @@ void Editor::pasteAsPlainTextWithPasteboard(Pasteboard* pasteboard)
 | 
|  
 | 
|  void Editor::pasteWithPasteboard(Pasteboard* pasteboard)
 | 
|  {
 | 
| -    RefPtrWillBeRawPtr<DocumentFragment> fragment = nullptr;
 | 
| +    RawPtr<DocumentFragment> fragment = nullptr;
 | 
|      bool chosePlainText = false;
 | 
|  
 | 
|      if (pasteboard->isHTMLAvailable()) {
 | 
| @@ -485,7 +485,7 @@ bool Editor::dispatchCPPEvent(const AtomicString& eventType, DataTransferAccessP
 | 
|              ? DataObject::create()
 | 
|              : DataObject::createFromPasteboard(pasteMode));
 | 
|  
 | 
| -    RefPtrWillBeRawPtr<Event> evt = ClipboardEvent::create(eventType, true, true, dataTransfer);
 | 
| +    RawPtr<Event> evt = ClipboardEvent::create(eventType, true, true, dataTransfer);
 | 
|      target->dispatchEvent(evt);
 | 
|      bool noDefaultProcessing = evt->defaultPrevented();
 | 
|      if (noDefaultProcessing && policy == DataTransferWritable)
 | 
| @@ -502,7 +502,7 @@ bool Editor::canSmartReplaceWithPasteboard(Pasteboard* pasteboard)
 | 
|      return smartInsertDeleteEnabled() && pasteboard->canSmartReplace();
 | 
|  }
 | 
|  
 | 
| -void Editor::replaceSelectionWithFragment(PassRefPtrWillBeRawPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle)
 | 
| +void Editor::replaceSelectionWithFragment(RawPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle)
 | 
|  {
 | 
|      if (frame().selection().isNone() || !frame().selection().isContentEditable() || !fragment)
 | 
|          return;
 | 
| @@ -525,7 +525,7 @@ void Editor::replaceSelectionWithText(const String& text, bool selectReplacement
 | 
|  }
 | 
|  
 | 
|  // TODO(xiaochengh): Merge it with |replaceSelectionWithFragment()|.
 | 
| -void Editor::replaceSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragment> fragment, bool smartReplace, bool plainText)
 | 
| +void Editor::replaceSelectionAfterDragging(RawPtr<DocumentFragment> fragment, bool smartReplace, bool plainText)
 | 
|  {
 | 
|      ReplaceSelectionCommand::CommandOptions options = ReplaceSelectionCommand::SelectReplacement | ReplaceSelectionCommand::PreventNesting;
 | 
|      if (smartReplace)
 | 
| @@ -536,7 +536,7 @@ void Editor::replaceSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragme
 | 
|      ReplaceSelectionCommand::create(*frame().document(), fragment, options, EditActionDrag)->apply();
 | 
|  }
 | 
|  
 | 
| -void Editor::moveSelectionAfterDragging(PassRefPtrWillBeRawPtr<DocumentFragment> fragment, const Position& pos, bool smartInsert, bool smartDelete)
 | 
| +void Editor::moveSelectionAfterDragging(RawPtr<DocumentFragment> fragment, const Position& pos, bool smartInsert, bool smartDelete)
 | 
|  {
 | 
|      MoveSelectionCommand::create(fragment, pos, smartInsert, smartDelete)->apply();
 | 
|  }
 | 
| @@ -652,7 +652,7 @@ TriState Editor::selectionHasStyle(CSSPropertyID propertyID, const String& value
 | 
|  
 | 
|  String Editor::selectionStartCSSPropertyValue(CSSPropertyID propertyID)
 | 
|  {
 | 
| -    RefPtrWillBeRawPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(frame().selection().selection(),
 | 
| +    RawPtr<EditingStyle> selectionStyle = EditingStyle::styleAtSelectionStart(frame().selection().selection(),
 | 
|          propertyID == CSSPropertyBackgroundColor);
 | 
|      if (!selectionStyle || !selectionStyle->style())
 | 
|          return String();
 | 
| @@ -662,7 +662,7 @@ String Editor::selectionStartCSSPropertyValue(CSSPropertyID propertyID)
 | 
|      return selectionStyle->style()->getPropertyValue(propertyID);
 | 
|  }
 | 
|  
 | 
| -static void dispatchEditableContentChangedEvents(PassRefPtrWillBeRawPtr<Element> startRoot, PassRefPtrWillBeRawPtr<Element> endRoot)
 | 
| +static void dispatchEditableContentChangedEvents(RawPtr<Element> startRoot, RawPtr<Element> endRoot)
 | 
|  {
 | 
|      if (startRoot)
 | 
|          startRoot->dispatchEvent(Event::create(EventTypeNames::webkitEditableContentChanged));
 | 
| @@ -688,7 +688,7 @@ void Editor::requestSpellcheckingAfterApplyingCommand(CompositeEditCommand* cmd)
 | 
|      spellChecker().chunkAndMarkAllMisspellingsAndBadGrammar(cmd->endingSelection().rootEditableElement(), insertedRange);
 | 
|  }
 | 
|  
 | 
| -void Editor::appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand> cmd)
 | 
| +void Editor::appliedEditing(RawPtr<CompositeEditCommand> cmd)
 | 
|  {
 | 
|      EventQueueScope scope;
 | 
|      frame().document()->updateLayout();
 | 
| @@ -721,7 +721,7 @@ void Editor::appliedEditing(PassRefPtrWillBeRawPtr<CompositeEditCommand> cmd)
 | 
|      respondToChangedContents(newSelection);
 | 
|  }
 | 
|  
 | 
| -void Editor::unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd)
 | 
| +void Editor::unappliedEditing(RawPtr<EditCommandComposition> cmd)
 | 
|  {
 | 
|      EventQueueScope scope;
 | 
|      frame().document()->updateLayout();
 | 
| @@ -739,7 +739,7 @@ void Editor::unappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd
 | 
|      respondToChangedContents(newSelection);
 | 
|  }
 | 
|  
 | 
| -void Editor::reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd)
 | 
| +void Editor::reappliedEditing(RawPtr<EditCommandComposition> cmd)
 | 
|  {
 | 
|      EventQueueScope scope;
 | 
|      frame().document()->updateLayout();
 | 
| @@ -755,9 +755,9 @@ void Editor::reappliedEditing(PassRefPtrWillBeRawPtr<EditCommandComposition> cmd
 | 
|      respondToChangedContents(newSelection);
 | 
|  }
 | 
|  
 | 
| -PassOwnPtrWillBeRawPtr<Editor> Editor::create(LocalFrame& frame)
 | 
| +RawPtr<Editor> Editor::create(LocalFrame& frame)
 | 
|  {
 | 
| -    return adoptPtrWillBeNoop(new Editor(frame));
 | 
| +    return new Editor(frame);
 | 
|  }
 | 
|  
 | 
|  Editor::Editor(LocalFrame& frame)
 | 
| @@ -1032,7 +1032,7 @@ void Editor::setBaseWritingDirection(WritingDirection direction)
 | 
|          return;
 | 
|      }
 | 
|  
 | 
| -    RefPtrWillBeRawPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(HTMLQuirksMode);
 | 
| +    RawPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(HTMLQuirksMode);
 | 
|      style->setProperty(CSSPropertyDirection, direction == LeftToRightWritingDirection ? "ltr" : direction == RightToLeftWritingDirection ? "rtl" : "inherit", false);
 | 
|      applyParagraphStyleToSelection(style.get(), EditActionSetWritingDirection);
 | 
|  }
 | 
| @@ -1155,7 +1155,7 @@ void Editor::computeAndSetTypingStyle(StylePropertySet* style, EditAction editin
 | 
|      }
 | 
|  
 | 
|      // Calculate the current typing style.
 | 
| -    RefPtrWillBeRawPtr<EditingStyle> typingStyle = nullptr;
 | 
| +    RawPtr<EditingStyle> typingStyle = nullptr;
 | 
|      if (frame().selection().typingStyle()) {
 | 
|          typingStyle = frame().selection().typingStyle()->copy();
 | 
|          typingStyle->overrideWithStyle(style);
 | 
| @@ -1166,7 +1166,7 @@ void Editor::computeAndSetTypingStyle(StylePropertySet* style, EditAction editin
 | 
|      typingStyle->prepareToApplyAt(frame().selection().selection().visibleStart().deepEquivalent(), EditingStyle::PreserveWritingDirection);
 | 
|  
 | 
|      // Handle block styles, substracting these from the typing style.
 | 
| -    RefPtrWillBeRawPtr<EditingStyle> blockStyle = typingStyle->extractAndRemoveBlockProperties();
 | 
| +    RawPtr<EditingStyle> blockStyle = typingStyle->extractAndRemoveBlockProperties();
 | 
|      if (!blockStyle->isEmpty()) {
 | 
|          ASSERT(frame().document());
 | 
|          ApplyStyleCommand::create(*frame().document(), blockStyle.get(), editingAction)->apply();
 | 
| @@ -1182,7 +1182,7 @@ bool Editor::findString(const String& target, FindOptions options)
 | 
|  
 | 
|      // TODO(yosin) We should make |findRangeOfString()| to return
 | 
|      // |EphemeralRange| rather than|Range| object.
 | 
| -    RefPtrWillBeRawPtr<Range> resultRange = findRangeOfString(target, EphemeralRange(selection.start(), selection.end()), static_cast<FindOptions>(options | FindAPICall));
 | 
| +    RawPtr<Range> resultRange = findRangeOfString(target, EphemeralRange(selection.start(), selection.end()), static_cast<FindOptions>(options | FindAPICall));
 | 
|  
 | 
|      if (!resultRange)
 | 
|          return false;
 | 
| @@ -1192,9 +1192,9 @@ bool Editor::findString(const String& target, FindOptions options)
 | 
|      return true;
 | 
|  }
 | 
|  
 | 
| -PassRefPtrWillBeRawPtr<Range> Editor::findStringAndScrollToVisible(const String& target, Range* previousMatch, FindOptions options)
 | 
| +RawPtr<Range> Editor::findStringAndScrollToVisible(const String& target, Range* previousMatch, FindOptions options)
 | 
|  {
 | 
| -    RefPtrWillBeRawPtr<Range> nextMatch = findRangeOfString(target, EphemeralRangeInFlatTree(previousMatch), options);
 | 
| +    RawPtr<Range> nextMatch = findRangeOfString(target, EphemeralRangeInFlatTree(previousMatch), options);
 | 
|      if (!nextMatch)
 | 
|          return nullptr;
 | 
|  
 | 
| @@ -1210,7 +1210,7 @@ PassRefPtrWillBeRawPtr<Range> Editor::findStringAndScrollToVisible(const String&
 | 
|  // |Range| object for checking whether start and end position crossing shadow
 | 
|  // boundaries, however we can do it without |Range| object.
 | 
|  template <typename Strategy>
 | 
| -static PassRefPtrWillBeRawPtr<Range> findStringBetweenPositions(const String& target, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions options)
 | 
| +static RawPtr<Range> findStringBetweenPositions(const String& target, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions options)
 | 
|  {
 | 
|      EphemeralRangeTemplate<Strategy> searchRange(referenceRange);
 | 
|  
 | 
| @@ -1221,7 +1221,7 @@ static PassRefPtrWillBeRawPtr<Range> findStringBetweenPositions(const String& ta
 | 
|          if (resultRange.isCollapsed())
 | 
|              return nullptr;
 | 
|  
 | 
| -        RefPtrWillBeRawPtr<Range> rangeObject = Range::create(resultRange.document(), toPositionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resultRange.endPosition()));
 | 
| +        RawPtr<Range> rangeObject = Range::create(resultRange.document(), toPositionInDOMTree(resultRange.startPosition()), toPositionInDOMTree(resultRange.endPosition()));
 | 
|          if (!rangeObject->collapsed())
 | 
|              return rangeObject.release();
 | 
|  
 | 
| @@ -1245,7 +1245,7 @@ static PassRefPtrWillBeRawPtr<Range> findStringBetweenPositions(const String& ta
 | 
|  }
 | 
|  
 | 
|  template <typename Strategy>
 | 
| -static PassRefPtrWillBeRawPtr<Range> findRangeOfStringAlgorithm(Document& document, const String& target, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions options)
 | 
| +static RawPtr<Range> findRangeOfStringAlgorithm(Document& document, const String& target, const EphemeralRangeTemplate<Strategy>& referenceRange, FindOptions options)
 | 
|  {
 | 
|      if (target.isEmpty())
 | 
|          return nullptr;
 | 
| @@ -1270,7 +1270,7 @@ static PassRefPtrWillBeRawPtr<Range> findRangeOfStringAlgorithm(Document& docume
 | 
|              searchRange = EphemeralRangeTemplate<Strategy>(documentRange.startPosition(), referenceRange.startPosition());
 | 
|      }
 | 
|  
 | 
| -    RefPtrWillBeRawPtr<Range> resultRange = findStringBetweenPositions(target, searchRange, options);
 | 
| +    RawPtr<Range> resultRange = findStringBetweenPositions(target, searchRange, options);
 | 
|  
 | 
|      // 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
 | 
| @@ -1290,12 +1290,12 @@ static PassRefPtrWillBeRawPtr<Range> findRangeOfStringAlgorithm(Document& docume
 | 
|      return resultRange.release();
 | 
|  }
 | 
|  
 | 
| -PassRefPtrWillBeRawPtr<Range> Editor::findRangeOfString(const String& target, const EphemeralRange& reference, FindOptions options)
 | 
| +RawPtr<Range> Editor::findRangeOfString(const String& target, const EphemeralRange& reference, FindOptions options)
 | 
|  {
 | 
|      return findRangeOfStringAlgorithm<EditingStrategy>(*frame().document(), target, reference, options);
 | 
|  }
 | 
|  
 | 
| -PassRefPtrWillBeRawPtr<Range> Editor::findRangeOfString(const String& target, const EphemeralRangeInFlatTree& reference, FindOptions options)
 | 
| +RawPtr<Range> Editor::findRangeOfString(const String& target, const EphemeralRangeInFlatTree& reference, FindOptions options)
 | 
|  {
 | 
|      return findRangeOfStringAlgorithm<EditingInFlatTreeStrategy>(*frame().document(), target, reference, options);
 | 
|  }
 | 
| @@ -1334,8 +1334,8 @@ void Editor::tidyUpHTMLStructure(Document& document)
 | 
|      bool needsValidStructure = document.hasEditableStyle() || (document.documentElement() && document.documentElement()->hasEditableStyle());
 | 
|      if (!needsValidStructure)
 | 
|          return;
 | 
| -    RefPtrWillBeRawPtr<Element> existingHead = nullptr;
 | 
| -    RefPtrWillBeRawPtr<Element> existingBody = nullptr;
 | 
| +    RawPtr<Element> existingHead = nullptr;
 | 
| +    RawPtr<Element> existingBody = nullptr;
 | 
|      Element* currentRoot = document.documentElement();
 | 
|      if (currentRoot) {
 | 
|          if (isHTMLHtmlElement(currentRoot))
 | 
| @@ -1353,10 +1353,10 @@ void Editor::tidyUpHTMLStructure(Document& document)
 | 
|      // rootEditableElement.
 | 
|      document.addConsoleMessage(ConsoleMessage::create(JSMessageSource, WarningMessageLevel, "document.execCommand() doesn't work with an invalid HTML structure. It is corrected automatically."));
 | 
|  
 | 
| -    RefPtrWillBeRawPtr<Element> root = HTMLHtmlElement::create(document);
 | 
| +    RawPtr<Element> root = HTMLHtmlElement::create(document);
 | 
|      if (existingHead)
 | 
|          root->appendChild(existingHead.release());
 | 
| -    RefPtrWillBeRawPtr<Element> body = nullptr;
 | 
| +    RawPtr<Element> body = nullptr;
 | 
|      if (existingBody)
 | 
|          body = existingBody.release();
 | 
|      else
 | 
| 
 |