Commit 87ea95ce authored by eric@webkit.org's avatar eric@webkit.org

First pass at s/Selection/VisibleSelection

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40793 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 54d4dabb
This diff is collapsed.
......@@ -370,6 +370,8 @@ __ZN7WebCore16NavigationActionC1ERKNS_4KURLENS_14NavigationTypeE
__ZN7WebCore16NavigationActionC1Ev
__ZN7WebCore16ScriptController10initScriptEv
__ZN7WebCore16ScriptController18windowScriptObjectEv
__ZN7WebCore16VisibleSelectionC1EPKNS_5RangeENS_9EAffinityE
__ZN7WebCore16VisibleSelectionC1ERKNS_15VisiblePositionES3_
__ZN7WebCore16colorFromNSColorEP7NSColor
__ZN7WebCore16createFullMarkupEPKNS_4NodeE
__ZN7WebCore16createFullMarkupEPKNS_5RangeE
......@@ -398,7 +400,7 @@ __ZN7WebCore19InspectorController5closeEv
__ZN7WebCore19InspectorController7inspectEPNS_4NodeE
__ZN7WebCore19InspectorController9showPanelENS0_13SpecialPanelsE
__ZN7WebCore19SelectionController10setFocusedEb
__ZN7WebCore19SelectionController12setSelectionERKNS_9SelectionEbbb
__ZN7WebCore19SelectionController12setSelectionERKNS_16VisibleSelectionEbbb
__ZN7WebCore19SelectionController16setSelectedRangeEPNS_5RangeENS_9EAffinityEb
__ZN7WebCore19SelectionController5clearEv
__ZN7WebCore19SelectionController6modifyENS0_11EAlterationENS0_10EDirectionENS_15TextGranularityEb
......@@ -680,9 +682,6 @@ __ZN7WebCore9PageGroup14addVisitedLinkEPKtm
__ZN7WebCore9PageGroup17closeLocalStorageEv
__ZN7WebCore9PageGroup21removeAllVisitedLinksEv
__ZN7WebCore9PageGroup26setShouldTrackVisitedLinksEb
__ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
__ZN7WebCore9SelectionC1EPKNS_5RangeENS_9EAffinityE
__ZN7WebCore9SelectionC1ERKNS_15VisiblePositionES3_
__ZN7WebCore9TimerBase4stopEv
__ZN7WebCore9TimerBase5startEdd
__ZN7WebCore9TimerBaseC2Ev
......@@ -788,6 +787,10 @@ __ZNK7WebCore15VisiblePosition4nextEb
__ZNK7WebCore15VisiblePosition8previousEb
__ZNK7WebCore16HTMLInputElement12autoCompleteEv
__ZNK7WebCore16ResourceResponse13nsURLResponseEv
__ZNK7WebCore16VisibleSelection17isContentEditableEv
__ZNK7WebCore16VisibleSelection17toNormalizedRangeEv
__ZNK7WebCore16VisibleSelection19rootEditableElementEv
__ZNK7WebCore16VisibleSelection23isContentRichlyEditableEv
__ZNK7WebCore17ResourceErrorBase8lazyInitEv
__ZNK7WebCore19AnimationController24numberOfActiveAnimationsEv
__ZNK7WebCore19InspectorController17drawNodeHighlightERNS_15GraphicsContextE
......@@ -900,10 +903,6 @@ __ZNK7WebCore9FrameTree4findERKNS_12AtomicStringE
__ZNK7WebCore9FrameTree5childERKNS_12AtomicStringE
__ZNK7WebCore9FrameTree6parentEb
__ZNK7WebCore9FrameView11needsLayoutEv
__ZNK7WebCore9Selection17isContentEditableEv
__ZNK7WebCore9Selection17toNormalizedRangeEv
__ZNK7WebCore9Selection19rootEditableElementEv
__ZNK7WebCore9Selection23isContentRichlyEditableEv
__ZNK7WebCore9TimerBase8isActiveEv
__ZTVN7WebCore12ChromeClientE
__ZTVN7WebCore17FileChooserClientE
......
......@@ -665,7 +665,6 @@ SOURCES += \
editing/RemoveNodePreservingChildrenCommand.cpp \
editing/ReplaceSelectionCommand.cpp \
editing/SelectionController.cpp \
editing/Selection.cpp \
editing/SetNodeAttributeCommand.cpp \
editing/SmartReplace.cpp \
editing/SmartReplaceICU.cpp \
......@@ -676,6 +675,7 @@ SOURCES += \
editing/TypingCommand.cpp \
editing/UnlinkCommand.cpp \
editing/VisiblePosition.cpp \
editing/VisibleSelection.cpp \
editing/visible_units.cpp \
editing/WrapContentsInDummySpanCommand.cpp \
history/BackForwardList.cpp \
......
......@@ -180,7 +180,6 @@ sources['editing'] = [
'editing/RemoveNodeCommand.cpp',
'editing/RemoveNodePreservingChildrenCommand.cpp',
'editing/ReplaceSelectionCommand.cpp',
'editing/Selection.cpp',
'editing/SelectionController.cpp',
'editing/SetNodeAttributeCommand.cpp',
'editing/SmartReplace.cpp',
......@@ -194,6 +193,7 @@ sources['editing'] = [
'editing/UnlinkCommand.cpp',
'editing/visible_units.cpp',
'editing/VisiblePosition.cpp',
'editing/VisibleSelection.cpp',
'editing/WrapContentsInDummySpanCommand.cpp',
]
sources['history'] = [
......
......@@ -12517,14 +12517,6 @@
RelativePath="..\editing\ReplaceSelectionCommand.h"
>
</File>
<File
RelativePath="..\editing\Selection.cpp"
>
</File>
<File
RelativePath="..\editing\Selection.h"
>
</File>
<File
RelativePath="..\editing\SelectionController.cpp"
>
......@@ -12625,6 +12617,14 @@
RelativePath="..\editing\VisiblePosition.h"
>
</File>
<File
RelativePath="..\editing\VisibleSelection.cpp"
>
</File>
<File
RelativePath="..\editing\VisibleSelection.h"
>
</File>
<File
RelativePath="..\editing\WrapContentsInDummySpanCommand.cpp"
>
......
......@@ -1892,8 +1892,6 @@
93309E07099E64920056E581 /* RemoveNodePreservingChildrenCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DB8099E64910056E581 /* RemoveNodePreservingChildrenCommand.h */; };
93309E09099E64920056E581 /* ReplaceSelectionCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309DBA099E64910056E581 /* ReplaceSelectionCommand.cpp */; };
93309E0A099E64920056E581 /* ReplaceSelectionCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DBB099E64910056E581 /* ReplaceSelectionCommand.h */; settings = {ATTRIBUTES = (Private, ); }; };
93309E0B099E64920056E581 /* Selection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309DBC099E64910056E581 /* Selection.cpp */; };
93309E0C099E64920056E581 /* Selection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DBD099E64910056E581 /* Selection.h */; settings = {ATTRIBUTES = (Private, ); }; };
93309E0D099E64920056E581 /* SelectionController.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309DBE099E64910056E581 /* SelectionController.cpp */; };
93309E0E099E64920056E581 /* SelectionController.h in Headers */ = {isa = PBXBuildFile; fileRef = 93309DBF099E64910056E581 /* SelectionController.h */; settings = {ATTRIBUTES = (Private, ); }; };
93309E0F099E64920056E581 /* SetNodeAttributeCommand.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93309DC0099E64910056E581 /* SetNodeAttributeCommand.cpp */; };
......@@ -2501,6 +2499,8 @@
A871DFE30A15376B00B12A68 /* RenderReplaced.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFDF0A15376B00B12A68 /* RenderReplaced.h */; settings = {ATTRIBUTES = (Private, ); }; };
A871DFE40A15376B00B12A68 /* RenderWidget.h in Headers */ = {isa = PBXBuildFile; fileRef = A871DFE00A15376B00B12A68 /* RenderWidget.h */; settings = {ATTRIBUTES = (Private, ); }; };
A871DFE50A15376B00B12A68 /* RenderWidget.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A871DFE10A15376B00B12A68 /* RenderWidget.cpp */; };
A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */; };
A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */ = {isa = PBXBuildFile; fileRef = A883DF260F3D045D00F19BF6 /* VisibleSelection.h */; settings = {ATTRIBUTES = (Private, ); }; };
A88AD52F09524B92001DD196 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A85D7A2F0879EBA9006A9172 /* QuartzCore.framework */; };
A88DD4870B4629A300C02990 /* PathTraversalState.h in Headers */ = {isa = PBXBuildFile; fileRef = A88DD4860B4629A300C02990 /* PathTraversalState.h */; };
A88DD4890B4629B000C02990 /* PathTraversalState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A88DD4880B4629B000C02990 /* PathTraversalState.cpp */; };
......@@ -6789,8 +6789,6 @@
93309DB8099E64910056E581 /* RemoveNodePreservingChildrenCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RemoveNodePreservingChildrenCommand.h; sourceTree = "<group>"; };
93309DBA099E64910056E581 /* ReplaceSelectionCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ReplaceSelectionCommand.cpp; sourceTree = "<group>"; };
93309DBB099E64910056E581 /* ReplaceSelectionCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ReplaceSelectionCommand.h; sourceTree = "<group>"; };
93309DBC099E64910056E581 /* Selection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Selection.cpp; sourceTree = "<group>"; };
93309DBD099E64910056E581 /* Selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Selection.h; sourceTree = "<group>"; };
93309DBE099E64910056E581 /* SelectionController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SelectionController.cpp; sourceTree = "<group>"; };
93309DBF099E64910056E581 /* SelectionController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SelectionController.h; sourceTree = "<group>"; };
93309DC0099E64910056E581 /* SetNodeAttributeCommand.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SetNodeAttributeCommand.cpp; sourceTree = "<group>"; };
......@@ -7242,6 +7240,8 @@
A871DFDF0A15376B00B12A68 /* RenderReplaced.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderReplaced.h; sourceTree = "<group>"; };
A871DFE00A15376B00B12A68 /* RenderWidget.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = RenderWidget.h; sourceTree = "<group>"; };
A871DFE10A15376B00B12A68 /* RenderWidget.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = RenderWidget.cpp; sourceTree = "<group>"; };
A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VisibleSelection.cpp; sourceTree = "<group>"; };
A883DF260F3D045D00F19BF6 /* VisibleSelection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VisibleSelection.h; sourceTree = "<group>"; };
A88DD4860B4629A300C02990 /* PathTraversalState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PathTraversalState.h; sourceTree = "<group>"; };
A88DD4880B4629B000C02990 /* PathTraversalState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PathTraversalState.cpp; sourceTree = "<group>"; };
A88FE3330E5EEE87008D8C0F /* GraphicsContextPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsContextPrivate.h; sourceTree = "<group>"; };
......@@ -11381,8 +11381,6 @@
93309DB8099E64910056E581 /* RemoveNodePreservingChildrenCommand.h */,
93309DBA099E64910056E581 /* ReplaceSelectionCommand.cpp */,
93309DBB099E64910056E581 /* ReplaceSelectionCommand.h */,
93309DBC099E64910056E581 /* Selection.cpp */,
93309DBD099E64910056E581 /* Selection.h */,
93309DBE099E64910056E581 /* SelectionController.cpp */,
93309DBF099E64910056E581 /* SelectionController.h */,
93309DC0099E64910056E581 /* SetNodeAttributeCommand.cpp */,
......@@ -11406,6 +11404,8 @@
D086FE9609D53AAB005BC74D /* UnlinkCommand.h */,
93309DD0099E64910056E581 /* VisiblePosition.cpp */,
93309DD1099E64910056E581 /* VisiblePosition.h */,
A883DF250F3D045D00F19BF6 /* VisibleSelection.cpp */,
A883DF260F3D045D00F19BF6 /* VisibleSelection.h */,
93309DD4099E64910056E581 /* WrapContentsInDummySpanCommand.cpp */,
93309DD5099E64910056E581 /* WrapContentsInDummySpanCommand.h */,
93309D98099E64910056E581 /* htmlediting.cpp */,
......@@ -16452,7 +16452,6 @@
BCD0E0FC0E972C3500265DEA /* SecurityOriginHash.h in Headers */,
371F4FFC0D25E7F300ECE0D5 /* SegmentedFontData.h in Headers */,
B2C3DA2F0D006C1D00EF6F26 /* SegmentedString.h in Headers */,
93309E0C099E64920056E581 /* Selection.h in Headers */,
93309E0E099E64920056E581 /* SelectionController.h in Headers */,
BC7FA6810D1F167900DB22A9 /* SelectorNodeList.h in Headers */,
51E0BB230DA572A600A9E417 /* SessionStorage.h in Headers */,
......@@ -16723,6 +16722,7 @@
BC96DB430F3A880E00573CB3 /* RenderBoxModelObject.h in Headers */,
2E3AC84E0F3D06D100633F04 /* WorkerContextProxy.h in Headers */,
2E3AC8500F3D06F700633F04 /* WorkerObjectProxy.h in Headers */,
A883DF280F3D045D00F19BF6 /* VisibleSelection.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -18461,7 +18461,6 @@
BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */,
371F4FFD0D25E7F300ECE0D5 /* SegmentedFontData.cpp in Sources */,
B2C3DA2E0D006C1D00EF6F26 /* SegmentedString.cpp in Sources */,
93309E0B099E64920056E581 /* Selection.cpp in Sources */,
93309E0D099E64920056E581 /* SelectionController.cpp in Sources */,
4A8C96EB0BE69032004EEFF0 /* SelectionControllerMac.mm in Sources */,
BC7FA6820D1F167900DB22A9 /* SelectorNodeList.cpp in Sources */,
......@@ -18703,6 +18702,7 @@
1A569D240D7E2B82007C3983 /* runtime_root.cpp in Sources */,
93309E1D099E64920056E581 /* visible_units.cpp in Sources */,
BC96DB460F3A882200573CB3 /* RenderBoxModelObject.cpp in Sources */,
A883DF270F3D045D00F19BF6 /* VisibleSelection.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1096,7 +1096,7 @@ void Element::updateFocusAppearance(bool /*restorePreviousSelection*/)
return;
// FIXME: We should restore the previous selection if there is one.
Selection newSelection = hasTagName(htmlTag) || hasTagName(bodyTag) ? Selection(Position(this, 0), DOWNSTREAM) : Selection::selectionFromContentsOfNode(this);
VisibleSelection newSelection = hasTagName(htmlTag) || hasTagName(bodyTag) ? VisibleSelection(Position(this, 0), DOWNSTREAM) : VisibleSelection::selectionFromContentsOfNode(this);
if (frame->shouldChangeSelection(newSelection)) {
frame->selection()->setSelection(newSelection);
......
......@@ -342,7 +342,7 @@ void ApplyStyleCommand::updateStartEnd(const Position& newStart, const Position&
if (!m_useEndingSelection && (newStart != m_start || newEnd != m_end))
m_useEndingSelection = true;
setEndingSelection(Selection(newStart, newEnd, VP_DEFAULT_AFFINITY));
setEndingSelection(VisibleSelection(newStart, newEnd, VP_DEFAULT_AFFINITY));
m_start = newStart;
m_end = newEnd;
}
......@@ -1480,7 +1480,7 @@ void ApplyStyleCommand::surroundNodeRangeWithElement(Node* startNode, Node* endN
}
// FIXME: We should probably call updateStartEnd if the start or end was in the node
// range so that the endingSelection() is canonicalized. See the comments at the end of
// Selection::validate().
// VisibleSelection::validate().
}
void ApplyStyleCommand::addBlockStyle(const StyleChange& styleChange, HTMLElement* block)
......
......@@ -72,7 +72,7 @@ void BreakBlockquoteCommand::doApply()
insertNodeAfter(breakNode.get(), topBlockquote);
if (isLastVisiblePositionInNode(visiblePos, topBlockquote)) {
setEndingSelection(Selection(Position(breakNode.get(), 0), DOWNSTREAM));
setEndingSelection(VisibleSelection(Position(breakNode.get(), 0), DOWNSTREAM));
rebalanceWhitespace();
return;
}
......@@ -97,7 +97,7 @@ void BreakBlockquoteCommand::doApply()
// If there's nothing inside topBlockquote to move, we're finished.
if (!startNode->isDescendantOf(topBlockquote)) {
setEndingSelection(Selection(VisiblePosition(Position(startNode, 0))));
setEndingSelection(VisibleSelection(VisiblePosition(Position(startNode, 0))));
return;
}
......@@ -168,7 +168,7 @@ void BreakBlockquoteCommand::doApply()
addBlockPlaceholderIfNeeded(clonedBlockquote.get());
// Put the selection right before the break.
setEndingSelection(Selection(Position(breakNode.get(), 0), DOWNSTREAM));
setEndingSelection(VisibleSelection(Position(breakNode.get(), 0), DOWNSTREAM));
rebalanceWhitespace();
}
......
......@@ -296,7 +296,7 @@ void CompositeEditCommand::inputText(const String& text, bool selectInsertedText
if (selectInsertedText) {
RefPtr<Range> selectedRange = TextIterator::rangeFromLocationAndLength(document()->documentElement(), startIndex, length);
setEndingSelection(Selection(selectedRange.get()));
setEndingSelection(VisibleSelection(selectedRange.get()));
}
}
......@@ -345,7 +345,7 @@ void CompositeEditCommand::deleteSelection(bool smartDelete, bool mergeBlocksAft
applyCommandToComposite(DeleteSelectionCommand::create(document(), smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
}
void CompositeEditCommand::deleteSelection(const Selection &selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
void CompositeEditCommand::deleteSelection(const VisibleSelection &selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
{
if (selection.isRange())
applyCommandToComposite(DeleteSelectionCommand::create(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
......@@ -452,7 +452,7 @@ void CompositeEditCommand::prepareWhitespaceAtPositionForSplit(Position& positio
void CompositeEditCommand::rebalanceWhitespace()
{
Selection selection = endingSelection();
VisibleSelection selection = endingSelection();
if (selection.isNone())
return;
......@@ -696,7 +696,7 @@ void CompositeEditCommand::pushAnchorElementDown(Node* anchorNode)
ASSERT(anchorNode->isLink());
setEndingSelection(Selection::selectionFromContentsOfNode(anchorNode));
setEndingSelection(VisibleSelection::selectionFromContentsOfNode(anchorNode));
applyStyledElement(static_cast<Element*>(anchorNode));
// Clones of anchorNode have been pushed down, now remove it.
if (anchorNode->inDocument())
......@@ -709,7 +709,7 @@ void CompositeEditCommand::pushAnchorElementDown(Node* anchorNode)
// Anchors cannot be nested.
void CompositeEditCommand::pushPartiallySelectedAnchorElementsDown()
{
Selection originalSelection = endingSelection();
VisibleSelection originalSelection = endingSelection();
VisiblePosition visibleStart(originalSelection.start());
VisiblePosition visibleEnd(originalSelection.end());
......@@ -797,7 +797,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
// FIXME (5098931): We should add a new insert action "WebViewInsertActionMoved" and call shouldInsertFragment here.
setEndingSelection(Selection(start, end, DOWNSTREAM));
setEndingSelection(VisibleSelection(start, end, DOWNSTREAM));
deleteSelection(false, false, false, false);
ASSERT(destination.deepEquivalent().node()->inDocument());
......@@ -866,7 +866,7 @@ void CompositeEditCommand::moveParagraphs(const VisiblePosition& startOfParagrap
RefPtr<Range> start = TextIterator::rangeFromLocationAndLength(document()->documentElement(), destinationIndex + startIndex, 0, true);
RefPtr<Range> end = TextIterator::rangeFromLocationAndLength(document()->documentElement(), destinationIndex + endIndex, 0, true);
if (start && end)
setEndingSelection(Selection(start->startPosition(), end->startPosition(), DOWNSTREAM));
setEndingSelection(VisibleSelection(start->startPosition(), end->startPosition(), DOWNSTREAM));
}
}
......@@ -897,7 +897,7 @@ bool CompositeEditCommand::breakOutOfEmptyListItem()
}
appendBlockPlaceholder(newBlock);
setEndingSelection(Selection(Position(newBlock.get(), 0), DOWNSTREAM));
setEndingSelection(VisibleSelection(Position(newBlock.get(), 0), DOWNSTREAM));
computedStyle(endingSelection().start().node())->diff(style.get());
if (style->length() > 0)
......@@ -935,7 +935,7 @@ bool CompositeEditCommand::breakOutOfEmptyMailBlockquotedParagraph()
// a second one.
if (!isStartOfParagraph(atBR))
insertNodeBefore(createBreakElement(document()), br);
setEndingSelection(Selection(atBR));
setEndingSelection(VisibleSelection(atBR));
// If this is an empty paragraph there must be a line break here.
if (!lineBreakExistsAtPosition(caret))
......
......@@ -52,7 +52,7 @@ protected:
void applyStyledElement(PassRefPtr<Element>);
void removeStyledElement(PassRefPtr<Element>);
void deleteSelection(bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = true);
void deleteSelection(const Selection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = true);
void deleteSelection(const VisibleSelection&, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = true);
virtual void deleteTextFromNode(PassRefPtr<Text>, unsigned offset, unsigned count);
void inputText(const String&, bool selectInsertedText = false);
void insertNodeAfter(PassRefPtr<Node>, PassRefPtr<Node> refChild);
......
......@@ -53,7 +53,7 @@ void CreateLinkCommand::doApply()
insertNodeAt(anchorElement.get(), endingSelection().start());
RefPtr<Text> textNode = new Text(document(), m_url);
appendNode(textNode.get(), anchorElement.get());
setEndingSelection(Selection(positionBeforeNode(anchorElement.get()), positionAfterNode(anchorElement.get()), DOWNSTREAM));
setEndingSelection(VisibleSelection(positionBeforeNode(anchorElement.get()), positionAfterNode(anchorElement.get()), DOWNSTREAM));
}
}
......
......@@ -101,7 +101,7 @@ static bool isDeletableElement(const Node* node)
return false;
}
static HTMLElement* enclosingDeletableElement(const Selection& selection)
static HTMLElement* enclosingDeletableElement(const VisibleSelection& selection)
{
if (!selection.isContentEditable())
return 0;
......@@ -128,7 +128,7 @@ static HTMLElement* enclosingDeletableElement(const Selection& selection)
return static_cast<HTMLElement*>(element);
}
void DeleteButtonController::respondToChangedSelection(const Selection& oldSelection)
void DeleteButtonController::respondToChangedSelection(const VisibleSelection& oldSelection)
{
if (!enabled())
return;
......
......@@ -34,7 +34,7 @@ class DeleteButton;
class Frame;
class HTMLElement;
class RenderObject;
class Selection;
class VisibleSelection;
class DeleteButtonController {
public:
......@@ -45,7 +45,7 @@ public:
HTMLElement* target() const { return m_target.get(); }
HTMLElement* containerElement() const { return m_containerElement.get(); }
void respondToChangedSelection(const Selection& oldSelection);
void respondToChangedSelection(const VisibleSelection& oldSelection);
void show(HTMLElement*);
void hide();
......
......@@ -88,7 +88,7 @@ DeleteSelectionCommand::DeleteSelectionCommand(Document *document, bool smartDel
{
}
DeleteSelectionCommand::DeleteSelectionCommand(const Selection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
DeleteSelectionCommand::DeleteSelectionCommand(const VisibleSelection& selection, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements)
: CompositeEditCommand(selection.start().node()->document()),
m_hasSelectionToDelete(true),
m_smartDelete(smartDelete),
......@@ -696,7 +696,7 @@ void DeleteSelectionCommand::calculateTypingStyleAfterDelete()
void DeleteSelectionCommand::clearTransientState()
{
m_selectionToDelete = Selection();
m_selectionToDelete = VisibleSelection();
m_upstreamStart.clear();
m_downstreamStart.clear();
m_upstreamEnd.clear();
......@@ -755,7 +755,7 @@ void DeleteSelectionCommand::doApply()
// want to replace it with a placeholder BR!
if (handleSpecialCaseBRDelete()) {
calculateTypingStyleAfterDelete();
setEndingSelection(Selection(m_endingPosition, affinity));
setEndingSelection(VisibleSelection(m_endingPosition, affinity));
clearTransientState();
rebalanceWhitespace();
return;
......@@ -778,7 +778,7 @@ void DeleteSelectionCommand::doApply()
calculateTypingStyleAfterDelete();
setEndingSelection(Selection(m_endingPosition, affinity));
setEndingSelection(VisibleSelection(m_endingPosition, affinity));
clearTransientState();
}
......
......@@ -36,14 +36,14 @@ public:
{
return adoptRef(new DeleteSelectionCommand(document, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
}
static PassRefPtr<DeleteSelectionCommand> create(const Selection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false)
static PassRefPtr<DeleteSelectionCommand> create(const VisibleSelection& selection, bool smartDelete = false, bool mergeBlocksAfterDelete = true, bool replace = false, bool expandForSpecialElements = false)
{
return adoptRef(new DeleteSelectionCommand(selection, smartDelete, mergeBlocksAfterDelete, replace, expandForSpecialElements));
}
private:
DeleteSelectionCommand(Document*, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
DeleteSelectionCommand(const Selection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
DeleteSelectionCommand(const VisibleSelection&, bool smartDelete, bool mergeBlocksAfterDelete, bool replace, bool expandForSpecialElements);
virtual void doApply();
virtual EditAction editingAction() const;
......@@ -74,7 +74,7 @@ private:
bool m_pruneStartBlockIfNecessary;
// This data is transient and should be cleared at the end of the doApply function.
Selection m_selectionToDelete;
VisibleSelection m_selectionToDelete;
Position m_upstreamStart;
Position m_downstreamStart;
Position m_upstreamEnd;
......
......@@ -158,7 +158,7 @@ EditAction EditCommand::editingAction() const
return EditActionUnspecified;
}
void EditCommand::setStartingSelection(const Selection& s)
void EditCommand::setStartingSelection(const VisibleSelection& s)
{
Element* root = s.rootEditableElement();
for (EditCommand* cmd = this; ; cmd = cmd->m_parent) {
......@@ -169,7 +169,7 @@ void EditCommand::setStartingSelection(const Selection& s)
}
}
void EditCommand::setEndingSelection(const Selection &s)
void EditCommand::setEndingSelection(const VisibleSelection &s)
{
Element* root = s.rootEditableElement();
for (EditCommand* cmd = this; cmd; cmd = cmd->m_parent) {
......
......@@ -28,7 +28,7 @@
#include "EditAction.h"
#include "Element.h"
#include "Selection.h"
#include "VisibleSelection.h"
namespace WebCore {
......@@ -47,8 +47,8 @@ public:
virtual EditAction editingAction() const;
const Selection& startingSelection() const { return m_startingSelection; }
const Selection& endingSelection() const { return m_endingSelection; }
const VisibleSelection& startingSelection() const { return m_startingSelection; }
const VisibleSelection& endingSelection() const { return m_endingSelection; }
Element* startingRootEditableElement() const { return m_startingRootEditableElement.get(); }
Element* endingRootEditableElement() const { return m_endingRootEditableElement.get(); }
......@@ -63,8 +63,8 @@ protected:
Document* document() const { return m_document.get(); }
void setStartingSelection(const Selection&);
void setEndingSelection(const Selection&);
void setStartingSelection(const VisibleSelection&);
void setEndingSelection(const VisibleSelection&);
PassRefPtr<CSSMutableStyleDeclaration> styleAtPosition(const Position&);
void updateLayout() const;
......@@ -75,8 +75,8 @@ private:
virtual void doReapply(); // calls doApply()
RefPtr<Document> m_document;
Selection m_startingSelection;
Selection m_endingSelection;
VisibleSelection m_startingSelection;
VisibleSelection m_endingSelection;
RefPtr<Element> m_startingRootEditableElement;
RefPtr<Element> m_endingRootEditableElement;
CompositeEditCommand* m_parent;
......
This diff is collapsed.
......@@ -110,8 +110,8 @@ public:
bool shouldDeleteRange(Range*) const;
bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
void respondToChangedSelection(const Selection& oldSelection);
void respondToChangedContents(const Selection& endingSelection);
void respondToChangedSelection(const VisibleSelection& oldSelection);
void respondToChangedContents(const VisibleSelection& endingSelection);
TriState selectionHasStyle(CSSStyleDeclaration*) const;
const SimpleFontData* fontForSelection(bool&) const;
......@@ -196,8 +196,8 @@ public:
Vector<String> guessesForMisspelledSelection();
Vector<String> guessesForUngrammaticalSelection();
void markMisspellingsAfterTypingToPosition(const VisiblePosition&);
void markMisspellings(const Selection&);
void markBadGrammar(const Selection&);
void markMisspellings(const VisibleSelection&);
void markBadGrammar(const VisibleSelection&);
void advanceToNextMisspelling(bool startBeforeSelection = false);
void showSpellingGuessPanel();
bool spellingPanelIsShowing();
......@@ -253,7 +253,7 @@ public:
void clear();
Selection selectionForCommand(Event*);
VisibleSelection selectionForCommand(Event*);
void appendToKillRing(const String&);
void prependToKillRing(const String&);
......
......@@ -184,7 +184,7 @@ static bool executeInsertNode(Frame* frame, PassRefPtr<Node> content)
static bool expandSelectionToGranularity(Frame* frame, TextGranularity granularity)
{
Selection selection = frame->selection()->selection();
VisibleSelection selection = frame->selection()->selection();
selection.expandUsingGranularity(granularity);
RefPtr<Range> newRange = selection.toNormalizedRange();
if (!newRange)
......@@ -935,8 +935,8 @@ static bool executeSuperscript(Frame* frame, Event*, EditorCommandSource source,
static bool executeSwapWithMark(Frame* frame, Event*, EditorCommandSource, const String&)
{
const Selection& mark = frame->mark();
const Selection& selection = frame->selection()->selection();
const VisibleSelection& mark = frame->mark();
const VisibleSelection& selection = frame->selection()->selection();
if (mark.isNone() || selection.isNone()) {
systemBeep();
return false;
......@@ -1042,20 +1042,20 @@ static bool enabled(Frame*, Event*, EditorCommandSource)
static bool enabledVisibleSelection(Frame* frame, Event* event, EditorCommandSource)
{
// The term "visible" here includes a caret in editable text or a range in any text.
const Selection& selection = frame->editor()->selectionForCommand(event);
const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
return (selection.isCaret() && selection.isContentEditable()) || selection.isRange();
}
static bool enabledVisibleSelectionAndMark(Frame* frame, Event* event, EditorCommandSource)
{
const Selection& selection = frame->editor()->selectionForCommand(event);
const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
return ((selection.isCaret() && selection.isContentEditable()) || selection.isRange())
&& frame->mark().isCaretOrRange();
}
static bool enableCaretInEditableText(Frame* frame, Event* event, EditorCommandSource)
{
const Selection& selection = frame->editor()->selectionForCommand(event);
const VisibleSelection& selection = frame->editor()->selectionForCommand(event);
return selection.isCaret() && selection.isContentEditable();
}
......
......@@ -63,7 +63,7 @@ bool FormatBlockCommand::modifyRange()
setEndingSelection(visibleEnd);
doApply();
visibleEnd = endingSelection().visibleEnd();
setEndingSelection(Selection(visibleStart.deepEquivalent(), visibleEnd.deepEquivalent(), DOWNSTREAM));
setEndingSelection(VisibleSelection(visibleStart.deepEquivalent(), visibleEnd.deepEquivalent(), DOWNSTREAM));
return true;
}
......@@ -87,7 +87,7 @@ void FormatBlockCommand::doApply()
// margin/padding, but not others. We should make the gap painting more consistent and
// then use a left margin/padding rule here.
if (visibleEnd != visibleStart && isStartOfParagraph(visibleEnd))
setEndingSelection(Selection(visibleStart, visibleEnd.previous(true)));
setEndingSelection(VisibleSelection(visibleStart, visibleEnd.previous(true)));
if (endingSelection().isRange() && modifyRange())
return;
......
......@@ -109,7 +109,7 @@ PassRefPtr<Element> IndentOutdentCommand::prepareBlockquoteLevelForInsertion(Vis
void IndentOutdentCommand::indentRegion()
{
Selection selection = selectionForParagraphIteration(endingSelection());
VisibleSelection selection = selectionForParagraphIteration(endingSelection());
VisiblePosition startOfSelection = selection.visibleStart();
VisiblePosition endOfSelection = selection.visibleEnd();
int startIndex = indexForVisiblePosition(startOfSelection);
......@@ -126,7 +126,7 @@ void IndentOutdentCommand::indentRegion()
insertNodeAt(blockquote, start);
RefPtr<Element> placeholder = createBreakElement(document());
appendNode(placeholder, blockquote);
setEndingSelection(Selection(Position(placeholder.get(), 0), DOWNSTREAM));