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

FLEDGE: Enable screen height as unit and pure numbers input for ad size. #39730

Merged
merged 1 commit into from
Apr 28, 2023

Conversation

chromium-wpt-export-bot
Copy link
Collaborator

@chromium-wpt-export-bot chromium-wpt-export-bot commented Apr 27, 2023

Currently, for generateBid() and joinAdInterestGroup(), the supported
ad size units are

  • "px": pixel
  • "sw": screen width

This CL adds the unit:

  • "sh": screen height

The parser is also updated to support parsing pure numbers as pixels.
For example, "100" is parsed as 100 pixels.

A regular expression is used to match the input, and capture the
sub-patterns for value and unit.
^\s*((?:0|(?:[1-9][0-9]))(?:.[0-9]+)?)(px|sw|sh)?\s$

It basically means we match

  1. Zero or more leading spaces.
  2. Numbers, with optionally decimal point and digits. No leading space, cannot begin with zero, non-negative. (Sub-pattern captured)
  3. Immediately followed by an unit which can be one of "px", "sw" or "sh", or the unit can be ignored entirely.
    entirely. (Sub-pattern captured)
  4. Zero or more trailing spaces.

Bug: http://b/239866637

See Turtledove issue: WICG/turtledove#312
See Turtledove PR: WICG/turtledove#417

Change-Id: I336055ff3dd635dcdfd78999d0cb5972569f5ac1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4402817
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Reviewed-by: Garrett Tanzer <gtanzer@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1137102}

Copy link
Collaborator

@wpt-pr-bot wpt-pr-bot left a comment

Choose a reason for hiding this comment

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

The review process for this patch is being conducted in the Chromium project.

size.

Currently, for generateBid() and joinAdInterestGroup(), the supported
ad size units are
* "px": pixel
* "sw": screen width

This CL adds the unit:
* "sh": screen height

The parser is also updated to support parsing pure numbers as pixels.
For example, "100" is parsed as 100 pixels.

A regular expression is used to match the input, and capture the
sub-patterns for value and unit.
^\s*((?:0|(?:[1-9][0-9]*))(?:\.[0-9]+)?)(px|sw|sh)?\s*$

It basically means we match
1. Zero or more leading spaces.
2. Numbers, with optionally decimal point and digits. No leading space, cannot begin with zero, non-negative. (Sub-pattern captured)
3. Immediately followed by an unit which can be one of "px", "sw" or "sh", or the unit can be ignored entirely.
entirely. (Sub-pattern captured)
4. Zero or more trailing spaces.

Bug: http://b/239866637

See Turtledove issue: WICG/turtledove#312
See Turtledove PR: WICG/turtledove#417

Change-Id: I336055ff3dd635dcdfd78999d0cb5972569f5ac1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4402817
Commit-Queue: Xiaochen Zhou <xiaochenzh@chromium.org>
Reviewed-by: Garrett Tanzer <gtanzer@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1137102}
@chromium-wpt-export-bot chromium-wpt-export-bot merged commit 673c0db into master Apr 28, 2023
16 of 19 checks passed
@chromium-wpt-export-bot chromium-wpt-export-bot deleted the chromium-export-cl-4402817 branch April 28, 2023 13:29
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

3 participants