Page MenuHomePhabricator

Bug 1919718 - Part 2: Implement HTMLInputElement.alpha r=emilio
ClosedPublic

Authored by saschanaz on Thu, Jan 8, 3:27 PM.
Referenced Files
Unknown Object (File)
Sun, Feb 1, 5:54 AM
Unknown Object (File)
Sun, Feb 1, 5:54 AM
Unknown Object (File)
Sun, Feb 1, 5:54 AM
Unknown Object (File)
Sun, Feb 1, 5:54 AM
Unknown Object (File)
Sun, Feb 1, 5:54 AM
Unknown Object (File)
Sun, Feb 1, 5:54 AM
Unknown Object (File)
Wed, Jan 28, 7:40 AM
Unknown Object (File)
Wed, Jan 28, 4:22 AM

Event Timeline

There are a very large number of changes, so older changes are hidden. Show Older Changes
phab-bot changed the visibility from "Custom Policy" to "Public (No Login Required)".Thu, Jan 8, 3:27 PM
phab-bot changed the edit policy from "Custom Policy" to "Restricted Project (Project)".
phab-bot removed a project: secure-revision.
saschanaz updated this revision to Diff 1182361.
saschanaz updated this revision to Diff 1182371.
saschanaz retitled this revision from WIP: Bug 1919718 - Part 2: Implement HTMLInputElement.alpha to Bug 1919718 - Part 2: Implement HTMLInputElement.alpha r=emilio.
saschanaz added a reviewer: emilio.

Code analysis found 2 defects in diff 1182371:

  • 1 defect found by clang-format
  • 1 defect found by clang-format (Mozlint)
WARNING: Found 2 defects (warning level) that can be dismissed.

You can run this analysis locally with:

  • ./mach lint --warnings --outgoing
  • ./mach clang-format -p dom/html/HTMLInputElement.cpp

For your convenience, here is a patch that fixes all the clang-format defects (use it in your repository with hg import or git apply -p0).


If you see a problem in this automated review, please report it here.

You can view these defects in the Diff Detail section of Phabricator diff 1182371.

Not a reuseful style component thing.

emilio requested changes to this revision.Sat, Jan 10, 9:36 PM
dom/html/HTMLInputElement.cpp
796–798

This reads extra weird: "if not set alpha, then set alpha to 1.0". Maybe !aAllowAlpha or something?

2212

This doesn't seem safe? You're not making it required. Either do so or check whether it's present?

layout/forms/nsColorControlFrame.cpp
87

Please fix the comment, but also this is a web-exposed change: you can currently override ::-moz-color-swatch { background-color: blue } or something, since this was not !important, right?

Have you done some analysis of whether people are using this? I assume this is safe to change, but might be worth having a pref just in case...

layout/style/res/forms.css
442

Using custom properties in UA stylesheets is generally a massive smell. It works here because the property is always set and this element happens to but I'm still not a fan. Instead, wdyt of just changing background-color: with color:, and using currentColor here?

Also, no need to repeat the same color twice, just background-image: linear-gradient(var(--overlay-color)) would work. Also, does #ccc work fine in dark mode?

447

Can you elaborate on the background-size/background-position? Why do you need to specify them? Doesn't the default just work if you make the gradient stops pixels rather than percentages?

This revision now requires changes to proceed.Sat, Jan 10, 9:36 PM
dom/html/HTMLInputElement.cpp
2212

The picker always send it though, only the element send it optionally. Maybe MOZ_ASSERT is enough?

layout/forms/nsColorControlFrame.cpp
87

Wait, it's web exposed?! 🤯

layout/style/res/forms.css
442

SGTM, will try.

#ccc works fine but probably I should check the difference from the light mode.

447

This was a copypaste from color picker CSS, I'll check whether it works and maybe fix it there too.

saschanaz updated this revision to Diff 1183056.
saschanaz retitled this revision from Bug 1919718 - Part 2: Implement HTMLInputElement.alpha r=emilio to WIP: Bug 1919718 - Part 2: Implement HTMLInputElement.alpha r=emilio.
saschanaz updated this revision to Diff 1183527.
saschanaz retitled this revision from WIP: Bug 1919718 - Part 2: Implement HTMLInputElement.alpha r=emilio to Bug 1919718 - Part 2: Implement HTMLInputElement.alpha r=emilio.

Err, the pref.

saschanaz updated this revision to Diff 1183630.

The analysis task source-test-clang-external failed, but we could not detect any defect.
Please check this task manually.

The analysis task source-test-clang-tidy failed, but we could not detect any defect.
Please check this task manually.


If you see a problem in this automated review, please report it here.

emilio added a project: testing-approved.
emilio added inline comments.
dom/html/HTMLInputElement.cpp
796–798

This reads extra weird: "if not set alpha, then set alpha to 1.0". Maybe !aAllowAlpha or something?

This doesn't seem addressed and I think it still reads very weird, but it's not a huge deal.

dom/webidl/HTMLInputElement.webidl
307–308

Do you need unrestricted float to not sanitize NaNs away?

This revision is now accepted and ready to land.Wed, Jan 14, 10:22 AM
dom/html/HTMLInputElement.cpp
796–798

It's aSpecifiedAlpha now, is it not good enough?

dom/webidl/HTMLInputElement.webidl
307–308

Huh, yes, but interestingly bindgen did not sanitize NaN when set in C++ 👀

dom/html/HTMLInputElement.cpp
796–798

It's aSpecifiedAlpha now, is it not good enough?

WFM :)

saschanaz marked 6 inline comments as done.
This revision is now accepted and ready to land.Thu, Jan 15, 8:18 PM