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

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

Issue 1226833007: Add CaretBase::m_caretPainter, and compute caretBrowsing lazily. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
« no previous file with comments | « Source/core/editing/Caret.h ('k') | Source/core/editing/FrameSelection.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/Caret.cpp
diff --git a/Source/core/editing/Caret.cpp b/Source/core/editing/Caret.cpp
index 52116d87df1002be37eca30e9f358d1a946f5985..4afb89d11851d0758e1b1e131f8e78f635382aef 100644
--- a/Source/core/editing/Caret.cpp
+++ b/Source/core/editing/Caret.cpp
@@ -40,7 +40,8 @@
namespace blink {
CaretBase::CaretBase(CaretVisibility visibility)
- : m_caretVisibility(visibility)
+ : m_caretPainter(nullptr)
+ , m_caretVisibility(visibility)
{
}
@@ -115,6 +116,7 @@ DEFINE_TRACE(DragCaretController)
void CaretBase::clearCaretRect()
{
+ m_caretPainter = nullptr;
m_caretLocalRect = LayoutRect();
}
@@ -162,6 +164,7 @@ static void mapCaretRectToCaretPainter(LayoutObject* caretLayoutObject, LayoutBl
bool CaretBase::updateCaretRect(Document* document, const PositionWithAffinity& caretPosition)
{
+ m_caretPainter = nullptr;
m_caretLocalRect = LayoutRect();
if (caretPosition.position().isNull())
@@ -175,9 +178,9 @@ bool CaretBase::updateCaretRect(Document* document, const PositionWithAffinity&
// Get the layoutObject that will be responsible for painting the caret
// (which is either the layoutObject we just found, or one of its containers).
- LayoutBlock* caretPainter = caretLayoutObject(caretPosition.position().deprecatedNode());
+ m_caretPainter = caretLayoutObject(caretPosition.position().deprecatedNode());
- mapCaretRectToCaretPainter(layoutObject, caretPainter, m_caretLocalRect);
+ mapCaretRectToCaretPainter(layoutObject, m_caretPainter, m_caretLocalRect);
return true;
}
@@ -187,11 +190,6 @@ bool CaretBase::updateCaretRect(Document* document, const VisiblePosition& caret
return updateCaretRect(document, PositionWithAffinity(caretPosition.deepEquivalent(), caretPosition.affinity()));
}
-LayoutBlock* DragCaretController::caretLayoutObject() const
-{
- return CaretBase::caretLayoutObject(m_position.deepEquivalent().deprecatedNode());
-}
-
IntRect CaretBase::absoluteBoundsForLocalRect(Node* node, const LayoutRect& rect) const
{
LayoutBlock* caretPainter = caretLayoutObject(node);
« no previous file with comments | « Source/core/editing/Caret.h ('k') | Source/core/editing/FrameSelection.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698