OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006, 2009 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 bool ShouldEmitSpaceBeforeAndAfterNode(Node*); | 135 bool ShouldEmitSpaceBeforeAndAfterNode(Node*); |
136 void RepresentNodeOffsetZero(); | 136 void RepresentNodeOffsetZero(); |
137 bool HandleTextNode(); | 137 bool HandleTextNode(); |
138 bool HandleReplacedElement(); | 138 bool HandleReplacedElement(); |
139 bool HandleNonTextNode(); | 139 bool HandleNonTextNode(); |
140 void HandleTextBox(); | 140 void HandleTextBox(); |
141 void HandleTextNodeFirstLetter(LayoutTextFragment*); | 141 void HandleTextNodeFirstLetter(LayoutTextFragment*); |
142 bool ShouldHandleFirstLetter(const LayoutText&) const; | 142 bool ShouldHandleFirstLetter(const LayoutText&) const; |
143 bool ShouldProceedToRemainingText() const; | 143 bool ShouldProceedToRemainingText() const; |
144 void ProceedToRemainingText(); | 144 void ProceedToRemainingText(); |
145 // Helper function during initialization. Returns true if the start position | |
146 // is in a text node with first-letter, in which case it also sets up related | |
147 // parameters. Returns false otherwise. | |
148 bool PrepareForFirstLetterInitialization(); | |
149 bool HasNotAdvancedToStartPosition(); | |
150 int AdjustedStartForFirstLetter(const Node&, const LayoutText&, int, int); | |
151 int AdjustedStartForRemainingText(const Node&, const LayoutText&, int, int); | |
152 void SpliceBuffer(UChar, | 145 void SpliceBuffer(UChar, |
153 Node* text_node, | 146 Node* text_node, |
154 Node* offset_base_node, | 147 Node* offset_base_node, |
155 int text_start_offset, | 148 int text_start_offset, |
156 int text_end_offset); | 149 int text_end_offset); |
157 void EmitText(Node* text_node, | 150 void EmitText(Node* text_node, |
158 LayoutText* layout_object, | 151 LayoutText* layout_object, |
159 int text_start_offset, | 152 int text_start_offset, |
160 int text_end_offset); | 153 int text_end_offset); |
161 size_t RestoreCollapsedTrailingSpace(InlineTextBox* next_text_box, | 154 size_t RestoreCollapsedTrailingSpace(InlineTextBox* next_text_box, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // Used when deciding text fragment created by :first-letter should be looked | 245 // Used when deciding text fragment created by :first-letter should be looked |
253 // into. | 246 // into. |
254 bool handled_first_letter_; | 247 bool handled_first_letter_; |
255 // Used when stopsOnFormControls() is true to determine if the iterator should | 248 // Used when stopsOnFormControls() is true to determine if the iterator should |
256 // keep advancing. | 249 // keep advancing. |
257 bool should_stop_; | 250 bool should_stop_; |
258 // Used for use counter |InnerTextWithShadowTree| and | 251 // Used for use counter |InnerTextWithShadowTree| and |
259 // |SelectionToStringWithShadowTree|, we should not use other purpose. | 252 // |SelectionToStringWithShadowTree|, we should not use other purpose. |
260 bool handle_shadow_root_; | 253 bool handle_shadow_root_; |
261 | 254 |
262 // Used for adjusting the initialization and the output when the start | |
263 // container is a text node with :first-letter. | |
264 int first_letter_start_offset_; | |
265 int remaining_text_start_offset_; | |
266 | |
267 // Contains state of emitted text. | 255 // Contains state of emitted text. |
268 TextIteratorTextState text_state_; | 256 TextIteratorTextState text_state_; |
269 }; | 257 }; |
270 | 258 |
271 extern template class CORE_EXTERN_TEMPLATE_EXPORT | 259 extern template class CORE_EXTERN_TEMPLATE_EXPORT |
272 TextIteratorAlgorithm<EditingStrategy>; | 260 TextIteratorAlgorithm<EditingStrategy>; |
273 extern template class CORE_EXTERN_TEMPLATE_EXPORT | 261 extern template class CORE_EXTERN_TEMPLATE_EXPORT |
274 TextIteratorAlgorithm<EditingInFlatTreeStrategy>; | 262 TextIteratorAlgorithm<EditingInFlatTreeStrategy>; |
275 | 263 |
276 using TextIterator = TextIteratorAlgorithm<EditingStrategy>; | 264 using TextIterator = TextIteratorAlgorithm<EditingStrategy>; |
277 using TextIteratorInFlatTree = TextIteratorAlgorithm<EditingInFlatTreeStrategy>; | 265 using TextIteratorInFlatTree = TextIteratorAlgorithm<EditingInFlatTreeStrategy>; |
278 | 266 |
279 } // namespace blink | 267 } // namespace blink |
280 | 268 |
281 #endif // TextIterator_h | 269 #endif // TextIterator_h |
OLD | NEW |