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

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

Issue 1177623005: Refactoring: Remove StyledMarkupAccumulator::m_convertBlocksToInlines (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: yosin's review (early return) 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 21 matching lines...) Expand all
32 #include "core/css/StylePropertySet.h" 32 #include "core/css/StylePropertySet.h"
33 #include "core/dom/Text.h" 33 #include "core/dom/Text.h"
34 #include "core/editing/htmlediting.h" 34 #include "core/editing/htmlediting.h"
35 #include "core/editing/iterators/TextIterator.h" 35 #include "core/editing/iterators/TextIterator.h"
36 #include "wtf/text/StringBuilder.h" 36 #include "wtf/text/StringBuilder.h"
37 37
38 namespace blink { 38 namespace blink {
39 39
40 using namespace HTMLNames; 40 using namespace HTMLNames;
41 41
42 StyledMarkupAccumulator::StyledMarkupAccumulator(EAbsoluteURLs shouldResolveURLs , const TextOffset& start, const TextOffset& end, const PassRefPtrWillBeRawPtr<D ocument> document, EAnnotateForInterchange shouldAnnotate, Node* highestNodeToBe Serialized, ConvertBlocksToInlines convertBlocksToInlines) 42 StyledMarkupAccumulator::StyledMarkupAccumulator(EAbsoluteURLs shouldResolveURLs , const TextOffset& start, const TextOffset& end, const PassRefPtrWillBeRawPtr<D ocument> document, EAnnotateForInterchange shouldAnnotate, Node* highestNodeToBe Serialized)
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)
49 , m_highestNodeToBeSerialized(highestNodeToBeSerialized) 48 , m_highestNodeToBeSerialized(highestNodeToBeSerialized)
50 { 49 {
51 } 50 }
52 51
53 void StyledMarkupAccumulator::appendString(const String& str) 52 void StyledMarkupAccumulator::appendString(const String& str)
54 { 53 {
55 m_result.append(str); 54 m_result.append(str);
56 } 55 }
57 56
58 void StyledMarkupAccumulator::appendStartTag(Node& node) 57 void StyledMarkupAccumulator::appendStartTag(Node& node)
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 if (!newInlineStyle->isEmpty()) { 183 if (!newInlineStyle->isEmpty()) {
185 out.appendLiteral(" style=\""); 184 out.appendLiteral(" style=\"");
186 MarkupFormatter::appendAttributeValue(out, newInlineStyle->style()-> asText(), documentIsHTML); 185 MarkupFormatter::appendAttributeValue(out, newInlineStyle->style()-> asText(), documentIsHTML);
187 out.append('\"'); 186 out.append('\"');
188 } 187 }
189 } 188 }
190 189
191 m_formatter.appendCloseTag(out, element); 190 m_formatter.appendCloseTag(out, element);
192 } 191 }
193 192
194 void StyledMarkupAccumulator::wrapWithNode(ContainerNode& node, RangeFullySelect sNode rangeFullySelectsNode)
195 {
196 StringBuilder markup;
197 if (node.isElementNode())
198 appendElement(markup, toElement(node), convertBlocksToInlines() && isBlo ck(&node), rangeFullySelectsNode);
199 else
200 appendStartMarkup(markup, node);
201 m_reversedPrecedingMarkup.append(markup.toString());
202 if (node.isElementNode())
203 appendEndTag(toElement(node));
204 }
205
206 void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style) 193 void StyledMarkupAccumulator::wrapWithStyleNode(StylePropertySet* style)
207 { 194 {
208 // wrappingStyleForSerialization should have removed -webkit-text-decoration s-in-effect 195 // wrappingStyleForSerialization should have removed -webkit-text-decoration s-in-effect
209 ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsI nEffect)); 196 ASSERT(propertyMissingOrEqualToNone(style, CSSPropertyWebkitTextDecorationsI nEffect));
210 ASSERT(m_document); 197 ASSERT(m_document);
211 198
212 StringBuilder openTag; 199 StringBuilder openTag;
213 openTag.appendLiteral("<div style=\""); 200 openTag.appendLiteral("<div style=\"");
214 MarkupFormatter::appendAttributeValue(openTag, style->asText(), m_document-> isHTMLDocument()); 201 MarkupFormatter::appendAttributeValue(openTag, style->asText(), m_document-> isHTMLDocument());
215 openTag.appendLiteral("\">"); 202 openTag.appendLiteral("\">");
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 // TODO(hajimehoshi): Use Strategy 248 // TODO(hajimehoshi): Use Strategy
262 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod e() == node.parentNode() 249 return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNod e() == node.parentNode()
263 && m_wrappingStyle && m_wrappingStyle->style(); 250 && m_wrappingStyle && m_wrappingStyle->style();
264 } 251 }
265 252
266 bool StyledMarkupAccumulator::shouldAnnotate() const 253 bool StyledMarkupAccumulator::shouldAnnotate() const
267 { 254 {
268 return m_shouldAnnotate == AnnotateForInterchange; 255 return m_shouldAnnotate == AnnotateForInterchange;
269 } 256 }
270 257
258 void StyledMarkupAccumulator::pushMarkup(const String& str)
259 {
260 m_reversedPrecedingMarkup.append(str);
261 }
262
271 } // namespace blink 263 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/editing/StyledMarkupAccumulator.h ('k') | Source/core/editing/StyledMarkupSerializer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698