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 "public/web/WebFrameContentDumper.h" | 5 #include "public/web/WebFrameContentDumper.h" |
6 | 6 |
7 #include "core/editing/EphemeralRange.h" | 7 #include "core/editing/EphemeralRange.h" |
8 #include "core/editing/iterators/TextIterator.h" | 8 #include "core/editing/iterators/TextIterator.h" |
9 #include "core/editing/serializers/Serialization.h" | 9 #include "core/editing/serializers/Serialization.h" |
10 #include "core/frame/FrameView.h" | 10 #include "core/frame/FrameView.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 const FrameTree& frameTree = frame->tree(); | 55 const FrameTree& frameTree = frame->tree(); |
56 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild
->tree().nextSibling()) { | 56 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild
->tree().nextSibling()) { |
57 if (!curChild->isLocalFrame()) | 57 if (!curChild->isLocalFrame()) |
58 continue; | 58 continue; |
59 LocalFrame* curLocalChild = toLocalFrame(curChild); | 59 LocalFrame* curLocalChild = toLocalFrame(curChild); |
60 // Ignore the text of non-visible frames. | 60 // Ignore the text of non-visible frames. |
61 LayoutViewItem contentLayoutItem = curLocalChild->contentLayoutItem(); | 61 LayoutViewItem contentLayoutItem = curLocalChild->contentLayoutItem(); |
62 LayoutPart* ownerLayoutObject = curLocalChild->ownerLayoutObject(); | 62 LayoutPart* ownerLayoutObject = curLocalChild->ownerLayoutObject(); |
63 if (contentLayoutItem.isNull() || !contentLayoutItem.size().width() || !
contentLayoutItem.size().height() | 63 if (contentLayoutItem.isNull() || !contentLayoutItem.size().width() || !
contentLayoutItem.size().height() |
64 || (contentLayoutItem.location().x() + contentLayoutItem.size().widt
h() <= 0) || (contentLayoutItem.location().y() + contentLayoutItem.size().height
() <= 0) | 64 || (contentLayoutItem.location().x() + contentLayoutItem.size().widt
h() <= 0) || (contentLayoutItem.location().y() + contentLayoutItem.size().height
() <= 0) |
65 || (ownerLayoutObject && ownerLayoutObject->style() && ownerLayoutOb
ject->style()->visibility() != VISIBLE)) { | 65 || (ownerLayoutObject && ownerLayoutObject->style() && ownerLayoutOb
ject->style()->visibility() != EVisibility::Visible)) { |
66 continue; | 66 continue; |
67 } | 67 } |
68 | 68 |
69 // Make sure the frame separator won't fill up the buffer, and give up i
f | 69 // Make sure the frame separator won't fill up the buffer, and give up i
f |
70 // it will. The danger is if the separator will make the buffer longer t
han | 70 // it will. The danger is if the separator will make the buffer longer t
han |
71 // maxChars. This will cause the computation above: | 71 // maxChars. This will cause the computation above: |
72 // maxChars - output->size() | 72 // maxChars - output->size() |
73 // to be a negative number which will crash when the subframe is added. | 73 // to be a negative number which will crash when the subframe is added. |
74 if (output.length() >= maxChars - frameSeparatorLength) | 74 if (output.length() >= maxChars - frameSeparatorLength) |
75 return; | 75 return; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 | 115 |
116 if (toShow & LayoutAsTextDebug) | 116 if (toShow & LayoutAsTextDebug) |
117 behavior |= LayoutAsTextShowCompositedLayers | LayoutAsTextShowAddresses
| LayoutAsTextShowIDAndClass | LayoutAsTextShowLayerNesting; | 117 behavior |= LayoutAsTextShowCompositedLayers | LayoutAsTextShowAddresses
| LayoutAsTextShowIDAndClass | LayoutAsTextShowLayerNesting; |
118 | 118 |
119 if (toShow & LayoutAsTextPrinting) | 119 if (toShow & LayoutAsTextPrinting) |
120 behavior |= LayoutAsTextPrintingMode; | 120 behavior |= LayoutAsTextPrintingMode; |
121 | 121 |
122 return externalRepresentation(toWebLocalFrameImpl(frame)->frame(), behavior)
; | 122 return externalRepresentation(toWebLocalFrameImpl(frame)->frame(), behavior)
; |
123 } | 123 } |
124 } | 124 } |
OLD | NEW |