Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Side by Side Diff: Source/core/editing/StyledMarkupSerializer.cpp

Issue 1173223003: Refactoring: Remove addDisplayInline parameter of StyledMarkupAccumulator::appendElement (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tkent's review Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/editing/StyledMarkupSerializer.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 wrapWithNode(*markupAccumulator, *parent, style); 290 wrapWithNode(*markupAccumulator, *parent, style);
291 } 291 }
292 lastClosed = parent; 292 lastClosed = parent;
293 } 293 }
294 } 294 }
295 295
296 return lastClosed; 296 return lastClosed;
297 } 297 }
298 298
299 template<typename Strategy> 299 template<typename Strategy>
300 bool StyledMarkupSerializer<Strategy>::needsInlineStyle(const Element& element)
301 {
302 if (!element.isHTMLElement())
303 return false;
304 if (m_shouldAnnotate == AnnotateForInterchange)
305 return true;
306 return convertBlocksToInlines() && isBlock(&element);
307 }
308
309 template<typename Strategy>
300 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)
301 { 311 {
302 StringBuilder markup; 312 StringBuilder markup;
303 if (node.isElementNode()) 313 if (!node.isElementNode()) {
304 accumulator.appendElement(markup, toElement(node), convertBlocksToInline s() && isBlock(&node), style); 314 accumulator.appendStartMarkup(markup, node);
315 accumulator.pushMarkup(markup.toString());
316 return;
317 }
318 Element& element = toElement(node);
319 if (accumulator.shouldApplyWrappingStyle(element) || needsInlineStyle(elemen t))
320 accumulator.appendElementWithInlineStyle(markup, element, style);
305 else 321 else
306 accumulator.appendStartMarkup(markup, node); 322 accumulator.appendElement(markup, element);
307 accumulator.pushMarkup(markup.toString()); 323 accumulator.pushMarkup(markup.toString());
308 if (!node.isElementNode())
309 return;
310 accumulator.appendEndTag(toElement(node)); 324 accumulator.appendEndTag(toElement(node));
311 } 325 }
312 326
313 template<typename Strategy> 327 template<typename Strategy>
314 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node) 328 RefPtrWillBeRawPtr<EditingStyle> StyledMarkupSerializer<Strategy>::createInlineS tyleIfNeeded(StyledMarkupAccumulator& accumulator, Node& node)
315 { 329 {
316 if (!node.isElementNode()) 330 if (!node.isElementNode())
317 return nullptr; 331 return nullptr;
318 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle (toElement(node)); 332 RefPtrWillBeRawPtr<EditingStyle> inlineStyle = accumulator.createInlineStyle (toElement(node));
319 if (convertBlocksToInlines() && isBlock(&node)) 333 if (convertBlocksToInlines() && isBlock(&node))
320 inlineStyle->forceInline(); 334 inlineStyle->forceInline();
321 return inlineStyle; 335 return inlineStyle;
322 } 336 }
323 337
324 template class StyledMarkupSerializer<EditingStrategy>; 338 template class StyledMarkupSerializer<EditingStrategy>;
325 339
326 } // namespace blink 340 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/StyledMarkupSerializer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698