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

Side by Side Diff: Source/core/rendering/GraphicsContextAnnotator.cpp

Issue 482753002: Use StringBuilder::appendLiteral() / StringBuilder::append(char) when possible (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 2013 Samsung Electronics. All rights reserved. 3 * Copyright (C) 2013 Samsung Electronics. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are 6 * modification, are permitted provided that the following conditions are
7 * met: 7 * met:
8 * 8 *
9 * * Redistributions of source code must retain the above copyright 9 * * Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 105
106 if ((mode & AnnotateElementId) && element && element->hasID()) 106 if ((mode & AnnotateElementId) && element && element->hasID())
107 annotations.append(std::make_pair(AnnotationKeyElementId, element->getId Attribute().string())); 107 annotations.append(std::make_pair(AnnotationKeyElementId, element->getId Attribute().string()));
108 108
109 if ((mode & AnnotateElementClass) && element && element->hasClass()) { 109 if ((mode & AnnotateElementClass) && element && element->hasClass()) {
110 SpaceSplitString classes = element->classNames(); 110 SpaceSplitString classes = element->classNames();
111 if (!classes.isNull() && classes.size() > 0) { 111 if (!classes.isNull() && classes.size() > 0) {
112 StringBuilder classBuilder; 112 StringBuilder classBuilder;
113 for (size_t i = 0; i < classes.size(); ++i) { 113 for (size_t i = 0; i < classes.size(); ++i) {
114 if (i > 0) 114 if (i > 0)
115 classBuilder.append(" "); 115 classBuilder.append(' ');
116 classBuilder.append(classes[i]); 116 classBuilder.append(classes[i]);
117 } 117 }
118 118
119 annotations.append(std::make_pair(AnnotationKeyElementClass, classBu ilder.toString())); 119 annotations.append(std::make_pair(AnnotationKeyElementClass, classBu ilder.toString()));
120 } 120 }
121 } 121 }
122 122
123 if ((mode & AnnotateElementTag) && element) 123 if ((mode & AnnotateElementTag) && element)
124 annotations.append(std::make_pair(AnnotationKeyElementTag, element->tagN ame())); 124 annotations.append(std::make_pair(AnnotationKeyElementTag, element->tagN ame()));
125 125
126 if (mode & AnnotateInspectorId) { 126 if (mode & AnnotateInspectorId) {
127 if (Node* ownerNode = object->generatingNode()) { 127 if (Node* ownerNode = object->generatingNode()) {
128 annotations.append(std::make_pair(AnnotationKeyInspectorNodeId, 128 annotations.append(std::make_pair(AnnotationKeyInspectorNodeId,
129 String::number(InspectorNodeIds::idForNode(ownerNode)))); 129 String::number(InspectorNodeIds::idForNode(ownerNode))));
130 } 130 }
131 } 131 }
132 132
133 m_context = paintInfo.context; 133 m_context = paintInfo.context;
134 m_context->beginAnnotation(annotations); 134 m_context->beginAnnotation(annotations);
135 } 135 }
136 136
137 void GraphicsContextAnnotator::finishAnnotation() 137 void GraphicsContextAnnotator::finishAnnotation()
138 { 138 {
139 ASSERT(m_context); 139 ASSERT(m_context);
140 m_context->endAnnotation(); 140 m_context->endAnnotation();
141 } 141 }
142 142
143 } // namespace blink 143 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/page/scrolling/ScrollingCoordinator.cpp ('k') | Source/core/rendering/RenderText.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698