| Index: third_party/WebKit/WebCore/editing/Editor.cpp
|
| ===================================================================
|
| --- third_party/WebKit/WebCore/editing/Editor.cpp (revision 9391)
|
| +++ third_party/WebKit/WebCore/editing/Editor.cpp (working copy)
|
| @@ -317,7 +317,7 @@
|
| {
|
| if (!m_frame)
|
| return 0;
|
| - return m_frame->selection()->toRange();
|
| + return m_frame->selection()->toNormalizedRange();
|
| }
|
|
|
| bool Editor::shouldDeleteRange(Range* range) const
|
| @@ -419,7 +419,7 @@
|
|
|
| const SimpleFontData* font = 0;
|
|
|
| - RefPtr<Range> range = m_frame->selection()->toRange();
|
| + RefPtr<Range> range = m_frame->selection()->toNormalizedRange();
|
| Node* startNode = range->editingStartPosition().node();
|
| if (startNode) {
|
| Node* pastEnd = range->pastLastNode();
|
| @@ -710,14 +710,14 @@
|
|
|
| void Editor::applyStyle(CSSStyleDeclaration* style, EditAction editingAction)
|
| {
|
| - switch (m_frame->selection()->state()) {
|
| - case Selection::NONE:
|
| + switch (m_frame->selection()->selectionType()) {
|
| + case Selection::NoSelection:
|
| // do nothing
|
| break;
|
| - case Selection::CARET:
|
| + case Selection::CaretSelection:
|
| m_frame->computeAndSetTypingStyle(style, editingAction);
|
| break;
|
| - case Selection::RANGE:
|
| + case Selection::RangeSelection:
|
| if (m_frame->document() && style)
|
| applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction));
|
| break;
|
| @@ -731,12 +731,12 @@
|
|
|
| void Editor::applyParagraphStyle(CSSStyleDeclaration* style, EditAction editingAction)
|
| {
|
| - switch (m_frame->selection()->state()) {
|
| - case Selection::NONE:
|
| + switch (m_frame->selection()->selectionType()) {
|
| + case Selection::NoSelection:
|
| // do nothing
|
| break;
|
| - case Selection::CARET:
|
| - case Selection::RANGE:
|
| + case Selection::CaretSelection:
|
| + case Selection::RangeSelection:
|
| if (m_frame->document() && style)
|
| applyCommand(ApplyStyleCommand::create(m_frame->document(), style, editingAction, ApplyStyleCommand::ForceBlockProperties));
|
| break;
|
| @@ -748,7 +748,7 @@
|
| if (!style || style->length() == 0 || !canEditRichly())
|
| return;
|
|
|
| - if (client() && client()->shouldApplyStyle(style, m_frame->selection()->toRange().get()))
|
| + if (client() && client()->shouldApplyStyle(style, m_frame->selection()->toNormalizedRange().get()))
|
| applyStyle(style, editingAction);
|
| }
|
|
|
| @@ -757,7 +757,7 @@
|
| if (!style || style->length() == 0 || !canEditRichly())
|
| return;
|
|
|
| - if (client() && client()->shouldApplyStyle(style, m_frame->selection()->toRange().get()))
|
| + if (client() && client()->shouldApplyStyle(style, m_frame->selection()->toNormalizedRange().get()))
|
| applyParagraphStyle(style, editingAction);
|
| }
|
|
|
| @@ -965,7 +965,7 @@
|
| Selection selection = selectionForCommand(triggeringEvent);
|
| if (!selection.isContentEditable())
|
| return false;
|
| - RefPtr<Range> range = selection.toRange();
|
| + RefPtr<Range> range = selection.toNormalizedRange();
|
|
|
| if (!shouldInsertText(text, range.get(), EditorInsertActionTyped))
|
| return true;
|
| @@ -996,7 +996,7 @@
|
| if (!canEdit())
|
| return false;
|
|
|
| - if (!shouldInsertText("\n", m_frame->selection()->toRange().get(), EditorInsertActionTyped))
|
| + if (!shouldInsertText("\n", m_frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped))
|
| return true;
|
|
|
| TypingCommand::insertLineBreak(m_frame->document());
|
| @@ -1012,7 +1012,7 @@
|
| if (!canEditRichly())
|
| return insertLineBreak();
|
|
|
| - if (!shouldInsertText("\n", m_frame->selection()->toRange().get(), EditorInsertActionTyped))
|
| + if (!shouldInsertText("\n", m_frame->selection()->toNormalizedRange().get(), EditorInsertActionTyped))
|
| return true;
|
|
|
| TypingCommand::insertParagraphSeparator(m_frame->document());
|
| @@ -1337,7 +1337,7 @@
|
| if (!client())
|
| return;
|
|
|
| - RefPtr<Range> selectedRange = frame()->selection()->toRange();
|
| + RefPtr<Range> selectedRange = frame()->selection()->toNormalizedRange();
|
| if (selectedRange)
|
| frame()->document()->removeMarkers(selectedRange.get(), DocumentMarker::Spelling);
|
|
|
| @@ -1773,7 +1773,7 @@
|
| return false;
|
| #else
|
| Vector<String> ignoredGuesses;
|
| - return isRangeUngrammatical(client(), frame()->selection()->toRange().get(), ignoredGuesses);
|
| + return isRangeUngrammatical(client(), frame()->selection()->toNormalizedRange().get(), ignoredGuesses);
|
| #endif
|
| }
|
|
|
| @@ -1784,7 +1784,7 @@
|
| #else
|
| Vector<String> guesses;
|
| // Ignore the result of isRangeUngrammatical; we just want the guesses, whether or not there are any
|
| - isRangeUngrammatical(client(), frame()->selection()->toRange().get(), guesses);
|
| + isRangeUngrammatical(client(), frame()->selection()->toNormalizedRange().get(), guesses);
|
| return guesses;
|
| #endif
|
| }
|
| @@ -1871,7 +1871,7 @@
|
| if (!editor->isContinuousSpellCheckingEnabled())
|
| return;
|
|
|
| - RefPtr<Range> searchRange(selection.toRange());
|
| + RefPtr<Range> searchRange(selection.toNormalizedRange());
|
| if (!searchRange)
|
| return;
|
|
|
| @@ -1923,7 +1923,7 @@
|
| return 0;
|
| IntPoint framePoint = frameView->windowToContents(windowPoint);
|
| Selection selection(frame->visiblePositionForPoint(framePoint));
|
| - return avoidIntersectionWithNode(selection.toRange().get(), deleteButtonController() ? deleteButtonController()->containerElement() : 0);
|
| + return avoidIntersectionWithNode(selection.toNormalizedRange().get(), deleteButtonController() ? deleteButtonController()->containerElement() : 0);
|
| }
|
|
|
| void Editor::revealSelectionAfterEditingOperation()
|
|
|