Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(563)

Side by Side Diff: docs/browser_view_resizer.md

Issue 1309473002: WIP: Migrate Wiki content over to src/docs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 # Introduction
2
3 To fix bug [458](http://code.google.com/p/chromium/issues/detail?id=458), which identifies that it is hard to hit the thin window frame corner to resize the win dow. It would be better to have a resize hit area (called widget from now on) in the corner, as we currently have for edit boxes for example.
4
5
6 # Background
7
8 This is specific to the Windows OS. On the Mac, Cocoa automatically adds a resiz e widget (Not sure about Linux, we should double check). On Windows, those resiz e widgets are at the extreme right of a status bar. For example, if you remove t he status bar from a Windows Explorer window, you lose the resize widget. But si nce Chrome never ever has a status bar and simply take over the bottom of the wi ndow for specific tasks (like the download shelf for example), we need to find a creative way of giving access to a resize widget.
9
10 The bottom corners where we would like to add the resize widget are currently co ntrolled by the browser view, which can have either the tab contents view or oth er dynamic views (like the download shelf view) displayed in this area.
11
12 # Requirements
13
14 Since there is no status bar to simply fix a resize widget to, we must dynamical ly create a widget that can be laid either on the tab contents view or on other views that might temporarily take over the bottom part of the browser view.
15
16 When no dynamic view is taking over the bottom of the browser view, the resize w idget can sit in the bottom right corner of the tab contents view, over the tab contents view.
17 <table align='center' border='0'> <tr><td><img src='http://lh6.ggpht.com/_2OD0ww 7UZAs/SUAaNi6TWYI/AAAAAAAAGmI/89jCYQ1Cxsw/ResizeCorner-2.png' /></td></tr></tabl e>
18 The resize widget must have the same width and height as the scroll bars so that it can fit in the corner currently left empty when both scroll bars are visible . If only one scroll bar is visible (either the horizontal or the vertical one), that scroll bar must still leave room for the resize widget to fit there (as it currently leave room for the empty corner when both scroll bars are visible), y et, only when the resize widget is laid on top of the tab contents view, not whe n a dynamic shelf is added at the bottom of the browser view.
19
20 <table align='center' border='0'> <tr><td><img src='http://lh6.ggpht.com/_2OD0ww 7UZAs/SUAaNjqr_iI/AAAAAAAAGmA/56hzjdnkVRI/ResizeCorner-1.png' /></td><td><img sr c='http://lh3.ggpht.com/_2OD0ww7UZAs/SUAaN_wDEUI/AAAAAAAAGmQ/7B4CTZTXOmk/ResizeC orner-3.png' /></td><td><img src='http://lh6.ggpht.com/_2OD0ww7UZAs/SUAaN7yme9I/ AAAAAAAAGmY/EaniiAbwi-Q/ResizeCorner-4.png' /></td></tr></table>
21
22 If another view (e.g., again, the download shelf) is added at the bottom of the browser view, below the tab contents view, and covers the bottom corners, then the resize widget must be laid on top of this other child view. Of course, all c hild views that can potentially be added at the bottom of the browser view, must be designed in a way that leaves enough room in the bottom corners for the resi ze widget.
23
24 <table align='center' border='0'> <tr><td><img src='http://lh3.ggpht.com/_2OD0ww 7UZAs/SUAaN17TIrI/AAAAAAAAGmg/6bljNQ_vZkI/ResizeCorner-5.png' /></td><td><img sr c='http://lh4.ggpht.com/_2OD0ww7UZAs/SUAaWINHA6I/AAAAAAAAGmo/-VG5FGC8Xds/ResizeC orner-6.png' /></td><td><img src='http://lh6.ggpht.com/_2OD0ww7UZAs/SUAaWDUpo0I/ AAAAAAAAGmw/8USPzoMpgu0/ResizeCorner-7.png' /></td></tr></table>
25
26 Since the bottom corners might have different colors, based on the state and con tent of the browser view, the resize widget must have a transparent background.
27
28 The resize widget is not animated itself. It might move with the animation of th e view it is laid on top of (e.g., when the download shelf is being animated in) , but we won't attempt to animate the resize widget itself (or fix it in the bot tom right corner of the browser view while the other views get animated it).
29
30 # Design
31
32 Unfortunately, we must deal with the two different cases (with or without a dyna mic bottom view) in two different and distinct ways.
33
34 ## Over a Dynamic View
35
36 For the cases where there is a dynamic view at the bottom of the browser view, a new view class (named `BrowserResizerView`) inheriting from [views::View](http: //src.chromium.org/svn/trunk/src/chrome/views/view.h) is used to display the res ize widget. It is set as a child of the dynamic view laid at the bottom of the b rowser view. The Browser view takes care of properly setting the bounds of the r esize widget view, based on the language direction.
37
38 Also, it is easier and more efficient to let the browser view handle the mouse i nteractions to resize the browser. We can let Windows take care of properly resi zing the view by returning the HTBOTTOMLEFT or HTBOTTOMRIGHT flags from the NCCl ientHitTest windows message handler when they occur over the resize widget. The browser view also takes care of changing the mouse cursor to the appropriate res izing arrows when the mouse hovers over the resize widget area.
39
40 ## Without a Dynamic View
41
42 To make sure that the scroll bars (handled by `WebKit`) are not drawn on top of the resizer widget (or vice versa), we need to properly implement the callback s pecifyinhg the rectangle covered by the resizer. This callback is implemented on the `RenderWidget` class that can delegate to a derive class via a new virtual method which returns an empty rect on the base class. Via a series of delegate i nterface calls, we eventually get back to the browser view which can return the size and position of the resize widget, but only if it is laid out on top of the tabs view, it returns an empty rect when there is a dynamic view.
43
44 To handle the drawing of the resize widget over the render widget, we need to ad d code to the Windows specific version of the render widget host view which rece ives the bitmap rendered by WebKit so it can layer the transparent bitmap used f or the resize widget. That same render widget host view must also handle the mou se interaction and use the same trick as the browser view to let Windows take ca re of resizing the whole frame. It must also take care of changing the mouse cur sor to the appropriate resizing arrows when the mouse hovers over the resize wid get area.
45
46 # Implementation
47
48 You can find the changes made to make this work in patch [16488](http://coderevi ew.chromium.org/16488).
49
50 # Alternatives Considered
51
52 We could have tried to reuse the code that currently takes care of resizing the edit boxes within WebKit, but this code is wired to the overflow style of HTML e lement and would have been hard to rewire in an elegant way to be used in a high er level object like the browser view. Unless we missed something.
53
54 We might also decide to go with the easier solution of only showing the resize c orner within the tab contents view. In that case, it would still be recommended that the resize widget would not appear when dynamic views are taking over the b ottom portion of the browser view, since it would look weird to have a resize co rner widget that is not in the real... corner... of the browser view ;-)
55
56 We may decide that we don't want to see the resize widget bitmap hide some pixel s from the tab contents (or dynamic view) yet we would still have the resizing f unctionality via the mouse interaction and also get visual feedback with the mou se cursor changes while we hover over the resize widget area.
57
58 We may do more research to find a way to solve this problem in a single place as opposed to the current dual solution, but none was found so far.
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698