| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/test_runner/layout_dump.h" | 5 #include "components/test_runner/layout_dump.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "third_party/WebKit/public/platform/WebSize.h" | 9 #include "third_party/WebKit/public/platform/WebSize.h" |
| 10 #include "third_party/WebKit/public/platform/WebString.h" | 10 #include "third_party/WebKit/public/platform/WebString.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 return result; | 51 return result; |
| 52 } | 52 } |
| 53 | 53 |
| 54 } // namespace | 54 } // namespace |
| 55 | 55 |
| 56 std::string DumpLayout(WebLocalFrame* frame, const LayoutDumpFlags& flags) { | 56 std::string DumpLayout(WebLocalFrame* frame, const LayoutDumpFlags& flags) { |
| 57 DCHECK(frame); | 57 DCHECK(frame); |
| 58 std::string result; | 58 std::string result; |
| 59 | 59 |
| 60 if (flags.dump_as_text) { | 60 if (flags.dump_as_text()) { |
| 61 result = DumpFrameHeaderIfNeeded(frame); | 61 result = DumpFrameHeaderIfNeeded(frame); |
| 62 if (flags.is_printing && frame->document().isHTMLDocument()) { | 62 if (flags.is_printing() && frame->document().isHTMLDocument()) { |
| 63 result += WebFrameContentDumper::dumpLayoutTreeAsText( | 63 result += WebFrameContentDumper::dumpLayoutTreeAsText( |
| 64 frame, WebFrameContentDumper::LayoutAsTextPrinting) | 64 frame, WebFrameContentDumper::LayoutAsTextPrinting) |
| 65 .utf8(); | 65 .utf8(); |
| 66 } else { | 66 } else { |
| 67 result += frame->document().contentAsTextForTesting().utf8(); | 67 result += frame->document().contentAsTextForTesting().utf8(); |
| 68 } | 68 } |
| 69 result += "\n"; | 69 result += "\n"; |
| 70 } else if (flags.dump_as_markup) { | 70 } else if (flags.dump_as_markup()) { |
| 71 DCHECK(!flags.is_printing); | 71 DCHECK(!flags.is_printing()); |
| 72 result = DumpFrameHeaderIfNeeded(frame); | 72 result = DumpFrameHeaderIfNeeded(frame); |
| 73 result += WebFrameContentDumper::dumpAsMarkup(frame).utf8(); | 73 result += WebFrameContentDumper::dumpAsMarkup(frame).utf8(); |
| 74 result += "\n"; | 74 result += "\n"; |
| 75 } else { | 75 } else { |
| 76 if (frame->parent() == nullptr) { | 76 if (frame->parent() == nullptr) { |
| 77 WebFrameContentDumper::LayoutAsTextControls layout_text_behavior = | 77 WebFrameContentDumper::LayoutAsTextControls layout_text_behavior = |
| 78 WebFrameContentDumper::LayoutAsTextNormal; | 78 WebFrameContentDumper::LayoutAsTextNormal; |
| 79 if (flags.is_printing) | 79 if (flags.is_printing()) |
| 80 layout_text_behavior |= WebFrameContentDumper::LayoutAsTextPrinting; | 80 layout_text_behavior |= WebFrameContentDumper::LayoutAsTextPrinting; |
| 81 result = WebFrameContentDumper::dumpLayoutTreeAsText(frame, | 81 result = WebFrameContentDumper::dumpLayoutTreeAsText(frame, |
| 82 layout_text_behavior) | 82 layout_text_behavior) |
| 83 .utf8(); | 83 .utf8(); |
| 84 } | 84 } |
| 85 result += DumpFrameScrollPosition(frame); | 85 result += DumpFrameScrollPosition(frame); |
| 86 } | 86 } |
| 87 | 87 |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace test_runner | 91 } // namespace test_runner |
| OLD | NEW |