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

Side by Side Diff: Source/core/platform/graphics/GraphicsContextAnnotation.cpp

Issue 21430003: Implement interfaces in PaintInfo and make it a class. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@getterPaintInfo01
Patch Set: Fixed Linux compilation (hopefuly Windows too), addressing some reviewer's suggestions. Created 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 default: 75 default:
76 ASSERT_NOT_REACHED(); 76 ASSERT_NOT_REACHED();
77 return "<unknown>"; 77 return "<unknown>";
78 } 78 }
79 } 79 }
80 80
81 } 81 }
82 82
83 namespace WebCore { 83 namespace WebCore {
84 84
85 GraphicsContextAnnotation::GraphicsContextAnnotation(const PaintInfo& paintInfo, const RenderObject* object) 85 GraphicsContextAnnotation::GraphicsContextAnnotation(PaintInfo& paintInfo, const RenderObject* object)
86 : m_rendererName(0) 86 : m_rendererName(0)
87 , m_paintPhase(0) 87 , m_paintPhase(0)
88 { 88 {
89 ASSERT(paintInfo.context); 89 ASSERT(paintInfo.getContext());
90 ASSERT(object); 90 ASSERT(object);
91 91
92 AnnotationModeFlags mode = paintInfo.context->annotationMode(); 92 AnnotationModeFlags mode = paintInfo.getContext()->annotationMode();
93 Element* element = object->node() && object->node()->isElementNode() ? toEle ment(object->node()) : 0; 93 Element* element = object->node() && object->node()->isElementNode() ? toEle ment(object->node()) : 0;
94 94
95 if (mode & AnnotateRendererName) 95 if (mode & AnnotateRendererName)
96 m_rendererName = object->renderName(); 96 m_rendererName = object->renderName();
97 97
98 if (mode & AnnotatePaintPhase) 98 if (mode & AnnotatePaintPhase)
99 m_paintPhase = paintPhaseName(paintInfo.phase); 99 m_paintPhase = paintPhaseName(paintInfo.getPhase());
100 100
101 if ((mode & AnnotateElementId) && element) { 101 if ((mode & AnnotateElementId) && element) {
102 const AtomicString id = element->getIdAttribute(); 102 const AtomicString id = element->getIdAttribute();
103 if (!id.isNull() && !id.isEmpty()) 103 if (!id.isNull() && !id.isEmpty())
104 m_elementId = id.string(); 104 m_elementId = id.string();
105 } 105 }
106 106
107 if ((mode & AnnotateElementClass) && element && element->hasClass()) { 107 if ((mode & AnnotateElementClass) && element && element->hasClass()) {
108 SpaceSplitString classes = element->classNames(); 108 SpaceSplitString classes = element->classNames();
109 if (!classes.isNull() && classes.size() > 0) { 109 if (!classes.isNull() && classes.size() > 0) {
(...skipping 25 matching lines...) Expand all
135 if (!m_elementId.isEmpty()) 135 if (!m_elementId.isEmpty())
136 list.append(std::make_pair(AnnotationKeyElementId, m_elementId)); 136 list.append(std::make_pair(AnnotationKeyElementId, m_elementId));
137 137
138 if (!m_elementClass.isEmpty()) 138 if (!m_elementClass.isEmpty())
139 list.append(std::make_pair(AnnotationKeyElementClass, m_elementClass)); 139 list.append(std::make_pair(AnnotationKeyElementClass, m_elementClass));
140 140
141 if (!m_elementTag.isEmpty()) 141 if (!m_elementTag.isEmpty())
142 list.append(std::make_pair(AnnotationKeyElementTag, m_elementTag)); 142 list.append(std::make_pair(AnnotationKeyElementTag, m_elementTag));
143 } 143 }
144 144
145 void GraphicsContextAnnotator::annotate(const PaintInfo& paintInfo, const Render Object* object) 145 void GraphicsContextAnnotator::annotate(PaintInfo& paintInfo, const RenderObject * object)
146 { 146 {
147 ASSERT(!m_context); 147 ASSERT(!m_context);
148 148
149 m_context = paintInfo.context; 149 m_context = paintInfo.getContext();
150 m_context->beginAnnotation(GraphicsContextAnnotation(paintInfo, object)); 150 m_context->beginAnnotation(GraphicsContextAnnotation(paintInfo, object));
151 } 151 }
152 152
153 void GraphicsContextAnnotator::finishAnnotation() 153 void GraphicsContextAnnotator::finishAnnotation()
154 { 154 {
155 ASSERT(m_context); 155 ASSERT(m_context);
156 m_context->endAnnotation(); 156 m_context->endAnnotation();
157 } 157 }
158 158
159 } 159 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698