Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 259 TrackExceptionState exceptionState; | 259 TrackExceptionState exceptionState; |
| 260 range->selectNodeContents(document->body(), exceptionState); | 260 range->selectNodeContents(document->body(), exceptionState); |
| 261 | 261 |
| 262 if (!exceptionState.hadException()) { | 262 if (!exceptionState.hadException()) { |
| 263 // The text iterator will walk nodes giving us text. This is similar to | 263 // The text iterator will walk nodes giving us text. This is similar to |
| 264 // the plainText() function in core/editing/TextIterator.h, but we imple ment the maximum | 264 // the plainText() function in core/editing/TextIterator.h, but we imple ment the maximum |
| 265 // size and also copy the results directly into a wstring, avoiding the | 265 // size and also copy the results directly into a wstring, avoiding the |
| 266 // string conversion. | 266 // string conversion. |
| 267 for (TextIterator it(range->startPosition(), range->endPosition()); !it. atEnd(); it.advance()) { | 267 for (TextIterator it(range->startPosition(), range->endPosition()); !it. atEnd(); it.advance()) { |
| 268 it.text().appendTextToStringBuilder(output, 0, maxChars - output.len gth()); | 268 it.text().appendTextToStringBuilder(output, 0, maxChars - output.len gth()); |
| 269 if (output.length() >= maxChars) | 269 if (output.length() >= maxChars) { |
| 270 range->dispose(); | |
|
yosin_UTC9
2015/09/10 01:58:39
Please introduce |ScopedRangeObject|, or better na
sof
2015/09/10 06:07:49
We have ScopedDisposal<T>, which is arguably more
| |
| 270 return; // Filled up the buffer. | 271 return; // Filled up the buffer. |
| 272 } | |
| 271 } | 273 } |
| 272 } | 274 } |
| 275 range->dispose(); | |
| 273 | 276 |
| 274 // The separator between frames when the frames are converted to plain text. | 277 // The separator between frames when the frames are converted to plain text. |
| 275 const LChar frameSeparator[] = { '\n', '\n' }; | 278 const LChar frameSeparator[] = { '\n', '\n' }; |
| 276 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator); | 279 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator); |
| 277 | 280 |
| 278 // Recursively walk the children. | 281 // Recursively walk the children. |
| 279 const FrameTree& frameTree = frame->tree(); | 282 const FrameTree& frameTree = frame->tree(); |
| 280 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild ->tree().nextSibling()) { | 283 for (Frame* curChild = frameTree.firstChild(); curChild; curChild = curChild ->tree().nextSibling()) { |
| 281 if (!curChild->isLocalFrame()) | 284 if (!curChild->isLocalFrame()) |
| 282 continue; | 285 continue; |
| (...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2193 } | 2196 } |
| 2194 | 2197 |
| 2195 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2198 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
| 2196 { | 2199 { |
| 2197 if (!frame()) | 2200 if (!frame()) |
| 2198 return WebSandboxFlags::None; | 2201 return WebSandboxFlags::None; |
| 2199 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); | 2202 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); |
| 2200 } | 2203 } |
| 2201 | 2204 |
| 2202 } // namespace blink | 2205 } // namespace blink |
| OLD | NEW |