Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(image-size-responsive): remove elidedUrl, elide url property instead #13226

Merged
merged 21 commits into from
Oct 29, 2021

Conversation

prerana1821
Copy link
Contributor

@prerana1821 prerana1821 commented Oct 17, 2021

Summary

The audit "image-size-responsive" used to contain "elidedUrl" property. All other audits save the result of URL.elideDataURI to their url property. So, I have set url to this elided value, and droped elidedUrl. I also have updated all the tests related to this audit.
image

Resolved Issue

fixes #13182

@prerana1821 prerana1821 requested a review from a team as a code owner October 17, 2021 10:52
@prerana1821 prerana1821 requested review from adamraine and removed request for a team October 17, 2021 10:52
@google-cla
Copy link

google-cla bot commented Oct 17, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

Copy link
Member

@adamraine adamraine left a comment

Choose a reason for hiding this comment

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

Are you using your own linter to adjust everything? This PR is mostly style changes, some of which violate our existing linter rules.

Would it be possible to revert the style changes but keep the elidedUrl deprecation?

@@ -8,28 +8,29 @@
* the page are large enough with respect to the pixel ratio. The
* audit will list all visible images that are too small.
*/
'use strict';
"use strict";
Copy link
Member

Choose a reason for hiding this comment

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

We use '. yarn lint --fix should resolve these.

@@ -9,7 +9,7 @@
"axe-core": "4.2.3"
}
},
"lighthouseVersion": "8.6.0",
"lighthouseVersion": "8.5.1",
Copy link
Member

Choose a reason for hiding this comment

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

I don't think we want the version to change here.

@google-cla
Copy link

google-cla bot commented Oct 18, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@google-cla
Copy link

google-cla bot commented Oct 18, 2021

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here with @googlebot I signed it! and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@prerana1821
Copy link
Contributor Author

@adamraine I have done all the fixes mentioned.

@adamraine
Copy link
Member

Thank you for making those fixes!

There are still some unrelated style changes in this PR (indentations, spacing, etc.). These changes just make the PR larger than it needs to be, especially in our generated files like sample_v2.json. Some of the style changes are good, but they still aren't really necessary.

TL;DR: If the changes aren't functional, we should leave them out of this PR :)

@prerana1821
Copy link
Contributor Author

Hey @adamraine , Thanks a lot for reviewing my changes. I have removed the not required changes.

Copy link
Member

@adamraine adamraine left a comment

Choose a reason for hiding this comment

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

Thank you for reverting the style changes in sample_v2.json, but most of this PR is still pure style changes. I've highlighted the changes we should keep, but the rest should be left out :)

Once you make those changes, you can run yarn update:sample-json to fix sample_v2.json automatically (without style changes).

@@ -53,8 +53,11 @@ describe('Images: size audit', () => {
});
Copy link
Member

Choose a reason for hiding this comment

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

All the changes in this file look like style, please only update any tests that are failing.

"failures": [
"No manifest was fetched"
],
"failures": ["No manifest was fetched"],
Copy link
Member

Choose a reason for hiding this comment

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

You shouldn't need to change this file. We will update it in the future, but for now it's fine.

return {
url: image.src,
elidedUrl: URL.elideDataURI(image.src),
url: URL.elideDataURI(image.src),
Copy link
Member

Choose a reason for hiding this comment

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

Removing elidedUrl here is good.

@@ -45,7 +46,7 @@ const LARGE_IMAGE_FACTOR = 0.75;
// considered SMALL.
const SMALL_IMAGE_THRESHOLD = 64;

/** @typedef {{url: string, elidedUrl: string, displayedSize: string, actualSize: string, actualPixels: number, expectedSize: string, expectedPixels: number}} Result */
/** @typedef {{url: string, displayedSize: string, actualSize: string, actualPixels: number, expectedSize: string, expectedPixels: number}} Result */
Copy link
Member

Choose a reason for hiding this comment

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

This change is good.

Copy link
Member

Choose a reason for hiding this comment

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

You can run yarn update:sample-json to propagate these changes to sample_v2.json.

{key: 'displayedSize', itemType: 'text', text: str_(UIStrings.columnDisplayed)},
{key: 'actualSize', itemType: 'text', text: str_(UIStrings.columnActual)},
{key: 'expectedSize', itemType: 'text', text: str_(UIStrings.columnExpected)},
{key: 'url', itemType: 'url', text: str_(i18n.UIStrings.columnURL)},
Copy link
Member

Choose a reason for hiding this comment

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

Removal of the elidedUrl heading is good. We like to keep each heading entry on a single line though. Anything else I didn't highlihgt is a style change we don't need.

@@ -69,8 +71,8 @@ function isVisible(imageRect, viewportDimensions) {
*/
function isSmallerThanViewport(imageRect, viewportDimensions) {
return (
(imageRect.bottom - imageRect.top) <= viewportDimensions.innerHeight &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Your editor seems to have made multiple unnecessary formatting changes. Could you undo those?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can run git diff origin/master to see the current diff between your current branch and master. You can remove all the unnecessary changes by running that command multiple times as you undo things.

@adamraine
Copy link
Member

Make sure to run yarn update:sample-json and commit the changes to sample_v2.json :)

@prerana1821
Copy link
Contributor Author

@adamraine I'm facing few issues running that command on my machine.
image

@adamraine
Copy link
Member

Hmm the command may be broken on windows, unfortunately I can't test on a windows machine at the moment to resolve this.

If you resolve the merge conflicts and give me access to your fork, I can run the command on my end.

@prerana1821
Copy link
Contributor Author

@adamraine Thanks a lot
I have resolved the merge conflicts & send you an invite for my forked repo

Copy link
Member

@adamraine adamraine left a comment

Choose a reason for hiding this comment

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

Thanks @prerana1821!

@adamraine adamraine merged commit 4da2012 into GoogleChrome:master Oct 29, 2021
@adamraine adamraine deleted the drop-image-size-responsive branch October 29, 2021 17:50
@connorjclark connorjclark mentioned this pull request Oct 29, 2021
15 tasks
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.

drop image-size-responsive elidedUrl
4 participants