| Index: public/web/WebSelection.h
|
| diff --git a/public/web/WebSelection.h b/public/web/WebSelection.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..9acd22ee794c96e2a1091e47f10bb3a12e2d0b14
|
| --- /dev/null
|
| +++ b/public/web/WebSelection.h
|
| @@ -0,0 +1,59 @@
|
| +// 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& base() const { return m_base; }
|
| + const WebSelectionBound& extent() const { return m_extent; }
|
| + const WebSelectionBound& start() const { return isBaseFirst() ? base() : extent(); }
|
| + const WebSelectionBound& end() const { return isBaseFirst() ? extent() : base(); }
|
| +
|
| + bool isNone() const { return selectionType() == NoSelection; }
|
| + bool isCaret() const { return selectionType() == CaretSelection; }
|
| + bool isRange() const { return selectionType() == RangeSelection; }
|
| +
|
| + bool isBaseFirst() const { return m_isBaseFirst; }
|
| + bool isEditable() const { return m_isEditable; }
|
| + bool isEditableRegionEmpty() const { return m_isEditableRegionEmpty; }
|
| +
|
| +private:
|
| + SelectionType selectionType() const { return m_selectionType; }
|
| +
|
| + SelectionType m_selectionType;
|
| +
|
| + WebSelectionBound m_base;
|
| + WebSelectionBound m_extent;
|
| +
|
| + // Whether |m_base| comes before |m_extent| in document position order.
|
| + bool m_isBaseFirst;
|
| +
|
| + // Whether the selection region consists of editable text.
|
| + bool m_isEditable;
|
| +
|
| + // If the selection region is editable text, whether it is empty.
|
| + bool m_isEditableRegionEmpty;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // WebSelection_h
|
|
|