@@ -18,6 +18,7 @@ import xpath from 'licia/xpath'
1818import concat from 'licia/concat'
1919import { setGlobal } from '../lib/evaluate'
2020import { createId } from '../lib/util'
21+ import { getObj } from '../lib/objManager'
2122import Protocol from 'devtools-protocol'
2223import DOM = Protocol . DOM
2324
@@ -93,6 +94,19 @@ function hookAttachShadow() {
9394
9495hookAttachShadow ( )
9596
97+
98+ export function describeNode ( params : DOM . DescribeNodeRequest ) : DOM . DescribeNodeResponse {
99+ let domnode = getObj ( params . objectId ! ) ;
100+
101+ let node = nodeManager . wrap ( domnode ) ;
102+ console . error ( node ) ;
103+ console . error ( getNode ( node . nodeId ) ) ;
104+
105+ return {
106+ node,
107+ }
108+ }
109+
96110export function getDocument ( ) {
97111 return {
98112 root : nodeManager . wrap ( document , {
@@ -258,6 +272,35 @@ export function requestChildNodes(params: DOM.RequestChildNodesRequest) {
258272 } )
259273}
260274
275+ export function scrollIntoViewIfNeeded (
276+ params : DOM . ScrollIntoViewIfNeededRequest
277+ ) {
278+ let node = getObj ( params . objectId ! ) ;
279+ node . scrollIntoViewIfNeeded ( ) ;
280+ }
281+ export function getContentQuads (
282+ params : DOM . GetContentQuadsRequest
283+ ) : DOM . GetContentQuadsResponse {
284+ const node = getObj ( params . objectId ! ) ;
285+ const rect = node . getBoundingClientRect ( )
286+ const { x, y, width, height } = rect
287+
288+ const quads = [
289+ x ,
290+ y ,
291+ x + width ,
292+ y ,
293+ x + width ,
294+ y + height ,
295+ x ,
296+ y + height ,
297+ ]
298+
299+ return {
300+ quads : [ quads ] ,
301+ }
302+ }
303+
261304export function requestNode (
262305 params : DOM . RequestNodeRequest
263306) : DOM . RequestNodeResponse {
@@ -271,7 +314,7 @@ export function requestNode(
271314export function resolveNode (
272315 params : DOM . ResolveNodeRequest
273316) : DOM . ResolveNodeResponse {
274- const node = getNode ( params . nodeId as number )
317+ const node = getNode ( params . nodeId || params . backendNodeId as number )
275318
276319 return {
277320 object : objManager . wrap ( node ) ,
0 commit comments