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

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

Issue 1236823002: Move DragCaretController class to its own file (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 2015-07-13T15:55:28 --similarity=30 Created 5 years, 5 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: Source/core/editing/Caret.cpp
diff --git a/Source/core/editing/Caret.cpp b/Source/core/editing/Caret.cpp
index 4afb89d11851d0758e1b1e131f8e78f635382aef..3c2df5451fee05704ba53c79437e9d3f243c8834 100644
--- a/Source/core/editing/Caret.cpp
+++ b/Source/core/editing/Caret.cpp
@@ -26,15 +26,11 @@
#include "config.h"
#include "core/editing/Caret.h"
-#include "core/dom/Document.h"
#include "core/editing/VisibleUnits.h"
#include "core/editing/htmlediting.h"
-#include "core/frame/LocalFrame.h"
#include "core/frame/Settings.h"
-#include "core/html/HTMLTextFormControlElement.h"
#include "core/layout/LayoutBlock.h"
#include "core/layout/LayoutView.h"
-#include "core/paint/DeprecatedPaintLayer.h"
#include "platform/graphics/GraphicsContext.h"
namespace blink {
@@ -45,75 +41,6 @@ CaretBase::CaretBase(CaretVisibility visibility)
{
}
-DragCaretController::DragCaretController()
- : CaretBase(Visible)
-{
-}
-
-PassOwnPtrWillBeRawPtr<DragCaretController> DragCaretController::create()
-{
- return adoptPtrWillBeNoop(new DragCaretController);
-}
-
-bool DragCaretController::isContentRichlyEditable() const
-{
- return isRichlyEditablePosition(m_position.deepEquivalent());
-}
-
-void DragCaretController::setCaretPosition(const VisiblePosition& position)
-{
- // for querying Layer::compositingState()
- // This code is probably correct, since it doesn't occur in a stack that involves updating compositing state.
- DisableCompositingQueryAsserts disabler;
-
- if (Node* node = m_position.deepEquivalent().deprecatedNode())
- invalidateCaretRect(node);
- m_position = position;
- Document* document = nullptr;
- if (Node* node = m_position.deepEquivalent().deprecatedNode()) {
- invalidateCaretRect(node);
- document = &node->document();
- }
- if (m_position.isNull() || m_position.isOrphan()) {
- clearCaretRect();
- } else {
- document->updateLayoutTreeIfNeeded();
- updateCaretRect(document, m_position);
- }
-}
-
-static bool removingNodeRemovesPosition(Node& node, const Position& position)
-{
- if (!position.anchorNode())
- return false;
-
- if (position.anchorNode() == node)
- return true;
-
- if (!node.isElementNode())
- return false;
-
- Element& element = toElement(node);
- return element.containsIncludingShadowDOM(position.anchorNode());
-}
-
-void DragCaretController::nodeWillBeRemoved(Node& node)
-{
- if (!hasCaret() || !node.inActiveDocument())
- return;
-
- if (!removingNodeRemovesPosition(node, m_position.deepEquivalent()))
- return;
-
- m_position.deepEquivalent().document()->layoutView()->clearSelection();
- clear();
-}
-
-DEFINE_TRACE(DragCaretController)
-{
- visitor->trace(m_position);
-}
-
void CaretBase::clearCaretRect()
{
m_caretPainter = nullptr;
@@ -276,10 +203,4 @@ void CaretBase::paintCaret(Node* node, GraphicsContext* context, const LayoutPoi
context->fillRect(caret, caretColor);
}
-void DragCaretController::paintDragCaret(LocalFrame* frame, GraphicsContext* p, const LayoutPoint& paintOffset, const LayoutRect& clipRect) const
-{
- if (m_position.deepEquivalent().deprecatedNode()->document().frame() == frame)
- paintCaret(m_position.deepEquivalent().deprecatedNode(), p, paintOffset, clipRect);
-}
-
-}
+} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698