Changeset 53618 in webkit
- Timestamp:
- Jan 21, 2010 1:49:02 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ChangeLog
r53543 r53618 1 2010-01-21 No'am Rosenthal <noam.rosenthal@nokia.com> 2 3 Reviewed by Antti Koivisto. 4 5 [Qt] Implement GraphicsLayer for accelerated layer compositing 6 https://bugs.webkit.org/show_bug.cgi?id=33514 7 8 * WebKit.pri: Addded compile flags to enable accelerated compositing 9 on versions higher than 4.5 10 1 11 2010-01-20 Tor Arne Vestbø <tor.arne.vestbo@nokia.com> 2 12 -
trunk/WebCore/ChangeLog
r53617 r53618 16 16 * platform/graphics/gtk/MediaPlayerPrivateGStreamer.h: 17 17 (WebCore::MediaPlayerPrivate::pipelineReset): 18 19 2010-01-21 No'am Rosenthal <noam.rosenthal@nokia.com> 20 21 Reviewed by Antti Koivisto. 22 23 [Qt] Implement GraphicsLayer for accelerated layer compositing 24 https://bugs.webkit.org/show_bug.cgi?id=33514 25 26 No new tests: tests in LayoutTests/compositing are now relevant for 27 QtWebkit! 28 29 * WebCore.pro: added accelerated-compositing related files 30 * platform/graphics/GraphicsLayer.h: define Qt-specific implementation of GraphicsLayer 31 * platform/graphics/qt/GraphicsLayerQt.cpp: Added. 32 (WebCore::GraphicsLayerQtImpl::): Implementation of GraphicsLayer with 33 a QGraphicsItem 34 (WebCore::GraphicsLayerQtImpl::ContentData::ContentData): save 35 pixmap/color info for directly composited content 36 (WebCore::GraphicsLayerQtImpl::State::State): save info for syncing 37 (WebCore::GraphicsLayerQtImpl::GraphicsLayerQtImpl): ctor 38 (WebCore::GraphicsLayerQtImpl::~GraphicsLayerQtImpl): dtor 39 (WebCore::GraphicsLayerQtImpl::setBaseTransform): set Qt 40 transformation in the way WebCore wants it 41 (WebCore::GraphicsLayerQtImpl::opaqueArea): calculate opaque area 42 based on info we have 43 (WebCore::GraphicsLayerQtImpl::boundingRect): reimp QGraphicsItem 44 (WebCore::GraphicsLayerQtImpl::paint): reimp QGraphicsItem 45 (WebCore::GraphicsLayerQtImpl::drawContents): draw HTML/Pixmap/Color 46 (WebCore::GraphicsLayerQtImpl::notifyChange): let WebCore know 47 something has changed 48 (WebCore::GraphicsLayerQtImpl::flushChanges): Make the changes appear 49 on screen by setting them to QGraphicsItems 50 (WebCore::GraphicsLayerQtImpl::notifyAnimationStarted): let WebCore 51 know the QAnimation started 52 (WebCore::GraphicsLayerQt::GraphicsLayerQt): ctor 53 (WebCore::GraphicsLayerQt::~GraphicsLayerQt): dtor 54 (WebCore::GraphicsLayer::create): hook for WebCore to know we're 55 implementing compositing 56 (WebCore::GraphicsLayer::compositingCoordinatesOrientation): hook for 57 WebCore to know we use a top-down system 58 (WebCore::GraphicsLayerQt::setNeedsDisplay): update the display 59 (WebCore::GraphicsLayerQt::setNeedsDisplayInRect): udpate part of the 60 display 61 (WebCore::GraphicsLayerQt::setName): reimp 62 (WebCore::GraphicsLayerQt::setParent): reimp 63 (WebCore::GraphicsLayerQt::setChildren): reimp 64 (WebCore::GraphicsLayerQt::addChild): reimp 65 (WebCore::GraphicsLayerQt::addChildAtIndex): reimp 66 (WebCore::GraphicsLayerQt::addChildAbove): reimp 67 (WebCore::GraphicsLayerQt::addChildBelow): reimp 68 (WebCore::GraphicsLayerQt::replaceChild): reimp 69 (WebCore::GraphicsLayerQt::removeFromParent): reimp 70 (WebCore::GraphicsLayerQt::setMaskLayer): reimp 71 (WebCore::GraphicsLayerQt::setPosition): reimp 72 (WebCore::GraphicsLayerQt::setAnchorPoint): reimp 73 (WebCore::GraphicsLayerQt::setSize): reimp 74 (WebCore::GraphicsLayerQt::setTransform): reimp 75 (WebCore::GraphicsLayerQt::setChildrenTransform): reimp 76 (WebCore::GraphicsLayerQt::setPreserves3D): reimp 77 (WebCore::GraphicsLayerQt::setMasksToBounds): reimp 78 (WebCore::GraphicsLayerQt::setDrawsContent): reimp 79 (WebCore::GraphicsLayerQt::setBackgroundColor): reimp 80 (WebCore::GraphicsLayerQt::clearBackgroundColor): reimp 81 (WebCore::GraphicsLayerQt::setContentsOpaque): reimp 82 (WebCore::GraphicsLayerQt::setBackfaceVisibility): reimp 83 (WebCore::GraphicsLayerQt::setOpacity): reimp 84 (WebCore::GraphicsLayerQt::setContentsRect): reimp 85 (WebCore::GraphicsLayerQt::setContentsToImage): reimp 86 (WebCore::GraphicsLayerQt::setContentsBackgroundColor): reimp 87 (WebCore::GraphicsLayerQt::setGeometryOrientation): reimp 88 (WebCore::GraphicsLayerQt::setContentsOrientation): reimp 89 (WebCore::GraphicsLayerQt::distributeOpacity): reimp 90 (WebCore::GraphicsLayerQt::accumulatedOpacity): reimp 91 (WebCore::GraphicsLayerQt::syncCompositingState): reimp 92 (WebCore::GraphicsLayerQt::nativeLayer): reimp (QGraphicsItem*) 93 (WebCore::GraphicsLayerQt::platformLayer): reimp (QGraphicsItem*) 94 (WebCore::solveEpsilon): copy from AnimationBase.cpp 95 (WebCore::solveCubicBezierFunction): copy from AniamtionBase.cpp 96 (WebCore::applyTimingFunction): use WebCore's timing and not Qt's 97 (WebCore::webkitAnimationToQtAnimationValue): safely figure out 98 animation values 99 (WebCore::AnimationQtBase::AnimationQtBase): base class for Qt-based 100 Webcore-initiated animations 101 (WebCore::AnimationQtBase::updateState): notify when an animation 102 starts 103 (WebCore::AnimationQtBase::duration): reimp QAbstractAnimation 104 (WebCore::AnimationQt:::AnimationQtBase): 105 (WebCore::AnimationQt::updateCurrentTime): realize keyframes from 106 progress 107 (WebCore::TransformAnimationQt::TransformAnimationQt): ctor 108 (WebCore::TransformAnimationQt::~TransformAnimationQt): dtor 109 (WebCore::TransformAnimationQt::applyFrame): set the actual QTransform 110 based on WebCore TransformOperations 111 (WebCore::TransformAnimationQt::updateState): change cache mode 112 (WebCore::OpacityAnimationQt::OpacityAnimationQt): 113 (WebCore::OpacityAnimationQt::applyFrame): change item's opacity 114 (WebCore::OpacityAnimationQt::updateState): 115 (WebCore::GraphicsLayerQt::addAnimation): convert WebCore Animation to 116 Qt Animation 117 (WebCore::GraphicsLayerQt::removeAnimationsForProperty): 118 (WebCore::GraphicsLayerQt::removeAnimationsForKeyframes): 119 (WebCore::GraphicsLayerQt::pauseAnimation): 120 (WebCore::GraphicsLayerQt::suspendAnimations): 121 (WebCore::GraphicsLayerQt::resumeAnimations): 122 * platform/graphics/qt/GraphicsLayerQt.h: Added. 123 * platform/qt/QWebPageClient.h: virtual functions for QGraphicsWebView 124 compositing 125 (QWebPageClient::setRootGraphicsLayer): let QGraphicsWebView know that 126 compositing has started/ended 127 (QWebPageClient::markForSync): let QGraphicsWebView know the 128 compositing layers need to sync, either soon or with the next update 18 129 19 130 2010-01-21 No'am Rosenthal <noam.rosenthal@nokia.com> -
trunk/WebCore/WebCore.pro
r53611 r53618 2723 2723 } 2724 2724 } 2725 contains(DEFINES, WTF_USE_ACCELERATED_COMPOSITING) { 2726 HEADERS += \ 2727 rendering/RenderLayerBacking.h \ 2728 rendering/RenderLayerCompositor.h \ 2729 platform/graphics/GraphicsLayer.h \ 2730 platform/graphics/GraphicsLayerClient.h \ 2731 platform/graphics/qt/GraphicsLayerQt.h 2732 SOURCES += \ 2733 platform/graphics/GraphicsLayer.cpp \ 2734 platform/graphics/qt/GraphicsLayerQt.cpp \ 2735 rendering/RenderLayerBacking.cpp \ 2736 rendering/RenderLayerCompositor.cpp 2737 } 2725 2738 2726 2739 symbian { -
trunk/WebCore/platform/graphics/GraphicsLayer.h
r53510 r53618 60 60 typedef void* NativeLayer; 61 61 } 62 #elif PLATFORM(QT) 63 class QGraphicsItem; 64 typedef QGraphicsItem PlatformLayer; 65 typedef QGraphicsItem* NativeLayer; 62 66 #else 63 67 typedef void* PlatformLayer; -
trunk/WebCore/platform/qt/QWebPageClient.h
r51171 r53618 30 30 #include <QCursor> 31 31 #endif 32 32 33 #include <QRect> 34 class QGraphicsItem; 33 35 34 36 class QWebPageClient { … … 40 42 virtual void setInputMethodEnabled(bool enable) = 0; 41 43 virtual bool inputMethodEnabled() const = 0; 44 #if USE(ACCELERATED_COMPOSITING) 45 // this gets called when we start/stop compositing. 46 virtual void setRootGraphicsLayer(QGraphicsItem* layer) {} 47 48 // this gets called when the compositor wants us to sync the layers 49 // if scheduleSync is true, we schedule a sync ourselves. otherwise, 50 // we wait for the next update and sync the layers then. 51 virtual void markForSync(bool scheduleSync = false) {} 52 #endif 53 42 54 #if QT_VERSION >= 0x040600 43 55 virtual void setInputMethodHint(Qt::InputMethodHint hint, bool enable) = 0; -
trunk/WebKit.pri
r53319 r53618 46 46 DEPENDPATH += $$PWD/WebKit/qt/Api 47 47 } 48 greaterThan(QT_MINOR_VERSION, 5):DEFINES += WTF_USE_ACCELERATED_COMPOSITING 48 49 49 50 !mac:!unix|symbian { -
trunk/WebKit/qt/Api/qgraphicswebview.cpp
r52552 r53618 23 23 24 24 #include "qwebframe.h" 25 #include "qwebframe_p.h" 25 26 #include "qwebpage.h" 26 27 #include "qwebpage_p.h" 27 28 #include "QWebPageClient.h" 28 #include <QtGui/QGraphicsScene> 29 #include <QtGui/QGraphicsView> 29 #include <FrameView.h> 30 #include <QtCore/qsharedpointer.h> 31 #include <QtCore/qtimer.h> 30 32 #include <QtGui/qapplication.h> 33 #include <QtGui/qgraphicsscene.h> 31 34 #include <QtGui/qgraphicssceneevent.h> 35 #include <QtGui/qgraphicsview.h> 36 #include <QtGui/qpixmapcache.h> 32 37 #include <QtGui/qstyleoption.h> 33 38 #if defined(Q_WS_X11) 34 39 #include <QX11Info> 40 #endif 41 #include <Settings.h> 42 43 #if USE(ACCELERATED_COMPOSITING) 44 45 // the overlay is here for one reason only: to have the scroll-bars and other 46 // extra UI elements appear on top of any QGraphicsItems created by CSS compositing layers 47 class QGraphicsWebViewOverlay : public QGraphicsItem { 48 public: 49 QGraphicsWebViewOverlay(QGraphicsWebView* view) 50 :QGraphicsItem(view) 51 , q(view) 52 { 53 setPos(0, 0); 54 setFlag(QGraphicsItem::ItemUsesExtendedStyleOption, true); 55 setCacheMode(QGraphicsItem::DeviceCoordinateCache); 56 } 57 58 QRectF boundingRect() const 59 { 60 return q->boundingRect(); 61 } 62 63 void paint(QPainter* painter, const QStyleOptionGraphicsItem* options, QWidget*) 64 { 65 q->page()->mainFrame()->render(painter, static_cast<QWebFrame::RenderLayer>(QWebFrame::AllLayers&(~QWebFrame::ContentsLayer)), options->exposedRect.toRect()); 66 } 67 68 friend class QGraphicsWebView; 69 QGraphicsWebView* q; 70 }; 71 35 72 #endif 36 73 … … 40 77 : q(parent) 41 78 , page(0) 42 {} 79 #if USE(ACCELERATED_COMPOSITING) 80 , rootGraphicsLayer(0) 81 , shouldSync(true) 82 #endif 83 { 84 #if USE(ACCELERATED_COMPOSITING) 85 // the overlay and stays alive for the lifetime of 86 // this QGraphicsWebView as the scrollbars are needed when there's no compositing 87 q->setFlag(QGraphicsItem::ItemUsesExtendedStyleOption); 88 #endif 89 } 43 90 44 91 virtual ~QGraphicsWebViewPrivate(); … … 62 109 virtual QObject* pluginParent() const; 63 110 111 #if USE(ACCELERATED_COMPOSITING) 112 virtual void setRootGraphicsLayer(QGraphicsItem* layer); 113 virtual void markForSync(bool scheduleSync); 114 void updateCompositingScrollPosition(); 115 #endif 116 117 void syncLayers(); 64 118 void _q_doLoadFinished(bool success); 65 119 66 120 QGraphicsWebView* q; 67 121 QWebPage* page; 122 #if USE(ACCELERATED_COMPOSITING) 123 QGraphicsItem* rootGraphicsLayer; 124 125 // the overlay gets instantiated when the root layer is attached, and get deleted when it's detached 126 QSharedPointer<QGraphicsWebViewOverlay> overlay; 127 128 // we need to sync the layers if we get a special call from the WebCore 129 // compositor telling us to do so. We'll get that call from ChromeClientQt 130 bool shouldSync; 131 132 // we need to put the root graphics layer behind the overlay (which contains the scrollbar) 133 enum { RootGraphicsLayerZValue, OverlayZValue }; 134 #endif 68 135 }; 69 136 70 137 QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate() 71 138 { 139 #if USE(ACCELERATED_COMPOSITING) 140 if (rootGraphicsLayer) { 141 // we don't need to delete the root graphics layer 142 // The lifecycle is managed in GraphicsLayerQt.cpp 143 rootGraphicsLayer->setParentItem(0); 144 q->scene()->removeItem(rootGraphicsLayer); 145 } 146 #endif 147 } 148 149 #if USE(ACCELERATED_COMPOSITING) 150 void QGraphicsWebViewPrivate::setRootGraphicsLayer(QGraphicsItem* layer) 151 { 152 if (rootGraphicsLayer) { 153 rootGraphicsLayer->setParentItem(0); 154 q->scene()->removeItem(rootGraphicsLayer); 155 QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive(); 156 } 157 158 rootGraphicsLayer = layer; 159 160 if (layer) { 161 layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); 162 layer->setParentItem(q); 163 layer->setZValue(RootGraphicsLayerZValue); 164 if (!overlay) { 165 overlay = QSharedPointer<QGraphicsWebViewOverlay>(new QGraphicsWebViewOverlay(q)); 166 overlay->setZValue(OverlayZValue); 167 } 168 updateCompositingScrollPosition(); 169 } else { 170 // we don't have compositing layers, we can render the scrollbars and content in one go 171 overlay.clear(); 172 } 173 } 174 175 void QGraphicsWebViewPrivate::markForSync(bool scheduleSync) 176 { 177 shouldSync = true; 178 if (scheduleSync) 179 QTimer::singleShot(0, q, SLOT(syncLayers())); 180 } 181 182 void QGraphicsWebViewPrivate::updateCompositingScrollPosition() 183 { 184 if (rootGraphicsLayer && q->page() && q->page()->mainFrame()) { 185 const QPoint scrollPosition = q->page()->mainFrame()->scrollPosition(); 186 rootGraphicsLayer->setPos(-scrollPosition); 187 } 188 } 189 190 #endif 191 192 void QGraphicsWebViewPrivate::syncLayers() 193 { 194 #if USE(ACCELERATED_COMPOSITING) 195 if (shouldSync) { 196 QWebFramePrivate::core(q->page()->mainFrame())->view()->syncCompositingStateRecursive(); 197 shouldSync = false; 198 } 199 #endif 72 200 } 73 201 … … 84 212 { 85 213 q->scroll(qreal(dx), qreal(dy), QRectF(rectToScroll)); 214 #if USE(ACCELERATED_COMPOSITING) 215 updateCompositingScrollPosition(); 216 #endif 86 217 } 87 218 … … 89 220 { 90 221 q->update(QRectF(dirtyRect)); 222 #if USE(ACCELERATED_COMPOSITING) 223 if (overlay) 224 overlay->update(QRectF(dirtyRect)); 225 #endif 91 226 } 92 227 … … 249 384 #endif 250 385 setFocusPolicy(Qt::StrongFocus); 386 setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); 251 387 } 252 388 … … 298 434 void QGraphicsWebView::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget*) 299 435 { 300 page()->mainFrame()->render(painter, option->exposedRect.toRect()); 436 #if USE(ACCELERATED_COMPOSITING) 437 page()->mainFrame()->render(painter, d->overlay ? QWebFrame::ContentsLayer : QWebFrame::AllLayers, option->exposedRect.toAlignedRect()); 438 d->syncLayers(); 439 #else 440 page()->mainFrame()->render(painter, QWebFrame::AllLayers, option->exposedRect.toRect()); 441 #endif 301 442 } 302 443 … … 426 567 if (!d->page) 427 568 return; 569 #if USE(ACCELERATED_COMPOSITING) 570 if (d->overlay) 571 d->overlay->prepareGeometryChange(); 572 #endif 428 573 d->page->d->client = d; // set the page client 429 574 … … 529 674 void QGraphicsWebView::updateGeometry() 530 675 { 676 677 #if USE(ACCELERATED_COMPOSITING) 678 if (d->overlay) 679 d->overlay->prepareGeometryChange(); 680 #endif 681 531 682 QGraphicsWidget::updateGeometry(); 532 683 … … 543 694 { 544 695 QGraphicsWidget::setGeometry(rect); 696 697 #if USE(ACCELERATED_COMPOSITING) 698 if (d->overlay) 699 d->overlay->prepareGeometryChange(); 700 #endif 545 701 546 702 if (!d->page) -
trunk/WebKit/qt/Api/qgraphicswebview.h
r50652 r53618 135 135 private: 136 136 Q_PRIVATE_SLOT(d, void _q_doLoadFinished(bool success)) 137 // we don't want to change the moc based on USE() macro, so this function is here 138 // but will be empty if ACCLERATED_COMPOSITING is disabled 139 Q_PRIVATE_SLOT(d, void syncLayers()) 137 140 138 141 QGraphicsWebViewPrivate* const d; -
trunk/WebKit/qt/Api/qwebsettings.cpp
r53060 r53618 153 153 global->attributes.value(QWebSettings::JavascriptEnabled)); 154 154 settings->setJavaScriptEnabled(value); 155 155 #if USE(ACCELERATED_COMPOSITING) 156 value = attributes.value(QWebSettings::AcceleratedCompositingEnabled, 157 global->attributes.value(QWebSettings::AcceleratedCompositingEnabled)); 158 159 settings->setAcceleratedCompositingEnabled(value); 160 #endif 156 161 value = attributes.value(QWebSettings::JavascriptCanOpenWindows, 157 162 global->attributes.value(QWebSettings::JavascriptCanOpenWindows)); … … 390 395 d->attributes.insert(QWebSettings::LocalStorageEnabled, false); 391 396 d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false); 397 d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, false); 392 398 d->offlineStorageDefaultQuota = 5 * 1024 * 1024; 393 399 d->defaultTextEncoding = QLatin1String("iso-8859-1"); -
trunk/WebKit/qt/Api/qwebsettings.h
r53060 r53618 69 69 LocalContentCanAccessRemoteUrls, 70 70 DnsPrefetchEnabled, 71 XSSAuditorEnabled 71 XSSAuditorEnabled, 72 AcceleratedCompositingEnabled 72 73 }; 73 74 enum WebGraphic { -
trunk/WebKit/qt/Api/qwebview.cpp
r52256 r53618 23 23 #include "qwebview.h" 24 24 25 #include "Page.h" 25 26 #include "QWebPageClient.h" 27 #include "Settings.h" 26 28 #include "qwebframe.h" 27 29 #include "qwebpage_p.h" 28 29 30 #include "qbitmap.h" 30 31 #include "qevent.h" … … 248 249 } 249 250 setAttribute(Qt::WA_OpaquePaintEvent, d->page); 251 #if USE(ACCELERATED_COMPOSITING) 252 d->page->d->page->settings()->setAcceleratedCompositingEnabled(false); 253 #endif 250 254 update(); 251 255 } -
trunk/WebKit/qt/ChangeLog
r53614 r53618 1 2010-01-21 No'am Rosenthal <noam.rosenthal@nokia.com> 2 3 Reviewed by Antti Koivisto. 4 5 [Qt] Implement GraphicsLayer for accelerated layer compositing 6 https://bugs.webkit.org/show_bug.cgi?id=33514 7 8 Here we have the QGraphicsWebView support for accelerated compositing 9 10 * Api/qgraphicswebview.cpp: 11 (QGraphicsWebViewOverlay::q): access to container object 12 (QGraphicsWebViewOverlay::boundingRect): overlay has same rect as the 13 webview 14 (QGraphicsWebViewOverlay::paint): paint everything but the contents 15 (QGraphicsWebViewPrivate::QGraphicsWebViewPrivate): some vars needed 16 for accelerated compositing 17 (QGraphicsWebViewPrivate::): 18 (QGraphicsWebViewPrivate::~QGraphicsWebViewPrivate): 19 (QGraphicsWebViewPrivate::setRootGraphicsLayer): make sure we have a 20 scrollbar overlay, and that the new graphics layer is parented by the 21 web-view 22 (QGraphicsWebViewPrivate::markForSync): flush changes at earliest 23 convenience or during the next draw 24 25 (QGraphicsWebViewPrivate::updateCompositingScrollPosition): sync the 26 position of the compositing layer with the scroll position 27 (QGraphicsWebViewPrivate::syncLayers): flush changes now 28 (QGraphicsWebViewPrivate::scroll): make sure we also move the 29 compositing layer 30 (QGraphicsWebViewPrivate::update): also update the overlay if needed 31 (QGraphicsWebView::QGraphicsWebView): initialize overlay with 0 32 (QGraphicsWebView::paint): paint only contents if we have an overlay, 33 sync the compositing layers now if needed 34 (QGraphicsWebView::setPage): also clean up the compositing 35 (QGraphicsWebView::updateGeometry): also update overlay geo 36 (QGraphicsWebView::setGeometry): also update overlay geo 37 * Api/qgraphicswebview.h: reimp compositing stuff from QWebPageClient 38 * Api/qwebsettings.cpp: init new settings flag for compositing as 39 false 40 (QWebSettingsPrivate::apply): apply new settings flag for compositing 41 (QWebSettings::QWebSettings): 42 * Api/qwebsettings.h: new settings flag for compositing 43 * Api/qwebview.cpp: 44 (QWebView::setPage): qwebview doesn't support compositing: always false 45 * QGVLauncher/main.cpp: 46 (WebView::WebView): some more cmdline arguments + compositing 47 (MainWindow::init): some more cmdline arguments 48 (main): ditto 49 * WebCoreSupport/ChromeClientQt.cpp: 50 (WebCore::ChromeClientQt::attachRootGraphicsLayer): reimp for 51 accel-compositing 52 (WebCore::ChromeClientQt::setNeedsOneShotDrawingSynchronization): 53 reimp for accel compositing 54 (WebCore::ChromeClientQt::scheduleCompositingLayerSync): reimp for 55 accel compositing 56 * WebCoreSupport/ChromeClientQt.h: reimps for accel compositing 57 1 58 2010-01-21 Benjamin Poulain <benjamin.poulain@nokia.com> 2 59 -
trunk/WebKit/qt/QGVLauncher/main.cpp
r52713 r53618 73 73 : QGraphicsWebView(parent) 74 74 { 75 if (QApplication::instance()->arguments().contains("--cacheWebView")) 76 setCacheMode(QGraphicsItem::DeviceCoordinateCache); 75 77 } 76 78 void setYRotation(qreal angle) … … 254 256 255 257 view->setScene(scene->scene()); 258 const QStringList arguments = QApplication::instance()->arguments(); 259 const int indexOfViewportUpdateMode = arguments.indexOf("--updateMode"); 260 if (indexOfViewportUpdateMode > 1 && indexOfViewportUpdateMode < arguments.count() - 1) { 261 const QString updateMode = arguments[indexOfViewportUpdateMode+1] + "ViewportUpdate"; 262 view->setViewportUpdateMode(static_cast<QGraphicsView::ViewportUpdateMode>(QGraphicsView::staticMetaObject.enumerator(QGraphicsView::staticMetaObject.indexOfEnumerator("ViewportUpdateMode")).keysToValue(updateMode.toAscii()))); 263 } 256 264 257 265 setCentralWidget(view); … … 448 456 { 449 457 QApplication app(argc, argv); 458 if (app.arguments().contains("--help")) { 459 qDebug() << "Usage: QGVLauncher [--url url] [--compositing] [--updateMode Full|Minimal|Smart|No|BoundingRect] [--cacheWebView]\n"; 460 return 0; 461 } 450 462 QString url = QString("file://%1/%2").arg(QDir::homePath()).arg(QLatin1String("index.html")); 451 463 … … 459 471 460 472 const QStringList args = app.arguments(); 461 if (args.count() > 1) 473 const int indexOfUrl = args.indexOf("--url"); 474 if (indexOfUrl > 0 && indexOfUrl < args.count() - 1) 475 url = args.at(indexOfUrl+1); 476 else if (args.count() > 1) 462 477 url = args.at(1); 478 if (args.contains("--compositing")) 479 QWebSettings::globalSettings()->setAttribute(QWebSettings::AcceleratedCompositingEnabled, true); 463 480 464 481 MainWindow* window = new MainWindow; 465 482 window->load(url); 466 483 467 for (int i = 2; i < args.count(); i++) 468 window->newWindow(args.at(i)); 484 for (int i = 2; i < args.count(); ++i) 485 if (!args.at(i).startsWith("-") && !args.at(i - 1).startsWith("-")) 486 window->newWindow(args.at(i)); 469 487 470 488 window->show(); -
trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp
r53610 r53618 26 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 27 */ 28 28 29 #include "config.h" 29 30 #include "ChromeClientQt.h" … … 43 44 #include "SecurityOrigin.h" 44 45 46 #include <qdebug.h> 47 #include <qtextdocument.h> 48 #include <qtooltip.h> 49 45 50 #include "qwebpage.h" 46 51 #include "qwebpage_p.h" … … 50 55 #include "qwebview.h" 51 56 52 #include <qtooltip.h> 53 #include <qtextdocument.h> 54 55 namespace WebCore 56 { 57 57 #if USE(ACCELERATED_COMPOSITING) 58 #include "GraphicsLayerQt.h" 59 #endif 60 61 namespace WebCore { 58 62 59 63 ChromeClientQt::ChromeClientQt(QWebPage* webPage) … … 467 471 } 468 472 473 #if USE(ACCELERATED_COMPOSITING) 474 void ChromeClientQt::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) 475 { 476 if (platformPageClient()) 477 platformPageClient()->setRootGraphicsLayer(graphicsLayer ? graphicsLayer->nativeLayer() : 0); 478 } 479 480 void ChromeClientQt::setNeedsOneShotDrawingSynchronization() 481 { 482 // we want the layers to synchronize next time we update the screen anyway 483 if (platformPageClient()) 484 platformPageClient()->markForSync(false); 485 } 486 487 void ChromeClientQt::scheduleCompositingLayerSync() 488 { 489 // we want the layers to synchronize ASAP 490 if (platformPageClient()) 491 platformPageClient()->markForSync(true); 492 } 493 #endif 494 469 495 QtAbstractWebPopup* ChromeClientQt::createSelectPopup() 470 496 { -
trunk/WebKit/qt/WebCoreSupport/ChromeClientQt.h
r53610 r53618 124 124 virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); 125 125 #endif 126 127 #if USE(ACCELERATED_COMPOSITING) 128 // see ChromeClient.h 129 // this is a hook for WebCore to tell us what we need to do with the GraphicsLayers 130 virtual void attachRootGraphicsLayer(Frame*, GraphicsLayer*); 131 virtual void setNeedsOneShotDrawingSynchronization(); 132 virtual void scheduleCompositingLayerSync(); 133 #endif 134 126 135 virtual void runOpenPanel(Frame*, PassRefPtr<FileChooser>); 127 136
Note: See TracChangeset
for help on using the changeset viewer.