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

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

Issue 1179133002: Refactoring: Remove the first parameter |result| from StyledMarkupAccumulator::appendStartMarkup (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Bug fix: miss to call pushMarkup 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
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 , m_start(start) 56 , m_start(start)
57 , m_end(end) 57 , m_end(end)
58 , m_document(document) 58 , m_document(document)
59 , m_shouldAnnotate(shouldAnnotate) 59 , m_shouldAnnotate(shouldAnnotate)
60 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) 60 , m_highestNodeToBeSerialized(highestNodeToBeSerialized)
61 { 61 {
62 } 62 }
63 63
64 void StyledMarkupAccumulator::appendStartTag(Node& node) 64 void StyledMarkupAccumulator::appendStartTag(Node& node)
65 { 65 {
66 appendStartMarkup(m_result, node); 66 appendStartMarkup(node);
67 } 67 }
68 68
69 void StyledMarkupAccumulator::appendEndTag(const Element& element) 69 void StyledMarkupAccumulator::appendEndTag(const Element& element)
70 { 70 {
71 appendEndMarkup(m_result, element); 71 appendEndMarkup(m_result, element);
72 } 72 }
73 73
74 void StyledMarkupAccumulator::appendStartMarkup(StringBuilder& result, Node& nod e) 74 void StyledMarkupAccumulator::appendStartMarkup(Node& node)
75 { 75 {
76 switch (node.nodeType()) { 76 switch (node.nodeType()) {
77 case Node::TEXT_NODE: 77 case Node::TEXT_NODE:
78 appendText(toText(node)); 78 appendText(m_result, toText(node));
79 break; 79 break;
80 case Node::ELEMENT_NODE: { 80 case Node::ELEMENT_NODE: {
81 Element& element = toElement(node); 81 Element& element = toElement(node);
82 RefPtrWillBeRawPtr<EditingStyle> style = createInlineStyle(element); 82 RefPtrWillBeRawPtr<EditingStyle> style = createInlineStyle(element);
83 appendElement(element, style); 83 appendElementWithInlineStyle(m_result, element, style);
yosin_UTC9 2015/06/12 07:58:04 Since |appendElement()| checks |element.isHTMLElem
84 break; 84 break;
85 } 85 }
86 default: 86 default:
87 m_formatter.appendStartMarkup(result, node, nullptr); 87 m_formatter.appendStartMarkup(m_result, node, nullptr);
88 break; 88 break;
89 } 89 }
90 } 90 }
91 91
92 void StyledMarkupAccumulator::appendEndMarkup(StringBuilder& result, const Eleme nt& element) 92 void StyledMarkupAccumulator::appendEndMarkup(StringBuilder& result, const Eleme nt& element)
93 { 93 {
94 m_formatter.appendEndMarkup(result, element); 94 m_formatter.appendEndMarkup(result, element);
95 } 95 }
96 96
97 void StyledMarkupAccumulator::appendText(Text& text)
98 {
99 appendText(m_result, text);
100 }
101
102 void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text) 97 void StyledMarkupAccumulator::appendText(StringBuilder& out, Text& text)
103 { 98 {
104 const bool parentIsTextarea = text.parentElement() && text.parentElement()-> tagQName() == textareaTag; 99 const bool parentIsTextarea = text.parentElement() && text.parentElement()-> tagQName() == textareaTag;
105 const bool wrappingSpan = shouldApplyWrappingStyle(text) && !parentIsTextare a; 100 const bool wrappingSpan = shouldApplyWrappingStyle(text) && !parentIsTextare a;
106 if (wrappingSpan) { 101 if (wrappingSpan) {
107 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = m_wrappingStyle->copy() ; 102 RefPtrWillBeRawPtr<EditingStyle> wrappingStyle = m_wrappingStyle->copy() ;
108 // FIXME: <rdar://problem/5371536> Style rules that match pasted content can change it's appearance 103 // FIXME: <rdar://problem/5371536> Style rules that match pasted content can change it's appearance
109 // Make sure spans are inline style in paste side e.g. span { display: b lock }. 104 // Make sure spans are inline style in paste side e.g. span { display: b lock }.
110 wrappingStyle->forceInline(); 105 wrappingStyle->forceInline();
111 // FIXME: Should this be included in forceInline? 106 // FIXME: Should this be included in forceInline?
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 m_reversedPrecedingMarkup.append(str); 270 m_reversedPrecedingMarkup.append(str);
276 } 271 }
277 272
278 void StyledMarkupAccumulator::appendInterchangeNewline() 273 void StyledMarkupAccumulator::appendInterchangeNewline()
279 { 274 {
280 DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\"" AppleInterchangeNewline "\">")); 275 DEFINE_STATIC_LOCAL(const String, interchangeNewlineString, ("<br class=\"" AppleInterchangeNewline "\">"));
281 m_result.append(interchangeNewlineString); 276 m_result.append(interchangeNewlineString);
282 } 277 }
283 278
284 } // namespace blink 279 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698