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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.h

Issue 2541163003: Fix TextIterator's behavior with first-letter (Closed)
Patch Set: Mon Dec 5 18:00:48 JST 2016 Created 4 years 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/iterators/TextIterator.h
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.h b/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
index 92a004942be699cf510908f7a81f7e4840795c6f..713bcbb5f73143b830e276e4d682e85cfacd727e 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
@@ -138,6 +138,13 @@ class CORE_TEMPLATE_CLASS_EXPORT TextIteratorAlgorithm {
bool handleNonTextNode();
void handleTextBox();
void handleTextNodeFirstLetter(LayoutTextFragment*);
+ // Helper function during initialization. Returns true if the start position
+ // is in a text node with first-letter, in which case it also sets up related
+ // parameters. Returns false otherwise.
+ bool prepareForFirstLetterInitialization();
+ bool hasNotAdvancedToStartPosition();
+ int adjustedStartForFirstLetter(const Node&, const LayoutText&, int, int);
+ int adjustedStartForRemainingText(const Node&, const LayoutText&, int, int);
void spliceBuffer(UChar,
Node* textNode,
Node* offsetBaseNode,
@@ -257,6 +264,11 @@ class CORE_TEMPLATE_CLASS_EXPORT TextIteratorAlgorithm {
// |SelectionToStringWithShadowTree|, we should not use other purpose.
bool m_handleShadowRoot;
+ // Used for adjusting the initialization and the output when the start
+ // container is a text node with :first-letter.
+ int m_firstLetterStartOffset;
+ int m_remainingTextStartOffset;
+
// Contains state of emitted text.
TextIteratorTextState m_textState;
};

Powered by Google App Engine
This is Rietveld 408576698