Skip to content

Commit

Permalink
[spec] Add trustedBiddingSignalsSlotSizeMode
Browse files Browse the repository at this point in the history
And related auctionConfig field.

This corresponds to the explainer changes in WICG#928.
  • Loading branch information
MattMenke2 authored Dec 15, 2023
1 parent e0c924b commit f91d9bf
Showing 1 changed file with 34 additions and 16 deletions.
50 changes: 34 additions & 16 deletions spec.bs
Original file line number Diff line number Diff line change
Expand Up @@ -705,6 +705,7 @@ dictionary AuctionAdConfig {
sequence<USVString> interestGroupBuyers;
Promise<any> auctionSignals;
record<DOMString, DOMString> requestedSize;
sequence<record<DOMString, DOMString>> allSlotsRequestedSizes;
Promise<any> sellerSignals;
Promise<DOMString> directFromSellerSignalsHeaderAdSlot;
unsigned long long sellerTimeout;
Expand Down Expand Up @@ -1087,23 +1088,20 @@ To <dfn>validate and convert auction ad config</dfn> given an {{AuctionAdConfig}
result of [=serializing a JavaScript value to a JSON string=].
* To handle an error, set |auctionConfig|'s [=auction config/auction signals=] to failure.
1. If |config|["{{AuctionAdConfig/requestedSize}}"] [=map/exists=]:
1. Let |requestedSize| be |config|["{{AuctionAdConfig/requestedSize}}"]
1. If |requestedSize|["height"] does not [=map/exist=], throw a {{TypeError}}.

1. If |requestedSize|["width"] does not [=map/exist=], throw a {{TypeError}}.

1. Let |width| and |widthUnit| be the dimension and dimension unit that results from running
[=parse an AdRender dimension value=] with |requestedSize|["width"], respectively.
1. If |width| is null, throw a {{TypeError}}.

1. Let |height| and |heightUnit| be the dimension and dimension unit that results from running
[=parse an AdRender dimension value=] with |requestedSize|["height"], respectively.
1. If |height| is null, throw a {{TypeError}}.

1. Let |adSize| be a new [=ad size=].
1. Set |adSize|'s [=ad size/width=] to |width|, [=ad size/width units=] to |widthUnit|,
[=ad size/height=] to |height|, [=ad size/height units=] to |heightUnit|.
1. Let |adSize| be the result from running [=parse an ad size value=] with
|config|["{{AuctionAdConfig/requestedSize}}"]
1. If |adSize| is null, throw a {{TypeError}}.
1. Set |auctionConfig|'s [=auction config/requested size=] to |adSize|.
1. If |config|["{{AuctionAdConfig/allSlotsRequestedSizes}}"] [=map/exists=]:
1. If |config|["{{AuctionAdConfig/allSlotsRequestedSizes}}"] is [=list/empty=]:
1. Throw a {{TypeError}}.
1. [=list/For each=] |adSizeValue| in |config|["{{AuctionAdConfig/allSlotsRequestedSizes}}"]:
1. Let |adSize| be the result of running [=parse an ad size value=] with |adSizeValue|.
1. If |adSize| is null, throw a {{TypeError}}.
1. [=list/Append=] |adSize| to |auctionConfig|'s [=auction config/all slots requested sizes=].
1. If |auctionConfig|'s [=auction config/requested size=] is not null, and |auctionConfig|'s
[=auction config/all slots requested sizes=] does not [=list/contain=] |auctionConfig|'s
[=auction config/requested size=], throw a {{TypeError}}.
1. If |config|["{{AuctionAdConfig/sellerSignals}}"] [=map/exists=]:
1. Set |auctionConfig|'s [=auction config/seller signals=] to
|config|["{{AuctionAdConfig/sellerSignals}}"].
Expand Down Expand Up @@ -4337,6 +4335,9 @@ An auction config is a [=struct=] with the following items:
: <dfn>requested size</dfn>
:: Null or an [=ad size=], initially null.
The size of the frame for the ad being selected by the auction.
: <dfn>all slots requested sizes</dfn>
:: Null or a [=list] of [=ad sizes=', initially null.
The size of all frames for ads being selected by any auction in the frame.
: <dfn>seller signals</dfn>
:: Null, a [=string=], a {{Promise}}, or failure.
Opaque JSON data passed to the seller's [=script runner=].
Expand Down Expand Up @@ -4617,6 +4618,23 @@ Width and height of an ad.
: <dfn>height units</dfn>
:: A [=string=]. Can only be one of "px" (pixel), "sh" (screen height), and "sw" (screen width).

<div algorith>
To <dfn>parse an AdRender ad size</dfn> given an [=object=] |adSlotSize|:

1. If |adSlotSize|["height"] does not [=map/exist=], return null.
1. If |adSlotSize|["width"] does not [=map/exist=], return null.
1. Let |width| and |widthUnit| be the dimension and dimension unit that results from running
[=parse an AdRender dimension value=] with |adSlotSize|["width"], respectively.
1. If |width| is null, return null.
1. Let |height| and |heightUnit| be the dimension and dimension unit that results from running
[=parse an AdRender dimension value=] with |adSlotSize|["height"], respectively.
1. If |height| is null, return null.
1. Let |adSize| be a new [=ad size=].
1. Set |adSize|'s [=ad size/width=] to |width|, [=ad size/width units=] to |widthUnit|,
[=ad size/height=] to |height|, [=ad size/height units=] to |heightUnit|.
1. return |adSize|.
</div>

</dl>

<h3 id=direct-from-seller-signals-section>Direct from seller signals</h3>
Expand Down

0 comments on commit f91d9bf

Please sign in to comment.