Index: Source/core/rendering/GraphicsContextAnnotator.h |
diff --git a/Source/core/dom/ParentNode.h b/Source/core/rendering/GraphicsContextAnnotator.h |
similarity index 67% |
copy from Source/core/dom/ParentNode.h |
copy to Source/core/rendering/GraphicsContextAnnotator.h |
index 9fb949a35b0aefb308f11af7253806ad7167cbe8..5d0936e551e5e3df46960cb7ff95ac2bc47d1b02 100644 |
--- a/Source/core/dom/ParentNode.h |
+++ b/Source/core/rendering/GraphicsContextAnnotator.h |
@@ -1,4 +1,5 @@ |
/* |
+ * Copyright (C) 2013 Google Inc. All rights reserved. |
* Copyright (C) 2013 Samsung Electronics. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
@@ -28,36 +29,40 @@ |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
*/ |
-#ifndef ParentNode_h |
-#define ParentNode_h |
+#ifndef GraphicsContextAnnotator_h |
+#define GraphicsContextAnnotator_h |
-#include "core/dom/ContainerNode.h" |
+#define ANNOTATE_GRAPHICS_CONTEXT(paintInfo, renderer) \ |
+ GraphicsContextAnnotator scopedGraphicsContextAnnotator; \ |
+ if (UNLIKELY(paintInfo.context->annotationMode())) \ |
+ scopedGraphicsContextAnnotator.annotate(paintInfo, renderer) |
namespace WebCore { |
-class ParentNode { |
+class GraphicsContext; |
+struct PaintInfo; |
+class RenderObject; |
+ |
+class GraphicsContextAnnotator { |
public: |
- static PassRefPtr<HTMLCollection> children(ContainerNode* node) |
- { |
- return node->children(); |
- } |
+ GraphicsContextAnnotator() |
+ : m_context(0) |
+ { } |
- static Element* firstElementChild(ContainerNode* node) |
+ ~GraphicsContextAnnotator() |
{ |
- return node->firstElementChild(); |
+ if (UNLIKELY(m_context != 0)) |
+ finishAnnotation(); |
} |
- static Element* lastElementChild(ContainerNode* node) |
- { |
- return node->lastElementChild(); |
- } |
+ void annotate(const PaintInfo&, const RenderObject*); |
- static unsigned childElementCount(ContainerNode* node) |
- { |
- return node->childElementCount(); |
- } |
+private: |
+ void finishAnnotation(); |
+ |
+ GraphicsContext* m_context; |
}; |
} // namespace WebCore |
-#endif // ParentNode_h |
+#endif // GraphicsContextAnnotator_h |