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

Allowing resize for fully below the fold elements even when top margin changed #8250

Merged
merged 1 commit into from Mar 23, 2017
Merged

Allowing resize for fully below the fold elements even when top margin changed #8250

merged 1 commit into from Mar 23, 2017

Conversation

tlong2
Copy link
Contributor

@tlong2 tlong2 commented Mar 20, 2017

Fixes something that was missed in #6824. If an element is fully below the fold, then resize should be allowed even when top margin is being changed, since changes to the top boundary won't be visible to the user.

@ampprojectbot
Copy link
Member

Hi, ampproject bot here! Here are a list of the owners that can approve your files.

You may leave an issue comment stating "@ampprojectbot retry!" to force me to re-evaluate this Pull Request's status

/to dvoytenko jridgewell

  • src/service/resources-impl.js

/to alanorozco camelburrito chenshay choumx cvializ ericlindley-g erwinmombay gregable honeybadgerdontcare jridgewell kmh287 lannka mkhatib mrjoro muxin newmuis powdercloud zhouyx

  • test/functional/test-resources.js

For any issues please file a bug at https://github.com/google/github-owners-bot/issues

@lannka
Copy link
Contributor

lannka commented Mar 22, 2017

/cc @zhouyx

@@ -1095,8 +1095,9 @@ export class Resources {
// 3. Active elements are immediately resized. The assumption is that
// the resize is triggered by the user action or soon after.
resize = true;
} else if (topMarginDiff == 0 && box.bottom + Math.min(heightDiff, 0) >=
viewportRect.bottom - bottomOffset) {
} else if (box.top >= viewportRect.bottom - bottomOffset ||
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes sense.
But I have two questions: when get box.top is its margin included?
What happens when topMarginDiff is a negative value? Or can it be a negative value?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good spot. You're right box.top does not include the margin. I've refined this so we calculate the top boundary that isn't changed and then check that this is below the fold.

With my refined approach, topMarginDiff being negative is not an issue, but I guess there is a potential issue if someone tries to set a top margin to be -100 or something. I've filed #8333 and will address this in a separate PR.

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.

None yet

6 participants