| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 #include "wtf/Vector.h" | 41 #include "wtf/Vector.h" |
| 42 #include "wtf/text/WTFString.h" | 42 #include "wtf/text/WTFString.h" |
| 43 | 43 |
| 44 namespace blink { | 44 namespace blink { |
| 45 | 45 |
| 46 class Color; | 46 class Color; |
| 47 class EmptyChromeClient; | 47 class EmptyChromeClient; |
| 48 class GraphicsContext; | 48 class GraphicsContext; |
| 49 class InspectorClient; | 49 class InspectorClient; |
| 50 class InspectorOverlayHost; | 50 class InspectorOverlayHost; |
| 51 class JSONObject; | |
| 52 class JSONValue; | 51 class JSONValue; |
| 53 class Node; | 52 class Node; |
| 54 class Page; | 53 class Page; |
| 55 class PlatformGestureEvent; | 54 class PlatformGestureEvent; |
| 56 class PlatformKeyboardEvent; | 55 class PlatformKeyboardEvent; |
| 57 class PlatformMouseEvent; | 56 class PlatformMouseEvent; |
| 58 class PlatformTouchEvent; | 57 class PlatformTouchEvent; |
| 59 | 58 |
| 60 struct HighlightConfig { | 59 struct HighlightConfig { |
| 61 WTF_MAKE_FAST_ALLOCATED; | 60 WTF_MAKE_FAST_ALLOCATED; |
| 62 public: | 61 public: |
| 63 Color content; | 62 Color content; |
| 64 Color contentOutline; | 63 Color contentOutline; |
| 65 Color padding; | 64 Color padding; |
| 66 Color border; | 65 Color border; |
| 67 Color margin; | 66 Color margin; |
| 68 Color eventTarget; | 67 Color eventTarget; |
| 68 Color shape; |
| 69 Color shapeMargin; |
| 70 |
| 69 bool showInfo; | 71 bool showInfo; |
| 70 bool showRulers; | 72 bool showRulers; |
| 71 bool showExtensionLines; | 73 bool showExtensionLines; |
| 72 }; | 74 }; |
| 73 | |
| 74 enum HighlightType { | |
| 75 HighlightTypeNode, | |
| 76 HighlightTypeRects, | |
| 77 }; | |
| 78 | |
| 79 struct Highlight { | |
| 80 Highlight() | |
| 81 : type(HighlightTypeNode) | |
| 82 , showRulers(false) | |
| 83 { | |
| 84 } | |
| 85 | |
| 86 void setDataFromConfig(const HighlightConfig& highlightConfig) | |
| 87 { | |
| 88 contentColor = highlightConfig.content; | |
| 89 contentOutlineColor = highlightConfig.contentOutline; | |
| 90 paddingColor = highlightConfig.padding; | |
| 91 borderColor = highlightConfig.border; | |
| 92 marginColor = highlightConfig.margin; | |
| 93 eventTargetColor = highlightConfig.eventTarget; | |
| 94 showRulers = highlightConfig.showRulers; | |
| 95 showExtensionLines = highlightConfig.showExtensionLines; | |
| 96 } | |
| 97 | |
| 98 Color contentColor; | |
| 99 Color contentOutlineColor; | |
| 100 Color paddingColor; | |
| 101 Color borderColor; | |
| 102 Color marginColor; | |
| 103 Color eventTargetColor; | |
| 104 | |
| 105 // When the type is Node, there are 4 or 5 quads (margin, border, padding, c
ontent, optional eventTarget). | |
| 106 // When the type is Rects, this is just a list of quads. | |
| 107 HighlightType type; | |
| 108 Vector<FloatQuad> quads; | |
| 109 bool showRulers; | |
| 110 bool showExtensionLines; | |
| 111 }; | |
| 112 | 75 |
| 113 class InspectorOverlay { | 76 class InspectorOverlay { |
| 114 WTF_MAKE_FAST_ALLOCATED; | 77 WTF_MAKE_FAST_ALLOCATED; |
| 115 public: | 78 public: |
| 116 static PassOwnPtr<InspectorOverlay> create(Page* page, InspectorClient* clie
nt) | 79 static PassOwnPtr<InspectorOverlay> create(Page* page, InspectorClient* clie
nt) |
| 117 { | 80 { |
| 118 return adoptPtr(new InspectorOverlay(page, client)); | 81 return adoptPtr(new InspectorOverlay(page, client)); |
| 119 } | 82 } |
| 120 | 83 |
| 121 ~InspectorOverlay(); | 84 ~InspectorOverlay(); |
| 122 | 85 |
| 123 void update(); | 86 void update(); |
| 124 void hide(); | 87 void hide(); |
| 125 void paint(GraphicsContext&); | 88 void paint(GraphicsContext&); |
| 126 void drawOutline(GraphicsContext*, const LayoutRect&, const Color&); | 89 void drawOutline(GraphicsContext*, const LayoutRect&, const Color&); |
| 127 bool handleGestureEvent(const PlatformGestureEvent&); | 90 bool handleGestureEvent(const PlatformGestureEvent&); |
| 128 bool handleMouseEvent(const PlatformMouseEvent&); | 91 bool handleMouseEvent(const PlatformMouseEvent&); |
| 129 bool handleTouchEvent(const PlatformTouchEvent&); | 92 bool handleTouchEvent(const PlatformTouchEvent&); |
| 130 bool handleKeyboardEvent(const PlatformKeyboardEvent&); | 93 bool handleKeyboardEvent(const PlatformKeyboardEvent&); |
| 131 | 94 |
| 132 void setPausedInDebuggerMessage(const String*); | 95 void setPausedInDebuggerMessage(const String*); |
| 133 void setInspectModeEnabled(bool); | 96 void setInspectModeEnabled(bool); |
| 134 | 97 |
| 135 void hideHighlight(); | 98 void hideHighlight(); |
| 136 void highlightNode(Node*, Node* eventTarget, const HighlightConfig&, bool om
itTooltip); | 99 void highlightNode(Node*, Node* eventTarget, const HighlightConfig&, bool om
itTooltip); |
| 137 void highlightQuad(PassOwnPtr<FloatQuad>, const HighlightConfig&); | 100 void highlightQuad(PassOwnPtr<FloatQuad>, const HighlightConfig&); |
| 138 void showAndHideViewSize(bool showGrid); | 101 void showAndHideViewSize(bool showGrid); |
| 139 | 102 |
| 140 Node* highlightedNode() const; | 103 Node* highlightedNode() const; |
| 141 bool getBoxModel(Node*, Vector<FloatQuad>*); | 104 bool getBoxModel(Node*, RefPtr<TypeBuilder::DOM::BoxModel>&); |
| 142 PassRefPtr<TypeBuilder::DOM::ShapeOutsideInfo> buildObjectForShapeOutside(No
de*); | |
| 143 | 105 |
| 144 void freePage(); | 106 void freePage(); |
| 145 | 107 |
| 146 InspectorOverlayHost* overlayHost() const { return m_overlayHost.get(); } | 108 InspectorOverlayHost* overlayHost() const { return m_overlayHost.get(); } |
| 147 | 109 |
| 148 void startedRecordingProfile(); | 110 void startedRecordingProfile(); |
| 149 void finishedRecordingProfile() { m_activeProfilerCount--; } | 111 void finishedRecordingProfile() { m_activeProfilerCount--; } |
| 150 | 112 |
| 151 // Methods supporting underlying overlay page. | 113 // Methods supporting underlying overlay page. |
| 152 void invalidate(); | 114 void invalidate(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 182 bool m_drawViewSizeWithGrid; | 144 bool m_drawViewSizeWithGrid; |
| 183 bool m_omitTooltip; | 145 bool m_omitTooltip; |
| 184 Timer<InspectorOverlay> m_timer; | 146 Timer<InspectorOverlay> m_timer; |
| 185 int m_activeProfilerCount; | 147 int m_activeProfilerCount; |
| 186 }; | 148 }; |
| 187 | 149 |
| 188 } // namespace blink | 150 } // namespace blink |
| 189 | 151 |
| 190 | 152 |
| 191 #endif // InspectorOverlay_h | 153 #endif // InspectorOverlay_h |
| OLD | NEW |