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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp

Issue 1845363003: String replaceWithLiteral should just use strlen, also rename to replace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Another NUL fix. Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 << " pos=(" << box.x() << "," << box.y() << ")" 413 << " pos=(" << box.x() << "," << box.y() << ")"
414 << " size=(" << box.width() << "," << box.height() << ")" 414 << " size=(" << box.width() << "," << box.height() << ")"
415 << " baseline=" << box.baselinePosition(AlphabeticBaseline) 415 << " baseline=" << box.baselinePosition(AlphabeticBaseline)
416 << "/" << box.baselinePosition(IdeographicBaseline); 416 << "/" << box.baselinePosition(IdeographicBaseline);
417 } 417 }
418 418
419 static void writeInlineTextBox(TextStream& ts, const InlineTextBox& textBox, int indent) 419 static void writeInlineTextBox(TextStream& ts, const InlineTextBox& textBox, int indent)
420 { 420 {
421 writeInlineBox(ts, textBox, indent); 421 writeInlineBox(ts, textBox, indent);
422 String value = textBox.text(); 422 String value = textBox.text();
423 value.replaceWithLiteral('\\', "\\\\"); 423 value.replace('\\', "\\\\");
424 value.replaceWithLiteral('\n', "\\n"); 424 value.replace('\n', "\\n");
425 value.replaceWithLiteral('"', "\\\""); 425 value.replace('"', "\\\"");
426 ts << " range=(" << textBox.start() << "," << (textBox.start() + textBox.len ()) << ")" 426 ts << " range=(" << textBox.start() << "," << (textBox.start() + textBox.len ()) << ")"
427 << " \"" << value << "\""; 427 << " \"" << value << "\"";
428 } 428 }
429 429
430 static void writeInlineFlowBox(TextStream& ts, const InlineFlowBox& rootBox, int indent) 430 static void writeInlineFlowBox(TextStream& ts, const InlineFlowBox& rootBox, int indent)
431 { 431 {
432 writeInlineBox(ts, rootBox, indent); 432 writeInlineBox(ts, rootBox, indent);
433 ts << "\n"; 433 ts << "\n";
434 for (const InlineBox* box = rootBox.firstChild(); box; box = box->nextOnLine ()) { 434 for (const InlineBox* box = rootBox.firstChild(); box; box = box->nextOnLine ()) {
435 if (box->isInlineFlowBox()) { 435 if (box->isInlineFlowBox()) {
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 element->document().updateLayout(); 845 element->document().updateLayout();
846 846
847 LayoutObject* layoutObject = element->layoutObject(); 847 LayoutObject* layoutObject = element->layoutObject();
848 if (!layoutObject || !layoutObject->isListItem()) 848 if (!layoutObject || !layoutObject->isListItem())
849 return String(); 849 return String();
850 850
851 return toLayoutListItem(layoutObject)->markerText(); 851 return toLayoutListItem(layoutObject)->markerText();
852 } 852 }
853 853
854 } // namespace blink 854 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698