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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.cpp

Issue 2915043004: Put TextIteratorTextNodeHandler and TextIteratorTextState on heap (Closed)
Patch Set: const Member<> Created 3 years, 7 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/iterators/TextIteratorTextNodeHandler.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.cpp
index be88802eb9f65a5b1e9033ed0943c653caf1bcc8..d96e3c7053135e51d25b3563abad2137289ba393 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextNodeHandler.cpp
@@ -16,7 +16,12 @@ namespace blink {
TextIteratorTextNodeHandler::TextIteratorTextNodeHandler(
const TextIteratorBehavior& behavior,
TextIteratorTextState* text_state)
- : behavior_(behavior), text_state_(*text_state) {}
+ : behavior_(behavior), text_state_(text_state) {}
+
+DEFINE_TRACE(TextIteratorTextNodeHandler) {
+ visitor->Trace(text_node_);
+ visitor->Trace(text_state_);
+}
bool TextIteratorTextNodeHandler::HandleRemainingTextRuns() {
if (ShouldProceedToRemainingText())
@@ -24,13 +29,13 @@ bool TextIteratorTextNodeHandler::HandleRemainingTextRuns() {
// Handle remembered text box
if (text_box_) {
HandleTextBox();
- return text_state_.PositionNode();
+ return text_state_->PositionNode();
}
// Handle remembered pre-formatted text node.
if (!needs_handle_pre_formatted_text_node_)
return false;
HandlePreFormattedTextNode();
- return text_state_.PositionNode();
+ return text_state_->PositionNode();
}
bool TextIteratorTextNodeHandler::ShouldHandleFirstLetter(
@@ -256,8 +261,8 @@ void TextIteratorTextNodeHandler::HandleTextBox() {
text_box_start == run_start && run_start > 0);
if (need_space &&
!layout_object->Style()->IsCollapsibleWhiteSpace(
- text_state_.LastCharacter()) &&
- text_state_.LastCharacter()) {
+ text_state_->LastCharacter()) &&
+ text_state_->LastCharacter()) {
if (run_start > 0 && str[run_start - 1] == ' ') {
unsigned space_run_start = run_start - 1;
while (space_run_start > 0 && str[space_run_start - 1] == ' ')
@@ -324,7 +329,7 @@ void TextIteratorTextNodeHandler::HandleTextBox() {
// If we are doing a subrun that doesn't go to the end of the text box,
// come back again to finish handling this text box; don't advance to
// the next one.
- if (static_cast<unsigned>(text_state_.PositionEndOffset()) <
+ if (static_cast<unsigned>(text_state_->PositionEndOffset()) <
text_box_end)
return;
@@ -436,8 +441,8 @@ void TextIteratorTextNodeHandler::SpliceBuffer(UChar c,
Node* offset_base_node,
int text_start_offset,
int text_end_offset) {
- text_state_.SpliceBuffer(c, text_node, offset_base_node, text_start_offset,
- text_end_offset);
+ text_state_->SpliceBuffer(c, text_node, offset_base_node, text_start_offset,
+ text_end_offset);
ResetCollapsedWhiteSpaceFixup();
}
@@ -445,8 +450,8 @@ void TextIteratorTextNodeHandler::EmitText(Node* text_node,
LayoutText* layout_object,
int text_start_offset,
int text_end_offset) {
- text_state_.EmitText(text_node, layout_object, text_start_offset,
- text_end_offset);
+ text_state_->EmitText(text_node, layout_object, text_start_offset,
+ text_end_offset);
ResetCollapsedWhiteSpaceFixup();
}

Powered by Google App Engine
This is Rietveld 408576698