Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(242)

Side by Side Diff: Source/web/WebPageSerializerImpl.cpp

Issue 171773008: Rename childNodeCount() / childNode() methods for clarity (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Further renaming for consistency Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/web/WebNode.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « Source/web/WebNode.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698