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 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()) { | |
|
yosin_UTC9
2015/06/12 07:58:04
nit: We don't need to have curry brace.
hajimehoshi
2015/06/12 08:14:13
Done.
| |
| 319 return; | |
| 320 } | |
| 321 | |
|
yosin_UTC9
2015/06/12 07:58:04
We don't need to have an extra blank line.
hajimehoshi
2015/06/12 08:14:13
Done.
| |
| 318 Element& element = toElement(node); | 322 Element& element = toElement(node); |
| 319 if (accumulator.shouldApplyWrappingStyle(element) || needsInlineStyle(elemen t)) | 323 if (accumulator.shouldApplyWrappingStyle(element) || needsInlineStyle(elemen t)) |
| 320 accumulator.appendElementWithInlineStyle(markup, element, style); | 324 accumulator.appendElementWithInlineStyle(markup, element, style); |
| 321 else | 325 else |
| 322 accumulator.appendElement(markup, element); | 326 accumulator.appendElement(markup, element); |
| 323 accumulator.pushMarkup(markup.toString()); | 327 accumulator.pushMarkup(markup.toString()); |
| 324 accumulator.appendEndTag(toElement(node)); | 328 accumulator.appendEndTag(toElement(node)); |
| 325 } | 329 } |
| 326 | 330 |
| 327 template<typename Strategy> | 331 template<typename Strategy> |
| 328 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) | 332 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) |
| 329 { | 333 { |
| 330 if (!node.isElementNode()) | 334 if (!node.isElementNode()) |
| 331 return nullptr; | 335 return nullptr; |
| 332 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle (toElement(node)); | 336 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle (toElement(node)); |
| 333 if (convertBlocksToInlines() && isBlock(&node)) | 337 if (convertBlocksToInlines() && isBlock(&node)) |
| 334 inlineStyle->forceInline(); | 338 inlineStyle->forceInline(); |
| 335 return inlineStyle; | 339 return inlineStyle; |
| 336 } | 340 } |
| 337 | 341 |
| 338 template class StyledMarkupSerializer<EditingStrategy>; | 342 template class StyledMarkupSerializer<EditingStrategy>; |
| 339 | 343 |
| 340 } // namespace blink | 344 } // namespace blink |
| OLD | NEW |