Changeset 245730 in webkit
- Timestamp:
- May 23, 2019, 6:34:32 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/inspector/protocol/DOM.json (modified) (1 diff)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/inspector/InspectorOverlay.cpp (modified) (5 diffs)
-
WebCore/inspector/InspectorOverlay.h (modified) (2 diffs)
-
WebCore/inspector/agents/InspectorDOMAgent.cpp (modified) (5 diffs)
-
WebCore/inspector/agents/InspectorDOMAgent.h (modified) (2 diffs)
-
WebInspectorUI/ChangeLog (modified) (1 diff)
-
WebInspectorUI/Localizations/en.lproj/localizedStrings.js (modified) (2 diffs)
-
WebInspectorUI/UserInterface/Base/Setting.js (modified) (1 diff)
-
WebInspectorUI/UserInterface/Controllers/DOMManager.js (modified) (1 diff)
-
WebInspectorUI/UserInterface/Views/SettingsTabContentView.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r245726 r245730 1 2019-05-23 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled 4 https://bugs.webkit.org/show_bug.cgi?id=198088 5 6 Reviewed by Timothy Hatcher. 7 8 When trying to "measure" the absolute position (to the viewport) or relative position (to 9 another element) of a given element, often the easiest way is to enable Element Selection 10 and Show Rulers at the same time. 11 12 This can have the undesired "side-effect" of having the rulers be always present, even when 13 not highlighting any nodes. 14 15 The ideal functionality is to allow the rulers/guides to be shown when element selection is 16 active and a node is hovered, regardless of whether "Show Rulers" is enabled. 17 18 * inspector/protocol/DOM.json: 19 Add an optional `showRulers` parameter to `DOM.setInspectModeEnabled` that supersedes the 20 current value of `Page.setShowRulers` as to whether rulers/guides are shown. 21 1 22 2019-05-23 Ross Kirsling <ross.kirsling@sony.com> 2 23 -
trunk/Source/JavaScriptCore/inspector/protocol/DOM.json
r244933 r245730 401 401 "parameters": [ 402 402 { "name": "enabled", "type": "boolean", "description": "True to enable inspection mode, false to disable it." }, 403 { "name": "highlightConfig", "$ref": "HighlightConfig", "optional": true, "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>." } 403 { "name": "highlightConfig", "$ref": "HighlightConfig", "optional": true, "description": "A descriptor for the highlight appearance of hovered-over nodes. May be omitted if <code>enabled == false</code>." }, 404 { "name": "showRulers", "type": "boolean", "optional": true, "description": "Whether the rulers should be shown during element selection. This overrides Page.setShowRulers." } 404 405 ] 405 406 }, -
trunk/Source/WebCore/ChangeLog
r245728 r245730 1 2019-05-23 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled 4 https://bugs.webkit.org/show_bug.cgi?id=198088 5 6 Reviewed by Timothy Hatcher. 7 8 When trying to "measure" the absolute position (to the viewport) or relative position (to 9 another element) of a given element, often the easiest way is to enable Element Selection 10 and Show Rulers at the same time. 11 12 This can have the undesired "side-effect" of having the rulers be always present, even when 13 not highlighting any nodes. 14 15 The ideal functionality is to allow the rulers/guides to be shown when element selection is 16 active and a node is hovered, regardless of whether "Show Rulers" is enabled. 17 18 * inspector/InspectorOverlay.h: 19 (WebCore::InspectorOverlay::setShowRulersDuringElementSelection): Added. 20 * inspector/InspectorOverlay.cpp: 21 (WebCore::InspectorOverlay::paint): 22 (WebCore::InspectorOverlay::shouldShowOverlay): 23 (WebCore::InspectorOverlay::drawNodeHighlight): 24 (WebCore::InspectorOverlay::drawQuadHighlight): 25 (WebCore::InspectorOverlay::drawElementTitle): 26 If `showRulersDuringElementSelection` is enabled, draw rulers whenever any highlight bounds 27 are calculated, but don't update the overlay if it's the only thing enabled (e.g. if there's 28 no currently hovered node, the overlay will disappear). 29 30 * inspector/agents/InspectorDOMAgent.cpp: 31 (WebCore::InspectorDOMAgent::willDestroyFrontendAndBackend): 32 (WebCore::InspectorDOMAgent::inspect): 33 (WebCore::InspectorDOMAgent::setInspectModeEnabled): 34 (WebCore::InspectorDOMAgent::setSearchingForNode): 35 Add an optional `showRulers` parameter to `DOM.setInspectModeEnabled` that supersedes the 36 current value of `Page.setShowRulers` as to whether rulers/guides are shown. 37 1 38 2019-05-23 Devin Rousso <drousso@apple.com> 2 39 -
trunk/Source/WebCore/inspector/InspectorOverlay.cpp
r245728 r245730 412 412 drawPaintRects(context, m_paintRects); 413 413 414 if (m_showRulers )414 if (m_showRulers || m_showRulersDuringElementSelection) 415 415 drawRulers(context, bounds); 416 416 } … … 493 493 bool InspectorOverlay::shouldShowOverlay() const 494 494 { 495 // Don't show the overlay when m_showRulersDuringElementSelection is true, as it's only supposed 496 // to have an effect when element selection is active (e.g. a node is hovered). 495 497 return m_highlightNode || m_highlightNodeList || m_highlightQuad || m_indicating || m_showPaintRects || m_showRulers; 496 498 } … … 578 580 drawShapeHighlight(context, node, bounds); 579 581 580 if (m_showRulers )582 if (m_showRulers || m_showRulersDuringElementSelection) 581 583 drawBounds(context, bounds); 582 584 … … 598 600 drawOutlinedQuad(context, highlight.quads[0], highlight.contentColor, highlight.contentOutlineColor, bounds); 599 601 600 if (m_showRulers )602 if (m_showRulers || m_showRulersDuringElementSelection) 601 603 drawBounds(context, bounds); 602 604 } … … 930 932 FloatSize contentInset(0, pageView->topContentInset(ScrollView::TopContentInsetType::WebCoreOrPlatformContentInset)); 931 933 contentInset.expand(elementDataSpacing, elementDataSpacing); 932 if (m_showRulers )934 if (m_showRulers || m_showRulersDuringElementSelection) 933 935 contentInset.expand(rulerSize, rulerSize); 934 936 -
trunk/Source/WebCore/inspector/InspectorOverlay.h
r245728 r245730 116 116 117 117 void setShowRulers(bool); 118 void setShowRulersDuringElementSelection(bool enabled) { m_showRulersDuringElementSelection = enabled; } 118 119 119 120 Node* highlightedNode() const; … … 151 152 Timer m_paintRectUpdateTimer; 152 153 153 bool m_indicating {false}; 154 bool m_showPaintRects {false}; 155 bool m_showRulers {false}; 154 bool m_indicating { false }; 155 bool m_showPaintRects { false }; 156 bool m_showRulers { false }; 157 bool m_showRulersDuringElementSelection { false }; 156 158 }; 157 159 -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r244933 r245730 326 326 327 327 ErrorString unused; 328 setSearchingForNode(unused, false, nullptr );328 setSearchingForNode(unused, false, nullptr, false); 329 329 hideHighlight(unused); 330 330 … … 1095 1095 ErrorString unused; 1096 1096 RefPtr<Node> node = inspectedNode; 1097 setSearchingForNode(unused, false, nullptr );1097 setSearchingForNode(unused, false, nullptr, false); 1098 1098 1099 1099 if (node->nodeType() != Node::ELEMENT_NODE && node->nodeType() != Node::DOCUMENT_NODE) … … 1148 1148 } 1149 1149 1150 void InspectorDOMAgent::setSearchingForNode(ErrorString& errorString, bool enabled, const JSON::Object* highlightInspectorObject )1150 void InspectorDOMAgent::setSearchingForNode(ErrorString& errorString, bool enabled, const JSON::Object* highlightInspectorObject, bool showRulers) 1151 1151 { 1152 1152 if (m_searchingForNode == enabled) … … 1155 1155 m_searchingForNode = enabled; 1156 1156 1157 if (enabled) { 1157 m_overlay->setShowRulersDuringElementSelection(m_searchingForNode && showRulers); 1158 1159 if (m_searchingForNode) { 1158 1160 m_inspectModeHighlightConfig = highlightConfigFromInspectorObject(errorString, highlightInspectorObject); 1159 1161 if (!m_inspectModeHighlightConfig) … … 1188 1190 } 1189 1191 1190 void InspectorDOMAgent::setInspectModeEnabled(ErrorString& errorString, bool enabled, const JSON::Object* highlightConfig )1191 { 1192 setSearchingForNode(errorString, enabled, highlightConfig ? highlightConfig : nullptr );1192 void InspectorDOMAgent::setInspectModeEnabled(ErrorString& errorString, bool enabled, const JSON::Object* highlightConfig, const bool* showRulers) 1193 { 1194 setSearchingForNode(errorString, enabled, highlightConfig ? highlightConfig : nullptr, showRulers && *showRulers); 1193 1195 } 1194 1196 -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.h
r244933 r245730 121 121 void resolveNode(ErrorString&, int nodeId, const String* objectGroup, RefPtr<Inspector::Protocol::Runtime::RemoteObject>& result) override; 122 122 void getAttributes(ErrorString&, int nodeId, RefPtr<JSON::ArrayOf<String>>& result) override; 123 void setInspectModeEnabled(ErrorString&, bool enabled, const JSON::Object* highlightConfig ) override;123 void setInspectModeEnabled(ErrorString&, bool enabled, const JSON::Object* highlightConfig, const bool* showRulers) override; 124 124 void requestNode(ErrorString&, const String& objectId, int* nodeId) override; 125 125 void pushNodeByPathToFrontend(ErrorString&, const String& path, int* nodeId) override; … … 205 205 206 206 void highlightMousedOverNode(); 207 void setSearchingForNode(ErrorString&, bool enabled, const JSON::Object* highlightConfig );207 void setSearchingForNode(ErrorString&, bool enabled, const JSON::Object* highlightConfig, bool showRulers); 208 208 std::unique_ptr<HighlightConfig> highlightConfigFromInspectorObject(ErrorString&, const JSON::Object* highlightInspectorObject); 209 209 -
trunk/Source/WebInspectorUI/ChangeLog
r245729 r245730 1 2019-05-23 Devin Rousso <drousso@apple.com> 2 3 Web Inspector: Overlay: rulers/guides should be shown whenever element selection is enabled 4 https://bugs.webkit.org/show_bug.cgi?id=198088 5 6 Reviewed by Timothy Hatcher. 7 8 When trying to "measure" the absolute position (to the viewport) or relative position (to 9 another element) of a given element, often the easiest way is to enable Element Selection 10 and Show Rulers at the same time. 11 12 This can have the undesired "side-effect" of having the rulers be always present, even when 13 not highlighting any nodes. 14 15 The ideal functionality is to allow the rulers/guides to be shown when element selection is 16 active and a node is hovered, regardless of whether "Show Rulers" is enabled. 17 18 * UserInterface/Base/Setting.js: 19 * UserInterface/Views/SettingsTabContentView.js: 20 (WI.SettingsTabContentView.prototype._createGeneralSettingsView): 21 Add a setting for controlling whether rulers/guides are shown during element selection. 22 23 * UserInterface/Controllers/DOMManager.js: 24 (WI.DOMManager.prototype.set inspectModeEnabled): 25 Pass the setting value as an optional parameter when calling `DOM.setInspectModeEnabled`. 26 27 * Localizations/en.lproj/localizedStrings.js: 28 1 29 2019-05-23 Commit Queue <commit-queue@webkit.org> 2 30 -
trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
r245729 r245730 366 366 localizedStrings["Editing audits"] = "Editing audits"; 367 367 localizedStrings["Element"] = "Element"; 368 localizedStrings["Element Selection:"] = "Element Selection:"; 368 369 localizedStrings["Element clips compositing descendants"] = "Element clips compositing descendants"; 369 370 localizedStrings["Element has CSS blending applied and composited descendants"] = "Element has CSS blending applied and composited descendants"; … … 958 959 localizedStrings["Show page load timing"] = "Show page load timing"; 959 960 localizedStrings["Show page resources"] = "Show page resources"; 961 localizedStrings["Show page rulers and node border lines"] = "Show page rulers and node border lines"; 960 962 localizedStrings["Show shadow DOM nodes"] = "Show shadow DOM nodes"; 961 963 localizedStrings["Show the details sidebar (%s)"] = "Show the details sidebar (%s)"; -
trunk/Source/WebInspectorUI/UserInterface/Base/Setting.js
r245657 r245730 167 167 showPaintRects: new WI.Setting("show-paint-rects", false), 168 168 showRulers: new WI.Setting("show-rulers", false), 169 showRulersDuringElementSelection: new WI.Setting("show-rulers-during-element-selection", true), 169 170 showScopeChainOnPause: new WI.Setting("show-scope-chain-sidebar", true), 170 171 showShadowDOM: new WI.Setting("show-shadow-dom", false), -
trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js
r244933 r245730 541 541 return; 542 542 543 DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), (error) => { 543 let commandArguments = { 544 enabled, 545 highlightConfig: this._buildHighlightConfig(), 546 showRulers: WI.settings.showRulersDuringElementSelection.value, 547 }; 548 DOMAgent.setInspectModeEnabled.invoke(commandArguments, (error) => { 544 549 this._inspectModeEnabled = error ? false : enabled; 545 550 this.dispatchEventToListeners(WI.DOMManager.Event.InspectModeStateChanged); -
trunk/Source/WebInspectorUI/UserInterface/Views/SettingsTabContentView.js
r245657 r245730 223 223 generalSettingsView.addSeparator(); 224 224 225 generalSettingsView.addSetting(WI.UIString("Element Selection:"), WI.settings.showRulersDuringElementSelection, WI.UIString("Show page rulers and node border lines")); 226 227 generalSettingsView.addSeparator(); 228 225 229 const zoomLevels = [0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4]; 226 230 const zoomValues = zoomLevels.map((level) => [level, Number.percentageString(level, 0)]);
Note:
See TracChangeset
for help on using the changeset viewer.