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 #ifndef WebFrameContentDumper_h | 5 #ifndef WebFrameContentDumper_h |
6 #define WebFrameContentDumper_h | 6 #define WebFrameContentDumper_h |
7 | 7 |
8 #include "public/platform/WebCommon.h" | 8 #include "public/platform/WebCommon.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class WebLocalFrame; | 12 class WebLocalFrame; |
| 13 class WebView; |
13 class WebString; | 14 class WebString; |
14 | 15 |
15 // Functions in this class should only be used for | 16 // Functions in this class should only be used for |
16 // testing purposes. | 17 // testing purposes. |
17 // The exceptions to this rule are tracked in http://crbug.com/585164. | 18 // The exceptions to this rule are tracked in http://crbug.com/585164. |
18 class WebFrameContentDumper { | 19 class WebFrameContentDumper { |
19 public: | 20 public: |
20 // Control of layoutTreeAsText output | 21 // Control of layoutTreeAsText output |
21 enum LayoutAsTextControl { | 22 enum LayoutAsTextControl { |
22 LayoutAsTextNormal = 0, | 23 LayoutAsTextNormal = 0, |
23 LayoutAsTextDebug = 1 << 0, | 24 LayoutAsTextDebug = 1 << 0, |
24 LayoutAsTextPrinting = 1 << 1, | 25 LayoutAsTextPrinting = 1 << 1, |
25 LayoutAsTextWithLineTrees = 1 << 2 | 26 LayoutAsTextWithLineTrees = 1 << 2 |
26 }; | 27 }; |
27 typedef unsigned LayoutAsTextControls; | 28 typedef unsigned LayoutAsTextControls; |
28 | 29 |
29 // Returns the contents of this frame as a string. If the text is | 30 // Returns the contents of this frame as a string. If the text is |
30 // longer than maxChars, it will be clipped to that length. WARNING: | 31 // longer than maxChars, it will be clipped to that length. |
31 // This function may be slow depending on the number of characters | |
32 // retrieved and page complexity. For a typically sized page, expect | |
33 // it to take on the order of milliseconds. | |
34 // | 32 // |
35 // If there is room, subframe text will be recursively appended. Each | 33 // If there is room, subframe text will be recursively appended. Each |
36 // frame will be separated by an empty line. | 34 // frame will be separated by an empty line. |
37 BLINK_EXPORT static WebString dumpFrameTreeAsText(WebLocalFrame*, size_t max
Chars); | 35 // TODO(dglazkov): WebFrameContentDumper should only be used for |
| 36 // testing purposes and this function is being deprecated. |
| 37 // Don't add new callsites, please. |
| 38 // See http://crbug.com/585164 for details. |
| 39 BLINK_EXPORT static WebString deprecatedDumpFrameTreeAsText(WebLocalFrame*,
size_t maxChars); |
| 40 |
| 41 // Dumps the contents of of a WebView as text, starting from the main |
| 42 // frame and recursively appending every subframe, separated by an |
| 43 // empty line. |
| 44 BLINK_EXPORT static WebString dumpWebViewAsText(WebView*, size_t maxChars); |
38 | 45 |
39 // Returns HTML text for the contents of this frame, generated | 46 // Returns HTML text for the contents of this frame, generated |
40 // from the DOM. | 47 // from the DOM. |
41 BLINK_EXPORT static WebString dumpAsMarkup(WebLocalFrame*); | 48 BLINK_EXPORT static WebString dumpAsMarkup(WebLocalFrame*); |
42 | 49 |
43 // Returns a text representation of the render tree. This method is used | 50 // Returns a text representation of the render tree. This method is used |
44 // to support layout tests. | 51 // to support layout tests. |
45 BLINK_EXPORT static WebString dumpLayoutTreeAsText(WebLocalFrame*, LayoutAsT
extControls toShow = LayoutAsTextNormal); | 52 BLINK_EXPORT static WebString dumpLayoutTreeAsText(WebLocalFrame*, LayoutAsT
extControls toShow = LayoutAsTextNormal); |
46 }; | 53 }; |
47 | 54 |
48 } // namespace blink | 55 } // namespace blink |
49 | 56 |
50 #endif | 57 #endif |
OLD | NEW |