Index: third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp |
diff --git a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp |
index 4b3a42362b633b4b2c19c5b15b78175ffc3315f8..cb53150f2e5e31387989e45582d80afdae00758d 100644 |
--- a/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp |
+++ b/third_party/WebKit/Source/core/layout/LayoutTreeAsText.cpp |
@@ -818,13 +818,17 @@ String ExternalRepresentation(LocalFrame* frame, |
return String(); |
PrintContext print_context(frame); |
- if (behavior & kLayoutAsTextPrintingMode) { |
+ bool is_text_printing_mode = !!(behavior & kLayoutAsTextPrintingMode); |
+ if (is_text_printing_mode) { |
FloatSize size(ToLayoutBox(layout_object)->Size()); |
print_context.begin(size.Width(), size.Height()); |
} |
- return ExternalRepresentation(ToLayoutBox(layout_object), behavior, |
- marked_layer); |
+ String representation = ExternalRepresentation(ToLayoutBox(layout_object), |
+ behavior, marked_layer); |
+ if (is_text_printing_mode) |
+ print_context.end(); |
+ return representation; |
} |
String ExternalRepresentation(Element* element, LayoutAsTextBehavior behavior) { |