Changeset 272433 in webkit
- Timestamp:
- Feb 5, 2021, 12:18:09 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 18 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/inspector/css/nodeLayoutContextTypeChanged-expected.txt (added)
-
LayoutTests/inspector/css/nodeLayoutContextTypeChanged.html (added)
-
Source/JavaScriptCore/ChangeLog (modified) (1 diff)
-
Source/JavaScriptCore/inspector/protocol/CSS.json (modified) (2 diffs)
-
Source/JavaScriptCore/inspector/protocol/DOM.json (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/Element.cpp (modified) (1 diff)
-
Source/WebCore/dom/Element.h (modified) (1 diff)
-
Source/WebCore/dom/Node.h (modified) (1 diff)
-
Source/WebCore/inspector/InspectorInstrumentation.cpp (modified) (1 diff)
-
Source/WebCore/inspector/InspectorInstrumentation.h (modified) (3 diffs)
-
Source/WebCore/inspector/agents/InspectorCSSAgent.cpp (modified) (2 diffs)
-
Source/WebCore/inspector/agents/InspectorCSSAgent.h (modified) (3 diffs)
-
Source/WebCore/inspector/agents/InspectorDOMAgent.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/RenderObject.h (modified) (1 diff)
-
Source/WebInspectorUI/ChangeLog (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js (modified) (1 diff)
-
Source/WebInspectorUI/UserInterface/Models/DOMNode.js (modified) (4 diffs)
-
Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r272427 r272433 1 2021-02-05 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Implement backend support for maintaining a list of Grid layout contexts 4 https://bugs.webkit.org/show_bug.cgi?id=221228 5 6 Reviewed by Devin Rousso. 7 8 Added tests for `CSS.nodeLayoutContextTypeChanged` event and corresponding properties. 9 10 * inspector/css/nodeLayoutContextTypeChanged-expected.txt: Added. 11 * inspector/css/nodeLayoutContextTypeChanged.html: Added. 12 1 13 2021-02-05 Rini Patel <rini_patel@apple.com> 2 14 -
trunk/Source/JavaScriptCore/ChangeLog
r272430 r272433 1 2021-02-05 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Implement backend support for maintaining a list of Grid layout contexts 4 https://bugs.webkit.org/show_bug.cgi?id=221228 5 6 Reviewed by Devin Rousso. 7 8 Added `CSS.LayoutContextType` property to `DOM.Node` and added `CSS.nodeLayoutContextTypeChanged` event. 9 10 * inspector/protocol/CSS.json: 11 - Added `CSS.LayoutContextType` type. 12 - Added `DOM.nodeLayoutContextTypeChanged` event. 13 * inspector/protocol/DOM.json: 14 - Added `layoutContextType` property to `DOM.Node` type. 15 1 16 2021-02-05 Yusuke Suzuki <ysuzuki@apple.com> 2 17 -
trunk/Source/JavaScriptCore/inspector/protocol/CSS.json
r270637 r272433 253 253 { "name": "defaultValue", "type": "number", "description": "The value that is used for the axis when it is not otherwise controlled." } 254 254 ] 255 }, 256 { 257 "id": "LayoutContextType", 258 "type": "string", 259 "enum": ["grid"], 260 "description": "The layout context type of a node." 255 261 } 256 262 ], … … 442 448 { "name": "styleSheetId", "$ref": "StyleSheetId", "description": "Identifier of the removed stylesheet." } 443 449 ] 450 }, 451 { 452 "name": "nodeLayoutContextTypeChanged", 453 "description": "Called when a node's layout context type has changed.", 454 "parameters": [ 455 { "name": "nodeId", "$ref": "DOM.NodeId", "description": "Identifier of the node whose layout context type changed." }, 456 { "name": "layoutContextType", "$ref": "LayoutContextType", "optional": true, "description": "The new layout context type of the node. When not provided, the <code>LayoutContextType</code> of the node is not a context for which Web Inspector has specific functionality." } 457 ] 444 458 } 445 459 ] -
trunk/Source/JavaScriptCore/inspector/protocol/DOM.json
r272197 r272433 67 67 { "name": "templateContent", "$ref": "Node", "optional": true, "description": "Content document fragment for template elements" }, 68 68 { "name": "pseudoElements", "type": "array", "items": { "$ref": "Node" }, "optional": true, "description": "Pseudo elements associated with this node." }, 69 { "name": "contentSecurityPolicyHash", "type": "string", "optional": true, "description": "Computed SHA-256 Content Security Policy hash source for given element." } 69 { "name": "contentSecurityPolicyHash", "type": "string", "optional": true, "description": "Computed SHA-256 Content Security Policy hash source for given element." }, 70 { "name": "layoutContextType", "$ref": "CSS.LayoutContextType", "optional": true, "description": "The layout context type of the node. When not provided, the <code>LayoutContextType</code> of the node is not a context for which Web Inspector has specific functionality." } 70 71 ] 71 72 }, -
trunk/Source/WebCore/ChangeLog
r272429 r272433 1 2021-02-05 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Implement backend support for maintaining a list of Grid layout contexts 4 https://bugs.webkit.org/show_bug.cgi?id=221228 5 6 Reviewed by Devin Rousso. 7 8 Test: inspector/dom/layout-context.html 9 10 Implemented support for getting the layout context for `grid` nodes as part of the existing `DOM.Node` protocol 11 object as well as firing an event when the layout context type changes for a node. 12 13 * dom/Element.cpp: 14 (WebCore::Element::didChangeRenderer): 15 - Handle the underlying RenderObject changing. 16 * dom/Element.h: 17 * dom/Node.h: 18 (WebCore::Node::didChangeRenderer): 19 * inspector/InspectorInstrumentation.cpp: 20 (WebCore::InspectorInstrumentation::nodeLayoutContextChangedImpl): 21 * inspector/InspectorInstrumentation.h: 22 (WebCore::InspectorInstrumentation::nodeLayoutContextChanged): 23 - Add instrumentation for layout context changes. 24 * inspector/agents/InspectorCSSAgent.cpp: 25 (WebCore::InspectorCSSAgent::layoutContextTypeForRenderer): 26 (WebCore::InspectorCSSAgent::nodeLayoutContextTypeChanged): 27 - Inform the frontend when a known node changes its layout context. 28 * inspector/agents/InspectorCSSAgent.h: 29 * inspector/agents/InspectorDOMAgent.cpp: 30 (WebCore::InspectorDOMAgent::buildObjectForNode): 31 - Set the layout context for nodes that will be new to the frontend. 32 * rendering/RenderObject.h: 33 (WebCore::Node::setRenderer): 34 1 35 2021-02-05 Chris Dumez <cdumez@apple.com> 2 36 -
trunk/Source/WebCore/dom/Element.cpp
r272370 r272433 4550 4550 } 4551 4551 4552 void Element::didChangeRenderer(RenderObject* oldRenderer) 4553 { 4554 InspectorInstrumentation::nodeLayoutContextChanged(*this, oldRenderer); 4555 } 4556 4552 4557 #if ENABLE(CSS_TYPED_OM) 4553 4558 -
trunk/Source/WebCore/dom/Element.h
r271930 r272433 728 728 729 729 void attachAttributeNodeIfNeeded(Attr&); 730 731 void didChangeRenderer(RenderObject*) final; 730 732 731 733 #if ASSERT_ENABLED -
trunk/Source/WebCore/dom/Node.h
r272117 r272433 707 707 static void moveTreeToNewScope(Node&, TreeScope& oldScope, TreeScope& newScope); 708 708 void moveNodeToNewDocument(Document& oldDocument, Document& newDocument); 709 710 virtual void didChangeRenderer(RenderObject*) { }; 709 711 710 712 struct NodeRareDataDeleter { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp
r268900 r272433 177 177 } 178 178 179 void InspectorInstrumentation::nodeLayoutContextChangedImpl(InstrumentingAgents& instrumentingAgents, Node& node, RenderObject* oldRenderer) 180 { 181 if (auto* cssAgent = instrumentingAgents.enabledCSSAgent()) 182 cssAgent->nodeLayoutContextTypeChanged(node, oldRenderer); 183 } 184 179 185 void InspectorInstrumentation::willModifyDOMAttrImpl(InstrumentingAgents& instrumentingAgents, Element& element, const AtomString& oldValue, const AtomString& newValue) 180 186 { -
trunk/Source/WebCore/inspector/InspectorInstrumentation.h
r268900 r272433 127 127 static void willRemoveDOMNode(Document&, Node&); 128 128 static void didRemoveDOMNode(Document&, Node&); 129 static void nodeLayoutContextChanged(Node&, RenderObject*); 129 130 static void willModifyDOMAttr(Document&, Element&, const AtomString& oldValue, const AtomString& newValue); 130 131 static void didModifyDOMAttr(Document&, Element&, const AtomString& name, const AtomString& value); … … 351 352 static void willRemoveDOMNodeImpl(InstrumentingAgents&, Node&); 352 353 static void didRemoveDOMNodeImpl(InstrumentingAgents&, Node&); 354 static void nodeLayoutContextChangedImpl(InstrumentingAgents&, Node&, RenderObject*); 353 355 static void willModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomString& oldValue, const AtomString& newValue); 354 356 static void didModifyDOMAttrImpl(InstrumentingAgents&, Element&, const AtomString& name, const AtomString& value); … … 603 605 } 604 606 607 inline void InspectorInstrumentation::nodeLayoutContextChanged(Node& node, RenderObject* oldRenderer) 608 { 609 FAST_RETURN_IF_NO_FRONTENDS(void()); 610 if (auto* agents = instrumentingAgents(node.document())) 611 nodeLayoutContextChangedImpl(*agents, node, oldRenderer); 612 } 613 605 614 inline void InspectorInstrumentation::willModifyDOMAttr(Document& document, Element& element, const AtomString& oldValue, const AtomString& newValue) 606 615 { -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.cpp
r270637 r272433 55 55 #include "NodeList.h" 56 56 #include "PseudoElement.h" 57 #include "RenderGrid.h" 57 58 #include "RenderStyleConstants.h" 58 59 #include "SVGStyleElement.h" … … 925 926 } 926 927 928 Optional<Protocol::CSS::LayoutContextType> InspectorCSSAgent::layoutContextTypeForRenderer(RenderObject* renderer) 929 { 930 if (is<RenderGrid>(renderer)) 931 return Protocol::CSS::LayoutContextType::Grid; 932 return WTF::nullopt; 933 } 934 935 void InspectorCSSAgent::nodeLayoutContextTypeChanged(Node& node, RenderObject* oldRenderer) 936 { 937 auto* domAgent = m_instrumentingAgents.persistentDOMAgent(); 938 if (!domAgent) 939 return; 940 941 auto newLayoutContextType = layoutContextTypeForRenderer(node.renderer()); 942 if (newLayoutContextType == layoutContextTypeForRenderer(oldRenderer)) 943 return; 944 945 // FIXME: <https://webkit.org/b/221449> Support enabling events for uninstrumented nodes. 946 auto nodeId = domAgent->boundNodeId(&node); 947 if (!nodeId) 948 return; 949 950 m_frontendDispatcher->nodeLayoutContextTypeChanged(nodeId, WTFMove(newLayoutContextType)); 951 } 952 927 953 InspectorStyleSheetForInlineStyle& InspectorCSSAgent::asInspectorStyleSheet(StyledElement& element) 928 954 { -
trunk/Source/WebCore/inspector/agents/InspectorCSSAgent.h
r270637 r272433 51 51 class Node; 52 52 class NodeList; 53 class RenderObject; 53 54 class StyleRule; 54 55 … … 82 83 83 84 static CSSStyleRule* asCSSStyleRule(CSSRule&); 85 static Optional<Inspector::Protocol::CSS::LayoutContextType> layoutContextTypeForRenderer(RenderObject*); 84 86 85 87 // InspectorAgentBase … … 114 116 void activeStyleSheetsUpdated(Document&); 115 117 bool forcePseudoState(const Element&, CSSSelector::PseudoClassType); 118 void nodeLayoutContextTypeChanged(Node&, RenderObject*); 116 119 117 120 // InspectorDOMAgent hooks -
trunk/Source/WebCore/inspector/agents/InspectorDOMAgent.cpp
r272197 r272433 94 94 #include "Pasteboard.h" 95 95 #include "PseudoElement.h" 96 #include "RenderGrid.h" 96 97 #include "RenderStyle.h" 97 98 #include "RenderStyleConstants.h" … … 1757 1758 value->setChildren(WTFMove(children)); 1758 1759 } 1760 1761 if (auto layoutContextType = InspectorCSSAgent::layoutContextTypeForRenderer(node->renderer())) 1762 value->setLayoutContextType(layoutContextType.value()); 1759 1763 1760 1764 auto* pageAgent = m_instrumentingAgents.enabledPageAgent(); -
trunk/Source/WebCore/rendering/RenderObject.h
r271559 r272433 1148 1148 inline void Node::setRenderer(RenderObject* renderer) 1149 1149 { 1150 auto oldRenderer = this->renderer(); 1150 1151 m_rendererWithStyleFlags.setPointer(renderer); 1152 didChangeRenderer(oldRenderer); 1151 1153 } 1152 1154 -
trunk/Source/WebInspectorUI/ChangeLog
r272372 r272433 1 2021-02-05 Patrick Angle <pangle@apple.com> 2 3 Web Inspector: Implement backend support for maintaining a list of Grid layout contexts 4 https://bugs.webkit.org/show_bug.cgi?id=221228 5 6 Reviewed by Devin Rousso. 7 8 Added `layoutContextType` property to `WI.DOMNode` and listener for `CSS.nodeLayoutContextTypeChanged` event. 9 10 * UserInterface/Controllers/DOMManager.js: 11 (WI.DOMManager.prototype.nodeLayoutContextTypeChanged): 12 - When a node's layout context changes, update the WI.DOMNode 13 * UserInterface/Models/DOMNode.js: 14 (WI.DOMNode): 15 (WI.DOMNode.prototype.get layoutContextType): 16 (WI.DOMNode.prototype.set layoutContextType): 17 - Fire an event when the layout context type changes. 18 * UserInterface/Protocol/CSSObserver.js: 19 (WI.CSSObserver.prototype.nodeLayoutContextTypeChanged): 20 - Listen for the `CSS.nodeLayoutContextTypeChanged` event. 21 1 22 2021-02-04 Razvan Caliman <rcaliman@apple.com> 2 23 -
trunk/Source/WebInspectorUI/UserInterface/Controllers/DOMManager.js
r272197 r272433 222 222 } 223 223 224 nodeLayoutContextTypeChanged(nodeId, layoutContextType) 225 { 226 let domNode = this._idToDOMNode[nodeId]; 227 console.assert(domNode instanceof WI.DOMNode, domNode, nodeId); 228 if (!domNode) 229 return; 230 231 domNode.layoutContextType = layoutContextType; 232 } 233 224 234 // Private 225 235 -
trunk/Source/WebInspectorUI/UserInterface/Models/DOMNode.js
r272197 r272433 53 53 this._computedRole = null; 54 54 this._contentSecurityPolicyHash = payload.contentSecurityPolicyHash; 55 this._layoutContextType = payload.layoutContextType; 55 56 56 57 if (this._nodeType === Node.DOCUMENT_NODE) … … 241 242 { 242 243 this._childNodeCount = count; 244 } 245 246 get layoutContextType() 247 { 248 return this._layoutContextType; 249 } 250 251 set layoutContextType(layoutContextType) 252 { 253 console.assert(layoutContextType !== this._layoutContextType); 254 this._layoutContextType = layoutContextType; 255 this.dispatchEventToListeners(WI.DOMNode.Event.LayoutContextTypeChanged); 243 256 } 244 257 … … 1123 1136 DidFireEvent: "dom-node-did-fire-event", 1124 1137 PowerEfficientPlaybackStateChanged: "dom-node-power-efficient-playback-state-changed", 1138 LayoutContextTypeChanged: "dom-node-layout-context-type-changed", 1125 1139 }; 1126 1140 … … 1142 1156 Failed: "failed", 1143 1157 }; 1158 1159 // Corresponds to `CSS.LayoutContextType`. 1160 WI.DOMNode.LayoutContextType = { 1161 Grid: "grid", 1162 }; -
trunk/Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
r261105 r272433 48 48 } 49 49 50 nodeLayoutContextTypeChanged(nodeId, layoutContextType) 51 { 52 WI.domManager.nodeLayoutContextTypeChanged(nodeId, layoutContextType); 53 } 54 50 55 namedFlowCreated(namedFlow) 51 56 {
Note:
See TracChangeset
for help on using the changeset viewer.