Changeset 68457 in webkit
- Timestamp:
- Sep 27, 2010 5:31:09 PM (14 years ago)
- Location:
- trunk/WebKit/qt
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/qt/Api/qgraphicswebview.cpp
r65124 r68457 76 76 QWebPage* page; 77 77 bool resizesToContents; 78 QSize deviceSize;79 78 80 79 // Just a convenience to avoid using page->client->overlay always … … 556 555 557 556 /*! 558 \property QGraphicsWebView::deviceSize559 \brief the size of the device using the web view560 561 The device size is used by the DOM window object methods562 otherHeight(), otherWidth() as well as a page for the viewport563 meta tag attributes device-width and device-height.564 */565 void QGraphicsWebView::setDeviceSize(const QSize& size)566 {567 d->deviceSize = size;568 }569 570 QSize QGraphicsWebView::deviceSize() const571 {572 return d->deviceSize;573 }574 575 /*!576 557 \property QGraphicsWebView::zoomFactor 577 558 \brief the zoom factor for the view -
trunk/WebKit/qt/Api/qgraphicswebview.h
r65124 r68457 42 42 Q_PROPERTY(QIcon icon READ icon NOTIFY iconChanged) 43 43 Q_PROPERTY(qreal zoomFactor READ zoomFactor WRITE setZoomFactor) 44 Q_PROPERTY(QSize deviceSize READ deviceSize WRITE setDeviceSize)45 44 46 45 Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) … … 65 64 qreal zoomFactor() const; 66 65 void setZoomFactor(qreal); 67 68 QSize deviceSize() const;69 void setDeviceSize(const QSize&);70 66 71 67 bool isModified() const; -
trunk/WebKit/qt/Api/qwebpage.cpp
r68292 r68457 22 22 #include "config.h" 23 23 #include "qwebpage.h" 24 24 25 #include "qwebview.h" 25 26 #include "qwebframe.h" … … 95 96 #include <QBitArray> 96 97 #include <QDebug> 98 #include <QDesktopWidget> 97 99 #include <QDragEnterEvent> 98 100 #include <QDragLeaveEvent> … … 2339 2341 } 2340 2342 2343 static int getintenv(const char* variable) 2344 { 2345 bool ok; 2346 int value = qgetenv(variable).toInt(&ok); 2347 return (ok) ? value : -1; 2348 } 2349 2350 static QSize queryDeviceSizeForScreenContainingWidget(const QWidget* widget) 2351 { 2352 QDesktopWidget* desktop = QApplication::desktop(); 2353 if (!desktop) 2354 return QSize(); 2355 2356 QSize size; 2357 2358 if (widget) { 2359 // Returns the available geometry of the screen which contains widget. 2360 // NOTE: this must be the the full screen size including any fixed status areas etc. 2361 size = desktop->availableGeometry(widget).size(); 2362 } else 2363 size = desktop->availableGeometry().size(); 2364 2365 // This must be in portrait mode, adjust if not. 2366 if (size.width() > size.height()) { 2367 int width = size.width(); 2368 size.setWidth(size.height()); 2369 size.setHeight(width); 2370 } 2371 2372 return size; 2373 } 2374 2375 /*! 2376 Computes the optimal viewport configuration given the \a availableSize, when 2377 user interface components are disregarded. 2378 2379 The configuration is also dependent on the device screen size which is obtained 2380 automatically. For testing purposes the size can be overridden by setting two 2381 environment variables QTWEBKIT_DEVICE_WIDTH and QTWEBKIT_DEVICE_HEIGHT, which 2382 both needs to be set. 2383 */ 2384 2341 2385 QWebPage::ViewportConfiguration QWebPage::viewportConfigurationForSize(QSize availableSize) const 2342 2386 { … … 2344 2388 static int deviceDPI = 160; 2345 2389 2346 FloatRect rect = d->page->chrome()->windowRect();2347 2348 int deviceWidth = rect.width();2349 int deviceHeight = rect.height();2350 2351 WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments(), desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize);2352 2353 2390 ViewportConfiguration result; 2391 2392 int deviceWidth = getintenv("QTWEBKIT_DEVICE_WIDTH"); 2393 int deviceHeight = getintenv("QTWEBKIT_DEVICE_HEIGHT"); 2394 2395 // Both environment variables need to be set - or they will be ignored. 2396 if (deviceWidth < 0 && deviceHeight < 0) { 2397 QSize size = queryDeviceSizeForScreenContainingWidget((d->client) ? d->client->ownerWidget() : 0); 2398 deviceWidth = size.width(); 2399 deviceHeight = size.height(); 2400 } 2401 2402 WebCore::ViewportConfiguration conf = WebCore::findConfigurationForViewportData(mainFrame()->d->viewportArguments(), 2403 desktopWidth, deviceWidth, deviceHeight, deviceDPI, availableSize); 2354 2404 2355 2405 result.m_isValid = true; -
trunk/WebKit/qt/ChangeLog
r68390 r68457 1 2010-09-27 Kenneth Rohde Christiansen <kenneth.christiansen@openbossa.org> 2 3 Reviewed by Antonio Gomes. 4 5 [Qt] Remove setDeviceSize methods 6 https://bugs.webkit.org/show_bug.cgi?id=46347 7 8 Remove our setDeviceHeight() API and obtain it automatically from the 9 system. Also for testing purposes, make it possible to override the 10 values via two newly introduced environment variables. 11 12 * Api/qgraphicswebview.cpp: 13 * Api/qgraphicswebview.h: 14 * Api/qwebpage.cpp: 15 (getintenv): 16 (queryDeviceSizeForScreenContainingWidget): 17 (QWebPage::viewportConfigurationForSize): 18 * WebCoreSupport/PageClientQt.cpp: 19 (WebCore::PageClientQGraphicsWidget::windowRect): 20 * symbian/eabi/QtWebKitu.def: 21 1 22 2010-09-27 Girish Ramakrishnan <girish@forwardbias.in> 2 23 -
trunk/WebKit/qt/WebCoreSupport/PageClientQt.cpp
r64965 r68457 319 319 QRectF PageClientQGraphicsWidget::windowRect() const 320 320 { 321 if (!view->deviceSize().isEmpty())322 return QRectF(QRect(QPoint(0, 0), view->deviceSize()));323 324 321 if (!view->scene()) 325 322 return QRectF(); -
trunk/WebKit/qt/symbian/eabi/QtWebKitu.def
r67549 r68457 800 800 _ZN8QWebPage23viewportChangeRequestedERKNS_13ViewportHintsE @ 799 NONAME ABSENT 801 801 _ZNK15QWebScriptWorld5worldEv @ 800 NONAME 802 _ZN16QGraphicsWebView13setDeviceSizeERK5QSize @ 801 NONAME803 802 _ZN23DumpRenderTreeSupportQt12pagePropertyEP9QWebFrameRK7QStringi @ 802 NONAME 804 803 _ZN23DumpRenderTreeSupportQt16isPageBoxVisibleEP9QWebFramei @ 803 NONAME … … 812 811 _ZN8QWebPage25requestPermissionFromUserEP9QWebFrameNS_16PermissionDomainE @ 811 NONAME 813 812 _ZN8QWebPage27cancelRequestsForPermissionEP9QWebFrameNS_16PermissionDomainE @ 812 NONAME 814 _ZNK16QGraphicsWebView10deviceSizeEv @ 813 NONAME815 813 _ZN23DumpRenderTreeSupportQt14viewportAsTextEP8QWebPageRK5QSize @ 814 NONAME 816 814 _ZN23DumpRenderTreeSupportQt32simulateDesktopNotificationClickERK7QString @ 815 NONAME
Note: See TracChangeset
for help on using the changeset viewer.