Summary: | [Qt] QtTestBrowser not setting preferredContentsSize for resizesToContents | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | WebKit | Reporter: | Antonio Gomes <tonikitoo> | ||||||||
Component: | Tools / Tests | Assignee: | Antonio Gomes <tonikitoo> | ||||||||
Status: | RESOLVED FIXED | ||||||||||
Severity: | Normal | CC: | hausmann, kenneth, koivisto | ||||||||
Priority: | P2 | Keywords: | Qt, QtTriaged | ||||||||
Version: | 528+ (Nightly build) | ||||||||||
Hardware: | PC | ||||||||||
OS: | All | ||||||||||
Attachments: |
|
Description
Antonio Gomes
2010-07-28 21:19:23 PDT
Created attachment 63247 [details]
patch v1
Patch addresses the problem for QtTestBrowser by properly handle scene, webview and viewport sizes when toggle resizesToContents on/off.
Comment on attachment 63247 [details]
patch v1
WebKitTools/QtTestBrowser/webview.cpp:91
+ setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
Strange... if it resizes to contents, no scrollbars should be shown... why are they set to as needed?
Comment on attachment 63247 [details]
patch v1
WebKitTools/QtTestBrowser/webview.cpp:91
+ setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
Strange... if it resizes to contents, no scrollbars should be shown... why are they set to as needed?
WebKitTools/QtTestBrowser/webview.cpp:100
+ scene()->setSceneRect(viewportRect);
shouldnt these be set automatically elsewhere so they are always consistent.
WebKitTools/QtTestBrowser/webview.cpp:93
+ scene()->setSceneRect(QRectF());
why this?
WebKitTools/QtTestBrowser/launcherwindow.cpp:409
+ toggleResizesToContents(true);
why not toggleResizesToContents(gResizesToContents) ?
(In reply to comment #2) > (From update of attachment 63247 [details]) > WebKitTools/QtTestBrowser/webview.cpp:91 > + setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); > Strange... if it resizes to contents, no scrollbars should be shown... why are they set to as needed? QGraphicsWebView *wont* have scrollbars as you said, but in order to make the content completely viewable (including offscreen content), the QGraphicsView still perform the scrolling, so it is set back to 'auto'. QGraphicsView's viewport is what is going to be getting scrolled instead then. > WebKitTools/QtTestBrowser/webview.cpp:100 > + scene()->setSceneRect(viewportRect); > shouldnt these be set automatically elsewhere so they are always consistent. In fact once setSceneRect(xxx) is called (see existing code in WebViewGraphicsBased::resizeEvent), scene will be sizing xxx until we call it with a invalid QRectF. > WebKitTools/QtTestBrowser/webview.cpp:93 > + scene()->setSceneRect(QRectF()); > why this? See from the docs: "The scene rectangle defines the extent of the scene. It is primarily used by QGraphicsView to determine the view's default scrollable area, and by QGraphicsScene to manage item indexing. If unset, or if set to a null QRectF, sceneRect() will return the largest bounding rect of all items on the scene since the scene was created (i.e., a rectangle that grows when items are added to or moved in the scene, but never shrinks)." Created attachment 63256 [details] patch v2 Same patch as attachment 63247 [details], but with more explainations in the code, as per discussion with Kenneth on IRC. Created attachment 63304 [details] (committed r64556, r=kenneth) patch v2.1 - right patch [Right patch this time]. Comment on attachment 63304 [details] (committed r64556, r=kenneth) patch v2.1 - right patch Clearing flags on attachment: 63304 Committed r64556: <http://trac.webkit.org/changeset/64556> |