diff options
| author | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:42:44 +0200 |
|---|---|---|
| committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-09-26 10:42:44 +0200 |
| commit | 33b26980cb24288b5a9f2590ccf32a949281bb79 (patch) | |
| tree | cc0203dac37338b24b0b25a4694c0b76d4e4164b /Source/WebKit | |
| parent | 715be629d51174233403237bfc563cf150087dc8 (diff) | |
| download | qtwebkit-33b26980cb24288b5a9f2590ccf32a949281bb79.tar.gz | |
Imported WebKit commit c596dd7f03007fa7ed896b928106497e8784b3b5 (http://svn.webkit.org/repository/webkit/trunk@129610)
New snapshot that removes QtQuick1 support (to be moved into QtQuick1 module)
Diffstat (limited to 'Source/WebKit')
88 files changed, 1098 insertions, 2508 deletions
diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index 78a2858c2..ca376aca8 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -556,6 +556,8 @@ void WebPagePrivate::init(const WebString& pageGroupName) m_webSettings->setUserAgentString(defaultUserAgent()); m_page->setDeviceScaleFactor(m_webSettings->devicePixelRatio()); + m_page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); + #if USE(ACCELERATED_COMPOSITING) m_tapHighlight = DefaultTapHighlight::create(this); m_selectionOverlay = SelectionOverlay::create(this); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index c32d3c4f3..36163acf9 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,120 @@ +2012-09-25 Genevieve Mak <gmak@rim.com> + + Fat Fingers doesn't work on non-scrollable pages. + PR #209609 + https://bugs.webkit.org/show_bug.cgi?id=97607 + + Reviewed by Antonio Gomes. + + Only bypass Fat Fingers and use the actual touch point if its specifically + requested and the page has a mouse move listener or if using the Touch Event + Mode meta-tag. + + * WebKitSupport/TouchEventHandler.cpp: + (BlackBerry::WebKit::TouchEventHandler::handleTouchPoint): + +2012-09-25 Rob Buis <rbuis@rim.com> + + [BlackBerry] Make COMPUTED_GOTO part of the HAVE section + https://bugs.webkit.org/show_bug.cgi?id=97600 + + Reviewed by Yong Li. + + Also get rid of COMPUTED_GOTO_INTERPRETER and add COMPUTED_GOTO_OPCODES. + + * WebCoreSupport/AboutDataEnableFeatures.in: + * WebCoreSupport/AboutDataHaveFeatures.in: + +2012-09-25 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Suspend the backingstore while adjusting the view on input field focus. + https://bugs.webkit.org/show_bug.cgi?id=97595 + + Reviewed by Antonio Gomes. + + PR 188751. + + Avoid jumpiness when both a scroll and zoom are required to + move an input field into focus by suspending the backingstore. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible): + +2012-09-25 Pratik Solanki <psolanki@apple.com> + + Remove HAVE_SBRK since we never set use_sbrk to true + https://bugs.webkit.org/show_bug.cgi?id=97525 + <rdar://problem/12363601> + + Reviewed by Geoffrey Garen. + + * WebCoreSupport/AboutDataHaveFeatures.in: Remove SBRK from list. + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestoneOptions) + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidLayout): + * WebCoreSupport/FrameLoaderClientBlackBerry.h: + (FrameLoaderClientBlackBerry): + + It is now necessary to opt into getting any of the + "layout milestone" notifications. + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::init): + +2012-09-25 Mike Fenton <mifenton@rim.com> + + [BlackBerry] When zooming into an input field take the current zoom level into account. + https://bugs.webkit.org/show_bug.cgi?id=97594 + + Reviewed by Antonio Gomes. + + PR 188751. + + Perform the zoom action prior to scroll to avoid breaking scrolling + rules. Take the current scale into account when calculating the + zoom factor. + + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::ensureFocusTextElementVisible): + +2012-09-25 Nima Ghanavatian <nghanavatian@rim.com> + + [BlackBerry] Handling required for multiple consecutive whitespace + https://bugs.webkit.org/show_bug.cgi?id=97575 + + Reviewed by Rob Buis. + + PR211670 + Need specific handling in the case where we have multiple + consecutive whitespaces which exceeds our character limit. This + breaks some of the functionality employed with the visible_units + methods used here to tranverse the text. + + Internally reviewed by Mike Fenton. + + * WebKitSupport/DOMSupport.cpp: + (BlackBerry::WebKit::DOMSupport::trimWhitespaceFromRange): + (DOMSupport): + (BlackBerry::WebKit::DOMSupport::isEmptyRangeOrAllSpaces): + * WebKitSupport/DOMSupport.h: + (WebCore): + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::spellCheckBlock): + (BlackBerry::WebKit::InputHandler::getRangeForSpellCheckWithFineGranularity): + 2012-09-24 Mark Lam <mark.lam@apple.com> Deleting the classic interpreter and cleaning up some build options. diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 6b0ba389d..235c163e2 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -14,8 +14,7 @@ CALENDAR_PICKER CHANNEL_MESSAGING CODEBLOCK_SAMPLING COMPARE_AND_SWAP -COMPUTED_GOTO -COMPUTED_GOTO_INTERPRETER +COMPUTED_GOTO_OPCODES CONSISTENCY_CHECK CONTEXT_MENUS CSS_FILTERS diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in index a9ec5f28e..3c3e2898d 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in @@ -5,6 +5,7 @@ CFNETWORK CFNETWORK_DATA_ARRAY_CALLBACK CG_INTERPOLATION_MEDIUM CGINTERPOLATION_MEDIUM +COMPUTED_GOTO CXX_NULLPTR DISPATCH_H DTRACE @@ -35,7 +36,6 @@ PTHREAD_SETNAME_NP QT5 READLINE RUNLOOP_TIMER -SBRK SIGNAL_H STDINT_H STRING_H diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index ab4c080bf..43311095f 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -848,35 +848,37 @@ void FrameLoaderClientBlackBerry::postProgressEstimateChangedNotification() m_webPagePrivate->m_client->notifyLoadProgress(m_frame->page()->progress()->estimatedProgress() * 100); } -void FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout() +void FrameLoaderClientBlackBerry::dispatchDidLayout(LayoutMilestones milestones) { if (!isMainFrame()) return; - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "dispatchDidFirstVisuallyNonEmptyLayout"); - - readyToRender(true); - - // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call - // dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page - // will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of - // the web page can be incorrect. - FrameLoadType frameLoadType = m_frame->loader()->loadType(); - if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard)) - m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true); - - if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) { - BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d; - m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first. - backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. - if (backingStorePrivate->renderVisibleContents()) { - if (!backingStorePrivate->shouldDirectRenderingToWindow()) - backingStorePrivate->blitVisibleContents(); - m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect()); + if (milestones & DidFirstVisuallyNonEmptyLayout) { + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "dispatchDidFirstVisuallyNonEmptyLayout"); + + readyToRender(true); + + // For FrameLoadTypeSame or FrameLoadTypeStandard load, the layout timer can be fired which can call + // dispatchDidFirstVisuallyNonEmptyLayout() after the load Finished state, in which case the web page + // will have no chance to zoom to initial scale. So we should give it a chance, otherwise the scale of + // the web page can be incorrect. + FrameLoadType frameLoadType = m_frame->loader()->loadType(); + if (m_webPagePrivate->loadState() == WebPagePrivate::Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard)) + m_webPagePrivate->setShouldZoomToInitialScaleAfterLoadFinished(true); + + if (m_webPagePrivate->shouldZoomToInitialScaleOnLoad()) { + BackingStorePrivate* backingStorePrivate = m_webPagePrivate->m_backingStore->d; + m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first. + backingStorePrivate->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. + if (backingStorePrivate->renderVisibleContents()) { + if (!backingStorePrivate->shouldDirectRenderingToWindow()) + backingStorePrivate->blitVisibleContents(); + m_webPagePrivate->m_client->notifyContentRendered(backingStorePrivate->visibleContentsRect()); + } } - } - m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout(); + m_webPagePrivate->m_client->notifyFirstVisuallyNonEmptyLayout(); + } } void FrameLoaderClientBlackBerry::postProgressFinishedNotification() diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h index 699d50dbe..9eb37a506 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.h @@ -82,8 +82,7 @@ public: virtual void dispatchDidFailLoad(const ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout() { notImplemented(); } - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(LayoutMilestones); virtual Frame* dispatchCreatePage(const NavigationAction&); virtual void dispatchShow() { notImplemented(); } diff --git a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp index a2c16d0d1..8d5b20f6a 100644 --- a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.cpp @@ -32,6 +32,7 @@ #include "RenderText.h" #include "RenderTextControl.h" #include "TextIterator.h" +#include "VisiblePosition.h" #include "VisibleSelection.h" #include "htmlediting.h" @@ -529,6 +530,35 @@ Frame* incrementFrame(Frame* curr, bool forward, bool wrapFlag) : curr->tree()->traversePreviousWithWrap(wrapFlag); } +PassRefPtr<Range> trimWhitespaceFromRange(VisiblePosition startPosition, VisiblePosition endPosition) +{ + if (isEmptyRangeOrAllSpaces(startPosition, endPosition)) + return VisibleSelection(endPosition, endPosition).toNormalizedRange(); + + while (isWhitespace(startPosition.characterAfter())) + startPosition = startPosition.next(); + + while (isWhitespace(endPosition.characterBefore())) + endPosition = endPosition.previous(); + + return VisibleSelection(startPosition, endPosition).toNormalizedRange(); +} + +bool isEmptyRangeOrAllSpaces(VisiblePosition startPosition, VisiblePosition endPosition) +{ + if (startPosition == endPosition) + return true; + + while (isWhitespace(startPosition.characterAfter())) { + startPosition = startPosition.next(); + + if (startPosition == endPosition) + return true; + } + + return false; +} + } // DOMSupport } // WebKit } // BlackBerry diff --git a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h index cdfe0fcfa..f75b9a41a 100644 --- a/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h +++ b/Source/WebKit/blackberry/WebKitSupport/DOMSupport.h @@ -38,6 +38,7 @@ class Node; class Position; class QualifiedName; class Range; +class VisiblePosition; class VisibleSelection; } @@ -92,6 +93,9 @@ WebCore::VisibleSelection visibleSelectionForClosestActualWordStart(const WebCor WebCore::Frame* incrementFrame(WebCore::Frame* curr, bool forward, bool wrapFlag); +PassRefPtr<WebCore::Range> trimWhitespaceFromRange(WebCore::VisiblePosition startPosition, WebCore::VisiblePosition endPosition); +bool isEmptyRangeOrAllSpaces(WebCore::VisiblePosition, WebCore::VisiblePosition); + } // DOMSupport } // WebKit } // BlackBerry diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index 5e64316aa..f9e652685 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -61,6 +61,7 @@ #include "WebPageClient.h" #include "WebPage_p.h" #include "WebSettings.h" +#include "htmlediting.h" #include "visible_units.h" #include <BlackBerryPlatformKeyboardEvent.h> @@ -892,6 +893,8 @@ void InputHandler::spellCheckBlock(VisibleSelection& visibleSelection, TextCheck return; } startOfCurrentLine = VisiblePosition(rangeForSpellChecking->endPosition()); + endOfCurrentLine = endOfLine(startOfCurrentLine); + rangeForSpellChecking = DOMSupport::trimWhitespaceFromRange(VisiblePosition(rangeForSpellChecking->startPosition()), VisiblePosition(rangeForSpellChecking->endPosition())); } SpellingLog(LogLevelInfo, "InputHandler::spellCheckBlock Substring text is '%s', of size %d", rangeForSpellChecking->text().latin1().data(), rangeForSpellChecking->text().length()); @@ -910,11 +913,12 @@ PassRefPtr<Range> InputHandler::getRangeForSpellCheckWithFineGranularity(Visible // Check the text length within this range. if (VisibleSelection(startPosition, endOfCurrentWord).toNormalizedRange()->text().length() >= MaxSpellCheckingStringLength) { // If this is not the first word, return a Range with end boundary set to the previous word. - if (startOfWord(endOfCurrentWord, LeftWordIfOnBoundary) != startPosition) + if (startOfWord(endOfCurrentWord, LeftWordIfOnBoundary) != startPosition && !DOMSupport::isEmptyRangeOrAllSpaces(startPosition, endOfCurrentWord)) return VisibleSelection(startPosition, endOfWord(previousWordPosition(endOfCurrentWord), LeftWordIfOnBoundary)).toNormalizedRange(); // Our first word has gone over the character limit. Increment the starting position past an uncheckable word. startPosition = endOfCurrentWord; + endOfCurrentWord = endOfWord(nextWordPosition(endOfCurrentWord)); } else if (endOfCurrentWord == endPosition) { // Return the last segment if the end of our word lies at the end of the range. return VisibleSelection(startPosition, endPosition).toNormalizedRange(); @@ -1046,11 +1050,33 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) break; } case VisibleSelection::NoSelection: + if (m_focusZoomScale) { + m_webPage->zoomAboutPoint(m_focusZoomScale, m_focusZoomLocation); + m_focusZoomScale = 0.0; + m_focusZoomLocation = WebCore::IntPoint(); + } return; } int fontHeight = selectionFocusRect.height(); + m_webPage->suspendBackingStore(); + + // If the text is too small, zoom in to make it a minimum size. + // The minimum size being defined as 3 mm is a good value based on my observations. + static const int s_minimumTextHeightInPixels = Graphics::Screen::primaryScreen()->heightInMMToPixels(3); + + if (fontHeight && fontHeight * m_webPage->currentScale() < s_minimumTextHeightInPixels) { + if (!m_focusZoomScale) { + m_focusZoomScale = m_webPage->currentScale(); + m_focusZoomLocation = selectionFocusRect.location(); + } + m_webPage->zoomAboutPoint(s_minimumTextHeightInPixels / fontHeight, m_focusZoomLocation); + } else { + m_focusZoomScale = 0.0; + m_focusZoomLocation = WebCore::IntPoint(); + } + if (elementFrame != mainFrame) { // Element is in a subframe. // Remove any scroll offset within the subframe to get the point relative to the main frame. selectionFocusRect.move(-elementFrame->view()->scrollPosition().x(), -elementFrame->view()->scrollPosition().y()); @@ -1122,18 +1148,7 @@ void InputHandler::ensureFocusTextElementVisible(CaretScrollType scrollType) mainFrameView->setConstrainsScrollingToContentEdge(true); } } - - // If the text is too small, zoom in to make it a minimum size. - // The minimum size being defined as 3 mm is a good value based on my observations. - static const int s_minimumTextHeightInPixels = Graphics::Screen::primaryScreen()->widthInMMToPixels(3); - if (fontHeight && fontHeight < s_minimumTextHeightInPixels) { - m_focusZoomScale = s_minimumTextHeightInPixels / fontHeight; - m_focusZoomLocation = selectionFocusRect.location(); - m_webPage->zoomAboutPoint(m_focusZoomScale, m_focusZoomLocation); - } else { - m_focusZoomScale = 0.0; - m_focusZoomLocation = WebCore::IntPoint(); - } + m_webPage->resumeBackingStore(); } void InputHandler::ensureFocusPluginElementVisible() diff --git a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp index 946ef7f6b..643bfa916 100644 --- a/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/TouchEventHandler.cpp @@ -257,7 +257,9 @@ bool TouchEventHandler::handleTouchPoint(Platform::TouchPoint& point, bool useFa m_webPage->m_inputHandler->notifyClientOfKeyboardVisibilityChange(true); IntPoint adjustedPoint; - if (m_convertTouchToMouse || !useFatFingers) { + // always use the true touch point if using the meta-tag, otherwise only use it if we sent mouse moves + // to the page and its requested. + if (pureWithMouseConversion || (m_convertTouchToMouse && !useFatFingers)) { adjustedPoint = point.m_pos; m_convertTouchToMouse = pureWithMouseConversion; } else // Fat finger point in viewport coordinates. diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index b216df91a..4a3edec9e 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,119 @@ +2012-09-25 Alpha Lam <hclam@chromium.org> + + Unreviewed. Roll DEPS for Chromium. + + * DEPS: + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestoneOptions) + * src/FrameLoaderClientImpl.cpp: + (WebKit::FrameLoaderClientImpl::dispatchDidLayout): + * src/FrameLoaderClientImpl.h: + (FrameLoaderClientImpl): + + It is now necessary to opt into getting any of the + "layout milestone" notifications. + * src/WebHelperPluginImpl.cpp: + (WebKit::WebHelperPluginImpl::initPage): + * src/WebPagePopupImpl.cpp: + (WebKit::WebPagePopupImpl::initPage): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::WebViewImpl): + +2012-09-25 Joshua Bell <jsbell@chromium.org> + + IndexedDB: One transaction coordinator per database + https://bugs.webkit.org/show_bug.cgi?id=97501 + + Reviewed by Tony Chang. + + Remove obsolete argument. + + * tests/IDBDatabaseBackendTest.h: + +2012-09-25 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r129517. + http://trac.webkit.org/changeset/129517 + https://bugs.webkit.org/show_bug.cgi?id=97582 + + Link errors in chromium (Requested by alecf on #webkit). + + * public/WebUserMediaRequest.h: + (WebUserMediaRequest): + * src/WebUserMediaRequest.cpp: + +2012-09-25 Dominic Mazzoni <dmazzoni@google.com> + + AX: Chromium doesn't pass accessibility text range and line number tests + https://bugs.webkit.org/show_bug.cgi?id=97246 + + Reviewed by Chris Fleizach. + + Use improved implementation of AccessibilityRenderObject::lineBreaks + and implement methods to get the line number of the selection and + to set the text range. + + Enables four existing tests to pass on Chromium: + Tests: accessibility/textarea-insertion-point-line-number.html + accessibility/textarea-line-for-index.html + accessibility/textarea-selected-text-range.html + accessibility/textbox-role-reports-selection.html + + * public/WebAccessibilityObject.h: + (WebAccessibilityObject): + * src/WebAccessibilityObject.cpp: + (WebKit::WebAccessibilityObject::selectionEndLineNumber): + (WebKit): + (WebKit::WebAccessibilityObject::selectionStartLineNumber): + (WebKit::WebAccessibilityObject::setSelectedTextRange): + (WebKit::WebAccessibilityObject::lineBreaks): + +2012-09-25 Tommy Widenflycht <tommyw@google.com> + + MediaStream API: Update getUserMedia to match the latest specification + https://bugs.webkit.org/show_bug.cgi?id=97540 + + Reviewed by Adam Barth. + + http://dev.w3.org/2011/webrtc/editor/getusermedia.html#navigatorusermedia + Navigator.getUserMedia is changed so that the audio and video members can either + be a bool or a constraints object. + + * public/WebUserMediaRequest.h: + (WebKit): + (WebUserMediaRequest): + * src/WebUserMediaRequest.cpp: + (WebKit::WebUserMediaRequest::audioConstraints): + (WebKit): + (WebKit::WebUserMediaRequest::videoConstraints): + +2012-09-24 Andrey Kosyakov <caseq@chromium.org> + + [chromium] adding a page overlay causes endless update loop when accelerated compositing is used + https://bugs.webkit.org/show_bug.cgi?id=97466 + + Reviewed by James Robinson. + + Do not update overlays in composite() -- doing so ultimately causes invalidation + of the view, hence another update and another call do composite(). Overlays should be + updated only when their content changes. + + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::composite): + 2012-09-21 Ilya Tikhonovsky <loislo@chromium.org> Web Inspector: extract Vector instrumentation from core NMI code into MemoryInstrumentationVector.h header. diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index f5ee44aef..bfedf4277 100644 --- a/Source/WebKit/chromium/DEPS +++ b/Source/WebKit/chromium/DEPS @@ -32,7 +32,7 @@ vars = { 'chromium_svn': 'http://src.chromium.org/svn/trunk/src', - 'chromium_rev': '158289' + 'chromium_rev': '158657' } deps = { diff --git a/Source/WebKit/chromium/public/WebAccessibilityObject.h b/Source/WebKit/chromium/public/WebAccessibilityObject.h index 3a32a95ee..c404d3aee 100644 --- a/Source/WebKit/chromium/public/WebAccessibilityObject.h +++ b/Source/WebKit/chromium/public/WebAccessibilityObject.h @@ -140,11 +140,11 @@ public: WEBKIT_EXPORT int hierarchicalLevel() const; WEBKIT_EXPORT WebAccessibilityObject hitTest(const WebPoint&) const; WEBKIT_EXPORT WebString keyboardShortcut() const; - WEBKIT_EXPORT bool performDefaultAction() const; WEBKIT_EXPORT WebAccessibilityRole roleValue() const; WEBKIT_EXPORT unsigned selectionEnd() const; + WEBKIT_EXPORT unsigned selectionEndLineNumber() const; WEBKIT_EXPORT unsigned selectionStart() const; - WEBKIT_EXPORT void setFocused(bool) const; + WEBKIT_EXPORT unsigned selectionStartLineNumber() const; WEBKIT_EXPORT WebString stringValue() const; WEBKIT_EXPORT WebString title() const; WEBKIT_EXPORT WebAccessibilityObject titleUIElement() const; @@ -163,6 +163,11 @@ public: WEBKIT_EXPORT bool accessibilityIsIgnored() const; WEBKIT_EXPORT bool lineBreaks(WebVector<int>&) const; + // Actions + WEBKIT_EXPORT void setFocused(bool) const; + WEBKIT_EXPORT bool performDefaultAction() const; + WEBKIT_EXPORT void setSelectedTextRange(int selectionStart, int selectionEnd) const; + // For a table WEBKIT_EXPORT unsigned columnCount() const; WEBKIT_EXPORT unsigned rowCount() const; diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 7a616c520..0ac5d932c 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -867,15 +867,14 @@ void FrameLoaderClientImpl::dispatchDidFinishLoad() // provisional load succeeds or fails, not the "real" one. } -void FrameLoaderClientImpl::dispatchDidFirstLayout() +void FrameLoaderClientImpl::dispatchDidLayout(LayoutMilestones milestones) { - if (m_webFrame->client()) - m_webFrame->client()->didFirstLayout(m_webFrame); -} + if (!m_webFrame->client()) + return; -void FrameLoaderClientImpl::dispatchDidFirstVisuallyNonEmptyLayout() -{ - if (m_webFrame->client()) + if (milestones & DidFirstLayout) + m_webFrame->client()->didFirstLayout(m_webFrame); + if (milestones & DidFirstVisuallyNonEmptyLayout) m_webFrame->client()->didFirstVisuallyNonEmptyLayout(m_webFrame); } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index 1cf5cd1e1..4d33267ce 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -110,8 +110,7 @@ public: virtual void dispatchDidFailLoad(const WebCore::ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(WebCore::LayoutMilestones); virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); virtual void dispatchDecidePolicyForResponse(WebCore::FramePolicyFunction function, const WebCore::ResourceResponse&, const WebCore::ResourceRequest&); diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index f559715d9..a3dd824cc 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -580,12 +580,44 @@ unsigned WebAccessibilityObject::selectionStart() const return m_private->selectedTextRange().start; } +unsigned WebAccessibilityObject::selectionEndLineNumber() const +{ + if (isDetached()) + return 0; + + VisiblePosition position = m_private->visiblePositionForIndex(selectionEnd()); + int lineNumber = m_private->lineForPosition(position); + if (lineNumber < 0) + return 0; + return lineNumber; +} + +unsigned WebAccessibilityObject::selectionStartLineNumber() const +{ + if (isDetached()) + return 0; + + VisiblePosition position = m_private->visiblePositionForIndex(selectionStart()); + int lineNumber = m_private->lineForPosition(position); + if (lineNumber < 0) + return 0; + return lineNumber; +} + void WebAccessibilityObject::setFocused(bool on) const { if (!isDetached()) m_private->setFocused(on); } +void WebAccessibilityObject::setSelectedTextRange(int selectionStart, int selectionEnd) const +{ + if (isDetached()) + return; + + m_private->setSelectedTextRange(PlainTextRange(selectionStart, selectionEnd - selectionStart)); +} + WebString WebAccessibilityObject::stringValue() const { if (isDetached()) @@ -731,21 +763,15 @@ bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const if (isDetached()) return false; - int textLength = m_private->textLength(); - if (!textLength) - return false; + Vector<int> lineBreaksVector; + m_private->lineBreaks(lineBreaksVector); - VisiblePosition pos = m_private->visiblePositionForIndex(textLength); - int lineBreakCount = m_private->lineForPosition(pos); - if (lineBreakCount <= 0) - return false; + size_t vectorSize = lineBreaksVector.size(); + WebVector<int> lineBreaksWebVector(vectorSize); + for (size_t i = 0; i< vectorSize; i++) + lineBreaksWebVector[i] = lineBreaksVector[i]; + result.swap(lineBreaksWebVector); - WebVector<int> lineBreaks(static_cast<size_t>(lineBreakCount)); - for (int i = 0; i < lineBreakCount; i++) { - PlainTextRange range = m_private->doAXRangeForLine(i); - lineBreaks[i] = range.start + range.length; - } - result.swap(lineBreaks); return true; } diff --git a/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp b/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp index afa3701aa..00991712d 100644 --- a/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp +++ b/Source/WebKit/chromium/src/WebHelperPluginImpl.cpp @@ -184,6 +184,9 @@ bool WebHelperPluginImpl::initPage(WebKit::WebViewImpl* webView, const String& p m_page->settings()->setScriptEnabled(true); m_page->settings()->setPluginsEnabled(true); + unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; + m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones)); + webView->client()->initializeHelperPluginWebFrame(this); // The page's main frame was set in initializeFrame() as a result of the above call. diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index 980f81a8a..1e0fcebb5 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -182,6 +182,9 @@ bool WebPagePopupImpl::initPage() m_page->setDeviceScaleFactor(m_webView->deviceScaleFactor()); m_page->settings()->setDeviceSupportsTouch(m_webView->page()->settings()->deviceSupportsTouch()); + unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; + m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones)); + static ContextFeaturesClient* pagePopupFeaturesClient = new PagePopupFeaturesClient(); provideContextFeaturesTo(m_page.get(), pagePopupFeaturesClient); static FrameLoaderClient* emptyFrameLoaderClient = new EmptyFrameLoaderClient(); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 6666571b3..261f7c357 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -483,6 +483,9 @@ WebViewImpl::WebViewImpl(WebViewClient* client) m_page->setGroupName(pageGroupName); + unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; + m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones)); + #if ENABLE(PAGE_VISIBILITY_API) if (m_client) setVisibilityState(m_client->visibilityState(), true); @@ -1822,9 +1825,6 @@ void WebViewImpl::composite(bool) if (!page()) return; - if (m_pageOverlays) - m_pageOverlays->update(); - m_layerTreeView->composite(); } #endif diff --git a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp index 459dd4b97..b6b36671d 100644 --- a/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp +++ b/Source/WebKit/chromium/tests/IDBDatabaseBackendTest.cpp @@ -32,7 +32,6 @@ #include "IDBFakeBackingStore.h" #include "IDBIndexBackendImpl.h" #include "IDBObjectStoreBackendImpl.h" -#include "IDBTransactionCoordinator.h" #include "WebIDBDatabaseCallbacksImpl.h" #include "WebIDBDatabaseImpl.h" @@ -53,9 +52,8 @@ TEST(IDBDatabaseBackendTest, BackingStoreRetention) RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore()); EXPECT_TRUE(backingStore->hasOneRef()); - IDBTransactionCoordinator* coordinator = 0; IDBFactoryBackendImpl* factory = 0; - RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid"); + RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), factory, "uniqueid"); EXPECT_GT(backingStore->refCount(), 1); const bool autoIncrement = false; @@ -118,9 +116,8 @@ TEST(IDBDatabaseBackendTest, ConnectionLifecycle) RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore()); EXPECT_TRUE(backingStore->hasOneRef()); - IDBTransactionCoordinator* coordinator = 0; IDBFactoryBackendImpl* factory = 0; - RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid"); + RefPtr<IDBDatabaseBackendImpl> db = IDBDatabaseBackendImpl::create("db", backingStore.get(), factory, "uniqueid"); EXPECT_GT(backingStore->refCount(), 1); RefPtr<MockIDBCallbacks> request1 = MockIDBCallbacks::create(); @@ -177,9 +174,8 @@ TEST(IDBDatabaseBackendTest, ForcedClose) RefPtr<IDBFakeBackingStore> backingStore = adoptRef(new IDBFakeBackingStore()); EXPECT_TRUE(backingStore->hasOneRef()); - IDBTransactionCoordinator* coordinator = 0; IDBFactoryBackendImpl* factory = 0; - RefPtr<IDBDatabaseBackendImpl> backend = IDBDatabaseBackendImpl::create("db", backingStore.get(), coordinator, factory, "uniqueid"); + RefPtr<IDBDatabaseBackendImpl> backend = IDBDatabaseBackendImpl::create("db", backingStore.get(), factory, "uniqueid"); EXPECT_GT(backingStore->refCount(), 1); RefPtr<FakeIDBDatabaseCallbacks> connection = FakeIDBDatabaseCallbacks::create(); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 137c5c115..2c7242e0b 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,65 @@ +2012-09-26 Jinwoo Song <jinwoo7.song@samsung.com> + + [EFL] Fix the typo in the ewk_view_fullscreen_exit() + https://bugs.webkit.org/show_bug.cgi?id=97635 + + Reviewed by Gyuyoung Kim. + + Fix the silly typo in the ewk_view_fullscreen_exit() API. + + * ewk/ewk_view.cpp: + (ewk_view_fullscreen_exit): + +2012-09-25 Jinwoo Song <jinwoo7.song@samsung.com> + + [EFL] Add fullscreen set/get APIs and callbacks + https://bugs.webkit.org/show_bug.cgi?id=97421 + + Reviewed by Gyuyoung Kim. + + Add setting APIs for JavaScript Fullscreen API and also add two callbacks to ewk_view API, + so that UI could customise behavior when fullscreen mode is requested. + + * WebCoreSupport/ChromeClientEfl.cpp: + (WebCore::ChromeClientEfl::enterFullScreenForElement): + (WebCore::ChromeClientEfl::exitFullScreenForElement): + * ewk/ewk_view.cpp: + (_Ewk_View_Private_Data): + (_ewk_view_priv_new): + (ewk_view_setting_enable_fullscreen_get): + (ewk_view_setting_enable_fullscreen_set): + (ewk_view_fullscreen_enter): + (ewk_view_fullscreen_exit): + * ewk/ewk_view.h: + * ewk/ewk_view_private.h: + * tests/test_ewk_view.cpp: + (ewkViewEnableFullscreenCb): + (TEST): + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestoneOptions) + * WebCoreSupport/FrameLoaderClientEfl.cpp: + (WebCore::FrameLoaderClientEfl::dispatchDidLayout): + * WebCoreSupport/FrameLoaderClientEfl.h: + (FrameLoaderClientEfl): + + It is now necessary to opt into getting any of the + "layout milestone" notifications. + * ewk/ewk_view.cpp: + (_ewk_view_priv_new): + 2012-09-24 Dominik Röttsches <dominik.rottsches@intel.com> [EFL][DRT] Enable Regions support diff --git a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp index f491d6855..a1a4c37c6 100644 --- a/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/ChromeClientEfl.cpp @@ -633,6 +633,7 @@ void ChromeClientEfl::enterFullScreenForElement(WebCore::Element* element) m_fullScreenElement = element; element->document()->webkitWillEnterFullScreenForElement(element); + ewk_view_fullscreen_enter(m_view); element->document()->webkitDidEnterFullScreenForElement(element); } @@ -644,6 +645,7 @@ void ChromeClientEfl::exitFullScreenForElement(WebCore::Element*) ASSERT(m_fullScreenElement); m_fullScreenElement->document()->webkitWillExitFullScreenForElement(m_fullScreenElement.get()); + ewk_view_fullscreen_exit(m_view); m_fullScreenElement->document()->webkitDidExitFullScreenForElement(m_fullScreenElement.get()); m_fullScreenElement.clear(); diff --git a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp index e793181bf..410b4248f 100644 --- a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp +++ b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp @@ -678,14 +678,12 @@ void FrameLoaderClientEfl::dispatchDidFinishDocumentLoad() ewk_frame_load_document_finished(m_frame); } -void FrameLoaderClientEfl::dispatchDidFirstLayout() +void FrameLoaderClientEfl::dispatchDidLayout(LayoutMilestones milestones) { - ewk_frame_load_firstlayout_finished(m_frame); -} - -void FrameLoaderClientEfl::dispatchDidFirstVisuallyNonEmptyLayout() -{ - ewk_frame_load_firstlayout_nonempty_finished(m_frame); + if (milestones & DidFirstLayout) + ewk_frame_load_firstlayout_finished(m_frame); + if (milestones & DidFirstVisuallyNonEmptyLayout) + ewk_frame_load_firstlayout_nonempty_finished(m_frame); } void FrameLoaderClientEfl::dispatchShow() diff --git a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h index 8c0966a72..6d66ee8aa 100644 --- a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.h @@ -106,8 +106,7 @@ class FrameLoaderClientEfl : public FrameLoaderClient { virtual void dispatchDidFailLoad(const ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(LayoutMilestones); virtual Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); diff --git a/Source/WebKit/efl/ewk/ewk_view.cpp b/Source/WebKit/efl/ewk/ewk_view.cpp index b2d6367a5..ef3564d6c 100644 --- a/Source/WebKit/efl/ewk/ewk_view.cpp +++ b/Source/WebKit/efl/ewk/ewk_view.cpp @@ -304,6 +304,9 @@ struct _Ewk_View_Private_Data { bool enableScripts : 1; bool enablePlugins : 1; bool enableFrameFlattening : 1; +#if ENABLE(FULLSCREEN_API) + bool enableFullscreen : 1; +#endif bool encodingDetector : 1; bool hyperlinkAuditingEnabled : 1; bool scriptsCanOpenWindows : 1; @@ -777,6 +780,9 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) priv->pageSettings = priv->page->settings(); + WebCore::LayoutMilestones layoutMilestones = WebCore::DidFirstLayout | WebCore::DidFirstVisuallyNonEmptyLayout; + priv->page->addLayoutMilestones(layoutMilestones); + priv->viewportArguments.width = WebCore::ViewportArguments::ValueAuto; priv->viewportArguments.height = WebCore::ViewportArguments::ValueAuto; priv->viewportArguments.initialScale = WebCore::ViewportArguments::ValueAuto; @@ -845,6 +851,9 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData) priv->settings.enableScripts = priv->pageSettings->isScriptEnabled(); priv->settings.enablePlugins = priv->pageSettings->arePluginsEnabled(); priv->settings.enableFrameFlattening = priv->pageSettings->frameFlatteningEnabled(); +#if ENABLE(FULLSCREEN_API) + priv->settings.enableFullscreen = priv->pageSettings->fullScreenEnabled(); +#endif priv->settings.enableXSSAuditor = priv->pageSettings->xssAuditorEnabled(); priv->settings.hyperlinkAuditingEnabled = priv->pageSettings->hyperlinkAuditingEnabled(); priv->settings.scriptsCanOpenWindows = priv->pageSettings->javaScriptCanOpenWindowsAutomatically(); @@ -4572,6 +4581,66 @@ void ewk_view_cursor_set(Evas_Object* ewkView, const WebCore::Cursor& cursor) } } +Eina_Bool ewk_view_setting_enable_fullscreen_get(const Evas_Object* ewkView) +{ +#if ENABLE(FULLSCREEN_API) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + return priv->settings.enableFullscreen; +#else + UNUSED_PARAM(ewkView); + return false; +#endif +} + +Eina_Bool ewk_view_setting_enable_fullscreen_set(Evas_Object* ewkView, Eina_Bool enable) +{ +#if ENABLE(FULLSCREEN_API) + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); + EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); + enable = !!enable; + if (priv->settings.enableFullscreen != enable) { + priv->pageSettings->setFullScreenEnabled(enable); + priv->settings.enableFullscreen = enable; + } + return true; +#else + UNUSED_PARAM(ewkView); + UNUSED_PARAM(enable); + return false; +#endif +} + +#if ENABLE(FULLSCREEN_API) +/** + * @internal + * Calls fullscreen_enter callback or falls back to default behavior and enables fullscreen mode. + */ +void ewk_view_fullscreen_enter(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + + if (!smartData->api->fullscreen_enter || !smartData->api->fullscreen_enter(smartData)) { + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); + ecore_evas_fullscreen_set(ecoreEvas, true); + } +} + +/** + * @internal + * Calls fullscreen_exit callback or falls back to default behavior and disables fullscreen mode. + */ +void ewk_view_fullscreen_exit(const Evas_Object* ewkView) +{ + EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); + + if (!smartData->api->fullscreen_exit || !smartData->api->fullscreen_exit(smartData)) { + Ecore_Evas* ecoreEvas = ecore_evas_ecore_evas_get(smartData->base.evas); + ecore_evas_fullscreen_set(ecoreEvas, false); + } +} +#endif + namespace EWKPrivate { WebCore::Page* corePage(const Evas_Object* ewkView) diff --git a/Source/WebKit/efl/ewk/ewk_view.h b/Source/WebKit/efl/ewk/ewk_view.h index cc9f01350..7a8b5d73b 100644 --- a/Source/WebKit/efl/ewk/ewk_view.h +++ b/Source/WebKit/efl/ewk/ewk_view.h @@ -173,6 +173,8 @@ struct _Ewk_View_Smart_Class { // - if overridden, have to call parent method if desired Eina_Bool (*focus_in)(Ewk_View_Smart_Data *sd); Eina_Bool (*focus_out)(Ewk_View_Smart_Data *sd); + Eina_Bool (*fullscreen_enter)(Ewk_View_Smart_Data *sd); + Eina_Bool (*fullscreen_exit)(Ewk_View_Smart_Data *sd); Eina_Bool (*mouse_wheel)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Wheel *ev); Eina_Bool (*mouse_down)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Down *ev); Eina_Bool (*mouse_up)(Ewk_View_Smart_Data *sd, const Evas_Event_Mouse_Up *ev); @@ -198,7 +200,7 @@ struct _Ewk_View_Smart_Class { * The version you have to put into the version field * in the @a Ewk_View_Smart_Class structure. */ -#define EWK_VIEW_SMART_CLASS_VERSION 6UL +#define EWK_VIEW_SMART_CLASS_VERSION 7UL /** * Initializes a whole @a Ewk_View_Smart_Class structure. @@ -210,7 +212,7 @@ struct _Ewk_View_Smart_Class { * @see EWK_VIEW_SMART_CLASS_INIT_VERSION * @see EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION */ -#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} +#define EWK_VIEW_SMART_CLASS_INIT(smart_class_init) {smart_class_init, EWK_VIEW_SMART_CLASS_VERSION, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} /** * Initializes to zero a whole @a Ewk_View_Smart_Class structure. @@ -2747,6 +2749,31 @@ EAPI Evas_Object* ewk_view_web_inspector_view_get(const Evas_Object *o); */ EAPI void ewk_view_web_inspector_view_set(Evas_Object *o, Evas_Object *inspector_view); +/** + * Enables/disables the fullscreen mode by javascript fullscreen API. + * The javascript API allows to request full screen mode, for more information see: + * http://dvcs.w3.org/hg/fullscreen/raw-file/tip/Overview.html + * + * Default value for javascript fullscreen API setting is @c EINA_TRUE. + * + * @param o view object to enable javascript fullscreen API + * @param enable @c EINA_TRUE to enable javascript fullscreen API or + * @c EINA_FALSE to disable + * + * @return @c EINA_TRUE on success or @c EINA_FALSE on failure + */ +EAPI Eina_Bool ewk_view_setting_enable_fullscreen_set(Evas_Object *o, Eina_Bool enable); + +/** + * Queries if the fullscreen mode is enabled. + * + * @param o view object to query whether javascript fullscreen API is enabled + * + * @return @c EINA_TRUE if the javascript fullscreen API is enabled + * @c EINA_FALSE if not or on failure + */ +EAPI Eina_Bool ewk_view_setting_enable_fullscreen_get(const Evas_Object *o); + #ifdef __cplusplus } #endif diff --git a/Source/WebKit/efl/ewk/ewk_view_private.h b/Source/WebKit/efl/ewk/ewk_view_private.h index 631fa2cd3..df7855d41 100644 --- a/Source/WebKit/efl/ewk/ewk_view_private.h +++ b/Source/WebKit/efl/ewk/ewk_view_private.h @@ -156,6 +156,11 @@ bool ewk_view_accelerated_compositing_object_create(Evas_Object* ewkView, Evas_N WebCore::GraphicsContext3D* ewk_view_accelerated_compositing_context_get(Evas_Object* ewkView); #endif +#if ENABLE(FULLSCREEN_API) +void ewk_view_fullscreen_enter(const Evas_Object* ewkView); +void ewk_view_fullscreen_exit(const Evas_Object* ewkView); +#endif + namespace EWKPrivate { WebCore::Page *corePage(const Evas_Object *ewkView); PlatformPageClient corePageClient(Evas_Object* ewkView); diff --git a/Source/WebKit/efl/tests/test_ewk_view.cpp b/Source/WebKit/efl/tests/test_ewk_view.cpp index 2d490797a..b5bbc7b8f 100644 --- a/Source/WebKit/efl/tests/test_ewk_view.cpp +++ b/Source/WebKit/efl/tests/test_ewk_view.cpp @@ -52,3 +52,33 @@ TEST(test_ewk_view, ewk_view_uri_get) { RUN_TEST("http://www.webkit.org", ewkViewUriGetCb); } + +/** +* @brief Checking whether function properly get/set fullscreen setting value. +*/ +static void ewkViewEnableFullscreenCb(void* eventInfo, Evas_Object* webView, void* data) +{ +#if ENABLE(FULLSCREEN_API) + ASSERT_TRUE(ewk_view_setting_enable_fullscreen_get(webView)); + + ASSERT_TRUE(ewk_view_setting_enable_fullscreen_set(webView, true)); + ASSERT_TRUE(ewk_view_setting_enable_fullscreen_get(webView)); + + ASSERT_TRUE(ewk_view_setting_enable_fullscreen_set(webView, false)); + ASSERT_FALSE(ewk_view_setting_enable_fullscreen_get(webView)); +#else + ASSERT_FALSE(ewk_view_setting_enable_fullscreen_get(webView)); + + ASSERT_FALSE(ewk_view_setting_enable_fullscreen_set(webView, true)); + ASSERT_FALSE(ewk_view_setting_enable_fullscreen_get(webView)); + + ASSERT_FALSE(ewk_view_setting_enable_fullscreen_set(webView, false)); + ASSERT_FALSE(ewk_view_setting_enable_fullscreen_get(webView)); +#endif + END_TEST(); +} + +TEST(test_ewk_view, ewk_view_setting_enable_fullscreen) +{ + RUN_TEST(ewkViewEnableFullscreenCb); +} diff --git a/Source/WebKit/gtk/ChangeLog b/Source/WebKit/gtk/ChangeLog index e69726d5b..cef16d151 100644 --- a/Source/WebKit/gtk/ChangeLog +++ b/Source/WebKit/gtk/ChangeLog @@ -1,3 +1,60 @@ +2012-09-26 Zan Dobersek <zandobersek@gmail.com> + + [GTK] Enable some of the unstable CSS features + https://bugs.webkit.org/show_bug.cgi?id=97572 + + Reviewed by Martin Robinson. + + Add a helper DumpRenderTreeSupportGtk method for enabling + the <style scoped> support in WebCore. This is used in DumpRenderTree. + + * WebCoreSupport/DumpRenderTreeSupportGtk.cpp: + (DumpRenderTreeSupportGtk::setShadowDOMEnabled): Add missing + ENABLE(SHADOW_DOM) compilation guards. + (DumpRenderTreeSupportGtk::setStyleScopedEnabled): + * WebCoreSupport/DumpRenderTreeSupportGtk.h: + (DumpRenderTreeSupportGtk): Remove the 'enabled' parameter name from both + setShadowDOMEnabled and setStyleScopedEnabled method declarations as it adds + no information and is causing style warnings. + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestoneOptions) + * WebCoreSupport/FrameLoaderClientGtk.cpp: + (WebKit::FrameLoaderClient::dispatchDidLayout): + * WebCoreSupport/FrameLoaderClientGtk.h: + (FrameLoaderClient): + + It is now necessary to opt into getting any of the + "layout milestone" notifications. + * webkit/webkitwebview.cpp: + (webkit_web_view_init): + +2012-09-25 Paweł Forysiuk <tuxator@o2.pl> + + [GTK] Webkit 1.8.2 fails to build with MinGW with spellchecking enabled + https://bugs.webkit.org/show_bug.cgi?id=93255 + + Reviewed by Martin Robinson. + + Build dies because of invalid cast. Additionaly word "interface" is in use with MinGW compiler. + + * WebCoreSupport/TextCheckerClientGtk.cpp: + (WebKit::TextCheckerClientGtk::checkSpellingOfString): Use String to avoid unneded casting + * webkit/webkitspellcheckerenchant.cpp: + (webkit_spell_checker_enchant_spell_checker_interface_init): rename interface -> checkerInterface + 2012-09-24 Benjamin Poulain <bpoulain@apple.com> Fix Geolocation error reporting in the test support diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp index b39d5ae75..ba5053452 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.cpp @@ -693,7 +693,16 @@ void DumpRenderTreeSupportGtk::setCSSRegionsEnabled(WebKitWebView* webView, bool void DumpRenderTreeSupportGtk::setShadowDOMEnabled(bool enabled) { +#if ENABLE(SHADOW_DOM) RuntimeEnabledFeatures::setShadowDOMEnabled(enabled); +#endif +} + +void DumpRenderTreeSupportGtk::setStyleScopedEnabled(bool enabled) +{ +#if ENABLE(STYLE_SCOPED) + RuntimeEnabledFeatures::setStyleScopedEnabled(enabled); +#endif } bool DumpRenderTreeSupportGtk::elementDoesAutoCompleteForElementWithId(WebKitWebFrame* frame, JSStringRef id) diff --git a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h index 44ac78329..3f7087cd4 100644 --- a/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/DumpRenderTreeSupportGtk.h @@ -118,7 +118,8 @@ public: static void setPageCacheSupportsPlugins(WebKitWebView*, bool enabled); static void setCSSGridLayoutEnabled(WebKitWebView*, bool enabled); static void setCSSRegionsEnabled(WebKitWebView*, bool enabled); - static void setShadowDOMEnabled(bool enabled); + static void setShadowDOMEnabled(bool); + static void setStyleScopedEnabled(bool); static void deliverAllMutationsIfNecessary(); static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const char* urlScheme); diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp index 103e6cdb1..d363faf2e 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp @@ -851,17 +851,13 @@ void FrameLoaderClient::dispatchDidFinishDocumentLoad() g_signal_emit_by_name(webView, "document-load-finished", m_frame); } -void FrameLoaderClient::dispatchDidFirstLayout() -{ - notImplemented(); -} - -void FrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() +void FrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones) { if (m_loadingErrorPage) return; - notifyStatus(m_frame, WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT); + if (milestones & DidFirstVisuallyNonEmptyLayout) + notifyStatus(m_frame, WEBKIT_LOAD_FIRST_VISUALLY_NON_EMPTY_LAYOUT); } void FrameLoaderClient::dispatchShow() diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h index 685c93cd4..f6e3d4f6e 100644 --- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h +++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.h @@ -89,8 +89,7 @@ namespace WebKit { virtual void dispatchDidFailLoad(const WebCore::ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(WebCore::LayoutMilestones); virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); diff --git a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp index e128ad260..23238f485 100644 --- a/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp +++ b/Source/WebKit/gtk/WebCoreSupport/TextCheckerClientGtk.cpp @@ -61,8 +61,8 @@ void TextCheckerClientGtk::learnWord(const String& text) void TextCheckerClientGtk::checkSpellingOfString(const UChar* text, int length, int* misspellingLocation, int* misspellingLength) { - GOwnPtr<gchar> utf8Text(g_utf16_to_utf8(const_cast<gunichar2*>(text), length, 0, 0, 0)); - webkit_spell_checker_check_spelling_of_string(m_spellChecker.get(), utf8Text.get(), misspellingLocation, misspellingLength); + String textAsString(text, length); + webkit_spell_checker_check_spelling_of_string(m_spellChecker.get(), textAsString.utf8().data(), misspellingLocation, misspellingLength); } String TextCheckerClientGtk::getAutoCorrectSuggestionForMisspelledWord(const String& inputWord) diff --git a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp index 83be3a3d2..e46140846 100644 --- a/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp +++ b/Source/WebKit/gtk/webkit/webkitspellcheckerenchant.cpp @@ -43,7 +43,7 @@ struct _WebKitSpellCheckerEnchantPrivate { OwnPtr<TextCheckerEnchant> textCheckerEnchant; }; -static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* interface); +static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* checkerInterface); G_DEFINE_TYPE_WITH_CODE(WebKitSpellCheckerEnchant, webkit_spell_checker_enchant, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE(WEBKIT_TYPE_SPELL_CHECKER, @@ -122,14 +122,14 @@ static void ignoreWord(WebKitSpellChecker* checker, const char* word) priv->textCheckerEnchant->ignoreWord(String::fromUTF8(word)); } -static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* interface) +static void webkit_spell_checker_enchant_spell_checker_interface_init(WebKitSpellCheckerInterface* checkerInterface) { - interface->check_spelling_of_string = checkSpellingOfString; - interface->get_guesses_for_word = getGuessesForWord; - interface->update_spell_checking_languages = updateSpellCheckingLanguages; - interface->get_autocorrect_suggestions_for_misspelled_word = getAutocorrectSuggestionsForMisspelledWord; - interface->learn_word = learnWord; - interface->ignore_word = ignoreWord; + checkerInterface->check_spelling_of_string = checkSpellingOfString; + checkerInterface->get_guesses_for_word = getGuessesForWord; + checkerInterface->update_spell_checking_languages = updateSpellCheckingLanguages; + checkerInterface->get_autocorrect_suggestions_for_misspelled_word = getAutocorrectSuggestionsForMisspelledWord; + checkerInterface->learn_word = learnWord; + checkerInterface->ignore_word = ignoreWord; } #endif /* ENABLE(SPELLCHECK) */ diff --git a/Source/WebKit/gtk/webkit/webkitwebview.cpp b/Source/WebKit/gtk/webkit/webkitwebview.cpp index 123075af3..608bfc243 100644 --- a/Source/WebKit/gtk/webkit/webkitwebview.cpp +++ b/Source/WebKit/gtk/webkit/webkitwebview.cpp @@ -3628,6 +3628,8 @@ static void webkit_web_view_init(WebKitWebView* webView) priv->corePage = new Page(pageClients); + priv->corePage->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); + #if ENABLE(GEOLOCATION) if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled()) { priv->geolocationClientMock = adoptPtr(new GeolocationClientMock); diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index 7579b6513..bc3000647 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,97 @@ +2012-09-25 Dan Bernstein <mitz@apple.com> + + WebKit/mac part of <rdar://problem/11455228> [mac] Stop using screen fonts + https://bugs.webkit.org/show_bug.cgi?id=97620 + + Reviewed by John Sullivan. + + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): Changed the default value of the screenFontSubstitutionEnabled + preference to NO. + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): Changed to enable screen font substitution also if + the value of the NSFontDefaultScreenFontSubstitutionEnabled user defaults key is YES. + +2012-09-21 Jeffrey Pfau <jpfau@apple.com> + + Add WebKit1 SPI for storage blocking preference + https://bugs.webkit.org/show_bug.cgi?id=97356 + + Reviewed by Brady Eidson. + + * WebView/WebPreferenceKeysPrivate.h: + * WebView/WebPreferences.mm: + (+[WebPreferences initialize]): + (-[WebPreferences setStorageBlockingPolicy:]): + (-[WebPreferences storageBlockingPolicy]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (-[WebView _preferencesChanged:]): + +2012-09-24 Simon Fraser <simon.fraser@apple.com> + + <rdar://problem/12351906> Have DumpRenderTree and WebKitTestRunner crash logs show which test crashed + + Reviewed by Mark Rowe. + + Use a new WebKitSytemInterface function to add data to crash logs about which + test was running when the crash happened. + + * WebCoreSupport/WebSystemInterface.mm: + (InitWebCoreSystemInterface): Hook up the function pointer for [wk|WK]SetCrashReportApplicationSpecificInformation. + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + The new API has two parts. First, the client has to opt into which + layout milestones they are interested in hearing about using + [WebView _layoutMilestones]. Then, WebKit will call + the WebFrameLoader delegate's didLayout(WebLayoutMilestones) + callback when the specified layout milestones have fired. + didLayout takes the WebLayoutMilestones bit mask, which will + indicate which milestones have fired since it is possible for two + to fire at the same time. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. They are now replaced + by dispatchDidLayout(LayoutMilestones) + * WebCoreSupport/WebFrameLoaderClient.h: + (WebFrameLoaderClient): + * WebCoreSupport/WebFrameLoaderClient.mm: + (WebFrameLoaderClient::dispatchDidLayout): + + Add new function to the delegate for didLayout. + * WebView/WebDelegateImplementationCaching.h: + (WebFrameLoadDelegateImplementationCache): + + We need a delegate template that takes an NSUInteger. + * WebView/WebDelegateImplementationCaching.mm: + (CallDelegate): + (CallFrameLoadDelegate): + + Convert between WebCore and WebKit versions of the bit mask. + * WebView/WebView.mm: + (coreLayoutMilestones): + (kitLayoutMilestones): + + Add new delegate, and set the appropriate layout milestones in + WebCore based on old delegates having implementations. + (-[WebView _cacheFrameLoadDelegateImplementations]): + + Call into WebCore. + (-[WebView _listenForLayoutMilestones:]): + (-[WebView _layoutMilestones]): + * WebView/WebViewInternal.h: + * WebView/WebViewPrivate.h: + 2012-09-24 Benjamin Poulain <bpoulain@apple.com> Fix Geolocation error reporting in the test support diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h index 3c1a40590..ccd751572 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.h @@ -108,8 +108,7 @@ private: virtual void dispatchDidFailLoad(const WebCore::ResourceError&) OVERRIDE; virtual void dispatchDidFinishDocumentLoad() OVERRIDE; virtual void dispatchDidFinishLoad() OVERRIDE; - virtual void dispatchDidFirstLayout() OVERRIDE; - virtual void dispatchDidFirstVisuallyNonEmptyLayout() OVERRIDE; + virtual void dispatchDidLayout(WebCore::LayoutMilestones) OVERRIDE; virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&) OVERRIDE; virtual void dispatchShow() OVERRIDE; diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index 64e44a4d0..eca8d2df0 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -662,29 +662,36 @@ void WebFrameLoaderClient::dispatchDidFinishLoad() [m_webFrame->_private->internalLoadDelegate webFrame:m_webFrame.get() didFinishLoadWithError:nil]; } -void WebFrameLoaderClient::dispatchDidFirstLayout() +void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones) { WebView *webView = getWebView(m_webFrame.get()); WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); - if (implementations->didFirstLayoutInFrameFunc) - CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get()); - - // See WebFrameLoaderClient::provisionalLoadStarted. - WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView]; - if ([getWebView(m_webFrame.get()) drawsBackground]) - [scrollView setDrawsBackground:YES]; + + if (implementations->didLayoutFunc) + CallFrameLoadDelegate(implementations->didLayoutFunc, webView, @selector(webView:didLayout:), kitLayoutMilestones(milestones)); + + if (milestones & DidFirstLayout) { + // FIXME: We should consider removing the old didFirstLayout API since this is doing double duty with the + // new didLayout API. + if (implementations->didFirstLayoutInFrameFunc) + CallFrameLoadDelegate(implementations->didFirstLayoutInFrameFunc, webView, @selector(webView:didFirstLayoutInFrame:), m_webFrame.get()); + + // See WebFrameLoaderClient::provisionalLoadStarted. + WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView]; + if ([getWebView(m_webFrame.get()) drawsBackground]) + [scrollView setDrawsBackground:YES]; #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 - [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic]; - [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic]; + [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic]; + [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic]; #endif -} + } -void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() -{ - WebView *webView = getWebView(m_webFrame.get()); - WebFrameLoadDelegateImplementationCache* implementations = WebViewGetFrameLoadDelegateImplementations(webView); - if (implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc) - CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get()); + if (milestones & DidFirstVisuallyNonEmptyLayout) { + // FIXME: We should consider removing the old didFirstVisuallyNonEmptyLayoutForFrame API since this is doing + // double duty with the new didLayout API. + if (implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc) + CallFrameLoadDelegate(implementations->didFirstVisuallyNonEmptyLayoutInFrameFunc, webView, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:), m_webFrame.get()); + } } Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction&) diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index 102ceff38..e25bb44f5 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -132,6 +132,7 @@ void InitWebCoreSystemInterface(void) INIT(CreateCTTypesetterWithUniCharProviderAndOptions); INIT(RecommendedScrollerStyle); INIT(ExecutableWasLinkedOnOrBeforeSnowLeopard); + INIT(SetCrashReportApplicationSpecificInformation); INIT(CopyDefaultSearchProviderDisplayName); INIT(AVAssetResolvedURL); INIT(Cursor); diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h index 29a43880a..5c1b33e97 100644 --- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h +++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.h @@ -73,6 +73,7 @@ struct WebFrameLoadDelegateImplementationCache { IMP didFinishLoadForFrameFunc; IMP didFirstLayoutInFrameFunc; IMP didFirstVisuallyNonEmptyLayoutInFrameFunc; + IMP didLayoutFunc; IMP didReceiveIconForFrameFunc; IMP didFinishDocumentLoadForFrameFunc; IMP didDisplayInsecureContentFunc; @@ -123,6 +124,7 @@ BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL); BOOL CallUIDelegateReturningBoolean(BOOL, WebView *, SEL, id, BOOL, id); id CallFrameLoadDelegate(IMP, WebView *, SEL); +id CallFrameLoadDelegate(IMP, WebView *, SEL, NSUInteger); id CallFrameLoadDelegate(IMP, WebView *, SEL, id); id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id); id CallFrameLoadDelegate(IMP, WebView *, SEL, id, id, id); diff --git a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm index 3c3e3c9b3..aac4cbfb0 100644 --- a/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm +++ b/Source/WebKit/mac/WebView/WebDelegateImplementationCaching.mm @@ -248,6 +248,18 @@ static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SE return nil; } +static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, NSUInteger integer) +{ + if (!delegate) + return nil; + @try { + return implementation(delegate, selector, self, integer); + } @catch(id exception) { + ReportDiscardedDelegateException(selector, exception); + } + return nil; +} + static inline id CallDelegate(IMP implementation, WebView *self, id delegate, SEL selector, id object) { if (!delegate) @@ -450,6 +462,11 @@ id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector) return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector); } +id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, NSUInteger integer) +{ + return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, integer); +} + id CallFrameLoadDelegate(IMP implementation, WebView *self, SEL selector, id object) { return CallDelegate(implementation, self, self->_private->frameLoadDelegate, selector, object); diff --git a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h index 847956d51..cb798b3c3 100644 --- a/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferenceKeysPrivate.h @@ -126,6 +126,7 @@ #define WebKitRequestAnimationFrameEnabledPreferenceKey @"WebKitRequestAnimationFrameEnabled" #define WebKitDiagnosticLoggingEnabledKey @"WebKitDiagnosticLoggingEnabled" #define WebKitScreenFontSubstitutionEnabledKey @"WebKitScreenFontSubstitutionEnabled" +#define WebKitStorageBlockingPolicyKey @"WebKitStorageBlockingPolicy" // These are private both because callers should be using the cover methods and because the // cover methods themselves are private. diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index 8c2ea6ac5..7c44824f5 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -399,7 +399,13 @@ public: [NSNumber numberWithBool:YES], WebKitRequestAnimationFrameEnabledPreferenceKey, [NSNumber numberWithBool:NO], WebKitWantsBalancedSetDefersLoadingBehaviorKey, [NSNumber numberWithBool:NO], WebKitDiagnosticLoggingEnabledKey, - [NSNumber numberWithBool:YES], WebKitScreenFontSubstitutionEnabledKey, +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + [NSNumber numberWithBool:NO], +#else + [NSNumber numberWithBool:YES], +#endif + WebKitScreenFontSubstitutionEnabledKey, + [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota, [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota, @@ -1750,6 +1756,16 @@ static NSString *classIBCreatorID = nil; [self _setBoolValue:enabled forKey:WebKitScreenFontSubstitutionEnabledKey]; } +- (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy +{ + [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey]; +} + +- (WebStorageBlockingPolicy)storageBlockingPolicy +{ + return static_cast<WebStorageBlockingPolicy>([self _integerValueForKey:WebKitStorageBlockingPolicyKey]); +} + @end @implementation WebPreferences (WebInternal) diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 1f362fef4..39017172f 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -43,6 +43,12 @@ typedef enum { WebTextDirectionSubmenuAlwaysIncluded } WebTextDirectionSubmenuInclusionBehavior; +typedef enum { + WebAllowAllStorage = 0, + WebBlockThirdPartyStorage, + WebBlockAllStorage +} WebStorageBlockingPolicy; + extern NSString *WebPreferencesChangedNotification; extern NSString *WebPreferencesRemovedNotification; extern NSString *WebPreferencesChangedInternalNotification; @@ -308,4 +314,7 @@ extern NSString *WebPreferencesCacheModelChangedInternalNotification; - (BOOL)screenFontSubstitutionEnabled; - (void)setScreenFontSubstitutionEnabled:(BOOL)enabled; +- (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy; +- (WebStorageBlockingPolicy)storageBlockingPolicy; + @end diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index 80d54174c..457d4062a 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -392,6 +392,20 @@ FindOptions coreOptions(WebFindOptions options) | (options & WebFindOptionsStartInSelection ? StartInSelection : 0); } +LayoutMilestones coreLayoutMilestones(WebLayoutMilestones milestones) +{ + return (milestones & WebDidFirstLayout ? DidFirstLayout : 0) + | (milestones & WebDidFirstVisuallyNonEmptyLayout ? DidFirstVisuallyNonEmptyLayout : 0) + | (milestones & WebDidHitRelevantRepaintedObjectsAreaThreshold ? DidHitRelevantRepaintedObjectsAreaThreshold : 0); +} + +WebLayoutMilestones kitLayoutMilestones(LayoutMilestones milestones) +{ + return (milestones & DidFirstLayout ? WebDidFirstLayout : 0) + | (milestones & DidFirstVisuallyNonEmptyLayout ? WebDidFirstVisuallyNonEmptyLayout : 0) + | (milestones & DidHitRelevantRepaintedObjectsAreaThreshold ? WebDidHitRelevantRepaintedObjectsAreaThreshold : 0); +} + @interface WebView (WebFileInternal) - (float)_deviceScaleFactor; - (BOOL)_isLoading; @@ -1430,7 +1444,12 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setUsesEncodingDetector([preferences usesEncodingDetector]); settings->setFantasyFontFamily([preferences fantasyFontFamily]); settings->setFixedFontFamily([preferences fixedFontFamily]); - settings->setScreenFontSubstitutionEnabled([preferences screenFontSubstitutionEnabled]); + settings->setScreenFontSubstitutionEnabled( +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 + [[NSUserDefaults standardUserDefaults] boolForKey:@"NSFontDefaultScreenFontSubstitutionEnabled"] || +#endif + [preferences screenFontSubstitutionEnabled] + ); settings->setForceFTPDirectoryListings([preferences _forceFTPDirectoryListings]); settings->setFTPDirectoryTemplatePath([preferences _ftpDirectoryTemplatePath]); settings->setLocalStorageDatabasePath([preferences _localStorageDatabasePath]); @@ -1549,6 +1568,18 @@ static bool needsSelfRetainWhileLoadingQuirk() settings->setNeedsDidFinishLoadOrderQuirk(needsDidFinishLoadOrderQuirk()); settings->setDiagnosticLoggingEnabled([preferences diagnosticLoggingEnabled]); + switch ([preferences storageBlockingPolicy]) { + case WebAllowAllStorage: + settings->setStorageBlockingPolicy(SecurityOrigin::AllowAllStorage); + break; + case WebBlockThirdPartyStorage: + settings->setStorageBlockingPolicy(SecurityOrigin::BlockThirdPartyStorage); + break; + case WebBlockAllStorage: + settings->setStorageBlockingPolicy(SecurityOrigin::BlockAllStorage); + break; + } + // We have enabled this setting in WebKit2 for the sake of some ScrollingCoordinator work. // To avoid possible rendering differences, we should enable it for WebKit1 too. settings->setFixedPositionCreatesStackingContext(true); @@ -1623,6 +1654,7 @@ static inline IMP getMethod(id o, SEL s) cache->didFinishLoadForFrameFunc = getMethod(delegate, @selector(webView:didFinishLoadForFrame:)); cache->didFirstLayoutInFrameFunc = getMethod(delegate, @selector(webView:didFirstLayoutInFrame:)); cache->didFirstVisuallyNonEmptyLayoutInFrameFunc = getMethod(delegate, @selector(webView:didFirstVisuallyNonEmptyLayoutInFrame:)); + cache->didLayoutFunc = getMethod(delegate, @selector(webView:didLayout:)); cache->didHandleOnloadEventsForFrameFunc = getMethod(delegate, @selector(webView:didHandleOnloadEventsForFrame:)); cache->didReceiveIconForFrameFunc = getMethod(delegate, @selector(webView:didReceiveIcon:forFrame:)); cache->didReceiveServerRedirectForProvisionalLoadForFrameFunc = getMethod(delegate, @selector(webView:didReceiveServerRedirectForProvisionalLoadForFrame:)); @@ -1634,6 +1666,19 @@ static inline IMP getMethod(id o, SEL s) cache->didDisplayInsecureContentFunc = getMethod(delegate, @selector(webViewDidDisplayInsecureContent:)); cache->didRunInsecureContentFunc = getMethod(delegate, @selector(webView:didRunInsecureContent:)); cache->didDetectXSSFunc = getMethod(delegate, @selector(webView:didDetectXSS:)); + + // It would be nice to get rid of this code and transition all clients to using didLayout instead of + // didFirstLayoutInFrame and didFirstVisuallyNonEmptyLayoutInFrame. In the meantime, this is required + // for backwards compatibility. + Page* page = core(self); + if (page) { + unsigned milestones = 0; + if (cache->didFirstLayoutInFrameFunc) + milestones |= DidFirstLayout; + if (cache->didFirstVisuallyNonEmptyLayoutInFrameFunc) + milestones |= DidFirstVisuallyNonEmptyLayout; + page->addLayoutMilestones(static_cast<LayoutMilestones>(milestones)); + } } - (void)_cacheScriptDebugDelegateImplementations @@ -2863,6 +2908,24 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) return WebPaginationModeUnpaginated; } +- (void)_listenForLayoutMilestones:(WebLayoutMilestones)layoutMilestones +{ + Page* page = core(self); + if (!page) + return; + + page->addLayoutMilestones(coreLayoutMilestones(layoutMilestones)); +} + +- (WebLayoutMilestones)_layoutMilestones +{ + Page* page = core(self); + if (!page) + return 0; + + return kitLayoutMilestones(page->layoutMilestones()); +} + - (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns { Page* page = core(self); diff --git a/Source/WebKit/mac/WebView/WebViewInternal.h b/Source/WebKit/mac/WebView/WebViewInternal.h index c0525742e..a43ef3a98 100644 --- a/Source/WebKit/mac/WebView/WebViewInternal.h +++ b/Source/WebKit/mac/WebView/WebViewInternal.h @@ -37,6 +37,7 @@ #import <WebCore/AlternativeTextClient.h> #import <WebCore/FindOptions.h> #import <WebCore/FloatRect.h> +#import <WebCore/LayoutMilestones.h> #import <WebCore/TextAlternativeWithRange.h> #import <WebCore/WebCoreKeyboardUIMode.h> @@ -65,6 +66,9 @@ struct DictationAlternative; WebCore::FindOptions coreOptions(WebFindOptions options); +WebCore::LayoutMilestones coreLayoutMilestones(WebLayoutMilestones); +WebLayoutMilestones kitLayoutMilestones(WebCore::LayoutMilestones); + #if USE(DICTATION_ALTERNATIVES) OBJC_CLASS NSTextAlternatives; #endif diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index c46d35e12..e19260478 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -108,6 +108,13 @@ typedef enum { WebPaginationModeBottomToTop, } WebPaginationMode; +enum { + WebDidFirstLayout = 1 << 0, + WebDidFirstVisuallyNonEmptyLayout = 1 << 1, + WebDidHitRelevantRepaintedObjectsAreaThreshold = 1 << 2 +}; +typedef NSUInteger WebLayoutMilestones; + // This needs to be in sync with WebCore::NotificationClient::Permission typedef enum { WebNotificationPermissionAllowed, @@ -566,6 +573,9 @@ Could be worth adding to the API. - (void)_setPaginationMode:(WebPaginationMode)paginationMode; - (WebPaginationMode)_paginationMode; +- (void)_listenForLayoutMilestones:(WebLayoutMilestones)layoutMilestones; +- (WebLayoutMilestones)_layoutMilestones; + // Whether the column-break-{before,after} properties are respected instead of the // page-break-{before,after} properties. - (void)_setPaginationBehavesLikeColumns:(BOOL)behavesLikeColumns; @@ -759,6 +769,8 @@ Could be worth adding to the API. - (void)webView:(WebView *)sender didFirstVisuallyNonEmptyLayoutInFrame:(WebFrame *)frame; +- (void)webView:(WebView *)sender didLayout:(WebLayoutMilestones)milestones; + // For implementing the WebInspector's test harness - (void)webView:(WebView *)webView didClearInspectorWindowObject:(WebScriptObject *)windowObject forFrame:(WebFrame *)frame; diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index a327eaf2e..5a844be3d 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -358,6 +358,8 @@ QWebPagePrivate::QWebPagePrivate(QWebPage *qq) // as expected out of the box, we use a default group similar to what other ports are doing. page->setGroupName("Default Group"); + page->addLayoutMilestones(DidFirstVisuallyNonEmptyLayout); + settings = new QWebSettings(page->settings()); history.d = new QWebHistoryPrivate(static_cast<WebCore::BackForwardListImpl*>(page->backForwardList())); diff --git a/Source/WebKit/qt/Api/qwebsettings.cpp b/Source/WebKit/qt/Api/qwebsettings.cpp index b77b1c4ee..ebecc7f5d 100644 --- a/Source/WebKit/qt/Api/qwebsettings.cpp +++ b/Source/WebKit/qt/Api/qwebsettings.cpp @@ -670,14 +670,18 @@ void QWebSettings::setIconDatabasePath(const QString& path) WebCore::IconDatabase::delayDatabaseCleanup(); + WebCore::IconDatabaseBase& db = WebCore::iconDatabase(); + if (!path.isEmpty()) { - WebCore::iconDatabase().setEnabled(true); + db.setEnabled(true); + if (db.isOpen()) + db.close(); QFileInfo info(path); if (info.isDir() && info.isWritable()) - WebCore::iconDatabase().open(path, WebCore::IconDatabase::defaultDatabaseFilename()); + db.open(path, WebCore::IconDatabase::defaultDatabaseFilename()); } else { - WebCore::iconDatabase().setEnabled(false); - WebCore::iconDatabase().close(); + db.setEnabled(false); + db.close(); } } diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index 3d7cedaa7..612b867d2 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,78 @@ +2012-09-26 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Remove Qt Quick 1 support + + Reviewed by Kenneth Rohde Christiansen. + + It is being moved to the Qt5 QtQuick1 module. + + A circular dependency exists otherwise in Qt, where QtWebKit would depend on QtQuick1, + which in turn depends on QtTools (for designer plugin), which in turn depends on QtWebKit + (for assistant help html rendering). + + * declarative/plugin.cpp: + (WebKitQmlPlugin::registerTypes): + * declarative/public.pri: + * declarative/qdeclarativewebview.cpp: Removed. + * declarative/qdeclarativewebview_p.h: Removed. + * tests/qdeclarativewebview/qdeclarativewebview.pro: Removed. + * tests/qdeclarativewebview/resources/basic.html: Removed. + * tests/qdeclarativewebview/resources/basic.png: Removed. + * tests/qdeclarativewebview/resources/basic.qml: Removed. + * tests/qdeclarativewebview/resources/elements.html: Removed. + * tests/qdeclarativewebview/resources/elements.qml: Removed. + * tests/qdeclarativewebview/resources/forward.html: Removed. + * tests/qdeclarativewebview/resources/forward.png: Removed. + * tests/qdeclarativewebview/resources/javaScript.html: Removed. + * tests/qdeclarativewebview/resources/javaScript.qml: Removed. + * tests/qdeclarativewebview/resources/loadError.qml: Removed. + * tests/qdeclarativewebview/resources/newwindows.html: Removed. + * tests/qdeclarativewebview/resources/newwindows.qml: Removed. + * tests/qdeclarativewebview/resources/propertychanges.qml: Removed. + * tests/qdeclarativewebview/resources/sample.html: Removed. + * tests/qdeclarativewebview/resources/sethtml.qml: Removed. + * tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml: Removed. + * tests/qdeclarativewebview/resources/webviewtest.qml: Removed. + * tests/qdeclarativewebview/resources/webviewtestdefault.qml: Removed. + * tests/qdeclarativewebview/tst_qdeclarativewebview.cpp: Removed. + * tests/qdeclarativewebview/tst_qdeclarativewebview.qrc: Removed. + +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestoneOptions) + * WebCoreSupport/FrameLoaderClientQt.cpp: + (WebCore::FrameLoaderClientQt::dispatchDidLayout): + * WebCoreSupport/FrameLoaderClientQt.h: + (FrameLoaderClientQt): + + It is now necessary to opt into getting any of the + "layout milestone" notifications. + * Api/qwebpage.cpp: + (QWebPagePrivate::QWebPagePrivate): + +2012-09-25 Simon Hausmann <simon.hausmann@digia.com> + + [Qt] Fix failing assertion when calling QWebSettings::setIconDatabasePath multiple times + + Reviewed by Jocelyn Turcotte. + + This happens in various auto-tests. We can implement this by closing the database before + opening it with the new path. + + * Api/qwebsettings.cpp: + (QWebSettings::setIconDatabasePath): + 2012-09-24 Benjamin Poulain <bpoulain@apple.com> Fix Geolocation error reporting in the test support diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp index bcf072d65..3320ea755 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp @@ -527,14 +527,12 @@ void FrameLoaderClientQt::dispatchDidFinishLoad() emitLoadFinished(true); } - -void FrameLoaderClientQt::dispatchDidFirstLayout() +void FrameLoaderClientQt::dispatchDidLayout(LayoutMilestones milestones) { -} + if (!m_webFrame) + return; -void FrameLoaderClientQt::dispatchDidFirstVisuallyNonEmptyLayout() -{ - if (m_webFrame) + if (milestones & DidFirstVisuallyNonEmptyLayout) emit m_webFrame->initialLayoutCompleted(); } diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h index 4a636a049..542129238 100644 --- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h +++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.h @@ -123,8 +123,7 @@ public: virtual void dispatchDidFailLoad(const WebCore::ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(WebCore::LayoutMilestones); virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); diff --git a/Source/WebKit/qt/declarative/plugin.cpp b/Source/WebKit/qt/declarative/plugin.cpp index db748952a..56eac632d 100644 --- a/Source/WebKit/qt/declarative/plugin.cpp +++ b/Source/WebKit/qt/declarative/plugin.cpp @@ -21,10 +21,6 @@ #include "qglobal.h" -#if defined(HAVE_QQUICK1) -#include "qdeclarativewebview_p.h" -#endif - #include <QtQml/qqml.h> #include <QtQml/qqmlextensionplugin.h> @@ -56,15 +52,6 @@ public: virtual void registerTypes(const char* uri) { Q_ASSERT(QLatin1String(uri) == QLatin1String("QtWebKit")); -#if defined(HAVE_QQUICK1) - qmlRegisterType<QDeclarativeWebSettings>(); - qmlRegisterType<QDeclarativeWebView>(uri, 1, 0, "WebView"); -#ifdef Q_REVISION - qmlRegisterType<QDeclarativeWebView>(uri, 1, 1, "WebView"); - qmlRegisterRevision<QDeclarativeWebView, 0>("QtWebKit", 1, 0); - qmlRegisterRevision<QDeclarativeWebView, 1>("QtWebKit", 1, 1); -#endif -#endif #if defined(HAVE_WEBKIT2) qmlRegisterType<QQuickWebView>(uri, 3, 0, "WebView"); diff --git a/Source/WebKit/qt/declarative/public.pri b/Source/WebKit/qt/declarative/public.pri index 754284b6c..ee233eb5d 100644 --- a/Source/WebKit/qt/declarative/public.pri +++ b/Source/WebKit/qt/declarative/public.pri @@ -26,11 +26,6 @@ wince*:LIBS += $$QMAKE_LIBS_GUI QT += webkit webkit-private widgets quick quick-private -have?(QQUICK1) { - SOURCES += qdeclarativewebview.cpp - HEADERS += qdeclarativewebview_p.h -} - WEBKIT += wtf DESTDIR = $${ROOT_BUILD_DIR}/imports/$${TARGET.module_name} diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp b/Source/WebKit/qt/declarative/qdeclarativewebview.cpp deleted file mode 100644 index cdfcf53b8..000000000 --- a/Source/WebKit/qt/declarative/qdeclarativewebview.cpp +++ /dev/null @@ -1,1101 +0,0 @@ -/* - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#include "qdeclarativewebview_p.h" - -#include <QApplication> -#include <QGraphicsSceneMouseEvent> -#include <QtCore/QDebug> -#include <QtCore/QEvent> -#include <QtCore/QFile> -#include <QtDeclarative/QDeclarativeContext> -#include <QtDeclarative/QDeclarativeEngine> -#include <QtDeclarative/qdeclarative.h> -#include <QtGui/QKeyEvent> -#include <QtGui/QMouseEvent> -#include <QtGui/QPen> -#include "qwebelement.h" -#include "qwebframe.h" -#include "qwebpage.h" -#include "qwebsettings.h" - -QT_BEGIN_NAMESPACE - -class QDeclarativeWebViewPrivate { -public: - QDeclarativeWebViewPrivate(QDeclarativeWebView* qq) - : q(qq) - , preferredwidth(0) - , preferredheight(0) - , progress(1.0) - , status(QDeclarativeWebView::Null) - , pending(PendingNone) - , newWindowComponent(0) - , newWindowParent(0) - , rendering(true) - { - } - - QDeclarativeWebView* q; - - QUrl url; // page url might be different if it has not loaded yet - GraphicsWebView* view; - - int preferredwidth, preferredheight; - qreal progress; - QDeclarativeWebView::Status status; - QString statusText; - enum { PendingNone, PendingUrl, PendingHtml, PendingContent } pending; - QUrl pendingUrl; - QString pendingString; - QByteArray pendingData; - mutable QDeclarativeWebSettings settings; - QDeclarativeComponent* newWindowComponent; - QDeclarativeItem* newWindowParent; - - static void windowObjectsAppend(QDeclarativeListProperty<QObject>* prop, QObject* o) - { - static_cast<QDeclarativeWebViewPrivate*>(prop->data)->windowObjects.append(o); - static_cast<QDeclarativeWebViewPrivate*>(prop->data)->updateWindowObjects(); - } - - void updateWindowObjects(); - QObjectList windowObjects; - - bool rendering; -}; - -GraphicsWebView::GraphicsWebView(QDeclarativeWebView* parent) - : QGraphicsWebView(parent) - , parent(parent) - , pressTime(400) -{ -} - -void GraphicsWebView::mousePressEvent(QGraphicsSceneMouseEvent* event) -{ - pressPoint = event->pos(); - if (pressTime) { - pressTimer.start(pressTime, this); - parent->setKeepMouseGrab(false); - } else { - grabMouse(); - parent->setKeepMouseGrab(true); - } - QGraphicsWebView::mousePressEvent(event); - - QWebHitTestResult hit = page()->mainFrame()->hitTestContent(pressPoint.toPoint()); - if (hit.isContentEditable()) - parent->forceActiveFocus(); - setFocus(); -} - -void GraphicsWebView::mouseReleaseEvent(QGraphicsSceneMouseEvent* event) -{ - QGraphicsWebView::mouseReleaseEvent(event); - pressTimer.stop(); - parent->setKeepMouseGrab(false); - ungrabMouse(); -} - -void GraphicsWebView::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event) -{ - QMouseEvent* me = new QMouseEvent(QEvent::MouseButtonDblClick, (event->pos() / parent->contentsScale()).toPoint(), event->button(), event->buttons(), 0); - emit doubleClick(event->pos().x(), event->pos().y()); - delete me; -} - -void GraphicsWebView::timerEvent(QTimerEvent* event) -{ - if (event->timerId() == pressTimer.timerId()) { - pressTimer.stop(); - grabMouse(); - parent->setKeepMouseGrab(true); - } -} - -void GraphicsWebView::mouseMoveEvent(QGraphicsSceneMouseEvent* event) -{ - if (pressTimer.isActive()) { - if ((event->pos() - pressPoint).manhattanLength() > QApplication::startDragDistance()) - pressTimer.stop(); - } - if (parent->keepMouseGrab()) - QGraphicsWebView::mouseMoveEvent(event); -} - -bool GraphicsWebView::sceneEvent(QEvent *event) -{ - bool rv = QGraphicsWebView::sceneEvent(event); - if (event->type() == QEvent::UngrabMouse) { - pressTimer.stop(); - parent->setKeepMouseGrab(false); - } - return rv; -} - -/*! - \qmltype WebView - \instantiates QDeclarativeWebView - \inqmlmodule QtWebKit 1.0 - \ingroup qml-view-elements - \since 4.7 - \brief The WebView item allows you to add Web content to a canvas. - \inherits Item - - A WebView renders Web content based on a URL. - - This type is made available by importing the \c QtWebKit module: - - \b{import QtWebKit 1.0} - - The WebView item includes no scrolling, scaling, toolbars, or other common browser - components. These must be implemented around WebView. See the \l{QML Web Browser} - example for a demonstration of this. - - The page to be displayed by the item is specified using the \l url property, - and this can be changed to fetch and display a new page. While the page loads, - the \l progress property is updated to indicate how much of the page has been - loaded. - - \section1 Appearance - - If the width and height of the item is not set, they will dynamically adjust - to a size appropriate for the content. This width may be large for typical - online web pages, typically greater than 800 by 600 pixels. - - If the \l{Item::}{width} or \l{Item::}{height} is explictly set, the rendered Web site will be - clipped, not scaled, to fit into the set dimensions. - - If the preferredWidth property is set, the width will be this amount or larger, - usually laying out the Web content to fit the preferredWidth. - - The appearance of the content can be controlled to a certain extent by changing - the settings.standardFontFamily property and other settings related to fonts. - - The page can be zoomed by calling the heuristicZoom() method, which performs a - series of tests to determine whether zoomed content will be displayed in an - appropriate way in the space allocated to the item. - - \section1 User Interaction and Navigation - - By default, certain mouse and touch events are delivered to other items in - preference to the Web content. For example, when a scrolling view is created - by placing a WebView in a Flickable, move events are delivered to the Flickable - so that the user can scroll the page. This prevents the user from accidentally - selecting text in a Web page instead of scrolling. - - The pressGrabTime property defines the time the user must touch or press a - mouse button over the WebView before the Web content will receive the move - events it needs to select text and images. - - When this item has keyboard focus, all keyboard input will be sent directly to - the Web page within. - - When the navigates by clicking on links, the item records the pages visited - in its internal history - - Because this item is designed to be used as a component in a browser, it - exposes \l{Action}{actions} for \l back, \l forward, \l reload and \l stop. - These can be triggered to change the current page displayed by the item. - - \section1 Example Usage - - \beginfloatright - \inlineimage webview.png - \endfloat - - The following example displays a scaled down Web page at a fixed size. - - \snippet doc/src/snippets/declarative/webview/webview.qml document - - \clearfloat - - \sa {declarative/modelviews/webview}{WebView example}, {demos/declarative/webbrowser}{Web Browser demo} -*/ - -/*! - \internal - \class QDeclarativeWebView - \brief The QDeclarativeWebView class allows you to add web content to a QDeclarativeView. - - A WebView renders web content base on a URL. - - \image webview.png - - The item includes no scrolling, scaling, - toolbars, etc., those must be implemented around WebView. See the WebBrowser example - for a demonstration of this. - - A QDeclarativeWebView object can be instantiated in Qml using the tag \l WebView. -*/ - -QDeclarativeWebView::QDeclarativeWebView(QDeclarativeItem *parent) : QDeclarativeItem(parent) -{ - init(); -} - -QDeclarativeWebView::~QDeclarativeWebView() -{ - delete d; -} - -void QDeclarativeWebView::init() -{ - d = new QDeclarativeWebViewPrivate(this); - - if (QWebSettings::iconDatabasePath().isNull() && - QWebSettings::globalSettings()->localStoragePath().isNull() && - QWebSettings::offlineStoragePath().isNull() && - QWebSettings::offlineWebApplicationCachePath().isNull()) - QWebSettings::enablePersistentStorage(); - - setAcceptedMouseButtons(Qt::LeftButton); - setFlag(QGraphicsItem::ItemHasNoContents, true); - setFlag(QGraphicsItem::ItemIsFocusScope, true); - setClip(true); - - d->view = new GraphicsWebView(this); - d->view->setResizesToContents(true); - d->view->setFocus(); - QWebPage* wp = new QDeclarativeWebPage(this); - setPage(wp); - if (!preferredWidth()) - setPreferredWidth(d->view->preferredWidth()); - if (!preferredHeight()) - setPreferredHeight(d->view->preferredHeight()); - connect(d->view, SIGNAL(geometryChanged()), this, SLOT(updateDeclarativeWebViewSize())); - connect(d->view, SIGNAL(doubleClick(int, int)), this, SIGNAL(doubleClick(int, int))); - connect(d->view, SIGNAL(scaleChanged()), this, SIGNAL(contentsScaleChanged())); -} - -void QDeclarativeWebView::componentComplete() -{ - QDeclarativeItem::componentComplete(); - page()->setNetworkAccessManager(qmlEngine(this)->networkAccessManager()); - - switch (d->pending) { - case QDeclarativeWebViewPrivate::PendingUrl: - setUrl(d->pendingUrl); - break; - case QDeclarativeWebViewPrivate::PendingHtml: - setHtml(d->pendingString, d->pendingUrl); - break; - case QDeclarativeWebViewPrivate::PendingContent: - setContent(d->pendingData, d->pendingString, d->pendingUrl); - break; - default: - break; - } - d->pending = QDeclarativeWebViewPrivate::PendingNone; - d->updateWindowObjects(); -} - -QDeclarativeWebView::Status QDeclarativeWebView::status() const -{ - return d->status; -} - - -/*! - \qmlproperty real WebView::progress - This property holds the progress of loading the current URL, from 0 to 1. - - If you just want to know when progress gets to 1, use - WebView::onLoadFinished() or WebView::onLoadFailed() instead. -*/ -qreal QDeclarativeWebView::progress() const -{ - return d->progress; -} - -void QDeclarativeWebView::doLoadStarted() -{ - if (!d->url.isEmpty()) { - d->status = Loading; - emit statusChanged(d->status); - } - emit loadStarted(); -} - -void QDeclarativeWebView::doLoadProgress(int p) -{ - if (d->progress == p / 100.0) - return; - d->progress = p / 100.0; - emit progressChanged(); -} - -void QDeclarativeWebView::pageUrlChanged() -{ - updateContentsSize(); - - if ((d->url.isEmpty() && page()->mainFrame()->url() != QUrl(QLatin1String("about:blank"))) - || (d->url != page()->mainFrame()->url() && !page()->mainFrame()->url().isEmpty())) - { - d->url = page()->mainFrame()->url(); - if (d->url == QUrl(QLatin1String("about:blank"))) - d->url = QUrl(); - emit urlChanged(); - } -} - -void QDeclarativeWebView::doLoadFinished(bool ok) -{ - if (ok) { - d->status = d->url.isEmpty() ? Null : Ready; - emit loadFinished(); - } else { - d->status = Error; - emit loadFailed(); - } - emit statusChanged(d->status); -} - -/*! - \qmlproperty url WebView::url - This property holds the URL to the page displayed in this item. It can be set, - but also can change spontaneously (eg. because of network redirection). - - If the url is empty, the page is blank. - - The url is always absolute (QML will resolve relative URL strings in the context - of the containing QML document). -*/ -QUrl QDeclarativeWebView::url() const -{ - return d->url; -} - -void QDeclarativeWebView::setUrl(const QUrl& url) -{ - if (url == d->url) - return; - - if (isComponentComplete()) { - d->url = url; - updateContentsSize(); - QUrl seturl = url; - if (seturl.isEmpty()) - seturl = QUrl(QLatin1String("about:blank")); - - Q_ASSERT(!seturl.isRelative()); - - page()->mainFrame()->load(seturl); - - emit urlChanged(); - } else { - d->pending = d->PendingUrl; - d->pendingUrl = url; - } -} - -/*! - \qmlproperty int WebView::preferredWidth - This property holds the ideal width for displaying the current URL. -*/ -int QDeclarativeWebView::preferredWidth() const -{ - return d->preferredwidth; -} - -void QDeclarativeWebView::setPreferredWidth(int width) -{ - if (d->preferredwidth == width) - return; - d->preferredwidth = width; - updateContentsSize(); - emit preferredWidthChanged(); -} - -/*! - \qmlproperty int WebView::preferredHeight - This property holds the ideal height for displaying the current URL. - This only affects the area zoomed by heuristicZoom(). -*/ -int QDeclarativeWebView::preferredHeight() const -{ - return d->preferredheight; -} - -void QDeclarativeWebView::setPreferredHeight(int height) -{ - if (d->preferredheight == height) - return; - d->preferredheight = height; - updateContentsSize(); - emit preferredHeightChanged(); -} - -/*! - \qmlmethod bool WebView::evaluateJavaScript(string scriptSource) - - Evaluates the \a scriptSource JavaScript inside the context of the - main web frame, and returns the result of the last executed statement. - - Note that this JavaScript does \e not have any access to QML objects - except as made available as windowObjects. -*/ -QVariant QDeclarativeWebView::evaluateJavaScript(const QString& scriptSource) -{ - return this->page()->mainFrame()->evaluateJavaScript(scriptSource); -} - -void QDeclarativeWebView::updateDeclarativeWebViewSize() -{ - QSizeF size = d->view->geometry().size() * contentsScale(); - setImplicitWidth(size.width()); - setImplicitHeight(size.height()); -} - -void QDeclarativeWebView::initialLayout() -{ - // nothing useful to do at this point -} - -void QDeclarativeWebView::updateContentsSize() -{ - if (page()) { - page()->setPreferredContentsSize(QSize( - d->preferredwidth>0 ? d->preferredwidth : width(), - d->preferredheight>0 ? d->preferredheight : height())); - } -} - -void QDeclarativeWebView::geometryChanged(const QRectF& newGeometry, const QRectF& oldGeometry) -{ - QWebPage* webPage = page(); - if (newGeometry.size() != oldGeometry.size() && webPage) { - QSize contentSize = webPage->preferredContentsSize(); - if (widthValid()) - contentSize.setWidth(width()); - if (heightValid()) - contentSize.setHeight(height()); - if (contentSize != webPage->preferredContentsSize()) - webPage->setPreferredContentsSize(contentSize); - } - QDeclarativeItem::geometryChanged(newGeometry, oldGeometry); -} - -/*! - \qmlproperty list<object> WebView::javaScriptWindowObjects - - A list of QML objects to expose to the web page. - - Each object will be added as a property of the web frame's window object. The - property name is controlled by the value of \c WebView.windowObjectName - attached property. - - Exposing QML objects to a web page allows JavaScript executing in the web - page itself to communicate with QML, by reading and writing properties and - by calling methods of the exposed QML objects. - - This example shows how to call into a QML method using a window object. - - \qml - WebView { - javaScriptWindowObjects: QtObject { - WebView.windowObjectName: "qml" - - function qmlCall() { - console.log("This call is in QML!"); - } - } - - html: "<script>window.qml.qmlCall();</script>" - } - \endqml - - The output of the example will be: - \code - This call is in QML! - \endcode - - If Javascript is not enabled for the page, then this property does nothing. -*/ -QDeclarativeListProperty<QObject> QDeclarativeWebView::javaScriptWindowObjects() -{ - return QDeclarativeListProperty<QObject>(this, d, &QDeclarativeWebViewPrivate::windowObjectsAppend); -} - -QDeclarativeWebViewAttached* QDeclarativeWebView::qmlAttachedProperties(QObject* o) -{ - return new QDeclarativeWebViewAttached(o); -} - -void QDeclarativeWebViewPrivate::updateWindowObjects() -{ - if (!q->isComponentCompletePublic() || !q->page()) - return; - - for (int i = 0; i < windowObjects.count(); ++i) { - QObject* object = windowObjects.at(i); - QDeclarativeWebViewAttached* attached = static_cast<QDeclarativeWebViewAttached *>(qmlAttachedPropertiesObject<QDeclarativeWebView>(object)); - if (attached && !attached->windowObjectName().isEmpty()) - q->page()->mainFrame()->addToJavaScriptWindowObject(attached->windowObjectName(), object); - } -} - -bool QDeclarativeWebView::renderingEnabled() const -{ - return d->rendering; -} - -void QDeclarativeWebView::setRenderingEnabled(bool enabled) -{ - if (d->rendering == enabled) - return; - d->rendering = enabled; - emit renderingEnabledChanged(); - d->view->setTiledBackingStoreFrozen(!enabled); -} - -/*! - \qmlsignal WebView::onDoubleClick(int clickx, int clicky) - - The WebView does not pass double-click events to the web engine, but rather - emits this signals. -*/ - -/*! - \qmlmethod bool WebView::heuristicZoom(int clickX, int clickY, real maxzoom) - - Finds a zoom that: - \list - \li shows a whole item - \li includes (\a clickX, \a clickY) - \li fits into the preferredWidth and preferredHeight - \li zooms by no more than \a maxZoom - \li is more than 10% above the current zoom - \endlist - - If such a zoom exists, emits zoomTo(zoom,centerX,centerY) and returns true; otherwise, - no signal is emitted and returns false. -*/ -bool QDeclarativeWebView::heuristicZoom(int clickX, int clickY, qreal maxZoom) -{ - if (contentsScale() >= maxZoom / scale()) - return false; - qreal ozf = contentsScale(); - QRect showArea = elementAreaAt(clickX, clickY, d->preferredwidth / maxZoom, d->preferredheight / maxZoom); - qreal z = qMin(qreal(d->preferredwidth) / showArea.width(), qreal(d->preferredheight) / showArea.height()); - if (z > maxZoom / scale()) - z = maxZoom / scale(); - if (z / ozf > 1.2) { - QRectF r(showArea.left() * z, showArea.top() * z, showArea.width() * z, showArea.height() * z); - emit zoomTo(z, r.x() + r.width() / 2, r.y() + r.height() / 2); - return true; - } - return false; -} - -/*! - \qmlproperty int WebView::pressGrabTime - - The number of milliseconds the user must press before the WebView - starts passing move events through to the Web engine (rather than - letting other QML elements such as a Flickable take them). - - Defaults to 400ms. Set to 0 to always grab and pass move events to - the Web engine. -*/ -int QDeclarativeWebView::pressGrabTime() const -{ - return d->view->pressTime; -} - -void QDeclarativeWebView::setPressGrabTime(int millis) -{ - if (d->view->pressTime == millis) - return; - d->view->pressTime = millis; - emit pressGrabTimeChanged(); -} - -#ifndef QT_NO_ACTION -/*! - \qmlproperty action WebView::back - This property holds the action for causing the previous URL in the history to be displayed. -*/ -QAction* QDeclarativeWebView::backAction() const -{ - return page()->action(QWebPage::Back); -} - -/*! - \qmlproperty action WebView::forward - This property holds the action for causing the next URL in the history to be displayed. -*/ -QAction* QDeclarativeWebView::forwardAction() const -{ - return page()->action(QWebPage::Forward); -} - -/*! - \qmlproperty action WebView::reload - This property holds the action for reloading with the current URL -*/ -QAction* QDeclarativeWebView::reloadAction() const -{ - return page()->action(QWebPage::Reload); -} - -/*! - \qmlproperty action WebView::stop - This property holds the action for stopping loading with the current URL -*/ -QAction* QDeclarativeWebView::stopAction() const -{ - return page()->action(QWebPage::Stop); -} -#endif // QT_NO_ACTION - -/*! - \qmlproperty string WebView::title - This property holds the title of the web page currently viewed - - By default, this property contains an empty string. -*/ -QString QDeclarativeWebView::title() const -{ - return page()->mainFrame()->title(); -} - -/*! - \qmlproperty pixmap WebView::icon - This property holds the icon associated with the web page currently viewed -*/ -QPixmap QDeclarativeWebView::icon() const -{ - return page()->mainFrame()->icon().pixmap(QSize(256, 256)); -} - -/*! - \qmlproperty string WebView::statusText - - This property is the current status suggested by the current web page. In a web browser, - such status is often shown in some kind of status bar. -*/ -void QDeclarativeWebView::setStatusText(const QString& text) -{ - d->statusText = text; - emit statusTextChanged(); -} - -void QDeclarativeWebView::windowObjectCleared() -{ - d->updateWindowObjects(); -} - -QString QDeclarativeWebView::statusText() const -{ - return d->statusText; -} - -QWebPage* QDeclarativeWebView::page() const -{ - return d->view->page(); -} - -// The QObject interface to settings(). -/*! - \qmlproperty string WebView::settings.standardFontFamily - \qmlproperty string WebView::settings.fixedFontFamily - \qmlproperty string WebView::settings.serifFontFamily - \qmlproperty string WebView::settings.sansSerifFontFamily - \qmlproperty string WebView::settings.cursiveFontFamily - \qmlproperty string WebView::settings.fantasyFontFamily - - \qmlproperty int WebView::settings.minimumFontSize - \qmlproperty int WebView::settings.minimumLogicalFontSize - \qmlproperty int WebView::settings.defaultFontSize - \qmlproperty int WebView::settings.defaultFixedFontSize - - \qmlproperty bool WebView::settings.autoLoadImages - \qmlproperty bool WebView::settings.javascriptEnabled - \qmlproperty bool WebView::settings.javaEnabled - \qmlproperty bool WebView::settings.pluginsEnabled - \qmlproperty bool WebView::settings.privateBrowsingEnabled - \qmlproperty bool WebView::settings.javascriptCanOpenWindows - \qmlproperty bool WebView::settings.javascriptCanAccessClipboard - \qmlproperty bool WebView::settings.developerExtrasEnabled - \qmlproperty bool WebView::settings.linksIncludedInFocusChain - \qmlproperty bool WebView::settings.zoomTextOnly - \qmlproperty bool WebView::settings.printElementBackgrounds - \qmlproperty bool WebView::settings.offlineStorageDatabaseEnabled - \qmlproperty bool WebView::settings.offlineWebApplicationCacheEnabled - \qmlproperty bool WebView::settings.localStorageDatabaseEnabled - \qmlproperty bool WebView::settings.localContentCanAccessRemoteUrls - - These properties give access to the settings controlling the web view. - - See QWebSettings for details of these properties. - - \qml - WebView { - settings.pluginsEnabled: true - settings.standardFontFamily: "Arial" - // ... - } - \endqml -*/ -QDeclarativeWebSettings* QDeclarativeWebView::settingsObject() const -{ - d->settings.s = page()->settings(); - return &d->settings; -} - -void QDeclarativeWebView::setPage(QWebPage* page) -{ - if (d->view->page() == page) - return; - - d->view->setPage(page); - updateContentsSize(); - page->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff); - page->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff); - connect(page->mainFrame(), SIGNAL(urlChanged(QUrl)), this, SLOT(pageUrlChanged())); - connect(page->mainFrame(), SIGNAL(titleChanged(QString)), this, SIGNAL(titleChanged(QString))); - connect(page->mainFrame(), SIGNAL(iconChanged()), this, SIGNAL(iconChanged())); - connect(page->mainFrame(), SIGNAL(initialLayoutCompleted()), this, SLOT(initialLayout())); - connect(page->mainFrame(), SIGNAL(contentsSizeChanged(QSize)), this, SIGNAL(contentsSizeChanged(QSize))); - - connect(page, SIGNAL(loadStarted()), this, SLOT(doLoadStarted())); - connect(page, SIGNAL(loadProgress(int)), this, SLOT(doLoadProgress(int))); - connect(page, SIGNAL(loadFinished(bool)), this, SLOT(doLoadFinished(bool))); - connect(page, SIGNAL(statusBarMessage(QString)), this, SLOT(setStatusText(QString))); - - connect(page->mainFrame(), SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(windowObjectCleared())); - - page->settings()->setAttribute(QWebSettings::TiledBackingStoreEnabled, true); -} - -/*! - \qmlsignal WebView::onLoadStarted() - - This handler is called when the web engine begins loading - a page. Later, WebView::onLoadFinished() or WebView::onLoadFailed() - will be emitted. -*/ - -/*! - \qmlsignal WebView::onLoadFinished() - - This handler is called when the web engine \e successfully - finishes loading a page, including any component content - (WebView::onLoadFailed() will be emitted otherwise). - - \sa progress -*/ - -/*! - \qmlsignal WebView::onLoadFailed() - - This handler is called when the web engine fails loading - a page or any component content - (WebView::onLoadFinished() will be emitted on success). -*/ - -void QDeclarativeWebView::load(const QNetworkRequest& request, QNetworkAccessManager::Operation operation, const QByteArray& body) -{ - page()->mainFrame()->load(request, operation, body); -} - -QString QDeclarativeWebView::html() const -{ - return page()->mainFrame()->toHtml(); -} - -/*! - \qmlproperty string WebView::html - This property holds HTML text set directly - - The html property can be set as a string. - - \qml - WebView { - html: "<p>This is <b>HTML</b>." - } - \endqml -*/ -void QDeclarativeWebView::setHtml(const QString& html, const QUrl& baseUrl) -{ - updateContentsSize(); - if (isComponentComplete()) - page()->mainFrame()->setHtml(html, baseUrl); - else { - d->pending = d->PendingHtml; - d->pendingUrl = baseUrl; - d->pendingString = html; - } - emit htmlChanged(); -} - -void QDeclarativeWebView::setContent(const QByteArray& data, const QString& mimeType, const QUrl& baseUrl) -{ - updateContentsSize(); - - if (isComponentComplete()) - page()->mainFrame()->setContent(data, mimeType, qmlContext(this)->resolvedUrl(baseUrl)); - else { - d->pending = d->PendingContent; - d->pendingUrl = baseUrl; - d->pendingString = mimeType; - d->pendingData = data; - } -} - -QWebHistory* QDeclarativeWebView::history() const -{ - return page()->history(); -} - -QWebSettings* QDeclarativeWebView::settings() const -{ - return page()->settings(); -} - -QDeclarativeWebView* QDeclarativeWebView::createWindow(QWebPage::WebWindowType type) -{ - switch (type) { - case QWebPage::WebBrowserWindow: { - if (!d->newWindowComponent && d->newWindowParent) - qWarning("WebView::newWindowComponent not set - WebView::newWindowParent ignored"); - else if (d->newWindowComponent && !d->newWindowParent) - qWarning("WebView::newWindowParent not set - WebView::newWindowComponent ignored"); - else if (d->newWindowComponent && d->newWindowParent) { - QDeclarativeWebView* webview = 0; - QDeclarativeContext* windowContext = new QDeclarativeContext(qmlContext(this)); - - QObject* newObject = d->newWindowComponent->create(windowContext); - if (newObject) { - windowContext->setParent(newObject); - QDeclarativeItem* item = qobject_cast<QDeclarativeItem *>(newObject); - if (!item) - delete newObject; - else { - webview = item->findChild<QDeclarativeWebView*>(); - if (!webview) - delete item; - else { - newObject->setParent(d->newWindowParent); - static_cast<QGraphicsObject*>(item)->setParentItem(d->newWindowParent); - } - } - } else - delete windowContext; - - return webview; - } - } - break; - case QWebPage::WebModalDialog: { - // Not supported - } - } - return 0; -} - -/*! - \qmlproperty component WebView::newWindowComponent - - This property holds the component to use for new windows. - The component must have a WebView somewhere in its structure. - - When the web engine requests a new window, it will be an instance of - this component. - - The parent of the new window is set by newWindowParent. It must be set. -*/ -QDeclarativeComponent* QDeclarativeWebView::newWindowComponent() const -{ - return d->newWindowComponent; -} - -void QDeclarativeWebView::setNewWindowComponent(QDeclarativeComponent* newWindow) -{ - if (newWindow == d->newWindowComponent) - return; - d->newWindowComponent = newWindow; - emit newWindowComponentChanged(); -} - - -/*! - \qmlproperty item WebView::newWindowParent - - The parent item for new windows. - - \sa newWindowComponent -*/ -QDeclarativeItem* QDeclarativeWebView::newWindowParent() const -{ - return d->newWindowParent; -} - -void QDeclarativeWebView::setNewWindowParent(QDeclarativeItem* parent) -{ - if (parent == d->newWindowParent) - return; - if (d->newWindowParent && parent) { - QList<QGraphicsItem *> children = d->newWindowParent->childItems(); - for (int i = 0; i < children.count(); ++i) - children.at(i)->setParentItem(parent); - } - d->newWindowParent = parent; - emit newWindowParentChanged(); -} - -QSize QDeclarativeWebView::contentsSize() const -{ - return page()->mainFrame()->contentsSize() * contentsScale(); -} - -qreal QDeclarativeWebView::contentsScale() const -{ - return d->view->scale(); -} - -void QDeclarativeWebView::setContentsScale(qreal scale) -{ - if (scale == d->view->scale()) - return; - d->view->setScale(scale); - updateDeclarativeWebViewSize(); - emit contentsScaleChanged(); -} - -#ifdef Q_REVISION -/*! - \qmlproperty color WebView::backgroundColor - \since QtWebKit 1.1 - This property holds the background color of the view. -*/ - -QColor QDeclarativeWebView::backgroundColor() const -{ - return d->view->palette().base().color(); -} - -void QDeclarativeWebView::setBackgroundColor(const QColor& color) -{ - QPalette palette = d->view->palette(); - if (palette.base().color() == color) - return; - palette.setBrush(QPalette::Base, color); - d->view->setPalette(palette); - emit backgroundColorChanged(); -} -#endif - -/*! - Returns the area of the largest element at position (\a x,\a y) that is no larger - than \a maxWidth by \a maxHeight pixels. - - May return an area larger in the case when no smaller element is at the position. -*/ -QRect QDeclarativeWebView::elementAreaAt(int x, int y, int maxWidth, int maxHeight) const -{ - QWebHitTestResult hit = page()->mainFrame()->hitTestContent(QPoint(x, y)); - QRect hitRect = hit.boundingRect(); - QWebElement element = hit.enclosingBlockElement(); - if (maxWidth <= 0) - maxWidth = INT_MAX; - if (maxHeight <= 0) - maxHeight = INT_MAX; - while (!element.parent().isNull() && element.geometry().width() <= maxWidth && element.geometry().height() <= maxHeight) { - hitRect = element.geometry(); - element = element.parent(); - } - return hitRect; -} - -/*! - \internal - \class QDeclarativeWebPage - \brief The QDeclarativeWebPage class is a QWebPage that can create QML plugins. - - \sa QDeclarativeWebView -*/ -QDeclarativeWebPage::QDeclarativeWebPage(QDeclarativeWebView* parent) : - QWebPage(parent) -{ -} - -QDeclarativeWebPage::~QDeclarativeWebPage() -{ -} - -QString QDeclarativeWebPage::chooseFile(QWebFrame* originatingFrame, const QString& oldFile) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(oldFile) - return oldFile; -} - -/*! - \qmlsignal WebView::onAlert(string message) - - The handler is called when the web engine sends a JavaScript alert. The \a message is the text - to be displayed in the alert to the user. -*/ - - -void QDeclarativeWebPage::javaScriptAlert(QWebFrame* originatingFrame, const QString& msg) -{ - Q_UNUSED(originatingFrame) - emit viewItem()->alert(msg); -} - -bool QDeclarativeWebPage::javaScriptConfirm(QWebFrame* originatingFrame, const QString& msg) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - return false; -} - -bool QDeclarativeWebPage::javaScriptPrompt(QWebFrame* originatingFrame, const QString& msg, const QString& defaultValue, QString* result) -{ - // Not supported (it's modal) - Q_UNUSED(originatingFrame) - Q_UNUSED(msg) - Q_UNUSED(defaultValue) - Q_UNUSED(result) - return false; -} - - -QDeclarativeWebView* QDeclarativeWebPage::viewItem() -{ - return static_cast<QDeclarativeWebView*>(parent()); -} - -QWebPage* QDeclarativeWebPage::createWindow(WebWindowType type) -{ - QDeclarativeWebView* newView = viewItem()->createWindow(type); - if (newView) - return newView->page(); - return 0; -} - -QT_END_NAMESPACE - diff --git a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h b/Source/WebKit/qt/declarative/qdeclarativewebview_p.h deleted file mode 100644 index 088f23bc8..000000000 --- a/Source/WebKit/qt/declarative/qdeclarativewebview_p.h +++ /dev/null @@ -1,384 +0,0 @@ -/* - Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies) - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public License - along with this library; see the file COPYING.LIB. If not, write to - the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - Boston, MA 02110-1301, USA. -*/ - - -#ifndef qdeclarativewebview_p_h -#define qdeclarativewebview_p_h - -#include <QAction> -#include <QDeclarativeItem> -#include <QtCore/QBasicTimer> -#include <QtCore/QUrl> -#include <QtNetwork/QNetworkAccessManager> -#include "qgraphicswebview.h" -#include "qwebpage.h" - - -QT_BEGIN_HEADER - -class QWebHistory; -class QWebSettings; - -QT_BEGIN_NAMESPACE - -QT_MODULE(Declarative) -class QDeclarativeWebSettings; -class QDeclarativeWebViewPrivate; -class QNetworkRequest; -class QDeclarativeWebView; -class QDeclarativeWebViewPrivate; - -class QDeclarativeWebPage : public QWebPage { - Q_OBJECT -public: - explicit QDeclarativeWebPage(QDeclarativeWebView *parent); - ~QDeclarativeWebPage(); -protected: - QWebPage *createWindow(WebWindowType type); - QString chooseFile(QWebFrame *originatingFrame, const QString& oldFile); - void javaScriptAlert(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptConfirm(QWebFrame *originatingFrame, const QString& msg); - bool javaScriptPrompt(QWebFrame *originatingFrame, const QString& msg, const QString& defaultValue, QString* result); - -private: - QDeclarativeWebView *viewItem(); -}; - -class GraphicsWebView : public QGraphicsWebView { - Q_OBJECT -public: - GraphicsWebView(QDeclarativeWebView* parent = 0); -protected: - void mousePressEvent(QGraphicsSceneMouseEvent* event); - void mouseReleaseEvent(QGraphicsSceneMouseEvent* event); - void mouseMoveEvent(QGraphicsSceneMouseEvent* event); - void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event); - void timerEvent(QTimerEvent* event); - bool sceneEvent(QEvent *event); - -Q_SIGNALS: - void doubleClick(int clickX, int clickY); -private: - QDeclarativeWebView *parent; - QPointF pressPoint; - QBasicTimer pressTimer; - int pressTime; // milliseconds before the touch event becomes a "tap and hold" - friend class QDeclarativeWebView; -}; - -class QDeclarativeWebViewAttached; - -// TODO: browser plugins - -class QDeclarativeWebView : public QDeclarativeItem { - Q_OBJECT - - Q_ENUMS(Status SelectionMode) - - Q_PROPERTY(QString title READ title NOTIFY titleChanged) - Q_PROPERTY(QPixmap icon READ icon NOTIFY iconChanged) - Q_PROPERTY(QString statusText READ statusText NOTIFY statusTextChanged) - - Q_PROPERTY(QString html READ html WRITE setHtml NOTIFY htmlChanged) - - Q_PROPERTY(int pressGrabTime READ pressGrabTime WRITE setPressGrabTime NOTIFY pressGrabTimeChanged) - - Q_PROPERTY(int preferredWidth READ preferredWidth WRITE setPreferredWidth NOTIFY preferredWidthChanged) - Q_PROPERTY(int preferredHeight READ preferredHeight WRITE setPreferredHeight NOTIFY preferredHeightChanged) - Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged) - Q_PROPERTY(qreal progress READ progress NOTIFY progressChanged) - Q_PROPERTY(Status status READ status NOTIFY statusChanged) - -#ifndef QT_NO_ACTION - Q_PROPERTY(QAction* reload READ reloadAction CONSTANT) - Q_PROPERTY(QAction* back READ backAction CONSTANT) - Q_PROPERTY(QAction* forward READ forwardAction CONSTANT) - Q_PROPERTY(QAction* stop READ stopAction CONSTANT) -#endif - - Q_PROPERTY(QDeclarativeWebSettings* settings READ settingsObject CONSTANT) - - Q_PROPERTY(QDeclarativeListProperty<QObject> javaScriptWindowObjects READ javaScriptWindowObjects CONSTANT) - - Q_PROPERTY(QDeclarativeComponent* newWindowComponent READ newWindowComponent WRITE setNewWindowComponent NOTIFY newWindowComponentChanged) - Q_PROPERTY(QDeclarativeItem* newWindowParent READ newWindowParent WRITE setNewWindowParent NOTIFY newWindowParentChanged) - - Q_PROPERTY(bool renderingEnabled READ renderingEnabled WRITE setRenderingEnabled NOTIFY renderingEnabledChanged) - - Q_PROPERTY(QSize contentsSize READ contentsSize NOTIFY contentsSizeChanged) - Q_PROPERTY(qreal contentsScale READ contentsScale WRITE setContentsScale NOTIFY contentsScaleChanged) -#ifdef Q_REVISION - Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor NOTIFY backgroundColorChanged REVISION 1) -#endif - -public: - QDeclarativeWebView(QDeclarativeItem *parent = 0); - ~QDeclarativeWebView(); - - QUrl url() const; - void setUrl(const QUrl &); - - QString title() const; - - QPixmap icon() const; - - Q_INVOKABLE bool heuristicZoom(int clickX, int clickY, qreal maxzoom); - QRect elementAreaAt(int x, int y, int minwidth, int minheight) const; - - int pressGrabTime() const; - void setPressGrabTime(int); - - int preferredWidth() const; - void setPreferredWidth(int); - int preferredHeight() const; - void setPreferredHeight(int); - - enum Status { Null, Ready, Loading, Error }; - Status status() const; - qreal progress() const; - QString statusText() const; - -#ifndef QT_NO_ACTION - QAction *reloadAction() const; - QAction *backAction() const; - QAction *forwardAction() const; - QAction *stopAction() const; -#endif - - QWebPage *page() const; - void setPage(QWebPage *page); - - void load(const QNetworkRequest &request, - QNetworkAccessManager::Operation operation = QNetworkAccessManager::GetOperation, - const QByteArray &body = QByteArray()); - - QString html() const; - - void setHtml(const QString &html, const QUrl &baseUrl = QUrl()); - void setContent(const QByteArray &data, const QString &mimeType = QString(), const QUrl &baseUrl = QUrl()); - - QWebHistory* history() const; - QWebSettings* settings() const; - QDeclarativeWebSettings *settingsObject() const; - - bool renderingEnabled() const; - void setRenderingEnabled(bool); - - QDeclarativeListProperty<QObject> javaScriptWindowObjects(); - - static QDeclarativeWebViewAttached* qmlAttachedProperties(QObject*); - - QDeclarativeComponent *newWindowComponent() const; - void setNewWindowComponent(QDeclarativeComponent *newWindow); - QDeclarativeItem* newWindowParent() const; - void setNewWindowParent(QDeclarativeItem* newWindow); - - bool isComponentCompletePublic() const { return isComponentComplete(); } - - QSize contentsSize() const; - - void setContentsScale(qreal scale); - qreal contentsScale() const; - -#ifdef Q_REVISION - Q_REVISION(1) QColor backgroundColor() const; - Q_REVISION(1) void setBackgroundColor(const QColor&); -#endif - -Q_SIGNALS: - void preferredWidthChanged(); - void preferredHeightChanged(); - void urlChanged(); - void progressChanged(); - void statusChanged(Status); - void titleChanged(const QString&); - void iconChanged(); - void statusTextChanged(); - void htmlChanged(); - void pressGrabTimeChanged(); - void newWindowComponentChanged(); - void newWindowParentChanged(); - void renderingEnabledChanged(); - void contentsSizeChanged(const QSize&); - void contentsScaleChanged(); -#ifdef Q_REVISION - void backgroundColorChanged(); -#endif - - void loadStarted(); - void loadFinished(); - void loadFailed(); - - void doubleClick(int clickX, int clickY); - - void zoomTo(qreal zoom, int centerX, int centerY); - - void alert(const QString& message); - -public Q_SLOTS: - QVariant evaluateJavaScript(const QString&); - -private Q_SLOTS: - void doLoadStarted(); - void doLoadProgress(int p); - void doLoadFinished(bool ok); - void setStatusText(const QString&); - void windowObjectCleared(); - void pageUrlChanged(); - void initialLayout(); - - void updateDeclarativeWebViewSize(); - - virtual void geometryChanged(const QRectF &newGeometry, - const QRectF &oldGeometry); - QDeclarativeWebView* createWindow(QWebPage::WebWindowType type); - -private: - void updateContentsSize(); - void init(); - virtual void componentComplete(); - Q_DISABLE_COPY(QDeclarativeWebView) - QDeclarativeWebViewPrivate* d; - QMouseEvent* sceneMouseEventToMouseEvent(QGraphicsSceneMouseEvent*); - QMouseEvent* sceneHoverMoveEventToMouseEvent(QGraphicsSceneHoverEvent*); - friend class QDeclarativeWebPage; -}; - -class QDeclarativeWebViewAttached : public QObject { - Q_OBJECT - Q_PROPERTY(QString windowObjectName READ windowObjectName WRITE setWindowObjectName) -public: - QDeclarativeWebViewAttached(QObject* parent) - : QObject(parent) - { - } - - QString windowObjectName() const - { - return m_windowObjectName; - } - - void setWindowObjectName(const QString &n) - { - m_windowObjectName = n; - } - -private: - QString m_windowObjectName; -}; - -class QDeclarativeWebSettings : public QObject { - Q_OBJECT - - Q_PROPERTY(QString standardFontFamily READ standardFontFamily WRITE setStandardFontFamily) - Q_PROPERTY(QString fixedFontFamily READ fixedFontFamily WRITE setFixedFontFamily) - Q_PROPERTY(QString serifFontFamily READ serifFontFamily WRITE setSerifFontFamily) - Q_PROPERTY(QString sansSerifFontFamily READ sansSerifFontFamily WRITE setSansSerifFontFamily) - Q_PROPERTY(QString cursiveFontFamily READ cursiveFontFamily WRITE setCursiveFontFamily) - Q_PROPERTY(QString fantasyFontFamily READ fantasyFontFamily WRITE setFantasyFontFamily) - - Q_PROPERTY(int minimumFontSize READ minimumFontSize WRITE setMinimumFontSize) - Q_PROPERTY(int minimumLogicalFontSize READ minimumLogicalFontSize WRITE setMinimumLogicalFontSize) - Q_PROPERTY(int defaultFontSize READ defaultFontSize WRITE setDefaultFontSize) - Q_PROPERTY(int defaultFixedFontSize READ defaultFixedFontSize WRITE setDefaultFixedFontSize) - - Q_PROPERTY(bool autoLoadImages READ autoLoadImages WRITE setAutoLoadImages) - Q_PROPERTY(bool javascriptEnabled READ javascriptEnabled WRITE setJavascriptEnabled) - Q_PROPERTY(bool javaEnabled READ javaEnabled WRITE setJavaEnabled) - Q_PROPERTY(bool pluginsEnabled READ pluginsEnabled WRITE setPluginsEnabled) - Q_PROPERTY(bool privateBrowsingEnabled READ privateBrowsingEnabled WRITE setPrivateBrowsingEnabled) - Q_PROPERTY(bool javascriptCanOpenWindows READ javascriptCanOpenWindows WRITE setJavascriptCanOpenWindows) - Q_PROPERTY(bool javascriptCanAccessClipboard READ javascriptCanAccessClipboard WRITE setJavascriptCanAccessClipboard) - Q_PROPERTY(bool developerExtrasEnabled READ developerExtrasEnabled WRITE setDeveloperExtrasEnabled) - Q_PROPERTY(bool linksIncludedInFocusChain READ linksIncludedInFocusChain WRITE setLinksIncludedInFocusChain) - Q_PROPERTY(bool zoomTextOnly READ zoomTextOnly WRITE setZoomTextOnly) - Q_PROPERTY(bool printElementBackgrounds READ printElementBackgrounds WRITE setPrintElementBackgrounds) - Q_PROPERTY(bool offlineStorageDatabaseEnabled READ offlineStorageDatabaseEnabled WRITE setOfflineStorageDatabaseEnabled) - Q_PROPERTY(bool offlineWebApplicationCacheEnabled READ offlineWebApplicationCacheEnabled WRITE setOfflineWebApplicationCacheEnabled) - Q_PROPERTY(bool localStorageDatabaseEnabled READ localStorageDatabaseEnabled WRITE setLocalStorageDatabaseEnabled) - Q_PROPERTY(bool localContentCanAccessRemoteUrls READ localContentCanAccessRemoteUrls WRITE setLocalContentCanAccessRemoteUrls) - -public: - QDeclarativeWebSettings() {} - - QString standardFontFamily() const { return s->fontFamily(QWebSettings::StandardFont); } - void setStandardFontFamily(const QString& f) { s->setFontFamily(QWebSettings::StandardFont, f); } - QString fixedFontFamily() const { return s->fontFamily(QWebSettings::FixedFont); } - void setFixedFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FixedFont, f); } - QString serifFontFamily() const { return s->fontFamily(QWebSettings::SerifFont); } - void setSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SerifFont, f); } - QString sansSerifFontFamily() const { return s->fontFamily(QWebSettings::SansSerifFont); } - void setSansSerifFontFamily(const QString& f) { s->setFontFamily(QWebSettings::SansSerifFont, f); } - QString cursiveFontFamily() const { return s->fontFamily(QWebSettings::CursiveFont); } - void setCursiveFontFamily(const QString& f) { s->setFontFamily(QWebSettings::CursiveFont, f); } - QString fantasyFontFamily() const { return s->fontFamily(QWebSettings::FantasyFont); } - void setFantasyFontFamily(const QString& f) { s->setFontFamily(QWebSettings::FantasyFont, f); } - - int minimumFontSize() const { return s->fontSize(QWebSettings::MinimumFontSize); } - void setMinimumFontSize(int size) { s->setFontSize(QWebSettings::MinimumFontSize, size); } - int minimumLogicalFontSize() const { return s->fontSize(QWebSettings::MinimumLogicalFontSize); } - void setMinimumLogicalFontSize(int size) { s->setFontSize(QWebSettings::MinimumLogicalFontSize, size); } - int defaultFontSize() const { return s->fontSize(QWebSettings::DefaultFontSize); } - void setDefaultFontSize(int size) { s->setFontSize(QWebSettings::DefaultFontSize, size); } - int defaultFixedFontSize() const { return s->fontSize(QWebSettings::DefaultFixedFontSize); } - void setDefaultFixedFontSize(int size) { s->setFontSize(QWebSettings::DefaultFixedFontSize, size); } - - bool autoLoadImages() const { return s->testAttribute(QWebSettings::AutoLoadImages); } - void setAutoLoadImages(bool on) { s->setAttribute(QWebSettings::AutoLoadImages, on); } - bool javascriptEnabled() const { return s->testAttribute(QWebSettings::JavascriptEnabled); } - void setJavascriptEnabled(bool on) { s->setAttribute(QWebSettings::JavascriptEnabled, on); } - bool javaEnabled() const { return s->testAttribute(QWebSettings::JavaEnabled); } - void setJavaEnabled(bool on) { s->setAttribute(QWebSettings::JavaEnabled, on); } - bool pluginsEnabled() const { return s->testAttribute(QWebSettings::PluginsEnabled); } - void setPluginsEnabled(bool on) { s->setAttribute(QWebSettings::PluginsEnabled, on); } - bool privateBrowsingEnabled() const { return s->testAttribute(QWebSettings::PrivateBrowsingEnabled); } - void setPrivateBrowsingEnabled(bool on) { s->setAttribute(QWebSettings::PrivateBrowsingEnabled, on); } - bool javascriptCanOpenWindows() const { return s->testAttribute(QWebSettings::JavascriptCanOpenWindows); } - void setJavascriptCanOpenWindows(bool on) { s->setAttribute(QWebSettings::JavascriptCanOpenWindows, on); } - bool javascriptCanAccessClipboard() const { return s->testAttribute(QWebSettings::JavascriptCanAccessClipboard); } - void setJavascriptCanAccessClipboard(bool on) { s->setAttribute(QWebSettings::JavascriptCanAccessClipboard, on); } - bool developerExtrasEnabled() const { return s->testAttribute(QWebSettings::DeveloperExtrasEnabled); } - void setDeveloperExtrasEnabled(bool on) { s->setAttribute(QWebSettings::DeveloperExtrasEnabled, on); } - bool linksIncludedInFocusChain() const { return s->testAttribute(QWebSettings::LinksIncludedInFocusChain); } - void setLinksIncludedInFocusChain(bool on) { s->setAttribute(QWebSettings::LinksIncludedInFocusChain, on); } - bool zoomTextOnly() const { return s->testAttribute(QWebSettings::ZoomTextOnly); } - void setZoomTextOnly(bool on) { s->setAttribute(QWebSettings::ZoomTextOnly, on); } - bool printElementBackgrounds() const { return s->testAttribute(QWebSettings::PrintElementBackgrounds); } - void setPrintElementBackgrounds(bool on) { s->setAttribute(QWebSettings::PrintElementBackgrounds, on); } - bool offlineStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::OfflineStorageDatabaseEnabled); } - void setOfflineStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::OfflineStorageDatabaseEnabled, on); } - bool offlineWebApplicationCacheEnabled() const { return s->testAttribute(QWebSettings::OfflineWebApplicationCacheEnabled); } - void setOfflineWebApplicationCacheEnabled(bool on) { s->setAttribute(QWebSettings::OfflineWebApplicationCacheEnabled, on); } - bool localStorageDatabaseEnabled() const { return s->testAttribute(QWebSettings::LocalStorageDatabaseEnabled); } - void setLocalStorageDatabaseEnabled(bool on) { s->setAttribute(QWebSettings::LocalStorageDatabaseEnabled, on); } - bool localContentCanAccessRemoteUrls() const { return s->testAttribute(QWebSettings::LocalContentCanAccessRemoteUrls); } - void setLocalContentCanAccessRemoteUrls(bool on) { s->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, on); } - - QWebSettings *s; -}; - -QT_END_NAMESPACE - -QML_DECLARE_TYPE(QDeclarativeWebView) -QML_DECLARE_TYPE(QDeclarativeWebSettings) -QML_DECLARE_TYPEINFO(QDeclarativeWebView, QML_HAS_ATTACHED_PROPERTIES) - -QT_END_HEADER - -#endif diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/qdeclarativewebview.pro b/Source/WebKit/qt/tests/qdeclarativewebview/qdeclarativewebview.pro deleted file mode 100644 index 1e2193b6b..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/qdeclarativewebview.pro +++ /dev/null @@ -1,5 +0,0 @@ -include(../tests.pri) -exists($${TARGET}.qrc):RESOURCES += $${TARGET}.qrc -INCLUDEPATH += \ - $$PWD/../../declarative - diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.html b/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.html deleted file mode 100644 index 22e3e243d..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.html +++ /dev/null @@ -1,17 +0,0 @@ -<html> -<head><title>Basic</title> -<link rel="icon" sizes="48x48" href="basic.png"> -<script type="text/javascript"> -<!-- -window.onload = function(){ window.status = "status here"; } -// --> -</script> -</head> -<body leftmargin="0" marginwidth="0"> -<table width="123"> -<tbody> -<tr><td>This is a basic test.</td></tr> -</tbody> -</table> -</body> -</html> diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.png b/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.png Binary files differdeleted file mode 100644 index 35717cca5..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.png +++ /dev/null diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.qml deleted file mode 100644 index b5208d033..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/basic.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtWebKit 1.0 - -WebView { - url: "basic.html" -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.html b/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.html deleted file mode 100644 index 923686794..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.html +++ /dev/null @@ -1,14 +0,0 @@ -<body leftmargin=0 topmargin=0> -<table width="300px" border=1 cellpadding=0 cellspacing=0> -<tr> -<td align=center width=25%%><p>A</p></td> -<td width=75% height=50px> - <table width=100% border=1 cellpadding=0 cellspacing=0> - <tr> - <td align=center width=50% height=50px><p>B</p></td> - <td align=center width=50% height=50px><p>C</p></td> - </tr> - </table> -</td> -</tr> -</table> diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.qml deleted file mode 100644 index 8fef8c92b..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/elements.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtWebKit 1.0 - -WebView { - url: "elements.html" - width: 310 - height: 100 -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.html b/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.html deleted file mode 100644 index 62ab62da9..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.html +++ /dev/null @@ -1,12 +0,0 @@ -<html> -<head><title>Forward</title> -<link rel="icon" sizes="32x32" href="forward.png"> -</head> -<body leftmargin="0" marginwidth="0"> -<table width="123"> -<tbody> -<tr><td>This is more.</td></tr> -</tbody> -</table> -</body> -</html> diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.png b/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.png Binary files differdeleted file mode 100644 index a82533e3d..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/forward.png +++ /dev/null diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.html b/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.html deleted file mode 100644 index 35270bc47..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.html +++ /dev/null @@ -1,11 +0,0 @@ -<html> -<head><title>JavaScript</title> -<link rel="icon" sizes="48x48" href="basic.png"> -<script type="text/javascript"> -<!-- -window.onload = function(){ window.status = "status here"; } -// --> -</script> -</head> -<body> -This is a JS test. diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.qml deleted file mode 100644 index 527e3b983..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/javaScript.qml +++ /dev/null @@ -1,12 +0,0 @@ -import QtQuick 1.0 -import QtWebKit 1.0 - -WebView { - url: "javaScript.html" - javaScriptWindowObjects: [ - QtObject { - property string qmlprop: "qmlvalue" - WebView.windowObjectName: "myjsname" - } - ] -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/loadError.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/loadError.qml deleted file mode 100644 index 26cec8f97..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/loadError.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtWebKit 1.0 - -WebView { - url: "does-not-exist.html" -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.html b/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.html deleted file mode 100644 index 4252d9a7f..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.html +++ /dev/null @@ -1,20 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<script type="text/javascript"> -<!-- -function clickTheLink() -{ - var ev = document.createEvent('MouseEvents'); - ev.initEvent( "click", true, false ); - document.getElementById('thelink').dispatchEvent(ev); -} -// --> -</script> -</head> -<body> -<h1>Multiple windows...</h1> - -<a id=thelink target="_blank" href="newwindows.html">Popup!</a> -</body> -</html> diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.qml deleted file mode 100644 index 166722d5e..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/newwindows.qml +++ /dev/null @@ -1,51 +0,0 @@ -// Demonstrates opening new WebViews from HTML - -import QtQuick 1.0 -import QtWebKit 1.0 - -Grid { - columns: 3 - id: pages - height: 300; width: 600 - property int pagesOpened: 0 - property Item firstPageOpened: null - - Component { - id: webViewPage - Rectangle { - id: thisPage - width: 150 - height: 150 - property WebView webView: wv - - WebView { - id: wv - anchors.fill: parent - newWindowComponent: webViewPage - newWindowParent: pages - url: "newwindows.html" - Component.onCompleted: { - if (pagesOpened == 1) { - pages.firstPageOpened = thisPage; - } - } - } - } - } - - Loader { - id: originalPage - sourceComponent: webViewPage - property bool ready: status == Loader.Ready && item.webView.status == WebView.Ready - } - - Timer { - interval: 10 - running: originalPage.ready && pagesOpened < 4 - repeat: true - onTriggered: { - pagesOpened++; - originalPage.item.webView.evaluateJavaScript("clickTheLink()"); - } - } -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/propertychanges.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/propertychanges.qml deleted file mode 100644 index db0688782..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/propertychanges.qml +++ /dev/null @@ -1,34 +0,0 @@ -import QtQuick 1.0 -import QtWebKit 1.0 - -Item { - width: 240 - height: 160 - Grid { - anchors.fill: parent - objectName: "newWindowParent" - id: newWindowParent - } - - Row { - anchors.fill: parent - id: oldWindowParent - objectName: "oldWindowParent" - } - - Loader { - sourceComponent: webViewComponent - } - Component { - id: webViewComponent - WebView { - id: webView - objectName: "webView" - newWindowComponent: webViewComponent - newWindowParent: oldWindowParent - url: "basic.html" - renderingEnabled: true - pressGrabTime: 200 - } - } -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/sample.html b/Source/WebKit/qt/tests/qdeclarativewebview/resources/sample.html deleted file mode 100644 index cc9bffaf8..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/sample.html +++ /dev/null @@ -1,6 +0,0 @@ -<html> -<head></head> -<body width=400 height=400> -Here is a sample text -</body> -</html> diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/sethtml.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/sethtml.qml deleted file mode 100644 index 5bff442b7..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/sethtml.qml +++ /dev/null @@ -1,5 +0,0 @@ -import QtWebKit 1.0 - -WebView { - html: "<p>This is a <b>string</b> set on the WebView" -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml deleted file mode 100644 index fb46d38b6..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewbackgroundcolor.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick 1.0 -import QtWebKit 1.1 - -WebView { - id: myweb - height: 300 - width: 300 - focus: true - backgroundColor : "red" -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtest.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtest.qml deleted file mode 100644 index 609d9c990..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtest.qml +++ /dev/null @@ -1,24 +0,0 @@ -import QtQuick 1.0 -import QtWebKit 1.0 - -Flickable { - id: flick - width: 640 - height: 400 - clip: true - contentWidth: myweb.width; contentHeight: myweb.height - property alias myurl: myweb.url - property alias prefHeight: myweb.preferredHeight - property alias prefWidth: myweb.preferredWidth - property url testUrl; - WebView { - id: myweb - url: testUrl - smooth: false - scale: 1.0 - preferredHeight: 500 - preferredWidth: 600 - pressGrabTime: 1000 - focus: true - } -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtestdefault.qml b/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtestdefault.qml deleted file mode 100644 index b26eea612..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/resources/webviewtestdefault.qml +++ /dev/null @@ -1,22 +0,0 @@ -import QtQuick 1.0 -import QtWebKit 1.0 - -Flickable { - id: flick - width: 640 - height: 400 - clip: true - contentWidth: myweb.width; contentHeight: myweb.height - property alias myurl: myweb.url - property alias prefHeight: myweb.preferredHeight - property alias prefWidth: myweb.preferredWidth - property url testUrl; - WebView { - id: myweb - url: testUrl; - smooth: false - scale: 1.0 - pressGrabTime: 1000 - focus: true - } -} diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp deleted file mode 100644 index 97da3539a..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.cpp +++ /dev/null @@ -1,552 +0,0 @@ -#include "../util.h" -#include <QAction> -#include <QColor> -#include <QDebug> -#include <QDeclarativeItem> -#include <QDeclarativeView> -#include <QDeclarativeComponent> -#include <QDeclarativeEngine> -#include <QDeclarativeProperty> -#include <QDir> -#include <QGraphicsWebView> -#include <QTest> -#include <QVariant> -#include <QWebFrame> -#include "qdeclarativewebview_p.h" - -class tst_QDeclarativeWebView : public QObject { - Q_OBJECT - -public: - tst_QDeclarativeWebView(); - -private Q_SLOTS: - void initTestCase(); - void cleanupTestCase(); - - void basicProperties(); - void elementAreaAt(); - void historyNav(); - void javaScript(); - void loadError(); - void multipleWindows(); - void newWindowComponent(); - void newWindowParent(); - void preferredWidthTest(); - void preferredHeightTest(); - void preferredWidthDefaultTest(); - void preferredHeightDefaultTest(); - void pressGrabTime(); - void renderingEnabled(); - void setHtml(); - void settings(); - void backgroundColor(); - -private: - void checkNoErrors(const QDeclarativeComponent&); - QString tmpDir() const - { - static QString tmpd = QDir::tempPath() + "/tst_qdeclarativewebview-" - + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); - return tmpd; - } -}; - -tst_QDeclarativeWebView::tst_QDeclarativeWebView() -{ - Q_UNUSED(waitForSignal) -} - -static QString strippedHtml(QString html) -{ - html.replace(QRegExp("\\s+"), ""); - return html; -} - -static QString fileContents(const QString& filename) -{ - QFile file(filename); - file.open(QIODevice::ReadOnly); - return QString::fromUtf8(file.readAll()); -} - -static void removeRecursive(const QString& dirname) -{ - QDir dir(dirname); - QFileInfoList entries(dir.entryInfoList(QDir::Dirs | QDir::Files | QDir::NoDotAndDotDot)); - for (int i = 0; i < entries.count(); ++i) - if (entries[i].isDir()) - removeRecursive(entries[i].filePath()); - else - dir.remove(entries[i].fileName()); - QDir().rmdir(dirname); -} - -void tst_QDeclarativeWebView::initTestCase() -{ - QWebSettings::setIconDatabasePath(tmpDir()); - QWebSettings::enablePersistentStorage(tmpDir()); -} - -void tst_QDeclarativeWebView::cleanupTestCase() -{ - removeRecursive(tmpDir()); -} - -void tst_QDeclarativeWebView::basicProperties() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/basic.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QObject* wv = component.create(); - QVERIFY(wv); - waitForSignal(wv, SIGNAL(iconChanged())); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QCOMPARE(wv->property("title").toString(), QLatin1String("Basic")); - QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 48); - QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap(":/resources/basic.png")); - QCOMPARE(wv->property("statusText").toString(), QLatin1String("status here")); - QCOMPARE(strippedHtml(fileContents(":/resources/basic.html")), strippedHtml(wv->property("html").toString())); - QEXPECT_FAIL("", "TODO: get preferred width from QGraphicsWebView result", Continue); - QCOMPARE(wv->property("preferredWidth").toInt(), 0); - QEXPECT_FAIL("", "TODO: get preferred height from QGraphicsWebView result", Continue); - QCOMPARE(wv->property("preferredHeight").toInt(), 0); - QCOMPARE(wv->property("url").toUrl(), QUrl("qrc:///resources/basic.html")); - QCOMPARE(wv->property("status").toInt(), int(QDeclarativeWebView::Ready)); - - QAction* reloadAction = wv->property("reload").value<QAction*>(); - QVERIFY(reloadAction); - QVERIFY(reloadAction->isEnabled()); - QAction* backAction = wv->property("back").value<QAction*>(); - QVERIFY(backAction); - QVERIFY(!backAction->isEnabled()); - QAction* forwardAction = wv->property("forward").value<QAction*>(); - QVERIFY(forwardAction); - QVERIFY(!forwardAction->isEnabled()); - QAction* stopAction = wv->property("stop").value<QAction*>(); - QVERIFY(stopAction); - QVERIFY(!stopAction->isEnabled()); - - wv->setProperty("pixelCacheSize", 0); // mainly testing that it doesn't crash or anything! - QCOMPARE(wv->property("pixelCacheSize").toInt(), 0); - reloadAction->trigger(); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); -} - -void tst_QDeclarativeWebView::elementAreaAt() -{ - W_QSKIP("This test should be changed to test 'heuristicZoom' instead.", SkipAll); - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/elements.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - - // FIXME: Tests disabled since elementAreaAt isn't exported. - // Areas from elements.html. -// const QRect areaA(1, 1, 75, 54); -// const QRect areaB(78, 3, 110, 50); -// const QRect wholeView(0, 0, 310, 100); -// const QRect areaBC(76, 1, 223, 54); - -// QCOMPARE(wv->elementAreaAt(40, 30, 100, 100), areaA); -// QCOMPARE(wv->elementAreaAt(130, 30, 200, 100), areaB); -// QCOMPARE(wv->elementAreaAt(40, 30, 400, 400), wholeView); -// QCOMPARE(wv->elementAreaAt(130, 30, 280, 280), areaBC); -// QCOMPARE(wv->elementAreaAt(130, 30, 400, 400), wholeView); -} - -void tst_QDeclarativeWebView::historyNav() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/basic.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QObject* wv = component.create(); - QVERIFY(wv); - waitForSignal(wv, SIGNAL(iconChanged())); - - QAction* reloadAction = wv->property("reload").value<QAction*>(); - QVERIFY(reloadAction); - QAction* backAction = wv->property("back").value<QAction*>(); - QVERIFY(backAction); - QAction* forwardAction = wv->property("forward").value<QAction*>(); - QVERIFY(forwardAction); - QAction* stopAction = wv->property("stop").value<QAction*>(); - QVERIFY(stopAction); - - for (int i = 1; i <= 2; ++i) { - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QCOMPARE(wv->property("title").toString(), QLatin1String("Basic")); - QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 48); - QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap(":/resources/basic.png")); - QCOMPARE(wv->property("statusText").toString(), QLatin1String("status here")); - QCOMPARE(strippedHtml(fileContents(":/resources/basic.html")), strippedHtml(wv->property("html").toString())); - QEXPECT_FAIL("", "TODO: get preferred width from QGraphicsWebView result", Continue); - QCOMPARE(wv->property("preferredWidth").toDouble(), 0.0); - QCOMPARE(wv->property("url").toUrl(), QUrl("qrc:///resources/basic.html")); - QCOMPARE(wv->property("status").toInt(), int(QDeclarativeWebView::Ready)); - QVERIFY(reloadAction->isEnabled()); - QVERIFY(!backAction->isEnabled()); - QVERIFY(!forwardAction->isEnabled()); - QVERIFY(!stopAction->isEnabled()); - reloadAction->trigger(); - waitForSignal(wv, SIGNAL(iconChanged())); - } - - wv->setProperty("url", QUrl("qrc:///resources/forward.html")); - waitForSignal(wv, SIGNAL(iconChanged())); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QCOMPARE(wv->property("title").toString(), QLatin1String("Forward")); - QTRY_COMPARE(qvariant_cast<QPixmap>(wv->property("icon")).width(), 32); - QCOMPARE(qvariant_cast<QPixmap>(wv->property("icon")), QPixmap(":/resources/forward.png")); - QCOMPARE(strippedHtml(fileContents(":/resources/forward.html")), strippedHtml(wv->property("html").toString())); - QCOMPARE(wv->property("url").toUrl(), QUrl("qrc:///resources/forward.html")); - QCOMPARE(wv->property("status").toInt(), int(QDeclarativeWebView::Ready)); - QCOMPARE(wv->property("statusText").toString(), QString()); - - QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=61042", Continue); - QVERIFY(reloadAction->isEnabled()); - QVERIFY(backAction->isEnabled()); - QVERIFY(!forwardAction->isEnabled()); - QEXPECT_FAIL("", "https://bugs.webkit.org/show_bug.cgi?id=61042", Continue); - QVERIFY(!stopAction->isEnabled()); - - backAction->trigger(); - waitForSignal(wv, SIGNAL(loadFinished())); - - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QCOMPARE(wv->property("title").toString(), QLatin1String("Basic")); - QCOMPARE(strippedHtml(fileContents(":/resources/basic.html")), strippedHtml(wv->property("html").toString())); - QCOMPARE(wv->property("url").toUrl(), QUrl("qrc:///resources/basic.html")); - QCOMPARE(wv->property("status").toInt(), int(QDeclarativeWebView::Ready)); - - QVERIFY(reloadAction->isEnabled()); - QVERIFY(!backAction->isEnabled()); - QVERIFY(forwardAction->isEnabled()); - QVERIFY(!stopAction->isEnabled()); -} - -static inline QVariant callEvaluateJavaScript(QObject *object, const QString& snippet) -{ - QVariant result; - QMetaObject::invokeMethod(object, "evaluateJavaScript", Q_RETURN_ARG(QVariant, result), Q_ARG(QString, snippet)); - return result; -} - -void tst_QDeclarativeWebView::javaScript() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/javaScript.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - - QCOMPARE(callEvaluateJavaScript(wv, "123").toInt(), 123); - QCOMPARE(callEvaluateJavaScript(wv, "window.status").toString(), QLatin1String("status here")); - QCOMPARE(callEvaluateJavaScript(wv, "window.myjsname.qmlprop").toString(), QLatin1String("qmlvalue")); -} - -void tst_QDeclarativeWebView::loadError() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/loadError.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QObject* wv = component.create(); - QVERIFY(wv); - QAction* reloadAction = wv->property("reload").value<QAction*>(); - QVERIFY(reloadAction); - - for (int i = 1; i <= 2; ++i) { - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QCOMPARE(wv->property("title").toString(), QString()); - QCOMPARE(wv->property("statusText").toString(), QString()); // HTML 'status bar' text, not error message - QCOMPARE(wv->property("url").toUrl(), QUrl("qrc:///resources/does-not-exist.html")); // Unlike QWebPage, which loses url - QCOMPARE(wv->property("status").toInt(), int(QDeclarativeWebView::Error)); - reloadAction->trigger(); - } -} - -void tst_QDeclarativeWebView::multipleWindows() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/newwindows.qml")); - checkNoErrors(component); - - QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(component.create()); - QVERIFY(rootItem); - - QTRY_COMPARE(rootItem->property("pagesOpened").toInt(), 4); - - QDeclarativeProperty prop(rootItem, "firstPageOpened"); - QObject* firstPageOpened = qvariant_cast<QObject*>(prop.read()); - QVERIFY(firstPageOpened); - - QDeclarativeProperty xProp(firstPageOpened, "x"); - QTRY_COMPARE(xProp.read().toReal(), qreal(150.0)); -} - -void tst_QDeclarativeWebView::newWindowComponent() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/propertychanges.qml")); - checkNoErrors(component); - QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(component.create()); - QVERIFY(rootItem); - QObject* wv = rootItem->findChild<QObject*>("webView"); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - - QDeclarativeComponent substituteComponent(&engine); - substituteComponent.setData("import QtQuick 1.0; WebView { objectName: 'newWebView'; url: 'basic.html'; }", QUrl::fromLocalFile("")); - QSignalSpy newWindowComponentSpy(wv, SIGNAL(newWindowComponentChanged())); - - wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); - QCOMPARE(wv->property("newWindowComponent"), QVariant::fromValue(&substituteComponent)); - QCOMPARE(newWindowComponentSpy.count(), 1); - - wv->setProperty("newWindowComponent", QVariant::fromValue(&substituteComponent)); - QCOMPARE(newWindowComponentSpy.count(), 1); - - wv->setProperty("newWindowComponent", QVariant::fromValue((QDeclarativeComponent*)0)); - QCOMPARE(newWindowComponentSpy.count(), 2); -} - -void tst_QDeclarativeWebView::newWindowParent() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/propertychanges.qml")); - checkNoErrors(component); - QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(component.create()); - QVERIFY(rootItem); - QObject* wv = rootItem->findChild<QObject*>("webView"); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - - QDeclarativeItem* oldWindowParent = rootItem->findChild<QDeclarativeItem*>("oldWindowParent"); - QCOMPARE(qvariant_cast<QDeclarativeItem*>(wv->property("newWindowParent")), oldWindowParent); - QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged())); - - QDeclarativeItem* newWindowParent = rootItem->findChild<QDeclarativeItem*>("newWindowParent"); - wv->setProperty("newWindowParent", QVariant::fromValue(newWindowParent)); - QVERIFY(newWindowParent); - QVERIFY(oldWindowParent); - QCOMPARE(oldWindowParent->childItems().count(), 0); - QCOMPARE(wv->property("newWindowParent"), QVariant::fromValue(newWindowParent)); - QCOMPARE(newWindowParentSpy.count(), 1); - - wv->setProperty("newWindowParent", QVariant::fromValue(newWindowParent)); - QCOMPARE(newWindowParentSpy.count(), 1); - - wv->setProperty("newWindowParent", QVariant::fromValue((QDeclarativeItem*)0)); - QCOMPARE(newWindowParentSpy.count(), 2); -} - -void tst_QDeclarativeWebView::preferredWidthTest() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/webviewtest.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - wv->setProperty("testUrl", QUrl("qrc:///resources/sample.html")); - QCOMPARE(wv->property("prefWidth").toInt(), 600); -} - -void tst_QDeclarativeWebView::preferredHeightTest() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/webviewtest.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - wv->setProperty("testUrl", QUrl("qrc:///resources/sample.html")); - QCOMPARE(wv->property("prefHeight").toInt(), 500); -} - -void tst_QDeclarativeWebView::preferredWidthDefaultTest() -{ - QGraphicsWebView view; - view.load(QUrl("qrc:///resources/sample.html")); - - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/webviewtestdefault.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - wv->setProperty("testUrl", QUrl("qrc:///resources/sample.html")); - QCOMPARE(wv->property("prefWidth").toDouble(), view.preferredWidth()); -} - -void tst_QDeclarativeWebView::preferredHeightDefaultTest() -{ - QGraphicsWebView view; - view.load(QUrl("qrc:///resources/sample.html")); - - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/webviewtestdefault.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - wv->setProperty("testUrl", QUrl("qrc:///resources/sample.html")); - QCOMPARE(wv->property("prefHeight").toDouble(), view.preferredHeight()); -} - -void tst_QDeclarativeWebView::pressGrabTime() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/propertychanges.qml")); - checkNoErrors(component); - QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(component.create()); - QVERIFY(rootItem); - QObject* wv = rootItem->findChild<QObject*>("webView"); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - QCOMPARE(wv->property("pressGrabTime").toInt(), 200); - QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged())); - - wv->setProperty("pressGrabTime", 100); - QCOMPARE(wv->property("pressGrabTime").toInt(), 100); - QCOMPARE(pressGrabTimeSpy.count(), 1); - - wv->setProperty("pressGrabTime", 100); - QCOMPARE(pressGrabTimeSpy.count(), 1); - - wv->setProperty("pressGrabTime", 0); - QCOMPARE(pressGrabTimeSpy.count(), 2); -} - -void tst_QDeclarativeWebView::renderingEnabled() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/propertychanges.qml")); - checkNoErrors(component); - QDeclarativeItem* rootItem = qobject_cast<QDeclarativeItem*>(component.create()); - QVERIFY(rootItem); - QObject* wv = rootItem->findChild<QObject*>("webView"); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - - QVERIFY(wv->property("renderingEnabled").toBool()); - QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged())); - - wv->setProperty("renderingEnabled", false); - QVERIFY(!wv->property("renderingEnabled").toBool()); - QCOMPARE(renderingEnabledSpy.count(), 1); - - wv->setProperty("renderingEnabled", false); - QCOMPARE(renderingEnabledSpy.count(), 1); - - wv->setProperty("renderingEnabled", true); - QCOMPARE(renderingEnabledSpy.count(), 2); -} - -void tst_QDeclarativeWebView::setHtml() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/sethtml.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - QCOMPARE(wv->property("html").toString(), QLatin1String("<html><head></head><body><p>This is a <b>string</b> set on the WebView</p></body></html>")); - - QSignalSpy spy(wv, SIGNAL(htmlChanged())); - wv->setProperty("html", QLatin1String("<html><head><title>Basic</title></head><body><p>text</p></body></html>")); - QCOMPARE(spy.count(), 1); -} - -void tst_QDeclarativeWebView::settings() -{ - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/basic.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - QTRY_COMPARE(wv->property("progress").toDouble(), 1.0); - - QObject* s = QDeclarativeProperty(wv, "settings").object(); - QVERIFY(s); - - QStringList settingsList; - settingsList << QString::fromLatin1("autoLoadImages") - << QString::fromLatin1("developerExtrasEnabled") - << QString::fromLatin1("javaEnabled") - << QString::fromLatin1("javascriptCanAccessClipboard") - << QString::fromLatin1("javascriptCanOpenWindows") - << QString::fromLatin1("javascriptEnabled") - << QString::fromLatin1("linksIncludedInFocusChain") - << QString::fromLatin1("localContentCanAccessRemoteUrls") - << QString::fromLatin1("localStorageDatabaseEnabled") - << QString::fromLatin1("offlineStorageDatabaseEnabled") - << QString::fromLatin1("offlineWebApplicationCacheEnabled") - << QString::fromLatin1("pluginsEnabled") - << QString::fromLatin1("printElementBackgrounds") - << QString::fromLatin1("privateBrowsingEnabled") - << QString::fromLatin1("zoomTextOnly"); - - // Merely tests that setting gets stored (in QWebSettings), behavioural tests are in WebKit. - for (int b = 0; b <= 1; b++) { - bool value = !!b; - foreach (const QString& name, settingsList) - s->setProperty(name.toLatin1().data(), value); - for (int i = 0; i < 2; i++) { - foreach (const QString& name, settingsList) - QCOMPARE(s->property(name.toLatin1().data()).toBool(), value); - } - } -} - -void tst_QDeclarativeWebView::backgroundColor() -{ - // We test here the rendering of the background. - QDeclarativeEngine engine; - QDeclarativeComponent component(&engine, QUrl("qrc:///resources/webviewbackgroundcolor.qml")); - checkNoErrors(component); - QObject* wv = component.create(); - QVERIFY(wv); - QCOMPARE(wv->property("backgroundColor").value<QColor>(), QColor(Qt::red)); - QDeclarativeView view; - view.setSource(QUrl("qrc:///resources/webviewbackgroundcolor.qml")); - view.show(); - QTest::qWaitForWindowShown(&view); - QPixmap result(view.width(), view.height()); - QPainter painter(&result); - view.render(&painter); - QPixmap reference(view.width(), view.height()); - reference.fill(Qt::red); - QCOMPARE(reference, result); - - // We test the emission of the backgroundColorChanged signal. - QSignalSpy spyColorChanged(wv, SIGNAL(backgroundColorChanged())); - wv->setProperty("backgroundColor", Qt::red); - QCOMPARE(spyColorChanged.count(), 0); - wv->setProperty("backgroundColor", Qt::green); - QCOMPARE(spyColorChanged.count(), 1); -} - -void tst_QDeclarativeWebView::checkNoErrors(const QDeclarativeComponent& component) -{ - // Wait until the component is ready - QTRY_VERIFY(component.isReady() || component.isError()); - if (component.isError()) { - QList<QDeclarativeError> errors = component.errors(); - for (int ii = 0; ii < errors.count(); ++ii) { - const QDeclarativeError &error = errors.at(ii); - QByteArray errorStr = QByteArray::number(error.line()) + ":" + - QByteArray::number(error.column()) + ":" + - error.description().toUtf8(); - qWarning() << errorStr; - } - } - QVERIFY(!component.isError()); -} - -QTEST_MAIN(tst_QDeclarativeWebView) -#include "tst_qdeclarativewebview.moc" diff --git a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc b/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc deleted file mode 100644 index fb66ad881..000000000 --- a/Source/WebKit/qt/tests/qdeclarativewebview/tst_qdeclarativewebview.qrc +++ /dev/null @@ -1,22 +0,0 @@ -<RCC> - <qresource prefix="/"> - <file>resources/basic.html</file> - <file>resources/basic.png</file> - <file>resources/basic.qml</file> - <file>resources/elements.html</file> - <file>resources/elements.qml</file> - <file>resources/forward.html</file> - <file>resources/forward.png</file> - <file>resources/javaScript.html</file> - <file>resources/javaScript.qml</file> - <file>resources/loadError.qml</file> - <file>resources/newwindows.html</file> - <file>resources/newwindows.qml</file> - <file>resources/propertychanges.qml</file> - <file>resources/sample.html</file> - <file>resources/sethtml.qml</file> - <file>resources/webviewbackgroundcolor.qml</file> - <file>resources/webviewtestdefault.qml</file> - <file>resources/webviewtest.qml</file> - </qresource> -</RCC> diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index 5e7a2d4e2..ba6a5b571 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,27 @@ +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestoneOptions) + * WebCoreSupport/WebFrameLoaderClient.cpp: + (WebFrameLoaderClient::dispatchDidLayout): + * WebCoreSupport/WebFrameLoaderClient.h: + (WebFrameLoaderClient): + + It is now necessary to opt into getting any of the + "layout milestone" notifications. + * WebView.cpp: + (WebView::initWithFrame): + 2012-09-19 Patrick Gansterer <paroga@webkit.org> [WIN] Use BString in favour of BSTR to improve memory management diff --git a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp index 64622968a..f0e93c0a1 100644 --- a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp +++ b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.cpp @@ -416,20 +416,20 @@ void WebFrameLoaderClient::dispatchDidFinishLoad() frameLoadDelegate->didFinishLoadForFrame(webView, m_webFrame); } -void WebFrameLoaderClient::dispatchDidFirstLayout() -{ - WebView* webView = m_webFrame->webView(); - COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePriv; - if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePriv)) && frameLoadDelegatePriv) - frameLoadDelegatePriv->didFirstLayoutInFrame(webView, m_webFrame); -} - -void WebFrameLoaderClient::dispatchDidFirstVisuallyNonEmptyLayout() +void WebFrameLoaderClient::dispatchDidLayout(LayoutMilestones milestones) { WebView* webView = m_webFrame->webView(); COMPtr<IWebFrameLoadDelegatePrivate> frameLoadDelegatePrivate; - if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate) - frameLoadDelegatePrivate->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame); + + if (milestones & DidFirstLayout) { + if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate) + frameLoadDelegatePrivate->didFirstLayoutInFrame(webView, m_webFrame); + } + + if (milestones & DidFirstVisuallyNonEmptyLayout) { + if (SUCCEEDED(webView->frameLoadDelegatePrivate(&frameLoadDelegatePrivate)) && frameLoadDelegatePrivate) + frameLoadDelegatePrivate->didFirstVisuallyNonEmptyLayoutInFrame(webView, m_webFrame); + } } Frame* WebFrameLoaderClient::dispatchCreatePage(const NavigationAction&) diff --git a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h index d65f1658b..d52f8120a 100644 --- a/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h +++ b/Source/WebKit/win/WebCoreSupport/WebFrameLoaderClient.h @@ -74,8 +74,7 @@ public: virtual void dispatchDidCommitLoad(); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(WebCore::LayoutMilestones); virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index 6f1069302..a90f67e75 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -2691,6 +2691,9 @@ HRESULT STDMETHODCALLTYPE WebView::initWithFrame( m_page = new Page(pageClients); provideGeolocationTo(m_page, new WebGeolocationClient(this)); + unsigned layoutMilestones = DidFirstLayout | DidFirstVisuallyNonEmptyLayout; + m_page->addLayoutMilestones(static_cast<LayoutMilestones>(layoutMilestones)); + BString localStoragePath; if (SUCCEEDED(m_preferences->localStorageDatabasePath(&localStoragePath))) m_page->settings()->setLocalStorageDatabasePath(toString(localStoragePath)); diff --git a/Source/WebKit/wince/ChangeLog b/Source/WebKit/wince/ChangeLog index d66fa5923..aa6bae9c6 100644 --- a/Source/WebKit/wince/ChangeLog +++ b/Source/WebKit/wince/ChangeLog @@ -1,3 +1,22 @@ +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestones) + * WebCoreSupport/FrameLoaderClientWinCE.cpp: + (WebKit::FrameLoaderClientWinCE::dispatchDidLayout): + * WebCoreSupport/FrameLoaderClientWinCE.h: + (FrameLoaderClientWinCE): + 2012-08-28 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r126914. diff --git a/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp b/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp index daefb90be..63fff82db 100644 --- a/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp +++ b/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.cpp @@ -376,12 +376,7 @@ void FrameLoaderClientWinCE::dispatchDidFinishDocumentLoad() notImplemented(); } -void FrameLoaderClientWinCE::dispatchDidFirstLayout() -{ - notImplemented(); -} - -void FrameLoaderClientWinCE::dispatchDidFirstVisuallyNonEmptyLayout() +void FrameLoaderClientWinCE::dispatchDidLayout(LayoutMilestones) { notImplemented(); } diff --git a/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h b/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h index 54e23926d..90ee494a4 100644 --- a/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h +++ b/Source/WebKit/wince/WebCoreSupport/FrameLoaderClientWinCE.h @@ -83,8 +83,7 @@ public: virtual void dispatchDidFailLoad(const WebCore::ResourceError&); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(WebCore::LayoutMilestones); virtual WebCore::Frame* dispatchCreatePage(const WebCore::NavigationAction&); virtual void dispatchShow(); diff --git a/Source/WebKit/wx/ChangeLog b/Source/WebKit/wx/ChangeLog index f3e82445c..2f2ba758b 100644 --- a/Source/WebKit/wx/ChangeLog +++ b/Source/WebKit/wx/ChangeLog @@ -1,3 +1,22 @@ +2012-09-25 Beth Dakin <bdakin@apple.com> + + https://bugs.webkit.org/show_bug.cgi?id=95397 + Need to merge didFirstVisuallyNonEmptyLayout and + didNewFirstVisuallyNonEmptyLayout + -and corresponding- + <rdar://problem/10791680> + + Reviewed by Sam Weinig. + + Remove dispatchDidFirstLayout, + dispatchDidFirstVisuallyNonEmptyLayout, and + dispatchDidNewFirstVisuallyNonEmptyLayout. Their functionality + is now replaced by dispatchDidLayout(LayoutMilestones) + * WebKitSupport/FrameLoaderClientWx.cpp: + (WebCore::FrameLoaderClientWx::dispatchDidLayout): + * WebKitSupport/FrameLoaderClientWx.h: + (FrameLoaderClientWx): + 2012-09-12 Sheriff Bot <webkit.review.bot@gmail.com> Unreviewed, rolling out r127876. diff --git a/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp index 8ac269675..f6ba4dde4 100644 --- a/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp +++ b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -354,13 +354,7 @@ void FrameLoaderClientWx::dispatchDidFinishLoad() notImplemented(); } - -void FrameLoaderClientWx::dispatchDidFirstLayout() -{ - notImplemented(); -} - -void FrameLoaderClientWx::dispatchDidFirstVisuallyNonEmptyLayout() +void FrameLoaderClientWx::dispatchDidLayout(LayoutMilestones) { notImplemented(); } diff --git a/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h index dd6fd88f7..4dd272582 100644 --- a/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h +++ b/Source/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -114,8 +114,7 @@ namespace WebCore { virtual void dispatchDidCommitLoad(); virtual void dispatchDidFinishDocumentLoad(); virtual void dispatchDidFinishLoad(); - virtual void dispatchDidFirstLayout(); - virtual void dispatchDidFirstVisuallyNonEmptyLayout(); + virtual void dispatchDidLayout(WebCore::LayoutMilestones); virtual void dispatchDidChangeIcons(WebCore::IconType); virtual void dispatchShow(); |
