Skip to content

Conversation

@brendankenny
Copy link
Contributor

if you look at existing deployments, you'll notice the shadow_v2 screenshot bounding boxes are a little weird. Trying to yarn update:sample-artifacts FullPageScreenshot, however, will give a gatherer error (element.getBoundingClientRect is not a function).

Turns out we were trying to ShadowRoot.getBoundingRect, which isn't a thing. FullPageScreenshot just needs to use the host, like getNodeDetails does when taking the original rect.

We didn't notice because #11536 didn't update the artifact, and the screenshot renderer falls back the audits' bounding rects if there isn't one bundled with the screenshot:

const rect =
(item.lhId ? this._fullPageScreenshot.nodes[item.lhId] : null) || item.boundingRect;

and since dbw_tester gets so weird with an extended height while taking the screenshot, the the original bounding rects on the full screenshot were pretty little weird :)

@brendankenny brendankenny requested a review from a team as a code owner December 17, 2020 21:25
@brendankenny brendankenny requested review from connorjclark and removed request for a team December 17, 2020 21:25
@google-cla google-cla bot added the cla: yes label Dec 17, 2020
@connorjclark
Copy link
Collaborator

LGTM

this didn't change in this PR but I noticed this:

image

weird... that is highlighting an image, not a <p>.

width: 120,
height: 15,
},
// And then many more nodes.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

open to expectation suggestions :)

htmlElement.tagName,
].join('-');
window.__lighthouseNodesDontTouchOrAllVarianceGoesAway.set(element, lhId);
window.__lighthouseNodesDontTouchOrAllVarianceGoesAway.set(htmlElement, lhId);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the other option is to do another ShadowRoot check here:

for (const [node, id] of lhIdToElements.entries()) {

but this seems in keeping with the intent of getNodeDetails (see the getBoundingClientRect(htmlElement), below)

@connorjclark connorjclark changed the title core: handle ShadowRoots in full-page-screenshot core(full-page-screenshot): handle ShadowRoots Dec 17, 2020
@brendankenny
Copy link
Contributor Author

this didn't change in this PR but I noticed this:

image

weird... that is highlighting an image, not a <p>.

yeah, this is actually really weird. That text ("This domain is for use in illustrative examples in documents...") is from example.com 🙃

Is the saved trace for sample_v2 mixed up somehow?

@brendankenny
Copy link
Contributor Author

or wait, only the element reference comes from the trace. nodeDetails for TraceElements is where it originated:

"TraceElements": [
{
"traceEventType": "largest-contentful-paint",
"node": {
"devtoolsNodePath": "1,HTML,1,BODY,0,DIV,1,P",
"selector": "body > div > p",
"boundingRect": {
"top": 574,
"bottom": 654,
"left": 132,
"right": 252,
"width": 120,
"height": 80
},
"nodeLabel": "This domain is for use in illustrative examples in documents. You may use this …",
"snippet": "<p class=\"paragraph\">"
}
},

I don't see anywhere in dbw_tester is could be including that snippet...

@connorjclark
Copy link
Collaborator

I believe it was manually added https://github.com/GoogleChrome/lighthouse/pull/10517/files#diff-fccf071866992ae51684ed3c5edc57deda156a9ef8bbf41caeeeb5ba8931d205R2086

my b. I didnt know about yarn update:sample-artifacts X so I must have advised to edit that file manually.

wanna rebaseline that artifact?

@brendankenny
Copy link
Contributor Author

wanna rebaseline that artifact?

ok, I sort of rebaselined it. I updated the LCP trace element (because I think a lot of people are looking to that for checking that the fp screenshot is working), but fully rebaselining removes the cls and animation elements, because there aren't any on the page (apparently). So I kept those manually added ones so sample_v2 still makes an interesting deployment page.

We can figure out some sort of policy on that some other day :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants