Re: Set Window Size

On 19/05/16 00:39, Clay Martin wrote:
> Doing a quick search I found this:
> https://developer.mozilla.org/en-US/docs/Web/Events/resize
> Which led me to this:
> http://www.w3.org/TR/DOM-Level-3-Events/#event-type-resize
>
> Which seems like what we want per it's definition:
> "A user agent MUST dispatch this event when a document view has been
> resized. This event type is dispatched after all effects for that
> occurrence of resizing of that particular event target have been
> executed by the user agent."
>
> Since Set Window Size resizes once (and isn't a continuous resize like
> if a user clicks/drags to resize the browser) it should only fire once,
> although I don't know if this accounts for the content completing
> reflow. Although it does say:
> "User agents which support continuous reflow of the document's layout
> during user-initiated resizing MUST dispatch this event synchronously
> after each reflow of the document."
>
> Where it calls out reflow of the document specifically. Thoughts?

That seems to have exactly the same problems; you may get 0 or more 
resize events as a result of every set window size command. At best the 
definition suggests that if you get one event then it is probably the 
final state of the window, although I guess that isn't guaranteed.

FWIW, in very sketchy terms, I think the spec should read as follows:

Let /width/ be the result of getting a property named "width".

Let /height/ be the result of getting a property named "height".

[error handling]

Optionally return success with data [an object containing width and height]

Optionally clamp /width/ and /height/ to UA-imposed limits.

Resize the current top level browsing context's window by moving its 
right and bottom edges such that the distance between the left and right 
edges of the viewport are /width/ CSS pixels of target and the distance 
between the top and bottom edges of the viewport are /height/ CSS pixels 
of target.

Wait until the window is believed to have completed the resize, or at 
most a user agent defined length of time.

NOTE: The implementation of the above step is necessarily UA dependent 
as it depends on the implementation of the underlying window manager. 
For example an implementation may wait until it receives a reply to a 
request to resize the window, or it may wait for a series of resize 
events indicating that the size has reached a quiescent state.

Return success with data [an object indicating the actual current size 
of the window].

Received on Thursday, 19 May 2016 09:14:01 UTC