Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(219)

Unified Diff: third_party/WebKit/Source/core/editing/LayoutSelection.h

Issue 2921863002: Introduce range-based for loop in LayoutSelection. (Closed)
Patch Set: update Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 272d016a9fab7f6db869dfee5159145c5c935ff4..3e7686f65f7ae6b259dfc007dff0644652a35f70 100644
--- a/third_party/WebKit/Source/core/editing/LayoutSelection.h
+++ b/third_party/WebKit/Source/core/editing/LayoutSelection.h
@@ -44,6 +44,26 @@ class SelectionPaintRange {
DISALLOW_NEW();
public:
+ class Iterator
+ : public std::iterator<std::input_iterator_tag, LayoutObject*> {
+ public:
+ explicit Iterator(const SelectionPaintRange*);
+ Iterator(const Iterator&) = default;
+ bool operator==(const Iterator& other) const {
+ return current_ == other.current_;
+ }
+ bool operator!=(const Iterator& other) const { return !operator==(other); }
+ Iterator& operator++();
+ LayoutObject* operator*() const;
+
+ private:
+ LayoutObject* current_;
+ const LayoutObject* included_end_;
+ const LayoutObject* stop_;
+ };
+ Iterator begin() const { return Iterator(this); };
+ Iterator end() const { return Iterator(nullptr); };
+
SelectionPaintRange() = default;
SelectionPaintRange(LayoutObject* start_layout_object,
int start_offset,

Powered by Google App Engine
This is Rietveld 408576698