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

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

Issue 2388703002: Make DragCaretController store PositionWithAffinity instead of VisiblePosition (Closed)
Patch Set: Created 4 years, 2 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 | « third_party/WebKit/Source/core/editing/DragCaretController.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/editing/DragCaretController.cpp
diff --git a/third_party/WebKit/Source/core/editing/DragCaretController.cpp b/third_party/WebKit/Source/core/editing/DragCaretController.cpp
index 13d20eb35490174f376c7bf0fba6dcd2b11d9148..fd1ebc32e459326018baf1715584b786eb94d820 100644
--- a/third_party/WebKit/Source/core/editing/DragCaretController.cpp
+++ b/third_party/WebKit/Source/core/editing/DragCaretController.cpp
@@ -39,19 +39,19 @@ DragCaretController* DragCaretController::create() {
}
bool DragCaretController::hasCaretIn(const LayoutBlock& layoutBlock) const {
- Node* node = m_position.deepEquivalent().anchorNode();
+ Node* node = m_position.position().anchorNode();
if (!node)
return false;
if (layoutBlock != CaretBase::caretLayoutObject(node))
return false;
- if (rootEditableElementOf(m_position))
+ if (rootEditableElementOf(m_position.position()))
return true;
Settings* settings = node->ownerDocument()->frame()->settings();
return settings && settings->caretBrowsingEnabled();
}
bool DragCaretController::isContentRichlyEditable() const {
- return isRichlyEditablePosition(m_position.deepEquivalent());
+ return isRichlyEditablePosition(m_position.position());
}
void DragCaretController::setCaretPosition(
@@ -61,17 +61,18 @@ void DragCaretController::setCaretPosition(
// involves updating compositing state.
DisableCompositingQueryAsserts disabler;
- if (Node* node = m_position.deepEquivalent().anchorNode())
+ if (Node* node = m_position.position().anchorNode())
m_caretBase->invalidateCaretRect(node);
- m_position = createVisiblePosition(position);
+ m_position = createVisiblePosition(position).toPositionWithAffinity();
Document* document = nullptr;
- if (Node* node = m_position.deepEquivalent().anchorNode()) {
+ if (Node* node = m_position.position().anchorNode()) {
m_caretBase->invalidateCaretRect(node);
document = &node->document();
}
- if (m_position.isNull() || m_position.isOrphan()) {
+ if (m_position.isNull()) {
m_caretBase->clearCaretRect();
} else {
+ DCHECK(!m_position.position().isOrphan());
document->updateStyleAndLayoutTree();
m_caretBase->updateCaretRect(m_position);
}
@@ -95,10 +96,10 @@ void DragCaretController::nodeWillBeRemoved(Node& node) {
if (!hasCaret() || !node.inActiveDocument())
return;
- if (!removingNodeRemovesPosition(node, m_position.deepEquivalent()))
+ if (!removingNodeRemovesPosition(node, m_position.position()))
return;
- m_position.deepEquivalent().document()->layoutViewItem().clearSelection();
+ m_position.position().document()->layoutViewItem().clearSelection();
clear();
}
@@ -110,8 +111,8 @@ DEFINE_TRACE(DragCaretController) {
void DragCaretController::paintDragCaret(LocalFrame* frame,
GraphicsContext& context,
const LayoutPoint& paintOffset) const {
- if (m_position.deepEquivalent().anchorNode()->document().frame() == frame)
- m_caretBase->paintCaret(m_position.deepEquivalent().anchorNode(), context,
+ if (m_position.position().anchorNode()->document().frame() == frame)
+ m_caretBase->paintCaret(m_position.position().anchorNode(), context,
paintOffset, DisplayItem::kDragCaret);
}
« no previous file with comments | « third_party/WebKit/Source/core/editing/DragCaretController.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698