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

Polyfill legacy offsetParent behavior #156

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

josepharhar
Copy link

The spec for offsetParent was changed here:
w3c/csswg-drafts#159

This change was implemented in Safari and Firefox, but hasn't been
implemented in Chrome, until now:
https://chromium-review.googlesource.com/c/chromium/src/+/2775208

When I made this change in chrome, it broke some chrome:// internal
pages which use paper-tooltip:
https://bugs.chromium.org/p/chromium/issues/detail?id=1200750
https://bugs.chromium.org/p/chromium/issues/detail?id=1202105

This patch fixes paper-tooltip to use the new offsetParent behavior by
adding a polyfill for the old offsetParent behavior. The issues reported
in the above bugs would also occur in Firefox and Safari, but nobody
ever found out because those chrome:// pages were obviously never tested
in Firefox or Safari.

The spec for offsetParent was changed here:
w3c/csswg-drafts#159

This change was implemented in Safari and Firefox, but hasn't been
implemented in Chrome, until now:
https://chromium-review.googlesource.com/c/chromium/src/+/2775208

When I made this change in chrome, it broke some chrome:// internal
pages which use paper-tooltip:
https://bugs.chromium.org/p/chromium/issues/detail?id=1200750
https://bugs.chromium.org/p/chromium/issues/detail?id=1202105

This patch fixes paper-tooltip to use the new offsetParent behavior by
adding a polyfill for the old offsetParent behavior. The issues reported
in the above bugs would also occur in Firefox and Safari, but nobody
ever found out because those chrome:// pages were obviously never tested
in Firefox or Safari.
@josepharhar
Copy link
Author

I noticed that this repo hasn't had a lot of activity in recent years...
If this doesn't get merged that's OK with me, but in order to ship the new offsetParent behavior in chrome I will at least need to patch this into chrome's copy of paper-tooltip here and here.

@josepharhar
Copy link
Author

It turns out that chromium already has a patch system that I can use to patch this behavior into chrome in order to fix the chrome:// copy of paper-tooltip of interest, so I'll just do that.
I'll leave this PR open in case anyone is actually interested.

@bicknellr
Copy link
Contributor

bicknellr commented Jul 30, 2021

(relaying from chat) Sounds like Chromium isn't interested in keeping a local patch, so we're going to do a regular release for this, which I think is safe since this should be fixing the element for an intentionally breaking change in Chromium.

http://cl/387845879 is the CL I'm going to use for testing. @josepharhar, I think you also said this would fix the same issue as #155?

@josepharhar
Copy link
Author

After reading #155 I think they are separate unrelated fixes

test/basic.html Outdated Show resolved Hide resolved
test/basic.html Outdated Show resolved Hide resolved
paper-tooltip.js Show resolved Hide resolved
@google-cla
Copy link

google-cla bot commented Jul 30, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: no and removed cla: yes labels Jul 30, 2021
@google-cla
Copy link

google-cla bot commented Jul 30, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

1 similar comment
@google-cla
Copy link

google-cla bot commented Jul 30, 2021

We found a Contributor License Agreement for you (the sender of this pull request), but were unable to find agreements for all the commit author(s) or Co-authors. If you authored these, maybe you used a different email address in the git commits than was used to sign the CLA (login here to double check)? If these were authored by someone else, then they will need to sign a CLA as well, and confirm that they're okay with these being contributed to Google.
In order to pass this check, please resolve this problem and then comment @googlebot I fixed it.. If the bot doesn't comment, it means it doesn't think anything has changed.

ℹ️ Googlers: Go here for more info.

@google-cla google-cla bot added cla: yes and removed cla: no labels Jul 30, 2021
pull bot pushed a commit to luojiguicai/chromium that referenced this pull request Oct 29, 2021
When I first changed the behavior of offsetParent for crbug.com/920069
it broke some webui pages which used paper-toolip: crbug.com/1200750

I minimized the broken case and determined that paper-tooltip was
broken. I made a PR on paper-tooltip here, but it's unlikely that it
will ever get merged:
PolymerElements/paper-tooltip#156

The fix to paper-tooltip is to polyfill the old offsetParent behavior in
javascript. This patch applies the fix to paper-tooltip within chrome
and re-enables the new offsetParent behavior.

