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 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 result.append(m_xmlEntities.convertEntitiesInString(attr
Value)); | 345 result.append(m_xmlEntities.convertEntitiesInString(attr
Value)); |
346 } | 346 } |
347 } | 347 } |
348 result.append('\"'); | 348 result.append('\"'); |
349 } | 349 } |
350 } | 350 } |
351 | 351 |
352 // Do post action for open tag. | 352 // Do post action for open tag. |
353 String addedContents = postActionAfterSerializeOpenTag(element, param); | 353 String addedContents = postActionAfterSerializeOpenTag(element, param); |
354 // Complete the open tag for element when it has child/children. | 354 // Complete the open tag for element when it has child/children. |
355 if (element->hasChildNodes() || param->haveAddedContentsBeforeEnd) | 355 if (element->hasChildren() || param->haveAddedContentsBeforeEnd) |
356 result.append('>'); | 356 result.append('>'); |
357 // Append the added contents generate in post action of open tag. | 357 // Append the added contents generate in post action of open tag. |
358 result.append(addedContents); | 358 result.append(addedContents); |
359 // Save the result to data buffer. | 359 // Save the result to data buffer. |
360 saveHTMLContentToBuffer(result.toString(), param); | 360 saveHTMLContentToBuffer(result.toString(), param); |
361 } | 361 } |
362 | 362 |
363 // Serialize end tag of an specified element. | 363 // Serialize end tag of an specified element. |
364 void WebPageSerializerImpl::endTagToString(Element* element, | 364 void WebPageSerializerImpl::endTagToString(Element* element, |
365 SerializeDomParam* param) | 365 SerializeDomParam* param) |
366 { | 366 { |
367 bool needSkip; | 367 bool needSkip; |
368 StringBuilder result; | 368 StringBuilder result; |
369 // Do pre action for end tag. | 369 // Do pre action for end tag. |
370 result.append(preActionBeforeSerializeEndTag(element, param, &needSkip)); | 370 result.append(preActionBeforeSerializeEndTag(element, param, &needSkip)); |
371 if (needSkip) | 371 if (needSkip) |
372 return; | 372 return; |
373 // Write end tag when element has child/children. | 373 // Write end tag when element has child/children. |
374 if (element->hasChildNodes() || param->haveAddedContentsBeforeEnd) { | 374 if (element->hasChildren() || param->haveAddedContentsBeforeEnd) { |
375 result.appendLiteral("</"); | 375 result.appendLiteral("</"); |
376 result.append(element->nodeName().lower()); | 376 result.append(element->nodeName().lower()); |
377 result.append('>'); | 377 result.append('>'); |
378 } else { | 378 } else { |
379 // Check whether we have to write end tag for empty element. | 379 // Check whether we have to write end tag for empty element. |
380 if (param->isHTMLDocument) { | 380 if (param->isHTMLDocument) { |
381 result.append('>'); | 381 result.append('>'); |
382 // FIXME: This code is horribly wrong. WebPageSerializerImpl must d
ie. | 382 // FIXME: This code is horribly wrong. WebPageSerializerImpl must d
ie. |
383 if (!element->isHTMLElement() || !toHTMLElement(element)->ieForbidsI
nsertHTML()) { | 383 if (!element->isHTMLElement() || !toHTMLElement(element)->ieForbidsI
nsertHTML()) { |
384 // We need to write end tag when it is required. | 384 // We need to write end tag when it is required. |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
517 | 517 |
518 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); | 518 encodeAndFlushBuffer(WebPageSerializerClient::CurrentFrameIsFinished, &p
aram, ForceFlush); |
519 } | 519 } |
520 | 520 |
521 ASSERT(m_dataBuffer.isEmpty()); | 521 ASSERT(m_dataBuffer.isEmpty()); |
522 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); | 522 m_client->didSerializeDataForFrame(KURL(), WebCString("", 0), WebPageSeriali
zerClient::AllFramesAreFinished); |
523 return didSerialization; | 523 return didSerialization; |
524 } | 524 } |
525 | 525 |
526 } // namespace blink | 526 } // namespace blink |
OLD | NEW |