| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if (m_end.isNotNull()) { | 122 if (m_end.isNotNull()) { |
| 123 if (text == m_end.text()) | 123 if (text == m_end.text()) |
| 124 length = m_end.offset(); | 124 length = m_end.offset(); |
| 125 } | 125 } |
| 126 if (m_start.isNotNull()) { | 126 if (m_start.isNotNull()) { |
| 127 if (text == m_start.text()) { | 127 if (text == m_start.text()) { |
| 128 start = m_start.offset(); | 128 start = m_start.offset(); |
| 129 length -= start; | 129 length -= start; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 m_accumulator.appendCharactersReplacingEntities(out, str, start, length,
m_accumulator.entityMaskForText(text)); | 132 MarkupFormatter::appendCharactersReplacingEntities(out, str, start, leng
th, m_accumulator.entityMaskForText(text)); |
| 133 } else { | 133 } else { |
| 134 const bool useRenderedText = !enclosingElementWithTag(firstPositionInNod
e(&text), selectTag); | 134 const bool useRenderedText = !enclosingElementWithTag(firstPositionInNod
e(&text), selectTag); |
| 135 String content = useRenderedText ? renderedText(text) : stringValueForRa
nge(text); | 135 String content = useRenderedText ? renderedText(text) : stringValueForRa
nge(text); |
| 136 StringBuilder buffer; | 136 StringBuilder buffer; |
| 137 MarkupAccumulator::appendCharactersReplacingEntities(buffer, content, 0,
content.length(), EntityMaskInPCDATA); | 137 MarkupFormatter::appendCharactersReplacingEntities(buffer, content, 0, c
ontent.length(), EntityMaskInPCDATA); |
| 138 out.append(convertHTMLTextToInterchangeFormat(buffer.toString(), text)); | 138 out.append(convertHTMLTextToInterchangeFormat(buffer.toString(), text)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (wrappingSpan) | 141 if (wrappingSpan) |
| 142 out.append(styleNodeCloseTag(false)); | 142 out.append(styleNodeCloseTag(false)); |
| 143 } | 143 } |
| 144 | 144 |
| 145 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
) | 145 void StyledMarkupAccumulator::appendElement(StringBuilder& out, Element& element
) |
| 146 { | 146 { |
| 147 appendElement(out, element, false, DoesFullySelectNode); | 147 appendElement(out, element, false, DoesFullySelectNode); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 { | 229 { |
| 230 StringBuilder openTag; | 230 StringBuilder openTag; |
| 231 appendStyleNodeOpenTag(openTag, style, isBlock); | 231 appendStyleNodeOpenTag(openTag, style, isBlock); |
| 232 m_reversedPrecedingMarkup.append(openTag.toString()); | 232 m_reversedPrecedingMarkup.append(openTag.toString()); |
| 233 appendString(styleNodeCloseTag(isBlock)); | 233 appendString(styleNodeCloseTag(isBlock)); |
| 234 } | 234 } |
| 235 | 235 |
| 236 String StyledMarkupAccumulator::takeResults() | 236 String StyledMarkupAccumulator::takeResults() |
| 237 { | 237 { |
| 238 StringBuilder result; | 238 StringBuilder result; |
| 239 result.reserveCapacity(MarkupAccumulator::totalLength(m_reversedPrecedingMar
kup) + m_accumulator.length()); | 239 result.reserveCapacity(MarkupFormatter::totalLength(m_reversedPrecedingMarku
p) + m_accumulator.length()); |
| 240 | 240 |
| 241 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) | 241 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) |
| 242 result.append(m_reversedPrecedingMarkup[i - 1]); | 242 result.append(m_reversedPrecedingMarkup[i - 1]); |
| 243 | 243 |
| 244 m_accumulator.concatenateMarkup(result); | 244 m_accumulator.concatenateMarkup(result); |
| 245 | 245 |
| 246 // We remove '\0' characters because they are not visibly rendered to the us
er. | 246 // We remove '\0' characters because they are not visibly rendered to the us
er. |
| 247 return result.toString().replace(0, ""); | 247 return result.toString().replace(0, ""); |
| 248 } | 248 } |
| 249 | 249 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 277 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod
e() == node.parentNode() | 277 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod
e() == node.parentNode() |
| 278 && m_wrappingStyle && m_wrappingStyle->style(); | 278 && m_wrappingStyle && m_wrappingStyle->style(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 bool StyledMarkupAccumulator::shouldAnnotate() const | 281 bool StyledMarkupAccumulator::shouldAnnotate() const |
| 282 { | 282 { |
| 283 return m_shouldAnnotate == AnnotateForInterchange; | 283 return m_shouldAnnotate == AnnotateForInterchange; |
| 284 } | 284 } |
| 285 | 285 |
| 286 } // namespace blink | 286 } // namespace blink |
| OLD | NEW |