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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 // Comment the BASE tag when serializing dom. | 162 // Comment the BASE tag when serializing dom. |
163 result.append("<!--"); | 163 result.append("<!--"); |
164 } | 164 } |
165 } else { | 165 } else { |
166 // Write XML declaration. | 166 // Write XML declaration. |
167 if (!param->haveAddedXMLProcessingDirective) { | 167 if (!param->haveAddedXMLProcessingDirective) { |
168 param->haveAddedXMLProcessingDirective = true; | 168 param->haveAddedXMLProcessingDirective = true; |
169 // Get encoding info. | 169 // Get encoding info. |
170 String xmlEncoding = param->document->xmlEncoding(); | 170 String xmlEncoding = param->document->xmlEncoding(); |
171 if (xmlEncoding.isEmpty()) | 171 if (xmlEncoding.isEmpty()) |
172 xmlEncoding = param->document->encoding(); | 172 xmlEncoding = param->document->encodingName(); |
173 if (xmlEncoding.isEmpty()) | 173 if (xmlEncoding.isEmpty()) |
174 xmlEncoding = UTF8Encoding().name(); | 174 xmlEncoding = UTF8Encoding().name(); |
175 result.append("<?xml version=\""); | 175 result.append("<?xml version=\""); |
176 result.append(param->document->xmlVersion()); | 176 result.append(param->document->xmlVersion()); |
177 result.append("\" encoding=\""); | 177 result.append("\" encoding=\""); |
178 result.append(xmlEncoding); | 178 result.append(xmlEncoding); |
179 if (param->document->xmlStandalone()) | 179 if (param->document->xmlStandalone()) |
180 result.append("\" standalone=\"yes"); | 180 result.append("\" standalone=\"yes"); |
181 result.append("\"?>\n"); | 181 result.append("\"?>\n"); |
182 } | 182 } |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 for (unsigned i = 0; i < m_frames.size(); ++i) { | 502 for (unsigned i = 0; i < m_frames.size(); ++i) { |
503 WebFrameImpl* webFrame = m_frames[i]; | 503 WebFrameImpl* webFrame = m_frames[i]; |
504 Document* document = webFrame->frame()->document(); | 504 Document* document = webFrame->frame()->document(); |
505 const KURL& url = document->url(); | 505 const KURL& url = document->url(); |
506 | 506 |
507 if (!url.isValid() || !m_localLinks.contains(url.string())) | 507 if (!url.isValid() || !m_localLinks.contains(url.string())) |
508 continue; | 508 continue; |
509 | 509 |
510 didSerialization = true; | 510 didSerialization = true; |
511 | 511 |
512 String encoding = document->encoding(); | 512 const WTF::TextEncoding& textEncoding = document->encoding().isValid() ?
document->encoding() : UTF8Encoding(); |
513 const WTF::TextEncoding& textEncoding = encoding.isEmpty() ? UTF8Encodin
g() : WTF::TextEncoding(encoding); | |
514 String directoryName = url == mainURL ? m_localDirectoryName : ""; | 513 String directoryName = url == mainURL ? m_localDirectoryName : ""; |
515 | 514 |
516 SerializeDomParam param(url, textEncoding, document, directoryName); | 515 SerializeDomParam param(url, textEncoding, document, directoryName); |
517 | 516 |
518 Element* documentElement = document->documentElement(); | 517 Element* documentElement = document->documentElement(); |
519 if (documentElement) | 518 if (documentElement) |
520 buildContentForNode(documentElement, ¶m); | 519 buildContentForNode(documentElement, ¶m); |
521 | 520 |
522 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); | 521 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); |
523 } | 522 } |
524 | 523 |
525 ASSERT(m_dataBuffer.isEmpty()); | 524 ASSERT(m_dataBuffer.isEmpty()); |
526 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); | 525 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); |
527 return didSerialization; | 526 return didSerialization; |
528 } | 527 } |
529 | 528 |
530 } // namespace WebKit | 529 } // namespace WebKit |
OLD | NEW |