| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2008, 2009, 2010, 2011 Google Inc. All rights reserved. |
| 4 * Copyright (C) 2011 Igalia S.L. | 4 * Copyright (C) 2011 Igalia S.L. |
| 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. | 5 * Copyright (C) 2011 Motorola Mobility. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * 1. Redistributions of source code must retain the above copyright | 10 * 1. Redistributions of source code must retain the above copyright |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 , m_shouldAnnotate(shouldAnnotate) | 58 , m_shouldAnnotate(shouldAnnotate) |
| 59 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) | 59 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) |
| 60 { | 60 { |
| 61 } | 61 } |
| 62 | 62 |
| 63 void StyledMarkupAccumulator::appendString(const String& str) | 63 void StyledMarkupAccumulator::appendString(const String& str) |
| 64 { | 64 { |
| 65 m_accumulator.appendString(str); | 65 m_accumulator.appendString(str); |
| 66 } | 66 } |
| 67 | 67 |
| 68 void StyledMarkupAccumulator::appendStartTag(Node& node, Namespaces* namespaces) | 68 void StyledMarkupAccumulator::appendStartTag(Node& node) |
| 69 { | 69 { |
| 70 StringBuilder out; | 70 StringBuilder out; |
| 71 appendStartMarkup(out, node, namespaces); | 71 appendStartMarkup(out, node); |
| 72 appendString(out.toString()); | 72 appendString(out.toString()); |
| 73 } | 73 } |
| 74 | 74 |
| 75 void StyledMarkupAccumulator::appendEndTag(const Element& element) | 75 void StyledMarkupAccumulator::appendEndTag(const Element& element) |
| 76 { | 76 { |
| 77 StringBuilder out; | 77 StringBuilder out; |
| 78 appendEndMarkup(out, element); | 78 appendEndMarkup(out, element); |
| 79 appendString(out.toString()); | 79 appendString(out.toString()); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void StyledMarkupAccumulator::appendStartMarkup(StringBuilder& result, Node& nod
e, Namespaces* namespaces) | 82 void StyledMarkupAccumulator::appendStartMarkup(StringBuilder& result, Node& nod
e) |
| 83 { | 83 { |
| 84 switch (node.nodeType()) { | 84 switch (node.nodeType()) { |
| 85 case Node::TEXT_NODE: | 85 case Node::TEXT_NODE: |
| 86 appendText(result, toText(node)); | 86 appendText(result, toText(node)); |
| 87 break; | 87 break; |
| 88 case Node::ELEMENT_NODE: | 88 case Node::ELEMENT_NODE: |
| 89 appendElement(result, toElement(node), namespaces); | 89 appendElement(result, toElement(node)); |
| 90 break; | 90 break; |
| 91 default: | 91 default: |
| 92 m_accumulator.appendStartMarkup(result, node, namespaces); | 92 m_accumulator.appendStartMarkup(result, node, nullptr); |
| 93 break; | 93 break; |
| 94 } | 94 } |
| 95 } | 95 } |
| 96 | 96 |
| 97 void StyledMarkupAccumulator::appendEndMarkup(StringBuilder& result, const Eleme
nt& element) | 97 void StyledMarkupAccumulator::appendEndMarkup(StringBuilder& result, const Eleme
nt& element) |
| 98 { | 98 { |
| 99 m_accumulator.appendEndMarkup(result, element); | 99 m_accumulator.appendEndMarkup(result, element); |
| 100 } | 100 } |
| 101 | 101 |
| 102 void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text) | 102 void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 String content = useRenderedText ? renderedText(text) : stringValueForRa
nge(text); | 134 String content = useRenderedText ? renderedText(text) : stringValueForRa
nge(text); |
| 135 StringBuilder buffer; | 135 StringBuilder buffer; |
| 136 MarkupAccumulator::appendCharactersReplacingEntities(buffer, content, 0,
content.length(), EntityMaskInPCDATA); | 136 MarkupAccumulator::appendCharactersReplacingEntities(buffer, content, 0,
content.length(), EntityMaskInPCDATA); |
| 137 out.append(convertHTMLTextToInterchangeFormat(buffer.toString(), text)); | 137 out.append(convertHTMLTextToInterchangeFormat(buffer.toString(), text)); |
| 138 } | 138 } |
| 139 | 139 |
| 140 if (wrappingSpan) | 140 if (wrappingSpan) |
| 141 out.append(styleNodeCloseTag(false)); | 141 out.append(styleNodeCloseTag(false)); |
| 142 } | 142 } |
| 143 | 143 |
| 144 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, Namespaces*) | 144 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
) |
| 145 { | 145 { |
| 146 appendElement(out, element, false, DoesFullySelectNode); | 146 appendElement(out, element, false, DoesFullySelectNode); |
| 147 } | 147 } |
| 148 | 148 |
| 149 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, bool addDisplayInline, StyledMarkupAccumulator::RangeFullySelectsNode rangeFul
lySelectsNode) | 149 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
, bool addDisplayInline, StyledMarkupAccumulator::RangeFullySelectsNode rangeFul
lySelectsNode) |
| 150 { | 150 { |
| 151 const bool documentIsHTML = element.document().isHTMLDocument(); | 151 const bool documentIsHTML = element.document().isHTMLDocument(); |
| 152 m_accumulator.appendOpenTag(out, element, 0); | 152 m_accumulator.appendOpenTag(out, element, 0); |
| 153 | 153 |
| 154 const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldA
nnotate() || addDisplayInline); | 154 const bool shouldAnnotateOrForceInline = element.isHTMLElement() && (shouldA
nnotate() || addDisplayInline); |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod
e() == node.parentNode() | 247 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod
e() == node.parentNode() |
| 248 && m_wrappingStyle && m_wrappingStyle->style(); | 248 && m_wrappingStyle && m_wrappingStyle->style(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 bool StyledMarkupAccumulator::shouldAnnotate() const | 251 bool StyledMarkupAccumulator::shouldAnnotate() const |
| 252 { | 252 { |
| 253 return m_shouldAnnotate == AnnotateForInterchange; | 253 return m_shouldAnnotate == AnnotateForInterchange; |
| 254 } | 254 } |
| 255 | 255 |
| 256 } // namespace blink | 256 } // namespace blink |
| OLD | NEW |