Changeset 147566 in webkit
- Timestamp:
- Apr 3, 2013 10:30:32 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r147565 r147566 1 2013-04-03 Antoine Quint <graouts@apple.com> 2 3 Web Inspector: DOM.highlightRect() and DOM.highlightQuad() should allow for page coordinates 4 https://bugs.webkit.org/show_bug.cgi?id=113869 5 6 Add a new "usePageCoordinates" parameter to DOM.highlightRect() and DOM.highlightQuad() 7 allowing to specify that the rect or quad to highlight should be converted to page 8 coordinates instead of using the default viewport coordinates. 9 10 Reviewed by Timothy Hatcher. 11 12 * inspector/Inspector.json: 13 * inspector/InspectorDOMAgent.cpp: 14 (WebCore::InspectorDOMAgent::highlightRect): 15 (WebCore::InspectorDOMAgent::highlightQuad): 16 (WebCore::InspectorDOMAgent::innerHighlightQuad): 17 Store the "usePageCoordinates" parameter obtained from the protocol calls onto the 18 highlight configuration object so that it may be used within the InspectorOverlay. 19 20 * inspector/InspectorDOMAgent.h: 21 (InspectorDOMAgent): 22 * inspector/InspectorOverlay.cpp: 23 (WebCore::InspectorOverlay::highlightQuad): 24 Check the highlight configuration for the "usePageCoordinates" parameter and 25 apply the inverse of the page's scroll offset to the quad if it's true. 26 27 * inspector/InspectorOverlay.h: 28 (HighlightConfig): 29 (WebCore::Highlight::setDataFromConfig): 30 (Highlight): 31 1 32 2013-04-03 Kangil Han <kangil.han@samsung.com> 2 33 -
trunk/Source/WebCore/inspector/Inspector.json
r147538 r147566 1976 1976 { "name": "height", "type": "integer", "description": "Rectangle height" }, 1977 1977 { "name": "color", "$ref": "RGBA", "optional": true, "description": "The highlight fill color (default: transparent)." }, 1978 { "name": "outlineColor", "$ref": "RGBA", "optional": true, "description": "The highlight outline color (default: transparent)." } 1978 { "name": "outlineColor", "$ref": "RGBA", "optional": true, "description": "The highlight outline color (default: transparent)." }, 1979 { "name": "usePageCoordinates", "type": "boolean", "optional": true, "description": "Indicates whether the provided parameters are in page coordinates or in viewport coordinates (the default)." } 1979 1980 ], 1980 1981 "description": "Highlights given rectangle. Coordinates are absolute with respect to the main frame viewport." … … 1985 1986 { "name": "quad", "$ref": "Quad", "description": "Quad to highlight" }, 1986 1987 { "name": "color", "$ref": "RGBA", "optional": true, "description": "The highlight fill color (default: transparent)." }, 1987 { "name": "outlineColor", "$ref": "RGBA", "optional": true, "description": "The highlight outline color (default: transparent)." } 1988 { "name": "outlineColor", "$ref": "RGBA", "optional": true, "description": "The highlight outline color (default: transparent)." }, 1989 { "name": "usePageCoordinates", "type": "boolean", "optional": true, "description": "Indicates whether the provided parameters are in page coordinates or in viewport coordinates (the default)." } 1988 1990 ], 1989 1991 "description": "Highlights given quad. Coordinates are absolute with respect to the main frame viewport." -
trunk/Source/WebCore/inspector/InspectorDOMAgent.cpp
r147428 r147566 1156 1156 } 1157 1157 1158 void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor )1158 void InspectorDOMAgent::highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor, const bool* usePageCoordinates) 1159 1159 { 1160 1160 OwnPtr<FloatQuad> quad = adoptPtr(new FloatQuad(FloatRect(x, y, width, height))); 1161 innerHighlightQuad(quad.release(), color, outlineColor );1162 } 1163 1164 void InspectorDOMAgent::highlightQuad(ErrorString* errorString, const RefPtr<InspectorArray>& quadArray, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor )1161 innerHighlightQuad(quad.release(), color, outlineColor, usePageCoordinates); 1162 } 1163 1164 void InspectorDOMAgent::highlightQuad(ErrorString* errorString, const RefPtr<InspectorArray>& quadArray, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor, const bool* usePageCoordinates) 1165 1165 { 1166 1166 OwnPtr<FloatQuad> quad = adoptPtr(new FloatQuad()); … … 1169 1169 return; 1170 1170 } 1171 innerHighlightQuad(quad.release(), color, outlineColor );1172 } 1173 1174 void InspectorDOMAgent::innerHighlightQuad(PassOwnPtr<FloatQuad> quad, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor )1171 innerHighlightQuad(quad.release(), color, outlineColor, usePageCoordinates); 1172 } 1173 1174 void InspectorDOMAgent::innerHighlightQuad(PassOwnPtr<FloatQuad> quad, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor, const bool* usePageCoordinates) 1175 1175 { 1176 1176 OwnPtr<HighlightConfig> highlightConfig = adoptPtr(new HighlightConfig()); 1177 1177 highlightConfig->content = parseColor(color); 1178 1178 highlightConfig->contentOutline = parseColor(outlineColor); 1179 highlightConfig->usePageCoordinates = *usePageCoordinates; 1179 1180 m_overlay->highlightQuad(quad, *highlightConfig); 1180 1181 } -
trunk/Source/WebCore/inspector/InspectorDOMAgent.h
r147428 r147566 146 146 virtual void releaseBackendNodeIds(ErrorString*, const String& nodeGroup); 147 147 virtual void hideHighlight(ErrorString*); 148 virtual void highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor );149 virtual void highlightQuad(ErrorString*, const RefPtr<InspectorArray>& quad, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor );148 virtual void highlightRect(ErrorString*, int x, int y, int width, int height, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor, const bool* usePageCoordinates); 149 virtual void highlightQuad(ErrorString*, const RefPtr<InspectorArray>& quad, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor, const bool* usePageCoordinates); 150 150 virtual void highlightNode(ErrorString*, const RefPtr<InspectorObject>& highlightConfig, const int* nodeId, const String* objectId); 151 151 virtual void highlightFrame(ErrorString*, const String& frameId, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor); … … 242 242 void discardBindings(); 243 243 244 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor );244 void innerHighlightQuad(PassOwnPtr<FloatQuad>, const RefPtr<InspectorObject>* color, const RefPtr<InspectorObject>* outlineColor, const bool* usePageCoordinates); 245 245 246 246 InspectorPageAgent* m_pageAgent; -
trunk/Source/WebCore/inspector/InspectorOverlay.cpp
r147202 r147566 260 260 void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const HighlightConfig& highlightConfig) 261 261 { 262 if (m_quadHighlightConfig.usePageCoordinates) 263 *quad -= m_page->mainFrame()->view()->scrollOffset(); 264 262 265 m_quadHighlightConfig = highlightConfig; 263 266 m_highlightQuad = quad; -
trunk/Source/WebCore/inspector/InspectorOverlay.h
r147202 r147566 60 60 bool showInfo; 61 61 bool showRulers; 62 bool usePageCoordinates; 62 63 }; 63 64 … … 82 83 marginColor = highlightConfig.margin; 83 84 showRulers = highlightConfig.showRulers; 85 usePageCoordinates = highlightConfig.usePageCoordinates; 84 86 } 85 87 … … 95 97 Vector<FloatQuad> quads; 96 98 bool showRulers; 99 bool usePageCoordinates; 97 100 }; 98 101
Note: See TracChangeset
for help on using the changeset viewer.