Title: [110580] trunk
Revision
110580
Author
[email protected]
Date
2012-03-13 11:02:45 -0700 (Tue, 13 Mar 2012)

Log Message

Add a method to window.internals to enable testing of inspector highlight rects
https://bugs.webkit.org/show_bug.cgi?id=80338

Patch by Max Vujovic <[email protected]> on 2012-03-13
Reviewed by Pavel Feldman.

.:

* Source/autotools/symbols.filter: Export symbols for GTK.

Source/WebCore:

Add window.internals.inspectorHighlightRects, a method which makes it possible to test the
positions and sizes of inspector highlight rects.

Test: inspector/elements/highlight-node.html

* WebCore.exp.in: Export symbols.
* testing/Internals.cpp:
(WebCore::Internals::inspectorHighlightRects): Call InspectorController::getHighlight and
return the highlight's quads as a ClientRectList.
(WebCore):
* testing/Internals.h:
(WebCore):
(Internals):
* testing/Internals.idl:

    Add inspectorHighlightRects to the window.internals interface.

Source/WebKit2:

* win/WebKit2.def: Export symbols for win.
* win/WebKit2CFLite.def: Same as above.

LayoutTests:

* inspector/elements/highlight-node-expected.txt: Added.
* inspector/elements/highlight-node.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (110579 => 110580)


--- trunk/ChangeLog	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/ChangeLog	2012-03-13 18:02:45 UTC (rev 110580)
@@ -1,3 +1,12 @@
+2012-03-13  Max Vujovic  <[email protected]>
+
+        Add a method to window.internals to enable testing of inspector highlight rects
+        https://bugs.webkit.org/show_bug.cgi?id=80338
+
+        Reviewed by Pavel Feldman.
+
+        * Source/autotools/symbols.filter: Export symbols for GTK.
+
 2012-03-12  Scott Byer  <[email protected]>
 
         Cleanup obsolete files.

Modified: trunk/LayoutTests/ChangeLog (110579 => 110580)


--- trunk/LayoutTests/ChangeLog	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/LayoutTests/ChangeLog	2012-03-13 18:02:45 UTC (rev 110580)
@@ -1,3 +1,13 @@
+2012-03-13  Max Vujovic  <[email protected]>
+
+        Add a method to window.internals to enable testing of inspector highlight rects
+        https://bugs.webkit.org/show_bug.cgi?id=80338
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/elements/highlight-node-expected.txt: Added.
+        * inspector/elements/highlight-node.html: Added.
+
 2012-03-13  Adam Barth  <[email protected]>
 
         Note that fast/loader/window-properties-restored-from-page-cache.html

Added: trunk/LayoutTests/inspector/elements/highlight-node-expected.txt (0 => 110580)


--- trunk/LayoutTests/inspector/elements/highlight-node-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/inspector/elements/highlight-node-expected.txt	2012-03-13 18:02:45 UTC (rev 110580)
@@ -0,0 +1,7 @@
+This test verifies the position and size of the highlight rectangles overlayed on an inspected div.
+
+margin rect is 260 x 260 at (0, 0)
+border rect is 250 x 250 at (5, 5)
+padding rect is 230 x 230 at (15, 15)
+content rect is 200 x 200 at (30, 30)
+

Added: trunk/LayoutTests/inspector/elements/highlight-node.html (0 => 110580)


--- trunk/LayoutTests/inspector/elements/highlight-node.html	                        (rev 0)
+++ trunk/LayoutTests/inspector/elements/highlight-node.html	2012-03-13 18:02:45 UTC (rev 110580)
@@ -0,0 +1,66 @@
+<html>
+<head>
+
+<style>
+
+body {
+    margin: 0;
+}
+#container {
+    width: 400px;
+    height: 400px;
+    background-color: grey;
+}
+#inspectedElement {
+    margin: 5px;
+    border: solid 10px aqua;
+    padding: 15px;
+    width: 200px;
+    height: 200px;
+    background-color: blue;
+    float: left;
+}
+#description {
+    clear: both;
+}
+
+</style>
+
+<script src=""
+<script src=""
+<script>
+
+function dumpInspectorHighlightRects()
+{
+    var rectNames = ["margin", "border", "padding", "content"];
+    var rects = window.internals.inspectorHighlightRects(document);
+    for (var i = 0; i < rects.length; i++)
+    {
+        var rectName = (i < rectNames.length ? rectNames[i] : "untitled");
+        var rect = rects.item(i);
+        var line = rectName + " rect is " + rect.width + " x " + rect.height + " at (" + rect.top + ", " + rect.left + ")<br/>";
+        document.getElementById("console").innerHTML += line;
+    }
+}
+
+function test()
+{
+    function nodeSelected(node)
+    {
+        RuntimeAgent.evaluate("dumpInspectorHighlightRects()", InspectorTest.completeTest);
+    }
+
+    InspectorTest.selectNodeWithId("inspectedElement", nodeSelected);
+}
+
+</script>
+</head>
+
+<body _onload_="runTest()">
+
+<div id="inspectedElement"></div>
+<p id="description">This test verifies the position and size of the highlight rectangles overlayed on an inspected div.</p>
+<div id="console"></div>
+
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (110579 => 110580)


