diff options
author | Alexis Menard <alexis.menard@trolltech.com> | 2011-05-31 15:05:01 (GMT) |
---|---|---|
committer | Alexis Menard <alexis.menard@trolltech.com> | 2011-05-31 15:05:01 (GMT) |
commit | 02c67de4bc9b9d2936b88255dd535dae23632701 (patch) | |
tree | 321a156932d63a6ae18cfa609fcb7f753d92a152 /src/3rdparty | |
parent | 5f4e810e50c102384d3623afa47629777a4af26d (diff) | |
download | Qt-02c67de4bc9b9d2936b88255dd535dae23632701.zip Qt-02c67de4bc9b9d2936b88255dd535dae23632701.tar.gz Qt-02c67de4bc9b9d2936b88255dd535dae23632701.tar.bz2 |
Updated WebKit to af58e9520937cc6fc3e31fe5d6682d19842e044d
Diffstat (limited to 'src/3rdparty')
19 files changed, 217 insertions, 37 deletions
diff --git a/src/3rdparty/webkit/.tag b/src/3rdparty/webkit/.tag index 5105691..2bd1785 100644 --- a/src/3rdparty/webkit/.tag +++ b/src/3rdparty/webkit/.tag @@ -1 +1 @@ -d14495f006a09eaee01d155fa57c80537408a835 +af58e9520937cc6fc3e31fe5d6682d19842e044d diff --git a/src/3rdparty/webkit/Source/WebCore/ChangeLog b/src/3rdparty/webkit/Source/WebCore/ChangeLog index 17630ce..fbd5b50 100644 --- a/src/3rdparty/webkit/Source/WebCore/ChangeLog +++ b/src/3rdparty/webkit/Source/WebCore/ChangeLog @@ -1,3 +1,94 @@ +2011-05-12 Daniel Bates <dbates@rim.com> + + Attempt to fix the build after changeset 86391 <http://trac.webkit.org/changeset/86391> + (https://bugs.webkit.org/show_bug.cgi?id=60681). + + * page/PluginHalter.cpp: + (WebCore::PluginHalter::PluginHalter): Substitute m_client for client in ASSERT_ARG since client is now of type PassOwnPtr + so it becomes 0 when assigned to another variable. + +2011-05-12 Patrick Gansterer <paroga@webkit.org> + + Reviewed by Adam Barth. + + Enable OwnPtr strict mode in PluginHalter + https://bugs.webkit.org/show_bug.cgi?id=60681 + + Pass PluginHalterClient as (Pass)OwnPtr to Page and PluginHalter. + + * WebCore.exp.in: + * page/Page.cpp: + (WebCore::Page::Page): + (WebCore::Page::PageClients::PageClients): + * page/Page.h: + * page/PluginHalter.cpp: + (WebCore::PluginHalter::PluginHalter): + * page/PluginHalter.h: + +2011-05-28 Alexey Proskuryakov <ap@apple.com> + + Suggested by Simon Fraser. + + REGRESSION (r85375): Load event is sometimes lost when multiple image elements use the same URL + https://bugs.webkit.org/show_bug.cgi?id=61692 + <rdar://problem/9488628> + + * loader/ImageLoader.cpp: (WebCore::ImageLoader::notifyFinished): There was no need to use + ASSERT_UNUSED here. + +2011-05-28 Alexey Proskuryakov <ap@apple.com> + + Reviewed by Geoff Garen. + + REGRESSION (r85375): Load event is sometimes lost when multiple image elements use the same URL + https://bugs.webkit.org/show_bug.cgi?id=61692 + <rdar://problem/9488628> + + Test: fast/dom/gc-image-element-2.html + + Manually verified that tests from bug 59604 and from bug 40926 still pass. + + The problem here was that HTMLImageElement::hasPendingActivity() could return false when + a load (or error) event was still expected to fire. + + * loader/cache/CachedResource.cpp: + (WebCore::CachedResource::setRequest): + * loader/cache/CachedResource.h: + (WebCore::CachedResource::wasCanceled): + (WebCore::CachedResource::errorOccurred): + Track whether the load was canceled. We want to always notify clients of load outcome, + as that's the only way they could make intelligent decisions. + + * dom/ScriptElement.cpp: (WebCore::ScriptElement::execute): Cached resource clients now + get a notifyFinished call on cancellation. Handle this case, where we don't need the + execute the script, but also don't need to fire an error event. + + * html/HTMLImageElement.cpp: Moved hasPendingActivity() to header, since it's just a single + function call now. + + * html/HTMLImageElement.h: (WebCore::HTMLImageElement::hasPendingActivity): There is a large + window between when CachedResource::isLoading() becomes false and events are queued. + ImageLoader::haveFiredLoadEvent() is a much better indication of whether we are expecting + an event to fire. + + * html/HTMLLinkElement.cpp: (WebCore::HTMLLinkElement::onloadTimerFired): Again, don't do + anything on cancellation. + + * loader/ImageLoader.cpp: + (WebCore::ImageEventSender::hasPendingEvents): Made it debug-only again, and fixed to + give an accurate result while looping over the list of events to dispatch. + (WebCore::ImageLoader::notifyFinished): Don't do anything when cancelled. We don't want to + switch to a broken image icon, or to dispatch events. + (WebCore::ImageEventSender::dispatchPendingEvents): Clear the current loader from dispatching + list, as the event is no longer pending when it's being dispatched. + + * loader/ImageLoader.h: Removed unnecessary hasPendingLoadEvent(). We don't care whether one + is already pending, we only care if one is expected at some time in the future, and + !haveFiredLoadEvent() is our best idea of that. + + * dom/XMLDocumentParser.cpp: (WebCore::XMLDocumentParser::notifyFinished): Another place to + handle cancellation. + 2011-05-23 Syed Idris Shah <syed.idris-shah@nokia.com> Reviewed by Andreas Kling. diff --git a/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in b/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in index dea8950..6523589 100644 --- a/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in +++ b/src/3rdparty/webkit/Source/WebCore/WebCore.exp.in @@ -701,7 +701,7 @@ __ZN7WebCore4Page6goBackEv __ZN7WebCore4Page8goToItemEPNS_11HistoryItemENS_13FrameLoadTypeE __ZN7WebCore4Page9goForwardEv __ZN7WebCore4Page9initGroupEv -__ZN7WebCore4PageC1ERKNS0_11PageClientsE +__ZN7WebCore4PageC1ERNS0_11PageClientsE __ZN7WebCore4PageD1Ev __ZN7WebCore4Path14addRoundedRectERKNS_9FloatRectERKNS_9FloatSizeE __ZN7WebCore4PathC1Ev diff --git a/src/3rdparty/webkit/Source/WebCore/dom/ScriptElement.cpp b/src/3rdparty/webkit/Source/WebCore/dom/ScriptElement.cpp index e45c6b8..f29c42d 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/ScriptElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/ScriptElement.cpp @@ -294,7 +294,7 @@ void ScriptElement::execute(CachedScript* cachedScript) ASSERT(cachedScript); if (cachedScript->errorOccurred()) dispatchErrorEvent(); - else { + else if (!cachedScript->wasCanceled()) { executeScript(ScriptSourceCode(cachedScript)); dispatchLoadEvent(); } diff --git a/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParser.cpp b/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParser.cpp index bfbd892..e1764ba 100644 --- a/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParser.cpp +++ b/src/3rdparty/webkit/Source/WebCore/dom/XMLDocumentParser.cpp @@ -324,6 +324,7 @@ void XMLDocumentParser::notifyFinished(CachedResource* unusedResource) ScriptSourceCode sourceCode(m_pendingScript.get()); bool errorOccurred = m_pendingScript->errorOccurred(); + bool wasCanceled = m_pendingScript->wasCanceled(); m_pendingScript->removeClient(this); m_pendingScript = 0; @@ -339,7 +340,7 @@ void XMLDocumentParser::notifyFinished(CachedResource* unusedResource) if (errorOccurred) scriptElement->dispatchErrorEvent(); - else { + else if (!wasCanceled) { scriptElement->executeScript(sourceCode); scriptElement->dispatchLoadEvent(); } diff --git a/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp b/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp index da80090..d66075e 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.cpp @@ -385,11 +385,6 @@ bool HTMLImageElement::complete() const return m_imageLoader.imageComplete(); } -bool HTMLImageElement::hasPendingActivity() -{ - return (cachedImage() && cachedImage()->isLoading()) || m_imageLoader.hasPendingLoadEvent(); -} - void HTMLImageElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const { HTMLElement::addSubresourceAttributeURLs(urls); diff --git a/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.h b/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.h index 861595a..8bcbe51 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.h +++ b/src/3rdparty/webkit/Source/WebCore/html/HTMLImageElement.h @@ -73,7 +73,7 @@ public: bool complete() const; bool haveFiredLoadEvent() const { return m_imageLoader.haveFiredLoadEvent(); } - bool hasPendingActivity(); + bool hasPendingActivity() const { return !m_imageLoader.haveFiredLoadEvent(); } protected: HTMLImageElement(const QualifiedName&, Document*, HTMLFormElement* = 0); diff --git a/src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp b/src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp index 326eaf4..ea8e6fe 100644 --- a/src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp +++ b/src/3rdparty/webkit/Source/WebCore/html/HTMLLinkElement.cpp @@ -432,7 +432,7 @@ void HTMLLinkElement::onloadTimerFired(Timer<HTMLLinkElement>* timer) ASSERT_UNUSED(timer, timer == &m_onloadTimer); if (m_cachedLinkResource->errorOccurred()) dispatchEvent(Event::create(eventNames().errorEvent, false, false)); - else + else if (!m_cachedLinkResource->wasCanceled()) dispatchEvent(Event::create(eventNames().loadEvent, false, false)); m_cachedLinkResource->removeClient(this); diff --git a/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.cpp b/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.cpp index ea956ee..0193e62 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.cpp +++ b/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.cpp @@ -67,7 +67,12 @@ public: void dispatchPendingEvents(); - bool hasPendingEvents(ImageLoader* loader) { return m_dispatchSoonList.find(loader) != notFound; } +#ifndef NDEBUG + bool hasPendingEvents(ImageLoader* loader) const + { + return m_dispatchSoonList.find(loader) != notFound || m_dispatchingList.find(loader) != notFound; + } +#endif private: void timerFired(Timer<ImageEventSender>*); @@ -208,9 +213,10 @@ void ImageLoader::updateFromElementIgnoringPreviousError() updateFromElement(); } -void ImageLoader::notifyFinished(CachedResource*) +void ImageLoader::notifyFinished(CachedResource* resource) { ASSERT(m_failedLoadURL.isEmpty()); + ASSERT(resource == m_image.get()); m_imageComplete = true; if (haveFiredBeforeLoadEvent()) @@ -219,6 +225,9 @@ void ImageLoader::notifyFinished(CachedResource*) if (m_firedLoad) return; + if (resource->wasCanceled()) + return; + loadEventSender().dispatchEventSoon(this); } @@ -310,11 +319,6 @@ void ImageLoader::elementWillMoveToNewOwnerDocument() setImage(0); } -bool ImageLoader::hasPendingLoadEvent() -{ - return loadEventSender().hasPendingEvents(this); -} - ImageEventSender::ImageEventSender(const AtomicString& eventType) : m_eventType(eventType) , m_timer(this, &ImageEventSender::timerFired) @@ -362,6 +366,7 @@ void ImageEventSender::dispatchPendingEvents() size_t size = m_dispatchingList.size(); for (size_t i = 0; i < size; ++i) { if (ImageLoader* loader = m_dispatchingList[i]) { + m_dispatchingList[i] = 0; if (m_eventType == eventNames().beforeloadEvent) loader->dispatchPendingBeforeLoadEvent(); else diff --git a/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.h b/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.h index c603e00..9bf7624 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.h +++ b/src/3rdparty/webkit/Source/WebCore/loader/ImageLoader.h @@ -58,7 +58,6 @@ public: bool haveFiredBeforeLoadEvent() const { return m_firedBeforeLoad; } bool haveFiredLoadEvent() const { return m_firedLoad; } - bool hasPendingLoadEvent(); static void dispatchPendingBeforeLoadEvents(); static void dispatchPendingLoadEvents(); diff --git a/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.cpp b/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.cpp index 04e2cfb..0f205da 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.cpp +++ b/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.cpp @@ -251,11 +251,13 @@ void CachedResource::setRequest(CachedResourceRequest* request) m_request = request; // All loads finish with data(allDataReceived = true) or error(), except for - // canceled loads, which silently set our request to 0. Be sure to set our - // loading flag to false in that case, so we don't seem to continue loading - // forever. - if (!m_request) + // canceled loads, which silently set our request to 0. Be sure to notify our + // client in that case, so we don't seem to continue loading forever. + if (!m_request && isLoading()) { setLoading(false); + setStatus(Canceled); + checkNotify(); + } if (canDelete() && !inCache()) delete this; diff --git a/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.h b/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.h index 72b00e5..d52be45 100644 --- a/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.h +++ b/src/3rdparty/webkit/Source/WebCore/loader/cache/CachedResource.h @@ -73,6 +73,7 @@ public: Unknown, // let cache decide what to do with it Pending, // only partially loaded Cached, // regular case + Canceled, LoadError, DecodeError }; @@ -182,7 +183,8 @@ public: String accept() const { return m_accept; } void setAccept(const String& accept) { m_accept = accept; } - bool errorOccurred() const { return (status() == LoadError || status() == DecodeError); } + bool wasCanceled() const { return m_status == Canceled; } + bool errorOccurred() const { return (m_status == LoadError || m_status == DecodeError); } bool sendResourceLoadCallbacks() const { return m_sendResourceLoadCallbacks; } diff --git a/src/3rdparty/webkit/Source/WebCore/page/Page.cpp b/src/3rdparty/webkit/Source/WebCore/page/Page.cpp index 76642f8..4207e4c 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/Page.cpp +++ b/src/3rdparty/webkit/Source/WebCore/page/Page.cpp @@ -113,7 +113,7 @@ static void networkStateChanged() frames[i]->document()->dispatchWindowEvent(Event::create(eventName, false, false)); } -Page::Page(const PageClients& pageClients) +Page::Page(PageClients& pageClients) : m_chrome(adoptPtr(new Chrome(this, pageClients.chromeClient))) , m_dragCaretController(adoptPtr(new SelectionController(0, true))) #if ENABLE(DRAG_SUPPORT) @@ -174,7 +174,7 @@ Page::Page(const PageClients& pageClients) allPages->add(this); if (pageClients.pluginHalterClient) { - m_pluginHalter = adoptPtr(new PluginHalter(pageClients.pluginHalterClient)); + m_pluginHalter = adoptPtr(new PluginHalter(pageClients.pluginHalterClient.release())); m_pluginHalter->setPluginAllowedRunTime(m_settings->pluginAllowedRunTime()); } @@ -940,7 +940,6 @@ Page::PageClients::PageClients() , editorClient(0) , dragClient(0) , inspectorClient(0) - , pluginHalterClient(0) , geolocationClient(0) , deviceMotionClient(0) , deviceOrientationClient(0) diff --git a/src/3rdparty/webkit/Source/WebCore/page/Page.h b/src/3rdparty/webkit/Source/WebCore/page/Page.h index 60193fb..bdea870 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/Page.h +++ b/src/3rdparty/webkit/Source/WebCore/page/Page.h @@ -111,7 +111,7 @@ namespace WebCore { EditorClient* editorClient; DragClient* dragClient; InspectorClient* inspectorClient; - PluginHalterClient* pluginHalterClient; + OwnPtr<PluginHalterClient> pluginHalterClient; GeolocationClient* geolocationClient; DeviceMotionClient* deviceMotionClient; DeviceOrientationClient* deviceOrientationClient; @@ -120,7 +120,7 @@ namespace WebCore { MediaStreamClient* mediaStreamClient; }; - Page(const PageClients&); + Page(PageClients&); ~Page(); void setNeedsRecalcStyleInAllFrames(); diff --git a/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.cpp b/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.cpp index 70ab17a..d3cfe17 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.cpp +++ b/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.cpp @@ -24,27 +24,24 @@ */ #include "config.h" - -// FIXME: Remove this define! -#define LOOSE_OWN_PTR - #include "PluginHalter.h" #include "HaltablePlugin.h" #include "PlatformString.h" #include <wtf/CurrentTime.h> +#include <wtf/PassOwnPtr.h> #include <wtf/Vector.h> using namespace std; namespace WebCore { -PluginHalter::PluginHalter(PluginHalterClient* client) +PluginHalter::PluginHalter(PassOwnPtr<PluginHalterClient> client) : m_client(client) , m_timer(this, &PluginHalter::timerFired) , m_pluginAllowedRunTime(numeric_limits<unsigned>::max()) { - ASSERT_ARG(client, client); + ASSERT_ARG(m_client, m_client); } void PluginHalter::didStartPlugin(HaltablePlugin* obj) diff --git a/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.h b/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.h index 5b96d19..5cc3c72 100644 --- a/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.h +++ b/src/3rdparty/webkit/Source/WebCore/page/PluginHalter.h @@ -38,7 +38,7 @@ class HaltablePlugin; class PluginHalter { WTF_MAKE_NONCOPYABLE(PluginHalter); WTF_MAKE_FAST_ALLOCATED; public: - PluginHalter(PluginHalterClient*); + PluginHalter(PassOwnPtr<PluginHalterClient>); void didStartPlugin(HaltablePlugin*); void didStopPlugin(HaltablePlugin*); diff --git a/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.cpp b/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.cpp index be549fe..f93702b 100644 --- a/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.cpp +++ b/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.cpp @@ -1,5 +1,7 @@ /* * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) + * Copyright (C) 2011 University of Szeged + * Copyright (C) 2011 Kristof Kosztyo <Kosztyo.Kristof@stud.u-szeged.hu> * Copyright (C) 2009 Girish Ramakrishnan <girish@forwardbias.in> * Copyright (C) 2006 George Staikos <staikos@kde.org> * Copyright (C) 2006 Dirk Mueller <mueller@kde.org> @@ -44,6 +46,7 @@ LauncherWindow::LauncherWindow(WindowOptions* data, QGraphicsScene* sharedScene) , m_inspector(0) , m_formatMenuAction(0) , m_zoomAnimation(0) + , m_findFlag(0) { if (data) m_windowOptions = *data; @@ -195,6 +198,8 @@ void LauncherWindow::createChrome() editMenu->addAction(page()->action(QWebPage::Copy)); editMenu->addAction(page()->action(QWebPage::Paste)); editMenu->addSeparator(); + editMenu->addAction("&Find", this, SLOT(showFindBar()), QKeySequence(Qt::CTRL | Qt::Key_F)); + editMenu->addSeparator(); QAction* setEditable = editMenu->addAction("Set Editable", this, SLOT(setEditable(bool))); setEditable->setCheckable(true); @@ -406,6 +411,48 @@ void LauncherWindow::createChrome() toggleJavascriptCanOpenWindows->setCheckable(true); toggleJavascriptCanOpenWindows->setChecked(false); + m_findBar = new QToolBar("Find", this); + addToolBar(Qt::BottomToolBarArea, m_findBar); + + QToolButton* findClose = new QToolButton(m_findBar); + findClose->setText("X"); + m_lineEdit = new QLineEdit(m_findBar); + m_lineEdit->setMaximumWidth(200); + QToolButton* findPrevious = new QToolButton(m_findBar); + findPrevious->setArrowType(Qt::LeftArrow); + QToolButton* findNext = new QToolButton(m_findBar); + findNext->setArrowType(Qt::RightArrow); + QCheckBox* findCaseSensitive = new QCheckBox("Case Sensitive", m_findBar); + QCheckBox* findWrapAround = new QCheckBox("Wrap Around", m_findBar); + QCheckBox* findHighLightAll = new QCheckBox("HighLight All", m_findBar); + + QSignalMapper* findSignalMapper = new QSignalMapper(m_findBar); + findSignalMapper->setMapping(m_lineEdit, s_findNormalFlag); + findSignalMapper->setMapping(findPrevious, QWebPage::FindBackward); + findSignalMapper->setMapping(findNext, s_findNormalFlag); + findSignalMapper->setMapping(findCaseSensitive, QWebPage::FindCaseSensitively); + findSignalMapper->setMapping(findWrapAround, QWebPage::FindWrapsAroundDocument); + findSignalMapper->setMapping(findHighLightAll, QWebPage::HighlightAllOccurrences); + + connect(findClose, SIGNAL(clicked()), this, SLOT(showFindBar())); + connect(m_lineEdit, SIGNAL(textChanged(const QString &)), findSignalMapper, SLOT(map())); + connect(findPrevious, SIGNAL(pressed()), findSignalMapper, SLOT(map())); + connect(findNext, SIGNAL(pressed()), findSignalMapper, SLOT(map())); + connect(findCaseSensitive, SIGNAL(stateChanged(int)), findSignalMapper, SLOT(map())); + connect(findWrapAround, SIGNAL(stateChanged(int)), findSignalMapper, SLOT(map())); + connect(findHighLightAll, SIGNAL(stateChanged(int)), findSignalMapper, SLOT(map())); + + connect(findSignalMapper, SIGNAL(mapped(int)), this, SLOT(find(int))); + + m_findBar->addWidget(findClose); + m_findBar->addWidget(m_lineEdit); + m_findBar->addWidget(findPrevious); + m_findBar->addWidget(findNext); + m_findBar->addWidget(findCaseSensitive); + m_findBar->addWidget(findWrapAround); + m_findBar->addWidget(findHighLightAll); + m_findBar->setMovable(false); + m_findBar->setVisible(false); #endif } @@ -975,3 +1022,38 @@ LauncherWindow* LauncherWindow::cloneWindow() return mw; } +void LauncherWindow::showFindBar() +{ + if (!m_findBar->isVisible()) { + m_findBar->setVisible(true); + m_lineEdit->setText(page()->selectedText()); + m_lineEdit->setFocus(Qt::PopupFocusReason); + } else { + m_findBar->setVisible(false); + page()->findText("", QWebPage::HighlightAllOccurrences); + } +} + +void LauncherWindow::find(int mode = s_findNormalFlag) +{ + QPalette palette; + bool found; + palette.setColor(m_lineEdit->backgroundRole(), Qt::white); + page()->findText("", QFlag(QWebPage::HighlightAllOccurrences)); + + m_findFlag = m_findFlag ^ mode; + if (mode == s_findNormalFlag || mode == QWebPage::FindBackward) { + found = page()->findText(m_lineEdit->text(), QFlag(m_findFlag & ~QWebPage::HighlightAllOccurrences)); + m_findFlag = m_findFlag ^ mode; + + if (found || m_lineEdit->text().isEmpty()) + m_lineEdit->setPalette(palette); + else { + palette.setColor(m_lineEdit->backgroundRole(), QColor(255, 0, 0, 127)); + m_lineEdit->setPalette(palette); + } + } + + if (m_findFlag & QWebPage::HighlightAllOccurrences) + page()->findText(m_lineEdit->text(), QFlag(m_findFlag)); +} diff --git a/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.h b/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.h index 705a1e4..f9cf00a 100644 --- a/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.h +++ b/src/3rdparty/webkit/Tools/QtTestBrowser/launcherwindow.h @@ -191,6 +191,8 @@ protected slots: void toggleOfflineWebApplicationCache(bool toggle); void setOfflineStorageDefaultQuota(); + void showFindBar(); + void find(int mode); #if defined(QT_CONFIGURED_WITH_OPENGL) void toggleQGLWidgetViewport(bool enable); #endif @@ -239,6 +241,11 @@ private: bool m_touchMocking; QString m_inputUrl; + + QToolBar* m_findBar; + QLineEdit* m_lineEdit; + int m_findFlag; + static const int s_findNormalFlag = 0; }; #endif diff --git a/src/3rdparty/webkit/VERSION b/src/3rdparty/webkit/VERSION index 06cfb06..e779590 100644 --- a/src/3rdparty/webkit/VERSION +++ b/src/3rdparty/webkit/VERSION @@ -4,4 +4,4 @@ This is a snapshot of the Qt port of WebKit from and has the sha1 checksum - d14495f006a09eaee01d155fa57c80537408a835 + af58e9520937cc6fc3e31fe5d6682d19842e044d |