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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
248 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu ilder& output) | 248 static void frameContentAsPlainText(size_t maxChars, LocalFrame* frame, StringBu ilder& output) |
249 { | 249 { |
250 Document* document = frame->document(); | 250 Document* document = frame->document(); |
251 if (!document) | 251 if (!document) |
252 return; | 252 return; |
253 | 253 |
254 if (!frame->view()) | 254 if (!frame->view()) |
255 return; | 255 return; |
256 | 256 |
257 // Select the document body. | 257 // Select the document body. |
258 RefPtrWillBeRawPtr<Range> range(document->createRange()); | 258 RefPtrWillBeRawPtr<Range> range(document->createRange()); |
yosin_UTC9
2015/09/11 07:07:19
Thus, we don't need to use |Range|.
We may want to
sof
2015/09/11 07:11:42
I'm sorry, spaced out completely - we clearly don'
| |
259 TrackExceptionState exceptionState; | 259 ScopedDisposal<Range> disposeScope(range.get()); |
260 range->selectNodeContents(document->body(), exceptionState); | |
261 | 260 |
262 if (!exceptionState.hadException()) { | 261 if (document->body()) { |
262 const EphemeralRange range = EphemeralRange::rangeOfContents(*document-> body()); | |
263 | |
263 // The text iterator will walk nodes giving us text. This is similar to | 264 // 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 | 265 // 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 | 266 // size and also copy the results directly into a wstring, avoiding the |
266 // string conversion. | 267 // string conversion. |
267 for (TextIterator it(range->startPosition(), range->endPosition()); !it. atEnd(); it.advance()) { | 268 for (TextIterator it(range.startPosition(), range.endPosition()); !it.at End(); it.advance()) { |
268 it.text().appendTextToStringBuilder(output, 0, maxChars - output.len gth()); | 269 it.text().appendTextToStringBuilder(output, 0, maxChars - output.len gth()); |
269 if (output.length() >= maxChars) | 270 if (output.length() >= maxChars) |
270 return; // Filled up the buffer. | 271 return; // Filled up the buffer. |
271 } | 272 } |
272 } | 273 } |
273 | 274 |
274 // The separator between frames when the frames are converted to plain text. | 275 // The separator between frames when the frames are converted to plain text. |
275 const LChar frameSeparator[] = { '\n', '\n' }; | 276 const LChar frameSeparator[] = { '\n', '\n' }; |
276 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator); | 277 const size_t frameSeparatorLength = WTF_ARRAY_LENGTH(frameSeparator); |
277 | 278 |
(...skipping 1915 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2193 } | 2194 } |
2194 | 2195 |
2195 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const | 2196 WebSandboxFlags WebLocalFrameImpl::effectiveSandboxFlags() const |
2196 { | 2197 { |
2197 if (!frame()) | 2198 if (!frame()) |
2198 return WebSandboxFlags::None; | 2199 return WebSandboxFlags::None; |
2199 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); | 2200 return static_cast<WebSandboxFlags>(frame()->loader().effectiveSandboxFlags( )); |
2200 } | 2201 } |
2201 | 2202 |
2202 } // namespace blink | 2203 } // namespace blink |
OLD | NEW |