8000
Skip to content

core(unsized-images): respect CSS rules from stylesheets - #11590

Merged
devtools-bot merged 2 commits into
masterfrom
unsized_images_fix
Oct 23, 2020
Merged

core(unsized-images): respect CSS rules from stylesheets#11590
devtools-bot merged 2 commits into
masterfrom
unsized_images_fix

Conversation

@patrickhulce
Copy link
Copy Markdown
Collaborator

Summary
CSS rules from stylesheets were being completely ignored due to an errant ts-expect-error, the explanation sounded so reasonable but it was referencing a property name that didn't even exist. Yet another reminder to prefer if (!foo) throw new Error('Impossible') over @ts-expect-error 😄

Also drive-by fix for AVIF getting incorrectly mime type sniffed.

Related Issues/PRs
fixes https://twitter.com/andreasbovens/status/1319411834865262594 :)

@patrickhulce
patrickhulce requested a review from a team as a code owner October 23, 2020 02:18
@patrickhulce
patrickhulce requested review from adamraine and removed request for a team October 23, 2020 02:18
@google-cla google-cla Bot added the cla: yes label Oct 23, 2020
<!-- PASS(responsive): image is used at full size -->
<!-- PASS(responsive-inverse): image does not account for DPR 2.625 -->
<!-- PASS(offscreen): image is lazily loaded -->
<!-- PASS(unsized-images): CSS sizing from stylesheet, not inline -->
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this was failing before the fix

* Finds the most specific directly matched CSS font-size rule from the list.
*
* @param {Array<LH.Crdp.CSS.RuleMatch>} [matchedCSSRules]
* @param {Array<LH.Crdp.CSS.RuleMatch>} matchedCSSRules
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

this causes vscode to complain about ordering of optional arguments

@adamraine adamraine left a comment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall LGTM

8000
* @param {string} property
* @return {string | undefined}
*/
function findSizeDeclaration(style, property) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: style => rule

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

0