Skip to content

Conversation

@patrickhulce
Copy link
Collaborator

Summary
Reworks the ImageElements artifact for clarity and improved growth opportunities.

Primary changes:

  • cssWidth/cssHeight have been removed.
  • attributeWidth/attributeHeight can now be null when the property is not set or if it's a CSS image (like in JS el.getAttribute.
  • naturalWidth/naturalHeight have been moved to naturalDimensions property that mirrors the intention behind _privateCssSizing and its undefined behavior.
  • _privateCssSizing -> cssEffectiveRules, sizing to me was ambiguous about the "effective source rule" portion and "rules" leaves the door open for future effective rules not related to sizing
  • Moved cssComputed* properties to a computedStyle property.

Related Issues/PRs
closes #12077
ref #11866

@patrickhulce patrickhulce requested a review from a team as a code owner May 26, 2021 22:55
@patrickhulce patrickhulce requested review from connorjclark and removed request for a team May 26, 2021 22:55
@google-cla google-cla bot added the cla: yes label May 26, 2021
/**
* The computed style
*/
computedStyle: {
Copy link
Collaborator

Choose a reason for hiding this comment

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

computedStyles ? or cssComputedStyles to match the other property?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I was aiming to match getComputedStyle, but SGTM :)

"height": 16
},
"snippet": "<img src=\"blob:http://localhost:10200/822c70a0-b912-41c7-9a21-56c3d309e75b\">",
"snippet": "<img src=\"blob:http://localhost:10200/5a659d35-80ca-42e2-8f98-19daed3b98aa\">",
Copy link
Collaborator

Choose a reason for hiding this comment

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

you got some churn here to manually remove

Copy link
Contributor

Choose a reason for hiding this comment

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

you got some churn here to manually remove

it's only the four urls, so maybe just an optional nit?

}

// Skip if we couldn't collect natural image size information.
if (!imageElement.naturalDimensions) continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

ha, adapting existing code is kind of awkward, but this is really nice to have an explicit guard if there wasn't natural image size info and not have to worry about falsy values, etc

Copy link
Contributor

@brendankenny brendankenny left a comment

Choose a reason for hiding this comment

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

thanks for getting this out so fast, @patrickhulce!

return;
}
if (!size) return;
element.naturalDimensions = {width: size.naturalWidth, height: size.naturalHeight};
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

Comment on lines +1335 to +1336
"displayedWidth": 360,
"displayedHeight": 240,
Copy link
Contributor

Choose a reason for hiding this comment

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

things have changed a lot on dbw_tester since we last ran this, apparently :)

"height": 16
},
"snippet": "<img src=\"blob:http://localhost:10200/822c70a0-b912-41c7-9a21-56c3d309e75b\">",
"snippet": "<img src=\"blob:http://localhost:10200/5a659d35-80ca-42e2-8f98-19daed3b98aa\">",
Copy link
Contributor

Choose a reason for hiding this comment

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

you got some churn here to manually remove

it's only the four urls, so maybe just an optional nit?

Co-authored-by: Connor Clark <[email protected]>
Co-authored-by: Connor Clark <[email protected]>
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.

ImageElement gathererer fixups

4 participants