Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Web Inspector: Show grid/flex overlays when in element selection
https://bugs.webkit.org/show_bug.cgi?id=251737 <rdar://problem/105041619> Reviewed by Patrick Angle. This allows for developers to more easily visually identify the organization of a node's contents using element select mode (e.g. hovering over a `gap` area will now be more recognizable due to the hatching shown by the flex overlay). * Source/JavaScriptCore/inspector/protocol/DOM.json: Move all the configuration options for grid and flex overlays to bespoke protocol objects. * Source/JavaScriptCore/inspector/scripts/codegen/generator.py: Ensure that these protocol objects have helper constants for pulling values out of them. * Source/WebCore/inspector/InspectorOverlay.h: * Source/WebCore/inspector/InspectorOverlay.cpp: (WebCore::InspectorOverlay::paint): (WebCore::InspectorOverlay::getHighlight): (WebCore::InspectorOverlay::shouldShowOverlay const): (WebCore::InspectorOverlay::showHighlightGridOverlayForNode): Added. (WebCore::InspectorOverlay::hideHighlightGridOverlay): Added. (WebCore::InspectorOverlay::showHighlightFlexOverlayForNode): Added. (WebCore::InspectorOverlay::hideHighlightFlexOverlay): Added. In addition to the always-on grid/flex overlay data, have another member variable for a single grid/flex overlay that takes precedence (and is drawn on top) of all other grid/flex overlays. * Source/WebCore/inspector/agents/InspectorDOMAgent.h: * Source/WebCore/inspector/agents/InspectorDOMAgent.cpp: (WebCore::parseRequiredConfigColor): Renamed from `parseConfigColor`. (WebCore::parseOptionalConfigColor): Added. (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend): (WebCore::InspectorDOMAgent::handleTouchEvent): (WebCore::InspectorDOMAgent::inspect): (WebCore::InspectorDOMAgent::highlightMousedOverNode): (WebCore::InspectorDOMAgent::setSearchingForNode): (WebCore::InspectorDOMAgent::highlightConfigFromInspectorObject): (WebCore::InspectorDOMAgent::gridOverlayConfigFromInspectorObject): Added. (WebCore::InspectorDOMAgent::flexOverlayConfigFromInspectorObject): Added. (WebCore::InspectorDOMAgent::setInspectModeEnabled): (WebCore::InspectorDOMAgent::showGridOverlay): (WebCore::InspectorDOMAgent::showFlexOverlay): * Source/WebInspectorUI/UserInterface/Models/DOMNode.js: (WI.DOMNode.get defaultLayoutOverlayColor): Added. (WI.DOMNode.prototype.showLayoutOverlay): Handle changes to `DOM.showGridOverlay` and `DOM.showFlexOverlay`. * Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js: (WI.DOMManager.prototype.set inspectModeEnabled): Pass along the current grid/flex overlay configuration when enabling element selection mode. * Source/WebInspectorUI/UserInterface/Base/Setting.js: * Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js: (WI.SettingsTabContentView.prototype._createElementsSettingsView): Add some on-by-default `WI.Setting` to control this behavior. * Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js: * LayoutTests/inspector/dom/showFlexOverlay.html: * LayoutTests/inspector/dom/showGridOverlay.html: Canonical link: https://commits.webkit.org/259989@main
- Loading branch information
Showing
13 changed files
with
294 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.