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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 const Element* element, SerializeDomParam* param, bool* needSkip) | 128 const Element* element, SerializeDomParam* param, bool* needSkip) |
129 { | 129 { |
130 StringBuilder result; | 130 StringBuilder result; |
131 | 131 |
132 *needSkip = false; | 132 *needSkip = false; |
133 if (param->isHTMLDocument) { | 133 if (param->isHTMLDocument) { |
134 // Skip the open tag of original META tag which declare charset since we | 134 // Skip the open tag of original META tag which declare charset since we |
135 // have overrided the META which have correct charset declaration after | 135 // have overrided the META which have correct charset declaration after |
136 // serializing open tag of HEAD element. | 136 // serializing open tag of HEAD element. |
137 if (element->hasTagName(HTMLNames::metaTag)) { | 137 if (element->hasTagName(HTMLNames::metaTag)) { |
138 const HTMLMetaElement* meta = static_cast<const HTMLMetaElement*>(el
ement); | 138 const HTMLMetaElement* meta = toHTMLMetaElement(element); |
139 // Check whether the META tag has declared charset or not. | 139 // Check whether the META tag has declared charset or not. |
140 String equiv = meta->httpEquiv(); | 140 String equiv = meta->httpEquiv(); |
141 if (equalIgnoringCase(equiv, "content-type")) { | 141 if (equalIgnoringCase(equiv, "content-type")) { |
142 String content = meta->content(); | 142 String content = meta->content(); |
143 if (content.length() && content.contains("charset", false)) { | 143 if (content.length() && content.contains("charset", false)) { |
144 // Find META tag declared charset, we need to skip it when | 144 // Find META tag declared charset, we need to skip it when |
145 // serializing DOM. | 145 // serializing DOM. |
146 param->skipMetaElement = element; | 146 param->skipMetaElement = element; |
147 *needSkip = true; | 147 *needSkip = true; |
148 } | 148 } |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
520 | 520 |
521 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); | 521 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); |
522 } | 522 } |
523 | 523 |
524 ASSERT(m_dataBuffer.isEmpty()); | 524 ASSERT(m_dataBuffer.isEmpty()); |
525 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); | 525 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); |
526 return didSerialization; | 526 return didSerialization; |
527 } | 527 } |
528 | 528 |
529 } // namespace WebKit | 529 } // namespace WebKit |
OLD | NEW |