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 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 { | 436 { |
437 bool didSerialization = false; | 437 bool didSerialization = false; |
438 | 438 |
439 Document* document = m_specifiedWebLocalFrameImpl->frame()->document(); | 439 Document* document = m_specifiedWebLocalFrameImpl->frame()->document(); |
440 const KURL& url = document->url(); | 440 const KURL& url = document->url(); |
441 | 441 |
442 if (url.isValid()) { | 442 if (url.isValid()) { |
443 didSerialization = true; | 443 didSerialization = true; |
444 | 444 |
445 const WTF::TextEncoding& textEncoding = document->encoding().isValid() ?
document->encoding() : UTF8Encoding(); | 445 const WTF::TextEncoding& textEncoding = document->encoding().isValid() ?
document->encoding() : UTF8Encoding(); |
| 446 if (textEncoding.isNonByteBasedEncoding()) { |
| 447 const UChar byteOrderMark = 0xFEFF; |
| 448 m_dataBuffer.append(byteOrderMark); |
| 449 } |
446 | 450 |
447 SerializeDomParam param(url, textEncoding, document); | 451 SerializeDomParam param(url, textEncoding, document); |
448 | 452 |
449 Element* documentElement = document->documentElement(); | 453 Element* documentElement = document->documentElement(); |
450 if (documentElement) | 454 if (documentElement) |
451 buildContentForNode(documentElement, ¶m); | 455 buildContentForNode(documentElement, ¶m); |
452 | 456 |
453 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); | 457 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); |
454 } else { | 458 } else { |
455 // Report empty contents for invalid URLs. | 459 // Report empty contents for invalid URLs. |
456 m_client->didSerializeDataForFrame( | 460 m_client->didSerializeDataForFrame( |
457 WebCString(), WebPageSerializerClient::CurrentFrameIsFinished); | 461 WebCString(), WebPageSerializerClient::CurrentFrameIsFinished); |
458 } | 462 } |
459 | 463 |
460 ASSERT(m_dataBuffer.isEmpty()); | 464 ASSERT(m_dataBuffer.isEmpty()); |
461 return didSerialization; | 465 return didSerialization; |
462 } | 466 } |
463 | 467 |
464 } // namespace blink | 468 } // namespace blink |
OLD | NEW |