Chromium Code Reviews| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 43 : m_formatter(shouldResolveURLs) | 43 : m_formatter(shouldResolveURLs) |
| 44 , m_start(start) | 44 , m_start(start) |
| 45 , m_end(end) | 45 , m_end(end) |
| 46 , m_document(document) | 46 , m_document(document) |
| 47 , m_shouldAnnotate(shouldAnnotate) | 47 , m_shouldAnnotate(shouldAnnotate) |
| 48 , m_convertBlocksToInlines(convertBlocksToInlines) | 48 , m_convertBlocksToInlines(convertBlocksToInlines) |
| 49 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) | 49 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) |
| 50 { | 50 { |
| 51 } | 51 } |
| 52 | 52 |
| 53 void StyledMarkupAccumulator::appendString(const String& str) | |
| 54 { | |
| 55 m_result.append(str); | |
| 56 } | |
| 57 | |
| 58 void StyledMarkupAccumulator::appendStartTag(Node& node) | 53 void StyledMarkupAccumulator::appendStartTag(Node& node) |
| 59 { | 54 { |
| 60 appendStartMarkup(m_result, node); | 55 appendStartMarkup(m_result, node); |
| 61 } | 56 } |
| 62 | 57 |
| 63 void StyledMarkupAccumulator::appendEndTag(const Element& element) | 58 void StyledMarkupAccumulator::appendEndTag(const Element& element) |
| 64 { | 59 { |
| 65 appendEndMarkup(m_result, element); | 60 appendEndMarkup(m_result, element); |
| 66 } | 61 } |
| 67 | 62 |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 208 // wrappingStyleForSerialization should have removed -webkit-text-decoration s-in-effect | 203 // wrappingStyleForSerialization should have removed -webkit-text-decoration s-in-effect |
| 209 ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsI nEffect)); | 204 ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsI nEffect)); |
| 210 ASSERT(m_document); | 205 ASSERT(m_document); |
| 211 | 206 |
| 212 StringBuilder openTag; | 207 StringBuilder openTag; |
| 213 openTag.appendLiteral("<div style=\""); | 208 openTag.appendLiteral("<div style=\""); |
| 214 MarkupFormatter::appendAttributeValue(openTag, style->asText(), m_document-> isHTMLDocument()); | 209 MarkupFormatter::appendAttributeValue(openTag, style->asText(), m_document-> isHTMLDocument()); |
| 215 openTag.appendLiteral("\">"); | 210 openTag.appendLiteral("\">"); |
| 216 m_reversedPrecedingMarkup.append(openTag.toString()); | 211 m_reversedPrecedingMarkup.append(openTag.toString()); |
| 217 | 212 |
| 218 appendString("</div>"); | 213 m_result.append("</div>"); |
| 219 } | 214 } |
| 220 | 215 |
| 221 String StyledMarkupAccumulator::takeResults() | 216 String StyledMarkupAccumulator::takeResults() |
| 222 { | 217 { |
| 223 StringBuilder result; | 218 StringBuilder result; |
| 224 result.reserveCapacity(MarkupFormatter::totalLength(m_reversedPrecedingMarku p) + m_result.length()); | 219 result.reserveCapacity(MarkupFormatter::totalLength(m_reversedPrecedingMarku p) + m_result.length()); |
| 225 | 220 |
| 226 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) | 221 for (size_t i = m_reversedPrecedingMarkup.size(); i > 0; --i) |
| 227 result.append(m_reversedPrecedingMarkup[i - 1]); | 222 result.append(m_reversedPrecedingMarkup[i - 1]); |
| 228 | 223 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 261 // TODO(hajimehoshi): Use Strategy | 256 // TODO(hajimehoshi): Use Strategy |
| 262 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod e() == node.parentNode() | 257 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod e() == node.parentNode() |
| 263 && m_wrappingStyle && m_wrappingStyle->style(); | 258 && m_wrappingStyle && m_wrappingStyle->style(); |
| 264 } | 259 } |
| 265 | 260 |
| 266 bool StyledMarkupAccumulator::shouldAnnotate() const | 261 bool StyledMarkupAccumulator::shouldAnnotate() const |
| 267 { | 262 { |
| 268 return m_shouldAnnotate == AnnotateForInterchange; | 263 return m_shouldAnnotate == AnnotateForInterchange; |
| 269 } | 264 } |
| 270 | 265 |
| 266 void StyledMarkupAccumulator::appendNewLine() | |
|
yosin_UTC9
2015/06/10 07:06:33
s/NewLine/newline/
as "interchange Newline String"
hajimehoshi
2015/06/10 07:16:30
Done.
| |
| 267 { | |
| 268 // TODO(hajimehoshi): This is copied from | |
| 269 // StyledMarkupSerialize::createMarkup. Unify them. | |
| 270 DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\"" AppleInterchangeNewline "\">")); | |
| 271 m_result.append(interchangeNewlineString); | |
| 272 } | |
| 273 | |
| 271 } // namespace blink | 274 } // namespace blink |
| OLD | NEW |