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

Unified Diff: third_party/WebKit/Source/core/editing/SelectionTemplate.h

Issue 2698793003: Get rid of redundant layout tree update related to selection (Closed)
Patch Set: 2017-02-17T16:13:56 selectionTypeWithLegacyGranularity() Created 3 years, 10 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/SelectionTemplate.h
diff --git a/third_party/WebKit/Source/core/editing/SelectionTemplate.h b/third_party/WebKit/Source/core/editing/SelectionTemplate.h
index ae04d0d868cca37eca1b86650335516d362bb355..b3d5b8a3fbbf28c251ea2d3d2bc5f5b1c80103c1 100644
--- a/third_party/WebKit/Source/core/editing/SelectionTemplate.h
+++ b/third_party/WebKit/Source/core/editing/SelectionTemplate.h
@@ -5,15 +5,16 @@
#ifndef SelectionTemplate_h
#define SelectionTemplate_h
+#include <iosfwd>
#include "base/macros.h"
#include "core/CoreExport.h"
#include "core/editing/EphemeralRange.h"
#include "core/editing/Position.h"
#include "core/editing/PositionWithAffinity.h"
+#include "core/editing/SelectionType.h"
#include "core/editing/TextAffinity.h"
#include "core/editing/TextGranularity.h"
#include "wtf/Allocator.h"
-#include <iosfwd>
namespace blink {
@@ -87,15 +88,27 @@ class CORE_EXPORT SelectionTemplate final {
TextAffinity affinity() const { return m_affinity; }
TextGranularity granularity() const { return m_granularity; }
bool hasTrailingWhitespace() const { return m_hasTrailingWhitespace; }
+ bool isCaret() const { return m_base.isNotNull() && m_base == m_extent; }
bool isDirectional() const { return m_isDirectional; }
bool isHandleVisible() const { return m_isHandleVisible; }
bool isNone() const { return m_base.isNull(); }
+ bool isRange() const { return m_base != m_extent; }
// Returns true if |this| selection holds valid values otherwise it causes
// assertion failure.
bool assertValid() const;
bool assertValidFor(const Document&) const;
+ const PositionTemplate<Strategy>& computeEndPosition() const;
+ const PositionTemplate<Strategy>& computeStartPosition() const;
+
+ // Returns |SelectionType| for |this| based on |m_base| and |m_extent|
+ // If |m_granularity| is |CharacterGranularity|, otherwise this function
+ // returns |RangeSelection| event if |m_base| == |m_extent|.
+ // Note: |m_granularity| will be removed, using this function is not
+ // encouraged.
+ SelectionType selectionTypeWithLegacyGranularity() const;
+
DECLARE_TRACE();
void printTo(std::ostream*, const char* type) const;

Powered by Google App Engine
This is Rietveld 408576698