--- trunk/Source/WebCore/ChangeLog	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebCore/ChangeLog	2012-03-13 18:02:45 UTC (rev 110580)
@@ -1,3 +1,27 @@
+2012-03-13  Max Vujovic  <[email protected]>
+
+        Add a method to window.internals to enable testing of inspector highlight rects
+        https://bugs.webkit.org/show_bug.cgi?id=80338
+
+        Reviewed by Pavel Feldman.
+
+        Add window.internals.inspectorHighlightRects, a method which makes it possible to test the
+        positions and sizes of inspector highlight rects.
+
+        Test: inspector/elements/highlight-node.html
+
+        * WebCore.exp.in: Export symbols.
+        * testing/Internals.cpp:
+        (WebCore::Internals::inspectorHighlightRects): Call InspectorController::getHighlight and
+        return the highlight's quads as a ClientRectList.
+        (WebCore):
+        * testing/Internals.h:
+        (WebCore):
+        (Internals):
+        * testing/Internals.idl:
+
+            Add inspectorHighlightRects to the window.internals interface.
+
 2012-03-13  Konrad Piascik  <[email protected]>
 
         [BlackBerry] Remove sublayers before clamping just in case the layer already exists

Modified: trunk/Source/WebCore/WebCore.exp.in (110579 => 110580)


--- trunk/Source/WebCore/WebCore.exp.in	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebCore/WebCore.exp.in	2012-03-13 18:02:45 UTC (rev 110580)
@@ -322,6 +322,9 @@
 __ZN7WebCore14CachedResource12removeClientEPNS_20CachedResourceClientE
 __ZN7WebCore14CachedResource16unregisterHandleEPNS_24CachedResourceHandleBaseE
 __ZN7WebCore14CachedResource9addClientEPNS_20CachedResourceClientE
+__ZN7WebCore14ClientRectListC1ERKN3WTF6VectorINS_9FloatQuadELm0EEE
+__ZN7WebCore14ClientRectListC1Ev
+__ZN7WebCore14ClientRectListD1Ev
 __ZN7WebCore14DocumentLoader10commitDataEPKcm
 __ZN7WebCore14DocumentLoader13attachToFrameEv
 __ZN7WebCore14DocumentLoader15detachFromFrameEv
@@ -810,6 +813,7 @@
 __ZN7WebCore4coreEP20NSURLProtectionSpace
 __ZN7WebCore4coreEP28NSURLAuthenticationChallenge
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE
+__ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_14ClientRectListE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_19CSSStyleDeclarationE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE
 __ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_8NodeListE
@@ -1325,6 +1329,7 @@
 __ZNK7WebCore17RegularExpression9searchRevERKN3WTF6StringE
 __ZNK7WebCore17ResourceErrorBase8lazyInitEv
 __ZNK7WebCore19AnimationController24numberOfActiveAnimationsEPNS_8DocumentE
+__ZNK7WebCore19InspectorController12getHighlightEPNS_9HighlightE
 __ZNK7WebCore19ResourceRequestBase10httpMethodEv
 __ZNK7WebCore19ResourceRequestBase15httpHeaderFieldEPKc
 __ZNK7WebCore19ResourceRequestBase3urlEv

Modified: trunk/Source/WebCore/testing/Internals.cpp (110579 => 110580)


--- trunk/Source/WebCore/testing/Internals.cpp	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebCore/testing/Internals.cpp	2012-03-13 18:02:45 UTC (rev 110580)
@@ -28,6 +28,8 @@
 
 #include "CachedResourceLoader.h"
 #include "ClientRect.h"
+#include "ClientRectList.h"
+#include "DOMNodeHighlighter.h"
 #include "Document.h"
 #include "DocumentMarker.h"
 #include "DocumentMarkerController.h"
@@ -335,6 +337,24 @@
     return ClientRect::create(renderer->absoluteBoundingBoxRectIgnoringTransforms());
 }
 
