| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 String WebFrameSerializerImpl::preActionBeforeSerializeOpenTag( | 123 String WebFrameSerializerImpl::preActionBeforeSerializeOpenTag( |
| 124 const Element* element, SerializeDomParam* param, bool* needSkip) | 124 const Element* element, SerializeDomParam* param, bool* needSkip) |
| 125 { | 125 { |
| 126 StringBuilder result; | 126 StringBuilder result; |
| 127 | 127 |
| 128 *needSkip = false; | 128 *needSkip = false; |
| 129 if (param->isHTMLDocument) { | 129 if (param->isHTMLDocument) { |
| 130 // Skip the open tag of original META tag which declare charset since we | 130 // Skip the open tag of original META tag which declare charset since we |
| 131 // have overrided the META which have correct charset declaration after | 131 // have overrided the META which have correct charset declaration after |
| 132 // serializing open tag of HEAD element. | 132 // serializing open tag of HEAD element. |
| 133 ASSERT(element); | 133 DCHECK(element); |
| 134 if (isHTMLMetaElement(element) && toHTMLMetaElement(element)->computeEnc
oding().isValid()) { | 134 if (isHTMLMetaElement(element) && toHTMLMetaElement(element)->computeEnc
oding().isValid()) { |
| 135 // Found META tag declared charset, we need to skip it when | 135 // Found META tag declared charset, we need to skip it when |
| 136 // serializing DOM. | 136 // serializing DOM. |
| 137 param->skipMetaElement = element; | 137 param->skipMetaElement = element; |
| 138 *needSkip = true; | 138 *needSkip = true; |
| 139 } else if (isHTMLHtmlElement(*element)) { | 139 } else if (isHTMLHtmlElement(*element)) { |
| 140 // Check something before processing the open tag of HEAD element. | 140 // Check something before processing the open tag of HEAD element. |
| 141 // First we add doc type declaration if original document has it. | 141 // First we add doc type declaration if original document has it. |
| 142 if (!param->haveSeenDocType) { | 142 if (!param->haveSeenDocType) { |
| 143 param->haveSeenDocType = true; | 143 param->haveSeenDocType = true; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 WebFrameSerializerImpl::WebFrameSerializerImpl( | 442 WebFrameSerializerImpl::WebFrameSerializerImpl( |
| 443 WebLocalFrame* frame, | 443 WebLocalFrame* frame, |
| 444 WebFrameSerializerClient* client, | 444 WebFrameSerializerClient* client, |
| 445 WebFrameSerializer::LinkRewritingDelegate* delegate) | 445 WebFrameSerializer::LinkRewritingDelegate* delegate) |
| 446 : m_client(client) | 446 : m_client(client) |
| 447 , m_delegate(delegate) | 447 , m_delegate(delegate) |
| 448 , m_htmlEntities(false) | 448 , m_htmlEntities(false) |
| 449 , m_xmlEntities(true) | 449 , m_xmlEntities(true) |
| 450 { | 450 { |
| 451 // Must specify available webframe. | 451 // Must specify available webframe. |
| 452 ASSERT(frame); | 452 DCHECK(frame); |
| 453 m_specifiedWebLocalFrameImpl = toWebLocalFrameImpl(frame); | 453 m_specifiedWebLocalFrameImpl = toWebLocalFrameImpl(frame); |
| 454 // Make sure we have non null client and delegate. | 454 // Make sure we have non null client and delegate. |
| 455 ASSERT(client); | 455 DCHECK(client); |
| 456 ASSERT(delegate); | 456 DCHECK(delegate); |
| 457 | 457 |
| 458 ASSERT(m_dataBuffer.isEmpty()); | 458 DCHECK(m_dataBuffer.isEmpty()); |
| 459 } | 459 } |
| 460 | 460 |
| 461 bool WebFrameSerializerImpl::serialize() | 461 bool WebFrameSerializerImpl::serialize() |
| 462 { | 462 { |
| 463 bool didSerialization = false; | 463 bool didSerialization = false; |
| 464 | 464 |
| 465 Document* document = m_specifiedWebLocalFrameImpl->frame()->document(); | 465 Document* document = m_specifiedWebLocalFrameImpl->frame()->document(); |
| 466 const KURL& url = document->url(); | 466 const KURL& url = document->url(); |
| 467 | 467 |
| 468 if (url.isValid()) { | 468 if (url.isValid()) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 480 if (documentElement) | 480 if (documentElement) |
| 481 buildContentForNode(documentElement, ¶m); | 481 buildContentForNode(documentElement, ¶m); |
| 482 | 482 |
| 483 encodeAndFlushBuffer(WebFrameSerializerClient::CurrentFrameIsFinished, &
param, ForceFlush); | 483 encodeAndFlushBuffer(WebFrameSerializerClient::CurrentFrameIsFinished, &
param, ForceFlush); |
| 484 } else { | 484 } else { |
| 485 // Report empty contents for invalid URLs. | 485 // Report empty contents for invalid URLs. |
| 486 m_client->didSerializeDataForFrame( | 486 m_client->didSerializeDataForFrame( |
| 487 WebCString(), WebFrameSerializerClient::CurrentFrameIsFinished); | 487 WebCString(), WebFrameSerializerClient::CurrentFrameIsFinished); |
| 488 } | 488 } |
| 489 | 489 |
| 490 ASSERT(m_dataBuffer.isEmpty()); | 490 DCHECK(m_dataBuffer.isEmpty()); |
| 491 return didSerialization; | 491 return didSerialization; |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |