haikuwebkit/Source/WebInspectorUI/UserInterface/Test
BJ Burg c0999c3214 Web Inspector: implement the basics for showing/hiding grid overlays
https://bugs.webkit.org/show_bug.cgi?id=221062

Reviewed by Devin Rousso.

Source/JavaScriptCore:

Add new commands to show and hide CSS grid overlays:

    - DOM.showGridOverlay
    - DOM.hideGridOverlay

* inspector/protocol/DOM.json:

Source/WebCore:

Implement backend commands for showing and hiding CSS grid overlays.
This patch draws a very simplistic grid overlay. Support for the
various grid overlay options will be added in later patches.

New test: inspector/dom/showGridOverlay.html

* inspector/InspectorOverlay.h:
(WebCore::InspectorOverlay::gridOverlayCount const):
Added, for testing only.

* inspector/InspectorOverlay.cpp:
(WebCore::InspectorOverlay::paint):
(WebCore::InspectorOverlay::shouldShowOverlay const):
Hook up the painting of any active grid overlays.

(WebCore::InspectorOverlay::setGridOverlayForNode):
(WebCore::InspectorOverlay::clearGridOverlayForNode):
(WebCore::InspectorOverlay::clearAllGridOverlays):
Maintain the list of active grid overlays. A node can only
have one grid overlay at a time.

(WebCore::InspectorOverlay::drawNodeHighlight):
Add a note about why grid overlays are not considered when
calculating the ruler exclusion area.

(WebCore::InspectorOverlay::drawGridOverlay): Added.
This drawing code exists to flesh out the rest of this patch,
and is obviously incomplete.

Draw grid lines that extend to the edge of the viewport,
equivalent to `config.showExtendedGridLines = true`.

* inspector/agents/InspectorDOMAgent.h:
* inspector/agents/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::showGridOverlay):
(WebCore::InspectorDOMAgent::hideGridOverlay):
Translate protocol commands into InspectorOverlay method calls.

* inspector/InspectorController.h:
* inspector/InspectorController.cpp:
(WebCore::InspectorController::gridOverlayCount const):
Added. This is used for testing purposes only.

* testing/Internals.h:
* testing/Internals.idl:
* testing/Internals.cpp:
(WebCore::Internals::inspectorGridOverlayCount): Added.

Source/WebInspectorUI:

Expose new DOM.showGridOverlay and DOM.hideGridOverlay commands
via WI.DOMNode. Add initial engineering UI to toggle grid overlays.

New methods are covered by a new test:

    inspector/dom/showGridOverlay.html

Additions to WI.DOMManager.prototype.requestDocument are covered
by existing tests (callback case) and a new test (promise case).

Additions to WI.Color are covered by a new test case in:

    inspector/model/color.html

* UserInterface/Controllers/DOMManager.js:
(WI.DOMManager.prototype.requestDocument):
(WI.DOMManager.prototype._requestDocumentWithPromise):
Drive-by: upgrade requestDocument() to return a promise if
no callback argument was passed. This is used by a new test.

* UserInterface/Models/Color.js:
(WI.Color.prototype.toProtocol): Added. The protocol object is
DOM.RGBAColor, which is the same thing as WI.Color.Format.RGBA.

* UserInterface/Models/DOMNode.js:
(WI.DOMNode.prototype.showGridOverlay):
(WI.DOMNode.prototype.hideGridOverlay):
Added. These are the methods that the rest of WebInspectorUI uses
to interact with grid overlays for a particular node. Note that
these methods return either an unsettled promise (from the agent call)
or a rejected promise (in the case that the node is destroyed).
This allows test cases to `await` before checking the grid overlay count.

* UserInterface/Test/TestHarness.js:
(TestHarness.prototype.expectException): Improve logging output
when InspectorTest.expectException does not catch an exception.

* UserInterface/Views/ContextMenuUtilities.js:
Add some engineering-only context menu items for showing/hiding
grid overlays to DOMTreeElements in the Elements Tab.

These are in place for development purposes and should eventually
be removed when no longer needed.

LayoutTests:

* inspector/dom/showGridOverlay-expected.txt: Added.
* inspector/dom/showGridOverlay.html: Added.
This test does not cover the actual drawing code. The drawing method
will change a lot and is not easy to test currently. The new test
covers the behavior of showGridOverlay/hideGridOverlay by querying
how many grid overlays are active according to InspectorOverlay.

* inspector/model/color-expected.txt:
* inspector/model/color.html:
Add a test case to exercise WI.Color.prototype.toProtocol().

* inspector/unit-tests/test-harness-expect-functions-async-expected.txt:
Rebaseline results after adding more state dumping in the failure case
for InspectorTest.expectException().


Canonical link: https://commits.webkit.org/233573@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@272197 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-02-02 09:02:31 +00:00
..
FrontendTestHarness.js
InspectorProtocol.js
ProtocolTestHarness.js
Test.js Web Inspector: find dialog does not populate search string from system find pasteboard 2020-04-28 21:43:13 +00:00
TestAppController.js Web Inspector: add ITML debuggable/target type 2020-05-29 17:34:08 +00:00
TestHarness.js Web Inspector: implement the basics for showing/hiding grid overlays 2021-02-02 09:02:31 +00:00
TestStub.js
TestSuite.js
TestUtilities.js