| 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 26 matching lines...) Expand all Loading... |
| 37 // 2 LayoutObjects are only valid for |Text| node without 'transform' or | 37 // 2 LayoutObjects are only valid for |Text| node without 'transform' or |
| 38 // 'first-letter'. | 38 // 'first-letter'. |
| 39 // TODO(editing-dev): Clarify the meaning of "offset". | 39 // TODO(editing-dev): Clarify the meaning of "offset". |
| 40 // editing/ passes them as offsets in the DOM tree but layout uses them as | 40 // editing/ passes them as offsets in the DOM tree but layout uses them as |
| 41 // offset in the layout tree. This doesn't work in the cases of | 41 // offset in the layout tree. This doesn't work in the cases of |
| 42 // CSS first-letter or character transform. See crbug.com/17528. | 42 // CSS first-letter or character transform. See crbug.com/17528. |
| 43 class SelectionPaintRange { | 43 class SelectionPaintRange { |
| 44 DISALLOW_NEW(); | 44 DISALLOW_NEW(); |
| 45 | 45 |
| 46 public: | 46 public: |
| 47 class Iterator |
| 48 : public std::iterator<std::input_iterator_tag, LayoutObject*> { |
| 49 public: |
| 50 explicit Iterator(const SelectionPaintRange*); |
| 51 Iterator(const Iterator&) = default; |
| 52 bool operator==(const Iterator& other) const { |
| 53 return current_ == other.current_; |
| 54 } |
| 55 bool operator!=(const Iterator& other) const { return !operator==(other); } |
| 56 Iterator& operator++(); |
| 57 LayoutObject* operator*() const; |
| 58 |
| 59 private: |
| 60 LayoutObject* current_; |
| 61 const LayoutObject* included_end_; |
| 62 const LayoutObject* stop_; |
| 63 }; |
| 64 Iterator begin() const { return Iterator(this); }; |
| 65 Iterator end() const { return Iterator(nullptr); }; |
| 66 |
| 47 SelectionPaintRange() = default; | 67 SelectionPaintRange() = default; |
| 48 SelectionPaintRange(LayoutObject* start_layout_object, | 68 SelectionPaintRange(LayoutObject* start_layout_object, |
| 49 int start_offset, | 69 int start_offset, |
| 50 LayoutObject* end_layout_object, | 70 LayoutObject* end_layout_object, |
| 51 int end_offset); | 71 int end_offset); |
| 52 | 72 |
| 53 bool operator==(const SelectionPaintRange& other) const; | 73 bool operator==(const SelectionPaintRange& other) const; |
| 54 | 74 |
| 55 LayoutObject* StartLayoutObject() const; | 75 LayoutObject* StartLayoutObject() const; |
| 56 int StartOffset() const; | 76 int StartOffset() const; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 110 |
| 91 Member<FrameSelection> frame_selection_; | 111 Member<FrameSelection> frame_selection_; |
| 92 bool has_pending_selection_ : 1; | 112 bool has_pending_selection_ : 1; |
| 93 | 113 |
| 94 SelectionPaintRange paint_range_; | 114 SelectionPaintRange paint_range_; |
| 95 }; | 115 }; |
| 96 | 116 |
| 97 } // namespace blink | 117 } // namespace blink |
| 98 | 118 |
| 99 #endif | 119 #endif |
| OLD | NEW |