OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * Copyright (C) 2006 Apple Computer, Inc. | 3 * Copyright (C) 2006 Apple Computer, Inc. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 23 matching lines...) Expand all Loading... | |
34 class LayoutSelection final : public GarbageCollected<LayoutSelection> { | 34 class LayoutSelection final : public GarbageCollected<LayoutSelection> { |
35 public: | 35 public: |
36 static LayoutSelection* Create(FrameSelection& frame_selection) { | 36 static LayoutSelection* Create(FrameSelection& frame_selection) { |
37 return new LayoutSelection(frame_selection); | 37 return new LayoutSelection(frame_selection); |
38 } | 38 } |
39 | 39 |
40 bool HasPendingSelection() const { return has_pending_selection_; } | 40 bool HasPendingSelection() const { return has_pending_selection_; } |
41 void SetHasPendingSelection() { has_pending_selection_ = true; } | 41 void SetHasPendingSelection() { has_pending_selection_ = true; } |
42 void Commit(LayoutView&); | 42 void Commit(LayoutView&); |
43 | 43 |
44 IntRect SelectionBounds(); | |
45 void InvalidatePaintForSelection(); | |
46 enum SelectionPaintInvalidationMode { | |
47 kPaintInvalidationNewXOROld, | |
48 kPaintInvalidationNewMinusOld | |
49 }; | |
50 void SetSelection( | |
51 LayoutObject* start, | |
52 int start_pos, | |
53 LayoutObject*, | |
54 int end_pos, | |
55 SelectionPaintInvalidationMode = kPaintInvalidationNewXOROld); | |
56 void ClearSelection(); | |
57 void SelectionStartEnd(int& start_pos, int& end_pos); | |
58 void OnDocumentShutdown(); | |
59 | |
44 DECLARE_TRACE(); | 60 DECLARE_TRACE(); |
45 | 61 |
46 private: | 62 private: |
47 LayoutSelection(FrameSelection&); | 63 LayoutSelection(FrameSelection&); |
48 | 64 |
49 const VisibleSelection& GetVisibleSelection() const; | 65 const VisibleSelection& GetVisibleSelection() const; |
50 | 66 |
51 SelectionInFlatTree CalcVisibleSelection( | 67 SelectionInFlatTree CalcVisibleSelection( |
52 const VisibleSelectionInFlatTree&) const; | 68 const VisibleSelectionInFlatTree&) const; |
53 | 69 |
54 Member<FrameSelection> frame_selection_; | 70 Member<FrameSelection> frame_selection_; |
55 bool has_pending_selection_ : 1; | 71 bool has_pending_selection_ : 1; |
72 | |
73 // The current selection represented as 2 boundaries. | |
74 // Selection boundaries are represented in LayoutView by a tuple | |
75 // (LayoutObject, DOM node offset). | |
76 // See http://www.w3.org/TR/dom/#range for more information. | |
77 // | |
78 // |m_selectionStartPos| and |m_selectionEndPos| are only valid for | |
hugoh_UTC2
2017/04/13 06:53:04
Post-merge nit: we should update the comment, now
| |
79 // |Text| node without 'transform' or 'first-letter'. | |
80 // | |
81 // Those are used for selection painting and paint invalidation upon | |
82 // selection change. | |
83 LayoutObject* selection_start_; | |
84 LayoutObject* selection_end_; | |
85 | |
86 // TODO(yosin): Clarify the meaning of these variables. editing/ passes | |
87 // them as offsets in the DOM tree but layout uses them as offset in the | |
88 // layout tree. | |
89 int selection_start_pos_; | |
90 int selection_end_pos_; | |
56 }; | 91 }; |
57 | 92 |
58 } // namespace blink | 93 } // namespace blink |
59 | 94 |
60 #endif | 95 #endif |
OLD | NEW |