| 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 14 matching lines...) Expand all Loading... |
| 25 #include "core/editing/Position.h" | 25 #include "core/editing/Position.h" |
| 26 #include "core/editing/VisibleSelection.h" | 26 #include "core/editing/VisibleSelection.h" |
| 27 #include "platform/heap/Handle.h" | 27 #include "platform/heap/Handle.h" |
| 28 | 28 |
| 29 namespace blink { | 29 namespace blink { |
| 30 | 30 |
| 31 class FrameSelection; | 31 class FrameSelection; |
| 32 | 32 |
| 33 class LayoutSelection final : public GarbageCollected<LayoutSelection> { | 33 class LayoutSelection final : public GarbageCollected<LayoutSelection> { |
| 34 public: | 34 public: |
| 35 enum class PaintHint { kHide, kKeep, kPaint }; | |
| 36 | |
| 37 static LayoutSelection* Create(FrameSelection& frame_selection) { | 35 static LayoutSelection* Create(FrameSelection& frame_selection) { |
| 38 return new LayoutSelection(frame_selection); | 36 return new LayoutSelection(frame_selection); |
| 39 } | 37 } |
| 40 | 38 |
| 41 bool HasPendingSelection() const { return has_pending_selection_; } | 39 bool HasPendingSelection() const { return has_pending_selection_; } |
| 42 void SetHasPendingSelection(PaintHint); | 40 void SetHasPendingSelection() { has_pending_selection_ = true; } |
| 43 void Commit(); | 41 void Commit(); |
| 44 | 42 |
| 45 IntRect SelectionBounds(); | 43 IntRect SelectionBounds(); |
| 46 void InvalidatePaintForSelection(); | 44 void InvalidatePaintForSelection(); |
| 47 enum SelectionPaintInvalidationMode { | 45 enum SelectionPaintInvalidationMode { |
| 48 kPaintInvalidationNewXOROld, | 46 kPaintInvalidationNewXOROld, |
| 49 kPaintInvalidationNewMinusOld | 47 kPaintInvalidationNewMinusOld |
| 50 }; | 48 }; |
| 51 void SetSelection( | 49 void SetSelection( |
| 52 LayoutObject* start, | 50 LayoutObject* start, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 63 private: | 61 private: |
| 64 LayoutSelection(FrameSelection&); | 62 LayoutSelection(FrameSelection&); |
| 65 | 63 |
| 66 const VisibleSelection& GetVisibleSelection() const; | 64 const VisibleSelection& GetVisibleSelection() const; |
| 67 | 65 |
| 68 SelectionInFlatTree CalcVisibleSelection( | 66 SelectionInFlatTree CalcVisibleSelection( |
| 69 const VisibleSelectionInFlatTree&) const; | 67 const VisibleSelectionInFlatTree&) const; |
| 70 | 68 |
| 71 Member<FrameSelection> frame_selection_; | 69 Member<FrameSelection> frame_selection_; |
| 72 bool has_pending_selection_ : 1; | 70 bool has_pending_selection_ : 1; |
| 73 bool force_hide_ : 1; | |
| 74 | 71 |
| 75 // The current selection represented as 2 boundaries. | 72 // The current selection represented as 2 boundaries. |
| 76 // Selection boundaries are represented in LayoutView by a tuple | 73 // Selection boundaries are represented in LayoutView by a tuple |
| 77 // (LayoutObject, DOM node offset). | 74 // (LayoutObject, DOM node offset). |
| 78 // See http://www.w3.org/TR/dom/#range for more information. | 75 // See http://www.w3.org/TR/dom/#range for more information. |
| 79 // | 76 // |
| 80 // |m_selectionStartPos| and |m_selectionEndPos| are only valid for | 77 // |m_selectionStartPos| and |m_selectionEndPos| are only valid for |
| 81 // |Text| node without 'transform' or 'first-letter'. | 78 // |Text| node without 'transform' or 'first-letter'. |
| 82 // | 79 // |
| 83 // Those are used for selection painting and paint invalidation upon | 80 // Those are used for selection painting and paint invalidation upon |
| 84 // selection change. | 81 // selection change. |
| 85 LayoutObject* selection_start_; | 82 LayoutObject* selection_start_; |
| 86 LayoutObject* selection_end_; | 83 LayoutObject* selection_end_; |
| 87 | 84 |
| 88 // TODO(yosin): Clarify the meaning of these variables. editing/ passes | 85 // TODO(yosin): Clarify the meaning of these variables. editing/ passes |
| 89 // them as offsets in the DOM tree but layout uses them as offset in the | 86 // them as offsets in the DOM tree but layout uses them as offset in the |
| 90 // layout tree. | 87 // layout tree. |
| 91 int selection_start_pos_; | 88 int selection_start_pos_; |
| 92 int selection_end_pos_; | 89 int selection_end_pos_; |
| 93 }; | 90 }; |
| 94 | 91 |
| 95 } // namespace blink | 92 } // namespace blink |
| 96 | 93 |
| 97 #endif | 94 #endif |
| OLD | NEW |