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

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

Issue 2406163004: Simplify the usage of PositionWithAffinity (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
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 cc0a0983fb83e619552bad05fa4c6dec02366ac2..9b891c3925cace812f42f7920b5a2949632a3556 100644
--- a/third_party/WebKit/Source/core/editing/DragCaretController.cpp
+++ b/third_party/WebKit/Source/core/editing/DragCaretController.cpp
@@ -39,7 +39,7 @@ DragCaretController* DragCaretController::create() {
}
bool DragCaretController::hasCaretIn(const LayoutBlock& layoutBlock) const {
- Node* node = m_position.position().anchorNode();
+ Node* node = m_position.anchorNode();
if (!node)
return false;
if (layoutBlock != CaretBase::caretLayoutObject(node))
@@ -58,18 +58,18 @@ void DragCaretController::setCaretPosition(
// involves updating compositing state.
DisableCompositingQueryAsserts disabler;
- if (Node* node = m_position.position().anchorNode())
+ if (Node* node = m_position.anchorNode())
m_caretBase->invalidateCaretRect(node);
m_position = createVisiblePosition(position).toPositionWithAffinity();
Document* document = nullptr;
- if (Node* node = m_position.position().anchorNode()) {
+ if (Node* node = m_position.anchorNode()) {
m_caretBase->invalidateCaretRect(node);
document = &node->document();
}
if (m_position.isNull()) {
m_caretBase->clearCaretRect();
} else {
- DCHECK(!m_position.position().isOrphan());
+ DCHECK(!m_position.isOrphan());
document->updateStyleAndLayoutTree();
m_caretBase->updateCaretRect(m_position);
}
@@ -96,7 +96,7 @@ void DragCaretController::nodeWillBeRemoved(Node& node) {
if (!removingNodeRemovesPosition(node, m_position.position()))
return;
- m_position.position().document()->layoutViewItem().clearSelection();
+ m_position.document()->layoutViewItem().clearSelection();
clear();
}
@@ -108,9 +108,10 @@ DEFINE_TRACE(DragCaretController) {
void DragCaretController::paintDragCaret(LocalFrame* frame,
GraphicsContext& context,
const LayoutPoint& paintOffset) const {
- if (m_position.position().anchorNode()->document().frame() == frame)
- m_caretBase->paintCaret(m_position.position().anchorNode(), context,
- paintOffset, DisplayItem::kDragCaret);
+ if (m_position.anchorNode()->document().frame() == frame) {
+ m_caretBase->paintCaret(m_position.anchorNode(), context, paintOffset,
+ DisplayItem::kDragCaret);
+ }
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/editing/CaretBase.cpp ('k') | third_party/WebKit/Source/core/editing/FrameCaret.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698