Bug 60518

Summary: Expose willStartLiveResize and willEndLiveResize in WebView
Product: WebKit Reporter: Sailesh Agrawal <sail>
Component: New BugsAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, fishd, jamesr, rsesek, thakis, tony
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 61488    
Bug Blocks:    
Attachments:
Description Flags
Patch
none
Patch
none
Patch
none
Patch
none
Patch none

Description Sailesh Agrawal 2011-05-09 17:24:19 PDT
Expose willStartLiveResize and willEndLiveResize in WebView
Comment 1 Sailesh Agrawal 2011-05-09 17:25:20 PDT
Created attachment 92890 [details]
Patch
Comment 2 Sailesh Agrawal 2011-05-09 17:27:38 PDT
The Chromium side of this change:
http://codereview.chromium.org/6998002/
Comment 3 James Robinson 2011-05-09 17:36:57 PDT
+cc Darin, he approves all WebKit API changes.  What is a 'live resize'?
Comment 4 Sailesh Agrawal 2011-05-09 17:40:29 PDT
(In reply to comment #3)
> What is a 'live resize'?
On the Mac a view is in live resize mode when the user clicks on the resize box and starts resizing the window. I believe the resize mode ends once the user lets go of the resize box.

See viewWillStartLiveResize and viewDidEndLiveResize here:
http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSView_Class/Reference/NSView.html
Comment 5 Nico Weber 2011-05-09 18:40:22 PDT
Comment on attachment 92890 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=92890&action=review

lgtm (but I'm not a reviewer)

> Source/WebKit/chromium/public/WebView.h:136
> +    // Notification that the view has started or ended live resize.

Maybe add "This is Mac-speak for when the user manuall resizes the window by dragging its corner." or something like this.
Comment 6 Darin Fisher (:fishd, Google) 2011-05-09 21:32:55 PDT
Comment on attachment 92890 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=92890&action=review

> Source/WebKit/chromium/public/WebView.h:137
> +    virtual void willStartLiveResize() = 0;

maybe you want to more explicitly mention the "resizer" in this API?  didStartDraggingResizer?  didStopDraggingResizer?

we already have the term "resizer" in the API.  see WebWidgetClient::windowResizerRect().

i'm a little concerned about using a OSX specific term here for something that could be generic to more ports.
Comment 7 Nico Weber 2011-05-09 21:35:52 PDT
Comment on attachment 92890 [details]
Patch

FWIW, both the thing in WebCore this forwards to (frameview) and the thing on the chrome side call this "live resizing". I'm not sure if giving it a different name in the webkit api layer adds clarity (but I don't feel strongly).
Comment 8 Darin Fisher (:fishd, Google) 2011-05-09 21:37:25 PDT
(In reply to comment #7)
> (From update of attachment 92890 [details])
> FWIW, both the thing in WebCore this forwards to (frameview) and the thing on the chrome side call this "live resizing". I'm not sure if giving it a different name in the webkit api layer adds clarity (but I don't feel strongly).

fair enough...  can i please see how this will be used in chromium?  i don't get what this is for.
Comment 9 Nico Weber 2011-05-09 21:38:41 PDT
See http://codereview.chromium.org/6998002/ (comment 2)
Comment 10 Nico Weber 2011-05-09 21:39:58 PDT
The next OS X version might add a new style of overlay scrollbars that are only visible while
a) the window is being scrolled or
b) the window is being resized.
To make b) happen, the scrollbars need to know if the window is being resized; that's what this is for afaiu.
Comment 11 Sailesh Agrawal 2011-05-10 09:06:15 PDT
Created attachment 92963 [details]
Patch
Comment 12 Sailesh Agrawal 2011-05-10 09:07:41 PDT
Comment on attachment 92890 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=92890&action=review

>> Source/WebKit/chromium/public/WebView.h:136
>> +    // Notification that the view has started or ended live resize.
> 
> Maybe add "This is Mac-speak for when the user manuall resizes the window by dragging its corner." or something like this.

Done.

>> Source/WebKit/chromium/public/WebView.h:137
>> +    virtual void willStartLiveResize() = 0;
> 
> maybe you want to more explicitly mention the "resizer" in this API?  didStartDraggingResizer?  didStopDraggingResizer?
> 
> we already have the term "resizer" in the API.  see WebWidgetClient::windowResizerRect().
> 
> i'm a little concerned about using a OSX specific term here for something that could be generic to more ports.

As Nico mentioned, liveResize matches the naming in WebCore.
Comment 13 Darin Fisher (:fishd, Google) 2011-05-10 22:00:12 PDT
(In reply to comment #10)
> The next OS X version might add a new style of overlay scrollbars that are only visible while
> a) the window is being scrolled or
> b) the window is being resized.
> To make b) happen, the scrollbars need to know if the window is being resized; that's what this is for afaiu.

