| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2012 Apple Inc. All rights
reserved. |
| 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. | 3 * Copyright (C) 2009, 2010 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 | 531 |
| 532 bool MarkupAccumulator::elementCannotHaveEndTag(const Node* node) | 532 bool MarkupAccumulator::elementCannotHaveEndTag(const Node* node) |
| 533 { | 533 { |
| 534 if (!node->isHTMLElement()) | 534 if (!node->isHTMLElement()) |
| 535 return false; | 535 return false; |
| 536 | 536 |
| 537 // FIXME: ieForbidsInsertHTML may not be the right function to call here | 537 // FIXME: ieForbidsInsertHTML may not be the right function to call here |
| 538 // ieForbidsInsertHTML is used to disallow setting innerHTML/outerHTML | 538 // ieForbidsInsertHTML is used to disallow setting innerHTML/outerHTML |
| 539 // or createContextualFragment. It does not necessarily align with | 539 // or createContextualFragment. It does not necessarily align with |
| 540 // which elements should be serialized w/o end tags. | 540 // which elements should be serialized w/o end tags. |
| 541 return static_cast<const HTMLElement*>(node)->ieForbidsInsertHTML(); | 541 return toHTMLElement(node)->ieForbidsInsertHTML(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 void MarkupAccumulator::appendEndMarkup(StringBuilder& result, const Node* node) | 544 void MarkupAccumulator::appendEndMarkup(StringBuilder& result, const Node* node) |
| 545 { | 545 { |
| 546 if (!node->isElementNode() || shouldSelfClose(node) || (!node->hasChildNodes
() && elementCannotHaveEndTag(node))) | 546 if (!node->isElementNode() || shouldSelfClose(node) || (!node->hasChildNodes
() && elementCannotHaveEndTag(node))) |
| 547 return; | 547 return; |
| 548 | 548 |
| 549 result.append('<'); | 549 result.append('<'); |
| 550 result.append('/'); | 550 result.append('/'); |
| 551 result.append(toElement(node)->nodeNamePreservingCase()); | 551 result.append(toElement(node)->nodeNamePreservingCase()); |
| 552 result.append('>'); | 552 result.append('>'); |
| 553 } | 553 } |
| 554 | 554 |
| 555 } | 555 } |
| OLD | NEW |