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

[6.x] fix the fitContent() method #815

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

browner12
Copy link
Contributor

well, my bad on this one....

In this PR of mine (#731) I screwed up the logic when flattening the conditional, and basically prevented all content fitting from occurring.

someone please double check my work on this one 😅

this conditional was basically blocking all content fitting from happening.
@SjorsO
Copy link
Contributor

SjorsO commented Sep 17, 2020

I noticed this method didn't work a while back, but I blamed my HTML, haha

I just tested the fix in this PR, I can confirm it solves the problem 👍

@taylorotwell taylorotwell merged commit c8c60e4 into laravel:6.x Sep 17, 2020
@browner12 browner12 deleted the fix-fit-content branch September 17, 2020 18:08
@driesvints
Copy link
Member

@browner12 I think this re-introduced the bug originally fixed in #730 where the browser can be resized to zero width or height.

It probably should be:

if (! empty($html) && $html->getSize()->getWidth() > 0 && $html->getSize()->getHeight() > 0) {

@browner12
Copy link
Contributor Author

That change seems to make sense.

Is the problem that >= and <= have no type strict options, and getWidth() or getHeight() are returning a falsy value?

@driesvints
Copy link
Member

No the problem is the = part that you kept. We explicitly want to prevent resizing when the width or height is zero or lower.

@browner12
Copy link
Contributor Author

Yah, that makes sense to me.

My only confusion is, if the height of the content is actually zero, what does it matter if we resize it to zero? Is there a scenario where getHeight() is returning 0, but the height isn't actually zero?

@driesvints
Copy link
Member

Hmm, that I don't know myself I have to admit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants