Index: third_party/WebKit/Source/core/editing/LayoutSelection.h |
diff --git a/third_party/WebKit/Source/core/editing/LayoutSelection.h b/third_party/WebKit/Source/core/editing/LayoutSelection.h |
index 17b7c6dc7f5b15a0e312cb984899cfd2868aed52..1a7fd41449633a1b2640e00c2fe59bf4116dbb1e 100644 |
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.h |
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.h |
@@ -30,6 +30,45 @@ namespace blink { |
class FrameSelection; |
+class SelectionPaintRange { |
yosin_UTC9
2017/05/25 04:29:16
nit: Could you add class comment for this?
e.g.
T
yoichio
2017/05/25 08:29:03
Done.
|
+ DISALLOW_NEW(); |
+ |
+ public: |
+ SelectionPaintRange() = default; |
+ SelectionPaintRange(LayoutObject* start_layout_object, |
+ int start_offset, |
+ LayoutObject* end_layout_object, |
+ int end_offset); |
+ |
+ bool operator==(const SelectionPaintRange& other) const; |
+ |
+ LayoutObject* StartLayoutObject() const; |
+ int StartOffset() const; |
+ LayoutObject* EndLayoutObject() const; |
+ int EndOffset() const; |
+ |
+ bool IsNull() const { return !start_layout_object_; } |
+ |
+ private: |
+ // The current selection represented as 2 boundaries. |
+ // Selection boundaries are represented in LayoutView by a tuple |
+ // (LayoutObject, DOM node offset). |
+ // See http://www.w3.org/TR/dom/#range for more information. |
+ // |
+ // |start_layout_object_| and |end_layout_object_| are only valid for |
+ // |Text| node without 'transform' or 'first-letter'. |
+ // |
+ // Those are used for selection painting and paint invalidation upon |
+ // selection change. |
+ // TODO(editing-dev): Clarify the meaning of |start_offset_| and |
+ // |end_offset_|. editing/ passes them as offsets in the DOM tree but layout |
yosin_UTC9
2017/05/25 04:29:16
nit: s/DOM tree buit/DOM tree but/
yoichio
2017/05/25 08:29:03
Done.
|
+ // uses them as offset in the layout tree. |
+ LayoutObject* start_layout_object_ = nullptr; |
+ int start_offset_ = -1; |
+ LayoutObject* end_layout_object_ = nullptr; |
+ int end_offset_ = -1; |
+}; |
+ |
class LayoutSelection final : public GarbageCollected<LayoutSelection> { |
public: |
static LayoutSelection* Create(FrameSelection& frame_selection) { |
@@ -47,10 +86,7 @@ class LayoutSelection final : public GarbageCollected<LayoutSelection> { |
kPaintInvalidationNewMinusOld |
}; |
void SetSelection( |
- LayoutObject* start, |
- int start_pos, |
- LayoutObject*, |
- int end_pos, |
+ const SelectionPaintRange&, |
SelectionPaintInvalidationMode = kPaintInvalidationNewXOROld); |
void ClearSelection(); |
std::pair<int, int> SelectionStartEnd(); |
@@ -67,24 +103,7 @@ class LayoutSelection final : public GarbageCollected<LayoutSelection> { |
Member<FrameSelection> frame_selection_; |
bool has_pending_selection_ : 1; |
- // The current selection represented as 2 boundaries. |
- // Selection boundaries are represented in LayoutView by a tuple |
- // (LayoutObject, DOM node offset). |
- // See http://www.w3.org/TR/dom/#range for more information. |
- // |
- // |m_selectionStartPos| and |m_selectionEndPos| are only valid for |
- // |Text| node without 'transform' or 'first-letter'. |
- // |
- // Those are used for selection painting and paint invalidation upon |
- // selection change. |
- LayoutObject* selection_start_; |
- LayoutObject* selection_end_; |
- |
- // TODO(yosin): Clarify the meaning of these variables. editing/ passes |
- // them as offsets in the DOM tree but layout uses them as offset in the |
- // layout tree. |
- int selection_start_pos_; |
- int selection_end_pos_; |
+ SelectionPaintRange paint_range_; |
}; |
} // namespace blink |