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

Unified Diff: public/web/WebSelection.h

Issue 929213004: Plumb selection bounds as a single unit (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: TODO for moving WebSelectionBound Created 5 years, 8 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 | « public/platform/WebSelectionBound.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: public/web/WebSelection.h
diff --git a/public/web/WebSelection.h b/public/web/WebSelection.h
new file mode 100644
index 0000000000000000000000000000000000000000..1c334770580b70eece5ba1345b66ff6a363365fd
--- /dev/null
+++ b/public/web/WebSelection.h
@@ -0,0 +1,54 @@
+// 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.
+
+#ifndef WebSelection_h
+#define WebSelection_h
+
+#include "../platform/WebCommon.h"
+#include "../platform/WebSelectionBound.h"
+
+namespace blink {
+
+struct CompositedSelection;
+
+// The active selection region, containing compositing data for the selection
+// end points as well as metadata for the selection region.
+class BLINK_EXPORT WebSelection {
+public:
+ enum SelectionType { NoSelection, CaretSelection, RangeSelection };
+
+#if INSIDE_BLINK
+ explicit WebSelection(const CompositedSelection&);
+#endif
+ WebSelection(const WebSelection&);
+
+ const WebSelectionBound& start() const { return m_start; }
+ const WebSelectionBound& end() const { return m_end; }
+
+ bool isNone() const { return selectionType() == NoSelection; }
+ bool isCaret() const { return selectionType() == CaretSelection; }
+ bool isRange() const { return selectionType() == RangeSelection; }
+
+ bool isEditable() const { return m_isEditable; }
+ bool isEmptyTextFormControl() const { return m_isEmptyTextFormControl; }
+
+private:
+ SelectionType selectionType() const { return m_selectionType; }
+
+ SelectionType m_selectionType;
+
+ WebSelectionBound m_start;
+ WebSelectionBound m_end;
+
+ // Whether the selection region consists of editable text.
+ bool m_isEditable;
+
+ // Whether the selection resides in an empty text form control. Note that
+ // this only applies to caret-type selections.
+ bool m_isEmptyTextFormControl;
+};
+
+} // namespace blink
+
+#endif // WebSelection_h
« no previous file with comments | « public/platform/WebSelectionBound.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698