+PassRefPtr<ClientRectList> Internals::inspectorHighlightRects(Document* document, ExceptionCode& ec)
+{
+#if ENABLE(INSPECTOR)
+    if (!document || !document->page() || !document->page()->inspectorController()) {
+        ec = INVALID_ACCESS_ERR;
+        return ClientRectList::create();
+    }
+
+    Highlight highlight;
+    document->page()->inspectorController()->getHighlight(&highlight);
+    return ClientRectList::create(highlight.quads);
+#else
+    UNUSED_PARAM(document);
+    UNUSED_PARAM(ec);
+    return ClientRectList::create();
+#endif
+}
+
 unsigned Internals::markerCountForNode(Node* node, const String& markerType, ExceptionCode& ec)
 {
     if (!node) {

Modified: trunk/Source/WebCore/testing/Internals.h (110579 => 110580)


--- trunk/Source/WebCore/testing/Internals.h	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebCore/testing/Internals.h	2012-03-13 18:02:45 UTC (rev 110580)
@@ -35,6 +35,7 @@
 namespace WebCore {
 
 class ClientRect;
+class ClientRectList;
 class Document;
 class DocumentMarker;
 class Element;
@@ -88,6 +89,8 @@
 
     PassRefPtr<ClientRect> boundingBox(Element*, ExceptionCode&);
 
+    PassRefPtr<ClientRectList> inspectorHighlightRects(Document*, ExceptionCode&);
+
     unsigned markerCountForNode(Node*, const String&, ExceptionCode&);
     PassRefPtr<Range> markerRangeForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);
     String markerDescriptionForNode(Node*, const String& markerType, unsigned index, ExceptionCode&);

Modified: trunk/Source/WebCore/testing/Internals.idl (110579 => 110580)


--- trunk/Source/WebCore/testing/Internals.idl	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebCore/testing/Internals.idl	2012-03-13 18:02:45 UTC (rev 110580)
@@ -63,6 +63,9 @@
 #endif
 
         ClientRect boundingBox(in Element element) raises(DOMException);
+
+        ClientRectList inspectorHighlightRects(in Document document) raises (DOMException);
+
         unsigned long markerCountForNode(in Node node, in DOMString markerType) raises(DOMException);
         Range markerRangeForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException);
         DOMString markerDescriptionForNode(in Node node, in DOMString markerType, in unsigned long index) raises(DOMException);

Modified: trunk/Source/WebKit2/ChangeLog (110579 => 110580)


--- trunk/Source/WebKit2/ChangeLog	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebKit2/ChangeLog	2012-03-13 18:02:45 UTC (rev 110580)
@@ -1,3 +1,13 @@
+2012-03-13  Max Vujovic  <[email protected]>
+
+        Add a method to window.internals to enable testing of inspector highlight rects
+        https://bugs.webkit.org/show_bug.cgi?id=80338
+
+        Reviewed by Pavel Feldman.
+
+        * win/WebKit2.def: Export symbols for win.
+        * win/WebKit2CFLite.def: Same as above.
+
 2012-03-13  Allan Sandfeld Jensen  <[email protected]>
 
         [Qt] Set correct device width and height.

Modified: trunk/Source/WebKit2/win/WebKit2.def (110579 => 110580)


--- trunk/Source/WebKit2/win/WebKit2.def	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebKit2/win/WebKit2.def	2012-03-13 18:02:45 UTC (rev 110580)
@@ -142,6 +142,9 @@
         ?toNode@WebCore@@YAPAVNode@1@VJSValue@JSC@@@Z
         ??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z
         ??0ClientRect@WebCore@@AAE@XZ
+        ??0ClientRectList@WebCore@@AAE@XZ
+        ??0ClientRectList@WebCore@@AAE@ABV?$Vector@VFloatQuad@WebCore@@$0A@@WTF@@@Z
+        ??1ClientRectList@WebCore@@QAE@XZ
         ??0String@WTF@@QAE@PBD@Z
         ??0String@WTF@@QAE@PB_W@Z
         ??1FrameDestructionObserver@WebCore@@MAE@XZ
@@ -164,6 +167,7 @@
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ
         ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
+        ?getHighlight@InspectorController@WebCore@@QBEXPAUHighlight@2@@Z
         ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z
         ?hasShadowRoot@Element@WebCore@@QBE_NXZ
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
@@ -197,6 +201,7 @@
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z
+        ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRectList@1@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVRange@1@@Z
         ?toRange@WebCore@@YAPAVRange@1@VJSValue@JSC@@@Z

Modified: trunk/Source/WebKit2/win/WebKit2CFLite.def (110579 => 110580)


--- trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/WebKit2/win/WebKit2CFLite.def	2012-03-13 18:02:45 UTC (rev 110580)
@@ -135,6 +135,9 @@
         ?toNode@WebCore@@YAPAVNode@1@VJSValue@JSC@@@Z
         ??0ClientRect@WebCore@@AAE@ABVIntRect@1@@Z
         ??0ClientRect@WebCore@@AAE@XZ
+        ??0ClientRectList@WebCore@@AAE@XZ
+        ??0ClientRectList@WebCore@@AAE@ABV?$Vector@VFloatQuad@WebCore@@$0A@@WTF@@@Z
+        ??1ClientRectList@WebCore@@QAE@XZ
         ??0String@WTF@@QAE@PBD@Z
         ??0String@WTF@@QAE@PB_W@Z
         ??1FrameDestructionObserver@WebCore@@MAE@XZ
@@ -157,6 +160,7 @@
         ?getCachedDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PBUClassInfo@3@@Z
         ?getData16SlowCase@StringImpl@WTF@@ABEPB_WXZ
         ?getElementById@TreeScope@WebCore@@QBEPAVElement@2@ABVAtomicString@WTF@@@Z
+        ?getHighlight@InspectorController@WebCore@@QBEXPAUHighlight@2@@Z
         ?getLocationAndLengthFromRange@TextIterator@WebCore@@SA_NPAVElement@2@PBVRange@2@AAI2@Z
         ?hasShadowRoot@Element@WebCore@@QBE_NXZ
         ?isPreloaded@CachedResourceLoader@WebCore@@QBE_NABVString@WTF@@@Z
@@ -190,6 +194,7 @@
         ?toDocument@WebCore@@YAPAVDocument@1@VJSValue@JSC@@@Z
         ?toElement@WebCore@@YAPAVElement@1@VJSValue@JSC@@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRect@1@@Z
+        ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVClientRectList@1@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
         ?toJS@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVRange@1@@Z
         ?toRange@WebCore@@YAPAVRange@1@VJSValue@JSC@@@Z

Modified: trunk/Source/autotools/symbols.filter (110579 => 110580)


--- trunk/Source/autotools/symbols.filter	2012-03-13 17:57:12 UTC (rev 110579)
+++ trunk/Source/autotools/symbols.filter	2012-03-13 18:02:45 UTC (rev 110580)
@@ -30,6 +30,7 @@
 _ZN7WebCore4Page18setPageScaleFactorEfRKNS_8IntPointE;
 _ZN7WebCore4Page13setPaginationERKNS0_10PaginationE;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_10ClientRectE;
+_ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_14ClientRectListE;
 _ZN7WebCore4toJSEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_5RangeE;
 _ZN7WebCore5Range6createEN3WTF10PassRefPtrINS_8DocumentEEENS2_INS_4NodeEEEiS6_i;
 _ZN7WebCore5RangeD1Ev;
@@ -49,6 +50,9 @@
 _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERjS6_;
 _ZN7WebCore12TextIterator29getLocationAndLengthFromRangeEPNS_7ElementEPKNS_5RangeERmS6_;
 _ZN7WebCore13createWrapperEPN3JSC9ExecStateEPNS_17JSDOMGlobalObjectEPNS_4NodeE;
+_ZN7WebCore14ClientRectListC1ERKN3WTF6VectorINS_9FloatQuadELm0EEE;
+_ZN7WebCore14ClientRectListC1Ev;
+_ZN7WebCore14ClientRectListD1Ev;
 _ZN7WebCore15setDOMExceptionEPN3JSC9ExecStateEi;
 _ZN7WebCore16HTMLInputElement17setSuggestedValueERKN3WTF6StringE;
 _ZN7WebCore16jsStringSlowCaseEPN3JSC9ExecStateERN3WTF7HashMapIPNS3_10StringImplENS0_4WeakINS0_8JSStringEEENS3_10StringHashENS3_10HashTraitsIS6_EENSB_IS9_EEEES6_;
@@ -88,6 +92,7 @@
 _ZNK7WebCore5Range4textEv;
 _ZNK7WebCore9TreeScope14getElementByIdERKN3WTF12AtomicStringE;
 _ZNK7WebCore14DocumentMarker11descriptionEv;
+_ZNK7WebCore19InspectorController12getHighlightEPNS_9HighlightE;
 _ZN7WebCore14ScrollableArea28setScrollOffsetFromInternalsERKNS_8IntPointE;
 _ZN7WebCore10ScrollView23setScrollbarsSuppressedEbb;
 _ZN7WebCore8Settings24setMockScrollbarsEnabledEb;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to