diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:51:15 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-07-16 14:51:15 +0200 |
commit | 4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26 (patch) | |
tree | 7bb9ad7e31c24d1cf1707e03e6f1a80f6d033951 /Source/WebKit | |
parent | 3977e3d2f72f7fe2c887c1ec0e0c342e1d169f42 (diff) | |
download | qtwebkit-4e6b3a206fa4ad8bb0b664f7674c9a70376d6e26.tar.gz |
Imported WebKit commit 953baa67aa07087b6ecd4199351ec554c724e27d (http://svn.webkit.org/repository/webkit/trunk@122676)
Diffstat (limited to 'Source/WebKit')
126 files changed, 3250 insertions, 1583 deletions
diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog index 88fe273a8..7614d4154 100644 --- a/Source/WebKit/ChangeLog +++ b/Source/WebKit/ChangeLog @@ -1,3 +1,38 @@ +2012-07-13 Thiago Marcos P. Santos <thiago.santos@intel.com> + + [CMake] Proper handling of ENABLE_API_TESTS build option + https://bugs.webkit.org/show_bug.cgi?id=91221 + + Reviewed by Rob Buis. + + Build unit tests only if ENABLE_API_TESTS is set. + + * PlatformEfl.cmake: + +2012-07-12 Simon Hausmann <simon.hausmann@nokia.com> + + Typo in path in generate-webkitversion.pl + https://bugs.webkit.org/show_bug.cgi?id=90883 + + Reviewed by Mark Rowe. + + Correct default path to version config file. In practice it wasn't a problem because only the Qt + build system seems to use the script right now and passes the path to the version file as a + command line parameter. + + * scripts/generate-webkitversion.pl: + +2012-07-11 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Implement Date/Time picker + https://bugs.webkit.org/show_bug.cgi?id=90911 + + Reviewed by Rob Buis. + + Add files into make file. + + * PlatformBlackBerry.cmake: + 2012-07-09 Christophe Dumez <christophe.dumez@intel.com> [EFL] Battery status code needs refactoring to be reused in WebKit2 diff --git a/Source/WebKit/PlatformBlackBerry.cmake b/Source/WebKit/PlatformBlackBerry.cmake index fa61b8bbe..aac068b48 100644 --- a/Source/WebKit/PlatformBlackBerry.cmake +++ b/Source/WebKit/PlatformBlackBerry.cmake @@ -91,6 +91,7 @@ LIST(APPEND WebKit_SOURCES blackberry/WebCoreSupport/VibrationClientBlackBerry.cpp blackberry/WebCoreSupport/PagePopupBlackBerry.cpp blackberry/WebCoreSupport/SelectPopupClient.cpp + blackberry/WebCoreSupport/DatePickerClient.cpp blackberry/WebKitSupport/BackingStoreCompositingSurface.cpp blackberry/WebKitSupport/BackingStoreTile.cpp blackberry/WebKitSupport/BackingStoreClient.cpp diff --git a/Source/WebKit/PlatformEfl.cmake b/Source/WebKit/PlatformEfl.cmake index a3fd10911..f6800af57 100644 --- a/Source/WebKit/PlatformEfl.cmake +++ b/Source/WebKit/PlatformEfl.cmake @@ -350,13 +350,15 @@ SET(EWKUnitTests_BINARIES test_ewk_view ) -FOREACH(testName ${EWKUnitTests_BINARIES}) - ADD_EXECUTABLE(${testName} ${WEBKIT_EFL_TEST_DIR}/${testName}.cpp ${WEBKIT_EFL_TEST_DIR}/test_runner.cpp) - ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) - TARGET_LINK_LIBRARIES(${testName} ${EWKUnitTests_LIBRARIES} ewkTestUtils gtest pthread) - ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}") - SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit") -ENDFOREACH() +IF (ENABLE_API_TESTS) + FOREACH (testName ${EWKUnitTests_BINARIES}) + ADD_EXECUTABLE(${testName} ${WEBKIT_EFL_TEST_DIR}/${testName}.cpp ${WEBKIT_EFL_TEST_DIR}/test_runner.cpp) + ADD_TEST(${testName} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${testName}) + TARGET_LINK_LIBRARIES(${testName} ${EWKUnitTests_LIBRARIES} ewkTestUtils gtest pthread) + ADD_TARGET_PROPERTIES(${testName} LINK_FLAGS "${EWKUnitTests_LINK_FLAGS}") + SET_TARGET_PROPERTIES(${testName} PROPERTIES FOLDER "WebKit") + ENDFOREACH () +ENDIF () IF (ENABLE_INSPECTOR) SET(WEB_INSPECTOR_DIR ${CMAKE_BINARY_DIR}/WebKit/efl/webinspector) diff --git a/Source/WebKit/blackberry/Api/BackingStore.cpp b/Source/WebKit/blackberry/Api/BackingStore.cpp index beb09c2c4..588ee9d52 100644 --- a/Source/WebKit/blackberry/Api/BackingStore.cpp +++ b/Source/WebKit/blackberry/Api/BackingStore.cpp @@ -77,9 +77,6 @@ namespace WebKit { const int s_renderTimerTimeout = 1.0; WebPage* BackingStorePrivate::s_currentBackingStoreOwner = 0; -Platform::Graphics::Buffer* BackingStorePrivate::s_overScrollImage = 0; -std::string BackingStorePrivate::s_overScrollImagePath; -Platform::IntSize BackingStorePrivate::s_overScrollImageSize; typedef std::pair<int, int> Divisor; typedef Vector<Divisor> DivisorList; @@ -1219,52 +1216,6 @@ void BackingStorePrivate::copyPreviousContentsToBackSurfaceOfTile(const Platform } } -bool BackingStorePrivate::ensureOverScrollImage() -{ - std::string path = m_webPage->settings()->overScrollImagePath().utf8(); - if (path == "") - return false; - - if (s_overScrollImage && path == s_overScrollImagePath) - return true; - - std::string imagePath = Platform::Client::get()->getApplicationLocalDirectory() + path; - - SkBitmap bitmap; - if (!SkImageDecoder::DecodeFile(imagePath.c_str(), &bitmap)) { - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelCritical, - "BackingStorePrivate::ensureOverScrollImage could not decode overscroll image: %s", imagePath.c_str()); - return false; - } - - destroyBuffer(s_overScrollImage); - s_overScrollImage = createBuffer(Platform::IntSize(bitmap.width(), bitmap.height()), Platform::Graphics::TemporaryBuffer); - - SkCanvas* canvas = Platform::Graphics::lockBufferDrawable(s_overScrollImage); - if (!canvas) { - destroyBuffer(s_overScrollImage); - s_overScrollImage = 0; - return false; - } - - SkPaint paint; - paint.setXfermodeMode(SkXfermode::kSrc_Mode); - paint.setFlags(SkPaint::kAntiAlias_Flag); - paint.setFilterBitmap(true); - - SkRect rect = SkRect::MakeXYWH(0, 0, bitmap.width(), bitmap.height()); - canvas->save(); - canvas->drawBitmapRect(bitmap, 0, rect, &paint); - canvas->restore(); - - Platform::Graphics::releaseBufferDrawable(s_overScrollImage); - - s_overScrollImageSize = Platform::IntSize(bitmap.width(), bitmap.height()); - s_overScrollImagePath = path; - - return true; -} - void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& contents, const WebCore::TransformationMatrix& transformation, bool flush) @@ -1273,11 +1224,8 @@ void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& conten Platform::IntPoint origin = contents.location(); Platform::IntRect contentsClipped = contents; - // We have to paint the default background in the case of overzoom and // make sure it is invalidated. - Color color(m_webPage->settings()->overZoomColor()); - Platform::IntRectRegion overScrollRegion = Platform::IntRectRegion::subtractRegions(Platform::IntRect(contentsClipped), contentsRect); @@ -1294,21 +1242,13 @@ void BackingStorePrivate::paintDefaultBackground(const Platform::IntRect& conten overScrollRect.intersect(Platform::IntRect(Platform::IntPoint(0, 0), surfaceSize())); } - if (ensureOverScrollImage()) { - // Tile the image on the window region. - Platform::IntRect dstRect; - for (int y = overScrollRect.y(); y < overScrollRect.y() + overScrollRect.height(); y += dstRect.height()) { - for (int x = overScrollRect.x(); x < overScrollRect.x() + overScrollRect.width(); x += dstRect.width()) { - Platform::IntRect imageRect = Platform::IntRect(Platform::IntPoint(x - (x % s_overScrollImageSize.width()), - y - (y % s_overScrollImageSize.height())), s_overScrollImageSize); - dstRect = imageRect; - dstRect.intersect(overScrollRect); - Platform::IntRect srcRect = Platform::IntRect(x - imageRect.x(), y - imageRect.y(), dstRect.width(), dstRect.height()); - blitToWindow(dstRect, s_overScrollImage, srcRect, false, 255); - } - } - } else + if (m_webPage->settings()->isEnableDefaultOverScrollBackground()) { + fillWindow(BlackBerry::Platform::Graphics::DefaultBackgroundPattern, + overScrollRect, overScrollRect.location(), 1.0 /*contentsScale*/); + } else { + Color color(m_webPage->settings()->overScrollColor()); clearWindow(overScrollRect, color.red(), color.green(), color.blue(), color.alpha()); + } } } @@ -1426,7 +1366,8 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, #if DEBUG_CHECKERBOARD blitCheckered = true; #endif - checkerWindow(dstRect, checkeredRects.at(i).location(), transformation.a()); + fillWindow(BlackBerry::Platform::Graphics::CheckerboardPattern, + dstRect, checkeredRects.at(i).location(), transformation.a()); } } @@ -1485,7 +1426,8 @@ void BackingStorePrivate::blitContents(const Platform::IntRect& dstRect, #if DEBUG_CHECKERBOARD blitCheckered = true; #endif - checkerWindow(dirtyRectT, contentsOrigin, transformation.a()); + fillWindow(BlackBerry::Platform::Graphics::CheckerboardPattern, + dirtyRectT, contentsOrigin, transformation.a()); } // Blit the visible buffer here if we have visible zoom jobs. @@ -2507,9 +2449,10 @@ void BackingStorePrivate::blitToWindow(const Platform::IntRect& dstRect, } -void BackingStorePrivate::checkerWindow(const Platform::IntRect& dstRect, - const Platform::IntPoint& contentsOrigin, - double contentsScale) +void BackingStorePrivate::fillWindow(Platform::Graphics::FillPattern pattern, + const Platform::IntRect& dstRect, + const Platform::IntPoint& contentsOrigin, + double contentsScale) { ASSERT(BlackBerry::Platform::userInterfaceThreadMessageClient()->isCurrentThread()); @@ -2519,11 +2462,9 @@ void BackingStorePrivate::checkerWindow(const Platform::IntRect& dstRect, BlackBerry::Platform::Graphics::Buffer* dstBuffer = buffer(); ASSERT(dstBuffer); if (!dstBuffer) - BlackBerry::Platform::log(BlackBerry::Platform::LogLevelWarn, "Empty window buffer, couldn't checkerWindow"); + BlackBerry::Platform::log(BlackBerry::Platform::LogLevelWarn, "Empty window buffer, couldn't fillWindow"); - Color color(m_webPage->settings()->backgroundColor()); - unsigned char alpha = color.alpha(); - BlackBerry::Platform::Graphics::checkerBuffer(dstBuffer, dstRect, contentsOrigin, contentsScale, alpha); + BlackBerry::Platform::Graphics::fillBuffer(dstBuffer, pattern, dstRect, contentsOrigin, contentsScale); } void BackingStorePrivate::invalidateWindow() diff --git a/Source/WebKit/blackberry/Api/BackingStore_p.h b/Source/WebKit/blackberry/Api/BackingStore_p.h index 447a10414..a09ecd43a 100644 --- a/Source/WebKit/blackberry/Api/BackingStore_p.h +++ b/Source/WebKit/blackberry/Api/BackingStore_p.h @@ -307,7 +307,7 @@ public: void renderContents(Platform::Graphics::Drawable* /*drawable*/, const Platform::IntRect& /*contentsRect*/, const Platform::IntSize& /*destinationSize*/) const; void blitToWindow(const Platform::IntRect& dstRect, const BlackBerry::Platform::Graphics::Buffer* srcBuffer, const Platform::IntRect& srcRect, bool blend, unsigned char globalAlpha); - void checkerWindow(const Platform::IntRect& dstRect, const Platform::IntPoint& contentsOrigin, double contentsScale); + void fillWindow(Platform::Graphics::FillPattern, const Platform::IntRect& dstRect, const Platform::IntPoint& contentsOrigin, double contentsScale); void invalidateWindow(); void invalidateWindow(const Platform::IntRect& dst); @@ -335,8 +335,6 @@ public: BlackBerry::Platform::IntSize surfaceSize() const; BlackBerry::Platform::Graphics::Buffer* buffer() const; - bool ensureOverScrollImage(); - static WebPage* s_currentBackingStoreOwner; bool m_suspendScreenUpdates; @@ -378,10 +376,6 @@ public: bool m_isDirectRenderingAnimationMessageScheduled; #endif - static Platform::Graphics::Buffer* s_overScrollImage; - static std::string s_overScrollImagePath; - static Platform::IntSize s_overScrollImageSize; - protected: virtual ~BackingStorePrivate(); }; diff --git a/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp b/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp index 3250601dd..1c2813ee8 100644 --- a/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp +++ b/Source/WebKit/blackberry/Api/WebKitTextCodec.cpp @@ -19,10 +19,10 @@ #include "config.h" #include "WebKitTextCodec.h" -#include "Base64.h" #include "KURL.h" #include "TextCodecICU.h" #include <wtf/Vector.h> +#include <wtf/text/Base64.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> @@ -84,28 +84,38 @@ TranscodeResult transcode(const char* sourceEncoding, const char* targetEncoding return Success; } -WebCore::Base64DecodePolicy base64DecodePolicyForWebCore(Base64DecodePolicy policy) +WTF::Base64DecodePolicy base64DecodePolicyForWTF(Base64DecodePolicy policy) { - // Must make sure Base64DecodePolicy is the same in WebKit and WebCore! - return static_cast<WebCore::Base64DecodePolicy>(policy); + COMPILE_ASSERT(WTF::Base64FailOnInvalidCharacter == static_cast<WTF::Base64DecodePolicy>(Base64FailOnInvalidCharacter)); + COMPILE_ASSERT(WTF::Base64IgnoreWhitespace == static_cast<WTF::Base64DecodePolicy>(Base64IgnoreWhitespace)); + COMPILE_ASSERT(WTF::Base64IgnoreInvalidCharacters == static_cast<WTF::Base64DecodePolicy>(Base64IgnoreInvalidCharacters)); + return static_cast<WTF::Base64DecodePolicy>(policy); } bool base64Decode(const std::string& base64, std::vector<char>& binary, Base64DecodePolicy policy) { Vector<char> result; - if (!WebCore::base64Decode(base64.c_str(), base64.length(), result, base64DecodePolicyForWebCore(policy))) + if (!WTF::base64Decode(base64.c_str(), base64.length(), result, base64DecodePolicyForWTF(policy))) return false; binary.insert(binary.begin(), result.begin(), result.end()); return true; } +WTF::Base64DecodePolicy base64EncodePolicyForWTF(Base64EncodePolicy policy) +{ + // FIXME: Base64InsertCRLF should be Base64InsertLFs. WTF::encodeBase64 doesn't insert CR. + COMPILE_ASSERT(WTF::Base64DoNotInsertLFs == static_cast<WTF::Base64EncodePolicy>(Base64DoNotInsertCRLF)); + COMPILE_ASSERT(WTF::Base64InsertLFs == static_cast<WTF::Base64EncodePolicy>(Base64InsertCRLF)); + return static_cast<WTF::Base64EncodePolicy>(policy); +} + bool base64Encode(const std::vector<char>& binary, std::string& base64, Base64EncodePolicy policy) { Vector<char> result; result.append(&binary[0], binary.size()); - WebCore::base64Encode(&binary[0], binary.size(), result, Base64InsertCRLF == policy ? true : false); + WTF::base64Encode(&binary[0], binary.size(), result, base64EncodePolicyForWTF(policy)); base64.clear(); base64.append(&result[0], result.size()); diff --git a/Source/WebKit/blackberry/Api/WebPage.cpp b/Source/WebKit/blackberry/Api/WebPage.cpp index e318003b4..97b56a7b2 100644 --- a/Source/WebKit/blackberry/Api/WebPage.cpp +++ b/Source/WebKit/blackberry/Api/WebPage.cpp @@ -337,6 +337,7 @@ WebPagePrivate::WebPagePrivate(WebPage* webPage, WebPageClient* client, const In , m_visible(false) , m_activationState(ActivationActive) , m_shouldResetTilesWhenShown(false) + , m_shouldZoomToInitialScaleAfterLoadFinished(false) , m_userScalable(true) , m_userPerformedManualZoom(false) , m_userPerformedManualScroll(false) @@ -881,9 +882,8 @@ bool WebPage::executeJavaScriptFunction(const std::vector<std::string> &function JSObjectRef functionObject = obj; JSValueRef result = 0; - JSValueRef exception; if (functionObject && thisObject) - result = JSObjectCallAsFunction(ctx, functionObject, thisObject, args.size(), argListRef.data(), &exception); + result = JSObjectCallAsFunction(ctx, functionObject, thisObject, args.size(), argListRef.data(), 0); for (unsigned i = 0; i < args.size(); ++i) JSStringRelease(argList[i]); @@ -892,11 +892,6 @@ bool WebPage::executeJavaScriptFunction(const std::vector<std::string> &function if (!value) { returnType = JSException; - JSStringRef stringRef = JSValueToStringCopy(ctx, exception, 0); - size_t bufferSize = JSStringGetMaximumUTF8CStringSize(stringRef); - WTF::Vector<char> buffer(bufferSize); - JSStringGetUTF8CString(stringRef, buffer.data(), bufferSize); - returnValue = WebString::fromUtf8(buffer.data()); return false; } @@ -1060,6 +1055,7 @@ void WebPagePrivate::setLoadState(LoadState state) m_backingStore->d->resetRenderQueue(); m_backingStore->d->resetTiles(true /* resetBackground */); m_backingStore->d->setScrollingOrZooming(false, false /* shouldBlit */); + m_shouldZoomToInitialScaleAfterLoadFinished = false; m_userPerformedManualZoom = false; m_userPerformedManualScroll = false; m_shouldUseFixedDesktopMode = false; @@ -1084,14 +1080,13 @@ void WebPagePrivate::setLoadState(LoadState state) frameLoadType = m_mainFrame->loader()->loadType(); if (!((m_didRestoreFromPageCache && documentHasViewportArguments) || (frameLoadType == FrameLoadTypeReload || frameLoadType == FrameLoadTypeReloadFromOrigin))) { m_viewportArguments = ViewportArguments(); + m_userScalable = m_webSettings->isUserScalable(); + resetScales(); // At the moment we commit a new load, set the viewport arguments // to any fallback values. If there is a meta viewport in the // content it will overwrite the fallback arguments soon. dispatchViewportPropertiesDidChange(m_userViewportArguments); - - m_userScalable = m_webSettings->isUserScalable(); - resetScales(); } else { IntSize virtualViewport = recomputeVirtualViewportFromViewportArguments(); m_webPage->setVirtualViewportSize(virtualViewport.width(), virtualViewport.height()); @@ -1706,9 +1701,10 @@ void WebPagePrivate::layoutFinished() m_nestedLayoutFinishedCount++; - if (shouldZoomToInitialScaleOnLoad()) + if (shouldZoomToInitialScaleOnLoad()) { zoomToInitialScaleOnLoad(); - else if (loadState() != None) + m_shouldZoomToInitialScaleAfterLoadFinished = false; + } else if (loadState() != None) notifyTransformedContentsSizeChanged(); m_nestedLayoutFinishedCount--; @@ -1743,19 +1739,6 @@ void WebPagePrivate::layoutFinished() } } -bool WebPagePrivate::shouldZoomToInitialScaleOnLoad() const -{ - // 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 = FrameLoadTypeStandard; - if (m_mainFrame && m_mainFrame->loader()) - frameLoadType = m_mainFrame->loader()->loadType(); - if (m_loadState == Committed || (m_loadState == Finished && (frameLoadType == FrameLoadTypeSame || frameLoadType == FrameLoadTypeStandard))) - return true; - return false; -} - void WebPagePrivate::zoomToInitialScaleOnLoad() { #if DEBUG_WEBPAGE_LOAD @@ -2344,6 +2327,11 @@ PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredent return static_cast<PageClientBlackBerry::SaveCredentialType>(m_client->notifyShouldSaveCredential(isNew)); } +void WebPagePrivate::syncProxyCredential(const WebCore::Credential& credential) +{ + m_client->syncProxyCredential(credential.user().utf8().data(), credential.password().utf8().data()); +} + void WebPagePrivate::notifyPopupAutofillDialog(const Vector<String>& candidates, const WebCore::IntRect& screenRect) { vector<string> textItems; @@ -4125,37 +4113,7 @@ bool WebPagePrivate::handleWheelEvent(PlatformWheelEvent& wheelEvent) bool WebPage::touchEvent(const Platform::TouchEvent& event) { #if DEBUG_TOUCH_EVENTS - switch (event.m_type) { - case Platform::TouchEvent::TouchEnd: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent Touch End"); - break; - case Platform::TouchEvent::TouchStart: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent Touch Start"); - break; - case Platform::TouchEvent::TouchMove: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent Touch Move"); - break; - case Platform::TouchEvent::TouchCancel: - Platform::log(Platform::LogLevelCritical, "WebPage::touchCancel Touch Cancel"); - break; - } - - for (unsigned i = 0; i < event.m_points.size(); i++) { - switch (event.m_points[i].m_state) { - case Platform::TouchPoint::TouchPressed: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Pressed (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - case Platform::TouchPoint::TouchReleased: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Released (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - case Platform::TouchPoint::TouchMoved: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Moved (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - case Platform::TouchPoint::TouchStationary: - Platform::log(Platform::LogLevelCritical, "WebPage::touchEvent %d Touch Stationary (%d, %d)", event.m_points[i].m_id, event.m_points[i].m_pos.x(), event.m_points[i].m_pos.y()); - break; - } - } + BBLOG(LogLevelCritical, "%s", event.toString().c_str()); #endif #if ENABLE(TOUCH_EVENTS) diff --git a/Source/WebKit/blackberry/Api/WebPageClient.h b/Source/WebKit/blackberry/Api/WebPageClient.h index 8ba09dd0a..2742492d1 100644 --- a/Source/WebKit/blackberry/Api/WebPageClient.h +++ b/Source/WebKit/blackberry/Api/WebPageClient.h @@ -135,7 +135,7 @@ public: virtual void notifyContentRendered(const Platform::IntRect&) = 0; virtual void resizeSurfaceIfNeeded() = 0; - virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle) = 0; + virtual void inputFocusGained(Platform::BlackBerryInputType, int inputStyle, Platform::VirtualKeyboardType, Platform::VirtualKeyboardEnterKeyType) = 0; virtual void inputFocusLost() = 0; virtual void inputTextChanged() = 0; virtual void inputSelectionChanged(unsigned selectionStart, unsigned selectionEnd) = 0; @@ -215,6 +215,7 @@ public: virtual void setPreventsScreenIdleDimming(bool noDimming) = 0; virtual bool authenticationChallenge(const unsigned short* realm, unsigned int realmLength, WebString& username, WebString& password) = 0; virtual SaveCredentialType notifyShouldSaveCredential(bool isNew) = 0; + virtual void syncProxyCredential(const WebString& username, const WebString& password) = 0; virtual void notifyPopupAutofillDialog(const std::vector<std::string>&, const Platform::IntRect&) = 0; virtual void notifyDismissAutofillDialog() = 0; diff --git a/Source/WebKit/blackberry/Api/WebPage_p.h b/Source/WebKit/blackberry/Api/WebPage_p.h index a0ffce066..0e46b73c5 100644 --- a/Source/WebKit/blackberry/Api/WebPage_p.h +++ b/Source/WebKit/blackberry/Api/WebPage_p.h @@ -191,6 +191,7 @@ public: virtual bool isVisible() const { return m_visible; } virtual bool authenticationChallenge(const WebCore::KURL&, const WebCore::ProtectionSpace&, WebCore::Credential&); virtual SaveCredentialType notifyShouldSaveCredential(bool); + virtual void syncProxyCredential(const WebCore::Credential&); // Called from within WebKit via ChromeClientBlackBerry. void enterFullscreenForNode(WebCore::Node*); @@ -206,7 +207,12 @@ public: void notifyPopupAutofillDialog(const Vector<String>&, const WebCore::IntRect&); void notifyDismissAutofillDialog(); - bool shouldZoomToInitialScaleOnLoad() const; + bool shouldZoomToInitialScaleOnLoad() const { return loadState() == Committed || m_shouldZoomToInitialScaleAfterLoadFinished; } + void setShouldZoomToInitialScaleAfterLoadFinished(bool shouldZoomToInitialScaleAfterLoadFinished) + { + m_shouldZoomToInitialScaleAfterLoadFinished = shouldZoomToInitialScaleAfterLoadFinished; + } + // Called according to our heuristic or from setLoadState depending on whether we have a virtual viewport. void zoomToInitialScaleOnLoad(); @@ -459,6 +465,7 @@ public: bool m_visible; ActivationStateType m_activationState; bool m_shouldResetTilesWhenShown; + bool m_shouldZoomToInitialScaleAfterLoadFinished; bool m_userScalable; bool m_userPerformedManualZoom; bool m_userPerformedManualScroll; diff --git a/Source/WebKit/blackberry/Api/WebSettings.cpp b/Source/WebKit/blackberry/Api/WebSettings.cpp index 0cf36cc69..1156d741a 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.cpp +++ b/Source/WebKit/blackberry/Api/WebSettings.cpp @@ -23,7 +23,6 @@ #include "WebSettings_p.h" #include "WebString.h" -#include <Base64.h> #include <BlackBerryPlatformDeviceInfo.h> #include <BlackBerryPlatformFontInfo.h> #include <BlackBerryPlatformScreen.h> @@ -33,6 +32,7 @@ #include <ViewportArguments.h> #include <wtf/HashSet.h> #include <wtf/Vector.h> +#include <wtf/text/Base64.h> namespace BlackBerry { namespace WebKit { @@ -48,8 +48,8 @@ DEFINE_STATIC_LOCAL(String, BlackBerryHandlePatternURLs, ("BlackBerryHandlePatte DEFINE_STATIC_LOCAL(String, BlackBerryInitialScale, ("BlackBerryInitialScale")); DEFINE_STATIC_LOCAL(String, BlackBerryLinksHandledExternallyEnabled, ("BlackBerryLinksHandledExternallyEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryMaxPluginInstances, ("BlackBerryMaxPluginInstances")); -DEFINE_STATIC_LOCAL(String, BlackBerryOverZoomColor, ("BlackBerryOverZoomColor")); -DEFINE_STATIC_LOCAL(String, BlackBerryOverScrollImagePath, ("BlackBerryOverScrollImagePath")); +DEFINE_STATIC_LOCAL(String, BlackBerryOverScrollColor, ("BlackBerryOverScrollColor")); +DEFINE_STATIC_LOCAL(String, BlackBerryEnableDefaultOverScrollBackground, ("BlackBerryEnableDefaultOverScrollBackground")); DEFINE_STATIC_LOCAL(String, BlackBerryRenderAnimationsOnScrollOrZoomEnabled, ("BlackBerryRenderAnimationsOnScrollOrZoomEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryScrollbarsEnabled, ("BlackBerryScrollbarsEnabled")); DEFINE_STATIC_LOCAL(String, BlackBerryTextReflowMode, ("BlackBerryTextReflowMode")); @@ -164,8 +164,8 @@ WebSettings* WebSettings::standardSettings() settings->m_private->setBoolean(BlackBerryCookiesEnabled, true); settings->m_private->setDouble(BlackBerryInitialScale, -1); settings->m_private->setUnsigned(BlackBerryMaxPluginInstances, 1); - settings->m_private->setUnsigned(BlackBerryOverZoomColor, WebCore::Color::white); - settings->m_private->setString(BlackBerryOverScrollImagePath, ""); + settings->m_private->setUnsigned(BlackBerryOverScrollColor, WebCore::Color::white); + settings->m_private->setBoolean(BlackBerryEnableDefaultOverScrollBackground, true); settings->m_private->setBoolean(BlackBerryScrollbarsEnabled, true); // FIXME: We should detect whether we are embedded in a browser or an email client and default to TextReflowEnabledOnlyForBlockZoom and TextReflowEnabled, respectively. @@ -471,7 +471,7 @@ void WebSettings::setUserStyleSheetString(const char* userStyleSheetString) data.append(userStyleSheetString, length); Vector<char> encodedData; - WebCore::base64Encode(data, encodedData); + base64Encode(data, encodedData); const char prefix[] = "data:text/css;charset=utf-8;base64,"; size_t prefixLength = sizeof(prefix) - 1; @@ -707,24 +707,24 @@ void WebSettings::setShouldRenderAnimationsOnScrollOrZoom(bool enable) m_private->setBoolean(BlackBerryRenderAnimationsOnScrollOrZoomEnabled, enable); } -unsigned WebSettings::overZoomColor() const +unsigned WebSettings::overScrollColor() const { - return m_private->getUnsigned(BlackBerryOverZoomColor); + return m_private->getUnsigned(BlackBerryOverScrollColor); } -void WebSettings::setOverZoomColor(unsigned color) +void WebSettings::setOverScrollColor(unsigned color) { - m_private->setUnsigned(BlackBerryOverZoomColor, color); + m_private->setUnsigned(BlackBerryOverScrollColor, color); } -WebString WebSettings::overScrollImagePath() const +bool WebSettings::isEnableDefaultOverScrollBackground() const { - return m_private->getString(BlackBerryOverScrollImagePath); + return m_private->getBoolean(BlackBerryEnableDefaultOverScrollBackground); } -void WebSettings::setOverScrollImagePath(const char* path) +void WebSettings::setEnableDefaultOverScrollBackground(bool enabled) { - m_private->setString(BlackBerryOverScrollImagePath, path); + m_private->setBoolean(BlackBerryEnableDefaultOverScrollBackground, enabled); } unsigned WebSettings::backgroundColor() const diff --git a/Source/WebKit/blackberry/Api/WebSettings.h b/Source/WebKit/blackberry/Api/WebSettings.h index a1ee57b8a..39f7c209b 100644 --- a/Source/WebKit/blackberry/Api/WebSettings.h +++ b/Source/WebKit/blackberry/Api/WebSettings.h @@ -198,11 +198,11 @@ public: bool shouldRenderAnimationsOnScrollOrZoom() const; void setShouldRenderAnimationsOnScrollOrZoom(bool enable); - unsigned overZoomColor() const; - void setOverZoomColor(unsigned); + unsigned overScrollColor() const; + void setOverScrollColor(unsigned); - WebString overScrollImagePath() const; - void setOverScrollImagePath(const char*); + bool isEnableDefaultOverScrollBackground() const; + void setEnableDefaultOverScrollBackground(bool); unsigned backgroundColor() const; void setBackgroundColor(unsigned); diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index a7df5802a..46ae45d59 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,241 @@ +2012-07-13 Xianzhu Wang <wangxianzhu@chromium.org> + + Move WebCore/platform/text/Base64 to WTF/wtf/text + https://bugs.webkit.org/show_bug.cgi?id=91162 + + Reviewed by Adam Barth. + + * Api/WebKitTextCodec.cpp: + (BlackBerry::WebKit::base64DecodePolicyForWTF): + (BlackBerry::WebKit::base64Decode): + (BlackBerry::WebKit::base64EncodePolicyForWTF): + (BlackBerry::WebKit::base64Encode): + * Api/WebSettings.cpp: + (BlackBerry::WebKit::WebSettings::setUserStyleSheetString): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + +2012-07-13 George Staikos <staikos@webkit.org> + + [BlackBerry] Fix crash due to unguarded use of renderer in select + popup. + https://bugs.webkit.org/show_bug.cgi?id=91287 + + Reviewed by Rob Buis. + + No known testcase for this. Found in the wild. + + * WebCoreSupport/SelectPopupClient.cpp: + (WebCore::SelectPopupClient::setValueAndClosePopup): + +2012-07-13 Mike Fenton <mifenton@rim.com> + + [BlackBerry] Add support for attributes to define keyboard and enter key type on the Virtual Keyboard + https://bugs.webkit.org/show_bug.cgi?id=91248 + + Reviewed by Antonio Gomes. + + PR 174733. + + Add data-blackberry-virtual-keyboard-type and + data-blackberry-virtual-keyboard-enter-key to + enable configuration of the desired virtual keyboard + using element attributes. + + Reviewed Internally by Gen Mak. + + * Api/WebPageClient.h: + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::convertStringToKeyboardType): + (WebKit): + (BlackBerry::WebKit::keyboardTypeAttribute): + (BlackBerry::WebKit::convertStringToKeyboardEnterKeyType): + (BlackBerry::WebKit::keyboardEnterKeyTypeAttribute): + (BlackBerry::WebKit::InputHandler::setElementFocused): + +2012-07-13 Jacky Jiang <zhajiang@rim.com> + + [BlackBerry] resetBitmapZoomScale called while zooming preventing pinch zoom + https://bugs.webkit.org/show_bug.cgi?id=91247 + + Reviewed by Antonio Gomes. + + PR: 175432 + On yahoo.com, the web page stopped zooming while trying to pinch as + WebPageClient::resetBitmapZoomScale(double) was being called by + WebPagePrivate::zoomToInitialScaleOnLoad() after load finished. + And also yahoo.com was keeping updating layout, which made it really + bad that zoomToInitialScaleOnLoad() was called many times when load + finished and the load type was FrameLoadTypeStandard or FrameLoadTypeSame. + As we only care about the situation that dispatchDidFirstVisuallyNonEmptyLayout() + happens after load finished, we can move the code to that method and + set a flag for WebPage layoutFinished() and zoomToInitialScaleOnLoad() + instead. In this way, we can ensure that the flag is only enabled when + dispatchDidFirstVisuallyNonEmptyLayout() is called after load finished + and get rid of calling zoomToInitialScaleOnLoad() lots of times when + keeping updating layout in such kind of situation. + + Internally reviewed by Arvid Nilsson + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::WebPagePrivate): + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + (BlackBerry::WebKit::WebPagePrivate::layoutFinished): + * Api/WebPage_p.h: + (BlackBerry::WebKit::WebPagePrivate::shouldZoomToInitialScaleOnLoad): + (BlackBerry::WebKit::WebPagePrivate::setShouldZoomToInitialScaleAfterLoadFinished): + (WebPagePrivate): + * WebCoreSupport/FrameLoaderClientBlackBerry.cpp: + (WebCore::FrameLoaderClientBlackBerry::dispatchDidFirstVisuallyNonEmptyLayout): + +2012-07-13 Jakob Petsovits <jpetsovits@rim.com> + + [BlackBerry] Use fillBuffer() instead of a user-defined background image. + https://bugs.webkit.org/show_bug.cgi?id=91180 + RIM PR 171458 + + Reviewed by Rob Buis. + Internally reviewed by Andrew Lo. + + By using Platform::Graphics::fillBuffer() to fill the + overscroll area, we save graphics memory for the buffer + that the background image was occupying. + + Also adapt checkerboard drawing as it is now done using + fillBuffer() which replaces checkerBuffer(). + + In the same go, use the opportunity of the WebSettings + API change to make it more consistent, renaming the + OverZoomColor setting to OverScrollColor. + + * Api/BackingStore.cpp: + (WebKit): + (BlackBerry::WebKit::BackingStorePrivate::paintDefaultBackground): + (BlackBerry::WebKit::BackingStorePrivate::blitContents): + (BlackBerry::WebKit::BackingStorePrivate::fillWindow): + * Api/BackingStore_p.h: + (BackingStorePrivate): + * Api/WebSettings.cpp: + (WebKit): + (BlackBerry::WebKit::WebSettings::standardSettings): + (BlackBerry::WebKit::WebSettings::overScrollColor): + (BlackBerry::WebKit::WebSettings::setOverScrollColor): + (BlackBerry::WebKit::WebSettings::isEnableDefaultOverScrollBackground): + (BlackBerry::WebKit::WebSettings::setEnableDefaultOverScrollBackground): + * Api/WebSettings.h: + +2012-07-13 Joshua Netterfield <jnetterfield@rim.com> + + [BlackBerry] Update about:* pages + https://bugs.webkit.org/show_bug.cgi?id=91121 + + Reviewed by Yong Li. + + Update the about:config pages, and improve the aesthetics of the about:build, about:version, about:credits, about:memory, about:config, and similar pages. + + No new tests, because there is no new funtionality. + + * WebCoreSupport/AboutData.cpp: + (WebCore): + (WebCore::writeFeatures): + (WebCore::numberToHTMLTr): Converted to template function, added bool specialization to write "true" and "false" instead of "1" and "0" + (WebCore::configPage): + (WebCore::memoryPage): + * WebCoreSupport/AboutTemplate.html.cpp: Template for BlackBerry about:* pages. + +2012-07-12 Benjamin C Meyer <bmeyer@rim.com> + + WebPage::executeJavaScriptFunction crashes when there is an exception + https://bugs.webkit.org/show_bug.cgi?id=91098 + RIM PR #149294 + + When there is an exception currently the code tries to get the string of + the exception via JSValueToStringCopy to pass back, but this cases a + crash inside JavaScriptCore, so change it to simply return false and not + set the return value with the exception string. + + Reviewed by George Staikos. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::executeJavaScriptFunction): + +2012-07-12 Pawel Chomicki <pchomicki@rim.com> + + [BlackBerry] WebPage::touchEvent() should use Platform::TouchEvent's toString() for debugging. + https://bugs.webkit.org/show_bug.cgi?id=91002 + + Reviewed by Antonio Gomes. + Reviewed internally by Genevieve Mak. + + Updated DEBUG_TOUCH_EVENTS section of touchEvent method to utilize + Platform::TouchEvent's toString method. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPage::touchEvent): + +2012-07-12 Jonathan Dong <jonathan.dong@torchmobile.com.cn> + + [BlackBerry] Cannot use digest proxy auth and NTLM auth at the same time + https://bugs.webkit.org/show_bug.cgi?id=91054 + + Reviewed by George Staikos. + + Implemented interface function syncProxyCredential() derived + from class PageClientBlackBerry. + + Internally reviewed by Jason Liu <jason.liu@torchmobile.com.cn> + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::syncProxyCredential): + (WebKit): + * Api/WebPageClient.h: + * Api/WebPage_p.h: + (WebPagePrivate): + +2012-07-11 Mike Lattanzio <mlattanzio@rim.com> + + [BlackBerry] UserViewportArguments are not properly respected. + https://bugs.webkit.org/show_bug.cgi?id=91005 + + Reviewed by Rob Buis. + + PR# 170088. + Move scale and zooming reset on Committed before applying + the user viewport to avoid overriding it immediately. + + Internal review by Konrad Piascik, Jacky Jiang. + + * Api/WebPage.cpp: + (BlackBerry::WebKit::WebPagePrivate::setLoadState): + +2012-07-11 Crystal Zhang <haizhang@rim.com> + + [BlackBerry] Implement Date/Time picker + https://bugs.webkit.org/show_bug.cgi?id=90911 + + Reviewed by Rob Buis. + + Implement HTML Date/Time picker, also should delete popup when closing popup. + + * WebCoreSupport/ChromeClientBlackBerry.cpp: + (WebCore::ChromeClientBlackBerry::closePagePopup): + * WebCoreSupport/DatePickerClient.cpp: Added. + (WebCore): + (WebCore::DatePickerClient::DatePickerClient): + (WebCore::DatePickerClient::~DatePickerClient): + (WebCore::DatePickerClient::generateHTML): + (WebCore::DatePickerClient::closePopup): + (WebCore::DatePickerClient::contentSize): + (WebCore::DatePickerClient::htmlSource): + (WebCore::DatePickerClient::setValueAndClosePopup): + (WebCore::DatePickerClient::didClosePopup): + (WebCore::DatePickerClient::writeDocument): + * WebCoreSupport/DatePickerClient.h: Added. + (WebKit): + (WebCore): + (DatePickerClient): + * WebKitSupport/InputHandler.cpp: + (BlackBerry::WebKit::InputHandler::openDatePopup): + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp index bc44ccb5a..7f50d7f87 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutData.cpp @@ -18,6 +18,7 @@ #include "config.h" #include "AboutData.h" +#include "AboutTemplate.html.cpp" #include "CString.h" #include "JSDOMWindow.h" @@ -35,20 +36,33 @@ namespace WebCore { -static String numberToHTMLTr(const String& description, unsigned number) +static String writeFeatures(const Vector<String>& trueList, const Vector<String>& falseList) +{ + String ret; + for (unsigned int i = 0, j = 0; i < trueList.size() || j < falseList.size();) { + bool pickFromFalse = ((i >= trueList.size()) || (j < falseList.size() && strcmp(falseList[j].ascii().data(), trueList[i].ascii().data()) < 0)); + const String& item = (pickFromFalse ? falseList : trueList)[ (pickFromFalse ? j : i)++ ]; + ret += String("<tr><td><div class='" + String(pickFromFalse ? "false" : "true") + "'" + (item.length() >= 30 ? " style='font-size:10px;' " : "") + ">" + item + "</div></td></tr>"); + } + return ret; +} + +template<class T> String numberToHTMLTr(const String& description, T number) { return String("<tr><td>") + description + "</td><td>" + String::number(number) + "</td></tr>"; } +template<> String numberToHTMLTr<bool>(const String& description, bool truth) +{ + return String("<tr><td>") + description + "</td><td>" + (truth?"true":"false") + "</td></tr>"; +} + String configPage() { String page; - #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD - page = String("<!DOCTYPE html><html><head><title>BlackBerry Browser Configuration Information</title><meta name=\"viewport\" content=\"width=700\">") - + "<style>@media all and (orientation:landscape) { body { -webkit-column-count:2; -webkit-column-rule:solid; font-size:8px; } h1 { -webkit-column-span: all; } ul { font-size: 50%; } } td,li { text-overflow: ellipsis; overflow: hidden; } .list2 { width: 49%; float:left; padding-right:1px; } ul { list-style-type:none; padding:0px; margin:0px; } h1,h2,h3 { text-align:center; margin:0; } h2 { padding:1em 0 0 0; clear:both; } li,td { font-family:\"DejaVu Sans Condensed\"; }</style>" - + "</head><body><h1>BlackBerry Browser Configuration Information</h1>" - + "<h2>Compiler Information</h2><table>" + page = writeHeader("Configuration"); + + "<div class=\"box\"><div class=\"box-title\">Compiler Information</div><table class='fixed-table'><col width=75%><col width=25%>" #if COMPILER(MSVC) + "<tr><td>Microsoft Visual C++</td><td>MSVC</td></tr>" + "<tr><td>_MSC_VER</td><td>" + String::number(_MSC_VER) + "</td></tr>" @@ -67,7 +81,7 @@ String configPage() // Add "" to satisfy check-webkit-style. + ""; - page += String("</table><h2>CPU Information</h2><table>") + page += String("</table></div><br><div class='box'><div class='box-title'>CPU Information</div><table class='fixed-table'><col width=75%><col width=25%>") #if CPU(X86) + "<tr><td>X86</td><td></td></tr>" #elif CPU(ARM) @@ -86,7 +100,7 @@ String configPage() #endif + "</td></tr>"; - page += String("</table><h2>Platform Information</h2><table>") + page += String("</table></div><br><div class='box'><div class='box-title'>Platform Information</div><table class='fixed-table'><col width=75%><col width=25%>") + "<tr><td>WebKit Version</td><td>" + String::number(WEBKIT_MAJOR_VERSION) + "." + String::number(WEBKIT_MINOR_VERSION) + "</td></tr>" + "<tr><td>BlackBerry</td><td>" #if PLATFORM(BLACKBERRY) @@ -104,22 +118,24 @@ String configPage() + "</td></tr>"; BlackBerry::Platform::Settings* settings = BlackBerry::Platform::Settings::instance(); - page += String("</table><h2>Platform Settings</h2><table>"); + page += String("</table></div><br><div class='box'><div class='box-title'>Platform Settings</div><table style='font-size:11px;' class='fixed-table'><col width=75%><col width=25%>"); page += numberToHTMLTr("isRSSFilteringEnabled", settings->isRSSFilteringEnabled()); page += numberToHTMLTr("secondaryThreadStackSize", settings->secondaryThreadStackSize()); page += numberToHTMLTr("maxPixelsPerDecodedImage", settings->maxPixelsPerDecodedImage()); page += numberToHTMLTr("shouldReportLowMemoryToUser", settings->shouldReportLowMemoryToUser()); page += numberToHTMLTr("numberOfBackingStoreTiles", settings->numberOfBackingStoreTiles()); - page += numberToHTMLTr("maximumNumberOfBackingStoreTilesAcrossProcesses", settings->maximumNumberOfBackingStoreTilesAcrossProcesses()); + page += numberToHTMLTr("maximumNumberOfBacking...AcrossProcesses", settings->maximumNumberOfBackingStoreTilesAcrossProcesses()); page += numberToHTMLTr("tabsSupportedByClient", settings->tabsSupportedByClient()); page += numberToHTMLTr("contextMenuEnabled", settings->contextMenuEnabled()); page += numberToHTMLTr("selectionEnabled", settings->selectionEnabled()); + page += numberToHTMLTr("fineCursorControlEnabled", settings->fineCursorControlEnabled()); page += numberToHTMLTr("alwaysShowKeyboardOnFocus", settings->alwaysShowKeyboardOnFocus()); page += numberToHTMLTr("allowCenterScrollAdjustmentForInputFields", settings->allowCenterScrollAdjustmentForInputFields()); page += numberToHTMLTr("unrestrictedResizeEvents", settings->unrestrictedResizeEvents()); page += numberToHTMLTr("isBridgeBrowser", settings->isBridgeBrowser()); page += numberToHTMLTr("isWebGLSupported", settings->isWebGLSupported()); page += numberToHTMLTr("showImageLocationOptionsInGCM", settings->showImageLocationOptionsInGCM()); + page += numberToHTMLTr("forceGLES2WindowUsage", settings->forceGLES2WindowUsage()); page += numberToHTMLTr("maxClickableSpeed", settings->maxClickableSpeed()); page += numberToHTMLTr("maxJitterRadiusClick", settings->maxJitterRadiusClick()); page += numberToHTMLTr("maxJitterRadiusTap", settings->maxJitterRadiusTap()); @@ -131,51 +147,33 @@ String configPage() page += numberToHTMLTr("maxJitterDistanceTap", settings->maxJitterDistanceTap()); page += numberToHTMLTr("maxJitterDistanceSingleTouchMove", settings->maxJitterDistanceSingleTouchMove()); page += numberToHTMLTr("maxJitterDistanceTouchHold", settings->maxJitterDistanceTouchHold()); - page += numberToHTMLTr("maxJitterDistanceHandleDrag", settings->maxJitterDistanceHandleDrag()); page += numberToHTMLTr("maxJitterDistanceTapHighlight", settings->maxJitterDistanceTapHighlight()); + page += numberToHTMLTr("maxJitterDistanceHandleDrag", settings->maxJitterDistanceHandleDrag()); page += numberToHTMLTr("topFatFingerPadding", settings->topFatFingerPadding()); page += numberToHTMLTr("rightFatFingerPadding", settings->rightFatFingerPadding()); page += numberToHTMLTr("bottomFatFingerPadding", settings->bottomFatFingerPadding()); + page += numberToHTMLTr("maxSelectionNeckHeight", settings->maxSelectionNeckHeight()); page += numberToHTMLTr("leftFatFingerPadding", settings->leftFatFingerPadding()); -#define FOR_EACH_TRUE_LIST() \ - for (unsigned int i = 0; i < trueList.size(); ++i) \ - page += String("<li>") + trueList[i] + "</li>" - -#define FOR_EACH_FALSE_LIST() \ - for (unsigned int i = 0; i < falseList.size(); ++i) \ - page += String("<li>") + falseList[i] + "</li>" - Vector<String> trueList, falseList; #include "AboutDataEnableFeatures.cpp" - page += String("</table><h2>WebKit ENABLE Information</h2><div class=\"list2\">"); - page += String("<h3>ENABLE</h3><ul>"); - FOR_EACH_TRUE_LIST(); - page += String("</ul></div><div class=\"list2\"><h3>don't ENABLE</h3><ul>"); - FOR_EACH_FALSE_LIST(); - page += String("</ul></div>"); + page += String("</table></div><br><div class='box'><div class='box-title'>WebKit Features (ENABLE_)</div><table class='fixed-table'>"); + + page += writeFeatures(trueList, falseList); trueList.clear(); falseList.clear(); #include "AboutDataHaveFeatures.cpp" - page += String("</table><h2>WebKit HAVE Information</h2><div class=\"list2\">"); - page += String("<h3>HAVE</h3><ul>"); - FOR_EACH_TRUE_LIST(); - page += String("</ul></div><div class=\"list2\"><h3>don't HAVE</h3><ul>"); - FOR_EACH_FALSE_LIST(); - page += String("</ul></div>"); + page += String("</table></div><br><div class='box'><div class='box-title'>WebKit Features (HAVE_)</div><table class='fixed-table'>"); + + page += writeFeatures(trueList, falseList); trueList.clear(); falseList.clear(); #include "AboutDataUseFeatures.cpp" - page += String("<h2>WebKit USE Information</h2><div class=\"list2\">"); - page += String("<h3>USE</h3><ul>"); - FOR_EACH_TRUE_LIST(); - page += String("</ul></div><div class=\"list2\"><h3>don't USE</h3><ul>"); - FOR_EACH_FALSE_LIST(); - page += String("</ul></div>"); - - page += String("</body></html>"); + page += String("</table></div><br><div class='box'><div class='box-title'>WebKit Features (USE_)</div><table class='fixed-table'>"); + page += writeFeatures(trueList, falseList); + page += String("</table></div></body></html>"); #endif return page; @@ -205,15 +203,14 @@ String memoryPage() { String page; - // generate memory information - page = "<html><head><title>BlackBerry Browser Memory Information</title></head><body><h2>BlackBerry Browser Memory Information</h2>"; + page = writeHeader("Memory") + + "<div class=\"box\"><div class=\"box-title\">Cache Information<br><div style='font-size:11px;color:#A8A8A8'>Size, Living, and Decoded are expressed in KB.</div><br></div><table class='fixed-table'><col width=75%><col width=25%>"; // generate cache information MemoryCache* cacheInc = memoryCache(); MemoryCache::Statistics cacheStat = cacheInc->getStatistics(); - page += "<h2>Cache Information</h2>" - "<table align=\"center\" rules=\"all\"><tr> <th>Item</th> <th>Count</th> <th>Size<br>KB</th> <th>Living<br>KB</th> <th>Decoded<br>KB</th></tr>"; + page += "<tr> <th align=left>Item</th> <th align=left>Count</th> <th align=left>Size</th> <th align=left>Living</th> <th align=left>Decoded</th></tr>"; MemoryCache::TypeStatistic total; total.count = cacheStat.images.count + cacheStat.cssStyleSheets.count @@ -234,7 +231,7 @@ String memoryPage() #endif page += cacheTypeStatisticToHTMLTr("Fonts", cacheStat.fonts); - page += "</table>"; + page += "</table></div><br>"; #if !defined(PUBLIC_BUILD) || !PUBLIC_BUILD @@ -244,7 +241,7 @@ String memoryPage() OwnPtr<JSC::TypeCountSet> objectTypeCounts = mainHeap.objectTypeCounts(); OwnPtr<JSC::TypeCountSet> protectedObjectTypeCounts = mainHeap.protectedObjectTypeCounts(); - page += "<h2>JS engine memory usage</h2><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>JS engine memory usage</div><table class='fixed-table'><col width=75%><col width=25%>"; page += numberToHTMLTr("Stack size", jscMemoryStat.stackBytes); page += numberToHTMLTr("JIT memory usage", jscMemoryStat.JITBytes); @@ -255,20 +252,20 @@ String memoryPage() page += numberToHTMLTr("Protected object count", mainHeap.protectedObjectCount()); page += numberToHTMLTr("Protected global object count", mainHeap.protectedGlobalObjectCount()); - page += "</table>"; + page += "</table></div><br>"; - page += "<h3>Object type counts</h3><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>Object type counts</div><table class='fixed-table'><col width=75%><col width=25%>"; dumpJSCTypeCountSetToTableHTML(page, objectTypeCounts.get()); - page += "</table>"; + page += "</table></div><br>"; - page += "<h3>Protected object type counts</h3><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>Protected object type counts</div><table class='fixed-table'><col width=75%><col width=25%>"; dumpJSCTypeCountSetToTableHTML(page, protectedObjectTypeCounts.get()); - page += "</table>"; + page += "</table></div><br>"; // Malloc info. struct mallinfo mallocInfo = mallinfo(); - page += "<h2>Malloc Information</h2><table align=\"center\" rules=\"all\">"; + page += "<div class='box'><div class='box-title'>Malloc Information</div><table class='fixed-table'><col width=75%><col width=25%>"; page += numberToHTMLTr("Total space in use", mallocInfo.usmblks + mallocInfo.uordblks); page += numberToHTMLTr("Total space in free blocks", mallocInfo.fsmblks + mallocInfo.fordblks); @@ -286,7 +283,7 @@ String memoryPage() if (!stat(String::format("/proc/%u/as", getpid()).latin1().data(), &processInfo)) page += numberToHTMLTr("Process total mapped memory", processInfo.st_size); - page += "</table>"; + page += "</table></div>"; #endif page += "</body></html>"; diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in index 8a0adf79d..250c3f959 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataEnableFeatures.in @@ -1,42 +1,34 @@ -3D_CANVAS -3D_PLUGIN 3D_RENDERING ACCELERATED_2D_CANVAS ANIMATION_API ASSEMBLER ASSEMBLER_WX_EXCLUSIVE BATTERY_STATUS -BLACKBERRY_CREDENTIAL_PERSIST -BLACKBERRY_DEBUG_MEMORY BLOB BRANCH_COMPACTION CHANNEL_MESSAGING CLASSIC_INTERPRETER -CODEBLOCK_SAMPLING +CLIENT_BASED_GEOLOCATION COMPARE_AND_SWAP COMPUTED_GOTO_CLASSIC_INTERPRETER -CONTEXT_MENUS CSS_FILTERS CSS_GRID_LAYOUT +CSS_IMAGE_SET CSS_SHADERS DASHBOARD_SUPPORT +CUSTOM_SCHEME_HANDLER DATALIST DATA_TRANSFER_ITEMS -DEBUG_MATH_LAYOUT +DASHBOARD_SUPPORT DEBUG_WITH_BREAKPOINT DETAILS DEVICE_ORIENTATION DFG_JIT DIRECTORY_UPLOAD -DOUBLE_TAP_CENTERS DOWNLOAD_ATTRIBUTE DRAG_SUPPORT -DRT -EVENT_MODE_METATAGS EXECUTABLE_ALLOCATOR_DEMAND EXECUTABLE_ALLOCATOR_FIXED -EXPERIMENTAL_FEATURE -FAST_MALLOC_MATCH_VALIDATION FAST_MOBILE_SCROLLING FILE_SYSTEM FILTERS @@ -44,15 +36,14 @@ FIXED_REPORTED_SIZE FTPDIR FULLSCREEN_API GAMEPAD -GC_LOGGING GC_VALIDATION GEOLOCATION GESTURE_EVENTS -GESTURE_RECOGNIZER -GGC +GLIB_SUPPORT GLOBAL_FASTMALLOC_NEW HIGH_DPI_CANVAS ICONDATABASE +IFRAME_SEAMLESS IMAGE_DECODER_DOWN_SAMPLING INDEXED_DATABASE INPUT_SPEECH @@ -67,16 +58,14 @@ INSPECTOR JAVASCRIPT_DEBUGGER JAVASCRIPT_I18N_API JAVA_BRIDGE +JAVASCRIPT_DEBUGGER JIT -JIT_OPTIMIZE_PROPERTY_ACCESS -JIT_USE_SOFT_MODULO JIT_VERBOSE JIT_VERBOSE_OSR -LARGE_HEAP LEGACY_NOTIFICATIONS +LEGACY_WEBKIT_BLOB_BUILDER LINK_PREFETCH LLINT -MAC_JAVA_BRIDGE MATHML MEDIA_SOURCE MEDIA_STATISTICS @@ -89,18 +78,17 @@ MICRODATA MUTATION_OBSERVERS NETSCAPE_PLUGIN_API NETSCAPE_PLUGIN_METADATA_CACHE -NEW_XML +NETWORK_INFO NOTIFICATIONS -NO_LISTBOX_RENDERING OPCODE_SAMPLING -OPCODE_STATS OPENTYPE_SANITIZER ORIENTATION_EVENTS +OVERFLOW_SCROLLING PAGE_VISIBILITY_API PAN_SCROLLING +PARSED_STYLE_SHEET_CACHING +PAGE_POPUP PARALLEL_GC -PARALLEL_JOBS -PASSWORD_ECHO PLUGIN_PACKAGE_SIMPLE_HASH PLUGIN_PROCESS PLUGIN_PROXY_FOR_VIDEO @@ -113,21 +101,17 @@ REGISTER_PROTOCOL_HANDLER REPAINT_THROTTLING REQUEST_ANIMATION_FRAME RUBBER_BANDING -RUN_TIME_HEURISTICS -RXI_IMAGE_FORMAT SAMPLING_COUNTERS SAMPLING_FLAGS SAMPLING_REGIONS SAMPLING_THREAD +SCRIPTED_SPEECH SHADOW_DOM SHARED_WORKERS SIMPLE_HEAP_PROFILING -SINGLE_THREADED -SKIA_GPU_CANVAS -SKIA_TEXT SMOOTH_SCROLLING -SPEECH_INPUT SPELLCHECK +SUBPIXEL_LAYOUT SQL_DATABASE STYLE_SCOPED SVG @@ -135,10 +119,11 @@ SVG_DOM_OBJC_BINDINGS SVG_FONTS TEXT_CARET TEXT_NOTIFICATIONS_ONLY +THREADED_SCROLLING THREADING_GENERIC +THREADED_SCROLLING THREADING_LIBDISPATCH THREADING_OPENMP -THREADING_SCROLLING TOUCH_EVENTS TOUCH_ICON_LOADING VALUE_PROFILER @@ -152,14 +137,11 @@ WEBGL WEBKIT2 WEB_ARCHIVE WEB_AUDIO -WEB_PROCESS_SANDBOX +WEB_INTENTS WEB_SOCKETS WEB_TIMING WORKERS WRITE_BARRIER_PROFILING -WTF_MALLOC_VALIDATION -XHR_RESPONSE_BLOB -XHTMLMP XSLT YARR_JIT YARR_JIT_DEBUG diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in index 344595cfc..d7e99518d 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataHaveFeatures.in @@ -1,37 +1,24 @@ ACCESSIBILITY -ASSEMBLER -AVCF -CG_INTERPOLATION_MEDIUM -COMPUTED_GOTO DISPATCH_H -DTRACE ERRNO_H -HEADER_DETECTION_H HOSTED_CORE_ANIMATION -INTTYPES_H INVERTED_WHEEL_EVENTS ISDEBUGGERPRESENT LANGINFO_H +LAYER_HOSTING_IN_WINDOW_SERVER MADV_DONTNEED MADV_FREE MADV_FREE_REUSE -MERGESORT MMAP NETWORK_CFDATA_ARRAY_CALLBACK -NULLPTR -PATH_BASED_BORDER_RADIUS_DRAWING PTHREAD_H -PTHREAD_MACHDEP_H PTHREAD_NP_H PTHREAD_RWLOCK PTHREAD_SETNAME_NP -QRAWFONT -QSTYLE READLINE RUNLOOP_TIMER SBRK SIGNAL_H -STDINT_H STRINGS_H STRNSTR SYS_PARAM_H @@ -40,8 +27,5 @@ SYS_TIME_H TIMEGM TM_GMTOFF TM_ZONE -VARIADIC_MACRO VASPRINTF VIRTUALALLOC -WEBCOMPOSITOR -WKQCA diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in index 88fec71b7..80ddd27d7 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutDataUseFeatures.in @@ -1,6 +1,5 @@ -ACCELERATE ACCELERATED_COMPOSITING -ACCELERATED_COMPOSITING_PLUGIN_LAYER +ARENA_ALLOC_ALIGNMENT_INTEGER ATSUI AUTOCORRECTION_PANEL AUTOMATIC_TEXT_REPLACEMENT @@ -14,6 +13,7 @@ CFURLSTORAGESESSIONS CG CG_INTERPOLATION_MEDIUM CHROME_NETWORK_STACK +CHROMIUM_NET CONCATENATED_IMPULSE_RESPONSES CONSOLE_ENTRY_POINT COREAUDIO @@ -52,13 +52,7 @@ PLUGIN_HOST_PROCESS PROTECTION_SPACE_AUTH_CALLBACK PTHREADS PTHREAD_GETSPECIFIC_DIRECT -QT4_UNICODE -QTKIT -QT_MOBILITY_SYSTEMINFO -QT_MULTIMEDIA QUERY_PERFORMANCE_COUNTER -QXMLQUERY -QXMLSTREAM REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR REQUEST_ANIMATION_FRAME_TIMER SAFARI_THEME diff --git a/Source/WebKit/blackberry/WebCoreSupport/AboutTemplate.html.cpp b/Source/WebKit/blackberry/WebCoreSupport/AboutTemplate.html.cpp new file mode 100644 index 000000000..74984ddd1 --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/AboutTemplate.html.cpp @@ -0,0 +1,31 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +static String writeHeader(const String& header) +{ + return "<!DOCTYPE html><html>" + "<head>" + " <style>.title{text-align:center;color:white;font-size:28pt;}.box{padding:10px;border:2px solid gray;margin:0px;background:black;color:white;-webkit-border-radius: 10px;}.box-title{text-align:center;font-weight:bold;}.true {color:green;}.false {color: red;text-decoration: line-through;}.fixed-table{color:white;border-collapse:collapse;width:100%} tr:nth-child(2n){color:#A8A8A8;}</style>" + " <title>"+title+"</title>" + " <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, maximum-scale=1\">" + " <style>@media all and (orientation:landscape) { .main { -webkit-column-count:2; -webkit-column-rule:solid; font-size:12px; } h1 { -webkit-column-span: all; } ul { font-size: 75%; } } td,li { text-overflow: ellipsis; overflow: hidden; }</style>" + "</head>" + "<body topmargin='10'>" + " <div class='box'><div class='title'><img alt='BlackBerry Browser Logo' src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAeCAIAAAC0Ujn1AAAAAXNSR0IArs4c6QAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9wHCxEvB12VSWwAAAq1SURBVEgNAaoKVfUBFxkjAQIBAAAAAP8BAQEA//8AAAEAAAAAAQEB////AQAAAAAB/wH/AAABAP8A/wAAAQH/AAABAf8AAAD/AQEB/v7/AQIB////AAAA//8AAQH/AAAAAQEB//7/BPX19v//AAABAAEAAAAAAAAAAAAAAAECAv7+/wABAQEDAwAEBv4CBQACBQADBf8AAAEA/wD8+gUB/v779//7+wD//gICAf39/gEAAP8AAAEAAAECAf7+/gAAAAQBAQEAAP8AAQEBAAD/AQECAAH//wACAgIABQT+BQv+CQ79BhD/FRoGHxsGEQ8CAwP89fb66Or54uIB9e4C+vEB+PP++vgCAgEA//8BAQH///////8CAQL///4EAAAAAAAAAQAB/wEAAf8AAAIBAgME/QYKAA8V/RAdBzk6DEc9DyMb7wMFHwcD9v8A8f3+BP39/PDy/MbR/LO6AeXcA/PoAfbwAf77//7+AAAB/////wAABAQEAQ0PGv//AP8BAQH//wIEAwACBv4LEf0UHgQsOBVnW/cgGhH7AOv5/wP/ABUFAOX8AAQCAAIEAPoDAQQHAAr//vCoufmtrwLo2gLy6QD69wH//gAA//7+/gD//wMHCQ0AAAABAAEBAwIBAwcADhT+HiwXVV4gaV/n/g0l9/8M9v7u7fn78Pfx8PgB9Pn99f1Q+sIa+Ozn+BcB/gQBMiUKLy/55fD+8vAB+fgA/voBAAABAQH///8DBgcMAAABAAABAQMFAA0T/R0sGlllIkBBCPH+DfL4D/Xx//Du7+rm+u7qAPHs//HuAvX0xAdCP/WyGvvw5Pwm6vUOBhQQBi4t+ubu/+7sAvv3//v7AAD/AAAAAwcJDgAAAAEBAv8JDf8YJhRIXx8yPgvw9wjz7gbx6uLi4d/i5Pjs7ADx8ADy8wDy8/zx8+nsADkP1isAzD/6uQX8DcftJwMHDAQlK/nZ2QL07//59gH//QAAAAMHBwwBAAH/BQf/ERsDK0MnOlcD7OsF8en36+TK0tXu6Oj98PH/8/T/9PX/8/X+8/X+8PHf3/8TCQksF+kI/u02/bko99ut3jYDAhMGFyD4284C9/EA+vkA//8E/wABAQICAAkN/RQfIShM/eDiCP/s9PfoyNjYA//9Af/+/gD+/v4BCAUCFwz5Nh/1WivZPxnR+fjw+P0G//8C/wAAu8j7/P7j/Qz1CRAlBCdD/vHoA/r1//r4BAEAAP8CBP4LEQoaM/vo7uz35Oj46evu5gL9+f/9/vb7ABMOBzoj7kIk6Ecm3yIN4Pz/AervBeLsEAwJAB0U9dDeCq7JFwsa1/4JFfvr9QgRNvQSwAPz7AD6+QQAAAEAAwb+DhUJ/BHh0sgLBPL//fEJAvzv8fP9/gVYPf1aNdUtGusXCu73/AbB1Q+3ywbi7xP09wJ5V/AjBvuEpAv97OAHBA4DCfX5AfAHCxgCDyX+B9wA9vAE/wH/AAUHAAgT/ezsIw3+7+7u7e7p+vv8KiIOlGfiKhbbBgT/8PUFlrUUo7kA2+UC/v7/Dw38RTUDOCr9rsALzNsJBxEE/u7tAQb5BQT29u73BAoP/AkMAfEEBAEBAf0FB//9B+3m4fcD9hMPAg8D/XBcDG9M1/P1+OTrEKW3+aG19e3tAQEE/gICBP4BBBgYFwgMBe71AZWu8QUDDgX+BP728/74/AEE/QkEAPf+//8ICwIDAwT//wEABAUA/QAC/Pfx8u4oGgWjfA0zI+jN1wm4xgOpuvTa2/QABQQDCAgBAwkBAwkCAQbw9Ai/zgO+xPbo7QQIDg3++/z+AP//AgD//QIB/AcCBQj9BAj/AAEEAQEAAQECAQAA+Pb6TUAVj3AADwr0iaL6sb/w5+0DDg4VHiQY5On0AAIHAgMFAAAAAAAA9PX38/Hy/Pj3AgYSCQIH/v/9AQMDAAH//wD++/z6+foDAgICAAABBAAAAAD+/fj5+0pDF6B+Bejr8Fh029Tc9wcKERUZGA0OEv8AAxkc/+nr8OPl6gMDAgD/AAABAQEDCQUJGQADCfX3+gwKCf///v///gEB/v7+/f7//AL//AAA/wT////9+vokHwmZgR/e4+ZJXrv1+gUUFx4IChEBAwr6+wEAAf7+/v4GBQMA/wEAAAEAAQABAAAAAwb/AgYAAAD+/f7//wAAAAACAwH+AAADAwMBA/0B+vgA//0EAQAAAPv5eFEY6en7Q1qx8vcJCAsS+v0KCAED9/j5+/z9AQEBAAEA3uDnAgMCAAD/AAAA//8BAAEBAQAA/wD/AgIBAQEA/wEB/////f//+P/8BAgDAPHzAP7+BP///x4VCyQdGWqDsvT8EgULCv0A//T19wcGBQIDAf3+//7+/vr7/AABAQEAAQAAAAD//gEBAQAAAP8AAAAAAf3+/v7//wAAAAACAvn5/v8FAP8C9AL38wD//gQAAf8JBQPQ1+7hBBYDBQIBAPj/APv9/v75+/sC/AEEBP78/P3v8PMBAQEAAQAAAAD/AAEA/wAAAP8BAAAAAQEA/wH+/v8EBQL2+f39/QYBEwUA9t8B+fUA//8CAf8B4eHm6OnwCAT8ARwX//8DAQEC/fz++fn7/f3++fr79PX4/v4AAQEBAAD//wD/AQABAQH/AAEA/wEB////AAEB+fv+9ff7+/wBAAIGARL5Au7lAPz6AQAAAwYIDfz7++nq7SghH+wHB/3zAP34+AAB/wIB/wQEA/n5+/n6+/8B/wH/AP8AAQEAAf8BAAD/AQEBAQH//wABAQAAAf7/Av7/BAADCgEfEQTx2QLt5AD8+AD//wMHCA0CAwPt7e7u6+sYEg4AGBn47/j/+vn9/f0FBgP5+fv+/v8AAAEBAAAAAAEBAP8BAAABAQAAAAAAAAEAAAEAAgMBAQUAAgkBGRIDAecD59sB9/QA//0AAAADBwkNAQACAgIB/fv77erq+//9/hUa/vT7APv9AAD+AAAB///+AQEB/wAAAAEAAQAAAAAAAAEAAP8AAAACAAECAQIF/wEIARoVAwfuAubYAvbv//37AAAB/wD/AwYHDP//////Af///gIA/f/39QIE/gAeIP/3/v72+QECAAD/AAD//wAAAAABAAEBAAAAAAAAAQABAgABAwEBBv8CCAIhGgQE7APm2AL17QL9+wAAAAD/AAEA/wMGCA0AAQECAgABAQIB//8B/vv/+PQC+/QAGxgADBH++Pz//wAA/wEAAAAAAAEAAAEAAQIAAAMBBAgABQgAEhIEIxIC890D59oB9e0B/fv///8AAP8BAP8AAAABDA8ZAP8AAAEBAQECAAAAAQAA/wEB/wIGAAoN/hIa/xAa/vkEAPn9//n8AP//AAAAAAEBAAQDAQcEAQkAAvnvAO3iA/Pv//r2AgD+AQAB/f79AQAA////AAAAAQwPGf8AAAEAAAAAAQEBAQAAAP//AAAAAAEDA/8DBQAHCv4IDgALEP8GCgAAAgAAAf8A/gL9+QL59f/07wL49P/79wH+/gAA/wD/AAAAAAAA/////wAAAAAAAAEMDhj/AP8AAAEBAAEAAQAA/wAAAQAAAAAAAAAAAAAAAAH/AgIAAgMAAQMAAQICAwL+/f0A/v0B/v0A/v4BAQAAAP/+/v4BAQEAAAAAAAD//wD///4BAQEA/wCyKWs61Q32JAAAAABJRU5ErkJggg==' /> "+title+"</div></div><br>" + " <div class='main'>"; +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp index 29de80020..6c09c64a2 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/ChromeClientBlackBerry.cpp @@ -321,6 +321,7 @@ void ChromeClientBlackBerry::closePagePopup(PagePopup*) PagePopupBlackBerry* webPopup = m_webPagePrivate->m_webPage->popup(); webPopup->closePopup(); + delete webPopup; } void ChromeClientBlackBerry::setToolbarsVisible(bool) diff --git a/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp new file mode 100644 index 000000000..d70dc4fbe --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.cpp @@ -0,0 +1,142 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "config.h" +#include "DatePickerClient.h" + +#include "Chrome.h" +#include "ChromeClient.h" +#include "Document.h" +#include "DocumentWriter.h" +#include "HTMLInputElement.h" +#include "Page.h" +#include "PagePopup.h" +#include "PopupPicker.h" +#include "RenderObject.h" +#include "WebPage_p.h" +#include "WebString.h" + +#include <wtf/text/StringBuilder.h> + +namespace WebCore { + +DatePickerClient::DatePickerClient(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step, BlackBerry::WebKit::WebPagePrivate* webPage, HTMLInputElement* element) + : m_type(type) + , m_webPage(webPage) + , m_element(element) +{ + generateHTML(type, value, min, max, step); +} + +DatePickerClient::~DatePickerClient() +{ +} + +void DatePickerClient::generateHTML(BlackBerry::Platform::BlackBerryInputType type, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step) +{ + StringBuilder source; + source.append("<html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"/><style>\n"); + // Include CSS file. + source.append(popupControlBlackBerryCss, + sizeof(popupControlBlackBerryCss)); + source.append("</style>\n<style>"); + source.append(timeControlBlackBerryCss, + sizeof(timeControlBlackBerryCss)); + source.append("</style></head><body>\n"); + source.append("<script>\n"); + source.append("window.addEventListener('load', function () {"); + switch (type) { + case BlackBerry::Platform::InputTypeDate: + source.append("window.popupcontrol.show(\"Date\", "); + break; + case BlackBerry::Platform::InputTypeTime: + source.append("window.popupcontrol.show(\"Time\", "); + break; + case BlackBerry::Platform::InputTypeDateTime: + source.append("window.popupcontrol.show(\"DateTime\", "); + break; + case BlackBerry::Platform::InputTypeDateTimeLocal: + source.append("window.popupcontrol.show(\"DateTimeLocal\", "); + break; + case BlackBerry::Platform::InputTypeMonth: + case BlackBerry::Platform::InputTypeWeek: + default: + break; + } + if (!value.isEmpty()) + source.append("\"" + String(value.impl()) + "\", "); + else + source.append("0, "); + + if (!min.isEmpty()) + source.append(String(min.impl()) + ", "); + else + source.append("0, "); + if (!max.isEmpty()) + source.append(String(max.impl()) + ", "); + else + source.append("0, "); + source.append(String::number(step)); + source.append("); \n }); \n"); + source.append(timeControlBlackBerryJs, sizeof(timeControlBlackBerryJs)); + source.append("</script>\n"); + source.append("</body> </html>\n"); + m_source = source.toString(); +} + +void DatePickerClient::closePopup() +{ + ASSERT(m_webPage); + m_webPage->m_page->chrome()->client()->closePagePopup(0); +} + +IntSize DatePickerClient::contentSize() +{ + // Fixme: will generate content size dynamically + return IntSize(320, 256); +} + +String DatePickerClient::htmlSource() +{ + return m_source; +} + +void DatePickerClient::setValueAndClosePopup(int, const String& value) +{ + // Return -1 if user cancel the selection. + ASSERT(m_element); + + if (!value.contains("-1")) + m_element->setValue(value); + closePopup(); +} + +void DatePickerClient::didClosePopup() +{ + m_webPage = 0; + m_element = 0; +} + +void DatePickerClient::writeDocument(DocumentWriter& writer) +{ + writer.setMIMEType("text/html"); + writer.begin(KURL()); + writer.addData(m_source.utf8().data(), m_source.utf8().length()); + writer.end(); +} +} diff --git a/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h new file mode 100644 index 000000000..bc6411bcb --- /dev/null +++ b/Source/WebKit/blackberry/WebCoreSupport/DatePickerClient.h @@ -0,0 +1,57 @@ +/* + * Copyright (C) 2012 Research In Motion Limited. All rights reserved. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef DatePickerClient_h +#define DatePickerClient_h + +#include "PagePopupClient.h" +#include <BlackBerryPlatformInputEvents.h> + +namespace BlackBerry { +namespace WebKit { +class WebPagePrivate; +class WebString; +} +} + +namespace WebCore { +class DocumentWriter; +class HTMLInputElement; + +class DatePickerClient : public PagePopupClient { +public: + DatePickerClient(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step, BlackBerry::WebKit::WebPagePrivate*, HTMLInputElement*); + ~DatePickerClient(); + + void generateHTML(BlackBerry::Platform::BlackBerryInputType, const BlackBerry::WebKit::WebString& value, const BlackBerry::WebKit::WebString& min, const BlackBerry::WebKit::WebString& max, double step); + + void writeDocument(DocumentWriter&); + virtual IntSize contentSize(); + virtual String htmlSource(); + void setValueAndClosePopup(int, const String&); + void didClosePopup(); + void closePopup(); + +private: + BlackBerry::Platform::BlackBerryInputType m_type; + String m_source; + BlackBerry::WebKit::WebPagePrivate* m_webPage; + HTMLInputElement* m_element; +}; +} // namespace WebCore +#endif diff --git a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp index f0d6c7564..9080272d7 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/FrameLoaderClientBlackBerry.cpp @@ -24,7 +24,6 @@ #include "BackForwardListImpl.h" #include "BackingStoreClient.h" #include "BackingStore_p.h" -#include "Base64.h" #include "Chrome.h" #include "ChromeClientBlackBerry.h" #include "ClientExtension.h" @@ -825,6 +824,14 @@ void FrameLoaderClientBlackBerry::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()) { m_webPagePrivate->zoomToInitialScaleOnLoad(); // Set the proper zoom level first. m_webPagePrivate->m_backingStore->d->clearVisibleZoom(); // Clear the visible zoom since we're explicitly rendering+blitting below. diff --git a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp index 00058ef60..f068f1fda 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/SelectPopupClient.cpp @@ -168,7 +168,8 @@ void SelectPopupClient::setValueAndClosePopup(int, const String& stringValue) // Force repaint because we do not send mouse events to the select element // and the element doesn't automatically repaint itself. m_element->dispatchFormControlChangeEvent(); - m_element->renderer()->repaint(); + if (m_element->renderer()) + m_element->renderer()->repaint(); closePopup(); } diff --git a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp index b3f5413bc..d9cb22d79 100644 --- a/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp +++ b/Source/WebKit/blackberry/WebKitSupport/InputHandler.cpp @@ -25,12 +25,14 @@ #include "CString.h" #include "Chrome.h" #include "DOMSupport.h" +#include "DatePickerClient.h" #include "Document.h" #include "DocumentLoader.h" #include "DocumentMarkerController.h" #include "FocusController.h" #include "Frame.h" #include "FrameView.h" +#include "HTMLFormElement.h" #include "HTMLInputElement.h" #include "HTMLNames.h" #include "HTMLOptGroupElement.h" @@ -211,6 +213,117 @@ static int inputStyle(BlackBerryInputType type, const Element* element) return DEFAULT_STYLE; } +static VirtualKeyboardType convertStringToKeyboardType(const AtomicString& string) +{ + DEFINE_STATIC_LOCAL(AtomicString, Default, ("default")); + DEFINE_STATIC_LOCAL(AtomicString, Url, ("url")); + DEFINE_STATIC_LOCAL(AtomicString, Email, ("email")); + DEFINE_STATIC_LOCAL(AtomicString, Password, ("password")); + DEFINE_STATIC_LOCAL(AtomicString, Web, ("web")); + DEFINE_STATIC_LOCAL(AtomicString, Number, ("number")); + DEFINE_STATIC_LOCAL(AtomicString, Symbol, ("symbol")); + DEFINE_STATIC_LOCAL(AtomicString, Phone, ("phone")); + DEFINE_STATIC_LOCAL(AtomicString, Pin, ("pin")); + DEFINE_STATIC_LOCAL(AtomicString, Hex, ("hexadecimal")); + + if (string.isEmpty()) + return VKBTypeNotSet; + if (equalIgnoringCase(string, Default)) + return VKBTypeDefault; + if (equalIgnoringCase(string, Url)) + return VKBTypeUrl; + if (equalIgnoringCase(string, Email)) + return VKBTypeEmail; + if (equalIgnoringCase(string, Password)) + return VKBTypePassword; + if (equalIgnoringCase(string, Web)) + return VKBTypeWeb; + if (equalIgnoringCase(string, Number)) + return VKBTypeNumPunc; + if (equalIgnoringCase(string, Symbol)) + return VKBTypeSymbol; + if (equalIgnoringCase(string, Phone)) + return VKBTypePhone; + if (equalIgnoringCase(string, Pin) || equalIgnoringCase(string, Hex)) + return VKBTypePin; + return VKBTypeNotSet; +} + +static VirtualKeyboardType keyboardTypeAttribute(const WebCore::Element* element) +{ + DEFINE_STATIC_LOCAL(QualifiedName, keyboardTypeAttr, (nullAtom, "data-blackberry-virtual-keyboard-type", nullAtom)); + + if (element->fastHasAttribute(keyboardTypeAttr)) { + AtomicString attributeString = element->fastGetAttribute(keyboardTypeAttr); + return convertStringToKeyboardType(attributeString); + } + + if (element->isFormControlElement()) { + const HTMLFormControlElement* formElement = static_cast<const HTMLFormControlElement*>(element); + if (formElement->form() && formElement->form()->fastHasAttribute(keyboardTypeAttr)) { + AtomicString attributeString = formElement->form()->fastGetAttribute(keyboardTypeAttr); + return convertStringToKeyboardType(attributeString); + } + } + + return VKBTypeNotSet; +} + +static VirtualKeyboardEnterKeyType convertStringToKeyboardEnterKeyType(const AtomicString& string) +{ + DEFINE_STATIC_LOCAL(AtomicString, Default, ("default")); + DEFINE_STATIC_LOCAL(AtomicString, Connect, ("connect")); + DEFINE_STATIC_LOCAL(AtomicString, Done, ("done")); + DEFINE_STATIC_LOCAL(AtomicString, Go, ("go")); + DEFINE_STATIC_LOCAL(AtomicString, Join, ("join")); + DEFINE_STATIC_LOCAL(AtomicString, Next, ("next")); + DEFINE_STATIC_LOCAL(AtomicString, Search, ("search")); + DEFINE_STATIC_LOCAL(AtomicString, Send, ("send")); + DEFINE_STATIC_LOCAL(AtomicString, Submit, ("submit")); + + if (string.isEmpty()) + return VKBEnterKeyNotSet; + if (equalIgnoringCase(string, Default)) + return VKBEnterKeyDefault; + if (equalIgnoringCase(string, Connect)) + return VKBEnterKeyConnect; + if (equalIgnoringCase(string, Done)) + return VKBEnterKeyDone; + if (equalIgnoringCase(string, Go)) + return VKBEnterKeyGo; + if (equalIgnoringCase(string, Join)) + return VKBEnterKeyJoin; + if (equalIgnoringCase(string, Next)) + return VKBEnterKeyNext; + if (equalIgnoringCase(string, Search)) + return VKBEnterKeySearch; + if (equalIgnoringCase(string, Send)) + return VKBEnterKeySend; + if (equalIgnoringCase(string, Submit)) + return VKBEnterKeySubmit; + return VKBEnterKeyNotSet; +} + +static VirtualKeyboardEnterKeyType keyboardEnterKeyTypeAttribute(const WebCore::Element* element) +{ + DEFINE_STATIC_LOCAL(QualifiedName, keyboardEnterKeyTypeAttr, (nullAtom, "data-blackberry-virtual-keyboard-enter-key", nullAtom)); + + if (element->fastHasAttribute(keyboardEnterKeyTypeAttr)) { + AtomicString attributeString = element->fastGetAttribute(keyboardEnterKeyTypeAttr); + return convertStringToKeyboardEnterKeyType(attributeString); + } + + if (element->isFormControlElement()) { + const HTMLFormControlElement* formElement = static_cast<const HTMLFormControlElement*>(element); + if (formElement->form() && formElement->form()->fastHasAttribute(keyboardEnterKeyTypeAttr)) { + AtomicString attributeString = formElement->form()->fastGetAttribute(keyboardEnterKeyTypeAttr); + return convertStringToKeyboardEnterKeyType(attributeString); + } + } + + return VKBEnterKeyNotSet; +} + WTF::String InputHandler::elementText() { if (!isActiveTextEdit()) @@ -478,8 +591,11 @@ void InputHandler::setElementFocused(Element* element) BlackBerryInputType type = elementType(element); m_currentFocusElementTextEditMask = inputStyle(type, element); - FocusLog(LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d", type, m_currentFocusElementTextEditMask); - m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask); + VirtualKeyboardType keyboardType = keyboardTypeAttribute(element); + VirtualKeyboardEnterKeyType enterKeyType = keyboardEnterKeyTypeAttribute(element); + + FocusLog(LogLevelInfo, "InputHandler::setElementFocused, Type=%d, Style=%d, Keyboard Type=%d, Enter Key=%d", type, m_currentFocusElementTextEditMask, keyboardType, enterKeyType); + m_webPage->m_client->inputFocusGained(type, m_currentFocusElementTextEditMask, keyboardType, enterKeyType); handleInputLocaleChanged(m_webPage->m_webSettings->isWritingDirectionRTL()); @@ -495,15 +611,28 @@ bool InputHandler::openDatePopup(HTMLInputElement* element, BlackBerryInputType if (isActiveTextEdit()) clearCurrentFocusElement(); - m_currentFocusElement = element; - m_currentFocusElementType = TextPopup; + switch (type) { + case BlackBerry::Platform::InputTypeDate: + case BlackBerry::Platform::InputTypeTime: + case BlackBerry::Platform::InputTypeDateTime: + case BlackBerry::Platform::InputTypeDateTimeLocal: { + // Check if popup already exists, close it if does. + m_webPage->m_page->chrome()->client()->closePagePopup(0); + String value = element->value(); + String min = element->getAttribute(HTMLNames::minAttr).string(); + String max = element->getAttribute(HTMLNames::maxAttr).string(); + double step = element->getAttribute(HTMLNames::stepAttr).toDouble(); + + DatePickerClient* client = new DatePickerClient(type, value, min, max, step, m_webPage, element); + // Fail to create HTML popup, use the old path + if (!m_webPage->m_page->chrome()->client()->openPagePopup(client, WebCore::IntRect())) + m_webPage->m_client->openDateTimePopup(type, value, min, max, step); - WTF::String value = element->value(); - WTF::String min = element->getAttribute(HTMLNames::minAttr).string(); - WTF::String max = element->getAttribute(HTMLNames::maxAttr).string(); - double step = element->getAttribute(HTMLNames::stepAttr).toDouble(); - m_webPage->m_client->openDateTimePopup(type, value, min, max, step); - return true; + return true; + } + default: // Other types not supported + return false; + } } bool InputHandler::openColorPopup(HTMLInputElement* element) diff --git a/Source/WebKit/chromium/All.gyp b/Source/WebKit/chromium/All.gyp index d28bce8cf..739a0c8ec 100644 --- a/Source/WebKit/chromium/All.gyp +++ b/Source/WebKit/chromium/All.gyp @@ -47,7 +47,9 @@ 'conditions': [ ['OS=="android"', { 'dependencies': [ + 'WebKitUnitTests.gyp:webkit_unit_tests_apk', '../../../Tools/DumpRenderTree/DumpRenderTree.gyp/DumpRenderTree.gyp:DumpRenderTree_apk', + '../../../Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp:TestWebKitAPI_apk', ], }], ], diff --git a/Source/WebKit/chromium/ChangeLog b/Source/WebKit/chromium/ChangeLog index cd904d3c1..ca0049168 100644 --- a/Source/WebKit/chromium/ChangeLog +++ b/Source/WebKit/chromium/ChangeLog @@ -1,3 +1,546 @@ +2012-07-13 Eric Penner <epenner@google.com> + + [chromium] Add 'self-managed' option to CCPrioritizedTexture to enable render-surface and canvas use cases. + https://bugs.webkit.org/show_bug.cgi?id=91177 + + Reviewed by Adrienne Walker. + + * tests/CCPrioritizedTextureTest.cpp: + (WTF::TEST_F): + * tests/TiledLayerChromiumTest.cpp: + +2012-07-13 Brian Anderson <brianderson@chromium.org> + + Add flushes to CCTextureUpdater::update + https://bugs.webkit.org/show_bug.cgi?id=89035 + + Reviewed by Adrienne Walker. + + CCTextureUpdaterTest added to verify texture upload/flushing patterns. + + * WebKit.gypi: + * tests/CCTextureUpdaterTest.cpp: Added. + +2012-07-13 David Grogan <dgrogan@chromium.org> + + IndexedDB: Re-enable indexeddb in test_shell + https://bugs.webkit.org/show_bug.cgi?id=91161 + + Reviewed by Tony Chang. + + IDB used to be allowed to run if webView->permissionClient() was NULL, + as is the case in test_shell. This was inadvertently changed in + http://wkb.ug/90310. + + We still don't have an automated test for this (http://crbug.com/113738) + Tested manually: + + * In test_shell: + 1) Open an IDB page + 2) Verify IDB has permission to open a DB + + * In chrome: + 1) Open an IDB page + 2) Verify IDB has permission to open a DB + 3) Revoke IDB permissions in chrome://chrome/settings/content + 4) Reload the IDB page + 5) Verify IDB doesn't have permission to open a DB + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::allowIndexedDB): + +2012-07-13 Wei James <james.wei@intel.com> + + enable TestWebKitAPI/webkit_unit_tests apk on x86 android platform by adding abi support + https://bugs.webkit.org/show_bug.cgi?id=91194 + + Reviewed by Adam Barth. + + * WebKitUnitTests.gyp: + +2012-07-13 Dana Jansens <danakj@chromium.org> + + webkit_unit_test CCLayerTreeHostImplTest.testRemoveRenderPasses started failing. + https://bugs.webkit.org/show_bug.cgi?id=91245 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed gardening: skip failing webkit unit test. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-13 Vsevolod Vlasov <vsevik@chromium.org> + + Unreviewed gardening, skip failing webkit_unit_tests. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-07-13 Kent Tamura <tkent@chromium.org> + + Make calendar pickers testable + https://bugs.webkit.org/show_bug.cgi?id=84827 + + Reviewed by Hajime Morita. + + * src/ChromeClientImpl.cpp: + (WebKit::ChromeClientImpl::ChromeClientImpl): + Initialize m_pagePopupDriver with the WebViewImpl. + (WebKit::ChromeClientImpl::openPagePopup): + Just calls PagePoupDriver::openPagePopup(). + (WebKit::ChromeClientImpl::closePagePopup): + Just calls PagePoupDriver::closePagePopup(). + (WebKit::ChromeClientImpl::setPagePopupDriver): + * src/ChromeClientImpl.h: + (ChromeClientImpl): Add setPagePopupDriver + * src/WebViewImpl.h: + (WebViewImpl): + WebViewImpl implements PagePopupDriver. openPagePopup() and + closePagePopup() override members of PagePopupDriver. + +2012-07-13 Yoshifumi Inoue <yosin@chromium.org> + + REGRESSION(r119948): [Forms] Spin button Up/Down actions make value to zero for input type "number" when step mismatched + https://bugs.webkit.org/show_bug.cgi?id=91197 + + Reviewed by Kent Tamura. + + This patch adds test cases for Decimal::ceiling() and floor() of + positive/negative small fractional numbers. + + * tests/DecimalTest.cpp: + (TEST_F): + +2012-07-12 Adrienne Walker <enne@google.com> + + [chromium] Root invalidations for RTL pages need to be in the right space + https://bugs.webkit.org/show_bug.cgi?id=91155 + + Reviewed by Kenneth Russell. + + The root layer has a translation on it when placed in the tree, so any + invalidations on this layer likewise need to be adjusted. + + This adjustment is due to the fact that compositor layers all have the + origin in the upper left corner of the layer, but this is not always + the origin for graphics layers. Rather than making compositor layers + have to deal with a potential offset, we change the transform when + inserting the layer into the tree. Invalidations need to be similarly + transformed from document space into compositor layer space. + + The need for this offset is due to the definition of the initial + containing block. RTL pages (pages with dir=RTL on the body) start + scrolled all the way to the right, and the origin is in the upper left + hand corner of this initial viewport. Thus on RTL pages with + horizontal overflow, the left of the document is in negative CSS + space. + + * src/NonCompositedContentHost.cpp: + (WebKit::NonCompositedContentHost::invalidateRect): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] Remove the RenderPass pointer from RenderPassDrawQuad + https://bugs.webkit.org/show_bug.cgi?id=91023 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-12 Adam Barth <abarth@webkit.org> + + [Chromium] WebSettings should be sorted + https://bugs.webkit.org/show_bug.cgi?id=91157 + + Reviewed by Eric Seidel. + + This might be my OCD, but IMHO this file would be cleaner if we listed + the settings in alphabetic order. + + * public/WebSettings.h: + * src/WebSettingsImpl.h: + (WebSettingsImpl): + (WebKit::WebSettingsImpl::forceSoftwareCompositing): + (WebKit::WebSettingsImpl::viewportEnabled): + (WebKit::WebSettingsImpl::maxUntiledLayerSize): + +2012-07-12 Joshua Bell <jsbell@chromium.org> + + IndexedDB: Enable IDBFactory.deleteDatabase() and webkitGetDatabaseNames() in Workers + https://bugs.webkit.org/show_bug.cgi?id=90310 + + Reviewed by Tony Chang. + + * src/IDBFactoryBackendProxy.cpp: + (WebKit::IDBFactoryBackendProxy::allowIndexedDB): Consolidates user-prompting logic. + (WebKit::getWebFrame): Helper to dig out frame from Document, or null for Worker. + (WebKit::IDBFactoryBackendProxy::getDatabaseNames): + (WebKit): + (WebKit::IDBFactoryBackendProxy::open): + (WebKit::IDBFactoryBackendProxy::deleteDatabase): + * src/IDBFactoryBackendProxy.h: Update method signatures to match interface. + (WebCore): + (IDBFactoryBackendProxy): + +2012-07-12 Dana Jansens <danakj@chromium.org> + + [chromium] The root layer should not try create a second RenderSurface for itself + https://bugs.webkit.org/show_bug.cgi?id=91124 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-12 Eric Penner <epenner@google.com> + + [chromium] Use CCTexture/TextureAllocator and remove TextureManager + https://bugs.webkit.org/show_bug.cgi?id=91001 + + Reviewed by Adrienne Walker. + + Deleting old texture manager tests. + + * WebKit.gypi: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCPrioritizedTextureTest.cpp: + (WTF::CCPrioritizedTextureTest::texturesMemorySize): + * tests/CCThreadedTest.cpp: + * tests/CCTiledLayerTestCommon.h: + * tests/Canvas2DLayerBridgeTest.cpp: + * tests/TextureManagerTest.cpp: Removed. + +2012-07-12 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] r122400 broke 10.6 build + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Reviewed by Tony Chang. + + Use the right availability macros for forward-declaring methods and + defining constants. + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + In r117327, we added a parameter for modifier keys to these methods. + Chromium has since switched to using the methods that require the + extra parameter so we can remove these methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-12 Tony Chang <tony@chromium.org> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-12 Adam Barth <abarth@webkit.org> + + [Chromium] Delete last mention of Hixie76 in WebKit/chromium + https://bugs.webkit.org/show_bug.cgi?id=91099 + + Reviewed by Tony Chang. + + This deprecated API is no longer used anywhere. + + * public/WebSettings.h: + (WebKit::WebSettings::setDefaultDeviceScaleFactor): + +2012-07-12 Tony Chang <tony@chromium.org> + + Unreviewed, rolling out r122477. + http://trac.webkit.org/changeset/122477 + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Broke Chromium Mac build + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Robert Sesek <rsesek@chromium.org> + + [chromium][Mac] r122400 broke 10.6 build + https://bugs.webkit.org/show_bug.cgi?id=91103 + + Reviewed by Tony Chang. + + Use the right availability macros for forward-declaring methods and + defining constants. + + * src/mac/WebInputEventFactory.mm: + +2012-07-12 Peter Beverloo <peter@chromium.org> + + [Chromium] Enable building APKs for TestWebKitAPI and webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=90989 + + Reviewed by Adam Barth. + + Add dependencies on the webkit_unit_tests_apk and TestWebKitAPI_apk + targets for Android, making sure that we're generating the packages. + + * All.gyp: + +2012-07-12 Leandro Gracia Gil <leandrogracia@chromium.org> + + [Chromium] Remove unrequired API in WebSurroundingText. + https://bugs.webkit.org/show_bug.cgi?id=91067 + + Reviewed by Adam Barth. + + Remove the unused first initialize method from WebSurroundingText. + Now both Chromium and LayoutTestController use the second method. + + * public/WebSurroundingText.h: + (WebSurroundingText): + * src/WebSurroundingText.cpp: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * src/mac/WebInputEventFactory.mm: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed. Rolled DEPS. + + * DEPS: + +2012-07-11 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122358. + http://trac.webkit.org/changeset/122358 + https://bugs.webkit.org/show_bug.cgi?id=91037 + + Build break on WebKit Win (Requested by hayato on #webkit). + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit): + (WebKit::WebViewImpl::dragTargetDragOver): + (WebKit::WebViewImpl::dragTargetDrop): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-11 Alexandre Elias <aelias@google.com> + + [chromium] Move compositor quads to Platform/chromium/public + https://bugs.webkit.org/show_bug.cgi?id=90582 + + Reviewed by Adrienne Walker. + + This moves CCSharedQuadState, CCDrawQuad, and all but two CC*DrawQuad + classes to the WebKit namespace, as a first step to pushing them + across the process boundary for the ubercompositor. + + - The intent is to serialize the class hierarchy using the same + mechanism as WebInputEvent. In order to do this, there are three + requirements: pure POD data, a method returning size, and a packing + pragma. + + - Private data members are fine with this kind of serializer, and a + default constructor is not needed. Because of that, we can maintain + the same encapsulation and convenient APIs (behind + WEBKIT_IMPLEMENTATION) as the original classes. To ease the + transition, the original WebCore headers still exist and typedef to + the new classes. + + - However, SharedQuadState will be serialized using the normal + IPC_STRUCT_TRAITS macro, so I made its members public. A custom + serializer (on quad lists) will maintain the pointers from quads to + SharedQuadStates. + + - I converted the Material casting mechanism to materialCast() methods + living in the derived classes. That way, the WebCompositorQuad header + doesn't need to know about all its derived classes. + + - Quad classes not yet transitioned can still be used in + non-ubercompositor mode. CCRenderPassDrawQuad and CCYUVVideoDrawQuad + are currently non-POD and I left them in their original files. + + This approach is the best I've found so far, since it preserves all + WebCore-facing APIs and avoids unnecessary code duplication (new quad + types or members can be added by modifying only one place). There + also should not be an unreasonable amount of custom serializer code + required. + + * tests/CCLayerTestCommon.cpp: + (CCLayerTestCommon::verifyQuadsExactlyCoverRect): + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Rename layerRect to contentRect for rects that live in content space + https://bugs.webkit.org/show_bug.cgi?id=90843 + + Reviewed by Adrienne Walker. + + * tests/CCLayerImplTest.cpp: + (WebCore::TEST): + * tests/CCLayerTreeHostCommonTest.cpp: + * tests/CCLayerTreeHostImplTest.cpp: + * tests/CCOcclusionTrackerTest.cpp: + (WebKitTests::CCOcclusionTrackerTestVisitTargetTwoTimes::runMyTest): + (WebKitTests::CCOcclusionTrackerTestSurfaceRotatedOffAxis::runMyTest): + (WebKitTests::CCOcclusionTrackerTestLargePixelsOccludeInsideClipRect::runMyTest): + * tests/CCQuadCullerTest.cpp: + * tests/CCRenderSurfaceTest.cpp: + * tests/CCSolidColorLayerImplTest.cpp: + (CCLayerTestCommon::TEST): + * tests/CCTiledLayerImplTest.cpp: + (CCLayerTestCommon::createLayer): + (CCLayerTestCommon::TEST): + (CCLayerTestCommon::getQuads): + (CCLayerTestCommon::coverageVisibleRectIntersectsTiles): + (CCLayerTestCommon::coverageVisibleRectIntersectsBounds): + * tests/CCTiledLayerTestCommon.cpp: + (WebKitTests::FakeLayerTextureUpdater::prepareToUpdate): + (WebKitTests::FakeTiledLayerChromium::update): + * tests/CCTiledLayerTestCommon.h: + (FakeTiledLayerChromium): + * tests/LayerChromiumTest.cpp: + * tests/TiledLayerChromiumTest.cpp: + +2012-07-11 Dana Jansens <danakj@chromium.org> + + [chromium] Minimum size used for occlusion tracking should be a setting on CCLayerTreeHost + https://bugs.webkit.org/show_bug.cgi?id=90993 + + Reviewed by Adrienne Walker. + + * tests/CCLayerTreeHostImplTest.cpp: + +2012-07-11 Adam Barth <abarth@webkit.org> + + [Chromium] Enable LEGACY_VIEWPORT_ADAPTION + https://bugs.webkit.org/show_bug.cgi?id=90991 + + Reviewed by Tony Chang. + + Chromium wishes to support LEGACY_VIEWPORT_ADAPTION. I actually thought + this was enabled before, but the enable bit got lost in the shuffle. + + * features.gypi: + +2012-07-11 Tony Chang <tony@chromium.org> + + [chromium] Remove drag and drop API methods that are no longer used + https://bugs.webkit.org/show_bug.cgi?id=90996 + + Reviewed by Adam Barth. + + In r117327, we added a parameter for modifier keys to these methods. + Chromium has since switched to using the methods that require the + extra parameter so we can remove these methods. + + * public/WebView.h: + (WebView): + * src/WebViewImpl.cpp: + (WebKit::WebViewImpl::dragTargetDragEnter): + (WebKit::WebViewImpl::dragTargetDragOver): + * src/WebViewImpl.h: + (WebViewImpl): + +2012-07-11 Shawn Singh <shawnsingh@chromium.org> + + Unreviewed build fix, forgot to add URLTestHelpers.* when landing r122344 + + * tests/URLTestHelpers.cpp: Added. + (URLTestHelpers): + (WebKit::URLTestHelpers::registerMockedURLFromBaseURL): + (WebKit::URLTestHelpers::registerMockedURLLoad): + * tests/URLTestHelpers.h: Added. + (WebKit): + (URLTestHelpers): + (WebKit::URLTestHelpers::toKURL): + +2012-07-11 Shawn Singh <shawnsingh@chromium.org> + + [chromium] Use WEBKIT_IMPLEMENTATION == 1 for webkit_unit_tests + https://bugs.webkit.org/show_bug.cgi?id=90094 + + Reviewed by Adrienne Walker. + + This patch adds the WEBKIT_IMPLEMENTATION = 1 define to + WebKitUnitTests.gyp. To get it to compile correctly, some string + and URL code was refactored and fixed, in particular GURL usage is + replaced with KURL usage. + + * WebKit.gyp: + added WEBKIT_IMPLEMENTATION == 1 for unit test code when in shared library + added URLTestHelpers to exclusion in shared library build, because it depends on webkit_support + + * WebKit.gypi: + added URLTestHelpers.h and .cpp to the build process + + * WebKitUnitTests.gyp: + added WEBKIT_IMPLEMENTATION == 1 for unit test code when not in shared library. + note that in shared library build, RunAllTests.cpp does not have WEBKIT_IMPLEMENTATION == 1. + + * public/WebDOMMessageEvent.h: + (WebKit::WebDOMMessageEvent::WebDOMMessageEvent): + * tests/AssociatedURLLoaderTest.cpp: + * tests/EventListenerTest.cpp: + * tests/FrameTestHelpers.cpp: + (WebKit::FrameTestHelpers::loadFrame): + * tests/FrameTestHelpers.h: + * tests/ListenerLeakTest.cpp: + (WebKit::ListenerLeakTest::RunTest): + * tests/PopupMenuTest.cpp: + * tests/RunAllTests.cpp: + * tests/URLTestHelpers.cpp: Added. + (URLTestHelpers): + (WebKit::URLTestHelpers::registerMockedURLFromBaseURL): + (WebKit::URLTestHelpers::registerMockedURLLoad): + * tests/URLTestHelpers.h: Copied from Source/WebKit/chromium/public/WebDOMMessageEvent.h. + (WebKit): + (URLTestHelpers): + (WebKit::URLTestHelpers::toKURL): + * tests/WebFrameTest.cpp: + * tests/WebPageNewSerializerTest.cpp: + * tests/WebPageSerializerTest.cpp: + * tests/WebViewTest.cpp: + +2012-07-10 Pavel Feldman <pfeldman@chromium.org> + + Web Inspector: migrate from background images to CSS for statusbar rendering. + https://bugs.webkit.org/show_bug.cgi?id=90902 + + Reviewed by Vsevolod Vlasov. + + * WebKit.gypi: + * src/js/Images/statusbarBackgroundChromium.png: Removed. + * src/js/Images/statusbarBottomBackgroundChromium.png: Removed. + * src/js/Images/statusbarButtonsChromium.png: Removed. + * src/js/Images/statusbarMenuButtonChromium.png: Removed. + * src/js/Images/statusbarMenuButtonSelectedChromium.png: Removed. + * src/js/devTools.css: + (.status-bar-background): + 2012-07-11 Kenichi Ishibashi <bashi@chromium.org> [Chromium] Adding HarfBuzz-ng for Linux diff --git a/Source/WebKit/chromium/DEPS b/Source/WebKit/chromium/DEPS index 67aef6ffa..b33ddc339 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': '145569' + 'chromium_rev': '146381' } deps = { diff --git a/Source/WebKit/chromium/WebKit.gyp b/Source/WebKit/chromium/WebKit.gyp index 6fce44075..f6868201c 100644 --- a/Source/WebKit/chromium/WebKit.gyp +++ b/Source/WebKit/chromium/WebKit.gyp @@ -688,6 +688,7 @@ ['component=="shared_library"', { 'defines': [ 'WEBKIT_DLL', + 'WEBKIT_IMPLEMENTATION=1', ], 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore_bindings', @@ -739,6 +740,7 @@ 'tests/PopupMenuTest.cpp', 'tests/RenderTableCellTest.cpp', 'tests/RenderTableRowTest.cpp', + 'tests/URLTestHelpers.cpp', 'tests/WebFrameTest.cpp', 'tests/WebPageNewSerializerTest.cpp', 'tests/WebPageSerializerTest.cpp', diff --git a/Source/WebKit/chromium/WebKit.gypi b/Source/WebKit/chromium/WebKit.gypi index 1a5babfd0..59c00795e 100644 --- a/Source/WebKit/chromium/WebKit.gypi +++ b/Source/WebKit/chromium/WebKit.gypi @@ -50,11 +50,6 @@ 'src/js/Images/segmentHoverEndChromium.png', 'src/js/Images/segmentSelectedChromium.png', 'src/js/Images/segmentSelectedEndChromium.png', - 'src/js/Images/statusbarBackgroundChromium.png', - 'src/js/Images/statusbarBottomBackgroundChromium.png', - 'src/js/Images/statusbarButtonsChromium.png', - 'src/js/Images/statusbarMenuButtonChromium.png', - 'src/js/Images/statusbarMenuButtonSelectedChromium.png', ], 'webkit_unittest_files': [ 'tests/ArenaTestHelpers.h', @@ -89,6 +84,7 @@ 'tests/CCScopedTextureTest.cpp', 'tests/CCSolidColorLayerImplTest.cpp', 'tests/CCTestCommon.h', + 'tests/CCTextureUpdaterTest.cpp', 'tests/CCTiledLayerImplTest.cpp', 'tests/CCTiledLayerTestCommon.h', 'tests/CCTiledLayerTestCommon.cpp', @@ -143,13 +139,14 @@ 'tests/ScrollbarLayerChromiumTest.cpp', 'tests/TextureCopierTest.cpp', 'tests/TextureLayerChromiumTest.cpp', - 'tests/TextureManagerTest.cpp', 'tests/ThrottledTextureUploaderTest.cpp', 'tests/TiledLayerChromiumTest.cpp', 'tests/TilingDataTest.cpp', 'tests/TreeSynchronizerTest.cpp', 'tests/TreeTestHelpers.cpp', 'tests/TreeTestHelpers.h', + 'tests/URLTestHelpers.cpp', + 'tests/URLTestHelpers.h', 'tests/WebAnimationTest.cpp', 'tests/WebCompositorInputHandlerImplTest.cpp', 'tests/WebFloatAnimationCurveTest.cpp', diff --git a/Source/WebKit/chromium/WebKitUnitTests.gyp b/Source/WebKit/chromium/WebKitUnitTests.gyp index bf68f4f49..051c13524 100644 --- a/Source/WebKit/chromium/WebKitUnitTests.gyp +++ b/Source/WebKit/chromium/WebKitUnitTests.gyp @@ -87,6 +87,9 @@ 'dependencies': [ '../../WebCore/WebCore.gyp/WebCore.gyp:webcore', ], + 'defines': [ + 'WEBKIT_IMPLEMENTATION=1', + ], 'sources': [ '<@(webkit_unittest_files)', ], @@ -170,7 +173,9 @@ '<(PRODUCT_DIR)/webkit_unit_tests_apk', '--ant-args', '-DPRODUCT_DIR=<(ant_build_out)', - '--ant-compile' + '--ant-compile', + '--app_abi', + '<(android_app_abi)', ], }], }], diff --git a/Source/WebKit/chromium/features.gypi b/Source/WebKit/chromium/features.gypi index 7c02a0127..35f86cf24 100644 --- a/Source/WebKit/chromium/features.gypi +++ b/Source/WebKit/chromium/features.gypi @@ -69,6 +69,7 @@ 'ENABLE_INPUT_TYPE_DATE=1', 'ENABLE_JAVASCRIPT_DEBUGGER=1', 'ENABLE_LEGACY_CSS_VENDOR_PREFIXES=0', + 'ENABLE_LEGACY_VIEWPORT_ADAPTION=1', 'ENABLE_LEGACY_WEBKIT_BLOB_BUILDER=1', 'ENABLE_LINK_PREFETCH=1', 'ENABLE_LINK_PRERENDER=1', diff --git a/Source/WebKit/chromium/public/WebDOMMessageEvent.h b/Source/WebKit/chromium/public/WebDOMMessageEvent.h index 355b73715..6619af246 100644 --- a/Source/WebKit/chromium/public/WebDOMMessageEvent.h +++ b/Source/WebKit/chromium/public/WebDOMMessageEvent.h @@ -46,6 +46,7 @@ class WebString; class WebDOMMessageEvent : public WebDOMEvent { public: + WebDOMMessageEvent() { } WEBKIT_EXPORT void initMessageEvent(const WebString& type, bool canBubble, bool cancelable, const WebSerializedScriptValue& messageData, const WebString& origin, const WebFrame* sourceFrame, const WebString& lastEventId); WEBKIT_EXPORT WebSerializedScriptValue data() const; diff --git a/Source/WebKit/chromium/public/WebSettings.h b/Source/WebKit/chromium/public/WebSettings.h index 56b49ffbb..88ed9639d 100644 --- a/Source/WebKit/chromium/public/WebSettings.h +++ b/Source/WebKit/chromium/public/WebSettings.h @@ -53,114 +53,112 @@ public: EditingBehaviorUnix }; - virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual bool forceSoftwareCompositing() const = 0; + virtual bool scrollAnimatorEnabled() const = 0; + virtual bool viewportEnabled() const = 0; + virtual void setAccelerated2dCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingEnabled(bool) = 0; + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; + virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; + virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; + virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; + virtual void setAcceleratedFiltersEnabled(bool) = 0; + virtual void setAcceleratedPaintingEnabled(bool) = 0; + virtual void setAllowDisplayOfInsecureContent(bool) = 0; + virtual void setAllowFileAccessFromFileURLs(bool) = 0; + virtual void setAllowRunningOfInsecureContent(bool) = 0; + virtual void setAllowScriptsToCloseWindows(bool) = 0; + virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; + virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setAuthorAndUserStylesEnabled(bool) = 0; + virtual void setCaretBrowsingEnabled(bool) = 0; + virtual void setCookieEnabled(bool) = 0; virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; - virtual void setDefaultFontSize(int) = 0; + virtual void setDNSPrefetchingEnabled(bool) = 0; + virtual void setDOMPasteAllowed(bool) = 0; virtual void setDefaultFixedFontSize(int) = 0; - virtual void setMinimumFontSize(int) = 0; - virtual void setMinimumLogicalFontSize(int) = 0; - virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool) = 0; - virtual void setTextAutosizingEnabled(bool) = 0; + virtual void setDefaultFontSize(int) = 0; virtual void setDefaultTextEncodingName(const WebString&) = 0; - virtual void setDeviceSupportsTouch(bool) = 0; + virtual void setDefaultTileSize(WebSize) = 0; + virtual void setDeferred2dCanvasEnabled(bool) = 0; + virtual void setDeveloperExtrasEnabled(bool) = 0; virtual void setDeviceSupportsMouse(bool) = 0; - virtual void setJavaScriptEnabled(bool) = 0; - virtual void setWebSecurityEnabled(bool) = 0; - virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; - virtual void setLoadsImagesAutomatically(bool) = 0; + virtual void setDeviceSupportsTouch(bool) = 0; + virtual void setDownloadableBinaryFontsEnabled(bool) = 0; + virtual void setEditableLinkBehaviorNeverLive() = 0; + virtual void setEditingBehavior(EditingBehavior) = 0; + virtual void setEnableScrollAnimator(bool) = 0; + virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; + virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; + virtual void setExperimentalCSSRegionsEnabled(bool) = 0; + virtual void setExperimentalCSSVariablesEnabled(bool) = 0; + virtual void setExperimentalWebGLEnabled(bool) = 0; + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setFixedPositionCreatesStackingContext(bool) = 0; + virtual void setFontRenderingModeNormal() = 0; + virtual void setForceCompositingMode(bool) = 0; + virtual void setForceSoftwareCompositing(bool) = 0; + virtual void setFrameFlatteningEnabled(bool) = 0; + virtual void setFullScreenEnabled(bool) = 0; + virtual void setHyperlinkAuditingEnabled(bool) = 0; virtual void setImagesEnabled(bool) = 0; - virtual void setPluginsEnabled(bool) = 0; - virtual void setDOMPasteAllowed(bool) = 0; - virtual void setDeveloperExtrasEnabled(bool) = 0; - virtual void setNeedsSiteSpecificQuirks(bool) = 0; - virtual void setShrinksStandaloneImagesToFit(bool) = 0; - virtual void setUsesEncodingDetector(bool) = 0; - virtual void setTextAreasAreResizable(bool) = 0; + virtual void setInteractiveFormValidationEnabled(bool) = 0; virtual void setJavaEnabled(bool) = 0; - virtual void setAllowScriptsToCloseWindows(bool) = 0; - virtual void setUserStyleSheetLocation(const WebURL&) = 0; - virtual void setAuthorAndUserStylesEnabled(bool) = 0; - virtual void setUsesPageCache(bool) = 0; - virtual void setPageCacheSupportsPlugins(bool) = 0; - virtual void setDownloadableBinaryFontsEnabled(bool) = 0; virtual void setJavaScriptCanAccessClipboard(bool) = 0; - virtual void setXSSAuditorEnabled(bool) = 0; - virtual void setDNSPrefetchingEnabled(bool) = 0; - virtual void setFixedElementsLayoutRelativeToFrame(bool) = 0; + virtual void setJavaScriptCanOpenWindowsAutomatically(bool) = 0; + virtual void setJavaScriptEnabled(bool) = 0; + virtual void setLayoutFallbackWidth(int) = 0; + virtual void setLoadsImagesAutomatically(bool) = 0; virtual void setLocalStorageEnabled(bool) = 0; - virtual void setEditableLinkBehaviorNeverLive() = 0; - virtual void setFrameFlatteningEnabled(bool) = 0; - virtual void setFontRenderingModeNormal() = 0; - virtual void setAllowUniversalAccessFromFileURLs(bool) = 0; - virtual void setAllowFileAccessFromFileURLs(bool) = 0; - virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; + virtual void setMaxUntiledLayerSize(WebSize) = 0; + virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; + virtual void setMemoryInfoEnabled(bool) = 0; + virtual void setMinimumAccelerated2dCanvasSize(int) = 0; + virtual void setMinimumFontSize(int) = 0; + virtual void setMinimumLogicalFontSize(int) = 0; + virtual void setMinimumTimerInterval(double) = 0; + virtual void setMockScrollbarsEnabled(bool) = 0; + virtual void setNeedsSiteSpecificQuirks(bool) = 0; virtual void setOfflineWebApplicationCacheEnabled(bool) = 0; - virtual void setWebAudioEnabled(bool) = 0; - virtual void setExperimentalWebGLEnabled(bool) = 0; - virtual void setExperimentalCSSRegionsEnabled(bool) = 0; - virtual void setExperimentalCSSGridLayoutEnabled(bool) = 0; - virtual void setExperimentalCSSCustomFilterEnabled(bool) = 0; - virtual void setExperimentalCSSVariablesEnabled(bool) = 0; virtual void setOpenGLMultisamplingEnabled(bool) = 0; + virtual void setPageCacheSupportsPlugins(bool) = 0; + virtual void setPasswordEchoDurationInSeconds(double) = 0; + virtual void setPasswordEchoEnabled(bool) = 0; + virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setPluginsEnabled(bool) = 0; virtual void setPrivilegedWebGLExtensionsEnabled(bool) = 0; - virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setShouldPrintBackgrounds(bool) = 0; virtual void setShowDebugBorders(bool) = 0; virtual void setShowFPSCounter(bool) = 0; - virtual void setShowPlatformLayerTree(bool) = 0; virtual void setShowPaintRects(bool) = 0; - virtual void setEditingBehavior(EditingBehavior) = 0; - virtual void setAcceleratedCompositingEnabled(bool) = 0; - virtual void setForceCompositingMode(bool) = 0; - virtual void setForceSoftwareCompositing(bool) = 0; - virtual void setMockScrollbarsEnabled(bool) = 0; - virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool) = 0; - virtual void setAcceleratedCompositingForVideoEnabled(bool) = 0; - virtual void setAcceleratedCompositingForCanvasEnabled(bool) = 0; - virtual void setAcceleratedCompositingForPluginsEnabled(bool) = 0; - virtual void setAcceleratedCompositingForAnimationEnabled(bool) = 0; - virtual void setAccelerated2dCanvasEnabled(bool) = 0; - virtual void setDeferred2dCanvasEnabled(bool) = 0; - virtual void setAcceleratedCompositingForFixedPositionEnabled(bool) = 0; - virtual void setMinimumAccelerated2dCanvasSize(int) = 0; - virtual void setAcceleratedFiltersEnabled(bool) = 0; - virtual void setMemoryInfoEnabled(bool) = 0; - virtual void setHyperlinkAuditingEnabled(bool) = 0; - virtual void setLayoutFallbackWidth(int) = 0; - virtual void setAsynchronousSpellCheckingEnabled(bool) = 0; + virtual void setShowPlatformLayerTree(bool) = 0; + virtual void setShrinksStandaloneImagesToFit(bool) = 0; + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON) = 0; + virtual void setSyncXHRInDocumentsEnabled(bool) = 0; + virtual void setTextAreasAreResizable(bool) = 0; + virtual void setTextAutosizingEnabled(bool) = 0; + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0; virtual void setUnifiedTextCheckerEnabled(bool) = 0; - virtual void setCaretBrowsingEnabled(bool) = 0; - virtual void setInteractiveFormValidationEnabled(bool) = 0; + virtual void setUserStyleSheetLocation(const WebURL&) = 0; + virtual void setUsesEncodingDetector(bool) = 0; + virtual void setUsesPageCache(bool) = 0; virtual void setValidationMessageTimerMagnification(int) = 0; - virtual void setMinimumTimerInterval(double) = 0; - virtual void setFullScreenEnabled(bool) = 0; - virtual void setAllowDisplayOfInsecureContent(bool) = 0; - virtual void setAllowRunningOfInsecureContent(bool) = 0; - virtual void setPasswordEchoEnabled(bool) = 0; - virtual void setPasswordEchoDurationInSeconds(double) = 0; - virtual void setShouldPrintBackgrounds(bool) = 0; - virtual void setEnableScrollAnimator(bool) = 0; - virtual bool scrollAnimatorEnabled() const = 0; - virtual void setVisualWordMovementEnabled(bool) = 0; - virtual void setAcceleratedPaintingEnabled(bool) = 0; virtual void setViewportEnabled(bool) = 0; - virtual void setMediaPlaybackRequiresUserGesture(bool) = 0; - virtual bool viewportEnabled() const = 0; - virtual void setDefaultTileSize(WebSize) = 0; - virtual void setMaxUntiledLayerSize(WebSize) = 0; - virtual void setFixedPositionCreatesStackingContext(bool) = 0; - virtual void setSyncXHRInDocumentsEnabled(bool) = 0; - virtual void setCookieEnabled(bool) = 0; - - virtual bool forceSoftwareCompositing() const = 0; + virtual void setVisualWordMovementEnabled(bool) = 0; + virtual void setWebAudioEnabled(bool) = 0; + virtual void setWebGLErrorsToConsoleEnabled(bool) = 0; + virtual void setWebSecurityEnabled(bool) = 0; + virtual void setXSSAuditorEnabled(bool) = 0; // DEPRECATED virtual void setDefaultDeviceScaleFactor(int) { } - virtual void setHixie76WebSocketProtocolEnabled(bool) { } protected: ~WebSettings() { } diff --git a/Source/WebKit/chromium/public/WebSurroundingText.h b/Source/WebKit/chromium/public/WebSurroundingText.h index 716fe4f0c..fa8c52ff0 100644 --- a/Source/WebKit/chromium/public/WebSurroundingText.h +++ b/Source/WebKit/chromium/public/WebSurroundingText.h @@ -48,10 +48,6 @@ public: WEBKIT_EXPORT bool isNull() const; WEBKIT_EXPORT void reset(); - // Initializes the object go get the surrounding text centered in the position described by the hit test. - // The maximum length of the contents retrieved is defined by maxLength. - WEBKIT_EXPORT void initialize(const WebHitTestResult&, size_t maxLength); - // Initializes the object to get the surrounding text centered in the position relative to a provided node. // The maximum length of the contents retrieved is defined by maxLength. WEBKIT_EXPORT void initialize(const WebNode&, const WebPoint&, size_t maxLength); diff --git a/Source/WebKit/chromium/public/WebView.h b/Source/WebKit/chromium/public/WebView.h index 96642f666..3ba5da24f 100644 --- a/Source/WebKit/chromium/public/WebView.h +++ b/Source/WebKit/chromium/public/WebView.h @@ -317,28 +317,16 @@ public: // Callback methods when a drag-and-drop operation is trying to drop // something on the WebView. - // FIXME: Remove this method after chromium changes catch up. - virtual WebDragOperation dragTargetDragEnter( - const WebDragData&, - const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) = 0; virtual WebDragOperation dragTargetDragEnter( const WebDragData&, const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) = 0; - // FIXME: Remove this method after chromium changes catch up. - virtual WebDragOperation dragTargetDragOver( - const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) = 0; virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) = 0; virtual void dragTargetDragLeave() = 0; - // FIXME: Remove this method after chromium changes catch up. - virtual void dragTargetDrop( - const WebPoint& clientPoint, const WebPoint& screenPoint) = 0; virtual void dragTargetDrop( const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers) = 0; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 349733919..b2219454c 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -60,6 +60,7 @@ #include "NavigationAction.h" #include "Node.h" #include "Page.h" +#include "PagePopupDriver.h" #include "PlatformScreen.h" #include "PlatformSupport.h" #include "PopupContainer.h" @@ -139,6 +140,9 @@ ChromeClientImpl::ChromeClientImpl(WebViewImpl* webView) , m_menubarVisible(true) , m_resizable(true) , m_nextNewWindowNavigationPolicy(WebNavigationPolicyIgnore) +#if ENABLE(PAGE_POPUP) + , m_pagePopupDriver(webView) +#endif { } @@ -1009,12 +1013,25 @@ PassRefPtr<SearchPopupMenu> ChromeClientImpl::createSearchPopupMenu(PopupMenuCli #if ENABLE(PAGE_POPUP) PagePopup* ChromeClientImpl::openPagePopup(PagePopupClient* client, const IntRect& originBoundsInRootView) { - return m_webView->openPagePopup(client, originBoundsInRootView); + ASSERT(m_pagePopupDriver); + return m_pagePopupDriver->openPagePopup(client, originBoundsInRootView); } void ChromeClientImpl::closePagePopup(PagePopup* popup) { - m_webView->closePagePopup(popup); + ASSERT(m_pagePopupDriver); + m_pagePopupDriver->closePagePopup(popup); +} + +void ChromeClientImpl::setPagePopupDriver(PagePopupDriver* driver) +{ + ASSERT(driver); + m_pagePopupDriver = driver; +} + +void ChromeClientImpl::resetPagePopupDriver() +{ + m_pagePopupDriver = m_webView; } #endif diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 5894177e0..86ff7ba68 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -198,6 +198,8 @@ public: #if ENABLE(PAGE_POPUP) virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect&) OVERRIDE; virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE; + virtual void setPagePopupDriver(WebCore::PagePopupDriver*) OVERRIDE; + virtual void resetPagePopupDriver() OVERRIDE; #endif virtual bool willAddTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE; virtual void addTextFieldDecorationsTo(WebCore::HTMLInputElement*) OVERRIDE; @@ -228,6 +230,9 @@ private: // The policy for how the next webview to be created will be shown. WebNavigationPolicy m_nextNewWindowNavigationPolicy; +#if ENABLE(PAGE_POPUP) + WebCore::PagePopupDriver* m_pagePopupDriver; +#endif }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp index 149bfe12a..e2c9bb9e2 100755 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.cpp @@ -35,6 +35,7 @@ #include "DOMStringList.h" #include "IDBDatabaseBackendProxy.h" #include "IDBDatabaseError.h" +#include "ScriptExecutionContext.h" #include "SecurityOrigin.h" #include "WebFrameImpl.h" #include "WebIDBCallbacksImpl.h" @@ -72,20 +73,6 @@ IDBFactoryBackendProxy::~IDBFactoryBackendProxy() { } -void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) -{ - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, "Database Listing", origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); - return; - } - - m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); -} - static const char allowIndexedDBMode[] = "allowIndexedDBMode"; class AllowIndexedDBMainThreadBridge : public ThreadSafeRefCounted<AllowIndexedDBMainThreadBridge> { @@ -161,60 +148,80 @@ private: WebWorkerBase* m_webWorkerBase; }; -bool IDBFactoryBackendProxy::allowIDBFromWorkerThread(WorkerContext* workerContext, const String& name, const WebSecurityOrigin&) +bool IDBFactoryBackendProxy::allowIndexedDB(ScriptExecutionContext* context, const String& name, const WebSecurityOrigin& origin, PassRefPtr<IDBCallbacks> callbacks) { + bool allowed; + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + WebFrameImpl* webFrame = WebFrameImpl::fromFrame(document->frame()); + WebViewImpl* webView = webFrame->viewImpl(); + // FIXME: webView->permissionClient() returns 0 in test_shell and content_shell http://crbug.com/137269 + allowed = !webView->permissionClient() || webView->permissionClient()->allowIndexedDB(webFrame, name, origin); + } else { + WorkerContext* workerContext = static_cast<WorkerContext*>(context); + WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); + WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + + String mode = allowIndexedDBMode; + mode.append(String::number(runLoop.createUniqueId())); + RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); + + // Either the bridge returns, or the queue gets terminated. + if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { + bridge->cancel(); + allowed = false; + } else + allowed = bridge->result(); + } - WebWorkerBase* webWorkerBase = static_cast<WebWorkerBase*>(&workerContext->thread()->workerLoaderProxy()); - WorkerRunLoop& runLoop = workerContext->thread()->runLoop(); + if (!allowed) + callbacks->onError(WebIDBDatabaseError(IDBDatabaseException::UNKNOWN_ERR, "The user denied permission to access the database.")); - String mode = allowIndexedDBMode; - mode.append(String::number(runLoop.createUniqueId())); - RefPtr<AllowIndexedDBMainThreadBridge> bridge = AllowIndexedDBMainThreadBridge::create(webWorkerBase, mode, name); + return allowed; +} - // Either the bridge returns, or the queue gets terminated. - if (runLoop.runInMode(workerContext, mode) == MessageQueueTerminated) { - bridge->cancel(); - return false; +static WebFrameImpl* getWebFrame(ScriptExecutionContext* context) +{ + ASSERT(context->isDocument() || context->isWorkerContext()); + if (context->isDocument()) { + Document* document = static_cast<Document*>(context); + return WebFrameImpl::fromFrame(document->frame()); } - - return bridge->result(); + return 0; } -void IDBFactoryBackendProxy::openFromWorker(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, WorkerContext* context, const String& dataDir) +void IDBFactoryBackendProxy::getDatabaseNames(PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { -#if ENABLE(WORKERS) - WebSecurityOrigin origin(prpOrigin); - if (!allowIDBFromWorkerThread(context, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, "Database Listing", origin, callbacks)) return; - } - m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, /*webFrame*/0, dataDir); -#endif + + WebFrameImpl* webFrame = getWebFrame(context); + m_webIDBFactory->getDatabaseNames(new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::open(const String& name, IDBCallbacks* callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) + +void IDBFactoryBackendProxy::open(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, name, origin, callbacks)) return; - } + WebFrameImpl* webFrame = getWebFrame(context); m_webIDBFactory->open(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } -void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> callbacks, PassRefPtr<SecurityOrigin> prpOrigin, Frame* frame, const String& dataDir) +void IDBFactoryBackendProxy::deleteDatabase(const String& name, PassRefPtr<IDBCallbacks> prpCallbacks, PassRefPtr<SecurityOrigin> securityOrigin, ScriptExecutionContext* context, const String& dataDir) { - WebSecurityOrigin origin(prpOrigin); - WebFrameImpl* webFrame = WebFrameImpl::fromFrame(frame); - WebViewImpl* webView = webFrame->viewImpl(); - if (webView->permissionClient() && !webView->permissionClient()->allowIndexedDB(webFrame, name, origin)) { - callbacks->onError(WebIDBDatabaseError(0, "The user denied permission to access the database.")); + RefPtr<IDBCallbacks> callbacks(prpCallbacks); + WebSecurityOrigin origin(securityOrigin); + if (!allowIndexedDB(context, name, origin, callbacks)) return; - } + WebFrameImpl* webFrame = getWebFrame(context); m_webIDBFactory->deleteDatabase(name, new WebIDBCallbacksImpl(callbacks), origin, webFrame, dataDir); } diff --git a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h index c07db3556..22a6f52a8 100644 --- a/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBFactoryBackendProxy.h @@ -31,10 +31,11 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBCallbacks.h" #include "IDBFactoryBackendInterface.h" namespace WebCore { -class WorkerContext; +class ScriptExecutionContext; } namespace WebKit { @@ -47,16 +48,13 @@ public: static PassRefPtr<WebCore::IDBFactoryBackendInterface> create(); virtual ~IDBFactoryBackendProxy(); - virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); - - virtual void open(const String& name, WebCore::IDBCallbacks*, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); - virtual void openFromWorker(const String& name, WebCore::IDBCallbacks*, PassRefPtr<WebCore::SecurityOrigin>, WebCore::WorkerContext*, const String& dataDir); - - virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::Frame*, const String& dataDir); + virtual void getDatabaseNames(PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void open(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); + virtual void deleteDatabase(const String& name, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::SecurityOrigin>, WebCore::ScriptExecutionContext*, const String& dataDir); private: IDBFactoryBackendProxy(); - bool allowIDBFromWorkerThread(WebCore::WorkerContext*, const String& name, const WebSecurityOrigin&); + bool allowIndexedDB(WebCore::ScriptExecutionContext*, const String& name, const WebSecurityOrigin&, PassRefPtr<WebCore::IDBCallbacks>); // We don't own this pointer (unlike all the other proxy classes which do). WebIDBFactory* m_webIDBFactory; diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 7e9539376..899315d29 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -157,7 +157,9 @@ WebScrollableLayer NonCompositedContentHost::scrollLayer() void NonCompositedContentHost::invalidateRect(const WebCore::IntRect& rect) { - m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(rect)); + WebCore::IntRect layerRect = rect; + layerRect.move(-m_layerAdjust); + m_graphicsLayer->setNeedsDisplayInRect(WebCore::FloatRect(layerRect)); } void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLayer*, double /* time */) diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 163862e19..76e30b52f 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -44,112 +44,113 @@ public: explicit WebSettingsImpl(WebCore::Settings*); virtual ~WebSettingsImpl() { } - virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual bool deviceSupportsTouch(); + virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } + virtual bool scrollAnimatorEnabled() const; + virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setAccelerated2dCanvasEnabled(bool); + virtual void setAcceleratedCompositingEnabled(bool); + virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); + virtual void setAcceleratedCompositingForAnimationEnabled(bool); + virtual void setAcceleratedCompositingForCanvasEnabled(bool); + virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); + virtual void setAcceleratedCompositingForPluginsEnabled(bool); + virtual void setAcceleratedCompositingForVideoEnabled(bool); + virtual void setAcceleratedFiltersEnabled(bool); + virtual void setAcceleratedPaintingEnabled(bool); + virtual void setAllowDisplayOfInsecureContent(bool); + virtual void setAllowFileAccessFromFileURLs(bool); + virtual void setAllowRunningOfInsecureContent(bool); + virtual void setAllowScriptsToCloseWindows(bool); + virtual void setAllowUniversalAccessFromFileURLs(bool); + virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); + virtual void setAsynchronousSpellCheckingEnabled(bool); + virtual void setAuthorAndUserStylesEnabled(bool); + virtual void setCaretBrowsingEnabled(bool); + virtual void setCookieEnabled(bool); virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); - virtual void setDefaultFontSize(int); + virtual void setDNSPrefetchingEnabled(bool); + virtual void setDOMPasteAllowed(bool); virtual void setDefaultFixedFontSize(int); - virtual void setMinimumFontSize(int); - virtual void setMinimumLogicalFontSize(int); - virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); - virtual void setTextAutosizingEnabled(bool); + virtual void setDefaultFontSize(int); virtual void setDefaultTextEncodingName(const WebString&); - virtual void setDeviceSupportsTouch(bool); - virtual void setDeviceSupportsMouse(bool); - virtual bool deviceSupportsTouch(); - virtual void setJavaScriptEnabled(bool); - virtual void setWebSecurityEnabled(bool); - virtual void setJavaScriptCanOpenWindowsAutomatically(bool); - virtual void setLoadsImagesAutomatically(bool); - virtual void setImagesEnabled(bool); - virtual void setPluginsEnabled(bool); - virtual void setDOMPasteAllowed(bool); + virtual void setDefaultTileSize(WebSize); + virtual void setDeferred2dCanvasEnabled(bool); virtual void setDeveloperExtrasEnabled(bool); - virtual void setNeedsSiteSpecificQuirks(bool); - virtual void setShrinksStandaloneImagesToFit(bool); - virtual void setUsesEncodingDetector(bool); - virtual void setTextAreasAreResizable(bool); - virtual void setJavaEnabled(bool); - virtual void setAllowScriptsToCloseWindows(bool); - virtual void setUserStyleSheetLocation(const WebURL&); - virtual void setAuthorAndUserStylesEnabled(bool); - virtual void setUsesPageCache(bool); - virtual void setPageCacheSupportsPlugins(bool); + virtual void setDeviceSupportsMouse(bool); + virtual void setDeviceSupportsTouch(bool); virtual void setDownloadableBinaryFontsEnabled(bool); - virtual void setJavaScriptCanAccessClipboard(bool); - virtual void setXSSAuditorEnabled(bool); - virtual void setDNSPrefetchingEnabled(bool); - virtual void setFixedElementsLayoutRelativeToFrame(bool); - virtual void setLocalStorageEnabled(bool); virtual void setEditableLinkBehaviorNeverLive(); - virtual void setFrameFlatteningEnabled(bool); - virtual void setFontRenderingModeNormal(); - virtual void setAllowUniversalAccessFromFileURLs(bool); - virtual void setAllowFileAccessFromFileURLs(bool); - virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); - virtual void setOfflineWebApplicationCacheEnabled(bool); - virtual void setWebAudioEnabled(bool); - virtual void setExperimentalWebGLEnabled(bool); - virtual void setExperimentalCSSRegionsEnabled(bool); - virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setEditingBehavior(EditingBehavior); + virtual void setEnableScrollAnimator(bool); virtual void setExperimentalCSSCustomFilterEnabled(bool); + virtual void setExperimentalCSSGridLayoutEnabled(bool); + virtual void setExperimentalCSSRegionsEnabled(bool); virtual void setExperimentalCSSVariablesEnabled(bool); - virtual void setOpenGLMultisamplingEnabled(bool); - virtual void setPrivilegedWebGLExtensionsEnabled(bool); - virtual void setWebGLErrorsToConsoleEnabled(bool); - virtual void setShowDebugBorders(bool); - virtual void setShowFPSCounter(bool); - virtual void setShowPlatformLayerTree(bool); - virtual void setShowPaintRects(bool); - virtual void setDefaultTileSize(WebSize); - virtual void setMaxUntiledLayerSize(WebSize); - virtual void setEditingBehavior(EditingBehavior); - virtual void setAcceleratedCompositingEnabled(bool); + virtual void setExperimentalWebGLEnabled(bool); + virtual void setFantasyFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setFixedElementsLayoutRelativeToFrame(bool); + virtual void setFixedFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setFixedPositionCreatesStackingContext(bool); + virtual void setFontRenderingModeNormal(); virtual void setForceCompositingMode(bool); virtual void setForceSoftwareCompositing(bool); - virtual void setMockScrollbarsEnabled(bool); - virtual void setAcceleratedCompositingFor3DTransformsEnabled(bool); - virtual void setAcceleratedCompositingForVideoEnabled(bool); - virtual void setAcceleratedCompositingForPluginsEnabled(bool); - virtual void setAcceleratedCompositingForCanvasEnabled(bool); - virtual void setAcceleratedCompositingForAnimationEnabled(bool); - virtual void setAccelerated2dCanvasEnabled(bool); - virtual void setDeferred2dCanvasEnabled(bool); - virtual void setAcceleratedCompositingForFixedPositionEnabled(bool); - virtual void setMinimumAccelerated2dCanvasSize(int); - virtual void setAcceleratedFiltersEnabled(bool); - virtual void setMemoryInfoEnabled(bool); + virtual void setFrameFlatteningEnabled(bool); + virtual void setFullScreenEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); - virtual void setLayoutFallbackWidth(int); - virtual void setAsynchronousSpellCheckingEnabled(bool); - virtual void setUnifiedTextCheckerEnabled(bool); - virtual void setCaretBrowsingEnabled(bool); + virtual void setImagesEnabled(bool); virtual void setInteractiveFormValidationEnabled(bool); - virtual void setValidationMessageTimerMagnification(int); + virtual void setJavaEnabled(bool); + virtual void setJavaScriptCanAccessClipboard(bool); + virtual void setJavaScriptCanOpenWindowsAutomatically(bool); + virtual void setJavaScriptEnabled(bool); + virtual void setLayoutFallbackWidth(int); + virtual void setLoadsImagesAutomatically(bool); + virtual void setLocalStorageEnabled(bool); + virtual void setMaxUntiledLayerSize(WebSize); + virtual void setMediaPlaybackRequiresUserGesture(bool); + virtual void setMemoryInfoEnabled(bool); + virtual void setMinimumAccelerated2dCanvasSize(int); + virtual void setMinimumFontSize(int); + virtual void setMinimumLogicalFontSize(int); virtual void setMinimumTimerInterval(double); - virtual void setFullScreenEnabled(bool); - virtual void setAllowDisplayOfInsecureContent(bool); - virtual void setAllowRunningOfInsecureContent(bool); - virtual void setPasswordEchoEnabled(bool); + virtual void setMockScrollbarsEnabled(bool); + virtual void setNeedsSiteSpecificQuirks(bool); + virtual void setOfflineWebApplicationCacheEnabled(bool); + virtual void setOpenGLMultisamplingEnabled(bool); + virtual void setPageCacheSupportsPlugins(bool); virtual void setPasswordEchoDurationInSeconds(double); - virtual void setShouldPrintBackgrounds(bool); - virtual void setEnableScrollAnimator(bool); - virtual bool scrollAnimatorEnabled() const; - virtual void setVisualWordMovementEnabled(bool); - virtual void setShouldDisplaySubtitles(bool); + virtual void setPasswordEchoEnabled(bool); + virtual void setPictographFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setPluginsEnabled(bool); + virtual void setPrivilegedWebGLExtensionsEnabled(bool); + virtual void setSansSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); + virtual void setSerifFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setShouldDisplayCaptions(bool); + virtual void setShouldDisplaySubtitles(bool); virtual void setShouldDisplayTextDescriptions(bool); - virtual void setAcceleratedPaintingEnabled(bool); - virtual void setFixedPositionCreatesStackingContext(bool); - virtual void setViewportEnabled(bool); - virtual void setMediaPlaybackRequiresUserGesture(bool); - virtual bool viewportEnabled() const { return m_viewportEnabled; } + virtual void setShouldPrintBackgrounds(bool); + virtual void setShowDebugBorders(bool); + virtual void setShowFPSCounter(bool); + virtual void setShowPaintRects(bool); + virtual void setShowPlatformLayerTree(bool); + virtual void setShrinksStandaloneImagesToFit(bool); + virtual void setStandardFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); virtual void setSyncXHRInDocumentsEnabled(bool); - virtual void setCookieEnabled(bool); + virtual void setTextAreasAreResizable(bool); + virtual void setTextAutosizingEnabled(bool); + virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded(); + virtual void setUnifiedTextCheckerEnabled(bool); + virtual void setUserStyleSheetLocation(const WebURL&); + virtual void setUsesEncodingDetector(bool); + virtual void setUsesPageCache(bool); + virtual void setValidationMessageTimerMagnification(int); + virtual void setViewportEnabled(bool); + virtual void setVisualWordMovementEnabled(bool); + virtual void setWebAudioEnabled(bool); + virtual void setWebGLErrorsToConsoleEnabled(bool); + virtual void setWebSecurityEnabled(bool); + virtual void setXSSAuditorEnabled(bool); bool showFPSCounter() const { return m_showFPSCounter; } bool showPlatformLayerTree() const { return m_showPlatformLayerTree; } @@ -157,7 +158,6 @@ public: bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } - virtual bool forceSoftwareCompositing() const { return m_forceSoftwareCompositing; } private: WebCore::Settings* m_settings; diff --git a/Source/WebKit/chromium/src/WebSurroundingText.cpp b/Source/WebKit/chromium/src/WebSurroundingText.cpp index f880676ae..45db3d1bd 100644 --- a/Source/WebKit/chromium/src/WebSurroundingText.cpp +++ b/Source/WebKit/chromium/src/WebSurroundingText.cpp @@ -40,15 +40,6 @@ using namespace WebCore; namespace WebKit { -void WebSurroundingText::initialize(const WebHitTestResult& hitTestResult, size_t maxLength) -{ - Node* node = hitTestResult.node().unwrap<Node>(); - if (!node || !node->renderer()) - return; - - m_private.reset(new SurroundingText(VisiblePosition(node->renderer()->positionForPoint(static_cast<IntPoint>(hitTestResult.localPoint()))), maxLength)); -} - void WebSurroundingText::initialize(const WebNode& webNode, const WebPoint& nodePoint, size_t maxLength) { const Node* node = webNode.constUnwrap<Node>(); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index dd3315ff9..721bfc1d6 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -2796,15 +2796,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( const WebDragData& webDragData, const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - return dragTargetDragEnter(webDragData, clientPoint, screenPoint, operationsAllowed, 0); -} - -WebDragOperation WebViewImpl::dragTargetDragEnter( - const WebDragData& webDragData, - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) { @@ -2819,14 +2810,6 @@ WebDragOperation WebViewImpl::dragTargetDragEnter( WebDragOperation WebViewImpl::dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed) -{ - return dragTargetDragOver(clientPoint, screenPoint, operationsAllowed, 0); -} - -WebDragOperation WebViewImpl::dragTargetDragOver( - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers) { @@ -2854,12 +2837,6 @@ void WebViewImpl::dragTargetDragLeave() } void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, - const WebPoint& screenPoint) -{ - dragTargetDrop(clientPoint, screenPoint, 0); -} - -void WebViewImpl::dragTargetDrop(const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers) { diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index f657504f2..4596dcafc 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -52,6 +52,7 @@ #include "IntRect.h" #include "NotificationPresenterImpl.h" #include "PageOverlayList.h" +#include "PagePopupDriver.h" #include "PageWidgetDelegate.h" #include "PlatformGestureCurveTarget.h" #include "UserMediaClientImpl.h" @@ -112,7 +113,14 @@ class WebMouseWheelEvent; class WebSettingsImpl; class WebTouchEvent; -class WebViewImpl : public WebView, public WebLayerTreeViewClient, public RefCounted<WebViewImpl>, public WebCore::PlatformGestureCurveTarget, public PageWidgetEventHandler { +class WebViewImpl : public WebView + , public WebLayerTreeViewClient + , public RefCounted<WebViewImpl> + , public WebCore::PlatformGestureCurveTarget +#if ENABLE(PAGE_POPUP) + , public WebCore::PagePopupDriver +#endif + , public PageWidgetEventHandler { public: enum AutoZoomType { DoubleTap, @@ -239,28 +247,16 @@ public: const WebDragData&, const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragEnter( - const WebDragData&, - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers); virtual WebDragOperation dragTargetDragOver( const WebPoint& clientPoint, const WebPoint& screenPoint, - WebDragOperationsMask operationsAllowed); - virtual WebDragOperation dragTargetDragOver( - const WebPoint& clientPoint, - const WebPoint& screenPoint, WebDragOperationsMask operationsAllowed, int keyModifiers); virtual void dragTargetDragLeave(); virtual void dragTargetDrop( const WebPoint& clientPoint, - const WebPoint& screenPoint); - virtual void dragTargetDrop( - const WebPoint& clientPoint, const WebPoint& screenPoint, int keyModifiers); virtual unsigned long createUniqueIdentifierForRequest(); @@ -491,8 +487,9 @@ public: void popupOpened(WebCore::PopupContainer* popupContainer); void popupClosed(WebCore::PopupContainer* popupContainer); #if ENABLE(PAGE_POPUP) - WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView); - void closePagePopup(WebCore::PagePopup*); + // PagePopupDriver functions. + virtual WebCore::PagePopup* openPagePopup(WebCore::PagePopupClient*, const WebCore::IntRect& originBoundsInRootView) OVERRIDE; + virtual void closePagePopup(WebCore::PagePopup*) OVERRIDE; #endif void hideAutofillPopup(); diff --git a/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png Binary files differdeleted file mode 100644 index b5a780f36..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarBackgroundChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png Binary files differdeleted file mode 100644 index 531a3efe7..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarBottomBackgroundChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png Binary files differdeleted file mode 100644 index 136d5a8be..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarButtonsChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png Binary files differdeleted file mode 100644 index c8fbd454f..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png b/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png Binary files differdeleted file mode 100644 index 668070d9b..000000000 --- a/Source/WebKit/chromium/src/js/Images/statusbarMenuButtonSelectedChromium.png +++ /dev/null diff --git a/Source/WebKit/chromium/src/js/devTools.css b/Source/WebKit/chromium/src/js/devTools.css index 3d1183404..c7aa9420d 100644 --- a/Source/WebKit/chromium/src/js/devTools.css +++ b/Source/WebKit/chromium/src/js/devTools.css @@ -80,28 +80,8 @@ body.platform-linux #scripts-files { -webkit-border-image: url(Images/segmentHoverEndChromium.png) 0 2 0 2; } -body.drawer-visible #main-status-bar { - background-image: url(Images/statusbarResizerVertical.png), url(Images/statusbarBackgroundChromium.png); -} - .status-bar { - background-image: url(Images/statusbarBackgroundChromium.png); -} - -button.status-bar-item { - background-image: url(Images/statusbarButtonsChromium.png); -} - -select.status-bar-item:active { - -webkit-border-image: url(Images/statusbarMenuButtonSelectedChromium.png) 0 17 0 2; -} - -#drawer { - background-image: url(Images/statusbarBottomBackgroundChromium.png); -} - -select.status-bar-item { - -webkit-border-image: url(Images/statusbarMenuButtonChromium.png) 0 17 0 2; + background-image: -webkit-linear-gradient(rgb(243,243,243), rgb(235,235,235)); } .scope-bar li.selected { diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index f719f2d5e..e1b94a640 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -34,7 +34,7 @@ #include "WebInputEvent.h" #include <wtf/ASCIICType.h> -#if BUILDING_ON_LEOPARD || BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 // Additional Lion APIs. enum { @@ -53,9 +53,11 @@ typedef NSUInteger NSEventPhase; - (NSEventPhase)momentumPhase; @end -#endif // BUILDING_ON_LEOPARD || BUILDING_ON_SNOW_LEOPARD +#endif // __MAC_OS_X_VERSION_MAX_ALLOWED < 1070 -#if BUILDING_ON_LEOPARD +// Do not __MAC_OS_X_VERSION_MAX_ALLOWED here because of a bug in the 10.5 SDK, +// see <http://lists.webkit.org/pipermail/webkit-dev/2012-July/021442.html>. +#if MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 // These are not defined in the 10.5 SDK but are defined in later SDKs inside // a MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_5 #ifdef. @@ -64,7 +66,7 @@ enum { NSEventTypeEndGesture = 20 }; -#endif // BUILDING_ON_LEOPARD +#endif // MAC_OS_X_VERSION_MAX_ALLOWED <= 1050 namespace WebKit { diff --git a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp index 03559f7f1..7051bf9d6 100644 --- a/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp +++ b/Source/WebKit/chromium/tests/AssociatedURLLoaderTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebURLLoaderOptions.h" @@ -42,11 +43,11 @@ #include "platform/WebURLResponse.h" #include <wtf/text/WTFString.h> -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -76,9 +77,9 @@ public: , m_runningMessageLoop(false) { // Reuse one of the test files from WebFrameTest. - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); + std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data()); filePath += "/Source/WebKit/chromium/tests/data/iframes_test.html"; - m_frameFilePath = WebString::fromUTF8(filePath); + m_frameFilePath = WebString::fromUTF8(filePath.c_str()); } void SetUp() @@ -87,7 +88,7 @@ public: m_webView->initializeMainFrame(&m_webFrameClient); // Load the frame before trying to load resources. - GURL url = GURL("http://www.test.com/iframes_test.html"); + WebCore::KURL url = toKURL("http://www.test.com/iframes_test.html"); WebURLResponse response; response.initialize(); response.setMIMEType("text/html"); @@ -184,7 +185,7 @@ public: { WebURLRequest request; request.initialize(); - request.setURL(GURL("http://www.test.com/success.html")); + request.setURL(toKURL("http://www.test.com/success.html")); request.setHTTPMethod(WebString::fromUTF8(unsafeMethod)); WebURLLoaderOptions options; options.untrustedHTTP = true; @@ -200,7 +201,7 @@ public: { WebURLRequest request; request.initialize(); - request.setURL(GURL("http://www.test.com/success.html")); + request.setURL(toKURL("http://www.test.com/success.html")); request.setHTTPHeaderField(WebString::fromUTF8(headerField), WebString::fromUTF8(headerValue)); WebURLLoaderOptions options; options.untrustedHTTP = true; @@ -230,7 +231,7 @@ public: id.append("-Exposed"); id.append(".html"); - GURL url = GURL(id); + WebCore::KURL url = toKURL(id); WebURLRequest request; request.initialize(); request.setURL(url); @@ -282,7 +283,7 @@ protected: // Test a successful same-origin URL load. TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) { - GURL url = GURL("http://www.test.com/SameOriginSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/SameOriginSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -305,7 +306,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginSuccess) TEST_F(AssociatedURLLoaderTest, SameOriginRestriction) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/SameOriginRestriction.html"); + WebCore::KURL url = toKURL("http://www.other.com/SameOriginRestriction.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -316,7 +317,7 @@ TEST_F(AssociatedURLLoaderTest, SameOriginRestriction) TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginSuccess.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -341,7 +342,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginSuccess) TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlSuccess.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -367,7 +368,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlSuccess) TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) { // This is cross-origin since the frame was loaded from www.test.com. - GURL url = GURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginWithAccessControlFailure.html"); WebURLRequest request; request.initialize(); request.setURL(url); @@ -398,9 +399,9 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginWithAccessControlFailure) // Test a same-origin URL redirect and load. TEST_F(AssociatedURLLoaderTest, RedirectSuccess) { - GURL url = GURL("http://www.test.com/RedirectSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectSuccess.html"); char redirect[] = "http://www.test.com/RedirectSuccess2.html"; // Same-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -435,9 +436,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectSuccess) // Test that a cross origin redirect response without CORS headers fails. TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) { - GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlFailure.html"); char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlFailure.html"; // Cross-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -467,9 +468,9 @@ TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlFailure) // Test that a cross origin redirect response with CORS headers that allow the requesting origin succeeds. TEST_F(AssociatedURLLoaderTest, RedirectCrossOriginWithAccessControlSuccess) { - GURL url = GURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); + WebCore::KURL url = toKURL("http://www.test.com/RedirectCrossOriginWithAccessControlSuccess.html"); char redirect[] = "http://www.other.com/RedirectCrossOriginWithAccessControlSuccess.html"; // Cross-origin - GURL redirectURL = GURL(redirect); + WebCore::KURL redirectURL = toKURL(redirect); WebURLRequest request; request.initialize(); @@ -590,7 +591,7 @@ TEST_F(AssociatedURLLoaderTest, CrossOriginHeaderAllowResponseHeaders) { WebURLRequest request; request.initialize(); - GURL url = GURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); + WebCore::KURL url = toKURL("http://www.other.com/CrossOriginHeaderAllowResponseHeaders.html"); request.setURL(url); WebString headerNameString(WebString::fromUTF8("non-whitelisted")); diff --git a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp index 262fcf76f..892da4f2f 100644 --- a/Source/WebKit/chromium/tests/CCLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerImplTest.cpp @@ -175,7 +175,7 @@ TEST(CCLayerImplTest, verifyLayerChangesAreTrackedProperly) EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setScreenSpaceTransform(arbitraryTransform)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setDrawableContentRect(arbitraryIntRect)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setUpdateRect(arbitraryFloatRect)); - EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleLayerRect(arbitraryIntRect)); + EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setVisibleContentRect(arbitraryIntRect)); EXECUTE_AND_VERIFY_SUBTREE_DID_NOT_CHANGE(root->setMaxScrollPosition(arbitraryIntSize)); } diff --git a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp index b35819759..6cc4d2c39 100644 --- a/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTestCommon.cpp @@ -43,10 +43,11 @@ void verifyQuadsExactlyCoverRect(const CCQuadList& quads, const IntRect& rect) for (size_t i = 0; i < quads.size(); ++i) { CCDrawQuad* quad = quads[i].get(); + IntRect quadRect = quad->quadRect(); - EXPECT_TRUE(rect.contains(quad->quadRect())) << quadString << i; - EXPECT_TRUE(remaining.contains(quad->quadRect())) << quadString << i; - remaining.subtract(Region(quad->quadRect())); + EXPECT_TRUE(rect.contains(quadRect)) << quadString << i; + EXPECT_TRUE(remaining.contains(quadRect)) << quadString << i; + remaining.subtract(Region(quadRect)); } EXPECT_TRUE(remaining.isEmpty()); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp index 73f1eb974..54409514c 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostCommonTest.cpp @@ -2844,13 +2844,13 @@ TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithAnimatingTransforms) EXPECT_EQ(animatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[0]->id()); EXPECT_EQ(childOfAnimatingSurface->id(), renderSurfaceLayerList[1]->renderSurface()->layerList()[1]->id()); - EXPECT_FALSE(child2->visibleLayerRect().isEmpty()); + EXPECT_FALSE(child2->visibleContentRect().isEmpty()); - // The animating layers should have a visibleLayerRect that represents the area of the front face that is within the viewport. - EXPECT_EQ(animatingChild->visibleLayerRect(), IntRect(IntPoint(), animatingChild->contentBounds())); - EXPECT_EQ(animatingSurface->visibleLayerRect(), IntRect(IntPoint(), animatingSurface->contentBounds())); - // And layers in the subtree of the animating layer should have valid visibleLayerRects also. - EXPECT_EQ(childOfAnimatingSurface->visibleLayerRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); + // The animating layers should have a visibleContentRect that represents the area of the front face that is within the viewport. + EXPECT_EQ(animatingChild->visibleContentRect(), IntRect(IntPoint(), animatingChild->contentBounds())); + EXPECT_EQ(animatingSurface->visibleContentRect(), IntRect(IntPoint(), animatingSurface->contentBounds())); + // And layers in the subtree of the animating layer should have valid visibleContentRects also. + EXPECT_EQ(childOfAnimatingSurface->visibleContentRect(), IntRect(IntPoint(), childOfAnimatingSurface->contentBounds())); } TEST(CCLayerTreeHostCommonTest, verifyBackFaceCullingWithPreserves3dForFlatteningSurface) @@ -3208,7 +3208,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSinglePerspectiveLayer) TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents) { - // A layer's visibleLayerRect is actually in the layer's content space. The + // A layer's visibleContentRect is actually in the layer's content space. The // screenSpaceTransform converts from the layer's origin space to screen space. This // test makes sure that hit testing works correctly accounts for the contents scale. // A contentsScale that is not 1 effectively forces a non-identity transform between @@ -3216,7 +3216,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents // screenSpaceTransformn. The hit testing code must take this into account. // // To test this, the layer is positioned at (25, 25), and is size (50, 50). If - // contentsScale is ignored, then hit testing will mis-interpret the visibleLayerRect + // contentsScale is ignored, then hit testing will mis-interpret the visibleContentRect // as being larger than the actual bounds of the layer. // DebugScopedSetImplThread thisScopeIsOnImplThread; @@ -3242,8 +3242,8 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForSingleLayerWithScaledContents CCLayerTreeHostCommon::calculateVisibleAndScissorRects(renderSurfaceLayerList, FloatRect()); // empty scissorRect will help ensure we're hit testing the correct rect. // Sanity check the scenario we just created. - // The visibleLayerRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. - EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleLayerRect()); + // The visibleContentRect is actually 100x100, even though the layout size of the layer is 50x50, positioned at 25x25. + EXPECT_INT_RECT_EQ(IntRect(IntPoint::zero(), IntSize(100, 100)), root->visibleContentRect()); ASSERT_EQ(1u, renderSurfaceLayerList.size()); ASSERT_EQ(1u, root->renderSurface()->layerList().size()); @@ -3418,7 +3418,7 @@ TEST(CCLayerTreeHostCommonTest, verifyHitTestingForMultiClippedRotatedLayer) // (4, 50) is inside the unclipped layer, but that corner of the layer should be // clipped away by the grandParent and should not get hit. If hit testing blindly uses - // visibleLayerRect without considering how parent may clip the layer, then hit + // visibleContentRect without considering how parent may clip the layer, then hit // testing would accidentally think that the point successfully hits the layer. testPoint = IntPoint(4, 50); resultLayer = CCLayerTreeHostCommon::findLayerThatIsHitByPoint(testPoint, renderSurfaceLayerList); diff --git a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp index fbede6ced..cb2b7f36f 100644 --- a/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCLayerTreeHostImplTest.cpp @@ -31,7 +31,6 @@ #include "CCTestCommon.h" #include "FakeWebGraphicsContext3D.h" #include "LayerRendererChromium.h" -#include "ManagedTexture.h" #include "cc/CCIOSurfaceLayerImpl.h" #include "cc/CCLayerImpl.h" #include "cc/CCLayerTilingData.h" @@ -70,6 +69,8 @@ public: , m_didRequestRedraw(false) { CCLayerTreeSettings settings; + settings.minimumOcclusionTrackingSize = IntSize(); + m_hostImpl = CCLayerTreeHostImpl::create(settings, this); m_hostImpl->initializeLayerRenderer(createContext(), UnthrottledUploader); m_hostImpl->setViewportSize(IntSize(10, 10)); @@ -86,6 +87,8 @@ public: CCSettings::setPartialSwapEnabled(partialSwap); CCLayerTreeSettings settings; + settings.minimumOcclusionTrackingSize = IntSize(); + OwnPtr<CCLayerTreeHostImpl> myHostImpl = CCLayerTreeHostImpl::create(settings, this); myHostImpl->initializeLayerRenderer(graphicsContext, UnthrottledUploader); @@ -97,7 +100,7 @@ public: root->setPosition(FloatPoint(0, 0)); root->setBounds(IntSize(10, 10)); root->setContentBounds(IntSize(10, 10)); - root->setVisibleLayerRect(IntRect(0, 0, 10, 10)); + root->setVisibleContentRect(IntRect(0, 0, 10, 10)); root->setDrawsContent(true); myHostImpl->setRootLayer(root.release()); return myHostImpl.release(); @@ -625,7 +628,7 @@ protected: setContentBounds(IntSize(10, 10)); setDrawsContent(true); setSkipsDraw(false); - setVisibleLayerRect(IntRect(0, 0, 10, 10)); + setVisibleContentRect(IntRect(0, 0, 10, 10)); OwnPtr<CCLayerTilingData> tiler = CCLayerTilingData::create(IntSize(100, 100), CCLayerTilingData::HasBorderTexels); tiler->setBounds(contentBounds()); @@ -647,7 +650,7 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) root->addChild(DidDrawCheckLayer::create(2)); DidDrawCheckLayer* layer = static_cast<DidDrawCheckLayer*>(root->children()[0].get()); - // Ensure visibleLayerRect for layer is empty + // Ensure visibleContentRect for layer is empty layer->setPosition(FloatPoint(100, 100)); layer->setBounds(IntSize(10, 10)); layer->setContentBounds(IntSize(10, 10)); @@ -664,9 +667,9 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_FALSE(layer->willDrawCalled()); EXPECT_FALSE(layer->didDrawCalled()); - EXPECT_TRUE(layer->visibleLayerRect().isEmpty()); + EXPECT_TRUE(layer->visibleContentRect().isEmpty()); - // Ensure visibleLayerRect for layer layer is not empty + // Ensure visibleContentRect for layer layer is not empty layer->setPosition(FloatPoint(0, 0)); EXPECT_FALSE(layer->willDrawCalled()); @@ -679,12 +682,11 @@ TEST_F(CCLayerTreeHostImplTest, didDrawNotCalledOnHiddenLayer) EXPECT_TRUE(layer->willDrawCalled()); EXPECT_TRUE(layer->didDrawCalled()); - EXPECT_FALSE(layer->visibleLayerRect().isEmpty()); + EXPECT_FALSE(layer->visibleContentRect().isEmpty()); } TEST_F(CCLayerTreeHostImplTest, willDrawNotCalledOnOccludedLayer) { - // Make the viewport large so that we can have large layers that get considered for occlusion (small layers do not). IntSize bigSize(1000, 1000); m_hostImpl->setViewportSize(bigSize); @@ -1184,10 +1186,8 @@ private: IntRect m_quadVisibleRect; }; -// https://bugs.webkit.org/show_bug.cgi?id=75783 TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) { - { OwnPtr<CCLayerImpl> root = CCLayerImpl::create(1); root->setAnchorPoint(FloatPoint(0, 0)); @@ -1200,6 +1200,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) root->addChild(BlendStateCheckLayer::create(2)); BlendStateCheckLayer* layer1 = static_cast<BlendStateCheckLayer*>(root->children()[0].get()); + layer1->setPosition(FloatPoint(2, 2)); CCLayerTreeHostImpl::FrameData frame; @@ -1252,6 +1253,7 @@ TEST_F(CCLayerTreeHostImplTest, blendingOffWhenDrawingOpaqueLayers) layer1->addChild(BlendStateCheckLayer::create(3)); BlendStateCheckLayer* layer2 = static_cast<BlendStateCheckLayer*>(layer1->children()[0].get()); + layer2->setPosition(FloatPoint(4, 4)); // 2 opaque layers, drawn without blending. layer1->setOpaque(true); @@ -1626,6 +1628,28 @@ TEST_F(CCLayerTreeHostImplTest, partialSwapReceivesDamageRect) EXPECT_EQ(expectedSwapRect.height(), actualSwapRect.height()); } +TEST_F(CCLayerTreeHostImplTest, rootLayerDoesntCreateExtraSurface) +{ + CCLayerImpl* root = new FakeDrawableCCLayerImpl(1); + CCLayerImpl* child = new FakeDrawableCCLayerImpl(2); + child->setAnchorPoint(FloatPoint(0, 0)); + child->setBounds(IntSize(10, 10)); + child->setDrawsContent(true); + root->setAnchorPoint(FloatPoint(0, 0)); + root->setBounds(IntSize(10, 10)); + root->setDrawsContent(true); + root->setOpacity(0.7f); + root->addChild(adoptPtr(child)); + + m_hostImpl->setRootLayer(adoptPtr(root)); + + CCLayerTreeHostImpl::FrameData frame; + + EXPECT_TRUE(m_hostImpl->prepareToDraw(frame)); + EXPECT_EQ(1u, frame.renderSurfaceLayerList->size()); + EXPECT_EQ(1u, frame.renderPasses.size()); +} + } // namespace class FakeLayerWithQuads : public CCLayerImpl { @@ -1855,7 +1879,7 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C root->setPosition(FloatPoint(rootRect.x(), rootRect.y())); root->setBounds(IntSize(rootRect.width(), rootRect.height())); root->setContentBounds(root->bounds()); - root->setVisibleLayerRect(rootRect); + root->setVisibleContentRect(rootRect); root->setDrawsContent(false); root->renderSurface()->setContentRect(IntRect(IntPoint(), IntSize(rootRect.width(), rootRect.height()))); @@ -1864,14 +1888,14 @@ static PassOwnPtr<CCLayerTreeHostImpl> setupLayersForOpacity(bool partialSwap, C child->setOpacity(0.5f); child->setBounds(IntSize(childRect.width(), childRect.height())); child->setContentBounds(child->bounds()); - child->setVisibleLayerRect(childRect); + child->setVisibleContentRect(childRect); child->setDrawsContent(false); grandChild->setAnchorPoint(FloatPoint(0, 0)); grandChild->setPosition(IntPoint(grandChildRect.x(), grandChildRect.y())); grandChild->setBounds(IntSize(grandChildRect.width(), grandChildRect.height())); grandChild->setContentBounds(grandChild->bounds()); - grandChild->setVisibleLayerRect(grandChildRect); + grandChild->setVisibleContentRect(grandChildRect); grandChild->setDrawsContent(true); child->addChild(grandChild.release()); @@ -2420,7 +2444,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, root->setPosition(FloatPoint(0, 0)); root->setBounds(rootSize); root->setContentBounds(rootSize); - root->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); + root->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); root->setDrawsContent(true); layerTreeHostImpl->setRootLayer(root.release()); @@ -2432,7 +2456,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, intermediateLayerPtr->setPosition(FloatPoint(10, 10)); intermediateLayerPtr->setBounds(rootSize); intermediateLayerPtr->setContentBounds(rootSize); - intermediateLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), rootSize)); + intermediateLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), rootSize)); intermediateLayerPtr->setDrawsContent(false); // only children draw content rootPtr->addChild(intermediateLayer.release()); @@ -2446,7 +2470,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, surfaceLayerPtr->setPosition(FloatPoint(10, 10)); surfaceLayerPtr->setBounds(surfaceSize); surfaceLayerPtr->setContentBounds(surfaceSize); - surfaceLayerPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), surfaceSize)); + surfaceLayerPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), surfaceSize)); surfaceLayerPtr->setDrawsContent(false); // only children draw content surfaceLayerPtr->setOpacity(0.5f); // This will cause it to have a surface intermediateLayerPtr->addChild(surfaceLayer.release()); @@ -2460,7 +2484,7 @@ static void setupLayersForTextureCaching(CCLayerTreeHostImpl* layerTreeHostImpl, childPtr->setPosition(FloatPoint(5, 5)); childPtr->setBounds(childSize); childPtr->setContentBounds(childSize); - childPtr->setVisibleLayerRect(IntRect(IntPoint(0, 0), childSize)); + childPtr->setVisibleContentRect(IntRect(IntPoint(0, 0), childSize)); childPtr->setDrawsContent(true); surfaceLayerPtr->addChild(child.release()); @@ -2496,7 +2520,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2528,7 +2553,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2548,7 +2574,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2574,10 +2601,11 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(quad->renderPass()->id())); + EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2611,7 +2639,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCaching) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2643,7 +2672,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2676,7 +2706,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2696,7 +2727,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2722,10 +2754,11 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); // Was our surface evicted? - EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(quad->renderPass()->id())); + EXPECT_FALSE(myHostImpl->layerRenderer()->haveCachedResourcesForRenderPassId(targetPass->id())); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2760,7 +2793,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingNoPartialSwap) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2801,7 +2835,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[1]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[1]->quadList()[0].get()); - EXPECT_TRUE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_TRUE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2834,7 +2869,8 @@ TEST_F(CCLayerTreeHostImplTest, surfaceTextureCachingMemoryLimit) EXPECT_EQ(1U, frame.renderPasses[0]->quadList().size()); EXPECT_EQ(CCDrawQuad::RenderPass, frame.renderPasses[0]->quadList()[0]->material()); CCRenderPassDrawQuad* quad = static_cast<CCRenderPassDrawQuad*>(frame.renderPasses[0]->quadList()[0].get()); - EXPECT_FALSE(quad->renderPass()->targetSurface()->contentsChanged()); + CCRenderPass* targetPass = frame.renderPassesById.get(quad->renderPassId()); + EXPECT_FALSE(targetPass->targetSurface()->contentsChanged()); myHostImpl->drawLayers(frame); myHostImpl->didDrawAllLayers(frame); @@ -2877,7 +2913,6 @@ struct RenderPassCacheEntry { struct RenderPassRemovalTestData : public CCLayerTreeHostImpl::FrameData { std::map<char, RenderPassCacheEntry> renderPassCache; - std::map<const CCRenderPass*, char> renderPassId; Vector<OwnPtr<CCRenderSurface> > renderSurfaceStore; Vector<OwnPtr<CCLayerImpl> > layerStore; OwnPtr<CCSharedQuadState> sharedQuadState; @@ -2943,14 +2978,13 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova renderer->clearCachedTextures(); // One shared state for all quads - we don't need the correct details - testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); + testData.sharedQuadState = CCSharedQuadState::create(WebTransformationMatrix(), IntRect(), IntRect(), 1.0, true); const char* currentChar = testScript; // Pre-create root pass char rootRenderPassId = testScript[0]; OwnPtr<CCRenderPass> rootRenderPass = createDummyRenderPass(testData, rootRenderPassId); - testData.renderPassId.insert(std::pair<CCRenderPass*, char>(rootRenderPass.get(), rootRenderPassId)); testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(rootRenderPassId, RenderPassCacheEntry(rootRenderPass.release()))); while (*currentChar) { char renderPassId = currentChar[0]; @@ -2997,26 +3031,22 @@ static void configureRenderPassTestData(const char* testScript, RenderPassRemova currentChar++; } - CCRenderPass* refRenderPassPtr; - if (testData.renderPassCache.find(newRenderPassId) == testData.renderPassCache.end()) { if (hasTexture) renderer->setHaveCachedResourcesForRenderPassId(newRenderPassId); - OwnPtr<CCRenderPass> refRenderPass = createDummyRenderPass(testData, newRenderPassId); - refRenderPassPtr = refRenderPass.get(); - testData.renderPassId.insert(std::pair<CCRenderPass*, char>(refRenderPass.get(), newRenderPassId)); - testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(refRenderPass.release()))); - } else - refRenderPassPtr = testData.renderPassCache[newRenderPassId].renderPass; + OwnPtr<CCRenderPass> renderPass = createDummyRenderPass(testData, newRenderPassId); + testData.renderPassCache.insert(std::pair<char, RenderPassCacheEntry>(newRenderPassId, RenderPassCacheEntry(renderPass.release()))); + } IntRect quadRect = IntRect(0, 0, 1, 1); IntRect contentsChangedRect = contentsChanged ? quadRect : IntRect(); - OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, refRenderPassPtr, isReplica, WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); + OwnPtr<CCRenderPassDrawQuad> quad = CCRenderPassDrawQuad::create(testData.sharedQuadState.get(), quadRect, newRenderPassId, isReplica, WebKit::WebTransformationMatrix(), WebKit::WebFilterOperations(), WebKit::WebFilterOperations(), 1, contentsChangedRect); static_cast<CCTestRenderPass*>(renderPass.get())->appendQuad(quad.release()); } } - testData.renderPasses.insert(0, renderPass.release()); + testData.renderPasses.insert(0, renderPass.get()); + testData.renderPassesById.add(renderPassId, renderPass.release()); if (*currentChar) currentChar++; } @@ -3026,9 +3056,8 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf { char* pos = buffer; for (CCRenderPassList::const_reverse_iterator it = testData.renderPasses.rbegin(); it != testData.renderPasses.rend(); ++it) { - CCRenderPass* currentPass = it->get(); - char passId = testData.renderPassId.find(currentPass)->second; - *pos = passId; + const CCRenderPass* currentPass = *it; + *pos = currentPass->id(); pos++; CCQuadList::const_iterator quadListIterator = currentPass->quadList().begin(); @@ -3039,14 +3068,10 @@ void dumpRenderPassTestData(const RenderPassRemovalTestData& testData, char* buf *pos = 's'; pos++; break; - case CCDrawQuad::RenderPass: { - CCRenderPassDrawQuad* renderPassDrawQuad = static_cast<CCRenderPassDrawQuad*>(currentQuad); - const CCRenderPass* refPass = renderPassDrawQuad->renderPass(); - char refPassId = testData.renderPassId.find(refPass)->second; - *pos = refPassId; + case CCDrawQuad::RenderPass: + *pos = CCRenderPassDrawQuad::materialCast(currentQuad)->renderPassId(); pos++; break; - } default: *pos = 'x'; pos++; diff --git a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp index 22ed5a997..f0bfd0ea3 100644 --- a/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp +++ b/Source/WebKit/chromium/tests/CCOcclusionTrackerTest.cpp @@ -62,7 +62,7 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE { if (m_overrideOpaqueContentsRect) - return intersection(m_opaqueContentsRect, visibleLayerRect()); + return intersection(m_opaqueContentsRect, visibleContentRect()); return LayerChromium::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) @@ -88,7 +88,7 @@ public: virtual Region visibleContentOpaqueRegion() const OVERRIDE { if (m_overrideOpaqueContentsRect) - return intersection(m_opaqueContentsRect, visibleLayerRect()); + return intersection(m_opaqueContentsRect, visibleContentRect()); return CCLayerImpl::visibleContentOpaqueRegion(); } void setOpaqueContentsRect(const IntRect& opaqueContentsRect) @@ -759,7 +759,7 @@ protected: // This extends past both sides of child2, so it will be the original rect. EXPECT_INT_RECT_EQ(IntRect(9, 430, 60, 80), occlusion.unoccludedContentRect(child, IntRect(9, 430, 60, 80))); // This extends past two adjacent sides of child2, and should included the unoccluded parts of each side. - // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleLayerRect(). + // This also demonstrates that the rect can be arbitrary and does not get clipped to the layer's visibleContentRect(). EXPECT_INT_RECT_EQ(IntRect(-10, 430, 20, 70), occlusion.unoccludedContentRect(child, IntRect(-10, 430, 60, 70))); // This extends past three adjacent sides of child2, so it should contain the unoccluded parts of each side. The left // and bottom edges are completely unoccluded for some row/column so we get back the original query rect. @@ -869,7 +869,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); occlusion.setLayerScissorRect(IntRect(0, 0, 1000, 1000)); - IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleLayerRect()); + IntRect clippedLayerInChild = CCMathUtil::mapClippedRect(layerTransform, layer->visibleContentRect()); this->visitLayer(layer, occlusion); this->enterContributingSurface(child, occlusion); @@ -2024,7 +2024,7 @@ protected: TestCCOcclusionTrackerWithScissor<typename Types::LayerType, typename Types::RenderSurfaceType> occlusion(IntRect(0, 0, 1000, 1000)); - // This is very close to the camera, so pixels in its visibleLayerRect will actually go outside of the layer's clipRect. + // This is very close to the camera, so pixels in its visibleContentRect will actually go outside of the layer's clipRect. // Ensure that those pixels don't occlude things outside the clipRect. this->visitLayer(layer, occlusion); this->enterLayer(parent, occlusion); diff --git a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp index 468af36bb..21e0a717c 100644 --- a/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp +++ b/Source/WebKit/chromium/tests/CCPrioritizedTextureTest.cpp @@ -28,6 +28,7 @@ #include "CCTiledLayerTestCommon.h" #include "cc/CCPrioritizedTextureManager.h" +#include "cc/CCTexture.h" #include <gtest/gtest.h> using namespace WebCore; @@ -50,7 +51,7 @@ public: size_t texturesMemorySize(size_t textureCount) { - return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; + return CCTexture::memorySizeBytes(m_textureSize, m_textureFormat) * textureCount; } PassOwnPtr<CCPrioritizedTextureManager> createManager(size_t maxTextures) @@ -98,7 +99,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textures[i]->setRequestPriority(100 + i); // Only lower half should be available. - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(textures[0], false)); EXPECT_TRUE(validateTexture(textures[7], false)); EXPECT_FALSE(validateTexture(textures[8], false)); @@ -109,7 +110,7 @@ TEST_F(CCPrioritizedTextureTest, requestTextureExceedingMaxLimit) textures[i]->setRequestPriority(100 - i); // Only upper half should be available. - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_FALSE(validateTexture(textures[0], false)); EXPECT_FALSE(validateTexture(textures[7], false)); EXPECT_TRUE(validateTexture(textures[8], false)); @@ -134,7 +135,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 8 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) validateTexture(textures[i], false); textureManager->reduceMemory(allocator()); @@ -144,7 +145,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 5 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(5)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 5); textureManager->reduceMemory(allocator()); @@ -154,7 +155,7 @@ TEST_F(CCPrioritizedTextureTest, changeMemoryLimits) // Set max limit to 4 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(4)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); for (size_t i = 0; i < maxTextures; ++i) EXPECT_EQ(validateTexture(textures[i], false), i < 4); textureManager->reduceMemory(allocator()); @@ -180,7 +181,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) for (size_t i = 0; i < numTextures; ++i) textures[i]->setRequestPriority(200 + i); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Allocate textures which are currently high priority. EXPECT_TRUE(validateTexture(textures[0], false)); @@ -195,7 +196,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPartialUpdateTextures) for (size_t i = 0; i < numTextures; ++i) moreTextures[i]->setRequestPriority(100 + i); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Textures are now below cutoff. EXPECT_FALSE(validateTexture(textures[0], false)); @@ -241,7 +242,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerPrioritiesAreEqual) // Set max limit to 8 textures textureManager->setMaxMemoryLimitBytes(texturesMemorySize(8)); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // The two high priority textures should be available, others should not. for (size_t i = 0; i < 2; ++i) @@ -272,7 +273,7 @@ TEST_F(CCPrioritizedTextureTest, textureManagerDestroyedFirst) EXPECT_FALSE(texture->haveBackingTexture()); texture->setRequestPriority(100); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -295,7 +296,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) EXPECT_FALSE(texture->haveBackingTexture()); texture->setRequestPriority(100); - textureManagerOne->prioritizeTextures(0); + textureManagerOne->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -311,7 +312,7 @@ TEST_F(CCPrioritizedTextureTest, textureMovedToNewManager) texture->setTextureManager(textureManagerTwo.get()); - textureManagerTwo->prioritizeTextures(0); + textureManagerTwo->prioritizeTextures(); EXPECT_TRUE(validateTexture(texture, false)); EXPECT_TRUE(texture->canAcquireBackingTexture()); @@ -325,8 +326,10 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -339,7 +342,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textures[i]->setRequestPriority(100 + i); // Only lower half should be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); EXPECT_TRUE(validateTexture(textures[0], false)); EXPECT_TRUE(validateTexture(textures[3], false)); EXPECT_FALSE(validateTexture(textures[4], false)); @@ -350,14 +353,14 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableOutsideRootS textures[i]->setRequestPriority(100 - i); // Only upper half should be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); EXPECT_FALSE(validateTexture(textures[0], false)); EXPECT_FALSE(validateTexture(textures[3], false)); EXPECT_TRUE(validateTexture(textures[4], false)); EXPECT_TRUE(validateTexture(textures[7], false)); EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); @@ -368,8 +371,10 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -382,7 +387,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa textures[i]->setRequestPriority(100); // The first four to be requested late will be available. - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); for (unsigned i = 0; i < maxTextures; ++i) EXPECT_FALSE(validateTexture(textures[i], false)); for (unsigned i = 0; i < maxTextures; i += 2) @@ -391,7 +396,7 @@ TEST_F(CCPrioritizedTextureTest, renderSurfacesReduceMemoryAvailableForRequestLa EXPECT_FALSE(validateTexture(textures[i], true)); EXPECT_EQ(texturesMemorySize(4), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(4), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); @@ -402,8 +407,10 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva const size_t maxTextures = 8; OwnPtr<CCPrioritizedTextureManager> textureManager = createManager(maxTextures); - // Half of the memory is taken by surfaces. - const size_t renderSurfacesBytes = texturesMemorySize(4); + // Half of the memory is taken by surfaces (with high priority place-holder) + OwnPtr<CCPrioritizedTexture> renderSurfacePlaceHolder = textureManager->createTexture(m_textureSize, m_textureFormat); + renderSurfacePlaceHolder->setToSelfManagedMemoryPlaceholder(texturesMemorySize(4)); + renderSurfacePlaceHolder->setRequestPriority(CCPriorityCalculator::renderSurfacePriority()); // Create textures to fill our memory limit. OwnPtr<CCPrioritizedTexture> textures[maxTextures]; @@ -417,7 +424,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva for (size_t i = 6; i < 8; ++i) textures[i]->setRequestPriority(CCPriorityCalculator::visiblePriority(false)); - textureManager->prioritizeTextures(renderSurfacesBytes); + textureManager->prioritizeTextures(); // Unable to requestLate textures in the child surface. EXPECT_FALSE(validateTexture(textures[6], true)); @@ -428,7 +435,7 @@ TEST_F(CCPrioritizedTextureTest, whenRenderSurfaceNotAvailableTexturesAlsoNotAva EXPECT_TRUE(validateTexture(textures[i], false)); EXPECT_EQ(texturesMemorySize(6), textureManager->memoryAboveCutoffBytes()); - EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForRenderSurfacesBytes()); + EXPECT_EQ(texturesMemorySize(2), textureManager->memoryForSelfManagedTextures()); EXPECT_LE(textureManager->memoryUseBytes(), textureManager->memoryAboveCutoffBytes()); textureManager->clearAllMemory(allocator()); diff --git a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp index d0d87d252..624d24711 100644 --- a/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp +++ b/Source/WebKit/chromium/tests/CCQuadCullerTest.cpp @@ -67,7 +67,7 @@ static PassOwnPtr<CCTiledLayerImpl> makeLayer(CCTiledLayerImpl* parent, const We layer->setSkipsDraw(false); layer->setDrawTransform(drawTransform); layer->setScreenSpaceTransform(drawTransform); - layer->setVisibleLayerRect(layerRect); + layer->setVisibleContentRect(layerRect); layer->setDrawOpacity(opacity); layer->setOpaque(opaque); diff --git a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp index b65e6e72b..e9e041749 100644 --- a/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp +++ b/Source/WebKit/chromium/tests/CCRenderSurfaceTest.cpp @@ -102,12 +102,10 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) IntRect contentRect = IntRect(IntPoint::zero(), IntSize(50, 50)); IntRect clipRect = IntRect(IntPoint(5, 5), IntSize(40, 40)); - WebTransformationMatrix draw; WebTransformationMatrix origin; - draw.translate(30, 40); + origin.translate(30, 40); - renderSurface->setDrawTransform(draw); renderSurface->setOriginTransform(origin); renderSurface->setContentRect(contentRect); renderSurface->setClipRect(clipRect); @@ -116,13 +114,12 @@ TEST(CCRenderSurfaceTest, sanityCheckSurfaceCreatesCorrectSharedQuadState) OwnPtr<CCSharedQuadState> sharedQuadState = renderSurface->createSharedQuadState(); - EXPECT_TRUE(sharedQuadState->quadTransform().isIdentity()); - EXPECT_EQ(30, sharedQuadState->layerTransform().m41()); - EXPECT_EQ(40, sharedQuadState->layerTransform().m42()); - EXPECT_EQ(contentRect, sharedQuadState->layerRect()); - EXPECT_EQ(clipRect, sharedQuadState->scissorRect()); - EXPECT_EQ(1, sharedQuadState->opacity()); - EXPECT_FALSE(sharedQuadState->isOpaque()); + EXPECT_EQ(30, sharedQuadState->quadTransform.m41()); + EXPECT_EQ(40, sharedQuadState->quadTransform.m42()); + EXPECT_EQ(contentRect, IntRect(sharedQuadState->visibleContentRect)); + EXPECT_EQ(clipRect, IntRect(sharedQuadState->scissorRect)); + EXPECT_EQ(1, sharedQuadState->opacity); + EXPECT_FALSE(sharedQuadState->opaque); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp index 22763cef3..1bfc81d8c 100644 --- a/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCSolidColorLayerImplTest.cpp @@ -45,17 +45,17 @@ TEST(CCSolidColorLayerImplTest, verifyTilingCompleteAndNoOverlap) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(800, 600); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); bool hadMissingTiles = false; layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); - verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleLayerRect); + verifyQuadsExactlyCoverRect(quadCuller.quadList(), visibleContentRect); } TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) @@ -66,10 +66,10 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setBackgroundColor(testColor); @@ -78,7 +78,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectBackgroundColorInQuad) layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(quadCuller.quadList()[0]->toSolidColorDrawQuad()->color(), testColor); + EXPECT_EQ(CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->color(), testColor); } TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) @@ -89,10 +89,10 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) MockCCQuadCuller quadCuller; IntSize layerSize = IntSize(100, 100); - IntRect visibleLayerRect = IntRect(IntPoint(), layerSize); + IntRect visibleContentRect = IntRect(IntPoint(), layerSize); OwnPtr<CCSolidColorLayerImpl> layer = CCSolidColorLayerImpl::create(1); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); layer->setDrawOpacity(opacity); @@ -101,7 +101,7 @@ TEST(CCSolidColorLayerImplTest, verifyCorrectOpacityInQuad) layer->appendQuads(quadCuller, sharedQuadState.get(), hadMissingTiles); ASSERT_EQ(quadCuller.quadList().size(), 1U); - EXPECT_EQ(opacity, quadCuller.quadList()[0]->toSolidColorDrawQuad()->opacity()); + EXPECT_EQ(opacity, CCSolidColorDrawQuad::materialCast(quadCuller.quadList()[0].get())->opacity()); } } // namespace diff --git a/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp new file mode 100644 index 000000000..d0bbd36f4 --- /dev/null +++ b/Source/WebKit/chromium/tests/CCTextureUpdaterTest.cpp @@ -0,0 +1,520 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON + * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" + +#include "cc/CCTextureUpdater.h" + +#include "CCTiledLayerTestCommon.h" +#include "FakeWebGraphicsContext3D.h" +#include "GraphicsContext3DPrivate.h" +#include "WebCompositor.h" +#include "platform/WebThread.h" + +#include <gtest/gtest.h> +#include <wtf/RefPtr.h> + +using namespace WebCore; +using namespace WebKit; +using namespace WebKitTests; +using testing::Test; + + +namespace { + +const int kFlushPeriodFull = 4; +const int kFlushPeriodPartial = kFlushPeriodFull; + +class CCTextureUpdaterTest; + +class WebGraphicsContext3DForUploadTest : public FakeWebGraphicsContext3D { +public: + WebGraphicsContext3DForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { } + virtual void flush(void); + virtual GrGLInterface* onCreateGrGLInterface() { return 0; } + +private: + CCTextureUpdaterTest* m_test; +}; + + +class TextureUploaderForUploadTest : public FakeTextureUploader { +public: + TextureUploaderForUploadTest(CCTextureUpdaterTest *test) : m_test(test) { } + + virtual void beginUploads(); + virtual void endUploads(); + virtual void uploadTexture(WebCore::CCGraphicsContext*, + WebCore::LayerTextureUpdater::Texture*, + WebCore::TextureAllocator*, + const WebCore::IntRect sourceRect, + const WebCore::IntRect destRect); + +private: + CCTextureUpdaterTest* m_test; +}; + + +class TextureForUploadTest : public LayerTextureUpdater::Texture { +public: + TextureForUploadTest() : LayerTextureUpdater::Texture(adoptPtr<CCPrioritizedTexture>(0)) { } + virtual void updateRect(CCGraphicsContext*, TextureAllocator*, const IntRect& sourceRect, const IntRect& destRect) { } +}; + + +class CCTextureUpdaterTest : public Test { +public: + CCTextureUpdaterTest() + : m_uploader(this) + , m_fullUploadCountExpected(0) + , m_partialCountExpected(0) + , m_totalUploadCountExpected(0) + , m_maxUploadCountPerUpdate(0) + , m_numBeginUploads(0) + , m_numEndUploads(0) + , m_numConsecutiveFlushes(0) + , m_numDanglingUploads(0) + , m_numTotalUploads(0) + , m_numTotalFlushes(0) + , m_numPreviousUploads(0) + , m_numPreviousFlushes(0) + { } + +public: + void onFlush() + { + // Check for back-to-back flushes. + EXPECT_EQ(0, m_numConsecutiveFlushes) << "Back-to-back flushes detected."; + + // Check for premature flushes + if (m_numPreviousUploads != m_maxUploadCountPerUpdate) { + if (m_numTotalUploads < m_fullUploadCountExpected) + EXPECT_GE(m_numDanglingUploads, kFlushPeriodFull) << "Premature flush detected in full uploads."; + else if (m_numTotalUploads > m_fullUploadCountExpected && m_numTotalUploads < m_totalUploadCountExpected) + EXPECT_GE(m_numDanglingUploads, kFlushPeriodPartial) << "Premature flush detected in partial uploads."; + } + + m_numDanglingUploads = 0; + m_numConsecutiveFlushes++; + m_numTotalFlushes++; + m_numPreviousFlushes++; + } + + void onBeginUploads() + { + m_numPreviousFlushes = 0; + m_numPreviousUploads = 0; + m_numBeginUploads++; + } + + void onUpload() + { + // Check for too many consecutive uploads + if (m_numTotalUploads < m_fullUploadCountExpected) + EXPECT_LT(m_numDanglingUploads, kFlushPeriodFull) << "Too many consecutive full uploads detected."; + else + EXPECT_LT(m_numDanglingUploads, kFlushPeriodPartial) << "Too many consecutive partial uploads detected."; + + m_numConsecutiveFlushes = 0; + m_numDanglingUploads++; + m_numTotalUploads++; + m_numPreviousUploads++; + } + + void onEndUploads() + { + EXPECT_EQ(0, m_numDanglingUploads) << "Last upload wasn't followed by a flush."; + + // Note: The m_numTotalUploads != m_fullUploadCountExpected comparison + // allows for the quota not to be hit in the case where we are trasitioning + // from full uploads to partial uploads. + if (m_numTotalUploads != m_totalUploadCountExpected && m_numTotalUploads != m_fullUploadCountExpected) { + EXPECT_EQ(m_maxUploadCountPerUpdate, m_numPreviousUploads) + << "endUpload() was called when there are textures to upload, but the upload quota hasn't been filled."; + } + + m_numEndUploads++; + } + +protected: + virtual void SetUp() + { + OwnPtr<WebThread> thread; + WebCompositor::initialize(thread.get()); + + m_context = CCGraphicsContext::create3D( + adoptPtr(new WebGraphicsContext3DForUploadTest(this))); + } + + virtual void TearDown() + { + WebCompositor::shutdown(); + } + + void appendFullUploadsToUpdater(int count) + { + m_fullUploadCountExpected += count; + m_totalUploadCountExpected += count; + + const IntRect rect(0, 0, 300, 150); + for (int i = 0; i < count; i++) + m_updater.appendFullUpdate(&m_texture, rect, rect); + } + + void appendPartialUploadsToUpdater(int count) + { + m_partialCountExpected += count; + m_totalUploadCountExpected += count; + + const IntRect rect(0, 0, 100, 100); + for (int i = 0; i < count; i++) + m_updater.appendPartialUpdate(&m_texture, rect, rect); + } + + void setMaxUploadCountPerUpdate(int count) + { + m_maxUploadCountPerUpdate = count; + } + +protected: + // Classes required to interact and test the CCTextureUpdater + OwnPtr<CCGraphicsContext> m_context; + CCTextureUpdater m_updater; + TextureForUploadTest m_texture; + FakeTextureAllocator m_allocator; + FakeTextureCopier m_copier; + TextureUploaderForUploadTest m_uploader; + + // Properties / expectations of this test + int m_fullUploadCountExpected; + int m_partialCountExpected; + int m_totalUploadCountExpected; + int m_maxUploadCountPerUpdate; + + // Dynamic properties of this test + int m_numBeginUploads; + int m_numEndUploads; + int m_numConsecutiveFlushes; + int m_numDanglingUploads; + int m_numTotalUploads; + int m_numTotalFlushes; + int m_numPreviousUploads; + int m_numPreviousFlushes; +}; + + +void WebGraphicsContext3DForUploadTest::flush(void) +{ + m_test->onFlush(); +} + +void TextureUploaderForUploadTest::beginUploads() +{ + m_test->onBeginUploads(); +} + +void TextureUploaderForUploadTest::endUploads() +{ + m_test->onEndUploads(); +} + +void TextureUploaderForUploadTest::uploadTexture(WebCore::CCGraphicsContext* context, + WebCore::LayerTextureUpdater::Texture* texture, + WebCore::TextureAllocator* allocator, + const WebCore::IntRect sourceRect, + const WebCore::IntRect destRect) +{ + m_test->onUpload(); +} + + +// ZERO UPLOADS TESTS +TEST_F(CCTextureUpdaterTest, ZeroUploads) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(0, m_numBeginUploads); + EXPECT_EQ(0, m_numEndUploads); + EXPECT_EQ(0, m_numPreviousFlushes); + EXPECT_EQ(0, m_numPreviousUploads); +} + + +// ONE UPLOAD TESTS +TEST_F(CCTextureUpdaterTest, OneFullUpload) +{ + appendFullUploadsToUpdater(1); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numPreviousFlushes); + EXPECT_EQ(1, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, OnePartialUpload) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(1); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(1, m_numPreviousFlushes); + EXPECT_EQ(1, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, OneFullOnePartialUpload) +{ + appendFullUploadsToUpdater(1); + appendPartialUploadsToUpdater(1); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + // We expect the full uploads to be followed by a flush + // before the partial uploads begin. + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(2, m_numPreviousFlushes); + EXPECT_EQ(2, m_numPreviousUploads); +} + + +// NO REMAINDER TESTS +// This class of tests upload a number of textures that is a multiple of the flush period. +const int fullUploadFlushMultipler = 7; +const int fullNoRemainderCount = fullUploadFlushMultipler * kFlushPeriodFull; + +const int partialUploadFlushMultipler = 11; +const int partialNoRemainderCount = partialUploadFlushMultipler * kFlushPeriodPartial; + +TEST_F(CCTextureUpdaterTest, ManyFullUploadsNoRemainder) +{ + appendFullUploadsToUpdater(fullNoRemainderCount); + appendPartialUploadsToUpdater(0); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullNoRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyPartialUploadsNoRemainder) +{ + appendFullUploadsToUpdater(0); + appendPartialUploadsToUpdater(partialNoRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(partialNoRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullManyPartialUploadsNoRemainder) +{ + appendFullUploadsToUpdater(fullNoRemainderCount); + appendPartialUploadsToUpdater(partialNoRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullNoRemainderCount + partialNoRemainderCount, m_numPreviousUploads); +} + + +// MIN/MAX REMAINDER TESTS +// This class of tests mix and match uploading 1 more and 1 less texture +// than a multiple of the flush period. + +const int fullMinRemainderCount = fullNoRemainderCount + 1; +const int fullMaxRemainderCount = fullNoRemainderCount - 1; +const int partialMinRemainderCount = partialNoRemainderCount + 1; +const int partialMaxRemainderCount = partialNoRemainderCount - 1; + +TEST_F(CCTextureUpdaterTest, ManyFullAndPartialMinRemainder) +{ + appendFullUploadsToUpdater(fullMinRemainderCount); + appendPartialUploadsToUpdater(partialMinRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler + 2, m_numPreviousFlushes); + EXPECT_EQ(fullMinRemainderCount + partialMinRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullAndPartialUploadsMaxRemainder) +{ + appendFullUploadsToUpdater(fullMaxRemainderCount); + appendPartialUploadsToUpdater(partialMaxRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullMaxRemainderCount + partialMaxRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullMinRemainderManyPartialMaxRemainder) +{ + appendFullUploadsToUpdater(fullMinRemainderCount); + appendPartialUploadsToUpdater(partialMaxRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ((fullUploadFlushMultipler+1) + partialUploadFlushMultipler, m_numPreviousFlushes); + EXPECT_EQ(fullMinRemainderCount + partialMaxRemainderCount, m_numPreviousUploads); +} + +TEST_F(CCTextureUpdaterTest, ManyFullMaxRemainderManyPartialMinRemainder) +{ + appendFullUploadsToUpdater(fullMaxRemainderCount); + appendPartialUploadsToUpdater(partialMinRemainderCount); + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, m_totalUploadCountExpected); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + EXPECT_EQ(fullUploadFlushMultipler + (partialUploadFlushMultipler+1), m_numPreviousFlushes); + EXPECT_EQ(fullMaxRemainderCount + partialMinRemainderCount, m_numPreviousUploads); +} + + +// MULTIPLE UPDATE TESTS +// These tests attempt to upload too many textures at once, requiring +// multiple calls to update(). + +int expectedFlushes(int uploads, int flushPeriod) +{ + return (uploads + flushPeriod - 1) / flushPeriod; +} + +TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateFullAndPartial) +{ + const int kMaxUploadsPerUpdate = 40; + const int kFullUploads = 100; + const int kPartialUploads = 20; + + int expectedPreviousFlushes = 0; + int expectedPreviousUploads = 0; + + setMaxUploadCountPerUpdate(kMaxUploadsPerUpdate); + appendFullUploadsToUpdater(kFullUploads); + appendPartialUploadsToUpdater(kPartialUploads); + + // First update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Second update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Third update (20 full, 20 partial) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kFullUploads-kMaxUploadsPerUpdate*2, kFlushPeriodFull) + + expectedFlushes(kPartialUploads, kFlushPeriodPartial); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = (kFullUploads-kMaxUploadsPerUpdate*2)+kPartialUploads; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Final sanity checks + EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); +} + +TEST_F(CCTextureUpdaterTest, TripleUpdateFinalUpdateAllPartial) +{ + const int kMaxUploadsPerUpdate = 40; + const int kFullUploads = 70; + const int kPartialUploads = 30; + + int expectedPreviousFlushes = 0; + int expectedPreviousUploads = 0; + + setMaxUploadCountPerUpdate(kMaxUploadsPerUpdate); + appendFullUploadsToUpdater(kFullUploads); + appendPartialUploadsToUpdater(kPartialUploads); + + // First update (40 full) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(1, m_numBeginUploads); + EXPECT_EQ(1, m_numEndUploads); + + expectedPreviousFlushes = expectedFlushes(kMaxUploadsPerUpdate, kFlushPeriodFull); + EXPECT_EQ(expectedPreviousFlushes, m_numPreviousFlushes); + + expectedPreviousUploads = kMaxUploadsPerUpdate; + EXPECT_EQ(expectedPreviousUploads, m_numPreviousUploads); + + // Second update (30 full, optionally 10 partial) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(2, m_numBeginUploads); + EXPECT_EQ(2, m_numEndUploads); + EXPECT_LE(m_numPreviousUploads, kMaxUploadsPerUpdate); + // Be lenient on the exact number of flushes here, as the number of flushes + // will depend on whether some partial uploads were performed. + // onFlush(), onUpload(), and onEndUpload() will do basic flush checks for us anyway. + + // Third update (30 partial OR 20 partial if 10 partial uploaded in second update) + m_updater.update(m_context.get(), &m_allocator, &m_copier, &m_uploader, kMaxUploadsPerUpdate); + + EXPECT_EQ(3, m_numBeginUploads); + EXPECT_EQ(3, m_numEndUploads); + EXPECT_LE(m_numPreviousUploads, kMaxUploadsPerUpdate); + // Be lenient on the exact number of flushes here as well. + + // Final sanity checks + EXPECT_EQ(kFullUploads + kPartialUploads, m_numTotalUploads); +} + + +} // namespace diff --git a/Source/WebKit/chromium/tests/CCThreadedTest.cpp b/Source/WebKit/chromium/tests/CCThreadedTest.cpp index 40d3ce5e6..2e2c1a06f 100644 --- a/Source/WebKit/chromium/tests/CCThreadedTest.cpp +++ b/Source/WebKit/chromium/tests/CCThreadedTest.cpp @@ -34,7 +34,6 @@ #include "FakeWebGraphicsContext3D.h" #include "GraphicsContext3DPrivate.h" #include "LayerChromium.h" -#include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCActiveAnimation.h" diff --git a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp index efb3a6a16..588c0ff08 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerImplTest.cpp @@ -48,7 +48,7 @@ static PassOwnPtr<CCTiledLayerImpl> createLayer(const IntSize& tileSize, const I tiler->setBounds(layerSize); layer->setTilingData(*tiler); layer->setSkipsDraw(false); - layer->setVisibleLayerRect(IntRect(IntPoint(), layerSize)); + layer->setVisibleContentRect(IntRect(IntPoint(), layerSize)); layer->setDrawOpacity(1); int textureId = 1; @@ -82,7 +82,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) // Layer with empty visible layer rect produces no quads { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); - layer->setVisibleLayerRect(IntRect()); + layer->setVisibleContentRect(IntRect()); MockCCQuadCuller quadCuller; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); @@ -96,7 +96,7 @@ TEST(CCTiledLayerImplTest, emptyQuadList) OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, CCLayerTilingData::NoBorderTexels); IntRect outsideBounds(IntPoint(-100, -100), IntSize(50, 50)); - layer->setVisibleLayerRect(outsideBounds); + layer->setVisibleContentRect(outsideBounds); MockCCQuadCuller quadCuller; OwnPtr<CCSharedQuadState> sharedQuadState = layer->createSharedQuadState(); @@ -158,10 +158,10 @@ TEST(CCTiledLayerImplTest, checkerboarding) } } -static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleLayerRect) +static PassOwnPtr<CCSharedQuadState> getQuads(CCQuadList& quads, IntSize tileSize, const IntSize& layerSize, CCLayerTilingData::BorderTexelOption borderTexelOption, const IntRect& visibleContentRect) { OwnPtr<CCTiledLayerImpl> layer = createLayer(tileSize, layerSize, borderTexelOption); - layer->setVisibleLayerRect(visibleLayerRect); + layer->setVisibleContentRect(visibleContentRect); layer->setBounds(layerSize); MockCCQuadCuller quadCuller(quads); @@ -201,13 +201,13 @@ static void coverageVisibleRectIntersectsTiles(CCLayerTilingData::BorderTexelOpt // This rect intersects the middle 3x3 of the 5x5 tiles. IntPoint topLeft(65, 73); IntPoint bottomRight(182, 198); - IntRect visibleLayerRect(topLeft, bottomRight - topLeft); + IntRect visibleContentRect(topLeft, bottomRight - topLeft); IntSize layerSize(250, 250); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleLayerRect); - verifyQuadsExactlyCoverRect(quads, visibleLayerRect); + sharedState = getQuads(quads, IntSize(50, 50), IntSize(250, 250), CCLayerTilingData::NoBorderTexels, visibleContentRect); + verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsTiles); @@ -216,11 +216,11 @@ static void coverageVisibleRectIntersectsBounds(CCLayerTilingData::BorderTexelOp DebugScopedSetImplThread scopedImplThread; IntSize layerSize(220, 210); - IntRect visibleLayerRect(IntPoint(), layerSize); + IntRect visibleContentRect(IntPoint(), layerSize); CCQuadList quads; OwnPtr<CCSharedQuadState> sharedState; - sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleLayerRect); - verifyQuadsExactlyCoverRect(quads, visibleLayerRect); + sharedState = getQuads(quads, IntSize(100, 100), layerSize, CCLayerTilingData::NoBorderTexels, visibleContentRect); + verifyQuadsExactlyCoverRect(quads, visibleContentRect); } WITH_AND_WITHOUT_BORDER_TEST(coverageVisibleRectIntersectsBounds); diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp index 558cba576..2d1603e48 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.cpp @@ -68,7 +68,7 @@ void FakeLayerTextureUpdater::prepareToUpdate(const IntRect& contentRect, const m_prepareCount++; m_lastUpdateRect = contentRect; if (!m_rectToInvalidate.isEmpty()) { - m_layer->invalidateRect(m_rectToInvalidate); + m_layer->invalidateContentRect(m_rectToInvalidate); m_rectToInvalidate = IntRect(); m_layer = 0; } @@ -118,7 +118,7 @@ void FakeTiledLayerChromium::setNeedsDisplayRect(const FloatRect& rect) void FakeTiledLayerChromium::update(CCTextureUpdater& updater, const CCOcclusionTracker* occlusion) { - updateLayerRect(updater, visibleLayerRect(), occlusion); + updateContentRect(updater, visibleContentRect(), occlusion); } void FakeTiledLayerChromium::setTexturePriorities(const CCPriorityCalculator& calculator) diff --git a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h index 53e58b3a7..9501caba9 100644 --- a/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h +++ b/Source/WebKit/chromium/tests/CCTiledLayerTestCommon.h @@ -29,6 +29,7 @@ #include "IntSize.h" #include "LayerTextureUpdater.h" #include "Region.h" +#include "TextureAllocator.h" #include "TextureCopier.h" #include "TextureUploader.h" #include "TiledLayerChromium.h" @@ -110,8 +111,8 @@ public: static WebCore::IntSize tileSize() { return WebCore::IntSize(100, 100); } - using WebCore::TiledLayerChromium::invalidateRect; - using WebCore::TiledLayerChromium::updateLayerRect; + using WebCore::TiledLayerChromium::invalidateContentRect; + using WebCore::TiledLayerChromium::updateContentRect; using WebCore::TiledLayerChromium::needsIdlePaint; using WebCore::TiledLayerChromium::skipsDraw; using WebCore::TiledLayerChromium::numPaintedTiles; @@ -120,7 +121,7 @@ public: virtual void setNeedsDisplayRect(const WebCore::FloatRect&) OVERRIDE; const WebCore::FloatRect& lastNeedsDisplayRect() const { return m_lastNeedsDisplayRect; } - // Updates the visibleLayerRect(). + // Updates the visibleContentRect(). virtual void update(WebCore::CCTextureUpdater&, const WebCore::CCOcclusionTracker*) OVERRIDE; virtual void setTexturePriorities(const WebCore::CCPriorityCalculator&) OVERRIDE; diff --git a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp index 435907c94..c206dda5e 100644 --- a/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp +++ b/Source/WebKit/chromium/tests/Canvas2DLayerBridgeTest.cpp @@ -30,7 +30,6 @@ #include "GraphicsContext3DPrivate.h" #include "ImageBuffer.h" #include "LayerChromium.h" -#include "TextureManager.h" #include "WebCompositor.h" #include "WebKit.h" #include "cc/CCGraphicsContext.h" diff --git a/Source/WebKit/chromium/tests/DecimalTest.cpp b/Source/WebKit/chromium/tests/DecimalTest.cpp index db80f5bfe..454dfea2c 100644 --- a/Source/WebKit/chromium/tests/DecimalTest.cpp +++ b/Source/WebKit/chromium/tests/DecimalTest.cpp @@ -211,12 +211,14 @@ TEST_F(DecimalTest, AddSpecialValues) TEST_F(DecimalTest, Ceiling) { EXPECT_EQ(Decimal(1), Decimal(1).ceiling()); + EXPECT_EQ(Decimal(1), encode(1, -10, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(11, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(13, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(15, -1, Positive).ceiling()); EXPECT_EQ(Decimal(2), encode(19, -1, Positive).ceiling()); EXPECT_EQ(Decimal(-1), Decimal(-1).ceiling()); + EXPECT_EQ(Decimal(0), encode(1, -10, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(11, -1, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(13, -1, Negative).ceiling()); EXPECT_EQ(Decimal(-1), encode(15, -1, Negative).ceiling()); @@ -229,7 +231,7 @@ TEST_F(DecimalTest, CeilingBigExponent) EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).ceiling()); } -TEST_F(DecimalTest, CeilingSmallExponent) +TEST_F(DecimalTest, DISABLED_CeilingSmallExponent) { EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).ceiling()); EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).ceiling()); @@ -525,12 +527,14 @@ TEST_F(DecimalTest, EncodedData) TEST_F(DecimalTest, Floor) { EXPECT_EQ(Decimal(1), Decimal(1).floor()); + EXPECT_EQ(Decimal(0), encode(1, -10, Positive).floor()); EXPECT_EQ(Decimal(1), encode(11, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(13, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(15, -1, Positive).floor()); EXPECT_EQ(Decimal(1), encode(19, -1, Positive).floor()); EXPECT_EQ(Decimal(-1), Decimal(-1).floor()); + EXPECT_EQ(Decimal(-1), encode(1, -10, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(11, -1, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(13, -1, Negative).floor()); EXPECT_EQ(Decimal(-2), encode(15, -1, Negative).floor()); @@ -543,7 +547,7 @@ TEST_F(DecimalTest, FloorBigExponent) EXPECT_EQ(encode(1, 1000, Negative), encode(1, 1000, Negative).floor()); } -TEST_F(DecimalTest, FloorSmallExponent) +TEST_F(DecimalTest, DISABLED_FloorSmallExponent) { EXPECT_EQ(encode(0, 0, Positive), encode(1, -1000, Positive).floor()); EXPECT_EQ(encode(0, 0, Negative), encode(1, -1000, Negative).floor()); diff --git a/Source/WebKit/chromium/tests/EventListenerTest.cpp b/Source/WebKit/chromium/tests/EventListenerTest.cpp index 799ac4007..425546952 100644 --- a/Source/WebKit/chromium/tests/EventListenerTest.cpp +++ b/Source/WebKit/chromium/tests/EventListenerTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include "WebDOMEvent.h" #include "WebDOMEventListener.h" #include "WebDOMMutationEvent.h" @@ -78,7 +79,7 @@ public: std::string baseURL("http://www.example.com/"); std::string fileName("listener/mutation_event_listener.html"); bool executeScript = true; - FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); } diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp index e406413dd..a2b1675c0 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.cpp +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include <wtf/StdLibExtras.h> #include "WebFrame.h" #include "WebFrameClient.h" @@ -40,35 +41,16 @@ #include "platform/WebURLResponse.h" #include "WebView.h" #include "WebViewClient.h" -#include <googleurl/src/gurl.h> #include <webkit/support/webkit_support.h> namespace WebKit { namespace FrameTestHelpers { -void registerMockedURLLoad(const std::string& base, const std::string& fileName) -{ - registerMockedURLLoad(GURL(base + fileName), fileName); -} - -void registerMockedURLLoad(GURL url, const std::string& fileName) -{ - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath += "/Source/WebKit/chromium/tests/data/"; - filePath += fileName; - - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); -} - void loadFrame(WebFrame* frame, const std::string& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(GURL(url)); + urlRequest.setURL(URLTestHelpers::toKURL(url)); frame->loadRequest(urlRequest); } diff --git a/Source/WebKit/chromium/tests/FrameTestHelpers.h b/Source/WebKit/chromium/tests/FrameTestHelpers.h index fc2fa2d36..bfb57b67c 100644 --- a/Source/WebKit/chromium/tests/FrameTestHelpers.h +++ b/Source/WebKit/chromium/tests/FrameTestHelpers.h @@ -33,8 +33,6 @@ #include <string> -class GURL; - namespace WebKit { class WebFrame; @@ -44,10 +42,6 @@ class WebViewClient; namespace FrameTestHelpers { -void registerMockedURLLoad(const std::string& base, const std::string& fileName); -// Like the previous overload, but it allows more flexibility in the url since it is given by the caller. -void registerMockedURLLoad(GURL, const std::string& fileName); - void loadFrame(WebFrame*, const std::string& url); WebView* createWebViewAndLoad(const std::string& url, bool enableJavascript = false, WebFrameClient* = 0, WebViewClient* = 0); diff --git a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp index e7c655247..fdae37c6a 100644 --- a/Source/WebKit/chromium/tests/LayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerChromiumTest.cpp @@ -494,7 +494,7 @@ TEST_F(LayerChromiumTest, checkPropertyChangeCausesCorrectBehavior) EXPECT_FALSE(testLayer->needsDisplay()); // Test properties that should not call needsDisplay and needsCommit when changed. - EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleLayerRect(IntRect(0, 0, 40, 50))); + EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setVisibleContentRect(IntRect(0, 0, 40, 50))); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setUsesLayerClipping(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setIsNonCompositedContent(true)); EXECUTE_AND_VERIFY_SET_NEEDS_COMMIT_BEHAVIOR(0, testLayer->setDrawOpacity(0.5f)); diff --git a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp index 9c9ec25b0..7cdba809c 100644 --- a/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/LayerRendererChromiumTest.cpp @@ -30,6 +30,7 @@ #include "GraphicsContext3D.h" #include "WebCompositor.h" #include "cc/CCDrawQuad.h" +#include "cc/CCPrioritizedTextureManager.h" #include "cc/CCSettings.h" #include "cc/CCSingleThreadProxy.h" @@ -76,7 +77,7 @@ public: FakeCCRendererClient() : m_setFullRootLayerDamageCount(0) , m_rootLayer(CCLayerImpl::create(1)) - , m_memoryAllocationLimitBytes(0) + , m_memoryAllocationLimitBytes(CCPrioritizedTextureManager::defaultMemoryAllocationLimit()) { m_rootLayer->createRenderSurface(); m_rootRenderPass = CCRenderPass::create(m_rootLayer->renderSurface(), m_rootLayer->id()); diff --git a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp index 5e321c70d..b0f700a0c 100644 --- a/Source/WebKit/chromium/tests/ListenerLeakTest.cpp +++ b/Source/WebKit/chromium/tests/ListenerLeakTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "FrameTestHelpers.h" +#include "URLTestHelpers.h" #include "WebView.h" #include <gtest/gtest.h> #include <v8/include/v8-profiler.h> @@ -90,7 +91,7 @@ public: std::string baseURL("http://www.example.com/"); std::string fileName(filename); bool executeScript = true; - FrameTestHelpers::registerMockedURLLoad(baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); m_webView = FrameTestHelpers::createWebViewAndLoad(baseURL + fileName, executeScript); } diff --git a/Source/WebKit/chromium/tests/PopupMenuTest.cpp b/Source/WebKit/chromium/tests/PopupMenuTest.cpp index 7acb31149..59c233632 100644 --- a/Source/WebKit/chromium/tests/PopupMenuTest.cpp +++ b/Source/WebKit/chromium/tests/PopupMenuTest.cpp @@ -43,6 +43,7 @@ #include "PopupMenuClient.h" #include "PopupMenuChromium.h" #include "RuntimeEnabledFeatures.h" +#include "URLTestHelpers.h" #include "WebDocument.h" #include "WebElement.h" #include "WebFrame.h" @@ -63,6 +64,7 @@ using namespace WebCore; using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -249,15 +251,7 @@ protected: void registerMockedURLLoad(const std::string& fileName) { - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath += "/Source/WebKit/chromium/tests/data/popup/"; - filePath += fileName; - - webkit_support::RegisterMockedURL(WebURL(GURL(baseURL + fileName)), response, WebString::fromUTF8(filePath)); + URLTestHelpers::registerMockedURLLoad(toKURL(baseURL + fileName), WebString::fromUTF8(fileName.c_str()), WebString::fromUTF8("popup/"), WebString::fromUTF8("text/html")); } void serveRequests() @@ -269,7 +263,7 @@ protected: { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(GURL(baseURL + fileName))); + urlRequest.setURL(WebURL(toKURL(baseURL + fileName))); frame->loadRequest(urlRequest); } @@ -427,7 +421,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) // mousedown event is held by select node, and we don't simulate the event for the node. // So we can only see mouseup and click event. - EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclick", element.innerText().utf8().data()); // Disable the item at index 1. m_popupMenuClient.setDisabledIndex(1); @@ -439,7 +433,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) simulateLeftMouseUpEvent(row1Point); // The item at index 1 is disabled, so the text should not be changed. - EXPECT_STREQ("upclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclick", element.innerText().utf8().data()); showPopup(); // menuItemHeight * 2.5 means the Y position on the item at index 2. @@ -448,7 +442,7 @@ TEST_F(SelectPopupMenuTest, DISABLED_SelectItemEventFire) simulateLeftMouseUpEvent(row1Point); // The item is changed to the item at index 2, from index 0, so change event is fired. - EXPECT_STREQ("upclickchangeupclick", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("upclickchangeupclick", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) @@ -469,7 +463,7 @@ TEST_F(SelectPopupMenuTest, FLAKY_SelectItemKeyEvent) WebElement element = m_webView->mainFrame()->document().getElementById("message"); // We only can see change event but no other mouse related events. - EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("change", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) @@ -491,7 +485,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnChange) simulateLeftMouseUpEvent(row1Point); WebElement element = m_webView->mainFrame()->document().getElementById("message"); - EXPECT_STREQ("change", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("change", element.innerText().utf8().data()); } TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) @@ -513,7 +507,7 @@ TEST_F(SelectPopupMenuTest, SelectItemRemoveSelectOnClick) simulateLeftMouseUpEvent(row1Point); WebElement element = m_webView->mainFrame()->document().getElementById("message"); - EXPECT_STREQ("click", std::string(element.innerText().utf8()).c_str()); + EXPECT_STREQ("click", element.innerText().utf8().data()); } } // namespace diff --git a/Source/WebKit/chromium/tests/RunAllTests.cpp b/Source/WebKit/chromium/tests/RunAllTests.cpp index dc0528257..78fd7da3d 100644 --- a/Source/WebKit/chromium/tests/RunAllTests.cpp +++ b/Source/WebKit/chromium/tests/RunAllTests.cpp @@ -28,6 +28,10 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +#if WEBKIT_IMPLEMENTATION +#include "config.h" +#endif + // FIXME: Avoid this source dependency on Chromium's base module. #include <base/test/test_suite.h> diff --git a/Source/WebKit/chromium/tests/TextureManagerTest.cpp b/Source/WebKit/chromium/tests/TextureManagerTest.cpp deleted file mode 100644 index d5313f5dc..000000000 --- a/Source/WebKit/chromium/tests/TextureManagerTest.cpp +++ /dev/null @@ -1,295 +0,0 @@ -/* - * Copyright (C) 2012 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY - * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY - * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" - -#include "CCTiledLayerTestCommon.h" -#include "ManagedTexture.h" -#include "TextureManager.h" - -#include <gtest/gtest.h> - -using namespace WebCore; -using namespace WebKitTests; -using namespace WTF; - -namespace { - -class TextureManagerTest : public testing::Test { -public: - TextureManagerTest() - : m_textureSize(256, 256) - , m_textureFormat(GraphicsContext3D::RGBA) - { - } - - virtual ~TextureManagerTest() - { - } - - size_t texturesMemorySize(size_t textureCount) - { - return TextureManager::memoryUseBytes(m_textureSize, m_textureFormat) * textureCount; - } - - PassOwnPtr<TextureManager> createTextureManager(size_t maxTextures, size_t preferredTextures) - { - return TextureManager::create(texturesMemorySize(maxTextures), texturesMemorySize(preferredTextures), 1024); - } - - bool requestTexture(TextureManager* manager, TextureToken token) - { - bool result = manager->requestTexture(token, m_textureSize, m_textureFormat); - if (result) - manager->allocateTexture(&m_fakeTextureAllocator, token); - return result; - } - -private: - FakeTextureAllocator m_fakeTextureAllocator; - const IntSize m_textureSize; - const GC3Denum m_textureFormat; -}; - -TEST_F(TextureManagerTest, requestTextureInPreferredLimit) -{ - const size_t preferredTextures = 8; - OwnPtr<TextureManager> textureManager = createTextureManager(preferredTextures * 2, preferredTextures); - TextureToken tokens[preferredTextures]; - for (size_t i = 0; i < preferredTextures; ++i) { - tokens[i] = textureManager->getToken(); - if (i) - EXPECT_GT(tokens[i], tokens[i - 1]); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - EXPECT_TRUE(textureManager->isProtected(tokens[i])); - } - - for (size_t i = 0; i < preferredTextures; ++i) - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); -} - -TEST_F(TextureManagerTest, requestTextureExceedingPreferredLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < preferredTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - textureManager->unprotectTexture(tokens[0]); - textureManager->unprotectTexture(tokens[2]); - - for (size_t i = preferredTextures; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - textureManager->unprotectTexture(tokens[4]); - textureManager->unprotectTexture(tokens[5]); - - // These textures should be valid before the reduceMemoryToLimit call. - EXPECT_TRUE(textureManager->hasTexture(tokens[0])); - EXPECT_TRUE(textureManager->hasTexture(tokens[2])); - - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - - EXPECT_FALSE(textureManager->hasTexture(tokens[0])); - EXPECT_TRUE(textureManager->hasTexture(tokens[1])); - EXPECT_TRUE(textureManager->isProtected(tokens[1])); - EXPECT_FALSE(textureManager->hasTexture(tokens[2])); - EXPECT_TRUE(textureManager->hasTexture(tokens[3])); - EXPECT_TRUE(textureManager->isProtected(tokens[3])); - - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); -} - -TEST_F(TextureManagerTest, requestTextureExceedingMaxLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - EXPECT_TRUE(textureManager->hasTexture(tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - for (size_t i = 0; i < maxTextures; ++i) { - TextureToken token = textureManager->getToken(); - EXPECT_FALSE(requestTexture(textureManager.get(), token)); - EXPECT_FALSE(textureManager->hasTexture(token)); - } - - EXPECT_EQ(textureManager->currentMemoryUseBytes(), texturesMemorySize(maxTextures)); - - textureManager->unprotectTexture(tokens[1]); - textureManager->unprotectTexture(tokens[3]); - EXPECT_TRUE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_TRUE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_FALSE(requestTexture(textureManager.get(), textureManager->getToken())); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_FALSE(textureManager->hasTexture(tokens[1])); - EXPECT_FALSE(textureManager->hasTexture(tokens[3])); -} - -TEST_F(TextureManagerTest, reduceMemoryToLimit) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < preferredTextures + 1; ++i) - textureManager->unprotectTexture(tokens[i]); - - textureManager->reduceMemoryToLimit(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); - textureManager->reduceMemoryToLimit(texturesMemorySize(1)); - EXPECT_EQ(texturesMemorySize(maxTextures - unprotectedTextures), textureManager->currentMemoryUseBytes()); - - // reduceMemoryToLimit doesn't change the current memory limits. - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, setMaxMemoryLimitBytes) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < unprotectedTextures; ++i) - textureManager->unprotectTexture(tokens[i]); - - textureManager->setMaxMemoryLimitBytes(texturesMemorySize(maxTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - textureManager->setMaxMemoryLimitBytes(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->maxMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, setPreferredMemoryLimitBytes) -{ - const size_t maxTextures = 8; - const size_t preferredTextures = 4; - OwnPtr<TextureManager> textureManager = createTextureManager(maxTextures, preferredTextures); - TextureToken tokens[maxTextures]; - for (size_t i = 0; i < maxTextures; ++i) { - tokens[i] = textureManager->getToken(); - EXPECT_TRUE(requestTexture(textureManager.get(), tokens[i])); - } - - const size_t unprotectedTextures = preferredTextures + 1; - for (size_t i = 0; i < unprotectedTextures; ++i) - textureManager->unprotectTexture(tokens[i]); - - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - - // Setting preferred memory limit only won't force reduceMemoryToLimit. - textureManager->setPreferredMemoryLimitBytes(texturesMemorySize(preferredTextures)); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->currentMemoryUseBytes()); - EXPECT_EQ(texturesMemorySize(maxTextures), textureManager->maxMemoryLimitBytes()); - EXPECT_EQ(texturesMemorySize(preferredTextures), textureManager->preferredMemoryLimitBytes()); -} - -TEST_F(TextureManagerTest, textureManagerDestroyedBeforeManagedTexture) -{ - OwnPtr<TextureManager> textureManager = createTextureManager(1, 1); - OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManager.get()); - - IntSize size(50, 50); - unsigned format = GraphicsContext3D::RGBA; - - // Texture is initially invalid, but we should be able to reserve. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - textureManager.clear(); - - // Deleting the manager should invalidate the texture and reservation attempts should fail. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_FALSE(managedTexture->reserve(size, format)); -} - -TEST_F(TextureManagerTest, textureMovedToNewManager) -{ - OwnPtr<TextureManager> textureManagerOne = createTextureManager(1, 1); - OwnPtr<TextureManager> textureManagerTwo = createTextureManager(1, 1); - OwnPtr<ManagedTexture> managedTexture = ManagedTexture::create(textureManagerOne.get()); - - IntSize size(50, 50); - unsigned format = GraphicsContext3D::RGBA; - - // Texture is initially invalid, but we should be able to reserve. - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - // Setting to the same manager should be a no-op. - managedTexture->setTextureManager(textureManagerOne.get()); - EXPECT_TRUE(managedTexture->isValid(size, format)); - - // Setting to a different manager should invalidate the texture. - managedTexture->setTextureManager(textureManagerTwo.get()); - - EXPECT_FALSE(managedTexture->isValid(size, format)); - EXPECT_TRUE(managedTexture->reserve(size, format)); - EXPECT_TRUE(managedTexture->isValid(size, format)); -} - -} // namespace diff --git a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp index c277e006e..f152ab4fb 100644 --- a/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp +++ b/Source/WebKit/chromium/tests/TiledLayerChromiumTest.cpp @@ -101,13 +101,13 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -116,11 +116,11 @@ TEST_F(TiledLayerChromiumTest, pushDirtyTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); // Invalidates both tiles... - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); // ....but then only update one of them. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); layer->pushPropertiesTo(layerImpl.get()); // We should only have the first tile since the other tile was invalidated but not painted. @@ -140,13 +140,13 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -159,10 +159,10 @@ TEST_F(TiledLayerChromiumTest, pushOccludedDirtyTiles) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); // Invalidates part of the top tile... - layer->invalidateRect(IntRect(0, 0, 50, 50)); + layer->invalidateContentRect(IntRect(0, 0, 50, 50)); // ....but the area is occluded. occluded.setOcclusion(IntRect(0, 0, 50, 50)); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -184,13 +184,13 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -211,8 +211,8 @@ TEST_F(TiledLayerChromiumTest, pushDeletedTiles) // This should recreate and update the deleted textures. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -235,13 +235,13 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) // This invalidates 25 tiles and then paints one visible tile. layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); // We should need idle-painting for 3x3 tiles in the center. @@ -255,9 +255,9 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintTiles) // For the next four updates, we should detect we still need idle painting. for (int i = 0; i < 4; i++) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); EXPECT_TRUE(layer->needsIdlePaint(visibleRect)); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -295,21 +295,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // This requires 4*30000 bytes of memory. IntRect layer2Rect(0, 0, 100, 300); layer2->setBounds(layer2Rect.size()); - layer2->setVisibleLayerRect(layer2Rect); - layer2->invalidateRect(layer2Rect); + layer2->setVisibleContentRect(layer2Rect); + layer2->invalidateContentRect(layer2Rect); // This uses 960000 bytes, leaving 88576 bytes of memory left, which is enough for 2 tiles only in the other layer. IntRect layerRect(IntPoint::zero(), IntSize(100, 2400)); layer1->setBounds(layerRect.size()); - layer1->setVisibleLayerRect(layerRect); - layer1->invalidateRect(layerRect); + layer1->setVisibleContentRect(layerRect); + layer1->invalidateContentRect(layerRect); // Paint a single tile in layer2 so that it will idle paint. layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer1->updateLayerRect(updater, layerRect, 0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer1->updateContentRect(updater, layerRect, 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); // We should need idle-painting for both remaining tiles in layer2. EXPECT_TRUE(layer2->needsIdlePaint(layer2Rect)); @@ -325,8 +325,8 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // Now idle paint layer2. We are going to run out of memory though! layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); // Oh well, commit the frame and push. updateTextures(); @@ -345,9 +345,9 @@ TEST_F(TiledLayerChromiumTest, pushTilesAfterIdlePaintFailed) // Now if layer2 becomes fully visible, we should be able to paint it and push valid textures. layer2->setTexturePriorities(priorityCalculator); layer1->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer2->updateLayerRect(updater, layer2Rect, 0); - layer1->updateLayerRect(updater, layerRect, 0); + textureManager->prioritizeTextures(); + layer2->updateContentRect(updater, layer2Rect, 0); + layer1->updateContentRect(updater, layerRect, 0); updateTextures(); layer1->pushPropertiesTo(layerImpl1.get()); @@ -374,12 +374,12 @@ TEST_F(TiledLayerChromiumTest, pushIdlePaintedOccludedTiles) layer->setBounds(IntSize(100, 100)); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); - layer->invalidateRect(IntRect(0, 0, 100, 100)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); + layer->invalidateContentRect(IntRect(0, 0, 100, 100)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), &occluded); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -398,13 +398,13 @@ TEST_F(TiledLayerChromiumTest, pushTilesMarkedDirtyDuringPaint) // However, during the paint, we invalidate one of the tiles. This should // not prevent the tile from being pushed. layer->setBounds(IntSize(100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer.get()); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); @@ -423,22 +423,22 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnNextLayer) OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer2->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); layer1->setTexturePriorities(priorityCalculator); layer2->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); // Invalidate a tile on layer1 layer2->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer1.get()); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); @@ -461,21 +461,21 @@ TEST_F(TiledLayerChromiumTest, pushTilesLayerMarkedDirtyDuringPaintOnPreviousLay OwnPtr<FakeCCTiledLayerImpl> layer2Impl(adoptPtr(new FakeCCTiledLayerImpl(2))); layer1->setBounds(IntSize(100, 200)); - layer1->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer1->invalidateRect(IntRect(0, 0, 100, 200)); + layer1->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer1->invalidateContentRect(IntRect(0, 0, 100, 200)); layer2->setBounds(IntSize(100, 200)); - layer2->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer2->invalidateRect(IntRect(0, 0, 100, 200)); + layer2->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer2->invalidateContentRect(IntRect(0, 0, 100, 200)); layer1->setTexturePriorities(priorityCalculator); layer2->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Invalidate a tile on layer2 layer1->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(0, 50, 100, 50), layer2.get()); - layer1->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); - layer2->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer1->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); + layer2->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updateTextures(); layer1->pushPropertiesTo(layer1Impl.get()); layer2->pushPropertiesTo(layer2Impl.get()); @@ -504,12 +504,12 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) // Invalidates 9 tiles and then paints one visible tile. layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // Idle-painting should see no more priority tiles for painting. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -521,8 +521,8 @@ TEST_F(TiledLayerChromiumTest, idlePaintOutOfMemory) EXPECT_TRUE(layerImpl->hasTileAt(1, 1)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // We shouldn't signal we need another idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -544,14 +544,14 @@ TEST_F(TiledLayerChromiumTest, idlePaintZeroSizedLayer) IntRect contentRect; layer->setBounds(contentRect.size()); - layer->setVisibleLayerRect(contentRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(contentRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Empty layers don't paint or idle-paint. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); // Empty layers don't have tiles. EXPECT_EQ(0u, layer->numPaintedTiles()); @@ -580,14 +580,14 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleLayers) IntRect visibleRect; layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); for (int i = 0; i < 2; i++) { // Paint / idle-paint. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, visibleRect, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, visibleRect, 0); // Non-visible layers don't need idle paint. EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); @@ -632,11 +632,11 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) IntRect visibleRect; layer->setBounds(contentBounds); - layer->setVisibleLayerRect(visibleRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(visibleRect); + layer->invalidateContentRect(contentRect); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // If idlePaintRect gives back a non-empty result then we should paint it. Otherwise, // we shoud paint nothing. @@ -648,9 +648,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) // If the layer is to be prepainted at all, then after four updates we should have the outer row/columns painted. for (int k = 0; k < 4; ++k) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -661,9 +661,9 @@ TEST_F(TiledLayerChromiumTest, idlePaintNonVisibleAnimatingLayers) EXPECT_FALSE(layer->needsIdlePaint(visibleRect)); for (int k = 0; k < 4; ++k) { layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); - layer->updateLayerRect(updater, visibleRect, 0); + layer->updateContentRect(updater, visibleRect, 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); } @@ -687,11 +687,11 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); layer->pushPropertiesTo(layerImpl.get()); @@ -700,22 +700,22 @@ TEST_F(TiledLayerChromiumTest, invalidateFromPrepare) EXPECT_TRUE(layerImpl->hasTileAt(0, 1)); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // Invoke updateLayerRect again. As the layer is valid updateLayerRect shouldn't be invoked on + // Invoke updateContentRect again. As the layer is valid updateContentRect shouldn't be invoked on // the LayerTextureUpdater. - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(0, layer->fakeLayerTextureUpdater()->prepareCount()); - layer->invalidateRect(IntRect(0, 0, 50, 50)); - // setRectToInvalidate triggers invalidateRect() being invoked from updateLayerRect. + layer->invalidateContentRect(IntRect(0, 0, 50, 50)); + // setRectToInvalidate triggers invalidateContentRect() being invoked from updateContentRect. layer->fakeLayerTextureUpdater()->setRectToInvalidate(IntRect(25, 25, 50, 50), layer.get()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); layer->fakeLayerTextureUpdater()->clearPrepareCount(); - // The layer should still be invalid as updateLayerRect invoked invalidate. - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + // The layer should still be invalid as updateContentRect invoked invalidate. + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); updater.update(ccContext.get(), &fakeAllocator, &fakeCopier, &fakeUploader, 1000); EXPECT_EQ(1, layer->fakeLayerTextureUpdater()->prepareCount()); } @@ -733,32 +733,32 @@ TEST_F(TiledLayerChromiumTest, verifyUpdateRectWhenContentBoundsAreScaled) layer->setBounds(layerBounds.size()); layer->setContentBounds(contentBounds.size()); - layer->setVisibleLayerRect(contentBounds); + layer->setVisibleContentRect(contentBounds); // On first update, the updateRect includes all tiles, even beyond the boundaries of the layer. // However, it should still be in layer space, not content space. - layer->invalidateRect(contentBounds); + layer->invalidateContentRect(contentBounds); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 300, 300 * 0.8), layer->updateRect()); updateTextures(); // After the tiles are updated once, another invalidate only needs to update the bounds of the layer. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(layerBounds), layer->updateRect()); updateTextures(); // Partial re-paint should also be represented by the updateRect in layer space, not content space. IntRect partialDamage(30, 100, 10, 10); - layer->invalidateRect(partialDamage); + layer->invalidateContentRect(partialDamage); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, contentBounds, 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, contentBounds, 0); EXPECT_FLOAT_RECT_EQ(FloatRect(45, 80, 15, 8), layer->updateRect()); } @@ -771,7 +771,7 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Create a layer with one tile. layer->setBounds(IntSize(100, 100)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 100)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 100)); // Invalidate the entire layer. layer->setNeedsDisplay(); @@ -779,8 +779,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Push the tiles to the impl side and check that there is exactly one. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 100), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 100), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -791,13 +791,13 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // Change the contents scale and verify that the content rectangle requiring painting // is not scaled. layer->setContentsScale(2); - layer->setVisibleLayerRect(IntRect(0, 0, 200, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 200, 200)); EXPECT_FLOAT_RECT_EQ(FloatRect(0, 0, 100, 100), layer->lastNeedsDisplayRect()); // The impl side should get 2x2 tiles now. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 200, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 200, 200), 0); updateTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_TRUE(layerImpl->hasTileAt(0, 0)); @@ -809,8 +809,8 @@ TEST_F(TiledLayerChromiumTest, verifyInvalidationWhenContentsScaleChanges) // impl side. layer->setNeedsDisplay(); layer->setTexturePriorities(priorityCalculator); - layer->updateLayerRect(updater, IntRect(1, 0, 0, 1), 0); - textureManager->prioritizeTextures(0); + layer->updateContentRect(updater, IntRect(1, 0, 0, 1), 0); + textureManager->prioritizeTextures(); layer->pushPropertiesTo(layerImpl.get()); EXPECT_FALSE(layerImpl->hasTileAt(0, 0)); @@ -839,13 +839,13 @@ TEST_F(TiledLayerChromiumTest, skipsDrawGetsReset) rootLayer->addChild(childLayer); rootLayer->setBounds(contentBounds); - rootLayer->setVisibleLayerRect(contentRect); + rootLayer->setVisibleContentRect(contentRect); rootLayer->setPosition(FloatPoint(150, 150)); childLayer->setBounds(contentBounds); - childLayer->setVisibleLayerRect(contentRect); + childLayer->setVisibleContentRect(contentRect); childLayer->setPosition(FloatPoint(150, 150)); - rootLayer->invalidateRect(contentRect); - childLayer->invalidateRect(contentRect); + rootLayer->invalidateContentRect(contentRect); + childLayer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(rootLayer); ccLayerTreeHost->setViewportSize(IntSize(300, 300)); @@ -876,15 +876,15 @@ TEST_F(TiledLayerChromiumTest, resizeToSmaller) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(textureManager.get())); layer->setBounds(IntSize(700, 700)); - layer->setVisibleLayerRect(IntRect(0, 0, 700, 700)); - layer->invalidateRect(IntRect(0, 0, 700, 700)); + layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); + layer->invalidateContentRect(IntRect(0, 0, 700, 700)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); layer->setBounds(IntSize(200, 200)); - layer->invalidateRect(IntRect(0, 0, 200, 200)); + layer->invalidateContentRect(IntRect(0, 0, 200, 200)); } TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) @@ -894,13 +894,13 @@ TEST_F(TiledLayerChromiumTest, hugeLayerUpdateCrash) int size = 1 << 30; layer->setBounds(IntSize(size, size)); - layer->setVisibleLayerRect(IntRect(0, 0, 700, 700)); - layer->invalidateRect(IntRect(0, 0, size, size)); + layer->setVisibleContentRect(IntRect(0, 0, 700, 700)); + layer->invalidateContentRect(IntRect(0, 0, size, size)); // Ensure no crash for bounds where size * size would overflow an int. layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 700, 700), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 700, 700), 0); } TEST_F(TiledLayerChromiumTest, partialUpdates) @@ -922,8 +922,8 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) RefPtr<FakeTiledLayerChromium> layer = adoptRef(new FakeTiledLayerChromium(ccLayerTreeHost->contentsTextureManager())); layer->setBounds(contentBounds); layer->setPosition(FloatPoint(150, 150)); - layer->setVisibleLayerRect(contentRect); - layer->invalidateRect(contentRect); + layer->setVisibleContentRect(contentRect); + layer->invalidateContentRect(contentRect); ccLayerTreeHost->setRootLayer(layer); ccLayerTreeHost->setViewportSize(IntSize(300, 200)); @@ -946,7 +946,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Full update of 3 tiles and partial update of 3 tiles. - layer->invalidateRect(IntRect(0, 0, 300, 150)); + layer->invalidateContentRect(IntRect(0, 0, 300, 150)); ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; @@ -964,7 +964,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 6 tiles. - layer->invalidateRect(IntRect(50, 50, 200, 100)); + layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -982,7 +982,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Checkerboard all tiles. - layer->invalidateRect(IntRect(0, 0, 300, 200)); + layer->invalidateContentRect(IntRect(0, 0, 300, 200)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -991,7 +991,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 6 checkerboard tiles. - layer->invalidateRect(IntRect(50, 50, 200, 100)); + layer->invalidateContentRect(IntRect(50, 50, 200, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -1009,7 +1009,7 @@ TEST_F(TiledLayerChromiumTest, partialUpdates) ccLayerTreeHost->commitComplete(); // Partial update of 4 tiles. - layer->invalidateRect(IntRect(50, 50, 100, 100)); + layer->invalidateContentRect(IntRect(50, 50, 100, 100)); { DebugScopedSetImplThread implThread; OwnPtr<FakeCCTiledLayerImpl> layerImpl(adoptPtr(new FakeCCTiledLayerImpl(1))); @@ -1035,12 +1035,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithoutOcclusion) // The tile size is 100x100, so this invalidates and then paints two tiles. layer->setBounds(IntSize(100, 200)); - layer->setVisibleLayerRect(IntRect(0, 0, 100, 200)); - layer->invalidateRect(IntRect(0, 0, 100, 200)); + layer->setVisibleContentRect(IntRect(0, 0, 100, 200)); + layer->invalidateContentRect(IntRect(0, 0, 100, 200)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 100, 200), 0); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 100, 200), 0); EXPECT_EQ(2, layer->fakeLayerTextureUpdater()->prepareRectCount()); } @@ -1056,12 +1056,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1071,8 +1071,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); occluded.setOcclusion(IntRect(250, 200, 300, 100)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-2, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1082,8 +1082,8 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusion) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); occluded.setOcclusion(IntRect(250, 250, 300, 100)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1104,12 +1104,12 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // The partially occluded tiles (by the 150 occlusion height) are visible beyond the occlusion, so not culled. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 360)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 360)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 360), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 360), &occluded); EXPECT_EQ(24-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1120,11 +1120,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // Now the visible region stops at the edge of the occlusion so the partly visible tiles become fully occluded. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 350)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 350)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 350), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 350), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1135,11 +1135,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndVisiblityConstraints) // Now the visible region is even smaller than the occlusion, it should have the same result. occluded.setOcclusion(IntRect(200, 200, 300, 150)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 340)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 340)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 340), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 340), &occluded); EXPECT_EQ(24-6, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1160,11 +1160,11 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(0, 0, 600, 600)); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(0, 0, 600, 600)); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); updateTextures(); @@ -1175,7 +1175,7 @@ TEST_F(TiledLayerChromiumTest, tilesNotPaintedWithoutInvalidation) layer->fakeLayerTextureUpdater()->clearPrepareRectCount(); // Repaint without marking it dirty. The 3 culled tiles will be pre-painted now. - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1200,11 +1200,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndTransforms) layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 50)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(36-3, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1228,11 +1228,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(200, 200, 300, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); // The content is half the size of the layer (so the number of tiles is fewer). // In this case, the content is 300x300, and since the tile size is 100, the // number of tiles 3x3. @@ -1248,11 +1248,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) // a different layer space. In this case the occluded region catches the // blown up tiles. occluded.setOcclusion(IntRect(200, 200, 300, 200)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1268,11 +1268,11 @@ TEST_F(TiledLayerChromiumTest, tilesPaintedWithOcclusionAndScaling) layer->setDrawTransform(screenTransform * WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); occluded.setOcclusion(IntRect(100, 100, 150, 100)); - layer->setVisibleLayerRect(IntRect(IntPoint(), layer->bounds())); - layer->invalidateRect(IntRect(0, 0, 600, 600)); + layer->setVisibleContentRect(IntRect(IntPoint(), layer->bounds())); + layer->invalidateContentRect(IntRect(0, 0, 600, 600)); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); - layer->updateLayerRect(updater, IntRect(0, 0, 600, 600), &occluded); + textureManager->prioritizeTextures(); + layer->updateContentRect(updater, IntRect(0, 0, 600, 600), &occluded); EXPECT_EQ(9-1, layer->fakeLayerTextureUpdater()->prepareRectCount()); EXPECT_NEAR(occluded.overdrawMetrics().pixelsUploadedOpaque(), 0, 1); @@ -1296,16 +1296,16 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) layer->setBounds(contentBounds.size()); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(visibleBounds); + layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // If the layer doesn't paint opaque content, then the visibleContentOpaqueRegion should be empty. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1317,8 +1317,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // visibleContentOpaqueRegion should match the visible part of what is painted opaque. opaquePaintRect = IntRect(10, 10, 90, 190); layer->fakeLayerTextureUpdater()->setOpaquePaintRect(opaquePaintRect); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1331,7 +1331,7 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we paint again without invalidating, the same stuff should be opaque. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1345,8 +1345,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we repaint a non-opaque part of the tile, then it shouldn't lose its opaque-ness. And other tiles should // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(0, 0, 1, 1)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(opaquePaintRect, visibleBounds), opaqueContents.bounds()); @@ -1360,8 +1360,8 @@ TEST_F(TiledLayerChromiumTest, visibleContentOpaqueRegion) // If we repaint an opaque part of the tile, then it should lose its opaque-ness. But other tiles should still // not be affected. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(10, 10, 1, 1)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(10, 10, 1, 1)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_EQ_RECT(intersection(IntRect(10, 100, 90, 100), visibleBounds), opaqueContents.bounds()); @@ -1389,16 +1389,16 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) layer->setBounds(contentBounds.size()); layer->setDrawTransform(WebTransformationMatrix(1, 0, 0, 1, layer->bounds().width() / 2.0, layer->bounds().height() / 2.0)); - layer->setVisibleLayerRect(visibleBounds); + layer->setVisibleContentRect(visibleBounds); layer->setDrawOpacity(1); layer->setTexturePriorities(priorityCalculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Invalidates and paints the whole layer. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(contentBounds); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(contentBounds); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1411,9 +1411,9 @@ TEST_F(TiledLayerChromiumTest, pixelsPaintedMetrics) // Invalidates an area on the top and bottom tile, which will cause us to paint the tile in the middle, // even though it is not dirty and will not be uploaded. layer->fakeLayerTextureUpdater()->setOpaquePaintRect(IntRect()); - layer->invalidateRect(IntRect(0, 0, 1, 1)); - layer->invalidateRect(IntRect(50, 200, 10, 10)); - layer->updateLayerRect(updater, contentBounds, &occluded); + layer->invalidateContentRect(IntRect(0, 0, 1, 1)); + layer->invalidateContentRect(IntRect(50, 200, 10, 10)); + layer->updateContentRect(updater, contentBounds, &occluded); updateTextures(); opaqueContents = layer->visibleContentOpaqueRegion(); EXPECT_TRUE(opaqueContents.isEmpty()); @@ -1448,7 +1448,7 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca root->setBounds(rootRect.size()); root->setAnchorPoint(FloatPoint()); - root->setVisibleLayerRect(rootRect); + root->setVisibleContentRect(rootRect); root->addChild(surface); surface->setForceRenderSurface(true); @@ -1460,20 +1460,20 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca child->setBounds(childRect.size()); child->setAnchorPoint(FloatPoint()); child->setPosition(childRect.location()); - child->setVisibleLayerRect(childRect); + child->setVisibleContentRect(childRect); child2->setBounds(child2Rect.size()); child2->setAnchorPoint(FloatPoint()); child2->setPosition(child2Rect.location()); - child2->setVisibleLayerRect(child2Rect); + child2->setVisibleContentRect(child2Rect); ccLayerTreeHost->setRootLayer(root); ccLayerTreeHost->setViewportSize(rootRect.size()); // With a huge memory limit, all layers should update and push their textures. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, std::numeric_limits<size_t>::max()); { DebugScopedSetImplThread implThread; @@ -1506,9 +1506,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca // With a memory limit that includes only the root layer (3x2 tiles) and half the surface that // the child layers draw into, the child layers will not be allocated. If the surface isn't // accounted for, then one of the children would fit within the memory limit. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, (3 * 2 + 3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; @@ -1542,9 +1542,9 @@ TEST_F(TiledLayerChromiumTest, dontAllocateContentsWhenTargetSurfaceCantBeAlloca // allocated. If render surface memory wasn't accounted for, there is enough space // for one of the children layers, but they draw into a surface that can't be // allocated. - root->invalidateRect(rootRect); - child->invalidateRect(childRect); - child2->invalidateRect(child2Rect); + root->invalidateContentRect(rootRect); + child->invalidateContentRect(childRect); + child2->invalidateContentRect(child2Rect); ccLayerTreeHost->updateLayers(updater, (3 * 1) * (100 * 100) * 4); { DebugScopedSetImplThread implThread; @@ -1633,13 +1633,13 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) IntRect contentRect(0, 0, 45, 47); EXPECT_EQ(contentRect.size(), layer->contentBounds()); - layer->setVisibleLayerRect(contentRect); + layer->setVisibleContentRect(contentRect); layer->setTexturePriorities(calculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1647,8 +1647,8 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringPaint) updateTextures(); // Invalidate the entire layer in content space. When painting, the rect given to webkit should match the layer's bounds. - layer->invalidateRect(contentRect); - layer->updateLayerRect(updater, contentRect, 0); + layer->invalidateContentRect(contentRect); + layer->updateContentRect(updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } @@ -1666,13 +1666,13 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali layer->setContentsScale(1.3); IntRect contentRect(IntPoint(), layer->contentBounds()); - layer->setVisibleLayerRect(contentRect); + layer->setVisibleContentRect(contentRect); layer->setTexturePriorities(calculator); - textureManager->prioritizeTextures(0); + textureManager->prioritizeTextures(); // Update the whole tile. - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); layer->trackingLayerPainter()->resetPaintedRect(); EXPECT_INT_RECT_EQ(IntRect(), layer->trackingLayerPainter()->paintedRect()); @@ -1681,7 +1681,7 @@ TEST_F(TiledLayerChromiumTest, nonIntegerContentsScaleIsNotDistortedDuringInvali // Invalidate the entire layer in layer space. When painting, the rect given to webkit should match the layer's bounds. layer->setNeedsDisplayRect(layerRect); - layer->updateLayerRect(updater, contentRect, 0); + layer->updateContentRect(updater, contentRect, 0); EXPECT_INT_RECT_EQ(layerRect, layer->trackingLayerPainter()->paintedRect()); } diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.cpp b/Source/WebKit/chromium/tests/URLTestHelpers.cpp new file mode 100644 index 000000000..b2e6039d1 --- /dev/null +++ b/Source/WebKit/chromium/tests/URLTestHelpers.cpp @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "URLTestHelpers.h" + +#include "platform/WebURLResponse.h" +#include <public/WebString.h> +#include <public/WebURL.h> +#include <webkit/support/webkit_support.h> + +namespace WebKit { +namespace URLTestHelpers { + +void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType) +{ + // fullURL = baseURL + fileName. + std::string fullString = std::string(baseURL.utf8().data()) + std::string(fileName.utf8().data()); + registerMockedURLLoad(toKURL(fullString.c_str()), fileName, WebString::fromUTF8(""), mimeType); +} + +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType) +{ + registerMockedURLLoad(fullURL, fileName, WebString::fromUTF8(""), mimeType); +} + +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType) +{ + WebURLResponse response; + response.initialize(); + response.setMIMEType(mimeType); + response.setHTTPStatusCode(200); + + // Physical file path for the mock = <webkitRootDir> + relativeBaseDirectory + fileName. + std::string filePath = std::string(webkit_support::GetWebKitRootDir().utf8().data()); + filePath.append("/Source/WebKit/chromium/tests/data/"); + filePath.append(std::string(relativeBaseDirectory.utf8().data())); + filePath.append(std::string(fileName.utf8().data())); + + webkit_support::RegisterMockedURL(fullURL, response, WebString::fromUTF8(filePath.c_str())); +} + +} // namespace URLTestHelpers +} // namespace WebKit diff --git a/Source/WebKit/chromium/tests/URLTestHelpers.h b/Source/WebKit/chromium/tests/URLTestHelpers.h new file mode 100644 index 000000000..0b9fb00bb --- /dev/null +++ b/Source/WebKit/chromium/tests/URLTestHelpers.h @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2012 Google Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are + * met: + * + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above + * copyright notice, this list of conditions and the following disclaimer + * in the documentation and/or other materials provided with the + * distribution. + * * Neither the name of Google Inc. nor the names of its + * contributors may be used to endorse or promote products derived from + * this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef URLTestHelpers_h +#define URLTestHelpers_h + +#include "KURL.h" +#include <public/WebString.h> + +namespace WebKit { + +class WebURL; + +namespace URLTestHelpers { + +inline WebCore::KURL toKURL(const std::string& url) +{ + WTF::String wtfString(url.c_str()); + return WebCore::KURL(WebCore::ParsedURLString, wtfString); +} + +// Helper functions for mock URLs. These functions set up the desired URL and mimeType, with a 200 OK return status. +// For the mock URL, fullURL == baseURL + fileName. +// For the actual file path: <WebKit root directory> + relativeBaseDirectory + fileName, +// or, if the relative base directory is not specified: <WebKit root directory> + fileName. +// +void registerMockedURLFromBaseURL(const WebString& baseURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html")); +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& mimeType = WebString::fromUTF8("text/html")); +void registerMockedURLLoad(const WebURL& fullURL, const WebString& fileName, const WebString& relativeBaseDirectory, const WebString& mimeType); + +} // namespace URLTestHelpers +} // namespace WebKit + +#endif diff --git a/Source/WebKit/chromium/tests/WebFrameTest.cpp b/Source/WebKit/chromium/tests/WebFrameTest.cpp index 6b14cff0f..9b745e029 100644 --- a/Source/WebKit/chromium/tests/WebFrameTest.cpp +++ b/Source/WebKit/chromium/tests/WebFrameTest.cpp @@ -36,6 +36,7 @@ #include "FrameTestHelpers.h" #include "FrameView.h" #include "ResourceError.h" +#include "URLTestHelpers.h" #include "WebDataSource.h" #include "WebDocument.h" #include "WebFindOptions.h" @@ -55,6 +56,7 @@ #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -73,12 +75,12 @@ public: void registerMockedHttpURLLoad(const std::string& fileName) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(fileName.c_str())); } void registerMockedChromeURLLoad(const std::string& fileName) { - FrameTestHelpers::registerMockedURLLoad(m_chromeURL, fileName); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_chromeURL.c_str()), WebString::fromUTF8(fileName.c_str())); } protected: @@ -96,7 +98,7 @@ TEST_F(WebFrameTest, ContentText) WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "iframes_test.html"); // Now retrieve the frames text and test it only includes visible elements. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find(" visible paragraph")); EXPECT_NE(std::string::npos, content.find(" visible iframe")); EXPECT_EQ(std::string::npos, content.find(" invisible pararaph")); @@ -156,7 +158,7 @@ TEST_F(WebFrameTest, ChromePageJavascript) webView->layout(); // Now retrieve the frame's text and ensure it was modified by running javascript. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find("Clobbered")); } @@ -175,7 +177,7 @@ TEST_F(WebFrameTest, ChromePageNoJavascript) webView->layout(); // Now retrieve the frame's text and ensure it wasn't modified by running javascript. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_EQ(std::string::npos, content.find("Clobbered")); } @@ -187,7 +189,7 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "postmessage_test.html", true); // Send a message with the correct origin. - WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(GURL(m_baseURL))); + WebSecurityOrigin correctOrigin(WebSecurityOrigin::create(toKURL(m_baseURL))); WebDOMEvent event = webView->mainFrame()->document().createEvent("MessageEvent"); WebDOMMessageEvent message = event.to<WebDOMMessageEvent>(); WebSerializedScriptValue data(WebSerializedScriptValue::fromString("foo")); @@ -195,14 +197,14 @@ TEST_F(WebFrameTest, DispatchMessageEventWithOriginCheck) webView->mainFrame()->dispatchMessageEventWithOriginCheck(correctOrigin, message); // Send another message with incorrect origin. - WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(GURL(m_chromeURL))); + WebSecurityOrigin incorrectOrigin(WebSecurityOrigin::create(toKURL(m_chromeURL))); webView->mainFrame()->dispatchMessageEventWithOriginCheck(incorrectOrigin, message); // Required to see any updates in contentAsText. webView->layout(); // Verify that only the first addition is in the body of the page. - std::string content = webView->mainFrame()->contentAsText(1024).utf8(); + std::string content = std::string(webView->mainFrame()->contentAsText(1024).utf8().data()); EXPECT_NE(std::string::npos, content.find("Message 1.")); EXPECT_EQ(std::string::npos, content.find("Message 2.")); } @@ -441,13 +443,13 @@ TEST_F(WebFrameTest, ReloadWithOverrideURLPreservesState) float previousScale = webViewImpl->pageScaleFactor(); // Reload the page using the cache. - webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + secondURL), false); + webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + secondURL), false); webkit_support::ServeAsynchronousMockedRequests(); ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); // Reload the page while ignoring the cache. - webViewImpl->mainFrame()->reloadWithOverrideURL(GURL(m_baseURL + thirdURL), true); + webViewImpl->mainFrame()->reloadWithOverrideURL(toKURL(m_baseURL + thirdURL), true); webkit_support::ServeAsynchronousMockedRequests(); ASSERT_EQ(previousOffset, webViewImpl->mainFrame()->scrollOffset()); ASSERT_EQ(previousScale, webViewImpl->pageScaleFactor()); @@ -469,8 +471,8 @@ TEST_F(WebFrameTest, IframeRedirect) WebVector<WebURL> redirects; iframeDataSource->redirectChain(redirects); ASSERT_EQ(2U, redirects.size()); - EXPECT_EQ(GURL("about:blank"), GURL(redirects[0])); - EXPECT_EQ(GURL("http://www.test.com/visible_iframe.html"), GURL(redirects[1])); + EXPECT_EQ(toKURL("about:blank"), toKURL(redirects[0].spec().data())); + EXPECT_EQ(toKURL("http://www.test.com/visible_iframe.html"), toKURL(redirects[1].spec().data())); webView->close(); } @@ -731,19 +733,19 @@ TEST_F(WebFrameTest, GetContentAsPlainText) // Generate a simple test case. const char simpleSource[] = "<div>Foo bar</div><div></div>baz"; - GURL testURL("about:blank"); + WebCore::KURL testURL = toKURL("about:blank"); frame->loadHTMLString(simpleSource, testURL); webkit_support::RunAllPendingMessages(); // Make sure it comes out OK. const std::string expected("Foo bar\nbaz"); WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ(expected, std::string(text.utf8())); + EXPECT_EQ(expected, std::string(text.utf8().data())); // Try reading the same one with clipping of the text. const int length = 5; text = frame->contentAsText(length); - EXPECT_EQ(expected.substr(0, length), std::string(text.utf8())); + EXPECT_EQ(expected.substr(0, length), std::string(text.utf8().data())); // Now do a new test with a subframe. const char outerFrameSource[] = "Hello<iframe></iframe> world"; @@ -757,12 +759,12 @@ TEST_F(WebFrameTest, GetContentAsPlainText) webkit_support::RunAllPendingMessages(); text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8())); + EXPECT_EQ("Hello world\n\nsub\ntext", std::string(text.utf8().data())); // Get the frame text where the subframe separator falls on the boundary of // what we'll take. There used to be a crash in this case. text = frame->contentAsText(12); - EXPECT_EQ("Hello world", std::string(text.utf8())); + EXPECT_EQ("Hello world", std::string(text.utf8().data())); webView->close(); } @@ -774,23 +776,23 @@ TEST_F(WebFrameTest, GetFullHtmlOfPage) // Generate a simple test case. const char simpleSource[] = "<p>Hello</p><p>World</p>"; - GURL testURL("about:blank"); + WebCore::KURL testURL = toKURL("about:blank"); frame->loadHTMLString(simpleSource, testURL); webkit_support::RunAllPendingMessages(); WebString text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data())); - const std::string html = frame->contentAsMarkup().utf8(); + const std::string html = std::string(frame->contentAsMarkup().utf8().data()); // Load again with the output html. - frame->loadHTMLString(html, testURL); + frame->loadHTMLString(WebData(html.c_str(), html.length()), testURL); webkit_support::RunAllPendingMessages(); - EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8())); + EXPECT_EQ(html, std::string(frame->contentAsMarkup().utf8().data())); text = frame->contentAsText(std::numeric_limits<size_t>::max()); - EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8())); + EXPECT_EQ("Hello\n\nWorld", std::string(text.utf8().data())); // Test selection check EXPECT_FALSE(frame->hasSelection()); diff --git a/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp b/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp index 5c3ba98a0..3ea4fcf9e 100644 --- a/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp +++ b/Source/WebKit/chromium/tests/WebPageNewSerializerTest.cpp @@ -30,6 +30,7 @@ #include "config.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "WebPageSerializer.h" @@ -41,11 +42,12 @@ #include "platform/WebURLResponse.h" #include "WebView.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; +using WebKit::URLTestHelpers::registerMockedURLLoad; namespace { @@ -110,41 +112,29 @@ protected: m_webView->close(); } - void registerMockedURLLoad(const WebURL& url, const WebString& fileName, const WebString& mimeType) - { - WebURLResponse response; - response.initialize(); - response.setMIMEType(mimeType); - response.setHTTPStatusCode(200); - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath.append("/Source/WebKit/chromium/tests/data/pageserializer/"); - filePath.append(fileName.utf8()); - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); - } - WebURL setUpCSSTestPage() { - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), cssMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("css_test_page.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/link_styles.css"), WebString::fromUTF8("link_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/import_style_from_link.css"), WebString::fromUTF8("import_style_from_link.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/import_styles.css"), WebString::fromUTF8("import_styles.css"), WebString::fromUTF8("pageserializer/"), cssMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/yellow_background.png"), WebString::fromUTF8("yellow_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/purple_background.png"), WebString::fromUTF8("purple_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/ul-dot.png"), WebString::fromUTF8("ul-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/ol-dot.png"), WebString::fromUTF8("ol-dot.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); return topFrameURL; } - void loadURLInTopFrame(const GURL& url) + void loadURLInTopFrame(const WebURL& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(url)); + urlRequest.setURL(url); m_webView->mainFrame()->loadRequest(urlRequest); // Make sure any pending request get served. webkit_support::ServeAsynchronousMockedRequests(); @@ -161,7 +151,7 @@ protected: static bool resourceVectorContains(const WebVector<WebPageSerializer::Resource>& resources, const char* url, const char* mimeType) { - WebURL webURL = WebURL(GURL(url)); + WebURL webURL = WebURL(toKURL(url)); for (size_t i = 0; i < resources.size(); ++i) { const WebPageSerializer::Resource& resource = resources[i]; if (resource.url == webURL && !resource.data.isEmpty() && !resource.mimeType.compare(WebCString(mimeType))) @@ -184,13 +174,13 @@ private: TEST_F(WebPageNewSerializeTest, PageWithFrames) { // Register the mocked frames. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/iframe.html"), WebString::fromUTF8("iframe.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/iframe2.html"), WebString::fromUTF8("iframe2.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/green_background.png"), WebString::fromUTF8("green_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); loadURLInTopFrame(topFrameURL); @@ -200,7 +190,7 @@ TEST_F(WebPageNewSerializeTest, PageWithFrames) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -227,7 +217,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -249,11 +239,11 @@ TEST_F(WebPageNewSerializeTest, FAILS_CSSResources) TEST_F(WebPageNewSerializeTest, BlankFrames) { // Register the mocked frame and load it. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), htmlMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), pngMimeType()); - registerMockedURLLoad(GURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), pngMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("blank_frames.html"), WebString::fromUTF8("pageserializer/"), htmlMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/red_background.png"), WebString::fromUTF8("red_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/orange_background.png"), WebString::fromUTF8("orange_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); + registerMockedURLLoad(toKURL("http://www.test.com/blue_background.png"), WebString::fromUTF8("blue_background.png"), WebString::fromUTF8("pageserializer/"), pngMimeType()); loadURLInTopFrame(topFrameURL); @@ -263,7 +253,7 @@ TEST_F(WebPageNewSerializeTest, BlankFrames) // The first resource should be the main-frame. const WebPageSerializer::Resource& resource = resources[0]; - EXPECT_TRUE(resource.url == GURL("http://www.test.com")); + EXPECT_TRUE(resource.url == WebURL(toKURL("http://www.test.com"))); EXPECT_EQ(0, resource.mimeType.compare(WebCString("text/html"))); EXPECT_FALSE(resource.data.isEmpty()); @@ -279,8 +269,8 @@ TEST_F(WebPageNewSerializeTest, BlankFrames) TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) { - WebURL topFrameURL = GURL("http://www.test.com/simple.xhtml"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), xhtmlMimeType()); + WebURL topFrameURL = toKURL("http://www.test.com/simple.xhtml"); + registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple.xhtml"), WebString::fromUTF8("pageserializer/"), xhtmlMimeType()); loadURLInTopFrame(topFrameURL); @@ -290,7 +280,7 @@ TEST_F(WebPageNewSerializeTest, SerializeXMLHasRightDeclaration) // We expect only one resource, the XML. ASSERT_EQ(1U, resources.size()); - std::string xml = resources[0].data; + std::string xml = std::string(resources[0].data.data()); // We should have one and only one instance of the XML declaration. size_t pos = xml.find("<?xml version="); @@ -310,7 +300,7 @@ TEST_F(WebPageNewSerializeTest, FAILS_TestMHTMLEncoding) ASSERT_FALSE(mhtmlData.isEmpty()); // Read the MHTML data line per line and do some pseudo-parsing to make sure the right encoding is used for the different sections. - LineReader lineReader(mhtmlData); + LineReader lineReader(std::string(mhtmlData.data())); int sectionCheckedCount = 0; const char* expectedEncoding = 0; std::string line; diff --git a/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp b/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp index aa0c6dc2a..feb5f7f6f 100644 --- a/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp +++ b/Source/WebKit/chromium/tests/WebPageSerializerTest.cpp @@ -31,6 +31,7 @@ #include "config.h" #include "WebPageSerializer.h" +#include "URLTestHelpers.h" #include "WebFrame.h" #include "WebFrameClient.h" #include "platform/WebString.h" @@ -39,11 +40,11 @@ #include "platform/WebURLResponse.h" #include "WebView.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -73,22 +74,16 @@ protected: m_webView->close(); } - void registerMockedURLLoad(const WebURL& url, const WebString& fileName) + void registerMockedURLLoad(const std::string& url, const WebString& fileName) { - WebURLResponse response; - response.initialize(); - response.setMIMEType("text/html"); - std::string filePath = webkit_support::GetWebKitRootDir().utf8(); - filePath.append("/Source/WebKit/chromium/tests/data/pageserialization/"); - filePath.append(fileName.utf8()); - webkit_support::RegisterMockedURL(url, response, WebString::fromUTF8(filePath)); + URLTestHelpers::registerMockedURLLoad(toKURL(url), fileName, WebString::fromUTF8("pageserialization/"), WebString::fromUTF8("text/html")); } - void loadURLInTopFrame(const GURL& url) + void loadURLInTopFrame(const WebURL& url) { WebURLRequest urlRequest; urlRequest.initialize(); - urlRequest.setURL(WebURL(url)); + urlRequest.setURL(url); m_webView->mainFrame()->loadRequest(urlRequest); // Make sure any pending request get served. webkit_support::ServeAsynchronousMockedRequests(); @@ -96,7 +91,7 @@ protected: static bool webVectorContains(const WebVector<WebURL>& vector, const char* url) { - return vector.contains(WebURL(GURL(url))); + return vector.contains(WebURL(toKURL(std::string(url)))); } // Useful for debugging. @@ -116,8 +111,8 @@ private: TEST_F(WebPageSerializerTest, HTMLNodes) { // Register the mocked frame and load it. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("simple_page.html")); + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("simple_page.html")); loadURLInTopFrame(topFrameURL); // Retrieve all resources. @@ -150,18 +145,18 @@ TEST_F(WebPageSerializerTest, HTMLNodes) TEST_F(WebPageSerializerTest, MultipleFrames) { // Register the mocked frames. - WebURL topFrameURL = GURL("http://www.test.com"); - registerMockedURLLoad(topFrameURL, WebString::fromUTF8("top_frame.html")); - registerMockedURLLoad(GURL("http://www.test.com/simple_iframe.html"), + WebURL topFrameURL = toKURL("http://www.test.com"); + registerMockedURLLoad("http://www.test.com", WebString::fromUTF8("top_frame.html")); + registerMockedURLLoad("http://www.test.com/simple_iframe.html", WebString::fromUTF8("simple_iframe.html")); - registerMockedURLLoad(GURL("http://www.test.com/object_iframe.html"), + registerMockedURLLoad("http://www.test.com/object_iframe.html", WebString::fromUTF8("object_iframe.html")); - registerMockedURLLoad(GURL("http://www.test.com/embed_iframe.html"), + registerMockedURLLoad("http://www.test.com/embed_iframe.html", WebString::fromUTF8("embed_iframe.html")); // If we don't register a mocked resource for awesome.png, it causes the // document loader of the iframe that has it as its src to assert on close, // not sure why. - registerMockedURLLoad(GURL("http://www.test.com/awesome.png"), + registerMockedURLLoad("http://www.test.com/awesome.png", WebString::fromUTF8("awesome.png")); loadURLInTopFrame(topFrameURL); diff --git a/Source/WebKit/chromium/tests/WebViewTest.cpp b/Source/WebKit/chromium/tests/WebViewTest.cpp index 7903721d9..33ce2f70c 100644 --- a/Source/WebKit/chromium/tests/WebViewTest.cpp +++ b/Source/WebKit/chromium/tests/WebViewTest.cpp @@ -35,6 +35,7 @@ #include "FrameTestHelpers.h" #include "FrameView.h" #include "HTMLDocument.h" +#include "URLTestHelpers.h" #include "WebDocument.h" #include "WebFrame.h" #include "WebFrameClient.h" @@ -42,11 +43,11 @@ #include "platform/WebSize.h" #include "WebViewClient.h" #include "WebViewImpl.h" -#include <googleurl/src/gurl.h> #include <gtest/gtest.h> #include <webkit/support/webkit_support.h> using namespace WebKit; +using WebKit::URLTestHelpers::toKURL; namespace { @@ -140,7 +141,7 @@ protected: TEST_F(WebViewTest, FocusIsInactive) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); webView->setFocus(true); @@ -168,7 +169,7 @@ TEST_F(WebViewTest, FocusIsInactive) TEST_F(WebViewTest, ActiveState) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "visible_iframe.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), "visible_iframe.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "visible_iframe.html"); ASSERT_TRUE(webView); @@ -192,7 +193,7 @@ void WebViewTest::testAutoResize(const WebSize& minAutoResize, const WebSize& ma { AutoResizeWebViewClient client; std::string url = m_baseURL + "specify_size.html?" + pageWidth + ":" + pageHeight; - FrameTestHelpers::registerMockedURLLoad(GURL(url), "specify_size.html"); + URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); WebView* webView = FrameTestHelpers::createWebViewAndLoad(url, true, 0, &client); client.testData().setWebView(webView); @@ -291,7 +292,7 @@ TEST_F(WebViewTest, AutoResizeMaxSize) void WebViewTest::testTextInputType(WebTextInputType expectedType, const std::string& htmlFile) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, htmlFile); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8(htmlFile.c_str())); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + htmlFile); webView->setInitialFocus(false); EXPECT_EQ(expectedType, webView->textInputType()); @@ -331,7 +332,7 @@ TEST_F(WebViewTest, DISABLED_TextInputType) TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) { - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_populated.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_populated.html")); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_populated.html"); webView->setInitialFocus(false); webView->setEditableSelectionOffsets(5, 13); @@ -345,7 +346,7 @@ TEST_F(WebViewTest, SetEditableSelectionOffsetsAndTextInputInfo) EXPECT_EQ(-1, info.compositionEnd); webView->close(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "content_editable_populated.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("content_editable_populated.html")); webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "content_editable_populated.html"); webView->setInitialFocus(false); webView->setEditableSelectionOffsets(8, 19); @@ -364,12 +365,12 @@ TEST_F(WebViewTest, FormChange) { FormChangeWebViewClient client; client.reset(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_set_value_while_focused.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_set_value_while_focused.html")); WebView* webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_set_value_while_focused.html", true, 0, &client); EXPECT_TRUE(client.called()); EXPECT_TRUE(client.focused()); client.reset(); - FrameTestHelpers::registerMockedURLLoad(m_baseURL, "input_field_set_value_while_not_focused.html"); + URLTestHelpers::registerMockedURLFromBaseURL(WebString::fromUTF8(m_baseURL.c_str()), WebString::fromUTF8("input_field_set_value_while_not_focused.html")); webView = FrameTestHelpers::createWebViewAndLoad(m_baseURL + "input_field_set_value_while_not_focused.html", true, 0, &client); EXPECT_TRUE(client.called()); EXPECT_FALSE(client.focused()); diff --git a/Source/WebKit/efl/ChangeLog b/Source/WebKit/efl/ChangeLog index 141f8bf1b..7c379dcee 100644 --- a/Source/WebKit/efl/ChangeLog +++ b/Source/WebKit/efl/ChangeLog @@ -1,3 +1,38 @@ +2012-07-13 Kihong Kwon <kihong.kwon@samsung.com> + + [EFL] Add const to the parameter of getters in ewk_security_origin + https://bugs.webkit.org/show_bug.cgi?id=90954 + + Reviewed by Kentaro Hara. + + Move initialization of strings for protocol and host to the ewk_security_origin_new method, + which allows to add const qualifier for ewk_security_origin_protocol_get and ewk_security_origin_host_get. + In addition, add null checks to the getters. + + * ewk/ewk_security_origin.cpp: + (ewk_security_origin_protocol_get): + (ewk_security_origin_host_get): + (ewk_security_origin_new): + * ewk/ewk_security_origin.h: + +2012-07-13 Gyuyoung Kim <gyuyoung.kim@samsung.com> + + [EFL] Add *explicit* keyword to constructor which has a parameter + https://bugs.webkit.org/show_bug.cgi?id=91207 + + Reviewed by Zoltan Herczeg. + + Add *explicit* keyword to contructor which has a parameter in order to avoid implicit type conversion. + + * WebCoreSupport/EditorClientEfl.h: + (EditorClientEfl): + * WebCoreSupport/InspectorClientEfl.h: + (InspectorClientEfl): + * WebCoreSupport/PageClientEfl.h: + (PageClientEfl): + * WebCoreSupport/VibrationClientEfl.h: + (VibrationClientEfl): + 2012-07-10 Adam Barth <abarth@webkit.org> LayoutTestController.dumpConfigurationForViewport should move to Internals diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h index d1feeb477..2a8ff4fe4 100644 --- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.h @@ -77,7 +77,7 @@ protected: WTF::Deque<WTF::RefPtr<WebCore::UndoStep> > redoStack; public: - EditorClientEfl(Evas_Object *view); + explicit EditorClientEfl(Evas_Object* view); ~EditorClientEfl(); // from EditorClient diff --git a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h index b6a078e72..6b71c4dc5 100644 --- a/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/InspectorClientEfl.h @@ -43,7 +43,7 @@ class Page; class InspectorClientEfl : public InspectorClient { public: - InspectorClientEfl(Evas_Object*); + explicit InspectorClientEfl(Evas_Object*); ~InspectorClientEfl(); virtual void inspectorDestroyed(); diff --git a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h index 6f98d701c..8ba75443c 100644 --- a/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/PageClientEfl.h @@ -31,7 +31,7 @@ class GraphicsContext3D; class PageClientEfl { public: - PageClientEfl(Evas_Object* view); + explicit PageClientEfl(Evas_Object* view); virtual ~PageClientEfl(); #if USE(ACCELERATED_COMPOSITING) diff --git a/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h b/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h index e7b0d925a..7d2f8fd8f 100644 --- a/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h +++ b/Source/WebKit/efl/WebCoreSupport/VibrationClientEfl.h @@ -27,7 +27,7 @@ namespace WebCore { class VibrationClientEfl : public VibrationClient { public: - VibrationClientEfl(Evas_Object* view); + explicit VibrationClientEfl(Evas_Object* view); virtual ~VibrationClientEfl() { } virtual void vibrate(const unsigned long& time); diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.cpp b/Source/WebKit/efl/ewk/ewk_security_origin.cpp index 66064a029..076158663 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.cpp +++ b/Source/WebKit/efl/ewk/ewk_security_origin.cpp @@ -39,19 +39,15 @@ struct _Ewk_Security_Origin { const char* host; }; -const char* ewk_security_origin_protocol_get(Ewk_Security_Origin* origin) +const char* ewk_security_origin_protocol_get(const Ewk_Security_Origin* origin) { - if (!origin->protocol) - origin->protocol = eina_stringshare_add(origin->securityOrigin->protocol().utf8().data()); - + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); return origin->protocol; } -const char* ewk_security_origin_host_get(Ewk_Security_Origin* origin) +const char* ewk_security_origin_host_get(const Ewk_Security_Origin* origin) { - if (!origin->host) - origin->host = eina_stringshare_add(origin->securityOrigin->host().utf8().data()); - + EINA_SAFETY_ON_NULL_RETURN_VAL(origin, 0); return origin->host; } @@ -142,8 +138,8 @@ Ewk_Security_Origin* ewk_security_origin_new(WebCore::SecurityOrigin* coreOrigin Ewk_Security_Origin* origin = new Ewk_Security_Origin; origin->securityOrigin = coreOrigin; - origin->host = 0; - origin->protocol = 0; + origin->protocol = eina_stringshare_add(coreOrigin->protocol().utf8().data()); + origin->host = eina_stringshare_add(coreOrigin->host().utf8().data()); return origin; } diff --git a/Source/WebKit/efl/ewk/ewk_security_origin.h b/Source/WebKit/efl/ewk/ewk_security_origin.h index 98abf769a..2d9ea4675 100644 --- a/Source/WebKit/efl/ewk/ewk_security_origin.h +++ b/Source/WebKit/efl/ewk/ewk_security_origin.h @@ -49,9 +49,9 @@ typedef struct _Ewk_Security_Origin Ewk_Security_Origin; * It returns a internal string which should not * be modified. The string is guaranteed to be stringshared. * - * @return the protocol scheme + * @return the protocol scheme or @c 0 if there is not a protocol scheme */ -EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_protocol_get(const Ewk_Security_Origin *o); /** * Returns the host of the security origin. @@ -61,9 +61,9 @@ EAPI const char *ewk_security_origin_protocol_get(Ewk_Security_Origin * * * @param o security origin object * - * @return the host domain + * @return the host domain or @c 0 if there is not a host scheme */ -EAPI const char *ewk_security_origin_host_get(Ewk_Security_Origin *o); +EAPI const char *ewk_security_origin_host_get(const Ewk_Security_Origin *o); /** * Returns the port of the security origin. diff --git a/Source/WebKit/mac/ChangeLog b/Source/WebKit/mac/ChangeLog index c89cbcf1f..25de1125e 100644 --- a/Source/WebKit/mac/ChangeLog +++ b/Source/WebKit/mac/ChangeLog @@ -1,3 +1,137 @@ +2012-07-14 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Do not try to update the cache model for every WebPreferences change + https://bugs.webkit.org/show_bug.cgi?id=91302 + + Reviewed by Joseph Pecoraro. + + WebView was listening to any change on any WebPreferences in order to update the cache model. This is unneeded in most cases, + we can just listen to updates of the CacheModel property. + + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences _postCacheModelChangedNotification]): + (-[WebPreferences setCacheModel:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (+[WebView initialize]): + (+[WebView _cacheModelChangedNotification:]): + +2012-07-14 Sheriff Bot <webkit.review.bot@gmail.com> + + Unreviewed, rolling out r122665. + http://trac.webkit.org/changeset/122665 + https://bugs.webkit.org/show_bug.cgi?id=91321 + + Broke Mac builds (Requested by rniwa on #webkit). + + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences setCacheModel:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (+[WebView initialize]): + (+[WebView _preferencesChangedNotification:]): + +2012-07-13 Benjamin Poulain <bpoulain@apple.com> + + [Mac] Do not try to update the cache model for every WebPreferences change + https://bugs.webkit.org/show_bug.cgi?id=91302 + + Reviewed by Joseph Pecoraro. + + WebView was listening to any change on any WebPreferences in order to update the cache model. This is unneeded in most cases, + we can just listen to updates of the CacheModel property. + + * WebView/WebPreferences.mm: + (-[WebPreferences initWithIdentifier:]): + (-[WebPreferences _postCacheModelChangedNotification]): + (-[WebPreferences setCacheModel:]): + * WebView/WebPreferencesPrivate.h: + * WebView/WebView.mm: + (+[WebView initialize]): + (+[WebView _cacheModelChangedNotification:]): + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Fix a logic error in the #if so that the correct code is compiled on Snow Leopard. + + I introduced this in r122403 when I inverted the sense of the #if. + + * WebView/WebFullScreenController.mm: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91024> Build against the latest SDK when targeting older OS X versions. + + Reviewed by Dan Bernstein. + + The deployment target is already set to the version that we're targeting, and it's that setting + which determines which functionality from the SDK is available to us. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91022> WebFullScreenController and WKFullScreenWindowController shouldn't add unprefixed methods to AppKit classes + + Reviewed by Dan Bernstein. + + * WebView/WebFullScreenController.mm: + (convertRectToScreen): Add a static helper method that calls through to -[NSWindow convertRectToScreen:] on OS versions where it exists + but otherwise provides a compatibility implementation of it. + (-[WebFullScreenController enterFullScreen:]): Call our new helper. + +2012-07-11 Mark Rowe <mrowe@apple.com> + + <http://webkit.org/b/91015> Remove BUILDING_ON / TARGETING macros in favor of system availability macros + + This removal was handled by a script that translates the relevant macros in to the equivalent checks + using the system availability macros. + + Reviewed by Filip Pizlo. + + * DefaultDelegates/WebDefaultContextMenuDelegate.mm: + * Misc/WebKitErrors.m: + * Misc/WebNSControlExtras.m: + * Misc/WebNSFileManagerExtras.mm: + * Plugins/Hosted/WebHostedNetscapePluginView.mm: + * Plugins/WebBaseNetscapePluginView.mm: + * Plugins/WebNetscapePluginView.mm: + * WebCoreSupport/WebChromeClient.mm: + * WebCoreSupport/WebEditorClient.mm: + * WebCoreSupport/WebFrameLoaderClient.mm: + * WebCoreSupport/WebSystemInterface.mm: + * WebView/WebClipView.mm: + * WebView/WebDynamicScrollBarsView.mm: + * WebView/WebFrameView.mm: + * WebView/WebFullScreenController.mm: + * WebView/WebHTMLView.mm: + * WebView/WebHTMLViewInternal.h: + * WebView/WebPDFDocumentExtras.mm: + * WebView/WebPreferences.mm: + * WebView/WebResourceInternal.h: + * WebView/WebScriptDebugDelegate.h: + * WebView/WebView.mm: + * WebView/WebViewPrivate.h: + +2012-07-11 Anders Carlsson <andersca@apple.com> + + Add -Wtautological-compare and -Wsign-compare warning flags + https://bugs.webkit.org/show_bug.cgi?id=90994 + + Reviewed by Mark Rowe. + + * Configurations/Base.xcconfig: + +2012-07-11 Mark Rowe <mrowe@apple.com> + + Add a Mountain Lion version of libWebKitSystemInterface.a. + + Reviewed by John Sullivan. + + * Configurations/DebugRelease.xcconfig: Look for the library under its expected name. + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/mac/Configurations/Base.xcconfig b/Source/WebKit/mac/Configurations/Base.xcconfig index e5c0d263b..d35aea68a 100644 --- a/Source/WebKit/mac/Configurations/Base.xcconfig +++ b/Source/WebKit/mac/Configurations/Base.xcconfig @@ -24,7 +24,7 @@ #include "CompilerVersion.xcconfig" COMPILER_SPECIFIC_WARNING_CFLAGS = $(COMPILER_SPECIFIC_WARNING_CFLAGS_$(TARGET_GCC_VERSION)); -COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wglobal-constructors -Wexit-time-destructors; +COMPILER_SPECIFIC_WARNING_CFLAGS_LLVM_COMPILER = -Wexit-time-destructors -Wglobal-constructors -Wtautological-compare; CLANG_WARN_CXX0X_EXTENSIONS = NO; DEBUG_INFORMATION_FORMAT = dwarf-with-dsym; @@ -51,6 +51,7 @@ GCC_WARN_ABOUT_DEPRECATED_FUNCTIONS = NO; GCC_WARN_ABOUT_MISSING_NEWLINE = YES; GCC_WARN_ABOUT_MISSING_PROTOTYPES = YES; GCC_WARN_NON_VIRTUAL_DESTRUCTOR = YES; +GCC_WARN_SIGN_COMPARE = YES; LINKER_DISPLAYS_MANGLED_NAMES = YES; OTHER_MIGFLAGS = -F$(BUILT_PRODUCTS_DIR); PREBINDING = NO; @@ -100,15 +101,12 @@ DEAD_CODE_STRIPPING = YES; SECTORDER_FLAGS = -Wl,-order_file,mac/WebKit.order; -// If the target Mac OS X version does not match the current Mac OS X version then we'll want to build using the target version's SDK. -SDKROOT = $(SDKROOT_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); -SDKROOT_1060_1050 = macosx10.5; -SDKROOT_1070_1050 = macosx10.5; -SDKROOT_1080_1050 = macosx10.5; -SDKROOT_1090_1050 = macosx10.5; -SDKROOT_1070_1060 = macosx10.6; -SDKROOT_1080_1060 = macosx10.6; -SDKROOT_1090_1060 = macosx10.6; -SDKROOT_1080_1070 = macosx10.7; -SDKROOT_1090_1070 = macosx10.7; -SDKROOT_1090_1080 = macosx10.8; +TARGETING_SAME_OS_X_VERSION = $(TARGETING_SAME_OS_X_VERSION_$(MAC_OS_X_VERSION_MAJOR)_$(TARGET_MAC_OS_X_VERSION_MAJOR)); +TARGETING_SAME_OS_X_VERSION_1060_1060 = YES; +TARGETING_SAME_OS_X_VERSION_1070_1070 = YES; +TARGETING_SAME_OS_X_VERSION_1080_1080 = YES; +TARGETING_SAME_OS_X_VERSION_1090_1090 = YES; + +// Don't build against an SDK unless we're targeting an older OS version. +SDKROOT = $(SDKROOT_TARGETING_SAME_OS_X_VERSION_$(TARGETING_SAME_OS_X_VERSION)); +SDKROOT_TARGETING_SAME_OS_X_VERSION_ = macosx; diff --git a/Source/WebKit/mac/Configurations/DebugRelease.xcconfig b/Source/WebKit/mac/Configurations/DebugRelease.xcconfig index eb9259b6d..086c31aa8 100644 --- a/Source/WebKit/mac/Configurations/DebugRelease.xcconfig +++ b/Source/WebKit/mac/Configurations/DebugRelease.xcconfig @@ -57,5 +57,5 @@ WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx = $(WEBKIT_SYSTEM_INTERFACE_LIBRARY_macos WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1050 = WebKitSystemInterfaceLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1060 = WebKitSystemInterfaceSnowLeopard; WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1070 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceLion; -WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceLion; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1080 = WebKitSystemInterfaceMountainLion; +WEBKIT_SYSTEM_INTERFACE_LIBRARY_macosx_1090 = WebKitSystemInterfaceMountainLion; diff --git a/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm b/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm index d3eff92e9..7466618b8 100644 --- a/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm +++ b/Source/WebKit/mac/DefaultDelegates/WebDefaultContextMenuDelegate.mm @@ -89,7 +89,7 @@ action = @selector(_searchWithSpotlightFromMenu:); break; case WebMenuItemTagSearchWeb: { -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 RetainPtr<CFStringRef> searchProviderName(AdoptCF, WKCopyDefaultSearchProviderDisplayName()); title = [NSString stringWithFormat:UI_STRING_INTERNAL("Search with %@", "Search with search provider context menu item with provider name inserted"), searchProviderName.get()]; #else @@ -136,7 +136,7 @@ } } -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 1 #else #define INCLUDE_SPOTLIGHT_CONTEXT_MENU_ITEM 0 diff --git a/Source/WebKit/mac/Misc/WebKitErrors.m b/Source/WebKit/mac/Misc/WebKitErrors.m index b1c6c976b..fe3de8675 100644 --- a/Source/WebKit/mac/Misc/WebKitErrors.m +++ b/Source/WebKit/mac/Misc/WebKitErrors.m @@ -116,7 +116,7 @@ static NSMutableDictionary *descriptions = nil; [userInfo setObject:localizedDescription forKey:NSLocalizedDescriptionKey]; if (contentURL) { [userInfo setObject:contentURL forKey:@"NSErrorFailingURLKey"]; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 [userInfo setObject:[contentURL _web_userVisibleString] forKey:NSErrorFailingURLStringKey]; #else [userInfo setObject:[contentURL _web_userVisibleString] forKey:NSURLErrorFailingURLStringErrorKey]; diff --git a/Source/WebKit/mac/Misc/WebNSControlExtras.m b/Source/WebKit/mac/Misc/WebNSControlExtras.m index 6edf84f6b..81b5c858f 100644 --- a/Source/WebKit/mac/Misc/WebNSControlExtras.m +++ b/Source/WebKit/mac/Misc/WebNSControlExtras.m @@ -46,7 +46,7 @@ NSRect windowFrame = [window frame]; CGFloat backingScaleFactor; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 backingScaleFactor = [window backingScaleFactor]; #else backingScaleFactor = [window userSpaceScaleFactor]; diff --git a/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm b/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm index fa150233d..e7a804398 100644 --- a/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm +++ b/Source/WebKit/mac/Misc/WebNSFileManagerExtras.mm @@ -36,7 +36,7 @@ #import <sys/stat.h> #import <wtf/RetainPtr.h> -#ifdef BUILDING_ON_SNOW_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1060 extern "C" DADiskRef DADiskCreateFromVolumePath(CFAllocatorRef allocator, DASessionRef session, CFURLRef path); #endif diff --git a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm index 165a00662..e38ae95b2 100644 --- a/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/Hosted/WebHostedNetscapePluginView.mm @@ -125,7 +125,7 @@ extern "C" { if (accleratedCompositingEnabled && _proxy->rendererType() == UseAcceleratedCompositing) { // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry // in order to get the coordinate system right. RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.leakRef()); diff --git a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm index 85d7aba42..0f1301314 100644 --- a/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebBaseNetscapePluginView.mm @@ -102,7 +102,7 @@ using namespace WebCore; _baseURL.adoptNS([baseURL copy]); _MIMEType.adoptNS([MIME copy]); -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Enable "kiosk mode" when instantiating the QT plug-in inside of Dashboard. See <rdar://problem/6878105> if ([[[NSBundle mainBundle] bundleIdentifier] isEqualToString:@"com.apple.dashboard.client"] && [_pluginPackage.get() bundleIdentifier] == "com.apple.QuickTime Plugin.plugin") { diff --git a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm index 426405f25..4e1aad495 100644 --- a/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm +++ b/Source/WebKit/mac/Plugins/WebNetscapePluginView.mm @@ -1099,7 +1099,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) #endif if (accleratedCompositingEnabled) { // FIXME: This code can be shared between WebHostedNetscapePluginView and WebNetscapePluginView. -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Since this layer isn't going to be inserted into a view, we need to create another layer and flip its geometry // in order to get the coordinate system right. RetainPtr<CALayer> realPluginLayer(AdoptNS, _pluginLayer.leakRef()); @@ -2231,7 +2231,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) break; } case NPNURLVProxy: { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (!value) break; @@ -2341,7 +2341,7 @@ static inline void getNPRect(const NSRect& nr, NPRect& npr) // For now, we'll distinguish older broken versions of Silverlight by asking the plug-in if it resolved its full screen badness. - (void)_workaroundSilverlightFullscreenBug:(BOOL)initializedPlugin { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT(_isSilverlight); NPBool isFullscreenPerformanceIssueFixed = 0; NPPluginFuncs *pluginFuncs = [_pluginPackage.get() pluginFuncs]; diff --git a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm index 2ea0d6672..ed6fa573b 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebChromeClient.mm @@ -818,7 +818,7 @@ void WebChromeClient::elementDidBlur(const WebCore::Node* node) bool WebChromeClient::selectItemWritingDirectionIsNatural() { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return false; #else return true; @@ -827,7 +827,7 @@ bool WebChromeClient::selectItemWritingDirectionIsNatural() bool WebChromeClient::selectItemAlignmentFollowsMenuWritingDirection() { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return true; #else return false; diff --git a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm index ed83da602..6497c95ee 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebEditorClient.mm @@ -74,7 +74,7 @@ using namespace WebCore; using namespace HTMLNames; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 @interface NSSpellChecker (WebNSSpellCheckerDetails) - (NSString *)languageForWordRange:(NSRange)range inString:(NSString *)string orthography:(NSOrthography *)orthography; @end @@ -698,7 +698,7 @@ void WebEditorClient::textDidChangeInTextArea(Element* element) bool WebEditorClient::shouldEraseMarkersAfterChangeSelection(TextCheckingType type) const { // This prevents erasing spelling markers on OS X Lion or later to match AppKit on these Mac OS X versions. -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 return type != TextCheckingTypeSpelling; #else return true; @@ -769,7 +769,7 @@ void WebEditorClient::checkGrammarOfString(const UChar* text, int length, Vector } } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static Vector<TextCheckingResult> core(NSArray *incomingResults, TextCheckingTypeMask checkingTypes) { Vector<TextCheckingResult> results; @@ -852,7 +852,7 @@ static Vector<TextCheckingResult> core(NSArray *incomingResults, TextCheckingTyp void WebEditorClient::checkTextOfParagraph(const UChar* text, int length, TextCheckingTypeMask checkingTypes, Vector<TextCheckingResult>& results) { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSString *textString = [[NSString alloc] initWithCharactersNoCopy:const_cast<UChar*>(text) length:length freeWhenDone:NO]; NSArray *incomingResults = [[NSSpellChecker sharedSpellChecker] checkString:textString range:NSMakeRange(0, [textString length]) types:(checkingTypes|NSTextCheckingTypeOrthography) options:nil inSpellDocumentWithTag:spellCheckerDocumentTag() orthography:NULL wordCount:NULL]; [textString release]; @@ -895,7 +895,7 @@ bool WebEditorClient::spellingUIIsShowing() void WebEditorClient::getGuessesForWord(const String& word, const String& context, Vector<String>& guesses) { guesses.clear(); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSString* language = nil; NSOrthography* orthography = nil; NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker]; @@ -925,7 +925,7 @@ void WebEditorClient::setInputMethodState(bool) { } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @interface WebEditorSpellCheckResponder : NSObject { WebEditorClient* _client; @@ -965,7 +965,7 @@ void WebEditorClient::didCheckSucceed(int sequence, NSArray* results) void WebEditorClient::requestCheckingOfString(PassRefPtr<WebCore::TextCheckingRequest> request) { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 ASSERT(!m_textCheckingRequest); m_textCheckingRequest = request; diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm index ca78e312c..6364420eb 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm @@ -668,7 +668,7 @@ void WebFrameLoaderClient::dispatchDidFirstLayout() WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView]; if ([getWebView(m_webFrame.get()) drawsBackground]) [scrollView setDrawsBackground:YES]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [scrollView setVerticalScrollElasticity:NSScrollElasticityAutomatic]; [scrollView setHorizontalScrollElasticity:NSScrollElasticityAutomatic]; #endif @@ -1087,7 +1087,7 @@ void WebFrameLoaderClient::provisionalLoadStarted() WebDynamicScrollBarsView *scrollView = [m_webFrame->_private->webFrameView _scrollView]; [scrollView setDrawsBackground:NO]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [scrollView setVerticalScrollElasticity:NSScrollElasticityNone]; [scrollView setHorizontalScrollElasticity:NSScrollElasticityNone]; #endif diff --git a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm index d1f2f15ee..102ceff38 100644 --- a/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm +++ b/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm @@ -43,7 +43,7 @@ void InitWebCoreSystemInterface(void) return; INIT(AdvanceDefaultButtonPulseAnimation); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CALayerEnumerateRectsBeingDrawnWithBlock); #endif INIT(CGContextGetShouldSmoothFonts); @@ -119,14 +119,14 @@ void InitWebCoreSystemInterface(void) INIT(GetGlyphsForCharacters); INIT(GetVerticalGlyphsForCharacters); -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 INIT(GetHyphenationLocationBeforeIndex); INIT(GetNSEventMomentumPhase); #endif INIT(CreateCTLineWithUniCharProvider); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(IOSurfaceContextCreate); INIT(IOSurfaceContextCreateImage); INIT(CreateCTTypesetterWithUniCharProviderAndOptions); @@ -174,24 +174,24 @@ void InitWebCoreSystemInterface(void) #if PLATFORM(MAC) // FIXME: We should stop using this file in Chromium. -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CreateVMPressureDispatchOnMainQueue); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 INIT(GetMacOSXVersionString); INIT(ExecutableWasLinkedOnOrBeforeLion); #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CGPathAddRoundedRect); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 INIT(CFURLRequestAllowAllPostCaching); #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) && !PLATFORM(IOS) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 && !PLATFORM(IOS) INIT(FilterIsManagedSession); INIT(FilterCreateInstance); INIT(FilterRelease); diff --git a/Source/WebKit/mac/WebView/WebClipView.mm b/Source/WebKit/mac/WebView/WebClipView.mm index 74709b0a3..d06fef760 100644 --- a/Source/WebKit/mac/WebView/WebClipView.mm +++ b/Source/WebKit/mac/WebView/WebClipView.mm @@ -52,7 +52,7 @@ using namespace WebCore; - (void)_immediateScrollToPoint:(NSPoint)newOrigin; @end -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @interface NSWindow (WebNSWindowDetails) - (void)_disableDelayedWindowDisplay; - (void)_enableDelayedWindowDisplay; @@ -105,13 +105,13 @@ using namespace WebCore; { _isScrolling = YES; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[self window] _disableDelayedWindowDisplay]; #endif [super _immediateScrollToPoint:newOrigin]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[self window] _enableDelayedWindowDisplay]; #endif diff --git a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm index 801109473..839b54f67 100644 --- a/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm +++ b/Source/WebKit/mac/WebView/WebDynamicScrollBarsView.mm @@ -413,7 +413,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; // This call updates the initial position correctly. [self adjustForScrollOriginChange]; -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSView *documentView = [self documentView]; if ([documentView isKindOfClass:[WebHTMLView class]]) { WebHTMLView *htmlView = (WebHTMLView *)documentView; @@ -522,7 +522,7 @@ static const unsigned cMaxUpdateScrollbarsPass = 2; BOOL isContinuous; WKGetWheelEventDeltas(event, &deltaX, &deltaY, &isContinuous); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 NSEventPhase momentumPhase = [event momentumPhase]; BOOL isLatchingEvent = momentumPhase & NSEventPhaseBegan || momentumPhase & NSEventPhaseStationary; #else diff --git a/Source/WebKit/mac/WebView/WebFrameView.mm b/Source/WebKit/mac/WebView/WebFrameView.mm index 7a09e4e06..c98e33942 100644 --- a/Source/WebKit/mac/WebView/WebFrameView.mm +++ b/Source/WebKit/mac/WebView/WebFrameView.mm @@ -322,7 +322,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl // FIXME: Remove the NSAppKitVersionNumberWithDeferredWindowDisplaySupport check once // once AppKit's Deferred Window Display support is available. -#if defined(BUILDING_ON_LEOPARD) || !defined(NSAppKitVersionNumberWithDeferredWindowDisplaySupport) +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 || !defined(NSAppKitVersionNumberWithDeferredWindowDisplaySupport) // CoreGraphics deferred updates are disabled if WebKitEnableCoalescedUpdatesPreferenceKey is NO // or has no value. For compatibility with Mac OS X 10.5 and lower, deferred updates are off by default. if (![[NSUserDefaults standardUserDefaults] boolForKey:WebKitEnableDeferredUpdatesPreferenceKey]) diff --git a/Source/WebKit/mac/WebView/WebFullScreenController.mm b/Source/WebKit/mac/WebView/WebFullScreenController.mm index acd698ab4..e64f47407 100644 --- a/Source/WebKit/mac/WebView/WebFullScreenController.mm +++ b/Source/WebKit/mac/WebView/WebFullScreenController.mm @@ -70,20 +70,19 @@ static IntRect screenRectOfContents(Element* element) - (void)_startExitFullScreenAnimationWithDuration:(NSTimeInterval)duration; @end -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) -@interface NSWindow(convertRectToScreenForLeopardAndSnowLeopard) -- (NSRect)convertRectToScreen:(NSRect)aRect; -@end - -@implementation NSWindow(convertRectToScreenForLeopardAndSnowLeopard) -- (NSRect)convertRectToScreen:(NSRect)rect +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 +static NSRect convertRectToScreen(NSWindow *window, NSRect rect) { - NSRect frame = [self frame]; + return [window convertRectToScreen:rect]; +} +#else +static NSRect convertRectToScreen(NSWindow *window, NSRect rect) +{ + NSRect frame = [window frame]; rect.origin.x += frame.origin.x; rect.origin.y += frame.origin.y; return rect; } -@end #endif @interface NSWindow(IsOnActiveSpaceAdditionForTigerAndLeopard) @@ -208,10 +207,9 @@ static IntRect screenRectOfContents(Element* element) if (!screen) screen = [NSScreen mainScreen]; NSRect screenFrame = [screen frame]; - - NSRect webViewFrame = [[_webView window] convertRectToScreen: - [_webView convertRect:[_webView frame] toView:nil]]; - + + NSRect webViewFrame = convertRectToScreen([_webView window], [_webView convertRect:[_webView frame] toView:nil]); + // Flip coordinate system: webViewFrame.origin.y = NSMaxY([[[NSScreen screens] objectAtIndex:0] frame]) - NSMaxY(webViewFrame); @@ -273,14 +271,14 @@ static IntRect screenRectOfContents(Element* element) WKWindowSetClipRect([self window], windowBounds); NSWindow *webWindow = [_webViewPlaceholder.get() window]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that // behavior here, making sure to reset the animation behavior afterward. NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; [webWindow setAnimationBehavior:NSWindowAnimationBehaviorNone]; #endif [webWindow orderOut:self]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [webWindow setAnimationBehavior:animationBehavior]; #endif @@ -323,7 +321,7 @@ static IntRect screenRectOfContents(Element* element) [self _updateMenuAndDockForFullScreen]; NSWindow* webWindow = [_webViewPlaceholder.get() window]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // In Lion, NSWindow will animate into and out of orderOut operations. Suppress that // behavior here, making sure to reset the animation behavior afterward. NSWindowAnimationBehavior animationBehavior = [webWindow animationBehavior]; @@ -338,7 +336,7 @@ static IntRect screenRectOfContents(Element* element) [webWindow setCollectionBehavior:behavior]; } else [webWindow orderWindow:NSWindowBelow relativeTo:[[self window] windowNumber]]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 [webWindow setAnimationBehavior:animationBehavior]; #endif @@ -415,7 +413,7 @@ static IntRect screenRectOfContents(Element* element) - (void)_updateMenuAndDockForFullScreen { // NSApplicationPresentationOptions is available on > 10.6 only: -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 NSApplicationPresentationOptions options = NSApplicationPresentationDefault; NSScreen* fullscreenScreen = [[self window] screen]; diff --git a/Source/WebKit/mac/WebView/WebHTMLView.mm b/Source/WebKit/mac/WebView/WebHTMLView.mm index 04a5a9973..505db5302 100644 --- a/Source/WebKit/mac/WebView/WebHTMLView.mm +++ b/Source/WebKit/mac/WebView/WebHTMLView.mm @@ -285,7 +285,7 @@ extern NSString *NSTextInputReplacementRangeAttributeName; - (void)_invalidateGStatesForTree; - (void)_propagateDirtyRectsToOpaqueAncestors; - (void)_windowChangedKeyState; -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)_updateLayerGeometryFromView; #endif @end @@ -411,7 +411,7 @@ static CachedImageClient* promisedDataClient() - (void)_web_clearPrintingModeRecursive; @end -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 @interface WebHTMLView (WebHTMLViewTextCheckingInternal) - (void)orderFrontSubstitutionsPanel:(id)sender; @@ -794,7 +794,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) subresources:0])) return fragment; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if ([types containsObject:NSPICTPboardType] && (fragment = [self _documentFragmentFromPasteboard:pasteboard forType:NSPICTPboardType @@ -875,7 +875,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) DOMRange *range = [self _selectedRange]; Frame* coreFrame = core([self _frame]); -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard inContext:range allowPlainText:allowPlainText]; if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:range givenAction:WebViewInsertActionPasted]) coreFrame->editor()->pasteAsFragment(core(fragment), [self _canSmartReplaceWithPasteboard:pasteboard], false); @@ -1232,7 +1232,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) } _private->lastScrollPosition = origin; -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 [self _updateLayerHostingViewPosition]; #endif } @@ -1389,7 +1389,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart) static BOOL isQuickLookEvent(NSEvent *event) { -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 const int kCGSEventSystemSubtypeHotKeyCombinationReleased = 9; return [event type] == NSSystemDefined && [event subtype] == kCGSEventSystemSubtypeHotKeyCombinationReleased && [event data1] == 'lkup'; #else @@ -1658,7 +1658,7 @@ static bool mouseEventIsPartOfClickOrDrag(NSEvent *event) static NSArray *types = nil; if (!types) { types = [[NSArray alloc] initWithObjects:WebArchivePboardType, NSHTMLPboardType, NSFilenamesPboardType, NSTIFFPboardType, NSPDFPboardType, -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSPICTPboardType, #endif NSURLPboardType, NSRTFDPboardType, NSRTFPboardType, NSStringPboardType, NSColorPboardType, kUTTypePNG, nil]; @@ -2047,7 +2047,7 @@ static bool mouseEventIsPartOfClickOrDrag(NSEvent *event) [resource release]; return fragment; } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (pboardType == NSPICTPboardType) { WebResource *resource = [[WebResource alloc] initWithData:[pasteboard dataForType:NSPICTPboardType] URL:uniqueURLWithRelativePart(@"image.pict") @@ -2699,7 +2699,7 @@ WEBCORE_COMMAND(yankAndSelect) return YES; } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 if (action == @selector(orderFrontSubstitutionsPanel:)) { NSMenuItem *menuItem = (NSMenuItem *)item; if ([menuItem isKindOfClass:[NSMenuItem class]]) { @@ -2852,7 +2852,7 @@ WEBCORE_COMMAND(yankAndSelect) return; #endif -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 // Legacy scrollbars require tracking the mouse at all times. if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) return; @@ -3391,7 +3391,7 @@ static void setMenuTargets(NSMenu* menu) return; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (_private->trackingAreaForNonKeyWindow) { [self removeTrackingArea:_private->trackingAreaForNonKeyWindow]; [_private->trackingAreaForNonKeyWindow release]; @@ -3424,7 +3424,7 @@ static void setMenuTargets(NSMenu* menu) [_private->completionController endRevertingChange:NO moveLeft:NO]; } -#if !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (WKRecommendedScrollerStyle() == NSScrollerStyleLegacy) { // Legacy style scrollbars have design details that rely on tracking the mouse all the time. // It's easiest to do this with a tracking area, which we will remove when the window is key @@ -4898,7 +4898,7 @@ static PassRefPtr<KeyboardEvent> currentKeyboardEvent(Frame* coreFrame) static BOOL writingDirectionKeyBindingsEnabled() { -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 return YES; #else NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; @@ -4936,7 +4936,7 @@ static BOOL writingDirectionKeyBindingsEnabled() [self _changeBaseWritingDirectionTo:NSWritingDirectionRightToLeft]; } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)changeBaseWritingDirectionToLTR:(id)sender { [self makeBaseWritingDirectionLeftToRight:sender]; @@ -5151,7 +5151,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (void)orderFrontSubstitutionsPanel:(id)sender { @@ -5286,7 +5286,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) if (font) rect.origin.y += [font ascender]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [self showDefinitionForAttributedString:attrString atPoint:rect.origin]; return; #endif @@ -5476,7 +5476,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) { if (!_private->layerHostingView) { NSView* hostingView = [[WebLayerHostingFlippedView alloc] initWithFrame:[self bounds]]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [hostingView setAutoresizingMask:(NSViewWidthSizable | NSViewHeightSizable)]; #endif [self addSubview:hostingView]; @@ -5488,7 +5488,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) // Make a container layer, which will get sized/positioned by AppKit and CA. CALayer* viewLayer = [WebRootLayer layer]; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Turn off default animations. NSNull *nullValue = [NSNull null]; NSDictionary *actions = [NSDictionary dictionaryWithObjectsAndKeys: @@ -5522,10 +5522,10 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) if ([[self _webView] _postsAcceleratedCompositingNotifications]) [[NSNotificationCenter defaultCenter] postNotificationName:_WebViewDidStartAcceleratedCompositingNotification object:[self _webView] userInfo:nil]; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 [viewLayer setSublayerTransform:CATransform3DMakeScale(1, -1, 1)]; // setGeometryFlipped: doesn't exist on Leopard. [self _updateLayerHostingViewPosition]; -#elif (defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION)) +#elif __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // Do geometry flipping here, which flips all the compositing layers so they are top-down. [viewLayer setGeometryFlipped:YES]; #else @@ -5544,7 +5544,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) } } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // This method is necessary on Leopard to work around <rdar://problem/7067892>. - (void)_updateLayerHostingViewPosition { @@ -5572,7 +5572,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point) [_private->layerHostingView _updateLayerGeometryFromView]; // Workaround for <rdar://problem/7071636> [_private->layerHostingView setFrame:layerViewFrame]; } -#endif // defined(BUILDING_ON_LEOPARD) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx { diff --git a/Source/WebKit/mac/WebView/WebHTMLViewInternal.h b/Source/WebKit/mac/WebView/WebHTMLViewInternal.h index a4153ab4f..137a1404b 100644 --- a/Source/WebKit/mac/WebView/WebHTMLViewInternal.h +++ b/Source/WebKit/mac/WebView/WebHTMLViewInternal.h @@ -66,7 +66,7 @@ namespace WebCore { - (BOOL)_web_isDrawingIntoLayer; #endif -#if USE(ACCELERATED_COMPOSITING) && defined(BUILDING_ON_LEOPARD) +#if USE(ACCELERATED_COMPOSITING) && __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 - (void)_updateLayerHostingViewPosition; #endif diff --git a/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm b/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm index 3e701cf5c..592edf75b 100644 --- a/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm +++ b/Source/WebKit/mac/WebView/WebPDFDocumentExtras.mm @@ -31,7 +31,7 @@ #import <PDFKit/PDFDocument.h> #import <objc/objc-runtime.h> -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 @interface PDFDocument (Internal) - (CGPDFDocumentRef)documentRef; @end diff --git a/Source/WebKit/mac/WebView/WebPreferences.mm b/Source/WebKit/mac/WebView/WebPreferences.mm index 9c28230ba..1defbf5ed 100644 --- a/Source/WebKit/mac/WebView/WebPreferences.mm +++ b/Source/WebKit/mac/WebView/WebPreferences.mm @@ -47,6 +47,7 @@ using namespace WebCore; NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification"; NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification"; NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification"; +NSString *WebPreferencesCacheModelChangedInternalNotification = @"WebPreferencesCacheModelChangedInternalNotification"; #define KEY(x) (_private->identifier ? [_private->identifier stringByAppendingString:(x)] : (x)) @@ -163,6 +164,10 @@ static WebCacheModel cacheModelForMainBundle(void) } @end +@interface WebPreferences () +- (void)_postCacheModelChangedNotification; +@end + @interface WebPreferences (WebInternal) + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key; + (NSString *)_IBCreatorID; @@ -222,6 +227,7 @@ static WebCacheModel cacheModelForMainBundle(void) [[self class] _setInstance:self forIdentifier:_private->identifier]; [self _postPreferencesChangedNotification]; + [self _postCacheModelChangedNotification]; return self; } @@ -346,7 +352,7 @@ static WebCacheModel cacheModelForMainBundle(void) @"0", WebKitPDFScaleFactorPreferenceKey, @"0", WebKitUseSiteSpecificSpoofingPreferenceKey, [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey, -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded], #else [NSNumber numberWithInt:WebTextDirectionSubmenuNeverIncluded], @@ -802,10 +808,21 @@ static WebCacheModel cacheModelForMainBundle(void) return [self _boolValueForKey:WebKitUsesPageCachePreferenceKey]; } +- (void)_postCacheModelChangedNotification +{ + if (!pthread_main_np()) { + [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO]; + return; + } + + [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil]; +} + - (void)setCacheModel:(WebCacheModel)cacheModel { [self _setIntegerValue:cacheModel forKey:WebKitCacheModelPreferenceKey]; [self setAutomaticallyDetectsCacheModel:NO]; + [self _postCacheModelChangedNotification]; } - (WebCacheModel)cacheModel diff --git a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h index 7e853fa44..5db85cf55 100644 --- a/Source/WebKit/mac/WebView/WebPreferencesPrivate.h +++ b/Source/WebKit/mac/WebView/WebPreferencesPrivate.h @@ -46,6 +46,7 @@ typedef enum { extern NSString *WebPreferencesChangedNotification; extern NSString *WebPreferencesRemovedNotification; extern NSString *WebPreferencesChangedInternalNotification; +extern NSString *WebPreferencesCacheModelChangedInternalNotification; @interface WebPreferences (WebPrivate) diff --git a/Source/WebKit/mac/WebView/WebResourceInternal.h b/Source/WebKit/mac/WebView/WebResourceInternal.h index ba84105a0..32442ca6c 100644 --- a/Source/WebKit/mac/WebView/WebResourceInternal.h +++ b/Source/WebKit/mac/WebView/WebResourceInternal.h @@ -29,7 +29,7 @@ #import "WebResourcePrivate.h" #import <wtf/PassRefPtr.h> -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 #define MAIL_THREAD_WORKAROUND 1 #endif diff --git a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h index 585700fa0..5182f31be 100644 --- a/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h +++ b/Source/WebKit/mac/WebView/WebScriptDebugDelegate.h @@ -28,7 +28,7 @@ #import <Foundation/Foundation.h> -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 typedef int WebSourceId; #else typedef intptr_t WebSourceId; diff --git a/Source/WebKit/mac/WebView/WebView.mm b/Source/WebKit/mac/WebView/WebView.mm index c35b873f4..b85d8f36b 100644 --- a/Source/WebKit/mac/WebView/WebView.mm +++ b/Source/WebKit/mac/WebView/WebView.mm @@ -463,7 +463,7 @@ NSString *_WebViewDidStartAcceleratedCompositingNotification = @"_WebViewDidStar static BOOL continuousSpellCheckingEnabled; static BOOL grammarCheckingEnabled; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 static BOOL automaticQuoteSubstitutionEnabled; static BOOL automaticLinkDetectionEnabled; static BOOL automaticDashSubstitutionEnabled; @@ -510,7 +510,7 @@ static CFMutableSetRef allWebViewsSet; @implementation WebView (WebPrivate) -#if !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 static NSString *createMacOSXVersionString() { @@ -545,7 +545,7 @@ static NSString *createMacOSXVersionString() return [[NSString alloc] initWithFormat:@"%d", major]; } -#endif // !defined(BUILDING_ON_SNOW_LEOPARD) && !defined(BUILDING_ON_LION) +#endif // __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 static NSString *createUserVisibleWebKitVersionString() { @@ -611,7 +611,7 @@ static void WebKitInitializeApplicationCachePathIfNecessary() static bool runningLeopardMail() { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return applicationIsAppleMail(); #endif return NO; @@ -619,7 +619,7 @@ static bool runningLeopardMail() static bool coreVideoHas7228836Fix() { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 NSBundle* coreVideoFrameworkBundle = [NSBundle bundleWithPath:@"/System/Library/Frameworks/CoreVideo.framework"]; double version = [[coreVideoFrameworkBundle objectForInfoDictionaryKey:(NSString *)kCFBundleVersionKey] doubleValue]; return (version >= 48); @@ -647,7 +647,7 @@ static bool shouldEnableLoadDeferring() [types release]; } -#if defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1060 // This method should be removed once we no longer want to keep Safari 5.0.x working with nightly builds. - (BOOL)_usesDocumentViews { @@ -1508,7 +1508,7 @@ static bool needsSelfRetainWhileLoadingQuirk() #if ENABLE(FULLSCREEN_API) settings->setFullScreenEnabled([preferences fullScreenEnabled]); #endif -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 // Asynchronous spell checking API is available for 10.6 or later. settings->setAsynchronousSpellCheckingEnabled([preferences asynchronousSpellCheckingEnabled]); #endif @@ -3040,13 +3040,13 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) WebCore::RunLoop::initializeMainRunLoop(); [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_applicationWillTerminate) name:NSApplicationWillTerminateNotification object:NSApp]; - [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesChangedNotification:) name:WebPreferencesChangedInternalNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_cacheModelChangedNotification:) name:WebPreferencesCacheModelChangedInternalNotification object:nil]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(_preferencesRemovedNotification:) name:WebPreferencesRemovedNotification object:nil]; continuousSpellCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebContinuousSpellCheckingEnabled]; grammarCheckingEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebGrammarCheckingEnabled]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 automaticQuoteSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticQuoteSubstitutionEnabled]; automaticLinkDetectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticLinkDetectionEnabled]; automaticDashSubstitutionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticDashSubstitutionEnabled]; @@ -3054,7 +3054,7 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns) automaticSpellingCorrectionEnabled = [[NSUserDefaults standardUserDefaults] boolForKey:WebAutomaticSpellingCorrectionEnabled]; #endif -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticTextReplacementEnabled]) automaticTextReplacementEnabled = [NSSpellChecker isAutomaticTextReplacementEnabled]; if (![[NSUserDefaults standardUserDefaults] objectForKey:WebAutomaticSpellingCorrectionEnabled]) @@ -3261,7 +3261,7 @@ static bool clientNeedsWebViewInitThreadWorkaround() if ([bundleIdentifier _webkit_hasCaseInsensitivePrefix:@"com.apple.Automator."]) return true; -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 // Mail. if ([bundleIdentifier _webkit_isCaseInsensitiveEqualToString:@"com.apple.Mail"]) return true; @@ -4564,7 +4564,7 @@ static WebFrame *incrementFrame(WebFrame *frame, WebFindOptions options = 0) [menuItem setState:checkMark ? NSOnState : NSOffState]; } return YES; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 } else if (action == @selector(toggleAutomaticQuoteSubstitution:)) { BOOL checkMark = [self isAutomaticQuoteSubstitutionEnabled]; if ([(NSObject *)item isKindOfClass:[NSMenuItem class]]) { @@ -4713,7 +4713,7 @@ static BOOL findString(NSView <WebDocumentSearching> *searchView, NSString *stri return kit(_private->page->rangeOfString(string, core(previousRange), coreOptions(options)).get()); } -#if defined(BUILDING_ON_SNOW_LEOPARD) || defined(BUILDING_ON_LION) +#if __MAC_OS_X_VERSION_MIN_REQUIRED <= 1070 // FIXME: Remove once WebKit no longer needs to support versions of Safari that call this. - (void)setHoverFeedbackSuspended:(BOOL)newValue { @@ -5402,7 +5402,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu grammarCheckingEnabled = flag; [[NSUserDefaults standardUserDefaults] setBool:grammarCheckingEnabled forKey:WebGrammarCheckingEnabled]; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[NSSpellChecker sharedSpellChecker] updatePanels]; #else NSSpellChecker *spellChecker = [NSSpellChecker sharedSpellChecker]; @@ -5429,7 +5429,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticQuoteSubstitutionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticQuoteSubstitutionEnabled; @@ -5438,7 +5438,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticLinkDetectionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticLinkDetectionEnabled; @@ -5447,7 +5447,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticDashSubstitutionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticDashSubstitutionEnabled; @@ -5456,7 +5456,7 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticTextReplacementEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticTextReplacementEnabled; @@ -5465,14 +5465,14 @@ static NSAppleEventDescriptor* aeDescFromJSValue(ExecState* exec, JSValue jsValu - (BOOL)isAutomaticSpellingCorrectionEnabled { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 return NO; #else return automaticSpellingCorrectionEnabled; #endif } -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag { @@ -5698,7 +5698,7 @@ static WebFrameView *containingFrameView(NSView *view) NSWindow *window = [self window]; NSWindow *hostWindow = [self hostWindow]; -#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 if (window) return [window backingScaleFactor]; if (hostWindow) @@ -5913,7 +5913,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num) return cacheModel; } -+ (void)_preferencesChangedNotification:(NSNotification *)notification ++ (void)_cacheModelChangedNotification:(NSNotification *)notification { WebPreferences *preferences = (WebPreferences *)[notification object]; ASSERT([preferences isKindOfClass:[WebPreferences class]]); @@ -6059,7 +6059,7 @@ static inline uint64_t roundUpToPowerOf2(uint64_t num) if (![selectedString length]) return; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 [[NSWorkspace sharedWorkspace] showSearchResultsForQueryString:selectedString]; #else (void)HISearchWindowShow((CFStringRef)selectedString, kNilOptions); @@ -6579,7 +6579,7 @@ void WebInstallMemoryPressureHandler(void) memoryPressureHandler().install(); } -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 static IMP originalRecursivelyRemoveMailAttributesImp; @@ -6605,7 +6605,7 @@ static void recursivelyRemoveMailAttributes(DOMNode *self, SEL selector, BOOL a, static void patchMailRemoveAttributesMethod() { -#ifdef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED == 1050 if (!WKAppVersionCheckLessThan(@"com.apple.mail", -1, 4.0)) return; Method methodToPatch = class_getInstanceMethod(objc_getRequiredClass("DOMNode"), @selector(recursivelyRemoveMailAttributes:convertObjectsToImages:convertEditableElements:)); diff --git a/Source/WebKit/mac/WebView/WebViewPrivate.h b/Source/WebKit/mac/WebView/WebViewPrivate.h index b7b3b1c41..0a9808dbc 100644 --- a/Source/WebKit/mac/WebView/WebViewPrivate.h +++ b/Source/WebKit/mac/WebView/WebViewPrivate.h @@ -677,7 +677,7 @@ Could be worth adding to the API. - (BOOL)isAutomaticDashSubstitutionEnabled; - (BOOL)isAutomaticTextReplacementEnabled; - (BOOL)isAutomaticSpellingCorrectionEnabled; -#ifndef BUILDING_ON_LEOPARD +#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1060 - (void)setAutomaticQuoteSubstitutionEnabled:(BOOL)flag; - (void)toggleAutomaticQuoteSubstitution:(id)sender; - (void)setAutomaticLinkDetectionEnabled:(BOOL)flag; diff --git a/Source/WebKit/qt/Api/qwebframe.cpp b/Source/WebKit/qt/Api/qwebframe.cpp index 21b3a0b70..ed1806fa0 100644 --- a/Source/WebKit/qt/Api/qwebframe.cpp +++ b/Source/WebKit/qt/Api/qwebframe.cpp @@ -356,6 +356,32 @@ void QWebFramePrivate::renderCompositedLayers(GraphicsContext* context, const In } #endif +// This code is copied from ChromeClientGtk.cpp. +static void coalesceRectsIfPossible(const QRect& clipRect, QVector<QRect>& rects) +{ + const unsigned int rectThreshold = 10; + const float wastedSpaceThreshold = 0.75f; + bool useUnionedRect = (rects.size() <= 1) || (rects.size() > rectThreshold); + if (!useUnionedRect) { + // Attempt to guess whether or not we should use the unioned rect or the individual rects. + // We do this by computing the percentage of "wasted space" in the union. If that wasted space + // is too large, then we will do individual rect painting instead. + float unionPixels = (clipRect.width() * clipRect.height()); + float singlePixels = 0; + for (size_t i = 0; i < rects.size(); ++i) + singlePixels += rects[i].width() * rects[i].height(); + float wastedSpace = 1 - (singlePixels / unionPixels); + if (wastedSpace <= wastedSpaceThreshold) + useUnionedRect = true; + } + + if (!useUnionedRect) + return; + + rects.clear(); + rects.append(clipRect); +} + void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWebFrame::RenderLayer> layers, const QRegion& clip) { if (!frame->view() || !frame->contentRenderer()) @@ -371,6 +397,8 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWe view->updateLayoutAndStyleIfNeededRecursive(); if (layers & QWebFrame::ContentsLayer) { + QRect clipBoundingRect = clip.boundingRect(); + coalesceRectsIfPossible(clipBoundingRect, vector); for (int i = 0; i < vector.size(); ++i) { const QRect& clipRect = vector.at(i); @@ -396,7 +424,7 @@ void QWebFramePrivate::renderRelativeCoords(GraphicsContext* context, QFlags<QWe context->restore(); } #if USE(ACCELERATED_COMPOSITING) - renderCompositedLayers(context, IntRect(clip.boundingRect())); + renderCompositedLayers(context, IntRect(clipBoundingRect)); #endif } renderFrameExtras(context, layers, clip); diff --git a/Source/WebKit/qt/Api/qwebpage.cpp b/Source/WebKit/qt/Api/qwebpage.cpp index e72c0862e..1330870da 100644 --- a/Source/WebKit/qt/Api/qwebpage.cpp +++ b/Source/WebKit/qt/Api/qwebpage.cpp @@ -791,7 +791,8 @@ void QWebPagePrivate::mouseReleaseEvent(T *ev) accepted = frame->eventHandler()->handleMouseReleaseEvent(mev); ev->setAccepted(accepted); - handleClipboard(ev, ev->button()); + if (!ev->isAccepted()) + handleClipboard(ev, ev->button()); handleSoftwareInputPanel(ev->button(), QPointF(ev->pos()).toPoint()); } diff --git a/Source/WebKit/qt/ChangeLog b/Source/WebKit/qt/ChangeLog index c6941fa54..6d26ea21c 100644 --- a/Source/WebKit/qt/ChangeLog +++ b/Source/WebKit/qt/ChangeLog @@ -1,3 +1,40 @@ +2012-07-12 Huang Dongsung <luxtella@company100.net> + + [Qt] Increase the drawing performance by merging dirty rects. + https://bugs.webkit.org/show_bug.cgi?id=91075 + + Reviewed by Noam Rosenthal. + + QWebFramePrivate calls FrameView::paintContents as many as the number of dirty + rects, so it causes too many redundant render tree traversals. + I changed it to merge dirty rects and call FrameView::paintContents only once. + The algorithm to merge rects is copied from GTK. + + When parallel image decoders are in use, each image is independently repainted + when decoding is finished. This creates a lot by repaint requests. So by merging + these repaint requests, I could improve rendering performance. + + For example, I tested parallel image decoders on the locally mirrored Pinterest site. + QWebFramePrivate called FrameView::paintContents 165 times after parallel image + decoders decoded all the images. It took about 120ms on my six-core Intel Xeon machine. + This patch decreases painting time from 120ms to 30ms. + + * Api/qwebframe.cpp: + (coalesceRectsIfPossible): + (QWebFramePrivate::renderRelativeCoords): + +2012-07-11 Steffen Imhof <steffen.imhof@basyskom.com> + + [Qt] Middle clicking a scrollbar causes text to be pasted. + https://bugs.webkit.org/show_bug.cgi?id=78444 + + Check if the event was already accepted before handling the clipboard. + + Reviewed by Simon Hausmann. + + * Api/qwebpage.cpp: + (QWebPagePrivate::mouseReleaseEvent): + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/scripts/generate-webkitversion.pl b/Source/WebKit/scripts/generate-webkitversion.pl index 8cdb4187b..c83b8496c 100644 --- a/Source/WebKit/scripts/generate-webkitversion.pl +++ b/Source/WebKit/scripts/generate-webkitversion.pl @@ -45,7 +45,7 @@ my $usage = "generate-webkitversion --config WebKit/mac/Configurations/Version.x my $major_version = ""; my $minor_version = ""; # The appropriate Apple-maintained Version.xcconfig file for WebKit version information is in WebKit/mac/Configurations/. -my $configFile = "./Soure/WebKit/mac/Configurations/Version.xcconfig"; +my $configFile = "./Source/WebKit/mac/Configurations/Version.xcconfig"; my $outputDir = ""; GetOptions('config=s' => \$configFile, diff --git a/Source/WebKit/win/ChangeLog b/Source/WebKit/win/ChangeLog index ce2d8d010..889e24c9b 100644 --- a/Source/WebKit/win/ChangeLog +++ b/Source/WebKit/win/ChangeLog @@ -1,3 +1,22 @@ +2012-07-14 Eric Carlson <eric.carlson@apple.com> + + Enable AVCF hardware video decoding + https://bugs.webkit.org/show_bug.cgi?id=90015 + <rdar://problem/10770317> + + Reviewed by Anders Carlsson. + + * WebCoreSupport/WebChromeClient.cpp: + (WebChromeClient::graphicsDeviceAdapter): New, return the view's graphics adapter. + * WebCoreSupport/WebChromeClient.h: + (WebChromeClient): + + * WebView.cpp: + (WebView::graphicsDeviceAdapter): New, return the layer tree host's graphics adapter. + * WebView.h: + (WebCore): + (WebView): + 2012-07-10 Adam Barth <abarth@webkit.org> WebCore::Settings for Hixie76 WebSocket protocol doesn't do anything and should be removed diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp index 381dbb021..3f7a418e6 100644 --- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp +++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.cpp @@ -752,7 +752,13 @@ void WebChromeClient::scheduleCompositingLayerSync() { m_webView->flushPendingGraphicsLayerChangesSoon(); } +#endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +WebCore::GraphicsDeviceAdapter* WebChromeClient::graphicsDeviceAdapter() const +{ + return m_webView->graphicsDeviceAdapter(); +} #endif COMPtr<IWebUIDelegate> WebChromeClient::uiDelegate() diff --git a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h index 9a5af3893..f5559b0c9 100644 --- a/Source/WebKit/win/WebCoreSupport/WebChromeClient.h +++ b/Source/WebKit/win/WebCoreSupport/WebChromeClient.h @@ -142,6 +142,10 @@ public: virtual void scheduleCompositingLayerSync(); #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + virtual WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const OVERRIDE; +#endif + virtual void scrollRectIntoView(const WebCore::IntRect&) const { } #if ENABLE(VIDEO) diff --git a/Source/WebKit/win/WebView.cpp b/Source/WebKit/win/WebView.cpp index c709ba9f1..ececdff22 100644 --- a/Source/WebKit/win/WebView.cpp +++ b/Source/WebKit/win/WebView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple, Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple, Inc. All rights reserved. * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved. * Copyright (C) 2011 Brent Fulgham. All rights reserved. * @@ -6529,6 +6529,15 @@ void WebView::setAcceleratedCompositing(bool accelerated) } #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) +WebCore::GraphicsDeviceAdapter* WebView::graphicsDeviceAdapter() const +{ + if (!m_layerTreeHost) + return 0; + return m_layerTreeHost->graphicsDeviceAdapter(); +} +#endif + HRESULT WebView::unused1() { ASSERT_NOT_REACHED(); diff --git a/Source/WebKit/win/WebView.h b/Source/WebKit/win/WebView.h index 821c7e9f4..696e2c77b 100644 --- a/Source/WebKit/win/WebView.h +++ b/Source/WebKit/win/WebView.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. * Copyright (C) 2009, 2010, 2011 Appcelerator, Inc. All rights reserved. * Copyright (C) 2011 Brent Fulgham. All rights reserved. * @@ -55,6 +55,9 @@ namespace WebCore { class CACFLayerTreeHost; #endif class FullScreenController; +#if PLATFORM(WIN) && USE(AVFOUNDATION) + struct GraphicsDeviceAdapter; +#endif } namespace WebCore { @@ -947,6 +950,10 @@ public: void setRootChildLayer(WebCore::GraphicsLayer*); #endif +#if PLATFORM(WIN) && USE(AVFOUNDATION) + WebCore::GraphicsDeviceAdapter* graphicsDeviceAdapter() const; +#endif + void enterFullscreenForNode(WebCore::Node*); void exitFullscreen(); |