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

Unified Diff: Source/core/paint/PaintDataCache.cpp

Issue 1218013003: Keep a cache of caret painters to avoid recomputing all the time. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: a shade of deduplication blue Created 5 years, 6 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/paint/PaintDataCache.h ('k') | Source/core/paint/PaintInfo.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/paint/PaintDataCache.cpp
diff --git a/Source/core/paint/PaintDataCache.cpp b/Source/core/paint/PaintDataCache.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..f074b2e2b6da941eaaafbadeb8863e1ca9e3f6e4
--- /dev/null
+++ b/Source/core/paint/PaintDataCache.cpp
@@ -0,0 +1,32 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "config.h"
+#include "core/paint/PaintDataCache.h"
+
+#include "core/editing/Caret.h"
+#include "core/editing/FrameSelection.h"
+#include "core/frame/LocalFrame.h"
+#include "core/frame/Settings.h"
+#include "core/page/Page.h"
+
+namespace blink {
+
+void PaintDataCache::updateCaretCacheForFrame(const LocalFrame* frame)
+{
+ m_caretFrame = frame;
+
+ Settings* settings = frame->settings();
+ bool caretBrowsing = settings && settings->caretBrowsingEnabled();
+
+ const FrameSelection& selection = frame->selection();
+ m_cursorCaretLayoutObject = (selection.hasEditableStyle() || caretBrowsing)
+ ? selection.caretLayoutObject() : nullptr;
+
+ const DragCaretController& dragCaretController = frame->page()->dragCaretController();
+ m_dragCaretLayoutObject = (dragCaretController.isContentEditable() || caretBrowsing)
+ ? dragCaretController.caretLayoutObject() : nullptr;
+}
+
+} // namespace blink
« no previous file with comments | « Source/core/paint/PaintDataCache.h ('k') | Source/core/paint/PaintInfo.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698