Fixed: 920069
Change-Id: Ib39c34a6c15b44161a7942c7ee9cfd4afe68acf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3061435
Commit-Queue: Joey Arhar <[email protected]>
Reviewed-by: dpapad <[email protected]>
Cr-Commit-Position: refs/heads/main@{#935992}
davidwongiiss1984 pushed a commit to omsproject/chromium that referenced this pull request Dec 14, 2021
This reverts commit def5070.

Reason for revert: The polyfill I wrote, not the actual offsetParent
flag, broke something else. I'll need to figure out what I did wrong in
the polyfill and fix it in a reland: crbug.com/1264786

Fixed: 1264786

Original change's description:
> Re-enable offsetParent and fix in webui's paper-tooltip
>
> When I first changed the behavior of offsetParent for crbug.com/920069
> it broke some webui pages which used paper-toolip: crbug.com/1200750
>
> I minimized the broken case and determined that paper-tooltip was
> broken. I made a PR on paper-tooltip here, but it's unlikely that it
> will ever get merged:
> PolymerElements/paper-tooltip#156
>
> The fix to paper-tooltip is to polyfill the old offsetParent behavior in
> javascript. This patch applies the fix to paper-tooltip within chrome
> and re-enables the new offsetParent behavior.
>
> Fixed: 920069
> Change-Id: Ib39c34a6c15b44161a7942c7ee9cfd4afe68acf7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3061435
> Commit-Queue: Joey Arhar <[email protected]>
> Reviewed-by: dpapad <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#935992}

(cherry picked from commit 5c36b4e)

Change-Id: I27faaeb162a004130e4692595530ea5ab4300574
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3280437
Reviewed-by: Joey Arhar <[email protected]>
Reviewed-by: dpapad <[email protected]>
Auto-Submit: Joey Arhar <[email protected]>
Commit-Queue: dpapad <[email protected]>
Cr-Original-Commit-Position: refs/heads/main@{#941603}
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3282903
Commit-Queue: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/branch-heads/4692@{chromium#200}
Cr-Branched-From: 038cd96-refs/heads/main@{#938553}
aarongable pushed a commit to chromium/chromium that referenced this pull request Apr 5, 2022
Original patch: http://crrev.com/872658
First revert/disable: http://crrev.com/879028
Second patch: http://crrev.com/935992
Second revert/disable: http://crrev.com/941603

The second attempt at this failed because the polyfill I wrote was
modifying the display property of nodes while computing offsetParent. I
rewrote the polyfill and verified that both of the bugs causing
disables/reverts are still fixed.

I made a pull request to add the polyfill upstream, but the upstream
maintainers will not publish any new releases and would prefer not to
merge any new PRs:
PolymerElements/paper-tooltip#156

Fixed: 920069
Change-Id: I006fec2d88da05dd4c3e2b2aa55352c02105fac0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3566126
Reviewed-by: Mason Freed <[email protected]>
Reviewed-by: Demetrios Papadopoulos <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#989056}
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this pull request Oct 14, 2022
When I first changed the behavior of offsetParent for crbug.com/920069
it broke some webui pages which used paper-toolip: crbug.com/1200750

I minimized the broken case and determined that paper-tooltip was
broken. I made a PR on paper-tooltip here, but it's unlikely that it
will ever get merged:
PolymerElements/paper-tooltip#156

The fix to paper-tooltip is to polyfill the old offsetParent behavior in
javascript. This patch applies the fix to paper-tooltip within chrome
and re-enables the new offsetParent behavior.

Fixed: 920069
Change-Id: Ib39c34a6c15b44161a7942c7ee9cfd4afe68acf7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3061435
Commit-Queue: Joey Arhar <[email protected]>
Reviewed-by: dpapad <[email protected]>
Cr-Commit-Position: refs/heads/main@{#935992}
NOKEYCHECK=True
GitOrigin-RevId: def507007a4d56a61c433f565c1f0beac7790831
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this pull request Oct 14, 2022
This reverts commit def507007a4d56a61c433f565c1f0beac7790831.

Reason for revert: The polyfill I wrote, not the actual offsetParent
flag, broke something else. I'll need to figure out what I did wrong in
the polyfill and fix it in a reland: crbug.com/1264786

Fixed: 1264786

Original change's description:
> Re-enable offsetParent and fix in webui's paper-tooltip
>
> When I first changed the behavior of offsetParent for crbug.com/920069
> it broke some webui pages which used paper-toolip: crbug.com/1200750
>
> I minimized the broken case and determined that paper-tooltip was
> broken. I made a PR on paper-tooltip here, but it's unlikely that it
> will ever get merged:
> PolymerElements/paper-tooltip#156
>
> The fix to paper-tooltip is to polyfill the old offsetParent behavior in
> javascript. This patch applies the fix to paper-tooltip within chrome
> and re-enables the new offsetParent behavior.
>
> Fixed: 920069
> Change-Id: Ib39c34a6c15b44161a7942c7ee9cfd4afe68acf7
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3061435
> Commit-Queue: Joey Arhar <[email protected]>
> Reviewed-by: dpapad <[email protected]>
> Cr-Commit-Position: refs/heads/main@{#935992}

Change-Id: I27faaeb162a004130e4692595530ea5ab4300574
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3280437
Reviewed-by: Joey Arhar <[email protected]>
Reviewed-by: dpapad <[email protected]>
Auto-Submit: Joey Arhar <[email protected]>
Commit-Queue: dpapad <[email protected]>
Cr-Commit-Position: refs/heads/main@{#941603}
NOKEYCHECK=True
GitOrigin-RevId: 5c36b4e8268c42e6d206af77efe45d58419043fe
mjfroman pushed a commit to mjfroman/moz-libwebrtc-third-party that referenced this pull request Oct 14, 2022
Original patch: http://crrev.com/872658
First revert/disable: http://crrev.com/879028
Second patch: http://crrev.com/935992
Second revert/disable: http://crrev.com/941603

The second attempt at this failed because the polyfill I wrote was
modifying the display property of nodes while computing offsetParent. I
rewrote the polyfill and verified that both of the bugs causing
disables/reverts are still fixed.

I made a pull request to add the polyfill upstream, but the upstream
maintainers will not publish any new releases and would prefer not to
merge any new PRs:
PolymerElements/paper-tooltip#156

Fixed: 920069
Change-Id: I006fec2d88da05dd4c3e2b2aa55352c02105fac0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3566126
Reviewed-by: Mason Freed <[email protected]>
Reviewed-by: Demetrios Papadopoulos <[email protected]>
Commit-Queue: Joey Arhar <[email protected]>
Cr-Commit-Position: refs/heads/main@{#989056}
NOKEYCHECK=True
GitOrigin-RevId: 600466d536907bc751f2a8ea1687cd7fec0e02e3
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.

2 participants