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

Unified Diff: components/test_runner/layout_dump.cc

Issue 1689283003: Remove duplication between TestRunner's fields and LayoutDumpFlags struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Despite LayoutDumpFlags constructor, we still need to set the flags in TestRunner::Reset. Created 4 years, 10 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
« no previous file with comments | « no previous file | components/test_runner/layout_dump_flags.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/test_runner/layout_dump.cc
diff --git a/components/test_runner/layout_dump.cc b/components/test_runner/layout_dump.cc
index ac5b5d409fc528d5ebfcf7688f3ff7f0a810979f..02a90ee7f100d5226360165d10b961fd04de6882 100644
--- a/components/test_runner/layout_dump.cc
+++ b/components/test_runner/layout_dump.cc
@@ -57,45 +57,37 @@ std::string DumpLayout(WebLocalFrame* frame, const LayoutDumpFlags& flags) {
DCHECK(frame);
std::string result;
- switch (flags.main_dump_mode) {
- case LayoutDumpMode::DUMP_AS_TEXT:
- result = DumpFrameHeaderIfNeeded(frame);
- if (flags.dump_as_printed && frame->document().isHTMLDocument()) {
- result += WebFrameContentDumper::dumpLayoutTreeAsText(
- frame, WebFrameContentDumper::LayoutAsTextPrinting)
- .utf8();
- } else {
- result += frame->document().contentAsTextForTesting().utf8();
- }
- result += "\n";
- break;
- case LayoutDumpMode::DUMP_AS_MARKUP:
- DCHECK(!flags.dump_as_printed);
- result = DumpFrameHeaderIfNeeded(frame);
- result += WebFrameContentDumper::dumpAsMarkup(frame).utf8();
- result += "\n";
- break;
- case LayoutDumpMode::DUMP_SCROLL_POSITIONS:
- if (frame->parent() == nullptr) {
- WebFrameContentDumper::LayoutAsTextControls layout_text_behavior =
- WebFrameContentDumper::LayoutAsTextNormal;
- if (flags.dump_as_printed)
- layout_text_behavior |= WebFrameContentDumper::LayoutAsTextPrinting;
- if (flags.debug_render_tree)
- layout_text_behavior |= WebFrameContentDumper::LayoutAsTextDebug;
- if (flags.dump_line_box_trees)
- layout_text_behavior |=
- WebFrameContentDumper::LayoutAsTextWithLineTrees;
- result = WebFrameContentDumper::dumpLayoutTreeAsText(
- frame, layout_text_behavior)
- .utf8();
- }
- result += DumpFrameScrollPosition(frame);
- break;
- default:
- DCHECK(false) << static_cast<int>(flags.main_dump_mode);
- result = "";
- break;
+ if (flags.dump_as_text) {
+ result = DumpFrameHeaderIfNeeded(frame);
+ if (flags.is_printing && frame->document().isHTMLDocument()) {
+ result += WebFrameContentDumper::dumpLayoutTreeAsText(
+ frame, WebFrameContentDumper::LayoutAsTextPrinting)
+ .utf8();
+ } else {
+ result += frame->document().contentAsTextForTesting().utf8();
+ }
+ result += "\n";
+ } else if (flags.dump_as_markup) {
+ DCHECK(!flags.is_printing);
+ result = DumpFrameHeaderIfNeeded(frame);
+ result += WebFrameContentDumper::dumpAsMarkup(frame).utf8();
+ result += "\n";
+ } else {
+ if (frame->parent() == nullptr) {
+ WebFrameContentDumper::LayoutAsTextControls layout_text_behavior =
+ WebFrameContentDumper::LayoutAsTextNormal;
+ if (flags.is_printing)
+ layout_text_behavior |= WebFrameContentDumper::LayoutAsTextPrinting;
+ if (flags.debug_render_tree)
+ layout_text_behavior |= WebFrameContentDumper::LayoutAsTextDebug;
+ if (flags.dump_line_box_trees)
+ layout_text_behavior |=
+ WebFrameContentDumper::LayoutAsTextWithLineTrees;
+ result = WebFrameContentDumper::dumpLayoutTreeAsText(frame,
+ layout_text_behavior)
+ .utf8();
+ }
+ result += DumpFrameScrollPosition(frame);
}
return result;
« no previous file with comments | « no previous file | components/test_runner/layout_dump_flags.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698