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

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

Issue 2272343002: Introduce DragController::hasCaretIn() (Closed)
Patch Set: 2016-08-25T15:59:17 Created 4 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
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 32464e386ed3ea5f1d058feaf2096c576cc54a0d..b19c5fffb3bb841da91e8bcb8d0ee7963dfa8ddc 100644
--- a/third_party/WebKit/Source/core/editing/DragCaretController.cpp
+++ b/third_party/WebKit/Source/core/editing/DragCaretController.cpp
@@ -26,6 +26,7 @@
#include "core/editing/DragCaretController.h"
#include "core/editing/EditingUtilities.h"
+#include "core/frame/Settings.h"
#include "core/layout/api/LayoutViewItem.h"
#include "core/paint/PaintLayer.h"
@@ -41,6 +42,19 @@ DragCaretController* DragCaretController::create()
return new DragCaretController;
}
+bool DragCaretController::hasCaretIn(const LayoutBlock& layoutBlock) const
+{
+ Node* node = m_position.deepEquivalent().anchorNode();
+ if (!node)
+ return false;
+ if (layoutBlock != CaretBase::caretLayoutObject(node))
+ return false;
+ if (rootEditableElementOf(m_position))
+ return true;
+ Settings* settings = node->ownerDocument()->frame()->settings();
+ return settings && settings->caretBrowsingEnabled();
+}
+
bool DragCaretController::isContentRichlyEditable() const
{
return isRichlyEditablePosition(m_position.deepEquivalent());
@@ -102,16 +116,6 @@ DEFINE_TRACE(DragCaretController)
visitor->trace(m_caretBase);
}
-LayoutBlock* DragCaretController::caretLayoutObject() const
-{
- return CaretBase::caretLayoutObject(m_position.deepEquivalent().anchorNode());
-}
-
-bool DragCaretController::isContentEditable() const
-{
- return rootEditableElementOf(m_position);
-}
-
void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext& context, const LayoutPoint& paintOffset) const
{
if (m_position.deepEquivalent().anchorNode()->document().frame() == frame)
« no previous file with comments | « third_party/WebKit/Source/core/editing/DragCaretController.h ('k') | third_party/WebKit/Source/core/layout/LayoutBlock.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698