Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(208)

Unified Diff: third_party/WebKit/Source/core/editing/FrameSelection.cpp

Issue 2374183004: Make non-null VisibleSelections creatable only by createVisibleSelection[Deprecated] (Closed)
Patch Set: Fix mac compile error Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/editing/FrameSelection.cpp
diff --git a/third_party/WebKit/Source/core/editing/FrameSelection.cpp b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
index 6d2a177520ac7679c9a31378b64123caeaaf725b..78d120bb951c9073db24adcfdb4f73976de93add 100644
--- a/third_party/WebKit/Source/core/editing/FrameSelection.cpp
+++ b/third_party/WebKit/Source/core/editing/FrameSelection.cpp
@@ -166,13 +166,13 @@ const VisibleSelectionInFlatTree& FrameSelection::selectionInFlatTree() const
void FrameSelection::moveTo(const VisiblePosition &pos, EUserTriggered userTriggered, CursorAlignOnScroll align)
{
SetSelectionOptions options = CloseTyping | ClearTypingStyle | userTriggered;
- setSelection(VisibleSelection(pos, pos, selection().isDirectional()), options, align);
+ setSelection(createVisibleSelectionDeprecated(pos, pos, selection().isDirectional()), options, align);
}
void FrameSelection::moveTo(const Position &pos, TextAffinity affinity)
{
SetSelectionOptions options = CloseTyping | ClearTypingStyle;
- setSelection(VisibleSelection(pos, affinity, selection().isDirectional()), options);
+ setSelection(createVisibleSelectionDeprecated(pos, affinity, selection().isDirectional()), options);
}
// TODO(xiaochengh): We should not use reference to return value.
@@ -823,7 +823,7 @@ void FrameSelection::selectFrameElementInParentIfFullySelected()
VisiblePosition afterOwnerElement = createVisiblePosition(Position(ownerElementParent, ownerElementNodeIndex + 1), VP_UPSTREAM_IF_POSSIBLE);
// Focus on the parent frame, and then select from before this element to after.
- VisibleSelection newSelection(beforeOwnerElement, afterOwnerElement);
+ VisibleSelection newSelection = createVisibleSelectionDeprecated(beforeOwnerElement, afterOwnerElement);
page->focusController().setFocusedFrame(parent);
// setFocusedFrame can dispatch synchronous focus/blur events. The document
// tree might be modified.
@@ -900,7 +900,7 @@ bool FrameSelection::setSelectedRange(const EphemeralRange& range, TextAffinity
// can be modified by event handlers, we should create |Range| object before
// calling it.
Range* logicalRange = createRange(range);
- VisibleSelection newSelection(range.startPosition(), range.endPosition(), affinity, directional == SelectionDirectionalMode::Directional);
+ VisibleSelection newSelection = createVisibleSelectionDeprecated(range.startPosition(), range.endPosition(), affinity, directional == SelectionDirectionalMode::Directional);
setSelection(newSelection, options);
m_selectionEditor->setLogicalRange(logicalRange);
return true;
@@ -1214,7 +1214,7 @@ void FrameSelection::setSelectionFromNone()
if (!documentElement)
return;
if (HTMLBodyElement* body = Traversal<HTMLBodyElement>::firstChild(*documentElement))
- setSelection(VisibleSelection(firstPositionInOrBeforeNode(body), TextAffinity::Downstream));
+ setSelection(createVisibleSelectionDeprecated(firstPositionInOrBeforeNode(body), TextAffinity::Downstream));
}
// TODO(yoichio): We should have LocalFrame having FrameCaret,
@@ -1294,7 +1294,7 @@ bool FrameSelection::selectWordAroundPosition(const VisiblePosition& position)
VisiblePosition end = endOfWord(position, wordSide);
String text = plainText(EphemeralRange(start.deepEquivalent(), end.deepEquivalent()));
if (!text.isEmpty() && !isSeparator(text.characterStartingAt(0))) {
- setSelection(VisibleSelection(start, end), WordGranularity);
+ setSelection(createVisibleSelectionDeprecated(start, end), WordGranularity);
return true;
}
}
@@ -1337,7 +1337,7 @@ void FrameSelection::moveRangeSelectionExtent(const IntPoint& contentsPoint)
void FrameSelection::moveRangeSelection(const VisiblePosition& basePosition, const VisiblePosition& extentPosition, TextGranularity granularity)
{
- VisibleSelection newSelection(basePosition, extentPosition);
+ VisibleSelection newSelection = createVisibleSelectionDeprecated(basePosition, extentPosition);
newSelection.expandUsingGranularity(granularity);
if (newSelection.isNone())

Powered by Google App Engine
This is Rietveld 408576698