| 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 return false; | 303 return false; |
| 304 if (m_shouldAnnotate == AnnotateForInterchange) | 304 if (m_shouldAnnotate == AnnotateForInterchange) |
| 305 return true; | 305 return true; |
| 306 return convertBlocksToInlines() && isBlock(&element); | 306 return convertBlocksToInlines() && isBlock(&element); |
| 307 } | 307 } |
| 308 | 308 |
| 309 template<typename Strategy> | 309 template<typename Strategy> |
| 310 void StyledMarkupSerializer<Strategy>::wrapWithNode(StyledMarkupAccumulator& acc
umulator, ContainerNode& node, PassRefPtrWillBeRawPtr<EditingStyle> style) | 310 void StyledMarkupSerializer<Strategy>::wrapWithNode(StyledMarkupAccumulator& acc
umulator, ContainerNode& node, PassRefPtrWillBeRawPtr<EditingStyle> style) |
| 311 { | 311 { |
| 312 StringBuilder markup; | 312 StringBuilder markup; |
| 313 if (!node.isElementNode()) { | 313 if (node.isDocumentNode()) { |
| 314 accumulator.appendStartMarkup(markup, node); | 314 MarkupFormatter::appendXMLDeclaration(markup, toDocument(node)); |
| 315 accumulator.pushMarkup(markup.toString()); | 315 accumulator.pushMarkup(markup.toString()); |
| 316 return; | 316 return; |
| 317 } | 317 } |
| 318 if (!node.isElementNode()) |
| 319 return; |
| 318 Element& element = toElement(node); | 320 Element& element = toElement(node); |
| 319 if (accumulator.shouldApplyWrappingStyle(element) || needsInlineStyle(elemen
t)) | 321 if (accumulator.shouldApplyWrappingStyle(element) || needsInlineStyle(elemen
t)) |
| 320 accumulator.appendElementWithInlineStyle(markup, element, style); | 322 accumulator.appendElementWithInlineStyle(markup, element, style); |
| 321 else | 323 else |
| 322 accumulator.appendElement(markup, element); | 324 accumulator.appendElement(markup, element); |
| 323 accumulator.pushMarkup(markup.toString()); | 325 accumulator.pushMarkup(markup.toString()); |
| 324 accumulator.appendEndTag(toElement(node)); | 326 accumulator.appendEndTag(toElement(node)); |
| 325 } | 327 } |
| 326 | 328 |
| 327 template<typename Strategy> | 329 template<typename Strategy> |
| 328 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS
tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) | 330 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS
tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) |
| 329 { | 331 { |
| 330 if (!node.isElementNode()) | 332 if (!node.isElementNode()) |
| 331 return nullptr; | 333 return nullptr; |
| 332 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle
(toElement(node)); | 334 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle
(toElement(node)); |
| 333 if (convertBlocksToInlines() && isBlock(&node)) | 335 if (convertBlocksToInlines() && isBlock(&node)) |
| 334 inlineStyle->forceInline(); | 336 inlineStyle->forceInline(); |
| 335 return inlineStyle; | 337 return inlineStyle; |
| 336 } | 338 } |
| 337 | 339 |
| 338 template class StyledMarkupSerializer<EditingStrategy>; | 340 template class StyledMarkupSerializer<EditingStrategy>; |
| 339 | 341 |
| 340 } // namespace blink | 342 } // namespace blink |
| OLD | NEW |