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

Unified Diff: Source/core/editing/VisibleSelection.cpp

Issue 434393003: Use tighter typing in editing: VisiblePosition & VisibleSelection (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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
« no previous file with comments | « Source/core/editing/VisiblePosition.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/VisibleSelection.cpp
diff --git a/Source/core/editing/VisibleSelection.cpp b/Source/core/editing/VisibleSelection.cpp
index 91618e7b5310bf83c9da9c625e9e767ef3cfc685..411437768c0c3bf2662cf67cf1c0bde506e3a3eb 100644
--- a/Source/core/editing/VisibleSelection.cpp
+++ b/Source/core/editing/VisibleSelection.cpp
@@ -266,18 +266,17 @@ bool VisibleSelection::expandUsingGranularity(TextGranularity granularity)
static PassRefPtrWillBeRawPtr<Range> makeSearchRange(const Position& pos)
{
- Node* n = pos.deprecatedNode();
- if (!n)
+ Node* node = pos.deprecatedNode();
+ if (!node)
return nullptr;
- Document& d = n->document();
- Node* de = d.documentElement();
- if (!de)
+ Document& document = node->document();
+ if (!document.documentElement())
return nullptr;
- Node* boundary = enclosingBlockFlowElement(*n);
+ Element* boundary = enclosingBlockFlowElement(*node);
if (!boundary)
return nullptr;
- RefPtrWillBeRawPtr<Range> searchRange(Range::create(d));
+ RefPtrWillBeRawPtr<Range> searchRange(Range::create(document));
TrackExceptionState exceptionState;
Position start(pos.parentAnchoredEquivalent());
@@ -374,7 +373,7 @@ void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity(Text
// the next one) to match TextEdit.
end = wordEnd.next();
- if (Node* table = isFirstPositionAfterTable(end)) {
+ if (Element* table = isFirstPositionAfterTable(end)) {
// The paragraph break after the last paragraph in the last cell of a block table ends
// at the start of the paragraph after the table.
if (isBlock(table))
@@ -424,7 +423,7 @@ void VisibleSelection::setStartAndEndFromBaseAndExtentRespectingGranularity(Text
// of the next one) in the selection.
VisiblePosition end(visibleParagraphEnd.next());
- if (Node* table = isFirstPositionAfterTable(end)) {
+ if (Element* table = isFirstPositionAfterTable(end)) {
// The paragraph break after the last paragraph in the last cell of a block table ends
// at the start of the paragraph after the table, not at the position just after the table.
if (isBlock(table))
@@ -631,11 +630,11 @@ void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
if (endRoot || endEditableAncestor != baseEditableAncestor) {
Position p = previousVisuallyDistinctCandidate(m_end);
- Node* shadowAncestor = endRoot ? endRoot->shadowHost() : 0;
+ Element* shadowAncestor = endRoot ? endRoot->shadowHost() : 0;
if (p.isNull() && shadowAncestor)
p = positionAfterNode(shadowAncestor);
while (p.isNotNull() && !(lowestEditableAncestor(p.containerNode()) == baseEditableAncestor && !isEditablePosition(p))) {
- Node* root = editableRootForPosition(p);
+ Element* root = editableRootForPosition(p);
shadowAncestor = root ? root->shadowHost() : 0;
p = isAtomicNode(p.containerNode()) ? positionInParentBeforeNode(*p.containerNode()) : previousVisuallyDistinctCandidate(p);
if (p.isNull() && shadowAncestor)
@@ -660,11 +659,11 @@ void VisibleSelection::adjustSelectionToAvoidCrossingEditingBoundaries()
Element* startEditableAncestor = lowestEditableAncestor(m_start.containerNode());
if (startRoot || startEditableAncestor != baseEditableAncestor) {
Position p = nextVisuallyDistinctCandidate(m_start);
- Node* shadowAncestor = startRoot ? startRoot->shadowHost() : 0;
+ Element* shadowAncestor = startRoot ? startRoot->shadowHost() : 0;
if (p.isNull() && shadowAncestor)
p = positionBeforeNode(shadowAncestor);
while (p.isNotNull() && !(lowestEditableAncestor(p.containerNode()) == baseEditableAncestor && !isEditablePosition(p))) {
- Node* root = editableRootForPosition(p);
+ Element* root = editableRootForPosition(p);
shadowAncestor = root ? root->shadowHost() : 0;
p = isAtomicNode(p.containerNode()) ? positionInParentAfterNode(*p.containerNode()) : nextVisuallyDistinctCandidate(p);
if (p.isNull() && shadowAncestor)
« no previous file with comments | « Source/core/editing/VisiblePosition.cpp ('k') | Source/core/editing/VisibleUnits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698