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

Unified Diff: third_party/WebKit/Source/core/layout/LayoutText.h

Issue 2929763002: Introduce InlineTextBoxesOf() for ease of loop over InlineTextBox of LayoutText (Closed)
Patch Set: 2017-06-08T17:21:30 Revise variable name in ComputeInlineBoxPositionTempalte to make patch size smaller 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/layout/LayoutText.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutText.h b/third_party/WebKit/Source/core/layout/LayoutText.h
index e5b27c3e00d0ddbbbf96eb276807b334de6c27e0..550ab2dd3a52861e9372cdc3e0955f52accf931c 100644
--- a/third_party/WebKit/Source/core/layout/LayoutText.h
+++ b/third_party/WebKit/Source/core/layout/LayoutText.h
@@ -23,6 +23,7 @@
#ifndef LayoutText_h
#define LayoutText_h
+#include <iterator>
#include "core/CoreExport.h"
#include "core/dom/Text.h"
#include "core/layout/LayoutObject.h"
@@ -352,6 +353,39 @@ inline LayoutText* Text::GetLayoutObject() const {
return ToLayoutText(CharacterData::GetLayoutObject());
}
+// Represents list of |InlineTextBox| objects associated to |LayoutText| in
+// layout order.
+class InlineTextBoxRange {
+ public:
+ class Iterator
+ : public std::iterator<std::input_iterator_tag, InlineTextBox*> {
+ public:
+ explicit Iterator(InlineTextBox*);
+ Iterator(const Iterator&) = default;
+
+ Iterator& operator++();
+ InlineTextBox* operator*() const;
+
+ bool operator==(const Iterator& other) const {
+ return current_ == other.current_;
+ }
+ bool operator!=(const Iterator& other) const { return !operator==(other); }
+
+ private:
+ InlineTextBox* current_;
+ };
+
+ explicit InlineTextBoxRange(const LayoutText&);
+
+ Iterator begin() const { return Iterator(layout_text_->FirstTextBox()); }
+ Iterator end() const { return Iterator(nullptr); }
+
+ private:
+ const LayoutText* layout_text_;
+};
+
+InlineTextBoxRange InlineTextBoxesOf(const LayoutText&);
+
void ApplyTextTransform(const ComputedStyle*, String&, UChar);
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutInline.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698