so, we currently have the resize() method on WebWidget.  you can't resize an individual WebFrame, only the viewport of the topmost one.  it seems this pair of enter/exit "resizing" methods should accompany the resize() method, right?

  willBeginResizing();
  resize(size1);
  resize(size2);
  ...
  didFinishResizing();

I just picked "clean room" names that seem to go well with the action named "resize", but willStartLiveResize and willEndLiveResize work too.
Comment 14 Darin Fisher (:fishd, Google) 2011-05-10 22:03:51 PDT
Comment on attachment 92963 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=92963&action=review

> Source/WebKit/chromium/public/WebView.h:139
> +    virtual void willStartLiveResize() = 0;

please move to WebWidget.  i think you can try to define these better instead
of referring to some OSX behavior.  this API should be well defined so other
ports can understand how to use it.  see my previous note.  i think this is
intended to bound a sequence of resize commands so the implementation can show
UI related to such an interaction.
Comment 15 Sailesh Agrawal 2011-05-13 15:03:10 PDT
Created attachment 93519 [details]
Patch
Comment 16 Darin Fisher (:fishd, Google) 2011-05-15 21:35:34 PDT
Comment on attachment 93519 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=93519&action=review

Sorry if it comes off as though I'm being nit-picky here.  I just think it is
important that the API makes sense.

> Source/WebKit/chromium/public/WebWidget.h:58
> +    // Called when the user begins to drag the resizer.

You are still leaving things mysterious for the reader to guess what you mean.
I think you mean that willStartLiveResize will be followed by a sequence of
calls to resize(), but you don't say that.  Am I interpreting this API correctly?
If so, please add a comment to clarify this.

Is it required that this API only be used when resizing using the "resizer"?  Why
is the effect particular to that way of resizing?  what if there are other ways
of allowing a user gesture to actuate a "live resize" sequence?

I'm guessing (so please clarify), but I think you just want to tell WebKit to
treat a sequence of resize() calls as related to a single user gesture.  Maybe
that does not need to be particular to the "resizer" UI?
Comment 17 Sailesh Agrawal 2011-05-23 14:37:20 PDT
Created attachment 94492 [details]
Patch
Comment 18 Sailesh Agrawal 2011-05-23 14:38:56 PDT
(In reply to comment #16)
> (From update of attachment 93519 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=93519&action=review
> 
> Sorry if it comes off as though I'm being nit-picky here.  I just think it is
> important that the API makes sense.
> 
> > Source/WebKit/chromium/public/WebWidget.h:58
> > +    // Called when the user begins to drag the resizer.
> 
> You are still leaving things mysterious for the reader to guess what you mean.
> I think you mean that willStartLiveResize will be followed by a sequence of
> calls to resize(), but you don't say that.  Am I interpreting this API correctly?
> If so, please add a comment to clarify this.

I guess the live resize begin/end messages are meant as hints and can be used to group any sequence of resize events.

I updated the change log to (hopefully) clarify this.

(By the way, thanks for your feedback. Sorry, I've been so slow on updating this patch.)
Comment 19 Darin Fisher (:fishd, Google) 2011-05-24 21:28:43 PDT
Comment on attachment 94492 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=94492&action=review

> Source/WebKit/chromium/public/WebWidget.h:61
> +    // lets go of the resizer.

nice, thanks!
Comment 20 WebKit Commit Bot 2011-05-25 16:30:52 PDT
Comment on attachment 94492 [details]
Patch

Clearing flags on attachment: 94492

Committed r87333: <http://trac.webkit.org/changeset/87333>
Comment 21 WebKit Commit Bot 2011-05-25 16:30:58 PDT
All reviewed patches have been landed.  Closing bug.
Comment 22 Sailesh Agrawal 2011-05-25 17:53:30 PDT
This change was backed out, trying again.
Comment 23 Sailesh Agrawal 2011-05-25 17:55:42 PDT
Created attachment 94894 [details]
Patch
Comment 24 Sailesh Agrawal 2011-05-25 17:57:24 PDT
To avoid breaking the Chromium build I changed the live resize start/end function not to be pure virtual.

Once http://codereview.chromium.org/6998002/ has landed I'll change them to be pure virtual.

Please take another look, thanks!
Comment 25 WebKit Commit Bot 2011-05-26 12:36:25 PDT
Comment on attachment 94894 [details]
Patch

Clearing flags on attachment: 94894

Committed r87417: <http://trac.webkit.org/changeset/87417>
Comment 26 WebKit Commit Bot 2011-05-26 12:36:31 PDT
All reviewed patches have been landed.  Closing bug.