OLD | NEW |
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 Loading... |
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 |
OLD | NEW |