diff options
Diffstat (limited to 'WebKit/qt')
-rw-r--r-- | WebKit/qt/Api/qwebelement.cpp | 5 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe.h | 2 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebframe_p.h | 7 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebhistory.cpp | 4 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebhistory_p.h | 6 | ||||
-rw-r--r-- | WebKit/qt/Api/qwebpage.cpp | 148 | ||||
-rw-r--r-- | WebKit/qt/ChangeLog | 293 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/ChromeClientQt.cpp | 7 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/ChromeClientQt.h | 2 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp | 5 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h | 1 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp | 27 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h | 6 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/PageClientQt.cpp | 144 | ||||
-rw-r--r-- | WebKit/qt/WebCoreSupport/PageClientQt.h | 45 | ||||
-rw-r--r-- | WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp | 46 | ||||
-rw-r--r-- | WebKit/qt/tests/qwebelement/tst_qwebelement.cpp | 6 | ||||
-rw-r--r-- | WebKit/qt/tests/qwebframe/tst_qwebframe.cpp | 13 | ||||
-rw-r--r-- | WebKit/qt/tests/qwebpage/tst_qwebpage.cpp | 35 |
19 files changed, 671 insertions, 131 deletions
diff --git a/WebKit/qt/Api/qwebelement.cpp b/WebKit/qt/Api/qwebelement.cpp index 261631c..68fa17a 100644 --- a/WebKit/qt/Api/qwebelement.cpp +++ b/WebKit/qt/Api/qwebelement.cpp @@ -26,6 +26,7 @@ #include "CSSRule.h" #include "CSSRuleList.h" #include "CSSStyleRule.h" +#include "CSSStyleSelector.h" #include "Document.h" #include "DocumentFragment.h" #include "FrameView.h" @@ -852,8 +853,8 @@ QString QWebElement::styleProperty(const QString &name, StyleResolveStrategy str // by importance and inheritance order. This include external CSS // declarations, as well as embedded and inline style declarations. - DOMWindow* domWindow = m_element->document()->frame()->domWindow(); - if (RefPtr<CSSRuleList> rules = domWindow->getMatchedCSSRules(m_element, "")) { + Document* doc = m_element->document(); + if (RefPtr<CSSRuleList> rules = doc->styleSelector()->styleRulesForElement(m_element, /*authorOnly*/ true)) { for (int i = rules->length(); i > 0; --i) { CSSStyleRule* rule = static_cast<CSSStyleRule*>(rules->item(i - 1)); diff --git a/WebKit/qt/Api/qwebframe.h b/WebKit/qt/Api/qwebframe.h index e78fb07..a598a56 100644 --- a/WebKit/qt/Api/qwebframe.h +++ b/WebKit/qt/Api/qwebframe.h @@ -56,6 +56,7 @@ namespace WebCore { class WidgetPrivate; class FrameLoaderClientQt; class ChromeClientQt; + class PlatformLayerProxyQt; } class QWebFrameData; class QWebHitTestResultPrivate; @@ -231,6 +232,7 @@ private: friend class WebCore::WidgetPrivate; friend class WebCore::FrameLoaderClientQt; friend class WebCore::ChromeClientQt; + friend class WebCore::PlatformLayerProxyQt; QWebFramePrivate *d; }; diff --git a/WebKit/qt/Api/qwebframe_p.h b/WebKit/qt/Api/qwebframe_p.h index 79187ab..5660bd1 100644 --- a/WebKit/qt/Api/qwebframe_p.h +++ b/WebKit/qt/Api/qwebframe_p.h @@ -38,6 +38,7 @@ namespace WebCore { class FrameView; class HTMLFrameOwnerElement; class Scrollbar; + class TextureMapperContentLayer; } class QWebPage; @@ -72,6 +73,9 @@ public: , allowsScrolling(true) , marginWidth(-1) , marginHeight(-1) +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + , rootGraphicsLayer(0) +#endif , zoomTextOnly(false) {} void init(QWebFrame* qframe, QWebFrameData* frameData); @@ -100,6 +104,9 @@ public: bool allowsScrolling; int marginWidth; int marginHeight; +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + WebCore::TextureMapperContentLayer* rootGraphicsLayer; +#endif bool zoomTextOnly; }; diff --git a/WebKit/qt/Api/qwebhistory.cpp b/WebKit/qt/Api/qwebhistory.cpp index 25d77a4..a9761de 100644 --- a/WebKit/qt/Api/qwebhistory.cpp +++ b/WebKit/qt/Api/qwebhistory.cpp @@ -256,8 +256,8 @@ QWebHistory::~QWebHistory() */ void QWebHistory::clear() { - //shortcut to private BackForwardList - WebCore::BackForwardList* lst = d->lst; + //shortcut to private BackForwardListImpl + WebCore::BackForwardListImpl* lst = d->lst; //clear visited links WebCore::Page* page = static_cast<WebCore::BackForwardListImpl*>(lst)->page(); diff --git a/WebKit/qt/Api/qwebhistory_p.h b/WebKit/qt/Api/qwebhistory_p.h index 1df2349..44793b9 100644 --- a/WebKit/qt/Api/qwebhistory_p.h +++ b/WebKit/qt/Api/qwebhistory_p.h @@ -20,7 +20,7 @@ #ifndef QWEBHISTORY_P_H #define QWEBHISTORY_P_H -#include "BackForwardList.h" +#include "BackForwardListImpl.h" #include "HistoryItem.h" #include <QtCore/qglobal.h> #include <QtCore/qshareddata.h> @@ -52,7 +52,7 @@ public: class QWebHistoryPrivate : public QSharedData { public: - QWebHistoryPrivate(WebCore::BackForwardList* l) + QWebHistoryPrivate(WebCore::BackForwardListImpl* l) { l->ref(); lst = l; @@ -64,7 +64,7 @@ public: QWebPagePrivate* page(); - WebCore::BackForwardList* lst; + WebCore::BackForwardListImpl* lst; }; diff --git a/WebKit/qt/Api/qwebpage.cpp b/WebKit/qt/Api/qwebpage.cpp index 454376c..40f41c5 100644 --- a/WebKit/qt/Api/qwebpage.cpp +++ b/WebKit/qt/Api/qwebpage.cpp @@ -33,69 +33,71 @@ #include "qwebsettings.h" #include "qwebkitversion.h" -#include "Chrome.h" -#include "ContextMenuController.h" -#include "Frame.h" -#include "FrameTree.h" -#include "FrameLoader.h" -#include "FrameLoaderClientQt.h" -#include "FrameView.h" -#include "FormState.h" #include "ApplicationCacheStorage.h" +#include "BackForwardListImpl.h" +#include "Cache.h" +#include "Chrome.h" #include "ChromeClientQt.h" #include "ContextMenu.h" #include "ContextMenuClientQt.h" +#include "ContextMenuController.h" #include "DeviceMotionClientQt.h" #include "DeviceOrientationClientQt.h" #include "DocumentLoader.h" #include "DragClientQt.h" #include "DragController.h" #include "DragData.h" +#include "Editor.h" #include "EditorClientQt.h" -#include "SchemeRegistry.h" -#include "SecurityOrigin.h" -#include "Settings.h" -#include "Page.h" -#include "Pasteboard.h" -#include "FrameLoader.h" +#include "FocusController.h" +#include "FormState.h" +#include "Frame.h" #include "FrameLoadRequest.h" -#include "KURL.h" -#include "Logging.h" +#include "FrameLoader.h" +#include "FrameLoader.h" +#include "FrameLoaderClientQt.h" +#include "FrameTree.h" +#include "FrameView.h" +#include "GeolocationPermissionClientQt.h" +#include "HTMLFormElement.h" +#include "HTMLInputElement.h" +#include "HTMLNames.h" +#include "HashMap.h" +#include "HitTestResult.h" #include "Image.h" #include "InspectorClientQt.h" #include "InspectorController.h" -#include "FocusController.h" -#include "Editor.h" -#include "Scrollbar.h" +#include "InspectorServerQt.h" +#include "KURL.h" +#include "LocalizedStrings.h" +#include "Logging.h" +#include "MIMETypeRegistry.h" +#include "NavigationAction.h" #include "NetworkingContext.h" +#include "NotificationPresenterClientQt.h" +#include "Page.h" +#include "PageClientQt.h" +#include "PageGroup.h" +#include "Pasteboard.h" #include "PlatformKeyboardEvent.h" +#include "PlatformTouchEvent.h" #include "PlatformWheelEvent.h" #include "PluginDatabase.h" +#include "PluginDatabase.h" +#include "PluginPackage.h" #include "ProgressTracker.h" #include "RefPtr.h" #include "RenderTextControl.h" +#include "SchemeRegistry.h" +#include "Scrollbar.h" +#include "SecurityOrigin.h" +#include "Settings.h" #include "TextIterator.h" -#include "HashMap.h" -#include "HTMLFormElement.h" -#include "HTMLInputElement.h" -#include "HTMLNames.h" -#include "HitTestResult.h" -#include "InspectorServerQt.h" -#include "WindowFeatures.h" #include "WebPlatformStrategies.h" -#include "LocalizedStrings.h" -#include "Cache.h" -#include "runtime/InitializeThreading.h" -#include "PageGroup.h" -#include "GeolocationPermissionClientQt.h" -#include "NotificationPresenterClientQt.h" -#include "PageClientQt.h" -#include "PlatformTouchEvent.h" +#include "WindowFeatures.h" #include "WorkerThread.h" +#include "runtime/InitializeThreading.h" #include "wtf/Threading.h" -#include "MIMETypeRegistry.h" -#include "PluginDatabase.h" -#include "PluginPackage.h" #include <QApplication> #include <QBasicTimer> @@ -311,7 +313,7 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) settings = new QWebSettings(page->settings()); - history.d = new QWebHistoryPrivate(page->backForwardList()); + history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList())); memset(actions, 0, sizeof(actions)); PageGroup::setShouldTrackVisitedLinks(true); @@ -323,6 +325,11 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) QWebPagePrivate::~QWebPagePrivate() { + if (inspector && inspectorIsInternalOnly) { + // Since we have to delete an internal inspector, + // call setInspector(0) directly to prevent potential crashes + setInspector(0); + } #ifndef QT_NO_CONTEXTMENU delete currentContextMenu; #endif @@ -332,6 +339,9 @@ QWebPagePrivate::~QWebPagePrivate() delete settings; delete page; + if (inspector) + inspector->setPage(0); + #if ENABLE(NOTIFICATIONS) NotificationPresenterClientQt::notificationPresenter()->removeClient(); #endif @@ -1008,7 +1018,6 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) { WebCore::Frame *frame = page->focusController()->focusedOrMainFrame(); WebCore::Editor *editor = frame->editor(); - QInputMethodEvent::Attribute selection(QInputMethodEvent::Selection, 0, 0, QVariant()); if (!editor->canEdit()) { ev->ignore(); @@ -1016,14 +1025,9 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) } RenderObject* renderer = 0; - RenderTextControl* renderTextControl = 0; - if (frame->selection()->rootEditableElement()) renderer = frame->selection()->rootEditableElement()->shadowAncestorNode()->renderer(); - if (renderer && renderer->isTextControl()) - renderTextControl = toRenderTextControl(renderer); - Vector<CompositionUnderline> underlines; bool hasSelection = false; @@ -1048,8 +1052,21 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) break; } case QInputMethodEvent::Selection: { - selection = a; hasSelection = true; + // A selection in the inputMethodEvent is always reflected in the visible text + if (renderer && renderer->node()) + setSelectionRange(renderer->node(), qMin(a.start, (a.start + a.length)), qMax(a.start, (a.start + a.length))); + + if (!ev->preeditString().isEmpty()) { + editor->setComposition(ev->preeditString(), underlines, + (a.length < 0) ? a.start + a.length : a.start, + (a.length < 0) ? a.start : a.start + a.length); + } else { + // If we are in the middle of a composition, an empty pre-edit string and a selection of zero + // cancels the current composition + if (editor->hasComposition() && (a.start + a.length == 0)) + editor->setComposition(QString(), underlines, 0, 0); + } break; } } @@ -1057,22 +1074,8 @@ void QWebPagePrivate::inputMethodEvent(QInputMethodEvent *ev) if (!ev->commitString().isEmpty()) editor->confirmComposition(ev->commitString()); - else { - // 1. empty preedit with a selection attribute, and start/end of 0 cancels composition - // 2. empty preedit with a selection attribute, and start/end of non-0 updates selection of current preedit text - // 3. populated preedit with a selection attribute, and start/end of 0 or non-0 updates selection of supplied preedit text - // 4. otherwise event is updating supplied pre-edit text - QString preedit = ev->preeditString(); - if (hasSelection) { - QString text = (renderTextControl) ? QString(renderTextControl->text()) : QString(); - if (preedit.isEmpty() && selection.start + selection.length > 0) - preedit = text; - editor->setComposition(preedit, underlines, - (selection.length < 0) ? selection.start + selection.length : selection.start, - (selection.length < 0) ? selection.start : selection.start + selection.length); - } else if (!preedit.isEmpty()) - editor->setComposition(preedit, underlines, preedit.length(), 0); - } + else if (!hasSelection && !ev->preeditString().isEmpty()) + editor->setComposition(ev->preeditString(), underlines, 0, ev->preeditString().length()); ev->accept(); } @@ -1329,9 +1332,8 @@ QVariant QWebPage::inputMethodQuery(Qt::InputMethodQuery property) const if (renderTextControl) { QString text = renderTextControl->text(); RefPtr<Range> range = editor->compositionRange(); - if (range) { + if (range) text.remove(range->startPosition().offsetInContainerNode(), TextIterator::rangeLength(range.get())); - } return QVariant(text); } return QVariant(); @@ -1760,14 +1762,6 @@ QWebPage::~QWebPage() FrameLoader *loader = d->mainFrame->d->frame->loader(); if (loader) loader->detachFromParent(); - if (d->inspector) { - // Since we have to delete an internal inspector, - // call setInspector(0) directly to prevent potential crashes - if (d->inspectorIsInternalOnly) - d->setInspector(0); - else - d->inspector->setPage(0); - } delete d; } @@ -1850,7 +1844,7 @@ void QWebPage::setView(QWidget* view) } if (view) - d->client = new PageClientQWidget(view); + d->client = new PageClientQWidget(view, this); } /*! @@ -2089,8 +2083,9 @@ static void openNewWindow(const QUrl& url, WebCore::Frame* frame) { if (Page* oldPage = frame->page()) { WindowFeatures features; + NavigationAction action; if (Page* newPage = oldPage->chrome()->createWindow(frame, - frameLoadRequest(url, frame), features)) + frameLoadRequest(url, frame), features, action)) newPage->chrome()->show(); } } @@ -2292,6 +2287,9 @@ static QSize queryDeviceSizeForScreenContainingWidget(const QWidget* widget) automatically. For testing purposes the size can be overridden by setting two environment variables QTWEBKIT_DEVICE_WIDTH and QTWEBKIT_DEVICE_HEIGHT, which both needs to be set. + + An invalid instance will be returned in the case an empty size is passed to the + method. */ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& availableSize) const @@ -2301,6 +2299,9 @@ QWebPage::ViewportAttributes QWebPage::viewportAttributesForSize(const QSize& av ViewportAttributes result; + if (availableSize.isEmpty()) + return result; // Returns an invalid instance. + int deviceWidth = getintenv("QTWEBKIT_DEVICE_WIDTH"); int deviceHeight = getintenv("QTWEBKIT_DEVICE_HEIGHT"); @@ -2823,6 +2824,7 @@ bool QWebPage::event(QEvent *ev) #endif case QEvent::InputMethod: d->inputMethodEvent(static_cast<QInputMethodEvent*>(ev)); + break; case QEvent::ShortcutOverride: d->shortcutOverrideEvent(static_cast<QKeyEvent*>(ev)); break; diff --git a/WebKit/qt/ChangeLog b/WebKit/qt/ChangeLog index c1bf664..98d6d45 100644 --- a/WebKit/qt/ChangeLog +++ b/WebKit/qt/ChangeLog @@ -1,3 +1,296 @@ +2010-10-29 Andreas Kling <kling@webkit.org> + + Reviewed by Ariya Hidayat. + + [Qt] QWebPage's InputMethod event handling calls ShortcutOverride handler too + https://bugs.webkit.org/show_bug.cgi?id=48692 + + * Api/qwebpage.cpp: + (QWebPage::event): Add missing break statement. + +2010-10-29 Ryosuke Niwa <rniwa@webkit.org> + + Reviewed by Darin Adler. + + Remove RenderTextControl::setSelectionRange + https://bugs.webkit.org/show_bug.cgi?id=47870 + + Converted RenderTextControll::setSelectionRange to a global function. + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): Calls setSelectionRange. + +2010-10-29 Darin Adler <darin@apple.com> + + Reviewed by Sam Weinig. + + Change BackForwardList clients to use BackForwardListImpl to prepare for further refactoring + https://bugs.webkit.org/show_bug.cgi?id=48574 + + * Api/qwebhistory.cpp: + (QWebHistory::clear): + * Api/qwebhistory_p.h: + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + Use BackForwardListImpl. + +2010-10-29 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Darin Adler. + + https://bugs.webkit.org/show_bug.cgi?id=48576 + Let WebKit2 client know when a frame is a frameset + + Added a blank implementation of the new FrameLoaderClient method. + + * WebCoreSupport/FrameLoaderClientQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidBecomeFrameset): + +2010-10-29 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Fix tst_QWebFrame on XVFB. + https://bugs.webkit.org/show_bug.cgi?id=48637 + + These tests relied on a window manager to activate the window. + + Fixes: + - tst_QWebFrame::popupFocus() + - tst_QwebFrame::inputFieldFocus() + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-10-28 Noam Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Ariya Hidayat. + + [Texmap] [Qt] Texture mapper initial implementation + https://bugs.webkit.org/show_bug.cgi?id=47070 + + Build fix, + + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PlatformLayerProxyQGraphicsObject::PlatformLayerProxyQGraphicsObject): + (WebCore::PageClientQGraphicsWidget::~PageClientQGraphicsWidget): + (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer): + * WebCoreSupport/PageClientQt.h: + +2010-10-28 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] QWebElement: Don't retrieve CSS rules through DOMWindow. + https://bugs.webkit.org/show_bug.cgi?id=48519 + + JavaScript is prevented from retrieving cross-domain CSS rules since r70335. + This patch allow QWebElement to retrive style without this limitation + by asking the Document directly instead of going through DOMWindow. + + Fixes: + - tst_QWebFrame::setHtmlWithResource() + - tst_QWebElement::style() + + * Api/qwebelement.cpp: + (QWebElement::styleProperty): + +2010-10-28 Kenneth Rohde Christiansen <kenneth@webkit.org> + + Reviewed by Andreas Kling. + + Make Qt viewportAttributesForSize not assert on (0, 0) size + https://bugs.webkit.org/show_bug.cgi?id=48524 + + We now return an invalid (isValid() == false) ViewportAttributes + instance when the supplied size is (0, 0). + + * Api/qwebpage.cpp: + (QWebPage::viewportAttributesForSize): + +2010-10-27 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Qt] Fix tst_QWebFrame::popupFocus(). + https://bugs.webkit.org/show_bug.cgi?id=48432 + + - Call setFocus() before show() to work around a but in Qt. + - Remove the check on combo at the end since hidePopup() leads + indirectly to its destruction and segfault. + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-10-26 Jenn Braithwaite <jennb@chromium.org> + + Reviewed by Dmitry Titov. + + Resource tracking failure when trying to move a frame between documents + https://bugs.webkit.org/show_bug.cgi?id=44713 + + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::transferLoadingResourceFromPage): + Emtpy method. + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-10-26 Yi Shen <yi.4.shen@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Skipping popup focus test for symbian + https://bugs.webkit.org/show_bug.cgi?id=48324 + + * tests/qwebframe/tst_qwebframe.cpp: + +2010-10-26 Jocelyn Turcotte <jocelyn.turcotte@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] Unit tests: setHtml("data:text/html,...") -> load(QUrl("data:text/html,...")) + https://bugs.webkit.org/show_bug.cgi?id=48319 + + These tests were failing since the new HTML parser. + This patch removes the content type from the error page as well. + + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::crashOnViewlessWebPages): + * tests/qwebelement/tst_qwebelement.cpp: + (tst_QWebElement::frame): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::loadFinished): + (ErrorPage::extension): + (tst_QWebPage::errorPageExtension): + (tst_QWebPage::errorPageExtensionInIFrames): + (tst_QWebPage::errorPageExtensionInFrameset): + +2010-10-25 No'am Rosenthal <noam.rosenthal@nokia.com> + + Reviewed by Kenneth Rohde Christiansen. + + [Texmap] [Qt] Texture mapper initial implementation + https://bugs.webkit.org/show_bug.cgi?id=47070 + + Glue layer (WebCoreSupport) changes to allow connecting TextureMapper to a Qt PageClient, i.e. + a QWebView or a QGraphicsWebView. This enables the new type, TextureMapperPlatformLayer, to be recognized both by + the compositor and by the page client. + Note that this is temporarily an opt-in, under USE(TEXTURE_MAPPER) + + * Api/qwebframe.h: + * Api/qwebframe_p.h: + (QWebFramePrivate::QWebFramePrivate): + * Api/qwebpage.cpp: + (QWebPage::setView): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::attachRootGraphicsLayer): + * WebCoreSupport/PageClientQt.cpp: + (WebCore::PlatformLayerProxyQt::PlatformLayerProxyQt): + (WebCore::PlatformLayerProxyQt::~PlatformLayerProxyQt): + (WebCore::PlatformLayerProxyQt::setSizeChanged): + (WebCore::PlatformLayerProxyQWidget::PlatformLayerProxyQWidget): + (WebCore::PlatformLayerProxyQWidget::eventFilter): + (WebCore::PlatformLayerProxyQWidget::setNeedsDisplay): + (WebCore::PlatformLayerProxyQWidget::setNeedsDisplayInRect): + (WebCore::PlatformLayerProxyQGraphicsObject::PlatformLayerProxyQGraphicsWidget): + (WebCore::PlatformLayerProxyQGraphicsObject::setNeedsDisplay): + (WebCore::PlatformLayerProxyQGraphicsObject::setNeedsDisplayInRect): + (WebCore::PageClientQWidget::setRootGraphicsLayer): + (WebCore::PageClientQWidget::markForSync): + (WebCore::PageClientQWidget::syncLayers): + (WebCore::PageClientQGraphicsWidget::updateCompositingScrollPosition): + (WebCore::PageClientQGraphicsWidget::createOrDeleteOverlay): + (WebCore::PageClientQGraphicsWidget::setRootGraphicsLayer): + * WebCoreSupport/PageClientQt.h: + (WebCore::PageClientQWidget::PageClientQWidget): + (WebCore::PageClientQWidget::allowsAcceleratedCompositing): + (WebCore::PageClientQGraphicsWidget::PageClientQGraphicsWidget): + +2010-10-25 Johnny Ding <jnd@chromium.org> + + Reviewed by Tony Chang. + + Dump the gesture status of frame in frame load callbacks in DumpRenderTree + by adding a new method dumpUserGestureInFrameLoadCallbacks. + Now only dump the gesture status in "DidStartProvisionalLoad" callback. + https://bugs.webkit.org/show_bug.cgi?id=47849 + + * WebCoreSupport/DumpRenderTreeSupportQt.cpp: + (DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader): + * WebCoreSupport/DumpRenderTreeSupportQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (drtPrintFrameUserGestureStatus): + (WebCore::FrameLoaderClientQt::dispatchDidHandleOnloadEvents): + (WebCore::FrameLoaderClientQt::dispatchDidPushStateWithinPage): + (WebCore::FrameLoaderClientQt::dispatchDidReplaceStateWithinPage): + (WebCore::FrameLoaderClientQt::dispatchDidPopStateWithinPage): + (WebCore::FrameLoaderClientQt::dispatchDidStartProvisionalLoad): + * WebCoreSupport/FrameLoaderClientQt.h: + +2010-10-22 Sam Weinig <sam@webkit.org> + + Reviewed by Anders Carlsson. + + WebKit2 needs to pass the current event modifier flags when requesting a new window + https://bugs.webkit.org/show_bug.cgi?id=48140 + + * Api/qwebpage.cpp: + (openNewWindow): + * WebCoreSupport/ChromeClientQt.cpp: + (WebCore::ChromeClientQt::createWindow): + * WebCoreSupport/ChromeClientQt.h: + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchCreatePage): + * WebCoreSupport/FrameLoaderClientQt.h: + Add NavigationAction parameter. + +2010-10-22 Yi Shen <yi.4.shen@nokia.com> + + Reviewed by Andreas Kling. + + [Qt] InspectorClientQt crashes when deleting a qwebpage which has an inspector + https://bugs.webkit.org/show_bug.cgi?id=48079 + + * Api/qwebpage.cpp: + (QWebPagePrivate::~QWebPagePrivate): + (QWebPage::~QWebPage): + +2010-10-22 Benjamin Poulain <benjamin.poulain@nokia.com> + + Reviewed by Simon Hausmann. + + [Qt] All widgets are rendered incorrectly when rendered through a cache + https://bugs.webkit.org/show_bug.cgi?id=47767 + + Add a new test for rendering with tiling. + + * tests/qgraphicswebview/tst_qgraphicswebview.cpp: + (tst_QGraphicsWebView::widgetsRenderingThroughCache): + +2010-10-21 Robert Hogan <robert@webkit.org> + + Reviewed by Simon Hausmann. + + [Qt] Sending a QInputMethodEvent::Selection event forces the + Editor to go into Composition mode + + Improve QWebPage handling of input method events: + - Selections don't trigger entering composition mode. + - Handle multiple selections + + Also remove redundant cancellation of composition in tst_qwebpage. + There is no composition in progress at that point. + + Finally, move infiniteLoopJS() to the end of the tst_qwebpage unit + tests - so you don't have to wait for it to complete when running + other tests. + + https://bugs.webkit.org/show_bug.cgi?id=39625 + + * Api/qwebpage.cpp: + (QWebPagePrivate::inputMethodEvent): + (QWebPage::inputMethodQuery): + * tests/qwebpage/tst_qwebpage.cpp: + (tst_QWebPage::inputMethods): + 2010-10-20 Luiz Agostini <luiz.agostini@openbossa.org> Reviewed by Antonio Gomes. diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp index 3bcc8f8..f0d3903 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.cpp @@ -39,11 +39,12 @@ #include "FrameView.h" #include "Geolocation.h" #if USE(ACCELERATED_COMPOSITING) -#include "GraphicsLayerQt.h" +#include "GraphicsLayer.h" #endif #include "GeolocationPermissionClientQt.h" #include "HitTestResult.h" #include "Icon.h" +#include "NavigationAction.h" #include "NetworkingContext.h" #include "NotImplemented.h" #include "NotificationPresenterClientQt.h" @@ -169,7 +170,7 @@ void ChromeClientQt::focusedNodeChanged(WebCore::Node*) } -Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features) +Page* ChromeClientQt::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures& features, const NavigationAction&) { QWebPage* newPage = m_webPage->createWindow(features.dialog ? QWebPage::WebModalDialog : QWebPage::WebBrowserWindow); if (!newPage) @@ -590,7 +591,7 @@ void ChromeClientQt::cancelGeolocationPermissionRequestForFrame(Frame* frame, Ge void ChromeClientQt::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* graphicsLayer) { if (platformPageClient()) - platformPageClient()->setRootGraphicsLayer(graphicsLayer ? graphicsLayer->nativeLayer() : 0); + platformPageClient()->setRootGraphicsLayer(graphicsLayer ? graphicsLayer->platformLayer() : 0); } void ChromeClientQt::setNeedsOneShotDrawingSynchronization() diff --git a/WebKit/qt/WebCoreSupport/ChromeClientQt.h b/WebKit/qt/WebCoreSupport/ChromeClientQt.h index 0a449f6..bbd2452 100644 --- a/WebKit/qt/WebCoreSupport/ChromeClientQt.h +++ b/WebKit/qt/WebCoreSupport/ChromeClientQt.h @@ -73,7 +73,7 @@ namespace WebCore { virtual void focusedNodeChanged(Node*); - virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&); + virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&, const NavigationAction&); virtual void show(); virtual bool canRunModal(); diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp index 28f6810..4309e5c 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.cpp @@ -561,6 +561,11 @@ void DumpRenderTreeSupportQt::dumpFrameLoader(bool b) FrameLoaderClientQt::dumpFrameLoaderCallbacks = b; } +void DumpRenderTreeSupportQt::dumpUserGestureInFrameLoader(bool b) +{ + FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = b; +} + void DumpRenderTreeSupportQt::dumpResourceLoadCallbacks(bool b) { FrameLoaderClientQt::dumpResourceLoadCallbacks = b; diff --git a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h index 0e76f04..356b226 100644 --- a/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h +++ b/WebKit/qt/WebCoreSupport/DumpRenderTreeSupportQt.h @@ -101,6 +101,7 @@ public: static QString plainText(const QVariant& rng); static void dumpFrameLoader(bool b); + static void dumpUserGestureInFrameLoader(bool b); static void dumpResourceLoadCallbacks(bool b); static void dumpResourceResponseMIMETypes(bool b); static void dumpResourceLoadCallbacksPath(const QString& path); diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index 4ebc7e1..1b57138 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -106,6 +106,13 @@ static QString drtDescriptionSuitableForTestResult(WebCore::Frame* _frame) } } +static QString drtPrintFrameUserGestureStatus(WebCore::Frame* frame) +{ + if (frame->loader()->isProcessingUserGesture()) + return QString::fromLatin1("Frame with user gesture \"%1\"").arg(QLatin1String("true")); + return QString::fromLatin1("Frame with user gesture \"%1\"").arg(QLatin1String("false")); +} + static QString drtDescriptionSuitableForTestResult(const WebCore::KURL& _url) { if (_url.isEmpty() || !_url.isLocalFile()) @@ -159,6 +166,7 @@ namespace WebCore { bool FrameLoaderClientQt::dumpFrameLoaderCallbacks = false; +bool FrameLoaderClientQt::dumpUserGestureInFrameLoaderCallbacks = false; bool FrameLoaderClientQt::dumpResourceLoadCallbacks = false; bool FrameLoaderClientQt::sendRequestReturnsNullOnRedirect = false; bool FrameLoaderClientQt::sendRequestReturnsNull = false; @@ -274,6 +282,9 @@ void FrameLoaderClientQt::transitionToCommittedForNewPage() vScrollbar, vLock); } +void FrameLoaderClientQt::dispatchDidBecomeFrameset(bool) +{ +} void FrameLoaderClientQt::makeRepresentation(DocumentLoader*) { @@ -314,7 +325,6 @@ void FrameLoaderClientQt::dispatchDidHandleOnloadEvents() // don't need this one if (dumpFrameLoaderCallbacks) printf("%s - didHandleOnloadEventsForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - } @@ -373,7 +383,7 @@ void FrameLoaderClientQt::dispatchDidPushStateWithinPage() { if (dumpFrameLoaderCallbacks) printf("%s - dispatchDidPushStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - + notImplemented(); } @@ -381,7 +391,7 @@ void FrameLoaderClientQt::dispatchDidReplaceStateWithinPage() { if (dumpFrameLoaderCallbacks) printf("%s - dispatchDidReplaceStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - + notImplemented(); } @@ -389,7 +399,7 @@ void FrameLoaderClientQt::dispatchDidPopStateWithinPage() { if (dumpFrameLoaderCallbacks) printf("%s - dispatchDidPopStateWithinPage\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); - + notImplemented(); } @@ -403,6 +413,9 @@ void FrameLoaderClientQt::dispatchDidStartProvisionalLoad() if (dumpFrameLoaderCallbacks) printf("%s - didStartProvisionalLoadForFrame\n", qPrintable(drtDescriptionSuitableForTestResult(m_frame))); + if (dumpUserGestureInFrameLoaderCallbacks) + printf("%s - in didStartProvisionalLoadForFrame\n", qPrintable(drtPrintFrameUserGestureStatus(m_frame))); + if (m_webFrame) emit m_webFrame->provisionalLoad(); } @@ -1102,7 +1115,7 @@ void FrameLoaderClientQt::dispatchDidFailLoad(const WebCore::ResourceError& erro callErrorPageExtension(error); } -WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage() +WebCore::Frame* FrameLoaderClientQt::dispatchCreatePage(const WebCore::NavigationAction&) { if (!m_webFrame) return 0; @@ -1262,6 +1275,10 @@ void FrameLoaderClientQt::didTransferChildFrameToNewDocument(Page*) } } +void FrameLoaderClientQt::transferLoadingResourceFromPage(unsigned long, DocumentLoader*, const ResourceRequest&, Page*) +{ +} + ObjectContentType FrameLoaderClientQt::objectContentType(const KURL& url, const String& _mimeType) { // qDebug()<<" ++++++++++++++++ url is "<<url.prettyURL()<<", mime = "<<_mimeType; diff --git a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index ec6a3b6..275b0e8 100644 --- a/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -120,7 +120,7 @@ public: virtual void dispatchDidFirstLayout(); virtual void dispatchDidFirstVisuallyNonEmptyLayout(); - virtual WebCore::Frame* dispatchCreatePage(); + virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const WTF::String&, const WebCore::ResourceRequest&); @@ -193,12 +193,15 @@ public: virtual void transitionToCommittedFromCachedFrame(WebCore::CachedFrame*); virtual void transitionToCommittedForNewPage(); + virtual void dispatchDidBecomeFrameset(bool); + virtual bool canCachePage() const; virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&); virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); virtual void didTransferChildFrameToNewDocument(WebCore::Page*); + virtual void transferLoadingResourceFromPage(unsigned long, WebCore::DocumentLoader*, const WebCore::ResourceRequest&, WebCore::Page*); virtual PassRefPtr<Widget> createPlugin(const IntSize&, HTMLPlugInElement*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool); virtual void redirectDataToPlugin(Widget* pluginWidget); @@ -233,6 +236,7 @@ public: virtual PassRefPtr<FrameNetworkingContext> createNetworkingContext(); static bool dumpFrameLoaderCallbacks; + static bool dumpUserGestureInFrameLoaderCallbacks; static bool dumpResourceLoadCallbacks; static bool dumpResourceResponseMIMETypes; static QString dumpResourceLoadCallbacksPath; diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.cpp b/WebKit/qt/WebCoreSupport/PageClientQt.cpp index 9aa01a2..4d42c39 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.cpp +++ b/WebKit/qt/WebCoreSupport/PageClientQt.cpp @@ -21,13 +21,127 @@ #include "config.h" #include "PageClientQt.h" +#include "texmap/TextureMapperPlatformLayer.h" #if defined(Q_WS_X11) #include <QX11Info> #endif +#ifdef QT_OPENGL_LIB +#include <QGLWidget> +#endif namespace WebCore { +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) +class PlatformLayerProxyQt : public QObject, public virtual TextureMapperLayerClient { +public: + PlatformLayerProxyQt(QWebFrame* frame, TextureMapperContentLayer* layer, QObject* object) + : QObject(object) + , m_frame(frame) + , m_layer(layer) + { + if (m_layer) + m_layer->setPlatformLayerClient(this); + m_frame->d->rootGraphicsLayer = m_layer; + } + + virtual ~PlatformLayerProxyQt() + { + if (m_layer) + m_layer->setPlatformLayerClient(0); + if (m_frame->d) + m_frame->d->rootGraphicsLayer = 0; + } + + // Since we just paint the composited tree and never create a special item for it, we don't have to handle its size changes. + void setSizeChanged(const IntSize&) { } + +private: + QWebFrame* m_frame; + TextureMapperContentLayer* m_layer; +}; + +class PlatformLayerProxyQWidget : public PlatformLayerProxyQt { +public: + PlatformLayerProxyQWidget(QWebFrame* frame, TextureMapperContentLayer* layer, QWidget* widget) + : PlatformLayerProxyQt(frame, layer, widget) + , m_widget(widget) + { + if (m_widget) + m_widget->installEventFilter(this); + } + + // We don't want a huge region-clip on the compositing layers; instead we unite the rectangles together + // and clear them when the paint actually occurs. + bool eventFilter(QObject* object, QEvent* event) + { + if (object == m_widget && event->type() == QEvent::Paint) + m_dirtyRect = QRect(); + return QObject::eventFilter(object, event); + } + + void setNeedsDisplay() + { + if (m_widget) + m_widget->update(); + } + + void setNeedsDisplayInRect(const IntRect& rect) + { + m_dirtyRect |= rect; + m_widget->update(m_dirtyRect); + } + +private: + QRect m_dirtyRect; + QWidget* m_widget; +}; + +class PlatformLayerProxyQGraphicsObject : public PlatformLayerProxyQt { +public: + PlatformLayerProxyQGraphicsObject(QWebFrame* frame, TextureMapperContentLayer* layer, QGraphicsObject* object) + : PlatformLayerProxyQt(frame, layer, object) + , m_graphicsItem(object) + { + } + + void setNeedsDisplay() + { + if (m_graphicsItem) + m_graphicsItem->update(); + } + + void setNeedsDisplayInRect(const IntRect& rect) + { + if (m_graphicsItem) + m_graphicsItem->update(QRectF(rect)); + } + +private: + QGraphicsItem* m_graphicsItem; +}; + +void PageClientQWidget::setRootGraphicsLayer(TextureMapperPlatformLayer* layer) +{ + if (layer) { + platformLayerProxy = new PlatformLayerProxyQWidget(page->mainFrame(), static_cast<TextureMapperContentLayer*>(layer), view); + return; + } + delete platformLayerProxy; + platformLayerProxy = 0; +} + +void PageClientQWidget::markForSync(bool scheduleSync) +{ + syncTimer.startOneShot(0); +} + +void PageClientQWidget::syncLayers(Timer<PageClientQWidget>*) +{ + QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateRecursive(); +} +#endif + void PageClientQWidget::scroll(int dx, int dy, const QRect& rectToScroll) { view->scroll(qreal(dx), qreal(dy), rectToScroll); @@ -53,6 +167,13 @@ void PageClientQWidget::setInputMethodHints(Qt::InputMethodHints hints) view->setInputMethodHints(hints); } +PageClientQWidget::~PageClientQWidget() +{ +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + delete platformLayerProxy; +#endif +} + #ifndef QT_NO_CURSOR QCursor PageClientQWidget::cursor() const { @@ -107,12 +228,16 @@ PageClientQGraphicsWidget::~PageClientQGraphicsWidget() { delete overlay; #if USE(ACCELERATED_COMPOSITING) +#if USE(TEXTURE_MAPPER) + delete platformLayerProxy; +#else if (!rootGraphicsLayer) return; // we don't need to delete the root graphics layer. The lifecycle is managed in GraphicsLayerQt.cpp. rootGraphicsLayer.data()->setParentItem(0); view->scene()->removeItem(rootGraphicsLayer.data()); #endif +#endif } void PageClientQGraphicsWidget::scroll(int dx, int dy, const QRect& rectToScroll) @@ -134,6 +259,8 @@ void PageClientQGraphicsWidget::update(const QRect& dirtyRect) void PageClientQGraphicsWidget::createOrDeleteOverlay() { + // We don't use an overlay with TextureMapper. Instead, the overlay is drawn inside QWebFrame. +#if !USE(TEXTURE_MAPPER) bool useOverlay = false; if (!viewResizesToContents) { #if USE(ACCELERATED_COMPOSITING) @@ -154,6 +281,7 @@ void PageClientQGraphicsWidget::createOrDeleteOverlay() overlay->deleteLater(); overlay = 0; } +#endif // !USE(TEXTURE_MAPPER) } #if USE(ACCELERATED_COMPOSITING) @@ -165,7 +293,18 @@ void PageClientQGraphicsWidget::syncLayers() } } -void PageClientQGraphicsWidget::setRootGraphicsLayer(QGraphicsItem* layer) +#if USE(TEXTURE_MAPPER) +void PageClientQGraphicsWidget::setRootGraphicsLayer(TextureMapperPlatformLayer* layer) +{ + if (layer) { + platformLayerProxy = new PlatformLayerProxyQGraphicsObject(page->mainFrame(), static_cast<TextureMapperContentLayer*>(layer), view); + return; + } + delete platformLayerProxy; + platformLayerProxy = 0; +} +#else +void PageClientQGraphicsWidget::setRootGraphicsLayer(QGraphicsObject* layer) { if (rootGraphicsLayer) { rootGraphicsLayer.data()->setParentItem(0); @@ -173,7 +312,7 @@ void PageClientQGraphicsWidget::setRootGraphicsLayer(QGraphicsItem* layer) QWebFramePrivate::core(page->mainFrame())->view()->syncCompositingStateRecursive(); } - rootGraphicsLayer = layer ? layer->toGraphicsObject() : 0; + rootGraphicsLayer = layer; if (layer) { layer->setFlag(QGraphicsItem::ItemClipsChildrenToShape, true); @@ -182,6 +321,7 @@ void PageClientQGraphicsWidget::setRootGraphicsLayer(QGraphicsItem* layer) } createOrDeleteOverlay(); } +#endif void PageClientQGraphicsWidget::markForSync(bool scheduleSync) { diff --git a/WebKit/qt/WebCoreSupport/PageClientQt.h b/WebKit/qt/WebCoreSupport/PageClientQt.h index 7014fd2..924d2a7 100644 --- a/WebKit/qt/WebCoreSupport/PageClientQt.h +++ b/WebKit/qt/WebCoreSupport/PageClientQt.h @@ -41,15 +41,25 @@ #include <Settings.h> +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) +#include "texmap/TextureMapperPlatformLayer.h" +#endif + namespace WebCore { class PageClientQWidget : public QWebPageClient { public: - PageClientQWidget(QWidget* view) - : view(view) + PageClientQWidget(QWidget* newView, QWebPage* newPage) + : view(newView) + , page(newPage) +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + , syncTimer(this, &PageClientQWidget::syncLayers) + , platformLayerProxy(0) +#endif { Q_ASSERT(view); } + virtual ~PageClientQWidget(); virtual bool isQWidgetClient() const { return true; } @@ -78,6 +88,21 @@ public: virtual QRectF windowRect() const; QWidget* view; + QWebPage* page; + +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + virtual void setRootGraphicsLayer(TextureMapperPlatformLayer* layer); + virtual void markForSync(bool scheduleSync); + void syncLayers(Timer<PageClientQWidget>*); +#endif + + // QGraphicsWebView can render composited layers + virtual bool allowsAcceleratedCompositing() const { return true; } + +#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER) + Timer<PageClientQWidget> syncTimer; + PlatformLayerProxyQt* platformLayerProxy; +#endif }; // the overlay is here for one reason only: to have the scroll-bars and other @@ -116,11 +141,14 @@ class QGraphicsItemOverlay : public QGraphicsObject { class PageClientQGraphicsWidget : public QWebPageClient { public: - PageClientQGraphicsWidget(QGraphicsWebView* v, QWebPage* p) - : view(v) - , page(p) + PageClientQGraphicsWidget(QGraphicsWebView* newView, QWebPage* newPage) + : view(newView) + , page(newPage) , viewResizesToContents(false) #if USE(ACCELERATED_COMPOSITING) +#if USE(TEXTURE_MAPPER) + , platformLayerProxy(0) +#endif , shouldSync(false) #endif , overlay(0) @@ -168,7 +196,7 @@ public: #endif #if USE(ACCELERATED_COMPOSITING) - virtual void setRootGraphicsLayer(QGraphicsItem* layer); + virtual void setRootGraphicsLayer(PlatformLayer* layer); virtual void markForSync(bool scheduleSync); void syncLayers(); @@ -183,8 +211,11 @@ public: bool viewResizesToContents; #if USE(ACCELERATED_COMPOSITING) +#if USE(TEXTURE_MAPPER) + PlatformLayerProxyQt* platformLayerProxy; +#else QWeakPointer<QGraphicsObject> rootGraphicsLayer; - +#endif // we have to flush quite often, so we use a meta-method instead of QTimer::singleShot for putting the event in the queue QMetaMethod syncMetaMethod; diff --git a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp index a04ff17..09a21e1 100644 --- a/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp +++ b/WebKit/qt/tests/qgraphicswebview/tst_qgraphicswebview.cpp @@ -35,6 +35,7 @@ private slots: void microFocusCoordinates(); void focusInputTypes(); void crashOnSetScaleBeforeSetUrl(); + void widgetsRenderingThroughCache(); }; void tst_QGraphicsWebView::qgraphicswebview() @@ -123,11 +124,11 @@ void tst_QGraphicsWebView::crashOnViewlessWebPages() // page, so we first connect the signal afterward. connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), page, SLOT(aborting())); - page->mainFrame()->setHtml(QString("data:text/html," - "<frameset cols=\"25%,75%\">" - "<frame src=\"data:text/html,foo \">" - "<frame src=\"data:text/html,bar\">" - "</frameset>")); + page->mainFrame()->load(QUrl("data:text/html," + "<frameset cols=\"25%,75%\">" + "<frame src=\"data:text/html,foo \">" + "<frame src=\"data:text/html,bar\">" + "</frameset>")); QVERIFY(waitForSignal(page, SIGNAL(loadFinished(bool)))); delete page; @@ -140,6 +141,41 @@ void tst_QGraphicsWebView::crashOnSetScaleBeforeSetUrl() delete webView; } +void tst_QGraphicsWebView::widgetsRenderingThroughCache() +{ + // Widgets should be rendered the same way with and without + // intermediate cache (tiling for example). + // See bug https://bugs.webkit.org/show_bug.cgi?id=47767 where + // widget are rendered as disabled when caching is using. + + QGraphicsWebView* webView = new QGraphicsWebView; + webView->setHtml(QLatin1String("<body style=\"background-color: white\"><input type=range></input><input type=checkbox></input><input type=radio></input><input type=file></input></body>")); + + QGraphicsView view; + view.show(); + QGraphicsScene* scene = new QGraphicsScene(&view); + view.setScene(scene); + scene->addItem(webView); + view.setGeometry(QRect(0, 0, 500, 500)); + QWidget *const widget = &view; + QTest::qWaitForWindowShown(widget); + + // 1. Reference without tiling. + webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, false); + QPixmap referencePixmap(view.size()); + widget->render(&referencePixmap); + + // 2. With tiling. + webView->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true); + QPixmap viewWithTiling(view.size()); + widget->render(&viewWithTiling); + QApplication::processEvents(); + viewWithTiling.fill(); + widget->render(&viewWithTiling); + + QCOMPARE(referencePixmap.toImage(), viewWithTiling.toImage()); +} + void tst_QGraphicsWebView::microFocusCoordinates() { QWebPage* page = new QWebPage; diff --git a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp index 2f1097a..9bd255f 100644 --- a/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp +++ b/WebKit/qt/tests/qwebelement/tst_qwebelement.cpp @@ -430,9 +430,9 @@ void tst_QWebElement::frame() QWebElement doc = m_mainFrame->documentElement(); QVERIFY(doc.webFrame() == m_mainFrame); - m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," - "<p>frame1\">" - "<frame src=\"data:text/html,<p>frame2\"></frameset>"), QUrl()); + m_mainFrame->load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," + "<p>frame1\">" + "<frame src=\"data:text/html,<p>frame2\"></frameset>")); waitForSignal(m_page, SIGNAL(loadFinished(bool))); diff --git a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp index ec8a39e..d74b631 100644 --- a/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp +++ b/WebKit/qt/tests/qwebframe/tst_qwebframe.cpp @@ -602,8 +602,8 @@ private slots: void setHtmlWithJSAlert(); void ipv6HostEncoding(); void metaData(); -#if !defined(Q_WS_MAEMO_5) - // as maemo 5 does not use QComboBoxes to implement the popups +#if !defined(Q_WS_MAEMO_5) && !defined(Q_OS_SYMBIAN) + // as maemo 5 && symbian do not use QComboBoxes to implement the popups // this test does not make sense for it. void popupFocus(); #endif @@ -2585,7 +2585,7 @@ void tst_QWebFrame::metaData() QCOMPARE(metaData.value("nonexistant"), QString()); } -#if !defined(Q_WS_MAEMO_5) +#if !defined(Q_WS_MAEMO_5) && !defined(Q_OS_SYMBIAN) void tst_QWebFrame::popupFocus() { QWebView view; @@ -2603,9 +2603,11 @@ void tst_QWebFrame::popupFocus() " </body>" "</html>"); view.resize(400, 100); + // Call setFocus before show to work around http://bugreports.qt.nokia.com/browse/QTBUG-14762 + view.setFocus(); view.show(); QTest::qWaitForWindowShown(&view); - view.setFocus(); + view.activateWindow(); QTRY_VERIFY(view.hasFocus()); // open the popup by clicking. check if focus is on the popup @@ -2618,7 +2620,7 @@ void tst_QWebFrame::popupFocus() // hide the popup and check if focus is on the page combo->hidePopup(); - QTRY_VERIFY(view.hasFocus() && !combo->view()->hasFocus()); // Focus should be back on the WebView + QTRY_VERIFY(view.hasFocus()); // Focus should be back on the WebView } #endif @@ -2629,6 +2631,7 @@ void tst_QWebFrame::inputFieldFocus() view.resize(400, 100); view.show(); QTest::qWaitForWindowShown(&view); + view.activateWindow(); view.setFocus(); QTRY_VERIFY(view.hasFocus()); diff --git a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp index 0462953..e6b5909 100644 --- a/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp +++ b/WebKit/qt/tests/qwebpage/tst_qwebpage.cpp @@ -77,7 +77,6 @@ private slots: void cleanupTestCase(); void acceptNavigationRequest(); - void infiniteLoopJS(); void geolocationRequestJS(); void loadFinished(); void acceptNavigationRequestWithNewWindow(); @@ -128,6 +127,7 @@ private slots: void testStopScheduledPageRefresh(); void findText(); void supportedContentType(); + void infiniteLoopJS(); private: QWebView* m_view; @@ -285,9 +285,9 @@ void tst_QWebPage::loadFinished() QSignalSpy spyLoadStarted(m_view, SIGNAL(loadStarted())); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); - m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," - "<head><meta http-equiv='refresh' content='1'></head>foo \">" - "<frame src=\"data:text/html,bar\"></frameset>"), QUrl()); + m_view->page()->mainFrame()->load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," + "<head><meta http-equiv='refresh' content='1'></head>foo \">" + "<frame src=\"data:text/html,bar\"></frameset>")); QTRY_COMPARE(spyLoadFinished.count(), 1); QTRY_VERIFY(spyLoadStarted.count() > 1); @@ -295,8 +295,8 @@ void tst_QWebPage::loadFinished() spyLoadFinished.clear(); - m_view->setHtml(QString("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," - "foo \"><frame src=\"data:text/html,bar\"></frameset>"), QUrl()); + m_view->page()->mainFrame()->load(QUrl("data:text/html,<frameset cols=\"25%,75%\"><frame src=\"data:text/html," + "foo \"><frame src=\"data:text/html,bar\"></frameset>")); QTRY_COMPARE(spyLoadFinished.count(), 1); QCOMPARE(spyLoadFinished.count(), 1); } @@ -1516,11 +1516,6 @@ void tst_QWebPage::inputMethods() QString selectionValue = variant.value<QString>(); QCOMPARE(selectionValue, QString("eb")); - //Cancel current composition first - inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 0, 0, QVariant()); - QInputMethodEvent eventSelection2("",inputAttributes); - page->event(&eventSelection2); - //Set selection with negative length inputAttributes << QInputMethodEvent::Attribute(QInputMethodEvent::Selection, 6, -5, QVariant()); QInputMethodEvent eventSelection3("",inputAttributes); @@ -1887,7 +1882,8 @@ public: { ErrorPageExtensionReturn* errorPage = static_cast<ErrorPageExtensionReturn*>(output); - errorPage->content = "data:text/html,error"; + errorPage->contentType = "text/html"; + errorPage->content = "error"; return true; } }; @@ -1904,7 +1900,7 @@ void tst_QWebPage::errorPageExtension() page->mainFrame()->setUrl(QUrl("http://non.existent/url")); QTRY_COMPARE(spyLoadFinished.count(), 2); - QCOMPARE(page->mainFrame()->toPlainText(), QString("data:text/html,error")); + QCOMPARE(page->mainFrame()->toPlainText(), QString("error")); QCOMPARE(page->history()->count(), 2); QCOMPARE(page->history()->currentItem().url(), QUrl("http://non.existent/url")); QCOMPARE(page->history()->canGoBack(), true); @@ -1931,14 +1927,15 @@ void tst_QWebPage::errorPageExtensionInIFrames() ErrorPage* page = new ErrorPage; m_view->setPage(page); - m_view->setHtml(QString("data:text/html," - "<h1>h1</h1>" - "<iframe src='data:text/html,<p/>p'></iframe>" - "<iframe src='non-existent.html'></iframe>")); + m_view->page()->mainFrame()->load(QUrl( + "data:text/html," + "<h1>h1</h1>" + "<iframe src='data:text/html,<p/>p'></iframe>" + "<iframe src='http://non.existent/url'></iframe>")); QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); QTRY_COMPARE(spyLoadFinished.count(), 1); - QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("data:text/html,error")); + QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("error")); m_view->setPage(0); } @@ -1952,7 +1949,7 @@ void tst_QWebPage::errorPageExtensionInFrameset() QSignalSpy spyLoadFinished(m_view, SIGNAL(loadFinished(bool))); QTRY_COMPARE(spyLoadFinished.count(), 1); - QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("data:text/html,error")); + QCOMPARE(page->mainFrame()->childFrames()[1]->toPlainText(), QString("error")); m_view->setPage(0); } |