| Index: Source/core/platform/graphics/GraphicsContextAnnotation.cpp
|
| diff --git a/Source/core/platform/graphics/GraphicsContextAnnotation.cpp b/Source/core/platform/graphics/GraphicsContextAnnotation.cpp
|
| index f64714f55876a0487481b5edaef7ca9015885280..97af0bf13287a7c29a4120d357d6b187c0860eb9 100644
|
| --- a/Source/core/platform/graphics/GraphicsContextAnnotation.cpp
|
| +++ b/Source/core/platform/graphics/GraphicsContextAnnotation.cpp
|
| @@ -32,10 +32,6 @@
|
| #include "core/platform/graphics/GraphicsContextAnnotation.h"
|
|
|
| #include "core/platform/graphics/GraphicsContext.h"
|
| -#include "core/rendering/PaintInfo.h"
|
| -#include "core/rendering/PaintPhase.h"
|
| -#include "core/rendering/RenderObject.h"
|
| -#include "wtf/text/StringBuilder.h"
|
|
|
| namespace {
|
|
|
| @@ -45,83 +41,17 @@ const char* AnnotationKeyElementId = "ID";
|
| const char* AnnotationKeyElementClass = "CLASS";
|
| const char* AnnotationKeyElementTag = "TAG";
|
|
|
| -static const char* paintPhaseName(WebCore::PaintPhase phase)
|
| -{
|
| - switch (phase) {
|
| - case WebCore::PaintPhaseBlockBackground:
|
| - return "BlockBackground";
|
| - case WebCore::PaintPhaseChildBlockBackground:
|
| - return "ChildBlockBackground";
|
| - case WebCore::PaintPhaseChildBlockBackgrounds:
|
| - return "ChildBlockBackgrounds";
|
| - case WebCore::PaintPhaseFloat:
|
| - return "Float";
|
| - case WebCore::PaintPhaseForeground:
|
| - return "Foreground";
|
| - case WebCore::PaintPhaseOutline:
|
| - return "Outline";
|
| - case WebCore::PaintPhaseChildOutlines:
|
| - return "ChildOutlines";
|
| - case WebCore::PaintPhaseSelfOutline:
|
| - return "SelfOutline";
|
| - case WebCore::PaintPhaseSelection:
|
| - return "Selection";
|
| - case WebCore::PaintPhaseCollapsedTableBorders:
|
| - return "CollapsedTableBorders";
|
| - case WebCore::PaintPhaseTextClip:
|
| - return "TextClip";
|
| - case WebCore::PaintPhaseMask:
|
| - return "Mask";
|
| - case WebCore::PaintPhaseClippingMask:
|
| - return "ClippingMask";
|
| - default:
|
| - ASSERT_NOT_REACHED();
|
| - return "<unknown>";
|
| - }
|
| -}
|
| -
|
| }
|
|
|
| namespace WebCore {
|
|
|
| -GraphicsContextAnnotation::GraphicsContextAnnotation(const PaintInfo& paintInfo, const RenderObject* object)
|
| - : m_rendererName(0)
|
| - , m_paintPhase(0)
|
| +GraphicsContextAnnotation::GraphicsContextAnnotation(const char* rendererName, const char* paintPhase, const String& elementId, const String& elementClass, const String& elementTag)
|
| + : m_rendererName(rendererName)
|
| + , m_paintPhase(paintPhase)
|
| + , m_elementId(elementId)
|
| + , m_elementClass(elementClass)
|
| + , m_elementTag(elementTag)
|
| {
|
| - ASSERT(paintInfo.context);
|
| - ASSERT(object);
|
| -
|
| - AnnotationModeFlags mode = paintInfo.context->annotationMode();
|
| - Element* element = object->node() && object->node()->isElementNode() ? toElement(object->node()) : 0;
|
| -
|
| - if (mode & AnnotateRendererName)
|
| - m_rendererName = object->renderName();
|
| -
|
| - if (mode & AnnotatePaintPhase)
|
| - m_paintPhase = paintPhaseName(paintInfo.phase);
|
| -
|
| - if ((mode & AnnotateElementId) && element) {
|
| - const AtomicString id = element->getIdAttribute();
|
| - if (!id.isNull() && !id.isEmpty())
|
| - m_elementId = id.string();
|
| - }
|
| -
|
| - if ((mode & AnnotateElementClass) && element && element->hasClass()) {
|
| - SpaceSplitString classes = element->classNames();
|
| - if (!classes.isNull() && classes.size() > 0) {
|
| - StringBuilder classBuilder;
|
| - for (size_t i = 0; i < classes.size(); ++i) {
|
| - if (i > 0)
|
| - classBuilder.append(" ");
|
| - classBuilder.append(classes[i]);
|
| - }
|
| -
|
| - m_elementClass = classBuilder.toString();
|
| - }
|
| - }
|
| -
|
| - if ((mode & AnnotateElementTag) && element)
|
| - m_elementTag = element->tagName();
|
| }
|
|
|
| void GraphicsContextAnnotation::asAnnotationList(AnnotationList &list) const
|
| @@ -144,18 +74,4 @@ void GraphicsContextAnnotation::asAnnotationList(AnnotationList &list) const
|
| list.append(std::make_pair(AnnotationKeyElementTag, m_elementTag));
|
| }
|
|
|
| -void GraphicsContextAnnotator::annotate(const PaintInfo& paintInfo, const RenderObject* object)
|
| -{
|
| - ASSERT(!m_context);
|
| -
|
| - m_context = paintInfo.context;
|
| - m_context->beginAnnotation(GraphicsContextAnnotation(paintInfo, object));
|
| -}
|
| -
|
| -void GraphicsContextAnnotator::finishAnnotation()
|
| -{
|
| - ASSERT(m_context);
|
| - m_context->endAnnotation();
|
| -}
|
| -
|
| }
|
|
|