diff options
Diffstat (limited to 'Source/WebKit/chromium/src')
72 files changed, 1373 insertions, 1091 deletions
diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index 27239d769..cfaa26bab 100644 --- a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp +++ b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp @@ -64,6 +64,7 @@ #include "PageVisibilityState.h" #include "PeerConnection00.h" #include "PlatformCursor.h" +#include "RTCPeerConnectionHandlerClient.h" #include "ReferrerPolicy.h" #include "ResourceResponse.h" #include "Settings.h" @@ -108,13 +109,15 @@ #include "WebTextCheckingResult.h" #include "WebTextCheckingType.h" #include "WebView.h" -#include "platform/WebICEOptions.h" -#include "platform/WebMediaStreamSource.h" -#include "platform/WebPeerConnection00Handler.h" -#include "platform/WebPeerConnection00HandlerClient.h" #include <public/WebClipboard.h> #include <public/WebFileSystem.h> #include <public/WebFilterOperation.h> +#include <public/WebICEOptions.h> +#include <public/WebMediaStreamSource.h> +#include <public/WebPeerConnection00Handler.h> +#include <public/WebPeerConnection00HandlerClient.h> +#include <public/WebRTCPeerConnectionHandler.h> +#include <public/WebRTCPeerConnectionHandlerClient.h> #include <public/WebReferrerPolicy.h> #include <public/WebScrollbar.h> #include <public/WebURLResponse.h> @@ -258,6 +261,7 @@ COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentNote, DocumentNoteRole) COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleDocumentRegion, DocumentRegionRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleUserInterfaceTooltip, UserInterfaceTooltipRole); COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleToggleButton, ToggleButtonRole); +COMPILE_ASSERT_MATCHING_ENUM(WebAccessibilityRoleCanvas, CanvasRole); COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Uncached, ApplicationCacheHost::UNCACHED); COMPILE_ASSERT_MATCHING_ENUM(WebApplicationCacheHost::Idle, ApplicationCacheHost::IDLE); @@ -592,6 +596,21 @@ COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateConnected COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateCompleted, PeerConnection00::ICE_COMPLETED); COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateFailed, PeerConnection00::ICE_FAILED); COMPILE_ASSERT_MATCHING_ENUM(WebPeerConnection00HandlerClient::ICEStateClosed, PeerConnection00::ICE_CLOSED); + +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateNew, RTCPeerConnectionHandlerClient::ReadyStateNew); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateOpening, RTCPeerConnectionHandlerClient::ReadyStateOpening); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateActive, RTCPeerConnectionHandlerClient::ReadyStateActive); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateClosing, RTCPeerConnectionHandlerClient::ReadyStateClosing); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ReadyStateClosed, RTCPeerConnectionHandlerClient::ReadyStateClosed); + +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateNew, RTCPeerConnectionHandlerClient::IceStateNew); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateGathering, RTCPeerConnectionHandlerClient::IceStateGathering); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateWaiting, RTCPeerConnectionHandlerClient::IceStateWaiting); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateChecking, RTCPeerConnectionHandlerClient::IceStateChecking); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateConnected, RTCPeerConnectionHandlerClient::IceStateConnected); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateCompleted, RTCPeerConnectionHandlerClient::IceStateCompleted); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateFailed, RTCPeerConnectionHandlerClient::IceStateFailed); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateClosed, RTCPeerConnectionHandlerClient::IceStateClosed); #endif #if ENABLE(SCRIPTED_SPEECH) diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index d73654578..985757783 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -42,6 +42,7 @@ #include "Console.h" #include "Cursor.h" #include "DatabaseTracker.h" +#include "DateTimeChooserImpl.h" #include "Document.h" #include "DocumentLoader.h" #include "ExternalPopupMenu.h" @@ -652,6 +653,8 @@ void ChromeClientImpl::dispatchViewportPropertiesDidChange(const ViewportArgumen args, settings->layoutFallbackWidth(), deviceRect.width, deviceRect.height, dpi / ViewportArguments::deprecatedTargetDPI, IntSize(deviceRect.width, deviceRect.height)); + restrictScaleFactorToInitialScaleIfNotUserScalable(computed); + if (m_webView->ignoreViewportTagMaximumScale()) { computed.maximumScale = max(computed.maximumScale, m_webView->maxPageScaleFactor); computed.userScalable = true; @@ -704,6 +707,13 @@ PassOwnPtr<WebColorChooser> ChromeClientImpl::createWebColorChooser(WebColorChoo } #endif +#if ENABLE(CALENDAR_PICKER) +PassOwnPtr<WebCore::DateTimeChooser> ChromeClientImpl::openDateTimeChooser(WebCore::DateTimeChooserClient* pickerClient, const WebCore::DateTimeChooserParameters& parameters) +{ + return adoptPtr(new DateTimeChooserImpl(this, pickerClient, parameters)); +} +#endif + void ChromeClientImpl::runOpenPanel(Frame* frame, PassRefPtr<FileChooser> fileChooser) { WebViewClient* client = m_webView->client(); @@ -1119,18 +1129,18 @@ void ChromeClientImpl::dashboardRegionsChanged() } #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) -PassOwnPtr<RegisterProtocolHandlerClientImpl> RegisterProtocolHandlerClientImpl::create(WebViewImpl* webView) +#if ENABLE(NAVIGATOR_CONTENT_UTILS) +PassOwnPtr<NavigatorContentUtilsClientImpl> NavigatorContentUtilsClientImpl::create(WebViewImpl* webView) { - return adoptPtr(new RegisterProtocolHandlerClientImpl(webView)); + return adoptPtr(new NavigatorContentUtilsClientImpl(webView)); } -RegisterProtocolHandlerClientImpl::RegisterProtocolHandlerClientImpl(WebViewImpl* webView) +NavigatorContentUtilsClientImpl::NavigatorContentUtilsClientImpl(WebViewImpl* webView) : m_webView(webView) { } -void RegisterProtocolHandlerClientImpl::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) +void NavigatorContentUtilsClientImpl::registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) { m_webView->client()->registerProtocolHandler(scheme, baseURL, url, title); } diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index a786dc5eb..7d456fbf5 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -33,8 +33,8 @@ #define ChromeClientImpl_h #include "ChromeClientChromium.h" +#include "NavigatorContentUtilsClient.h" #include "PopupMenu.h" -#include "RegisterProtocolHandlerClient.h" #include "SearchPopupMenu.h" #include "WebNavigationPolicy.h" #include <public/WebColor.h> @@ -50,6 +50,8 @@ class PopupContainer; class PopupMenuClient; class RenderBox; class SecurityOrigin; +class DateTimeChooser; +class DateTimeChooserClient; struct WindowFeatures; } @@ -144,6 +146,9 @@ public: virtual PassOwnPtr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient*, const WebCore::Color&) OVERRIDE; PassOwnPtr<WebColorChooser> createWebColorChooser(WebColorChooserClient*, const WebColor&); #endif +#if ENABLE(CALENDAR_PICKER) + virtual PassOwnPtr<WebCore::DateTimeChooser> openDateTimeChooser(WebCore::DateTimeChooserClient*, const WebCore::DateTimeChooserParameters&) OVERRIDE; +#endif virtual void runOpenPanel(WebCore::Frame*, PassRefPtr<WebCore::FileChooser>); virtual void loadIconForFiles(const Vector<WTF::String>&, WebCore::FileIconLoader*); #if ENABLE(DIRECTORY_UPLOAD) @@ -237,15 +242,15 @@ private: #endif }; -class RegisterProtocolHandlerClientImpl : public WebCore::RegisterProtocolHandlerClient { +class NavigatorContentUtilsClientImpl : public WebCore::NavigatorContentUtilsClient { public: - static PassOwnPtr<RegisterProtocolHandlerClientImpl> create(WebViewImpl*); - ~RegisterProtocolHandlerClientImpl() { } + static PassOwnPtr<NavigatorContentUtilsClientImpl> create(WebViewImpl*); + ~NavigatorContentUtilsClientImpl() { } virtual void registerProtocolHandler(const String& scheme, const String& baseURL, const String& url, const String& title) OVERRIDE; private: - explicit RegisterProtocolHandlerClientImpl(WebViewImpl*); + explicit NavigatorContentUtilsClientImpl(WebViewImpl*); WebViewImpl* m_webView; }; diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index adaa41392..2fd6431c1 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -53,7 +53,6 @@ #include "KURL.h" #include "MediaError.h" #include "Page.h" -#include "PlatformString.h" #include "RenderWidget.h" #include "Settings.h" #include "TextBreakIterator.h" @@ -75,6 +74,7 @@ #include "platform/WebVector.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <wtf/text/WTFString.h> using namespace WebCore; @@ -122,7 +122,7 @@ static String selectMisspelledWord(const ContextMenu* defaultMenu, Frame* select // Selection is empty, so change the selection to the word under the cursor. HitTestResult hitTestResult = selectedFrame->eventHandler()-> - hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().point(), true); + hitTestResultAtPoint(selectedFrame->page()->contextMenuController()->hitTestResult().point(), HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::AllowShadowContent); Node* innerNode = hitTestResult.innerNode(); VisiblePosition pos(innerNode->renderer()->positionForPoint( hitTestResult.localPoint())); diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp new file mode 100644 index 000000000..69718dcb6 --- /dev/null +++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp @@ -0,0 +1,132 @@ +/* + * 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 "DateTimeChooserImpl.h" + +#if ENABLE(CALENDAR_PICKER) + +#include "CalendarPicker.h" +#include "ChromeClientImpl.h" +#include "DateComponents.h" +#include "DateTimeChooserClient.h" +#include "Language.h" +#include "LocalizedDate.h" +#include "NotImplemented.h" +#include "PickerCommon.h" +#include "RenderTheme.h" +#include "platform/WebKitPlatformSupport.h" +#include <public/WebLocalizedString.h> + +using namespace WTF::Unicode; + +namespace WebKit { + +DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore::DateTimeChooserClient* client, const WebCore::DateTimeChooserParameters& parameters) + : m_chromeClient(chromeClient) + , m_client(client) + , m_popup(0) + , m_parameters(parameters) +{ + ASSERT(m_chromeClient); + ASSERT(m_client); + m_popup = m_chromeClient->openPagePopup(this, m_parameters.anchorRectInRootView); +} + +DateTimeChooserImpl::~DateTimeChooserImpl() +{ +} + +void DateTimeChooserImpl::endChooser() +{ + if (!m_popup) + return; + m_chromeClient->closePagePopup(m_popup); +} + +WebCore::IntSize DateTimeChooserImpl::contentSize() +{ + return WebCore::IntSize(0, 0); +} + +void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer) +{ + WebCore::DateComponents date; + date.setMillisecondsSinceEpochForDate(m_parameters.minimum); + String minString = date.toString(); + date.setMillisecondsSinceEpochForDate(m_parameters.maximum); + String maxString = date.toString(); + String stepString = String::number(m_parameters.step); + + addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); + writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss)); + writer.addData(WebCore::calendarPickerCss, sizeof(WebCore::calendarPickerCss)); + CString extraStyle = WebCore::RenderTheme::defaultTheme()->extraCalendarPickerStyleSheet(); + if (extraStyle.length()) + writer.addData(extraStyle.data(), extraStyle.length()); + addString("</style></head><body><div id=main>Loading...</div><script>\n" + "window.dialogArguments = {\n", writer); + addProperty("min", minString, writer); + addProperty("max", maxString, writer); + addProperty("step", stepString, writer); + addProperty("required", m_parameters.required, writer); + addProperty("currentValue", m_parameters.currentValue, writer); + addProperty("locale", WebCore::defaultLanguage(), writer); + addProperty("todayLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarToday), writer); + addProperty("clearLabel", Platform::current()->queryLocalizedString(WebLocalizedString::CalendarClear), writer); + addProperty("weekStartDay", WebCore::firstDayOfWeek(), writer); + addProperty("monthLabels", WebCore::monthLabels(), writer); + addProperty("dayLabels", WebCore::weekDayShortLabels(), writer); + Direction dir = direction(WebCore::monthLabels()[0][0]); + addProperty("isRTL", dir == RightToLeft || dir == RightToLeftArabic, writer); + addString("}\n", writer); + + writer.addData(WebCore::pickerCommonJs, sizeof(WebCore::pickerCommonJs)); + writer.addData(WebCore::calendarPickerJs, sizeof(WebCore::calendarPickerJs)); + addString("</script></body>\n", writer); +} + +void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stringValue) +{ + if (numValue >= 0) + m_client->didChooseValue(stringValue); + endChooser(); +} + +void DateTimeChooserImpl::didClosePopup() +{ + ASSERT(m_client); + m_popup = 0; + m_client->didEndChooser(); +} + +} // namespace WebKit + +#endif // ENABLE(CALENDAR_PICKER) diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.h b/Source/WebKit/chromium/src/DateTimeChooserImpl.h new file mode 100644 index 000000000..e504592bc --- /dev/null +++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.h @@ -0,0 +1,73 @@ +/* + * 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 DateTimeChooserImpl_h +#define DateTimeChooserImpl_h + +#include "DateTimeChooser.h" +#include "PagePopupClient.h" + +#if ENABLE(CALENDAR_PICKER) + +namespace WebCore { +class PagePopup; +class DateTimeChooserClient; +} + +namespace WebKit { + +class ChromeClientImpl; + +class DateTimeChooserImpl : public WebCore::DateTimeChooser, public WebCore::PagePopupClient { +public: + DateTimeChooserImpl(ChromeClientImpl*, WebCore::DateTimeChooserClient*, const WebCore::DateTimeChooserParameters&); + virtual ~DateTimeChooserImpl(); + + // DateTimeChooser functions: + virtual void endChooser() OVERRIDE; + +private: + // PagePopupClient functions: + virtual WebCore::IntSize contentSize() OVERRIDE; + virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE; + virtual void setValueAndClosePopup(int, const String&) OVERRIDE; + virtual void didClosePopup() OVERRIDE; + + ChromeClientImpl* m_chromeClient; + WebCore::DateTimeChooserClient* m_client; + WebCore::PagePopup* m_popup; + WebCore::DateTimeChooserParameters m_parameters; +}; + +} + +#endif // ENABLE(CALENDAR_PICKER) + +#endif // DateTimeChooserImpl_h diff --git a/Source/WebKit/chromium/src/EditorClientImpl.cpp b/Source/WebKit/chromium/src/EditorClientImpl.cpp index b5eaf595f..3046db32e 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.cpp +++ b/Source/WebKit/chromium/src/EditorClientImpl.cpp @@ -37,7 +37,6 @@ #include "KeyboardCodes.h" #include "KeyboardEvent.h" #include "PlatformKeyboardEvent.h" -#include "PlatformString.h" #include "RenderObject.h" #include "Settings.h" #include "SpellChecker.h" @@ -61,6 +60,7 @@ #include "WebTextCheckingResult.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <wtf/text/WTFString.h> using namespace WebCore; @@ -849,6 +849,15 @@ void EditorClientImpl::getGuessesForWord(const String& word, notImplemented(); } +bool EditorClientImpl::supportsGlobalSelection() +{ +#if OS(UNIX) && !OS(DARWIN) + return true; +#else + return false; +#endif +} + void EditorClientImpl::willSetInputMethodState() { if (m_webView->client()) diff --git a/Source/WebKit/chromium/src/EditorClientImpl.h b/Source/WebKit/chromium/src/EditorClientImpl.h index 3ee9ebaaa..a79bb9b1f 100644 --- a/Source/WebKit/chromium/src/EditorClientImpl.h +++ b/Source/WebKit/chromium/src/EditorClientImpl.h @@ -113,6 +113,7 @@ public: virtual void willSetInputMethodState(); virtual void setInputMethodState(bool enabled); virtual void requestCheckingOfString(WTF::PassRefPtr<WebCore::TextCheckingRequest>); + virtual bool supportsGlobalSelection() OVERRIDE; virtual WebCore::TextCheckerClient* textChecker() { return this; } diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 5dd02b563..c99bd7c57 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -997,8 +997,7 @@ void FrameLoaderClientImpl::dispatchDecidePolicyForNavigationAction( if (event->isMouseEvent()) { const MouseEvent* mouseEvent = static_cast<const MouseEvent*>(event); - node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint( - mouseEvent->absoluteLocation(), false).innerNonSharedNode(); + node = m_webFrame->frame()->eventHandler()->hitTestResultAtPoint(mouseEvent->absoluteLocation()).innerNonSharedNode(); break; } } diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index 4f257c77c..f2657a7bd 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -35,13 +35,13 @@ #include "Frame.h" #include "InspectorFrontendHost.h" #include "Page.h" -#include "PlatformString.h" #include "ScriptController.h" #include "V8InspectorFrontendHost.h" #include "WebDevToolsFrontendClient.h" #include "WebDevToolsFrontendImpl.h" #include "platform/WebFloatPoint.h" #include "platform/WebString.h" +#include <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/LinkHighlight.cpp b/Source/WebKit/chromium/src/LinkHighlight.cpp index 2c804a8cd..1e72900c4 100644 --- a/Source/WebKit/chromium/src/LinkHighlight.cpp +++ b/Source/WebKit/chromium/src/LinkHighlight.cpp @@ -41,7 +41,9 @@ #include "WebFrameImpl.h" #include "WebKit.h" #include "WebViewImpl.h" +#include <public/Platform.h> #include <public/WebAnimationCurve.h> +#include <public/WebCompositorSupport.h> #include <public/WebFloatAnimationCurve.h> #include <public/WebFloatPoint.h> #include <public/WebRect.h> @@ -59,16 +61,16 @@ PassOwnPtr<LinkHighlight> LinkHighlight::create(Node* node, WebViewImpl* owningW } LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) - : m_contentLayer(adoptPtr(WebContentLayer::create(this))) - , m_clipLayer(adoptPtr(WebLayer::create())) - , m_node(node) + : m_node(node) , m_owningWebViewImpl(owningWebViewImpl) , m_currentGraphicsLayer(0) , m_geometryNeedsUpdate(false) { ASSERT(m_node); ASSERT(owningWebViewImpl); - + WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); + m_contentLayer = adoptPtr(compositorSupport->createContentLayer(this)); + m_clipLayer = adoptPtr(compositorSupport->createLayer()); m_clipLayer->setAnchorPoint(WebFloatPoint()); m_clipLayer->addChild(m_contentLayer->layer()); m_contentLayer->layer()->setDrawsContent(false); @@ -147,7 +149,7 @@ bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositin return false; bool pathHasChanged = false; - FloatRect boundingRect = m_node->getPixelSnappedRect(); + FloatRect boundingRect = m_node->pixelSnappedBoundingBox(); // FIXME: If we ever use a more sophisticated highlight path, we'll need // to devise a way of detecting when it changes. @@ -196,17 +198,21 @@ void LinkHighlight::startHighlightAnimation() { const float startOpacity = 1; // FIXME: Should duration be configurable? - const float duration = 2; + const float duration = 0.1f; m_contentLayer->layer()->setOpacity(startOpacity); - OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(WebFloatAnimationCurve::create()); + WebCompositorSupport* compositorSupport = Platform::current()->compositorSupport(); + + OwnPtr<WebFloatAnimationCurve> curve = adoptPtr(compositorSupport->createFloatAnimationCurve()); + curve->add(WebFloatKeyframe(0, startOpacity)); curve->add(WebFloatKeyframe(duration / 2, startOpacity)); // For layout tests we don't fade out. curve->add(WebFloatKeyframe(duration, WebKit::layoutTestMode() ? startOpacity : 0)); - m_animation = adoptPtr(WebAnimation::create(*curve, WebAnimation::TargetPropertyOpacity)); + m_animation = adoptPtr(compositorSupport->createAnimation(*curve, WebAnimation::TargetPropertyOpacity)); + m_contentLayer->layer()->setDrawsContent(true); m_contentLayer->layer()->addAnimation(m_animation.get()); diff --git a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp index d22412ac8..5fa07ddad 100644 --- a/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp +++ b/Source/WebKit/chromium/src/LocalFileSystemChromium.cpp @@ -39,7 +39,6 @@ #include "FileSystemCallback.h" #include "FileSystemCallbacks.h" #include "FileSystemType.h" -#include "PlatformString.h" #include "WebFileError.h" #include "WebFileSystemCallbacksImpl.h" #include "WebFrameClient.h" @@ -52,6 +51,7 @@ #include "WorkerThread.h" #include <public/WebFileSystem.h> #include <wtf/Threading.h> +#include <wtf/text/WTFString.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 2a4432d8a..40a009369 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -202,6 +202,58 @@ String AXMenuListActionVerb() return String(); } +#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +String AXAMPMFieldText() +{ + return query(WebLocalizedString::AXAMPMFieldText); +} + +String AXDayOfMonthFieldText() +{ + return query(WebLocalizedString::AXDayOfMonthFieldText); +} + +String AXDateTimeFieldEmptyValueText() +{ + return query(WebLocalizedString::AXDateTimeFieldEmptyValueText); +} + +String AXHourFieldText() +{ + return query(WebLocalizedString::AXHourFieldText); +} + +String AXMillisecondFieldText() +{ + return query(WebLocalizedString::AXMillisecondFieldText); +} + +String AXMinuteFieldText() +{ + return query(WebLocalizedString::AXMinuteFieldText); +} + +String AXMonthFieldText() +{ + return query(WebLocalizedString::AXMonthFieldText); +} + +String AXSecondFieldText() +{ + return query(WebLocalizedString::AXSecondFieldText); +} + +String AXWeekOfYearFieldText() +{ + return query(WebLocalizedString::AXWeekOfYearFieldText); +} + +String AXYearFieldText() +{ + return query(WebLocalizedString::AXYearFieldText); +} +#endif + String missingPluginText() { return query(WebLocalizedString::MissingPluginText); diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 4df4204b3..ae99ba889 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -42,13 +42,13 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView) : m_webView(webView) , m_opaque(true) , m_showDebugBorders(false) - , m_deviceScaleFactor(1.0) { m_graphicsLayer = WebCore::GraphicsLayer::create(this); #ifndef NDEBUG m_graphicsLayer->setName("non-composited content"); #endif m_graphicsLayer->setDrawsContent(true); + m_graphicsLayer->setAppliesPageScale(true); WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer(); layer->setUseLCDText(true); layer->layer()->setOpaque(true); @@ -88,7 +88,7 @@ void NonCompositedContentHost::setScrollLayer(WebCore::GraphicsLayer* layer) ASSERT(haveScrollLayer()); } -void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale) +void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin) { if (!haveScrollLayer()) return; @@ -102,8 +102,6 @@ void NonCompositedContentHost::setViewport(const WebCore::IntSize& viewportSize, // Due to the possibility of pinch zoom, the noncomposited layer is always // assumed to be scrollable. layer->setScrollable(true); - m_deviceScaleFactor = deviceScale; - m_graphicsLayer->deviceOrPageScaleFactorChanged(); m_graphicsLayer->setSize(contentsSize); // In RTL-style pages, the origin of the initial containing block for the diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 08b5f6a41..69776d90f 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -58,7 +58,7 @@ public: void setBackgroundColor(const WebCore::Color&); void setOpaque(bool); void setScrollLayer(WebCore::GraphicsLayer*); - void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin, float deviceScale); + void setViewport(const WebCore::IntSize& viewportSize, const WebCore::IntSize& contentsSize, const WebCore::IntPoint& scrollPosition, const WebCore::IntPoint& scrollOrigin); WebCore::GraphicsLayer* topLevelRootLayer() const { return m_graphicsLayer.get(); } void setShowDebugBorders(bool); @@ -73,11 +73,6 @@ private: virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect); virtual bool showDebugBorders(const WebCore::GraphicsLayer*) const; virtual bool showRepaintCounter(const WebCore::GraphicsLayer*) const; - // The deviceScaleFactor given to the GraphicsLayer can be non-1 when the - // contents are scaled in the compositor instead of by the pageScaleFactor. - // However, the pageScaleFactor is always baked into the GraphicsLayer's - // size, so it is always 1 for the GraphicsLayer. - virtual float deviceScaleFactor() const OVERRIDE { return m_deviceScaleFactor; } bool haveScrollLayer(); WebLayer* scrollLayer(); @@ -89,7 +84,6 @@ private: bool m_opaque; bool m_showDebugBorders; - float m_deviceScaleFactor; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index aca97d0a3..762055497 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -31,8 +31,6 @@ #include "config.h" #include "PlatformSupport.h" -#include <googleurl/src/url_util.h> - #include "Chrome.h" #include "ChromeClientImpl.h" #include "FileMetadata.h" @@ -41,8 +39,6 @@ #include "WebFileUtilities.h" #include "WebFrameClient.h" #include "WebFrameImpl.h" -#include "WebIDBKey.h" -#include "WebIDBKeyPath.h" #include "WebKit.h" #include "WebPluginContainerImpl.h" #include "WebPluginListBuilderImpl.h" @@ -257,23 +253,6 @@ void PlatformSupport::getFontFamilyForCharacters(const UChar* characters, size_t #endif } -void PlatformSupport::getRenderStyleForStrike(const char* font, int sizeAndStyle, FontRenderStyle* result) -{ - WebFontRenderStyle style; - -#if OS(ANDROID) - style.setDefaults(); -#else - if (!font || !*font) - style.setDefaults(); // It's probably a webfont. Take the system defaults. - else if (WebKit::Platform::current()->sandboxSupport()) - WebKit::Platform::current()->sandboxSupport()->getRenderStyleForStrike(font, sizeAndStyle, &style); - else - WebFontInfo::renderStyleForStrike(font, sizeAndStyle, &style); -#endif - - style.toFontRenderStyle(result); -} #endif // Indexed Database ----------------------------------------------------------- @@ -285,23 +264,6 @@ PassRefPtr<IDBFactoryBackendInterface> PlatformSupport::idbFactory() return IDBFactoryBackendProxy::create(); } -void PlatformSupport::createIDBKeysFromSerializedValuesAndKeyPath(const Vector<RefPtr<SerializedScriptValue> >& values, const IDBKeyPath& keyPath, Vector<RefPtr<IDBKey> >& keys) -{ - WebVector<WebSerializedScriptValue> webValues = values; - WebVector<WebIDBKey> webKeys; - webKitPlatformSupport()->createIDBKeysFromSerializedValuesAndKeyPath(webValues, keyPath, webKeys); - - size_t webKeysSize = webKeys.size(); - keys.reserveCapacity(webKeysSize); - for (size_t i = 0; i < webKeysSize; ++i) - keys.append(PassRefPtr<IDBKey>(webKeys[i])); -} - -PassRefPtr<SerializedScriptValue> PlatformSupport::injectIDBKeyIntoSerializedValue(PassRefPtr<IDBKey> key, PassRefPtr<SerializedScriptValue> value, const IDBKeyPath& keyPath) -{ - return webKitPlatformSupport()->injectIDBKeyIntoSerializedValue(key, value, keyPath); -} - // Plugin --------------------------------------------------------------------- bool PlatformSupport::plugins(bool refresh, Vector<PluginInfo>* results) @@ -319,20 +281,6 @@ NPObject* PlatformSupport::pluginScriptableObject(Widget* widget) return static_cast<WebPluginContainerImpl*>(widget)->scriptableObject(); } -// Resources ------------------------------------------------------------------ - -#if ENABLE(WEB_AUDIO) - -PassOwnPtr<AudioBus> PlatformSupport::decodeAudioFileData(const char* data, size_t size, double sampleRate) -{ - WebAudioBus webAudioBus; - if (webKitPlatformSupport()->loadAudioResource(&webAudioBus, data, size, sampleRate)) - return webAudioBus.release(); - return nullptr; -} - -#endif // ENABLE(WEB_AUDIO) - // Theming -------------------------------------------------------------------- #if OS(WINDOWS) @@ -547,51 +495,6 @@ void PlatformSupport::paintThemePart( #endif -// Visited Links -------------------------------------------------------------- - -LinkHash PlatformSupport::visitedLinkHash(const UChar* url, unsigned length) -{ - url_canon::RawCanonOutput<2048> buffer; - url_parse::Parsed parsed; - if (!url_util::Canonicalize(url, length, 0, &buffer, &parsed)) - return 0; // Invalid URLs are unvisited. - return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length()); -} - -LinkHash PlatformSupport::visitedLinkHash(const KURL& base, - const AtomicString& attributeURL) -{ - // Resolve the relative URL using googleurl and pass the absolute URL up to - // the embedder. We could create a GURL object from the base and resolve - // the relative URL that way, but calling the lower-level functions - // directly saves us the string allocation in most cases. - url_canon::RawCanonOutput<2048> buffer; - url_parse::Parsed parsed; - -#if USE(GOOGLEURL) - const CString& cstr = base.utf8String(); - const char* data = cstr.data(); - int length = cstr.length(); - const url_parse::Parsed& srcParsed = base.parsed(); -#else - // When we're not using GoogleURL, first canonicalize it so we can resolve it - // below. - url_canon::RawCanonOutput<2048> srcCanon; - url_parse::Parsed srcParsed; - String str = base.string(); - if (!url_util::Canonicalize(str.characters(), str.length(), 0, &srcCanon, &srcParsed)) - return 0; - const char* data = srcCanon.data(); - int length = srcCanon.length(); -#endif - - if (!url_util::ResolveRelative(data, length, srcParsed, attributeURL.characters(), - attributeURL.length(), 0, &buffer, &parsed)) - return 0; // Invalid resolved URL. - - return webKitPlatformSupport()->visitedLinkHash(buffer.data(), buffer.length()); -} - // These are temporary methods that the WebKit layer can use to call to the // Glue layer. Once the Glue layer moves entirely into the WebKit layer, these // methods will be deleted. diff --git a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp index 147f40e13..09176ee98 100644 --- a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -31,7 +31,6 @@ #include "config.h" #include "SpeechInputClientImpl.h" -#include "PlatformString.h" #include "SecurityOrigin.h" #include "SpeechInputListener.h" #include "WebSecurityOrigin.h" @@ -39,6 +38,7 @@ #include "platform/WebString.h" #include "WebViewClient.h" #include <wtf/PassOwnPtr.h> +#include <wtf/text/WTFString.h> #if ENABLE(INPUT_SPEECH) diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h index 750cbae5c..312e88b13 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h @@ -26,11 +26,11 @@ #ifndef SpeechRecognitionClientProxy_h #define SpeechRecognitionClientProxy_h -#include "PlatformString.h" #include "SpeechRecognitionClient.h" #include "WebSpeechRecognizerClient.h" #include <wtf/Compiler.h> #include <wtf/PassOwnPtr.h> +#include <wtf/text/WTFString.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index 1eb69d28f..f559715d9 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -50,6 +50,7 @@ #include "platform/WebRect.h" #include "platform/WebString.h" #include "platform/WebURL.h" +#include <wtf/text/StringBuilder.h> using namespace WebCore; @@ -95,16 +96,21 @@ int WebAccessibilityObject::axID() const if (isDetached()) return -1; - m_private->updateBackingStore(); return m_private->axObjectID(); } +bool WebAccessibilityObject::updateBackingStoreAndCheckValidity() +{ + if (!isDetached()) + m_private->updateBackingStore(); + return !isDetached(); +} + WebString WebAccessibilityObject::accessibilityDescription() const { if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->accessibilityDescription(); } @@ -113,7 +119,6 @@ WebString WebAccessibilityObject::actionVerb() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->actionVerb(); } @@ -122,7 +127,6 @@ bool WebAccessibilityObject::canSetFocusAttribute() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->canSetFocusAttribute(); } @@ -131,25 +135,14 @@ bool WebAccessibilityObject::canSetValueAttribute() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->canSetValueAttribute(); } -bool WebAccessibilityObject::isValid() const -{ - if (isDetached()) - return false; - - m_private->updateBackingStore(); - return m_private->axObjectID(); -} - unsigned WebAccessibilityObject::childCount() const { if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->children().size(); } @@ -158,7 +151,6 @@ WebAccessibilityObject WebAccessibilityObject::childAt(unsigned index) const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); if (m_private->children().size() <= index) return WebAccessibilityObject(); @@ -170,7 +162,6 @@ WebAccessibilityObject WebAccessibilityObject::firstChild() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->firstChild()); } @@ -179,7 +170,6 @@ WebAccessibilityObject WebAccessibilityObject::focusedChild() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); RefPtr<AccessibilityObject> focused = m_private->focusedUIElement(); if (m_private.get() == focused.get() || m_private.get() == focused->parentObject()) return WebAccessibilityObject(focused); @@ -192,7 +182,6 @@ WebAccessibilityObject WebAccessibilityObject::lastChild() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->lastChild()); } @@ -202,7 +191,6 @@ WebAccessibilityObject WebAccessibilityObject::nextSibling() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->nextSibling()); } @@ -211,7 +199,6 @@ WebAccessibilityObject WebAccessibilityObject::parentObject() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->parentObject()); } @@ -221,7 +208,6 @@ WebAccessibilityObject WebAccessibilityObject::previousSibling() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->previousSibling()); } @@ -230,7 +216,6 @@ bool WebAccessibilityObject::canSetSelectedAttribute() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->canSetSelectedAttribute(); } @@ -239,7 +224,6 @@ bool WebAccessibilityObject::isAnchor() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isAnchor(); } @@ -248,7 +232,6 @@ bool WebAccessibilityObject::isAriaReadOnly() const if (isDetached()) return 0; - m_private->updateBackingStore(); return equalIgnoringCase(m_private->getAttribute(HTMLNames::aria_readonlyAttr), "true"); } @@ -257,7 +240,6 @@ bool WebAccessibilityObject::isButtonStateMixed() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->checkboxOrRadioValue() == ButtonStateMixed; } @@ -266,7 +248,6 @@ bool WebAccessibilityObject::isChecked() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isChecked(); } @@ -275,7 +256,6 @@ bool WebAccessibilityObject::isCollapsed() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isCollapsed(); } @@ -284,7 +264,6 @@ bool WebAccessibilityObject::isControl() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isControl(); } @@ -293,7 +272,6 @@ bool WebAccessibilityObject::isEnabled() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isEnabled(); } @@ -302,7 +280,6 @@ bool WebAccessibilityObject::isFocused() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isFocused(); } @@ -311,7 +288,6 @@ bool WebAccessibilityObject::isHovered() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isHovered(); } @@ -320,7 +296,6 @@ bool WebAccessibilityObject::isIndeterminate() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isIndeterminate(); } @@ -329,7 +304,6 @@ bool WebAccessibilityObject::isLinked() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isLinked(); } @@ -338,7 +312,6 @@ bool WebAccessibilityObject::isLoaded() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isLoaded(); } @@ -347,7 +320,6 @@ bool WebAccessibilityObject::isMultiSelectable() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isMultiSelectable(); } @@ -356,7 +328,6 @@ bool WebAccessibilityObject::isOffScreen() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isOffScreen(); } @@ -365,7 +336,6 @@ bool WebAccessibilityObject::isPasswordField() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isPasswordField(); } @@ -374,7 +344,6 @@ bool WebAccessibilityObject::isPressed() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isPressed(); } @@ -383,7 +352,6 @@ bool WebAccessibilityObject::isReadOnly() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isReadOnly(); } @@ -392,7 +360,6 @@ bool WebAccessibilityObject::isRequired() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isRequired(); } @@ -401,7 +368,6 @@ bool WebAccessibilityObject::isSelected() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isSelected(); } @@ -410,7 +376,6 @@ bool WebAccessibilityObject::isSelectedOptionActive() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->isSelectedOptionActive(); } @@ -419,7 +384,6 @@ bool WebAccessibilityObject::isVertical() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->orientation() == AccessibilityOrientationVertical; } @@ -428,7 +392,6 @@ bool WebAccessibilityObject::isVisible() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isVisible(); } @@ -437,7 +400,6 @@ bool WebAccessibilityObject::isVisited() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->isVisited(); } @@ -446,7 +408,6 @@ WebString WebAccessibilityObject::accessKey() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return WebString(m_private->accessKey()); } @@ -455,7 +416,6 @@ bool WebAccessibilityObject::ariaHasPopup() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->ariaHasPopup(); } @@ -464,7 +424,6 @@ bool WebAccessibilityObject::ariaLiveRegionAtomic() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->ariaLiveRegionAtomic(); } @@ -473,7 +432,6 @@ bool WebAccessibilityObject::ariaLiveRegionBusy() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->ariaLiveRegionBusy(); } @@ -482,7 +440,6 @@ WebString WebAccessibilityObject::ariaLiveRegionRelevant() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->ariaLiveRegionRelevant(); } @@ -491,7 +448,6 @@ WebString WebAccessibilityObject::ariaLiveRegionStatus() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->ariaLiveRegionStatus(); } @@ -500,16 +456,22 @@ WebRect WebAccessibilityObject::boundingBoxRect() const if (isDetached()) return WebRect(); - m_private->updateBackingStore(); return m_private->pixelSnappedBoundingBoxRect(); } +bool WebAccessibilityObject::canvasHasFallbackContent() const +{ + if (isDetached()) + return false; + + return m_private->canvasHasFallbackContent(); +} + double WebAccessibilityObject::estimatedLoadingProgress() const { if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->estimatedLoadingProgress(); } @@ -518,7 +480,6 @@ WebString WebAccessibilityObject::helpText() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->helpText(); } @@ -527,7 +488,6 @@ int WebAccessibilityObject::headingLevel() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->headingLevel(); } @@ -536,7 +496,6 @@ int WebAccessibilityObject::hierarchicalLevel() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->hierarchicalLevel(); } @@ -545,7 +504,6 @@ WebAccessibilityObject WebAccessibilityObject::hitTest(const WebPoint& point) co if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); IntPoint contentsPoint = m_private->documentFrameView()->windowToContents(point); RefPtr<AccessibilityObject> hit = m_private->accessibilityHitTest(contentsPoint); @@ -563,7 +521,6 @@ WebString WebAccessibilityObject::keyboardShortcut() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); String accessKey = m_private->accessKey(); if (accessKey.isNull()) return WebString(); @@ -574,14 +531,16 @@ WebString WebAccessibilityObject::keyboardShortcut() const // Follow the same order as Mozilla MSAA implementation: // Ctrl+Alt+Shift+Meta+key. MSDN states that keyboard shortcut strings // should not be localized and defines the separator as "+". + StringBuilder modifierStringBuilder; if (modifiers & PlatformEvent::CtrlKey) - modifierString += "Ctrl+"; + modifierStringBuilder.appendLiteral("Ctrl+"); if (modifiers & PlatformEvent::AltKey) - modifierString += "Alt+"; + modifierStringBuilder.appendLiteral("Alt+"); if (modifiers & PlatformEvent::ShiftKey) - modifierString += "Shift+"; + modifierStringBuilder.appendLiteral("Shift+"); if (modifiers & PlatformEvent::MetaKey) - modifierString += "Win+"; + modifierStringBuilder.appendLiteral("Win+"); + modifierString = modifierStringBuilder.toString(); } return String(modifierString + accessKey); @@ -594,7 +553,6 @@ bool WebAccessibilityObject::performDefaultAction() const UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); - m_private->updateBackingStore(); return m_private->performDefaultAction(); } @@ -603,7 +561,6 @@ WebAccessibilityRole WebAccessibilityObject::roleValue() const if (isDetached()) return WebKit::WebAccessibilityRoleUnknown; - m_private->updateBackingStore(); return static_cast<WebAccessibilityRole>(m_private->roleValue()); } @@ -612,7 +569,6 @@ unsigned WebAccessibilityObject::selectionEnd() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->selectedTextRange().start + m_private->selectedTextRange().length; } @@ -621,7 +577,6 @@ unsigned WebAccessibilityObject::selectionStart() const if (isDetached()) return 0; - m_private->updateBackingStore(); return m_private->selectedTextRange().start; } @@ -636,7 +591,6 @@ WebString WebAccessibilityObject::stringValue() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->stringValue(); } @@ -645,7 +599,6 @@ WebString WebAccessibilityObject::title() const if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->title(); } @@ -654,7 +607,6 @@ WebAccessibilityObject WebAccessibilityObject::titleUIElement() const if (isDetached()) return WebAccessibilityObject(); - m_private->updateBackingStore(); return WebAccessibilityObject(m_private->titleUIElement()); } @@ -663,16 +615,22 @@ WebURL WebAccessibilityObject::url() const if (isDetached()) return WebURL(); - m_private->updateBackingStore(); return m_private->url(); } +bool WebAccessibilityObject::supportsRangeValue() const +{ + if (isDetached()) + return false; + + return m_private->supportsRangeValue(); +} + WebString WebAccessibilityObject::valueDescription() const { if (isDetached()) return WebString(); - m_private->updateBackingStore(); return m_private->valueDescription(); } @@ -681,7 +639,6 @@ float WebAccessibilityObject::valueForRange() const if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->valueForRange(); } @@ -690,7 +647,6 @@ float WebAccessibilityObject::maxValueForRange() const if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->maxValueForRange(); } @@ -699,7 +655,6 @@ float WebAccessibilityObject::minValueForRange() const if (isDetached()) return 0.0; - m_private->updateBackingStore(); return m_private->minValueForRange(); } @@ -708,8 +663,6 @@ WebNode WebAccessibilityObject::node() const if (isDetached()) return WebNode(); - m_private->updateBackingStore(); - Node* node = m_private->node(); if (!node) return WebNode(); @@ -722,8 +675,6 @@ WebDocument WebAccessibilityObject::document() const if (isDetached()) return WebDocument(); - m_private->updateBackingStore(); - Document* document = m_private->document(); if (!document) return WebDocument(); @@ -772,7 +723,6 @@ bool WebAccessibilityObject::accessibilityIsIgnored() const if (isDetached()) return false; - m_private->updateBackingStore(); return m_private->accessibilityIsIgnored(); } @@ -781,7 +731,6 @@ bool WebAccessibilityObject::lineBreaks(WebVector<int>& result) const if (isDetached()) return false; - m_private->updateBackingStore(); int textLength = m_private->textLength(); if (!textLength) return false; @@ -805,7 +754,6 @@ unsigned WebAccessibilityObject::columnCount() const if (isDetached()) return false; - m_private->updateBackingStore(); if (!m_private->isAccessibilityTable()) return 0; @@ -817,7 +765,6 @@ unsigned WebAccessibilityObject::rowCount() const if (isDetached()) return false; - m_private->updateBackingStore(); if (!m_private->isAccessibilityTable()) return 0; @@ -826,7 +773,9 @@ unsigned WebAccessibilityObject::rowCount() const WebAccessibilityObject WebAccessibilityObject::cellForColumnAndRow(unsigned column, unsigned row) const { - m_private->updateBackingStore(); + if (isDetached()) + return WebAccessibilityObject(); + if (!m_private->isAccessibilityTable()) return WebAccessibilityObject(); @@ -836,7 +785,9 @@ WebAccessibilityObject WebAccessibilityObject::cellForColumnAndRow(unsigned colu unsigned WebAccessibilityObject::cellColumnIndex() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -847,7 +798,9 @@ unsigned WebAccessibilityObject::cellColumnIndex() const unsigned WebAccessibilityObject::cellColumnSpan() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -858,7 +811,9 @@ unsigned WebAccessibilityObject::cellColumnSpan() const unsigned WebAccessibilityObject::cellRowIndex() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -869,7 +824,9 @@ unsigned WebAccessibilityObject::cellRowIndex() const unsigned WebAccessibilityObject::cellRowSpan() const { - m_private->updateBackingStore(); + if (isDetached()) + return 0; + if (!m_private->isTableCell()) return 0; @@ -880,20 +837,20 @@ unsigned WebAccessibilityObject::cellRowSpan() const void WebAccessibilityObject::scrollToMakeVisible() const { - m_private->updateBackingStore(); - m_private->scrollToMakeVisible(); + if (!isDetached()) + m_private->scrollToMakeVisible(); } void WebAccessibilityObject::scrollToMakeVisibleWithSubFocus(const WebRect& subfocus) const { - m_private->updateBackingStore(); - m_private->scrollToMakeVisibleWithSubFocus(subfocus); + if (!isDetached()) + m_private->scrollToMakeVisibleWithSubFocus(subfocus); } void WebAccessibilityObject::scrollToGlobalPoint(const WebPoint& point) const { - m_private->updateBackingStore(); - m_private->scrollToGlobalPoint(point); + if (!isDetached()) + m_private->scrollToGlobalPoint(point); } WebAccessibilityObject::WebAccessibilityObject(const WTF::PassRefPtr<WebCore::AccessibilityObject>& object) diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.cpp b/Source/WebKit/chromium/src/WebAnimationImpl.cpp index e5d9ef2a3..b5a94d714 100644 --- a/Source/WebKit/chromium/src/WebAnimationImpl.cpp +++ b/Source/WebKit/chromium/src/WebAnimationImpl.cpp @@ -26,7 +26,6 @@ #include "WebAnimationImpl.h" -#include "AnimationIdVendor.h" #include "CCActiveAnimation.h" #include "CCAnimationCurve.h" #include "WebFloatAnimationCurveImpl.h" @@ -36,23 +35,24 @@ #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> -using WebCore::AnimationIdVendor; using WebCore::CCActiveAnimation; namespace WebKit { -WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty) +WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, TargetProperty targetProperty, int animationId) { - return WebAnimation::create(curve, AnimationIdVendor::getNextAnimationId(), AnimationIdVendor::getNextGroupId(), targetProperty); + return new WebAnimationImpl(curve, targetProperty, animationId, 0); } -WebAnimation* WebAnimation::create(const WebAnimationCurve& curve, int animationId, int groupId, TargetProperty targetProperty) +WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, TargetProperty targetProperty, int animationId, int groupId) { - return new WebAnimationImpl(curve, animationId, groupId, targetProperty); -} + static int nextAnimationId = 1; + static int nextGroupId = 1; + if (!animationId) + animationId = nextAnimationId++; + if (!groupId) + groupId = nextGroupId++; -WebAnimationImpl::WebAnimationImpl(const WebAnimationCurve& webCurve, int animationId, int groupId, TargetProperty targetProperty) -{ WebAnimationCurve::AnimationCurveType curveType = webCurve.type(); OwnPtr<WebCore::CCAnimationCurve> curve; switch (curveType) { @@ -74,6 +74,11 @@ WebAnimationImpl::~WebAnimationImpl() { } +int WebAnimationImpl::id() +{ + return m_animation->id(); +} + WebAnimation::TargetProperty WebAnimationImpl::targetProperty() const { return static_cast<WebAnimationImpl::TargetProperty>(m_animation->targetProperty()); diff --git a/Source/WebKit/chromium/src/WebAnimationImpl.h b/Source/WebKit/chromium/src/WebAnimationImpl.h index d7ceba51f..ccf451786 100644 --- a/Source/WebKit/chromium/src/WebAnimationImpl.h +++ b/Source/WebKit/chromium/src/WebAnimationImpl.h @@ -37,10 +37,11 @@ namespace WebKit { class WebAnimationImpl : public WebAnimation { public: - WebAnimationImpl(const WebAnimationCurve&, int animationId, int groupId, TargetProperty); + WebAnimationImpl(const WebAnimationCurve&, TargetProperty, int animationId, int groupId = 0); virtual ~WebAnimationImpl(); // WebAnimation implementation + virtual int id() OVERRIDE; virtual TargetProperty targetProperty() const OVERRIDE; virtual int iterations() const OVERRIDE; virtual void setIterations(int) OVERRIDE; diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp index 8084d715c..16222ac4f 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.cpp @@ -27,63 +27,16 @@ #include "WebCompositorInputHandlerImpl.h" -#include "CCActiveGestureAnimation.h" -#include "CCProxy.h" +#include "PlatformGestureCurveFactory.h" #include "PlatformGestureCurveTarget.h" -#include "TouchpadFlingPlatformGestureCurve.h" #include "TraceEvent.h" -#include "WebCompositorImpl.h" #include "WebCompositorInputHandlerClient.h" #include "WebInputEvent.h" +#include <public/WebInputHandlerClient.h> #include <wtf/ThreadingPrimitives.h> using namespace WebCore; -namespace WebCore { - -PassOwnPtr<CCInputHandler> CCInputHandler::create(CCInputHandlerClient* inputHandlerClient) -{ - return WebKit::WebCompositorInputHandlerImpl::create(inputHandlerClient); -} - -class PlatformGestureToCCGestureAdapter : public CCGestureCurve, public PlatformGestureCurveTarget { -public: - static PassOwnPtr<CCGestureCurve> create(PassOwnPtr<PlatformGestureCurve> platformCurve) - { - return adoptPtr(new PlatformGestureToCCGestureAdapter(platformCurve)); - } - - virtual const char* debugName() const - { - return m_curve->debugName(); - } - - virtual bool apply(double time, CCGestureCurveTarget* target) - { - ASSERT(target); - m_target = target; - return m_curve->apply(time, this); - } - - virtual void scrollBy(const IntPoint& scrollDelta) - { - ASSERT(m_target); - m_target->scrollBy(scrollDelta); - } - -private: - PlatformGestureToCCGestureAdapter(PassOwnPtr<PlatformGestureCurve> curve) - : m_curve(curve) - , m_target(0) - { - } - - OwnPtr<PlatformGestureCurve> m_curve; - CCGestureCurveTarget* m_target; -}; - -} - namespace WebKit { // These statics may only be accessed from the compositor thread. @@ -95,15 +48,8 @@ WebCompositorInputHandler* WebCompositorInputHandler::fromIdentifier(int identif return WebCompositorInputHandlerImpl::fromIdentifier(identifier); } -PassOwnPtr<WebCompositorInputHandlerImpl> WebCompositorInputHandlerImpl::create(WebCore::CCInputHandlerClient* inputHandlerClient) -{ - return adoptPtr(new WebCompositorInputHandlerImpl(inputHandlerClient)); -} - WebCompositorInputHandler* WebCompositorInputHandlerImpl::fromIdentifier(int identifier) { - ASSERT(WebCompositorImpl::initialized()); - ASSERT(CCProxy::isImplThread()); if (!s_compositors) return 0; @@ -115,26 +61,20 @@ WebCompositorInputHandler* WebCompositorInputHandlerImpl::fromIdentifier(int ide return 0; } -WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl(CCInputHandlerClient* inputHandlerClient) +WebCompositorInputHandlerImpl::WebCompositorInputHandlerImpl() : m_client(0) , m_identifier(s_nextAvailableIdentifier++) - , m_inputHandlerClient(inputHandlerClient) + , m_inputHandlerClient(0) #ifndef NDEBUG , m_expectScrollUpdateEnd(false) , m_expectPinchUpdateEnd(false) #endif , m_gestureScrollStarted(false) { - ASSERT(CCProxy::isImplThread()); - - if (!s_compositors) - s_compositors = new HashSet<WebCompositorInputHandlerImpl*>; - s_compositors->add(this); } WebCompositorInputHandlerImpl::~WebCompositorInputHandlerImpl() { - ASSERT(CCProxy::isImplThread()); if (m_client) m_client->willShutdown(); @@ -148,7 +88,6 @@ WebCompositorInputHandlerImpl::~WebCompositorInputHandlerImpl() void WebCompositorInputHandlerImpl::setClient(WebCompositorInputHandlerClient* client) { - ASSERT(CCProxy::isImplThread()); // It's valid to set a new client if we've never had one or to clear the client, but it's not valid to change from having one client to a different one. ASSERT(!m_client || !client); m_client = client; @@ -156,7 +95,6 @@ void WebCompositorInputHandlerImpl::setClient(WebCompositorInputHandlerClient* c void WebCompositorInputHandlerImpl::handleInputEvent(const WebInputEvent& event) { - ASSERT(CCProxy::isImplThread()); ASSERT(m_client); WebCompositorInputHandlerImpl::EventDisposition disposition = handleInputEventInternal(event); @@ -177,19 +115,19 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h { if (event.type == WebInputEvent::MouseWheel) { const WebMouseWheelEvent& wheelEvent = *static_cast<const WebMouseWheelEvent*>(&event); - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(wheelEvent.x, wheelEvent.y), CCInputHandlerClient::Wheel); + WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(wheelEvent.x, wheelEvent.y), WebInputHandlerClient::ScrollInputTypeWheel); switch (scrollStatus) { - case CCInputHandlerClient::ScrollStarted: { + case WebInputHandlerClient::ScrollStatusStarted: { TRACE_EVENT_INSTANT2("cc", "WebCompositorInputHandlerImpl::handleInput wheel scroll", "deltaX", -wheelEvent.deltaX, "deltaY", -wheelEvent.deltaY); - m_inputHandlerClient->scrollBy(IntPoint(wheelEvent.x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); + m_inputHandlerClient->scrollBy(WebPoint(wheelEvent.x, wheelEvent.y), IntSize(-wheelEvent.deltaX, -wheelEvent.deltaY)); m_inputHandlerClient->scrollEnd(); return DidHandle; } - case CCInputHandlerClient::ScrollIgnored: + case WebInputHandlerClient::ScrollStatusIgnored: // FIXME: This should be DropEvent, but in cases where we fail to properly sync scrollability it's safer to send the // event to the main thread. Change back to DropEvent once we have synchronization bugs sorted out. return DidNotHandle; - case CCInputHandlerClient::ScrollOnMainThread: + case WebInputHandlerClient::ScrollStatusOnMainThread: return DidNotHandle; } } else if (event.type == WebInputEvent::GestureScrollBegin) { @@ -199,14 +137,14 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h m_expectScrollUpdateEnd = true; #endif const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture); + WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(gestureEvent.x, gestureEvent.y), WebInputHandlerClient::ScrollInputTypeGesture); switch (scrollStatus) { - case CCInputHandlerClient::ScrollStarted: + case WebInputHandlerClient::ScrollStatusStarted: m_gestureScrollStarted = true; return DidHandle; - case CCInputHandlerClient::ScrollOnMainThread: + case WebInputHandlerClient::ScrollStatusOnMainThread: return DidNotHandle; - case CCInputHandlerClient::ScrollIgnored: + case WebInputHandlerClient::ScrollStatusIgnored: return DropEvent; } } else if (event.type == WebInputEvent::GestureScrollUpdate) { @@ -216,7 +154,8 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h return DidNotHandle; const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - m_inputHandlerClient->scrollBy(IntPoint(gestureEvent.x, gestureEvent.y), IntSize(-gestureEvent.deltaX, -gestureEvent.deltaY)); + m_inputHandlerClient->scrollBy(WebPoint(gestureEvent.x, gestureEvent.y), + IntSize(-gestureEvent.data.scrollUpdate.deltaX, -gestureEvent.data.scrollUpdate.deltaY)); return DidHandle; } else if (event.type == WebInputEvent::GestureScrollEnd) { ASSERT(m_expectScrollUpdateEnd); @@ -246,7 +185,7 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h } else if (event.type == WebInputEvent::GesturePinchUpdate) { ASSERT(m_expectPinchUpdateEnd); const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); - m_inputHandlerClient->pinchGestureUpdate(gestureEvent.deltaX, IntPoint(gestureEvent.x, gestureEvent.y)); + m_inputHandlerClient->pinchGestureUpdate(gestureEvent.data.pinchUpdate.scale, WebPoint(gestureEvent.x, gestureEvent.y)); return DidHandle; } else if (event.type == WebInputEvent::GestureFlingStart) { const WebGestureEvent& gestureEvent = *static_cast<const WebGestureEvent*>(&event); @@ -263,24 +202,24 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::handleGestureFling(const WebGestureEvent& gestureEvent) { - CCInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(IntPoint(gestureEvent.x, gestureEvent.y), CCInputHandlerClient::Gesture); + WebInputHandlerClient::ScrollStatus scrollStatus = m_inputHandlerClient->scrollBegin(WebPoint(gestureEvent.x, gestureEvent.y), WebInputHandlerClient::ScrollInputTypeGesture); switch (scrollStatus) { - case CCInputHandlerClient::ScrollStarted: { - TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started"); - OwnPtr<PlatformGestureCurve> flingCurve = TouchpadFlingPlatformGestureCurve::create(FloatPoint(gestureEvent.deltaX, gestureEvent.deltaY)); - m_wheelFlingAnimation = CCActiveGestureAnimation::create(PlatformGestureToCCGestureAdapter::create(flingCurve.release()), this); - m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.deltaX, gestureEvent.deltaY); + case WebInputHandlerClient::ScrollStatusStarted: { + m_wheelFlingCurve = PlatformGestureCurveFactory::get()->createCurve(gestureEvent.data.flingStart.sourceDevice, FloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY)); + TRACE_EVENT_ASYNC_BEGIN1("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this, "curve", m_wheelFlingCurve->debugName()); + m_wheelFlingParameters.delta = WebFloatPoint(gestureEvent.data.flingStart.velocityX, gestureEvent.data.flingStart.velocityY); m_wheelFlingParameters.point = WebPoint(gestureEvent.x, gestureEvent.y); m_wheelFlingParameters.globalPoint = WebPoint(gestureEvent.globalX, gestureEvent.globalY); m_wheelFlingParameters.modifiers = gestureEvent.modifiers; + m_wheelFlingParameters.sourceDevice = gestureEvent.data.flingStart.sourceDevice; m_inputHandlerClient->scheduleAnimation(); return DidHandle; } - case CCInputHandlerClient::ScrollOnMainThread: { + case WebInputHandlerClient::ScrollStatusOnMainThread: { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::scrollOnMainThread"); return DidNotHandle; } - case CCInputHandlerClient::ScrollIgnored: { + case WebInputHandlerClient::ScrollStatusIgnored: { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::ignored"); // We still pass the curve to the main thread if there's nothing scrollable, in case something // registers a handler before the curve is over. @@ -290,21 +229,30 @@ WebCompositorInputHandlerImpl::EventDisposition WebCompositorInputHandlerImpl::h return DidNotHandle; } -int WebCompositorInputHandlerImpl::identifier() const +void WebCompositorInputHandlerImpl::bindToClient(WebInputHandlerClient* client) { - ASSERT(CCProxy::isImplThread()); - return m_identifier; + ASSERT(!m_inputHandlerClient); + + TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::bindToClient"); + if (!s_compositors) + s_compositors = new HashSet<WebCompositorInputHandlerImpl*>; + s_compositors->add(this); + + m_inputHandlerClient = client; } void WebCompositorInputHandlerImpl::animate(double monotonicTime) { - if (!m_wheelFlingAnimation) + if (!m_wheelFlingCurve) return; - if (!m_wheelFlingParameters.startTime) + if (!m_wheelFlingParameters.startTime) { m_wheelFlingParameters.startTime = monotonicTime; + m_inputHandlerClient->scheduleAnimation(); + return; + } - if (m_wheelFlingAnimation->animate(monotonicTime)) + if (m_wheelFlingCurve->apply(monotonicTime - m_wheelFlingParameters.startTime, this)) m_inputHandlerClient->scheduleAnimation(); else { TRACE_EVENT_INSTANT0("cc", "WebCompositorInputHandlerImpl::animate::flingOver"); @@ -314,9 +262,12 @@ void WebCompositorInputHandlerImpl::animate(double monotonicTime) bool WebCompositorInputHandlerImpl::cancelCurrentFling() { - bool hadFlingAnimation = m_wheelFlingAnimation; + bool hadFlingAnimation = m_wheelFlingCurve; + if (hadFlingAnimation) + TRACE_EVENT_ASYNC_END0("cc", "WebCompositorInputHandlerImpl::handleGestureFling::started", this); + TRACE_EVENT_INSTANT1("cc", "WebCompositorInputHandlerImpl::cancelCurrentFling", "hadFlingAnimation", hadFlingAnimation); - m_wheelFlingAnimation.clear(); + m_wheelFlingCurve.clear(); m_wheelFlingParameters = WebActiveWheelFlingParameters(); return hadFlingAnimation; } diff --git a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h index 9474b2193..fa81de945 100644 --- a/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h +++ b/Source/WebKit/chromium/src/WebCompositorInputHandlerImpl.h @@ -26,12 +26,11 @@ #ifndef WebCompositorInputHandlerImpl_h #define WebCompositorInputHandlerImpl_h -#include "CCGestureCurve.h" -#include "CCInputHandler.h" +#include "PlatformGestureCurveTarget.h" #include "WebActiveWheelFlingParameters.h" #include "WebCompositorInputHandler.h" #include "WebInputEvent.h" -#include <public/WebCompositor.h> +#include <public/WebInputHandler.h> #include <wtf/HashSet.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> @@ -42,36 +41,35 @@ class Mutex; namespace WebCore { class IntPoint; -class CCGestureCurveTarget; -class CCInputHandlerClient; -class CCThread; +class PlatformGestureCurve; } namespace WebKit { class WebCompositorInputHandlerClient; -class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebCore::CCInputHandler, public WebCore::CCGestureCurveTarget { +class WebCompositorInputHandlerImpl : public WebCompositorInputHandler, public WebInputHandler, public WebCore::PlatformGestureCurveTarget { WTF_MAKE_NONCOPYABLE(WebCompositorInputHandlerImpl); public: - static PassOwnPtr<WebCompositorInputHandlerImpl> create(WebCore::CCInputHandlerClient*); static WebCompositorInputHandler* fromIdentifier(int identifier); + WebCompositorInputHandlerImpl(); virtual ~WebCompositorInputHandlerImpl(); // WebCompositorInputHandler implementation. virtual void setClient(WebCompositorInputHandlerClient*); virtual void handleInputEvent(const WebInputEvent&); - // WebCore::CCInputHandler implementation. - virtual int identifier() const; + // WebInputHandler implementation. + virtual void bindToClient(WebInputHandlerClient*); virtual void animate(double monotonicTime); - // WebCore::CCGestureCurveTarget implementation. + // WebCore::PlatformGestureCurveTarget implementation. virtual void scrollBy(const WebCore::IntPoint&); + int identifier() const { return m_identifier; } + private: - explicit WebCompositorInputHandlerImpl(WebCore::CCInputHandlerClient*); enum EventDisposition { DidHandle, DidNotHandle, DropEvent }; // This function processes the input event and determines the disposition, but does not make @@ -83,13 +81,13 @@ private: // Returns true if we actually had an active fling to cancel. bool cancelCurrentFling(); - OwnPtr<WebCore::CCActiveGestureAnimation> m_wheelFlingAnimation; + OwnPtr<WebCore::PlatformGestureCurve> m_wheelFlingCurve; // Parameters for the active fling animation, stored in case we need to transfer it out later. WebActiveWheelFlingParameters m_wheelFlingParameters; WebCompositorInputHandlerClient* m_client; int m_identifier; - WebCore::CCInputHandlerClient* m_inputHandlerClient; + WebInputHandlerClient* m_inputHandlerClient; #ifndef NDEBUG bool m_expectScrollUpdateEnd; diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp index fa21e8974..862b19be6 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.cpp @@ -26,6 +26,7 @@ #include "config.h" #include "WebContentLayerImpl.h" +#include "ContentLayerChromium.h" #include "SkMatrix44.h" #include <public/WebContentLayerClient.h> #include <public/WebFloatPoint.h> @@ -43,40 +44,45 @@ WebContentLayer* WebContentLayer::create(WebContentLayerClient* client) } WebContentLayerImpl::WebContentLayerImpl(WebContentLayerClient* client) - : m_webLayerImpl(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) + : m_layer(adoptPtr(new WebLayerImpl(ContentLayerChromium::create(this)))) , m_client(client) { - m_webLayerImpl->layer()->setIsDrawable(true); + m_layer->layer()->setIsDrawable(true); } WebContentLayerImpl::~WebContentLayerImpl() { - static_cast<ContentLayerChromium*>(m_webLayerImpl->layer())->clearDelegate(); + static_cast<ContentLayerChromium*>(m_layer->layer())->clearClient(); } WebLayer* WebContentLayerImpl::layer() { - return m_webLayerImpl.get(); + return m_layer.get(); } void WebContentLayerImpl::setDoubleSided(bool doubleSided) { - m_webLayerImpl->layer()->setDoubleSided(doubleSided); + m_layer->layer()->setDoubleSided(doubleSided); } -void WebContentLayerImpl::setContentsScale(float scale) +void WebContentLayerImpl::setBoundsContainPageScale(bool boundsContainPageScale) { - m_webLayerImpl->layer()->setContentsScale(scale); + return m_layer->layer()->setBoundsContainPageScale(boundsContainPageScale); +} + +bool WebContentLayerImpl::boundsContainPageScale() const +{ + return m_layer->layer()->boundsContainPageScale(); } void WebContentLayerImpl::setUseLCDText(bool enable) { - m_webLayerImpl->layer()->setUseLCDText(enable); + m_layer->layer()->setUseLCDText(enable); } void WebContentLayerImpl::setDrawCheckerboardForMissingTiles(bool enable) { - m_webLayerImpl->layer()->setDrawCheckerboardForMissingTiles(enable); + m_layer->layer()->setDrawCheckerboardForMissingTiles(enable); } diff --git a/Source/WebKit/chromium/src/WebContentLayerImpl.h b/Source/WebKit/chromium/src/WebContentLayerImpl.h index 511f8e0ba..45fa79b0e 100644 --- a/Source/WebKit/chromium/src/WebContentLayerImpl.h +++ b/Source/WebKit/chromium/src/WebContentLayerImpl.h @@ -26,33 +26,34 @@ #ifndef WebContentLayerImpl_h #define WebContentLayerImpl_h -#include "ContentLayerChromium.h" +#include "ContentLayerChromiumClient.h" #include "WebLayerImpl.h" #include <public/WebContentLayer.h> -#include <wtf/PassRefPtr.h> +#include <wtf/OwnPtr.h> namespace WebKit { class WebContentLayerClient; class WebContentLayerImpl : public WebContentLayer, - public WebCore::ContentLayerDelegate { + public WebCore::ContentLayerChromiumClient { public: explicit WebContentLayerImpl(WebContentLayerClient*); // WebContentLayer implementation. virtual WebLayer* layer() OVERRIDE; virtual void setDoubleSided(bool) OVERRIDE; - virtual void setContentsScale(float) OVERRIDE; + virtual void setBoundsContainPageScale(bool) OVERRIDE; + virtual bool boundsContainPageScale() const OVERRIDE; virtual void setUseLCDText(bool) OVERRIDE; virtual void setDrawCheckerboardForMissingTiles(bool) OVERRIDE; protected: virtual ~WebContentLayerImpl(); - // ContentLayerDelegate implementation. + // ContentLayerChromiumClient implementation. virtual void paintContents(SkCanvas*, const WebCore::IntRect& clip, WebCore::FloatRect& opaque) OVERRIDE; - OwnPtr<WebLayerImpl> m_webLayerImpl; + OwnPtr<WebLayerImpl> m_layer; WebContentLayerClient* m_client; bool m_drawsContent; }; diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index c639f674d..a0a75b48c 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -45,7 +45,6 @@ #include "PageGroup.h" #include "PageScriptDebugServer.h" #include "painting/GraphicsContextBuilder.h" -#include "PlatformString.h" #include "RenderView.h" #include "ResourceError.h" #include "ResourceRequest.h" @@ -67,6 +66,7 @@ #include <wtf/MathExtras.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> +#include <wtf/text/WTFString.h> using namespace WebCore; using namespace std; diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp index 800568a61..f723390b5 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.cpp @@ -43,7 +43,6 @@ #include "Node.h" #include "Page.h" #include "Pasteboard.h" -#include "PlatformString.h" #include "ScriptController.h" #include "SecurityOrigin.h" #include "Settings.h" @@ -59,6 +58,7 @@ #include "WebViewImpl.h" #include <wtf/OwnPtr.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h index a5dca3074..4030da7b3 100644 --- a/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsFrontendImpl.h @@ -31,11 +31,11 @@ #ifndef WebDevToolsFrontendImpl_h #define WebDevToolsFrontendImpl_h -#include "PlatformString.h" #include "WebDevToolsFrontend.h" #include <wtf/Forward.h> #include <wtf/Noncopyable.h> #include <wtf/Vector.h> +#include <wtf/text/WTFString.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebEntities.h b/Source/WebKit/chromium/src/WebEntities.h index f21056664..68a434367 100644 --- a/Source/WebKit/chromium/src/WebEntities.h +++ b/Source/WebKit/chromium/src/WebEntities.h @@ -31,8 +31,8 @@ #ifndef WebEntities_h #define WebEntities_h -#include "PlatformString.h" #include <wtf/HashMap.h> +#include <wtf/text/WTFString.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h index 5348895bf..6c03c2342 100644 --- a/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h +++ b/Source/WebKit/chromium/src/WebExternalTextureLayerImpl.h @@ -26,7 +26,7 @@ #ifndef WebExternalTextureLayerImpl_h #define WebExternalTextureLayerImpl_h -#include "TextureLayerChromium.h" +#include "TextureLayerChromiumClient.h" #include <public/WebExternalTextureLayer.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp index 9f5665cb8..4349f84e2 100644 --- a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.cpp @@ -37,11 +37,11 @@ namespace WebKit { WebFloatAnimationCurve* WebFloatAnimationCurve::create() { - return new WebFloatAnimationCurveImpl(WebCore::CCKeyframedFloatAnimationCurve::create()); + return new WebFloatAnimationCurveImpl(); } -WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve> curve) - : m_curve(curve) +WebFloatAnimationCurveImpl::WebFloatAnimationCurveImpl() + : m_curve(WebCore::CCKeyframedFloatAnimationCurve::create()) { } diff --git a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h index e8f1620d6..12ca3c66e 100644 --- a/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h +++ b/Source/WebKit/chromium/src/WebFloatAnimationCurveImpl.h @@ -38,7 +38,7 @@ namespace WebKit { class WebFloatAnimationCurveImpl : public WebFloatAnimationCurve { public: - explicit WebFloatAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedFloatAnimationCurve>); + WebFloatAnimationCurveImpl(); virtual ~WebFloatAnimationCurveImpl(); // WebAnimationCurve implementation. diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 4279febe0..4395c6d70 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -170,6 +170,7 @@ #include "WebSecurityOrigin.h" #include "WebViewImpl.h" #include "XPathResult.h" +#include "htmlediting.h" #include "markup.h" #include "painting/GraphicsContextBuilder.h" #include "platform/WebFloatPoint.h" @@ -1190,6 +1191,11 @@ bool WebFrameImpl::isProcessingUserGesture() const return ScriptController::processingUserGesture(); } +bool WebFrameImpl::consumeUserGesture() const +{ + return UserGestureIndicator::consumeUserGesture(); +} + bool WebFrameImpl::willSuppressOpenerInNewFrame() const { return frame()->loader()->suppressOpenerInNewFrame(); @@ -1257,7 +1263,7 @@ size_t WebFrameImpl::characterIndexForPoint(const WebPoint& webPoint) const return notFound; IntPoint point = frame()->view()->windowToContents(webPoint); - HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point, false); + HitTestResult result = frame()->eventHandler()->hitTestResultAtPoint(point); RefPtr<Range> range = frame()->rangeForPoint(result.roundedPoint()); if (!range) return notFound; @@ -1460,24 +1466,69 @@ bool WebFrameImpl::selectWordAroundCaret() void WebFrameImpl::selectRange(const WebPoint& start, const WebPoint& end) { - VisiblePosition startPosition = visiblePositionForWindowPoint(start); - VisiblePosition endPosition = visiblePositionForWindowPoint(end); + if (start == end && moveCaret(start)) + return; - // To correctly handle editable boundaries, we adjust the selection by setting its extent - // while keeping its base fixed. For a touch-based UI, this means that moving the selection - // handles behaves like a drag-select with the mouse, which is what we want here. If both - // endpoints changed, we need to set the extent twice. - // FIXME: the WebFrame::SelectRange API should explicitly state which endpoint is moving. - VisibleSelection newSelection = frame()->selection()->selection(); - if (startPosition != newSelection.visibleStart()) - newSelection = VisibleSelection(newSelection.visibleEnd(), startPosition); - if (endPosition != newSelection.visibleEnd()) - newSelection = VisibleSelection(newSelection.visibleStart(), endPosition); + if (moveSelectionStart(start, true) && moveSelectionEnd(end, true)) + return; + // Failed to move endpoints, probably because there's no current selection. + // Just set the selection explicitly (but this won't handle editable boundaries correctly). + VisibleSelection newSelection(visiblePositionForWindowPoint(start), visiblePositionForWindowPoint(end)); if (frame()->selection()->shouldChangeSelection(newSelection)) frame()->selection()->setSelection(newSelection, CharacterGranularity); } +bool WebFrameImpl::moveSelectionStart(const WebPoint& point, bool allowCollapsedSelection) +{ + const VisibleSelection& selection = frame()->selection()->selection(); + if (selection.isNone()) + return false; + + VisiblePosition start = visiblePositionForWindowPoint(point); + if (!allowCollapsedSelection) { + VisiblePosition maxStart = selection.visibleEnd().previous(); + if (comparePositions(start, maxStart) > 0) + start = maxStart; + } + + // start is moving, so base=end, extent=start + VisibleSelection newSelection = VisibleSelection(selection.visibleEnd(), start); + frame()->selection()->setNonDirectionalSelectionIfNeeded(newSelection, CharacterGranularity); + return true; +} + +bool WebFrameImpl::moveSelectionEnd(const WebPoint& point, bool allowCollapsedSelection) +{ + const VisibleSelection& selection = frame()->selection()->selection(); + if (selection.isNone()) + return false; + + VisiblePosition end = visiblePositionForWindowPoint(point); + if (!allowCollapsedSelection) { + VisiblePosition minEnd = selection.visibleStart().next(); + if (comparePositions(end, minEnd) < 0) + end = minEnd; + } + + // end is moving, so base=start, extent=end + VisibleSelection newSelection = VisibleSelection(selection.visibleStart(), end); + frame()->selection()->setNonDirectionalSelectionIfNeeded(newSelection, CharacterGranularity); + return true; +} + +bool WebFrameImpl::moveCaret(const WebPoint& point) +{ + FrameSelection* frameSelection = frame()->selection(); + if (frameSelection->isNone() || !frameSelection->isContentEditable()) + return false; + + VisiblePosition pos = visiblePositionForWindowPoint(point); + frameSelection->setExtent(pos, UserTriggered); + frameSelection->setBase(frameSelection->extent(), UserTriggered); + return true; +} + void WebFrameImpl::selectRange(const WebRange& webRange) { RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange); diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index 20c5fe9d3..e59c932c5 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -36,10 +36,10 @@ #include "Frame.h" #include "FrameLoaderClientImpl.h" -#include "PlatformString.h" #include <wtf/Compiler.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> +#include <wtf/text/WTFString.h> namespace WebCore { class GraphicsContext; @@ -162,6 +162,7 @@ public: virtual void commitDocumentData(const char* data, size_t length); virtual unsigned unloadListenerCount() const; virtual bool isProcessingUserGesture() const; + virtual bool consumeUserGesture() const; virtual bool willSuppressOpenerInNewFrame() const; virtual void replaceSelection(const WebString&); virtual void insertText(const WebString&); @@ -185,6 +186,9 @@ public: virtual bool selectWordAroundCaret(); virtual void selectRange(const WebPoint& start, const WebPoint& end); virtual void selectRange(const WebRange&); + virtual bool moveSelectionStart(const WebPoint&, bool allowCollapsedSelection); + virtual bool moveSelectionEnd(const WebPoint&, bool allowCollapsedSelection); + virtual bool moveCaret(const WebPoint&); virtual int printBegin(const WebPrintParams&, const WebNode& constrainToNode, bool* useBrowserOverlays); diff --git a/Source/WebKit/chromium/src/WebIDBKey.cpp b/Source/WebKit/chromium/src/WebIDBKey.cpp index cfadafbac..d60b5f5c1 100644 --- a/Source/WebKit/chromium/src/WebIDBKey.cpp +++ b/Source/WebKit/chromium/src/WebIDBKey.cpp @@ -32,10 +32,6 @@ #include "IDBBindingUtilities.h" #include "IDBKey.h" -#include "IDBKeyPath.h" -#include "SerializedScriptValue.h" -#include "WebIDBKeyPath.h" -#include "platform/WebSerializedScriptValue.h" using namespace WebCore; @@ -83,19 +79,6 @@ WebIDBKey WebIDBKey::createNull() return key; } -WebIDBKey WebIDBKey::createFromValueAndKeyPath(const WebSerializedScriptValue& serializedScriptValue, const WebIDBKeyPath& idbKeyPath) -{ - // FIXME: If key path is empty string, this should return invalid key instead - if (serializedScriptValue.isNull()) - return WebIDBKey::createNull(); - return createIDBKeyFromSerializedValueAndKeyPath(serializedScriptValue, idbKeyPath); -} - -WebSerializedScriptValue WebIDBKey::injectIDBKeyIntoSerializedValue(const WebIDBKey& key, const WebSerializedScriptValue& value, const WebIDBKeyPath& path) -{ - return WebCore::injectIDBKeyIntoSerializedValue(key, value, path); -} - void WebIDBKey::assign(const WebIDBKey& value) { m_private = value.m_private; diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp index bab70c61d..d2df09045 100644 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.cpp @@ -35,14 +35,13 @@ namespace WebKit { WebIOSurfaceLayer* WebIOSurfaceLayer::create() { - RefPtr<IOSurfaceLayerChromium> layer = IOSurfaceLayerChromium::create(); - layer->setIsDrawable(true); - return new WebIOSurfaceLayerImpl(layer.release()); + return new WebIOSurfaceLayerImpl(); } -WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl(PassRefPtr<IOSurfaceLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebIOSurfaceLayerImpl::WebIOSurfaceLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(IOSurfaceLayerChromium::create()))) { + m_layer->layer()->setIsDrawable(true); } WebIOSurfaceLayerImpl::~WebIOSurfaceLayerImpl() diff --git a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h index 3dbb02759..7aaeb02c1 100644 --- a/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h +++ b/Source/WebKit/chromium/src/WebIOSurfaceLayerImpl.h @@ -29,15 +29,11 @@ #include <public/WebIOSurfaceLayer.h> #include <wtf/OwnPtr.h> -namespace WebCore { -class IOSurfaceLayerChromium; -} - namespace WebKit { class WebIOSurfaceLayerImpl : public WebIOSurfaceLayer { public: - explicit WebIOSurfaceLayerImpl(PassRefPtr<WebCore::IOSurfaceLayerChromium>); + WebIOSurfaceLayerImpl(); virtual ~WebIOSurfaceLayerImpl(); // WebIOSurfaceLayer implementation. diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp b/Source/WebKit/chromium/src/WebImageLayerImpl.cpp index d93af8045..7038e3550 100644 --- a/Source/WebKit/chromium/src/WebImageLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebImageLayerImpl.cpp @@ -35,11 +35,11 @@ namespace WebKit { WebImageLayer* WebImageLayer::create() { - return new WebImageLayerImpl(WebCore::ImageLayerChromium::create()); + return new WebImageLayerImpl(); } -WebImageLayerImpl::WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebImageLayerImpl::WebImageLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(ImageLayerChromium::create()))) { } diff --git a/Source/WebKit/chromium/src/WebImageLayerImpl.h b/Source/WebKit/chromium/src/WebImageLayerImpl.h index 9a4b8b3eb..feea60b9c 100644 --- a/Source/WebKit/chromium/src/WebImageLayerImpl.h +++ b/Source/WebKit/chromium/src/WebImageLayerImpl.h @@ -38,7 +38,7 @@ class WebLayerImpl; class WebImageLayerImpl : public WebImageLayer { public: - explicit WebImageLayerImpl(PassRefPtr<WebCore::ImageLayerChromium>); + WebImageLayerImpl(); virtual ~WebImageLayerImpl(); // WebImageLayer implementation. diff --git a/Source/WebKit/chromium/src/WebInputEvent.cpp b/Source/WebKit/chromium/src/WebInputEvent.cpp index d61eb2d31..96123c62e 100644 --- a/Source/WebKit/chromium/src/WebInputEvent.cpp +++ b/Source/WebKit/chromium/src/WebInputEvent.cpp @@ -202,4 +202,41 @@ void WebKeyboardEvent::setKeyIdentifierFromWindowsKeyCode() snprintf(keyIdentifier, sizeof(keyIdentifier), "U+%04X", toupper(windowsKeyCode)); } +// static +int WebKeyboardEvent::windowsKeyCodeWithoutLocation(int keycode) +{ + switch (keycode) { + case VK_LCONTROL: + case VK_RCONTROL: + return VK_CONTROL; + case VK_LSHIFT: + case VK_RSHIFT: + return VK_SHIFT; + case VK_LMENU: + case VK_RMENU: + return VK_MENU; + default: + return keycode; + } +} + +// static +int WebKeyboardEvent::locationModifiersFromWindowsKeyCode(int keycode) +{ + switch (keycode) { + case VK_LCONTROL: + case VK_LSHIFT: + case VK_LMENU: + case VK_LWIN: + return IsLeft; + case VK_RCONTROL: + case VK_RSHIFT: + case VK_RMENU: + case VK_RWIN: + return IsRight; + default: + return 0; + } +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 0391c285b..2afc7dcfe 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -149,10 +149,14 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureScrollUpdate: m_type = PlatformEvent::GestureScrollUpdate; + m_deltaX = e.data.scrollUpdate.deltaX; + m_deltaY = e.data.scrollUpdate.deltaY; break; case WebInputEvent::GestureTap: m_type = PlatformEvent::GestureTap; - m_area = IntSize(e.boundingBox.width, e.boundingBox.height); + m_area = IntSize(e.data.tap.width, e.data.tap.height); + // FIXME: PlatformGestureEvent deltaX is overloaded - wkb.ug/93123 + m_deltaX = static_cast<int>(e.data.tap.tapCount); break; case WebInputEvent::GestureTapDown: m_type = PlatformEvent::GestureTapDown; @@ -165,7 +169,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GestureLongPress: m_type = PlatformEvent::GestureLongPress; - m_area = IntSize(e.boundingBox.width, e.boundingBox.height); + m_area = IntSize(e.data.longPress.width, e.data.longPress.height); break; case WebInputEvent::GesturePinchBegin: m_type = PlatformEvent::GesturePinchBegin; @@ -175,14 +179,14 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W break; case WebInputEvent::GesturePinchUpdate: m_type = PlatformEvent::GesturePinchUpdate; + // FIXME: PlatformGestureEvent deltaX is overloaded - wkb.ug/93123 + m_deltaX = e.data.pinchUpdate.scale; break; default: ASSERT_NOT_REACHED(); } m_position = widget->convertFromContainingWindow(IntPoint(e.x, e.y)); m_globalPosition = IntPoint(e.globalX, e.globalY); - m_deltaX = e.deltaX; - m_deltaY = e.deltaY; m_timestamp = e.timeStampSeconds; m_modifiers = 0; @@ -223,7 +227,6 @@ PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven m_unmodifiedText = String(e.unmodifiedText); m_keyIdentifier = String(e.keyIdentifier); m_autoRepeat = (e.modifiers & WebInputEvent::IsAutoRepeat); - m_windowsVirtualKeyCode = e.windowsKeyCode; m_nativeVirtualKeyCode = e.nativeKeyCode; m_isKeypad = (e.modifiers & WebInputEvent::IsKeyPad); m_isSystemKey = e.isSystemKey; @@ -237,6 +240,28 @@ PlatformKeyboardEventBuilder::PlatformKeyboardEventBuilder(const WebKeyboardEven m_modifiers |= PlatformEvent::AltKey; if (e.modifiers & WebInputEvent::MetaKey) m_modifiers |= PlatformEvent::MetaKey; + + // FIXME: PlatformKeyboardEvents expect a locational version of the keycode (e.g. VK_LSHIFT + // instead of VK_SHIFT). This should be changed so the location/keycode are stored separately, + // as in other places in the code. + m_windowsVirtualKeyCode = e.windowsKeyCode; + if (e.windowsKeyCode == VK_SHIFT) { + if (e.modifiers & WebInputEvent::IsLeft) + m_windowsVirtualKeyCode = VK_LSHIFT; + else if (e.modifiers & WebInputEvent::IsRight) + m_windowsVirtualKeyCode = VK_RSHIFT; + } else if (e.windowsKeyCode == VK_CONTROL) { + if (e.modifiers & WebInputEvent::IsLeft) + m_windowsVirtualKeyCode = VK_LCONTROL; + else if (e.modifiers & WebInputEvent::IsRight) + m_windowsVirtualKeyCode = VK_RCONTROL; + } else if (e.windowsKeyCode == VK_MENU) { + if (e.modifiers & WebInputEvent::IsLeft) + m_windowsVirtualKeyCode = VK_LMENU; + else if (e.modifiers & WebInputEvent::IsRight) + m_windowsVirtualKeyCode = VK_RMENU; + } + } void PlatformKeyboardEventBuilder::setKeyType(Type type) @@ -448,8 +473,12 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) return; // Skip all other keyboard events. modifiers = getWebInputModifiers(event); - if (event.keyLocation() & KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) + if (event.keyLocation() == KeyboardEvent::DOM_KEY_LOCATION_NUMPAD) modifiers |= WebInputEvent::IsKeyPad; + else if (event.keyLocation() == KeyboardEvent::DOM_KEY_LOCATION_LEFT) + modifiers |= WebInputEvent::IsLeft; + else if (event.keyLocation() == KeyboardEvent::DOM_KEY_LOCATION_RIGHT) + modifiers |= WebInputEvent::IsRight; timeStampSeconds = event.timeStamp() / millisPerSecond; windowsKeyCode = event.keyCode(); @@ -526,8 +555,11 @@ WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Gestu type = GestureScrollBegin; else if (event.type() == eventNames().gesturescrollendEvent) type = GestureScrollEnd; - else if (event.type() == eventNames().gesturescrollupdateEvent) + else if (event.type() == eventNames().gesturescrollupdateEvent) { type = GestureScrollUpdate; + data.scrollUpdate.deltaX = event.deltaX(); + data.scrollUpdate.deltaY = event.deltaY(); + } timeStampSeconds = event.timeStamp() / millisPerSecond; modifiers = getWebInputModifiers(event); @@ -536,9 +568,6 @@ WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Gestu globalY = event.screenY(); x = event.absoluteLocation().x() - widget->location().x(); y = event.absoluteLocation().y() - widget->location().y(); - - deltaX = event.deltaX(); - deltaY = event.deltaY(); } #endif // ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit/chromium/src/WebLayerImpl.cpp b/Source/WebKit/chromium/src/WebLayerImpl.cpp index bf64a8f2a..85f9b4db4 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerImpl.cpp @@ -79,7 +79,12 @@ SkMatrix44 skMatrix44FromTransformationMatrix(const WebTransformationMatrix& mat WebLayer* WebLayer::create() { - return new WebLayerImpl(LayerChromium::create()); + return new WebLayerImpl(); +} + +WebLayerImpl::WebLayerImpl() + : m_layer(LayerChromium::create()) +{ } WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) @@ -87,6 +92,7 @@ WebLayerImpl::WebLayerImpl(PassRefPtr<LayerChromium> layer) { } + WebLayerImpl::~WebLayerImpl() { m_layer->clearRenderSurface(); @@ -349,6 +355,16 @@ void WebLayerImpl::setScrollPosition(WebPoint position) m_layer->setScrollPosition(position); } +WebPoint WebLayerImpl::scrollPosition() const +{ + return m_layer->scrollPosition(); +} + +void WebLayerImpl::setMaxScrollPosition(WebSize maxScrollPosition) +{ + m_layer->setMaxScrollPosition(maxScrollPosition); +} + void WebLayerImpl::setScrollable(bool scrollable) { m_layer->setScrollable(scrollable); @@ -385,6 +401,11 @@ void WebLayerImpl::setFixedToContainerLayer(bool enable) m_layer->setFixedToContainerLayer(enable); } +void WebLayerImpl::setScrollClient(WebLayerScrollClient* scrollClient) +{ + m_layer->setLayerScrollClient(scrollClient); +} + LayerChromium* WebLayerImpl::layer() const { return m_layer.get(); diff --git a/Source/WebKit/chromium/src/WebLayerImpl.h b/Source/WebKit/chromium/src/WebLayerImpl.h index 0a61826a5..6739fd5ed 100644 --- a/Source/WebKit/chromium/src/WebLayerImpl.h +++ b/Source/WebKit/chromium/src/WebLayerImpl.h @@ -27,6 +27,7 @@ #define WebLayerImpl_h #include <public/WebLayer.h> +#include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -37,6 +38,7 @@ namespace WebKit { class WebLayerImpl : public WebLayer { public: + WebLayerImpl(); explicit WebLayerImpl(PassRefPtr<WebCore::LayerChromium>); virtual ~WebLayerImpl(); @@ -92,12 +94,15 @@ public: virtual void transferAnimationsTo(WebLayer*) OVERRIDE; virtual void setForceRenderSurface(bool) OVERRIDE; virtual void setScrollPosition(WebPoint) OVERRIDE; + virtual WebPoint scrollPosition() const OVERRIDE; + virtual void setMaxScrollPosition(WebSize) OVERRIDE; virtual void setScrollable(bool) OVERRIDE; virtual void setHaveWheelEventHandlers(bool) OVERRIDE; virtual void setShouldScrollOnMainThread(bool) OVERRIDE; virtual void setNonFastScrollableRegion(const WebVector<WebRect>&) OVERRIDE; virtual void setIsContainerForFixedPositionLayers(bool) OVERRIDE; virtual void setFixedToContainerLayer(bool) OVERRIDE; + virtual void setScrollClient(WebLayerScrollClient*) OVERRIDE; WebCore::LayerChromium* layer() const; diff --git a/Source/WebKit/chromium/src/WebLayerTreeView.cpp b/Source/WebKit/chromium/src/WebLayerTreeView.cpp deleted file mode 100644 index 7dfbcd129..000000000 --- a/Source/WebKit/chromium/src/WebLayerTreeView.cpp +++ /dev/null @@ -1,214 +0,0 @@ -/* - * Copyright (C) 2011 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 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 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 <public/WebLayerTreeView.h> - -#include "CCFontAtlas.h" -#include "CCGraphicsContext.h" -#include "CCLayerTreeHost.h" -#include "CCRenderingStats.h" -#include "LayerChromium.h" -#include "WebLayerImpl.h" -#include "WebLayerTreeViewImpl.h" -#include <public/WebLayer.h> -#include <public/WebPoint.h> -#include <public/WebRect.h> -#include <public/WebRenderingStats.h> -#include <public/WebSize.h> - -using namespace WebCore; - -namespace WebKit { - -WebLayerTreeView::Settings::operator CCLayerTreeSettings() const -{ - CCLayerTreeSettings settings; - settings.showFPSCounter = showFPSCounter; - settings.showPlatformLayerTree = showPlatformLayerTree; - settings.showPaintRects = showPaintRects; - settings.renderVSyncEnabled = renderVSyncEnabled; - settings.refreshRate = refreshRate; - settings.defaultTileSize = defaultTileSize; - settings.maxUntiledLayerSize = maxUntiledLayerSize; - settings.acceleratePainting = acceleratePainting; - - // FIXME: showFPSCounter / showPlatformLayerTree / maxPartialTextureUpdates aren't supported currently. - return settings; -} - -void WebLayerTreeView::reset() -{ - m_private.reset(0); -} - -bool WebLayerTreeView::isNull() const -{ - return !m_private.get(); -} - -bool WebLayerTreeView::initialize(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) -{ - // We have to leak the pointer here into a WebPrivateOwnPtr. We free this object in reset(). - m_private.reset(WebLayerTreeViewImpl::create(client, root, settings).leakPtr()); - return !isNull(); -} - -void WebLayerTreeView::setSurfaceReady() -{ - m_private->layerTreeHost()->setSurfaceReady(); -} - -void WebLayerTreeView::setRootLayer(WebLayer *root) -{ - if (root) - m_private->layerTreeHost()->setRootLayer(static_cast<WebLayerImpl*>(root)->layer()); - else - m_private->layerTreeHost()->setRootLayer(PassRefPtr<LayerChromium>()); -} - -int WebLayerTreeView::compositorIdentifier() -{ - return m_private->layerTreeHost()->compositorIdentifier(); -} - -void WebLayerTreeView::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize) -{ - if (!deviceViewportSize.isEmpty()) - m_private->layerTreeHost()->setViewportSize(layoutViewportSize, deviceViewportSize); - else - m_private->layerTreeHost()->setViewportSize(layoutViewportSize, layoutViewportSize); -} - -WebSize WebLayerTreeView::layoutViewportSize() const -{ - return WebSize(m_private->layerTreeHost()->layoutViewportSize()); -} - -WebSize WebLayerTreeView::deviceViewportSize() const -{ - return WebSize(m_private->layerTreeHost()->deviceViewportSize()); -} - -void WebLayerTreeView::setDeviceScaleFactor(const float deviceScaleFactor) -{ - m_private->layerTreeHost()->setDeviceScaleFactor(deviceScaleFactor); -} - -float WebLayerTreeView::deviceScaleFactor() const -{ - return m_private->layerTreeHost()->deviceScaleFactor(); -} - -void WebLayerTreeView::setBackgroundColor(WebColor color) -{ - m_private->layerTreeHost()->setBackgroundColor(color); -} - -void WebLayerTreeView::setHasTransparentBackground(bool transparent) -{ - m_private->layerTreeHost()->setHasTransparentBackground(transparent); -} - -void WebLayerTreeView::setVisible(bool visible) -{ - m_private->layerTreeHost()->setVisible(visible); -} - -void WebLayerTreeView::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) -{ - m_private->layerTreeHost()->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); -} - -void WebLayerTreeView::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) -{ - m_private->layerTreeHost()->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); -} - -void WebLayerTreeView::setNeedsAnimate() -{ - m_private->layerTreeHost()->setNeedsAnimate(); -} - -void WebLayerTreeView::setNeedsRedraw() -{ - m_private->layerTreeHost()->setNeedsRedraw(); -} - -bool WebLayerTreeView::commitRequested() const -{ - return m_private->layerTreeHost()->commitRequested(); -} - -void WebLayerTreeView::composite() -{ - if (CCProxy::hasImplThread()) - m_private->layerTreeHost()->setNeedsCommit(); - else - m_private->layerTreeHost()->composite(); -} - -void WebLayerTreeView::updateAnimations(double frameBeginTime) -{ - m_private->layerTreeHost()->updateAnimations(frameBeginTime); -} - -bool WebLayerTreeView::compositeAndReadback(void *pixels, const WebRect& rect) -{ - return m_private->layerTreeHost()->compositeAndReadback(pixels, rect); -} - -void WebLayerTreeView::finishAllRendering() -{ - m_private->layerTreeHost()->finishAllRendering(); -} - -void WebLayerTreeView::renderingStats(WebRenderingStats& stats) const -{ - CCRenderingStats ccStats; - m_private->layerTreeHost()->renderingStats(ccStats); - - stats.numAnimationFrames = ccStats.numAnimationFrames; - stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; - stats.droppedFrameCount = ccStats.droppedFrameCount; - stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; - stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; -} - -void WebLayerTreeView::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight) -{ - IntRect asciiToRectTable[128]; - for (int i = 0; i < 128; ++i) - asciiToRectTable[i] = asciiToWebRectTable[i]; - OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable, fontHeight); - m_private->layerTreeHost()->setFontAtlas(fontAtlas.release()); -} - -void WebLayerTreeView::loseCompositorContext(int numTimes) -{ - m_private->layerTreeHost()->loseContext(numTimes); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp index 1fd823976..bb898c966 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.cpp @@ -26,130 +26,35 @@ #include "config.h" #include "WebLayerTreeViewImpl.h" +#include "CCFontAtlas.h" +#include "CCInputHandler.h" #include "CCLayerTreeHost.h" -#include "CCThreadProxy.h" #include "LayerChromium.h" #include "WebLayerImpl.h" +#include "WebToCCInputHandlerAdapter.h" #include <public/WebGraphicsContext3D.h> +#include <public/WebInputHandler.h> #include <public/WebLayer.h> #include <public/WebLayerTreeView.h> #include <public/WebLayerTreeViewClient.h> +#include <public/WebRenderingStats.h> #include <public/WebSize.h> -#include <public/WebThread.h> using namespace WebCore; -namespace { - -// Adapts a pure WebGraphicsContext3D into a WebCompositorOutputSurface until -// downstream code can be updated to produce output surfaces directly. -class WebGraphicsContextToOutputSurfaceAdapter : public WebKit::WebCompositorOutputSurface { -public: - explicit WebGraphicsContextToOutputSurfaceAdapter(PassOwnPtr<WebKit::WebGraphicsContext3D> context) - : m_context3D(context) - , m_client(0) - { - } - - virtual bool bindToClient(WebKit::WebCompositorOutputSurfaceClient* client) OVERRIDE - { - ASSERT(client); - if (!m_context3D->makeContextCurrent()) - return false; - m_client = client; - return true; - } - - virtual const Capabilities& capabilities() const OVERRIDE - { - return m_capabilities; - } - - virtual WebKit::WebGraphicsContext3D* context3D() const OVERRIDE - { - return m_context3D.get(); - } - - virtual void sendFrameToParentCompositor(const WebKit::WebCompositorFrame&) OVERRIDE - { - } - -private: - OwnPtr<WebKit::WebGraphicsContext3D> m_context3D; - Capabilities m_capabilities; - WebKit::WebCompositorOutputSurfaceClient* m_client; -}; +namespace WebKit { +WebLayerTreeView* WebLayerTreeView::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) +{ + OwnPtr<WebLayerTreeViewImpl> layerTreeViewImpl = adoptPtr(new WebLayerTreeViewImpl(client)); + if (!layerTreeViewImpl->initialize(settings)) + return 0; + layerTreeViewImpl->setRootLayer(root); + return layerTreeViewImpl.leakPtr(); } -namespace WebKit { - -// Converts messages from CCLayerTreeHostClient to WebLayerTreeViewClient. -class WebLayerTreeViewClientAdapter : public WebCore::CCLayerTreeHostClient { -public: - WebLayerTreeViewClientAdapter(WebLayerTreeViewClient* client) - : m_client(client) - , m_usingRealOutputSurface(false) - { - } - virtual ~WebLayerTreeViewClientAdapter() { } - - // CCLayerTreeHostClient implementation - virtual void willBeginFrame() OVERRIDE { m_client->willBeginFrame(); } - virtual void didBeginFrame() OVERRIDE { m_client->didBeginFrame(); } - virtual void updateAnimations(double monotonicFrameBeginTime) OVERRIDE { m_client->updateAnimations(monotonicFrameBeginTime); } - virtual void layout() OVERRIDE { m_client->layout(); } - virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE { m_client->applyScrollAndScale(scrollDelta, pageScale); } - virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE - { - WebCompositorOutputSurface* outputSurface = m_client->createOutputSurface(); - if (outputSurface) { - m_usingRealOutputSurface = true; - return adoptPtr(outputSurface); - } - - // Temporarily, if the output surface can't be created, create a WebGraphicsContext3D - // directly. This allows bootstrapping the output surface system while downstream - // users of the API still use the old approach. - WebGraphicsContext3D* context = m_client->createContext3D(); - if (!context) - return nullptr; - - m_usingRealOutputSurface = false; - return adoptPtr(new WebGraphicsContextToOutputSurfaceAdapter(adoptPtr(context))); - } - - virtual void didRecreateOutputSurface(bool success) OVERRIDE - { - if (m_usingRealOutputSurface) { - m_client->didRecreateOutputSurface(success); - return; - } - m_client->didRebindGraphicsContext(success); - } - virtual void willCommit() OVERRIDE { m_client->willCommit(); } - virtual void didCommit() OVERRIDE { m_client->didCommit(); } - virtual void didCommitAndDrawFrame() OVERRIDE { m_client->didCommitAndDrawFrame(); } - virtual void didCompleteSwapBuffers() OVERRIDE { m_client->didCompleteSwapBuffers(); } - virtual void scheduleComposite() OVERRIDE { m_client->scheduleComposite(); } - -private: - WebLayerTreeViewClient* m_client; - bool m_usingRealOutputSurface; -}; - -PassOwnPtr<WebLayerTreeViewImpl> WebLayerTreeViewImpl::create(WebLayerTreeViewClient* client, const WebLayer& root, const WebLayerTreeView::Settings& settings) -{ - OwnPtr<WebLayerTreeViewImpl> impl = adoptPtr(new WebLayerTreeViewImpl(client, settings)); - if (!impl->layerTreeHost()) - return nullptr; - impl->layerTreeHost()->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer()); - return impl.release(); -} - -WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client, const WebLayerTreeView::Settings& settings) - : m_clientAdapter(adoptPtr(new WebLayerTreeViewClientAdapter(client))) - , m_layerTreeHost(CCLayerTreeHost::create(m_clientAdapter.get(), settings)) +WebLayerTreeViewImpl::WebLayerTreeViewImpl(WebLayerTreeViewClient* client) + : m_client(client) { } @@ -157,4 +62,221 @@ WebLayerTreeViewImpl::~WebLayerTreeViewImpl() { } +bool WebLayerTreeViewImpl::initialize(const WebLayerTreeView::Settings& webSettings) +{ + CCLayerTreeSettings settings; + settings.acceleratePainting = webSettings.acceleratePainting; + settings.showFPSCounter = webSettings.showFPSCounter; + settings.showPlatformLayerTree = webSettings.showPlatformLayerTree; + settings.showPaintRects = webSettings.showPaintRects; + settings.renderVSyncEnabled = webSettings.renderVSyncEnabled; + settings.refreshRate = webSettings.refreshRate; + settings.defaultTileSize = webSettings.defaultTileSize; + settings.maxUntiledLayerSize = webSettings.maxUntiledLayerSize; + m_layerTreeHost = CCLayerTreeHost::create(this, settings); + if (!m_layerTreeHost) + return false; + return true; +} + +void WebLayerTreeViewImpl::setSurfaceReady() +{ + m_layerTreeHost->setSurfaceReady(); +} + +void WebLayerTreeViewImpl::setRootLayer(const WebLayer& root) +{ + m_layerTreeHost->setRootLayer(static_cast<const WebLayerImpl*>(&root)->layer()); +} + +void WebLayerTreeViewImpl::clearRootLayer() +{ + m_layerTreeHost->setRootLayer(PassRefPtr<LayerChromium>()); +} + +void WebLayerTreeViewImpl::setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize) +{ + if (!deviceViewportSize.isEmpty()) + m_layerTreeHost->setViewportSize(layoutViewportSize, deviceViewportSize); + else + m_layerTreeHost->setViewportSize(layoutViewportSize, layoutViewportSize); +} + +WebSize WebLayerTreeViewImpl::layoutViewportSize() const +{ + return WebSize(m_layerTreeHost->layoutViewportSize()); +} + +WebSize WebLayerTreeViewImpl::deviceViewportSize() const +{ + return WebSize(m_layerTreeHost->deviceViewportSize()); +} + +void WebLayerTreeViewImpl::setDeviceScaleFactor(const float deviceScaleFactor) +{ + m_layerTreeHost->setDeviceScaleFactor(deviceScaleFactor); +} + +float WebLayerTreeViewImpl::deviceScaleFactor() const +{ + return m_layerTreeHost->deviceScaleFactor(); +} + +void WebLayerTreeViewImpl::setBackgroundColor(WebColor color) +{ + m_layerTreeHost->setBackgroundColor(color); +} + +void WebLayerTreeViewImpl::setHasTransparentBackground(bool transparent) +{ + m_layerTreeHost->setHasTransparentBackground(transparent); +} + +void WebLayerTreeViewImpl::setVisible(bool visible) +{ + m_layerTreeHost->setVisible(visible); +} + +void WebLayerTreeViewImpl::setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) +{ + m_layerTreeHost->setPageScaleFactorAndLimits(pageScaleFactor, minimum, maximum); +} + +void WebLayerTreeViewImpl::startPageScaleAnimation(const WebPoint& scroll, bool useAnchor, float newPageScale, double durationSec) +{ + m_layerTreeHost->startPageScaleAnimation(IntSize(scroll.x, scroll.y), useAnchor, newPageScale, durationSec); +} + +void WebLayerTreeViewImpl::setNeedsAnimate() +{ + m_layerTreeHost->setNeedsAnimate(); +} + +void WebLayerTreeViewImpl::setNeedsRedraw() +{ + m_layerTreeHost->setNeedsRedraw(); +} + +bool WebLayerTreeViewImpl::commitRequested() const +{ + return m_layerTreeHost->commitRequested(); +} + +void WebLayerTreeViewImpl::composite() +{ + if (CCProxy::hasImplThread()) + m_layerTreeHost->setNeedsCommit(); + else + m_layerTreeHost->composite(); +} + +void WebLayerTreeViewImpl::updateAnimations(double frameBeginTime) +{ + m_layerTreeHost->updateAnimations(frameBeginTime); +} + +bool WebLayerTreeViewImpl::compositeAndReadback(void *pixels, const WebRect& rect) +{ + return m_layerTreeHost->compositeAndReadback(pixels, rect); +} + +void WebLayerTreeViewImpl::finishAllRendering() +{ + m_layerTreeHost->finishAllRendering(); +} + +void WebLayerTreeViewImpl::renderingStats(WebRenderingStats& stats) const +{ + CCRenderingStats ccStats; + m_layerTreeHost->renderingStats(ccStats); + + stats.numAnimationFrames = ccStats.numAnimationFrames; + stats.numFramesSentToScreen = ccStats.numFramesSentToScreen; + stats.droppedFrameCount = ccStats.droppedFrameCount; + stats.totalPaintTimeInSeconds = ccStats.totalPaintTimeInSeconds; + stats.totalRasterizeTimeInSeconds = ccStats.totalRasterizeTimeInSeconds; +} + +void WebLayerTreeViewImpl::setFontAtlas(SkBitmap bitmap, WebRect asciiToWebRectTable[128], int fontHeight) +{ + IntRect asciiToRectTable[128]; + for (int i = 0; i < 128; ++i) + asciiToRectTable[i] = asciiToWebRectTable[i]; + OwnPtr<CCFontAtlas> fontAtlas = CCFontAtlas::create(bitmap, asciiToRectTable, fontHeight); + m_layerTreeHost->setFontAtlas(fontAtlas.release()); +} + +void WebLayerTreeViewImpl::loseCompositorContext(int numTimes) +{ + m_layerTreeHost->loseContext(numTimes); +} + +void WebLayerTreeViewImpl::willBeginFrame() +{ + m_client->willBeginFrame(); +} + +void WebLayerTreeViewImpl::didBeginFrame() +{ + m_client->didBeginFrame(); +} + +void WebLayerTreeViewImpl::animate(double monotonicFrameBeginTime) +{ + m_client->updateAnimations(monotonicFrameBeginTime); +} + +void WebLayerTreeViewImpl::layout() +{ + m_client->layout(); +} + +void WebLayerTreeViewImpl::applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) +{ + m_client->applyScrollAndScale(scrollDelta, pageScale); +} + +PassOwnPtr<WebCompositorOutputSurface> WebLayerTreeViewImpl::createOutputSurface() +{ + return adoptPtr(m_client->createOutputSurface()); +} + +void WebLayerTreeViewImpl::didRecreateOutputSurface(bool success) +{ + m_client->didRecreateOutputSurface(success); +} + +PassOwnPtr<CCInputHandler> WebLayerTreeViewImpl::createInputHandler() +{ + OwnPtr<WebInputHandler> handler = adoptPtr(m_client->createInputHandler()); + if (handler) + return WebToCCInputHandlerAdapter::create(handler.release()); + return nullptr; +} + +void WebLayerTreeViewImpl::willCommit() +{ + m_client->willCommit(); +} + +void WebLayerTreeViewImpl::didCommit() +{ + m_client->didCommit(); +} + +void WebLayerTreeViewImpl::didCommitAndDrawFrame() +{ + m_client->didCommitAndDrawFrame(); +} + +void WebLayerTreeViewImpl::didCompleteSwapBuffers() +{ + m_client->didCompleteSwapBuffers(); +} + +void WebLayerTreeViewImpl::scheduleComposite() +{ + m_client->scheduleComposite(); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h index 3bc43410d..a1dbd7404 100644 --- a/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h +++ b/Source/WebKit/chromium/src/WebLayerTreeViewImpl.h @@ -26,6 +26,7 @@ #ifndef WebLayerTreeViewImpl_h #define WebLayerTreeViewImpl_h +#include "CCLayerTreeHostClient.h" #include <public/WebLayerTreeView.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -39,17 +40,55 @@ class WebLayer; class WebLayerTreeViewClient; class WebLayerTreeViewClientAdapter; -class WebLayerTreeViewImpl { +class WebLayerTreeViewImpl : public WebLayerTreeView, public WebCore::CCLayerTreeHostClient { public: - static PassOwnPtr<WebLayerTreeViewImpl> create(WebLayerTreeViewClient*, const WebLayer& root, const WebLayerTreeView::Settings&); + explicit WebLayerTreeViewImpl(WebLayerTreeViewClient*); virtual ~WebLayerTreeViewImpl(); - WebCore::CCLayerTreeHost* layerTreeHost() { return m_layerTreeHost.get(); } + bool initialize(const Settings&); -private: - WebLayerTreeViewImpl(WebLayerTreeViewClient*, const WebLayerTreeView::Settings&); + // WebLayerTreeView implementation. + virtual void setSurfaceReady() OVERRIDE; + virtual void setRootLayer(const WebLayer&) OVERRIDE; + virtual void clearRootLayer() OVERRIDE; + virtual void setViewportSize(const WebSize& layoutViewportSize, const WebSize& deviceViewportSize = WebSize()) OVERRIDE; + virtual WebSize layoutViewportSize() const OVERRIDE; + virtual WebSize deviceViewportSize() const OVERRIDE; + virtual void setDeviceScaleFactor(float) OVERRIDE; + virtual float deviceScaleFactor() const OVERRIDE; + virtual void setBackgroundColor(WebColor) OVERRIDE; + virtual void setHasTransparentBackground(bool) OVERRIDE; + virtual void setVisible(bool) OVERRIDE; + virtual void setPageScaleFactorAndLimits(float pageScaleFactor, float minimum, float maximum) OVERRIDE; + virtual void startPageScaleAnimation(const WebPoint& destination, bool useAnchor, float newPageScale, double durationSec) OVERRIDE; + virtual void setNeedsAnimate() OVERRIDE; + virtual void setNeedsRedraw() OVERRIDE; + virtual bool commitRequested() const OVERRIDE; + virtual void composite() OVERRIDE; + virtual void updateAnimations(double frameBeginTime) OVERRIDE; + virtual bool compositeAndReadback(void *pixels, const WebRect&) OVERRIDE; + virtual void finishAllRendering() OVERRIDE; + virtual void renderingStats(WebRenderingStats&) const OVERRIDE; + virtual void setFontAtlas(SkBitmap, WebRect asciiToRectTable[128], int fontHeight) OVERRIDE; + virtual void loseCompositorContext(int numTimes) OVERRIDE; + + // WebCore::CCLayerTreeHostClient implementation. + virtual void willBeginFrame() OVERRIDE; + virtual void didBeginFrame() OVERRIDE; + virtual void animate(double monotonicFrameBeginTime) OVERRIDE; + virtual void layout() OVERRIDE; + virtual void applyScrollAndScale(const WebCore::IntSize& scrollDelta, float pageScale) OVERRIDE; + virtual PassOwnPtr<WebCompositorOutputSurface> createOutputSurface() OVERRIDE; + virtual void didRecreateOutputSurface(bool success) OVERRIDE; + virtual PassOwnPtr<WebCore::CCInputHandler> createInputHandler() OVERRIDE; + virtual void willCommit() OVERRIDE; + virtual void didCommit() OVERRIDE; + virtual void didCommitAndDrawFrame() OVERRIDE; + virtual void didCompleteSwapBuffers() OVERRIDE; + virtual void scheduleComposite() OVERRIDE; - OwnPtr<WebLayerTreeViewClientAdapter> m_clientAdapter; +private: + WebLayerTreeViewClient* m_client; OwnPtr<WebCore::CCLayerTreeHost> m_layerTreeHost; }; diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp index 72e871637..e570dca5a 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp @@ -12,6 +12,7 @@ #include "AudioSourceProviderClient.h" #include "Frame.h" #include "GraphicsContext.h" +#include "GraphicsLayerChromium.h" #include "HTMLMediaElement.h" #include "IntSize.h" #include "KURL.h" @@ -29,11 +30,13 @@ #include <public/Platform.h> #include <public/WebCString.h> #include <public/WebCanvas.h> +#include <public/WebCompositorSupport.h> #include <public/WebMimeRegistry.h> #include <public/WebRect.h> #include <public/WebSize.h> #include <public/WebString.h> #include <public/WebURL.h> +#include <public/WebVideoLayer.h> #if USE(ACCELERATED_COMPOSITING) #include "RenderLayerCompositor.h" @@ -97,6 +100,10 @@ WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl() #endif if (m_helperPlugin) closeHelperPlugin(); +#if USE(ACCELERATED_COMPOSITING) + if (m_videoLayer) + GraphicsLayerChromium::unregisterContentsLayer(m_videoLayer->layer()); +#endif } void WebMediaPlayerClientImpl::networkStateChanged() @@ -111,8 +118,10 @@ void WebMediaPlayerClientImpl::readyStateChanged() m_mediaPlayer->readyStateChanged(); #if USE(ACCELERATED_COMPOSITING) if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer) { - m_videoLayer = adoptPtr(WebVideoLayer::create(this)); + m_videoLayer = adoptPtr(Platform::current()->compositorSupport()->createVideoLayer(this)); + m_videoLayer->layer()->setOpaque(m_opaque); + GraphicsLayerChromium::registerContentsLayer(m_videoLayer->layer()); } #endif } @@ -431,6 +440,12 @@ bool WebMediaPlayerClientImpl::sourceAbort(const String& id) return m_webMediaPlayer->sourceAbort(id); } +void WebMediaPlayerClientImpl::sourceSetDuration(double duration) +{ + if (m_webMediaPlayer) + m_webMediaPlayer->sourceSetDuration(duration); +} + void WebMediaPlayerClientImpl::sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus status) { if (m_webMediaPlayer) diff --git a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h index 329fd9ec0..dd170e57c 100644 --- a/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h +++ b/Source/WebKit/chromium/src/WebMediaPlayerClientImpl.h @@ -39,7 +39,6 @@ #include "WebMediaPlayerClient.h" #include "WebStreamTextureClient.h" #include <public/WebVideoFrameProvider.h> -#include <public/WebVideoLayer.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> @@ -50,6 +49,7 @@ namespace WebKit { class WebHelperPluginImpl; class WebAudioSourceProvider; class WebMediaPlayer; +class WebVideoLayer; // This class serves as a bridge between WebCore::MediaPlayer and // WebKit::WebMediaPlayer. @@ -163,6 +163,7 @@ public: virtual WTF::PassRefPtr<WebCore::TimeRanges> sourceBuffered(const String&); virtual bool sourceAppend(const String&, const unsigned char* data, unsigned length); virtual bool sourceAbort(const String&); + virtual void sourceSetDuration(double); virtual void sourceEndOfStream(WebCore::MediaPlayer::EndOfStreamStatus); virtual bool sourceSetTimestampOffset(const String&, double offset); #endif diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index dd4b15ebd..793ca8b83 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -75,6 +75,8 @@ // override the incorrect base URL and make sure we alway load correct local // saved resource files. +#define WTF_DEPRECATED_STRING_OPERATORS + #include "config.h" #include "WebPageSerializerImpl.h" diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 75a97e0f6..524ba80f8 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -51,6 +51,7 @@ #include "FrameView.h" #include "GestureEvent.h" #include "GraphicsContext.h" +#include "GraphicsLayerChromium.h" #include "HitTestResult.h" #include "HostWindow.h" #include "HTMLFormElement.h" @@ -71,6 +72,8 @@ #include "WheelEvent.h" #include <public/Platform.h> #include <public/WebClipboard.h> +#include <public/WebCompositorSupport.h> +#include <public/WebExternalTextureLayer.h> #include <public/WebRect.h> #include <public/WebString.h> #include <public/WebURL.h> @@ -368,8 +371,10 @@ void WebPluginContainerImpl::setBackingTextureId(unsigned textureId) ASSERT(!m_ioSurfaceLayer); - if (!m_textureLayer) - m_textureLayer = adoptPtr(WebExternalTextureLayer::create()); + if (!m_textureLayer) { + m_textureLayer = adoptPtr(Platform::current()->compositorSupport()->createExternalTextureLayer()); + GraphicsLayerChromium::registerContentsLayer(m_textureLayer->layer()); + } m_textureLayer->setTextureId(textureId); // If anyone of the IDs is zero we need to switch between hardware @@ -392,8 +397,10 @@ void WebPluginContainerImpl::setBackingIOSurfaceId(int width, ASSERT(!m_textureLayer); - if (!m_ioSurfaceLayer) - m_ioSurfaceLayer = adoptPtr(WebIOSurfaceLayer::create()); + if (!m_ioSurfaceLayer) { + m_ioSurfaceLayer = adoptPtr(Platform::current()->compositorSupport()->createIOSurfaceLayer()); + GraphicsLayerChromium::registerContentsLayer(m_ioSurfaceLayer->layer()); + } m_ioSurfaceLayer->setIOSurfaceProperties(ioSurfaceId, WebSize(width, height)); // If anyone of the IDs is zero we need to switch between hardware @@ -500,7 +507,7 @@ bool WebPluginContainerImpl::isRectTopmost(const WebRect& rect) LayoutPoint center = documentRect.center(); // Make the rect we're checking (the point surrounded by padding rects) contained inside the requested rect. (Note that -1/2 is 0.) LayoutSize padding((documentRect.width() - 1) / 2, (documentRect.height() - 1) / 2); - HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(center, false, false, DontHitTestScrollbars, HitTestRequest::ReadOnly | HitTestRequest::Active, padding); + HitTestResult result = frame->eventHandler()->hitTestResultAtPoint(center, HitTestRequest::ReadOnly | HitTestRequest::Active, padding); const HitTestResult::NodeSet& nodes = result.rectBasedTestResult(); if (nodes.size() != 1) return false; @@ -627,6 +634,13 @@ WebPluginContainerImpl::WebPluginContainerImpl(WebCore::HTMLPlugInElement* eleme WebPluginContainerImpl::~WebPluginContainerImpl() { +#if USE(ACCELERATED_COMPOSITING) + if (m_textureLayer) + GraphicsLayerChromium::unregisterContentsLayer(m_textureLayer->layer()); + if (m_ioSurfaceLayer) + GraphicsLayerChromium::unregisterContentsLayer(m_ioSurfaceLayer->layer()); +#endif + if (m_isAcceptingTouchEvents) m_element->document()->didRemoveTouchEventHandler(); diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index 998be6e41..e203a7370 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -35,7 +35,6 @@ #include "WebPluginContainer.h" #include "Widget.h" -#include <public/WebExternalTextureLayer.h> #include <public/WebIOSurfaceLayer.h> #include <wtf/OwnPtr.h> #include <wtf/PassRefPtr.h> @@ -67,6 +66,7 @@ struct WebPrintParams; class ScrollbarGroup; class WebPlugin; class WebPluginLoadObserver; +class WebExternalTextureLayer; class WebPluginContainerImpl : public WebCore::PluginViewBase, public WebPluginContainer { public: diff --git a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp index 8bc880c75..bbd71bc82 100644 --- a/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp +++ b/Source/WebKit/chromium/src/WebRuntimeFeatures.cpp @@ -204,14 +204,13 @@ bool WebRuntimeFeatures::isWebAudioEnabled() #endif } -void WebRuntimeFeatures::enablePushState(bool enable) +void WebRuntimeFeatures::enablePushState(bool) { - RuntimeEnabledFeatures::setPushStateEnabled(enable); } bool WebRuntimeFeatures::isPushStateEnabled(bool enable) { - return RuntimeEnabledFeatures::pushStateEnabled(); + return true; } void WebRuntimeFeatures::enableTouch(bool enable) diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarImpl.cpp deleted file mode 100644 index 73b92697e..000000000 --- a/Source/WebKit/chromium/src/WebScrollbarImpl.cpp +++ /dev/null @@ -1,131 +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 "WebScrollbarImpl.h" - -#include "IntRect.h" -#include "Scrollbar.h" - -namespace WebKit { - -PassOwnPtr<WebScrollbar> WebScrollbar::create(WebCore::Scrollbar* scrollbar) -{ - return adoptPtr(new WebScrollbarImpl(scrollbar)); -} - -WebScrollbarImpl::WebScrollbarImpl(WebCore::Scrollbar* scrollbar) - : m_scrollbar(scrollbar) -{ -} - -bool WebScrollbarImpl::isOverlay() const -{ - return m_scrollbar->isOverlayScrollbar(); -} - -int WebScrollbarImpl::value() const -{ - return m_scrollbar->value(); -} - -WebPoint WebScrollbarImpl::location() const -{ - return m_scrollbar->location(); -} - -WebSize WebScrollbarImpl::size() const -{ - return m_scrollbar->size(); -} - -bool WebScrollbarImpl::enabled() const -{ - return m_scrollbar->enabled(); -} - -int WebScrollbarImpl::maximum() const -{ - return m_scrollbar->maximum(); -} - -int WebScrollbarImpl::totalSize() const -{ - return m_scrollbar->totalSize(); -} - -bool WebScrollbarImpl::isScrollViewScrollbar() const -{ - return m_scrollbar->isScrollViewScrollbar(); -} - -bool WebScrollbarImpl::isScrollableAreaActive() const -{ - return m_scrollbar->isScrollableAreaActive(); -} - -void WebScrollbarImpl::getTickmarks(WebVector<WebRect>& webTickmarks) const -{ - Vector<WebCore::IntRect> tickmarks; - m_scrollbar->getTickmarks(tickmarks); - - WebVector<WebRect> result(tickmarks.size()); - for (size_t i = 0; i < tickmarks.size(); ++i) - result[i] = tickmarks[i]; - - webTickmarks.swap(result); -} - -WebScrollbar::ScrollbarControlSize WebScrollbarImpl::controlSize() const -{ - return static_cast<WebScrollbar::ScrollbarControlSize>(m_scrollbar->controlSize()); -} - -WebScrollbar::ScrollbarPart WebScrollbarImpl::pressedPart() const -{ - return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->pressedPart()); -} - -WebScrollbar::ScrollbarPart WebScrollbarImpl::hoveredPart() const -{ - return static_cast<WebScrollbar::ScrollbarPart>(m_scrollbar->hoveredPart()); -} - -WebScrollbar::ScrollbarOverlayStyle WebScrollbarImpl::scrollbarOverlayStyle() const -{ - return static_cast<WebScrollbar::ScrollbarOverlayStyle>(m_scrollbar->scrollbarOverlayStyle()); -} - -WebScrollbar::Orientation WebScrollbarImpl::orientation() const -{ - return static_cast<WebScrollbar::Orientation>(m_scrollbar->orientation()); -} - -bool WebScrollbarImpl::isCustomScrollbar() const -{ - return m_scrollbar->isCustomScrollbar(); -} - -} // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp index ec6e9895d..44f6ea3c5 100644 --- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.cpp @@ -29,19 +29,18 @@ #include "ScrollbarLayerChromium.h" #include "WebLayerImpl.h" -using WebCore::Scrollbar; using WebCore::ScrollbarLayerChromium; namespace WebKit { -WebScrollbarLayer* WebScrollbarLayer::create(WebCore::Scrollbar* scrollbar, WebScrollbarThemePainter painter, PassOwnPtr<WebScrollbarThemeGeometry> geometry) +WebScrollbarLayer* WebScrollbarLayer::create(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) { - return new WebScrollbarLayerImpl(ScrollbarLayerChromium::create(WebScrollbar::create(scrollbar), painter, geometry, 0)); + return new WebScrollbarLayerImpl(scrollbar, painter, geometry); } -WebScrollbarLayerImpl::WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebScrollbarLayerImpl::WebScrollbarLayerImpl(WebScrollbar* scrollbar, WebScrollbarThemePainter painter, WebScrollbarThemeGeometry* geometry) + : m_layer(adoptPtr(new WebLayerImpl(ScrollbarLayerChromium::create(adoptPtr(scrollbar), painter, adoptPtr(geometry), 0)))) { } diff --git a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h index 720f79c55..a85b28e67 100644 --- a/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h +++ b/Source/WebKit/chromium/src/WebScrollbarLayerImpl.h @@ -28,18 +28,13 @@ #include <public/WebScrollbarLayer.h> #include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class ScrollbarLayerChromium; -} namespace WebKit { class WebLayerImpl; class WebScrollbarLayerImpl : public WebScrollbarLayer { public: - explicit WebScrollbarLayerImpl(PassRefPtr<WebCore::ScrollbarLayerChromium>); + WebScrollbarLayerImpl(WebScrollbar*, WebScrollbarThemePainter, WebScrollbarThemeGeometry*); virtual ~WebScrollbarLayerImpl(); // WebScrollbarLayer implementation. diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index eb4b7bb76..5026ee94b 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -53,6 +53,7 @@ WebSettingsImpl::WebSettingsImpl(Settings* settings) , m_renderVSyncEnabled(true) , m_viewportEnabled(false) , m_applyDefaultDeviceScaleFactorInCompositor(false) + , m_gestureTapHighlightEnabled(true) , m_defaultTileSize(WebSize(256, 256)) , m_maxUntiledLayerSize(WebSize(512, 512)) { @@ -636,4 +637,9 @@ void WebSettingsImpl::setCookieEnabled(bool enabled) m_settings->setCookieEnabled(enabled); } +void WebSettingsImpl::setGestureTapHighlightEnabled(bool enableHighlight) +{ + m_gestureTapHighlightEnabled = enableHighlight; +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index 7bc8a649a..6cee2af23 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -95,6 +95,7 @@ public: virtual void setForceCompositingMode(bool); virtual void setFrameFlatteningEnabled(bool); virtual void setFullScreenEnabled(bool); + virtual void setGestureTapHighlightEnabled(bool); virtual void setHyperlinkAuditingEnabled(bool); virtual void setImagesEnabled(bool); virtual void setInteractiveFormValidationEnabled(bool); @@ -157,6 +158,7 @@ public: bool showPaintRects() const { return m_showPaintRects; } bool renderVSyncEnabled() const { return m_renderVSyncEnabled; } bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } + bool gestureTapHighlightEnabled() { return m_gestureTapHighlightEnabled; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } @@ -168,6 +170,7 @@ private: bool m_renderVSyncEnabled; bool m_viewportEnabled; bool m_applyDefaultDeviceScaleFactorInCompositor; + bool m_gestureTapHighlightEnabled; WebSize m_defaultTileSize; WebSize m_maxUntiledLayerSize; }; diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp index 94404262c..5a5231fce 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.cpp @@ -35,11 +35,11 @@ namespace WebKit { WebSolidColorLayer* WebSolidColorLayer::create() { - return new WebSolidColorLayerImpl(SolidColorLayerChromium::create()); + return new WebSolidColorLayerImpl(); } -WebSolidColorLayerImpl::WebSolidColorLayerImpl(PassRefPtr<SolidColorLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebSolidColorLayerImpl::WebSolidColorLayerImpl() + : m_layer(adoptPtr(new WebLayerImpl(SolidColorLayerChromium::create()))) { m_layer->layer()->setIsDrawable(true); } diff --git a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h index 7742ba492..f6e46e3ec 100644 --- a/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h +++ b/Source/WebKit/chromium/src/WebSolidColorLayerImpl.h @@ -28,18 +28,13 @@ #include <public/WebSolidColorLayer.h> #include <wtf/OwnPtr.h> -#include <wtf/PassRefPtr.h> - -namespace WebCore { -class SolidColorLayerChromium; -} namespace WebKit { class WebLayerImpl; class WebSolidColorLayerImpl : public WebSolidColorLayer { public: - explicit WebSolidColorLayerImpl(PassRefPtr<WebCore::SolidColorLayerChromium>); + WebSolidColorLayerImpl(); virtual ~WebSolidColorLayerImpl(); // WebSolidColorLayer implementation. diff --git a/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.cpp b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.cpp new file mode 100644 index 000000000..79049c97a --- /dev/null +++ b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.cpp @@ -0,0 +1,128 @@ +/* + * 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 "WebToCCInputHandlerAdapter.h" + +#include <public/WebInputHandlerClient.h> + +#define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ + COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums) + +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusOnMainThread, CCInputHandlerClient::ScrollOnMainThread); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusStarted, CCInputHandlerClient::ScrollStarted); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollStatusIgnored, CCInputHandlerClient::ScrollIgnored); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeGesture, CCInputHandlerClient::Gesture); +COMPILE_ASSERT_MATCHING_ENUM(WebInputHandlerClient::ScrollInputTypeWheel, CCInputHandlerClient::Wheel); + +namespace WebKit { + +PassOwnPtr<WebToCCInputHandlerAdapter> WebToCCInputHandlerAdapter::create(PassOwnPtr<WebInputHandler> handler) +{ + return adoptPtr(new WebToCCInputHandlerAdapter(handler)); +} + +WebToCCInputHandlerAdapter::WebToCCInputHandlerAdapter(PassOwnPtr<WebInputHandler> handler) + : m_handler(handler) +{ +} + +WebToCCInputHandlerAdapter::~WebToCCInputHandlerAdapter() +{ +} + +class WebToCCInputHandlerAdapter::ClientAdapter : public WebInputHandlerClient { +public: + ClientAdapter(WebCore::CCInputHandlerClient* client) + : m_client(client) + { + } + + virtual ~ClientAdapter() + { + } + + virtual ScrollStatus scrollBegin(WebPoint point, ScrollInputType type) OVERRIDE + { + return static_cast<WebInputHandlerClient::ScrollStatus>(m_client->scrollBegin(point, static_cast<WebCore::CCInputHandlerClient::ScrollInputType>(type))); + } + + virtual void scrollBy(WebPoint point, WebSize offset) OVERRIDE + { + m_client->scrollBy(point, offset); + } + + virtual void scrollEnd() OVERRIDE + { + m_client->scrollEnd(); + } + + virtual void pinchGestureBegin() OVERRIDE + { + m_client->pinchGestureBegin(); + } + + virtual void pinchGestureUpdate(float magnifyDelta, WebPoint anchor) OVERRIDE + { + m_client->pinchGestureUpdate(magnifyDelta, anchor); + } + + virtual void pinchGestureEnd() OVERRIDE + { + m_client->pinchGestureEnd(); + } + + virtual void startPageScaleAnimation(WebSize targetPosition, + bool anchorPoint, + float pageScale, + double startTime, + double duration) OVERRIDE + { + m_client->startPageScaleAnimation(targetPosition, anchorPoint, pageScale, startTime, duration); + } + + virtual void scheduleAnimation() OVERRIDE + { + m_client->scheduleAnimation(); + } + +private: + WebCore::CCInputHandlerClient* m_client; +}; + + +void WebToCCInputHandlerAdapter::bindToClient(WebCore::CCInputHandlerClient* client) +{ + m_clientAdapter = adoptPtr(new ClientAdapter(client)); + m_handler->bindToClient(m_clientAdapter.get()); +} + +void WebToCCInputHandlerAdapter::animate(double monotonicTime) +{ + m_handler->animate(monotonicTime); +} + +} + diff --git a/Source/WebKit/chromium/src/WebScrollbarImpl.h b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.h index 5c9231aaa..889553559 100644 --- a/Source/WebKit/chromium/src/WebScrollbarImpl.h +++ b/Source/WebKit/chromium/src/WebToCCInputHandlerAdapter.h @@ -22,43 +22,33 @@ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WebScrollbarImpl_h -#define WebScrollbarImpl_h +#ifndef WebToCCInputHandlerAdapter_h +#define WebToCCInputHandlerAdapter_h -#include <public/WebScrollbar.h> - -namespace WebCore { -class Scrollbar; -} +#include "CCInputHandler.h" +#include <public/WebInputHandler.h> +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> namespace WebKit { -class WebScrollbarImpl : public WebScrollbar { +class WebToCCInputHandlerAdapter : public WebCore::CCInputHandler { public: - WebScrollbarImpl(WebCore::Scrollbar*); + static PassOwnPtr<WebToCCInputHandlerAdapter> create(PassOwnPtr<WebInputHandler>); + virtual ~WebToCCInputHandlerAdapter(); - // Implement WebKit::WebScrollbar methods - virtual bool isOverlay() const OVERRIDE; - virtual int value() const OVERRIDE; - virtual WebPoint location() const OVERRIDE; - virtual WebSize size() const OVERRIDE; - virtual bool enabled() const OVERRIDE; - virtual int maximum() const OVERRIDE; - virtual int totalSize() const OVERRIDE; - virtual bool isScrollViewScrollbar() const OVERRIDE; - virtual bool isScrollableAreaActive() const OVERRIDE; - virtual void getTickmarks(WebVector<WebRect>& tickmarks) const OVERRIDE; - virtual ScrollbarControlSize controlSize() const OVERRIDE; - virtual ScrollbarPart pressedPart() const OVERRIDE; - virtual ScrollbarPart hoveredPart() const OVERRIDE; - virtual ScrollbarOverlayStyle scrollbarOverlayStyle() const OVERRIDE; - virtual Orientation orientation() const OVERRIDE; - virtual bool isCustomScrollbar() const OVERRIDE; + // WebCore::CCInputHandler implementation. + virtual void bindToClient(WebCore::CCInputHandlerClient*) OVERRIDE; + virtual void animate(double monotonicTime) OVERRIDE; private: - RefPtr<WebCore::Scrollbar> m_scrollbar; + explicit WebToCCInputHandlerAdapter(PassOwnPtr<WebInputHandler>); + + class ClientAdapter; + OwnPtr<ClientAdapter> m_clientAdapter; + OwnPtr<WebInputHandler> m_handler; }; -} // namespace WebKit +} -#endif +#endif // WebToCCInputHandlerAdapter_h diff --git a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp index 201042e95..69a12e8a9 100644 --- a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.cpp @@ -36,11 +36,11 @@ namespace WebKit { WebTransformAnimationCurve* WebTransformAnimationCurve::create() { - return new WebTransformAnimationCurveImpl(WebCore::CCKeyframedTransformAnimationCurve::create()); + return new WebTransformAnimationCurveImpl(); } -WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve> curve) - : m_curve(curve) +WebTransformAnimationCurveImpl::WebTransformAnimationCurveImpl() + : m_curve(WebCore::CCKeyframedTransformAnimationCurve::create()) { } diff --git a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h index 45a03ef06..bc9a9345a 100644 --- a/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h +++ b/Source/WebKit/chromium/src/WebTransformAnimationCurveImpl.h @@ -38,7 +38,7 @@ namespace WebKit { class WebTransformAnimationCurveImpl : public WebTransformAnimationCurve { public: - explicit WebTransformAnimationCurveImpl(PassOwnPtr<WebCore::CCKeyframedTransformAnimationCurve>); + WebTransformAnimationCurveImpl(); virtual ~WebTransformAnimationCurveImpl(); // WebAnimationCurve implementation. diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp index 5bfed6742..a8fdb4b4f 100644 --- a/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp +++ b/Source/WebKit/chromium/src/WebVideoLayerImpl.cpp @@ -33,11 +33,11 @@ namespace WebKit { WebVideoLayer* WebVideoLayer::create(WebVideoFrameProvider* provider) { - return new WebVideoLayerImpl(WebCore::VideoLayerChromium::create(provider)); + return new WebVideoLayerImpl(provider); } -WebVideoLayerImpl::WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium> layer) - : m_layer(adoptPtr(new WebLayerImpl(layer))) +WebVideoLayerImpl::WebVideoLayerImpl(WebVideoFrameProvider* provider) + : m_layer(adoptPtr(new WebLayerImpl(WebCore::VideoLayerChromium::create(provider)))) { } diff --git a/Source/WebKit/chromium/src/WebVideoLayerImpl.h b/Source/WebKit/chromium/src/WebVideoLayerImpl.h index 287e4b5e2..664935baf 100644 --- a/Source/WebKit/chromium/src/WebVideoLayerImpl.h +++ b/Source/WebKit/chromium/src/WebVideoLayerImpl.h @@ -28,16 +28,12 @@ #include <public/WebVideoLayer.h> -namespace WebCore { -class VideoLayerChromium; -} - namespace WebKit { class WebLayerImpl; class WebVideoLayerImpl : public WebVideoLayer { public: - explicit WebVideoLayerImpl(PassRefPtr<WebCore::VideoLayerChromium>); + explicit WebVideoLayerImpl(WebVideoFrameProvider*); virtual ~WebVideoLayerImpl(); // WebVideoLayer implementation. diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index c6f9f7e09..be474d8fa 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -119,13 +119,12 @@ #include "TextFieldDecoratorImpl.h" #include "TextIterator.h" #include "Timer.h" -#include "TouchpadFlingPlatformGestureCurve.h" #include "TraceEvent.h" #include "UserGestureIndicator.h" #include "WebAccessibilityObject.h" #include "WebActiveWheelFlingParameters.h" #include "WebAutofillClient.h" -#include "WebCompositorImpl.h" +#include "WebCompositorInputHandlerImpl.h" #include "WebDevToolsAgentImpl.h" #include "WebDevToolsAgentPrivate.h" #include "WebFrameImpl.h" @@ -145,13 +144,12 @@ #include "WebRuntimeFeatures.h" #include "WebSettingsImpl.h" #include "WebTextInputInfo.h" -#include "WebTouchCandidatesInfo.h" #include "WebViewClient.h" #include "WheelEvent.h" #include "painting/GraphicsContextBuilder.h" #include <public/Platform.h> -#include <public/WebCompositor.h> #include <public/WebCompositorOutputSurface.h> +#include <public/WebCompositorSupport.h> #include <public/WebDragData.h> #include <public/WebFloatPoint.h> #include <public/WebGraphicsContext3D.h> @@ -169,7 +167,9 @@ #include <wtf/Uint8ClampedArray.h> #if ENABLE(GESTURE_EVENTS) +#include "PlatformGestureCurveFactory.h" #include "PlatformGestureEvent.h" +#include "TouchDisambiguation.h" #endif #if OS(WINDOWS) @@ -416,6 +416,7 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_recreatingGraphicsContext(false) , m_compositorSurfaceReady(false) , m_deviceScaleInCompositor(1) + , m_inputHandlerIdentifier(-1) #endif #if ENABLE(INPUT_SPEECH) , m_speechInputClient(SpeechInputClientImpl::create(client)) @@ -432,8 +433,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client) #if ENABLE(MEDIA_STREAM) , m_userMediaClientImpl(this) #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) - , m_registerProtocolHandlerClient(RegisterProtocolHandlerClientImpl::create(this)) +#if ENABLE(NAVIGATOR_CONTENT_UTILS) + , m_navigatorContentUtilsClient(NavigatorContentUtilsClientImpl::create(this)) #endif , m_flingModifier(0) { @@ -464,8 +465,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client) #if ENABLE(NOTIFICATIONS) || ENABLE(LEGACY_NOTIFICATIONS) provideNotification(m_page.get(), notificationPresenterImpl()); #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) - provideRegisterProtocolHandlerTo(m_page.get(), m_registerProtocolHandlerClient.get()); +#if ENABLE(NAVIGATOR_CONTENT_UTILS) + provideNavigatorContentUtilsTo(m_page.get(), m_navigatorContentUtilsClient.get()); #endif provideContextFeaturesTo(m_page.get(), m_featureSwitchClient.get()); @@ -638,17 +639,13 @@ void WebViewImpl::handleMouseUp(Frame& mainFrame, const WebMouseEvent& event) FrameView* view = m_page->mainFrame()->view(); IntPoint clickPoint(m_lastMouseDownPoint.x, m_lastMouseDownPoint.y); IntPoint contentPoint = view->windowToContents(clickPoint); - HitTestResult hitTestResult = focused->eventHandler()->hitTestResultAtPoint(contentPoint, false, false, ShouldHitTestScrollbars); + HitTestResult hitTestResult = focused->eventHandler()->hitTestResultAtPoint(contentPoint, HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::TestChildFrameScrollBars); // We don't want to send a paste when middle clicking a scroll bar or a // link (which will navigate later in the code). The main scrollbars // have to be handled separately. if (!hitTestResult.scrollbar() && !hitTestResult.isLiveLink() && focused && !view->scrollbarAtPoint(clickPoint)) { Editor* editor = focused->editor(); - Pasteboard* pasteboard = Pasteboard::generalPasteboard(); - bool oldSelectionMode = pasteboard->isSelectionMode(); - pasteboard->setSelectionMode(true); - editor->command(AtomicString("Paste")).execute(); - pasteboard->setSelectionMode(oldSelectionMode); + editor->command(AtomicString("PasteGlobalSelection")).execute(); } } #endif @@ -688,11 +685,13 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) { switch (event.type) { case WebInputEvent::GestureFlingStart: { + m_client->cancelScheduledContentIntents(); m_lastWheelPosition = WebPoint(event.x, event.y); m_lastWheelGlobalPosition = WebPoint(event.globalX, event.globalY); m_flingModifier = event.modifiers; // FIXME: Make the curve parametrizable from the browser. - m_gestureAnimation = ActivePlatformGestureAnimation::create(TouchpadFlingPlatformGestureCurve::create(FloatPoint(event.deltaX, event.deltaY)), this); + OwnPtr<PlatformGestureCurve> flingCurve = PlatformGestureCurveFactory::get()->createCurve(event.data.flingStart.sourceDevice, FloatPoint(event.data.flingStart.velocityX, event.data.flingStart.velocityY)); + m_gestureAnimation = ActivePlatformGestureAnimation::create(flingCurve.release(), this); scheduleAnimation(); return true; } @@ -703,12 +702,28 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) } return false; case WebInputEvent::GestureTap: { - PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); + m_client->cancelScheduledContentIntents(); + if (detectContentOnTouch(WebPoint(event.x, event.y), event.type)) + return true; + RefPtr<WebCore::PopupContainer> selectPopup; selectPopup = m_selectPopup; hideSelectPopup(); ASSERT(!m_selectPopup); + + if (event.data.tap.width > 0) { + IntRect boundingBox(event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, event.data.tap.width, event.data.tap.height); + Vector<IntRect> goodTargets; + findGoodTouchTargets(boundingBox, mainFrameImpl()->frame(), pageScaleFactor(), goodTargets); + // FIXME: replace touch adjustment code when numberOfGoodTargets == 1? + // Single candidate case is currently handled by: https://bugs.webkit.org/show_bug.cgi?id=85101 + if (goodTargets.size() >= 2 && m_client && m_client->didTapMultipleTargets(event, goodTargets)) + return true; + } + + PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); bool gestureHandled = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); + if (m_selectPopup && m_selectPopup == selectPopup) { // That tap triggered a select popup which is the same as the one that // was showing before the tap. It means the user tapped the select @@ -716,6 +731,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) // immediately reopened the select popup. It needs to be closed. hideSelectPopup(); } + return gestureHandled; } case WebInputEvent::GestureTwoFingerTap: @@ -723,6 +739,10 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) if (!mainFrameImpl() || !mainFrameImpl()->frameView()) return false; + m_client->cancelScheduledContentIntents(); + if (detectContentOnTouch(WebPoint(event.x, event.y), event.type)) + return true; + m_page->contextMenuController()->clearContextMenu(); m_contextMenuAllowed = true; PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); @@ -731,18 +751,21 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) return handled; } case WebInputEvent::GestureTapDown: { + m_client->cancelScheduledContentIntents(); // Queue a highlight animation, then hand off to regular handler. #if OS(LINUX) - enableTouchHighlight(IntPoint(event.x, event.y)); + if (settingsImpl()->gestureTapHighlightEnabled()) + enableTouchHighlight(IntPoint(event.x, event.y)); #endif PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); return mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); } + case WebInputEvent::GestureDoubleTap: case WebInputEvent::GestureScrollBegin: + case WebInputEvent::GesturePinchBegin: + m_client->cancelScheduledContentIntents(); case WebInputEvent::GestureScrollEnd: case WebInputEvent::GestureScrollUpdate: - case WebInputEvent::GestureDoubleTap: - case WebInputEvent::GesturePinchBegin: case WebInputEvent::GesturePinchEnd: case WebInputEvent::GesturePinchUpdate: { PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); @@ -761,20 +784,20 @@ void WebViewImpl::transferActiveWheelFlingAnimation(const WebActiveWheelFlingPar m_lastWheelPosition = parameters.point; m_lastWheelGlobalPosition = parameters.globalPoint; m_flingModifier = parameters.modifiers; - OwnPtr<PlatformGestureCurve> curve = TouchpadFlingPlatformGestureCurve::create(parameters.delta, IntPoint(parameters.cumulativeScroll)); + OwnPtr<PlatformGestureCurve> curve = PlatformGestureCurveFactory::get()->createCurve(parameters.sourceDevice, parameters.delta, IntPoint(parameters.cumulativeScroll)); m_gestureAnimation = ActivePlatformGestureAnimation::create(curve.release(), this, parameters.startTime); scheduleAnimation(); } void WebViewImpl::renderingStats(WebRenderingStats& stats) const { - if (!m_layerTreeView.isNull()) - m_layerTreeView.renderingStats(stats); + if (m_layerTreeView) + m_layerTreeView->renderingStats(stats); } void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds) { - if (m_layerTreeView.isNull()) + if (!m_layerTreeView) return; IntPoint clampedPoint = targetPosition; @@ -786,7 +809,7 @@ void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool u return; } - m_layerTreeView.startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds); + m_layerTreeView->startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds); } #endif @@ -795,17 +818,6 @@ WebViewBenchmarkSupport* WebViewImpl::benchmarkSupport() return &m_benchmarkSupport; } -WebVector<WebFloatQuad> WebViewImpl::getTouchHighlightQuads(const WebPoint& point, - int padding, - WebTouchCandidatesInfo& outTouchInfo, - WebColor& outTapHighlightColor) -{ - // FIXME: Upstream this function from the chromium-android branch. - notImplemented(); - - return WebVector<WebFloatQuad>(); -} - bool WebViewImpl::handleKeyEvent(const WebKeyboardEvent& event) { ASSERT((event.type == WebInputEvent::RawKeyDown) @@ -992,9 +1004,8 @@ WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, AutoZoomType zoomTy // Use the rect-based hit test to find the node. IntPoint point = mainFrameImpl()->frameView()->windowToContents(IntPoint(rect.x, rect.y)); - HitTestResult result = mainFrameImpl()->frame()->eventHandler()->hitTestResultAtPoint(point, - false, zoomType == FindInPage, DontHitTestScrollbars, HitTestRequest::Active | HitTestRequest::ReadOnly, - IntSize(rect.width, rect.height)); + HitTestRequest::HitTestRequestType hitType = HitTestRequest::ReadOnly | HitTestRequest::Active | ((zoomType == FindInPage) ? HitTestRequest::IgnoreClipping : 0); + HitTestResult result = mainFrameImpl()->frame()->eventHandler()->hitTestResultAtPoint(point, hitType, IntSize(rect.width, rect.height)); Node* node = result.innerNonSharedNode(); if (!node) @@ -1006,7 +1017,7 @@ WebRect WebViewImpl::computeBlockBounds(const WebRect& rect, AutoZoomType zoomTy // Return the bounding box in the window coordinate system. if (node) { - IntRect rect = node->Node::getPixelSnappedRect(); + IntRect rect = node->Node::pixelSnappedBoundingBox(); Frame* frame = node->document()->frame(); return frame->view()->contentsToWindow(rect); } @@ -1128,8 +1139,7 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo static bool highlightConditions(Node* node) { - return node->isLink() - || node->supportsFocus() + return node->supportsFocus() || node->hasEventListeners(eventNames().clickEvent) || node->hasEventListeners(eventNames().mousedownEvent) || node->hasEventListeners(eventNames().mouseupEvent); @@ -1150,11 +1160,20 @@ Node* WebViewImpl::bestTouchLinkNode(IntPoint touchEventLocation) while (bestTouchNode && !highlightConditions(bestTouchNode)) bestTouchNode = bestTouchNode->parentNode(); + // If the document has click handlers installed, we don't want to default to applying the highlight to the entire RenderView, or the + // entire body. Also, if the node has non-auto Z-index, we cannot be sure of it's ordering with respect to other possible target nodes. + RenderObject* touchNodeRenderer = bestTouchNode ? bestTouchNode->renderer() : 0; + if (bestTouchNode && (!touchNodeRenderer || touchNodeRenderer->isRenderView() || touchNodeRenderer->isBody() || !touchNodeRenderer->style()->hasAutoZIndex())) + return 0; + return bestTouchNode; } void WebViewImpl::enableTouchHighlight(IntPoint touchEventLocation) { + // Always clear any existing highlight when this is invoked, even if we don't get a new target to highlight. + m_linkHighlight.clear(); + Node* touchNode = bestTouchLinkNode(touchEventLocation); if (!touchNode || !touchNode->renderer() || !touchNode->renderer()->enclosingLayer()) @@ -1167,7 +1186,6 @@ void WebViewImpl::enableTouchHighlight(IntPoint touchEventLocation) if (!highlightColor.alpha()) return; - // This will clear any highlight currently being displayed. m_linkHighlight = LinkHighlight::create(touchNode, this); m_linkHighlight->startHighlightAnimation(); } @@ -1650,8 +1668,8 @@ void WebViewImpl::updateBatteryStatus(const WebBatteryStatus& status) void WebViewImpl::setCompositorSurfaceReady() { m_compositorSurfaceReady = true; - if (!m_layerTreeView.isNull()) - m_layerTreeView.setSurfaceReady(); + if (m_layerTreeView) + m_layerTreeView->setSurfaceReady(); } void WebViewImpl::animate(double) @@ -1663,7 +1681,7 @@ void WebViewImpl::animate(double) // In composited mode, we always go through the compositor so it can apply // appropriate flow-control mechanisms. if (isAcceleratedCompositingActive()) - m_layerTreeView.updateAnimations(monotonicFrameBeginTime); + m_layerTreeView->updateAnimations(monotonicFrameBeginTime); else #endif updateAnimations(monotonicFrameBeginTime); @@ -1717,7 +1735,7 @@ void WebViewImpl::layout() #if USE(ACCELERATED_COMPOSITING) void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect) { - ASSERT(!m_layerTreeView.isNull()); + ASSERT(m_layerTreeView); PlatformContextSkia context(canvas); @@ -1731,7 +1749,7 @@ void WebViewImpl::doPixelReadbackToCanvas(WebCanvas* canvas, const IntRect& rect OwnPtr<ImageBuffer> imageBuffer(ImageBuffer::create(rect.size())); RefPtr<Uint8ClampedArray> pixelArray(Uint8ClampedArray::createUninitialized(rect.width() * rect.height() * 4)); if (imageBuffer && pixelArray) { - m_layerTreeView.compositeAndReadback(pixelArray->data(), invertRect); + m_layerTreeView->compositeAndReadback(pixelArray->data(), invertRect); imageBuffer->putByteArray(Premultiplied, pixelArray.get(), rect.size(), IntRect(IntPoint(), rect.size()), IntPoint()); gc.save(); gc.translate(IntSize(0, bitmapHeight)); @@ -1759,7 +1777,7 @@ void WebViewImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOptions opt if (canvas) { // Clip rect to the confines of the rootLayerTexture. IntRect resizeRect(rect); - resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView.deviceViewportSize())); + resizeRect.intersect(IntRect(IntPoint(0, 0), m_layerTreeView->deviceViewportSize())); doPixelReadbackToCanvas(canvas, resizeRect); } #endif @@ -1798,8 +1816,8 @@ void WebViewImpl::themeChanged() void WebViewImpl::composite(bool) { #if USE(ACCELERATED_COMPOSITING) - if (WebCompositor::threadingEnabled()) - m_layerTreeView.setNeedsRedraw(); + if (Platform::current()->compositorSupport()->isThreadingEnabled()) + m_layerTreeView->setNeedsRedraw(); else { ASSERT(isAcceleratedCompositingActive()); if (!page()) @@ -1808,7 +1826,7 @@ void WebViewImpl::composite(bool) if (m_pageOverlays) m_pageOverlays->update(); - m_layerTreeView.composite(); + m_layerTreeView->composite(); } #endif } @@ -1816,16 +1834,16 @@ void WebViewImpl::composite(bool) void WebViewImpl::setNeedsRedraw() { #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive()) - m_layerTreeView.setNeedsRedraw(); + if (m_layerTreeView && isAcceleratedCompositingActive()) + m_layerTreeView->setNeedsRedraw(); #endif } bool WebViewImpl::isInputThrottled() const { #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull() && isAcceleratedCompositingActive()) - return m_layerTreeView.commitRequested(); + if (m_layerTreeView && isAcceleratedCompositingActive()) + return m_layerTreeView->commitRequested(); #endif return false; } @@ -1833,8 +1851,8 @@ bool WebViewImpl::isInputThrottled() const void WebViewImpl::loseCompositorContext(int numTimes) { #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull()) - m_layerTreeView.loseCompositorContext(numTimes); + if (m_layerTreeView) + m_layerTreeView->loseCompositorContext(numTimes); #endif } @@ -2761,9 +2779,9 @@ void WebViewImpl::setDeviceScaleFactor(float scaleFactor) page()->setDeviceScaleFactor(scaleFactor); - if (!m_layerTreeView.isNull() && m_webSettings->applyDefaultDeviceScaleFactorInCompositor()) { + if (m_layerTreeView && m_webSettings->applyDefaultDeviceScaleFactorInCompositor()) { m_deviceScaleInCompositor = page()->deviceScaleFactor(); - m_layerTreeView.setDeviceScaleFactor(m_deviceScaleInCompositor); + m_layerTreeView->setDeviceScaleFactor(m_deviceScaleInCompositor); } if (m_deviceScaleInCompositor != 1) { // Don't allow page scaling when compositor scaling is being used, @@ -2858,8 +2876,8 @@ bool WebViewImpl::computePageScaleFactorLimits() float clampedScale = clampPageScaleFactorToLimits(pageScaleFactor()); #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull()) - m_layerTreeView.setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor); + if (m_layerTreeView) + m_layerTreeView->setPageScaleFactorAndLimits(clampedScale, m_minimumPageScaleFactor, m_maximumPageScaleFactor); #endif if (clampedScale != pageScaleFactor()) { setPageScaleFactorPreservingScrollOffset(clampedScale); @@ -3290,7 +3308,7 @@ void WebViewImpl::applyAutofillSuggestions( refreshAutofillPopup(); } else { m_autofillPopupShowing = true; - m_autofillPopup->showInRect(focusedNode->getPixelSnappedRect(), focusedNode->ownerDocument()->view(), 0); + m_autofillPopup->showInRect(focusedNode->pixelSnappedBoundingBox(), focusedNode->ownerDocument()->view(), 0); } } @@ -3334,8 +3352,8 @@ void WebViewImpl::setIsTransparent(bool isTransparent) if (m_nonCompositedContentHost) m_nonCompositedContentHost->setOpaque(!isTransparent); - if (!m_layerTreeView.isNull()) - m_layerTreeView.setHasTransparentBackground(isTransparent); + if (m_layerTreeView) + m_layerTreeView->setHasTransparentBackground(isTransparent); } bool WebViewImpl::isTransparent() const @@ -3390,7 +3408,7 @@ void WebView::addUserScript(const WebString& sourceCode, patterns->append(patternsIn[i]); PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); - RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns.release(), nullptr, static_cast<UserScriptInjectionTime>(injectAt), static_cast<UserContentInjectedFrames>(injectIn)); @@ -3406,7 +3424,7 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, patterns->append(patternsIn[i]); PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); - RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::create()); + RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); // FIXME: Current callers always want the level to be "author". It probably makes sense to let // callers specify this though, since in other cases the caller will probably want "user" level. @@ -3438,6 +3456,8 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa if (*isNewNavigation && !isNavigationWithinPage) m_pageScaleFactorIsSet = false; + // Make sure link highlight from previous page is cleared. + m_linkHighlight.clear(); m_gestureAnimation.clear(); resetSavedScrollAndScaleState(); } @@ -3596,7 +3616,7 @@ void WebViewImpl::refreshAutofillPopup() return; } - WebRect newWidgetRect = m_autofillPopup->refresh(focusedWebCoreNode()->getPixelSnappedRect()); + WebRect newWidgetRect = m_autofillPopup->refresh(focusedWebCoreNode()->pixelSnappedBoundingBox()); // Let's resize the backing window if necessary. WebPopupMenuImpl* popupMenu = static_cast<WebPopupMenuImpl*>(m_autofillPopup->client()); if (popupMenu && popupMenu->client()->windowRect() != newWidgetRect) @@ -3655,8 +3675,12 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) m_nonCompositedContentHost->setScrollLayer(scrollLayer); } - if (!m_layerTreeView.isNull()) - m_layerTreeView.setRootLayer(m_rootLayer); + if (m_layerTreeView) { + if (m_rootLayer) + m_layerTreeView->setRootLayer(*m_rootLayer); + else + m_layerTreeView->clearRootLayer(); + } IntRect damagedRect(0, 0, m_size.width, m_size.height); if (!m_isAcceleratedCompositingActive) @@ -3665,7 +3689,7 @@ void WebViewImpl::setRootGraphicsLayer(GraphicsLayer* layer) void WebViewImpl::scheduleCompositingLayerSync() { - m_layerTreeView.setNeedsRedraw(); + m_layerTreeView->setNeedsRedraw(); } void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&) @@ -3675,7 +3699,7 @@ void WebViewImpl::scrollRootLayerRect(const IntSize&, const IntRect&) void WebViewImpl::invalidateRootLayerRect(const IntRect& rect) { - ASSERT(!m_layerTreeView.isNull()); + ASSERT(m_layerTreeView); if (!page()) return; @@ -3696,7 +3720,7 @@ void WebViewImpl::setBackgroundColor(const WebCore::Color& color) WebCore::Color documentBackgroundColor = color.isValid() ? color : WebCore::Color::white; WebColor webDocumentBackgroundColor = documentBackgroundColor.rgb(); m_nonCompositedContentHost->setBackgroundColor(documentBackgroundColor); - m_layerTreeView.setBackgroundColor(webDocumentBackgroundColor); + m_layerTreeView->setBackgroundColor(webDocumentBackgroundColor); } WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() @@ -3708,9 +3732,9 @@ WebCore::GraphicsLayer* WebViewImpl::rootGraphicsLayer() void WebViewImpl::scheduleAnimation() { if (isAcceleratedCompositingActive()) { - if (WebCompositor::threadingEnabled()) { - ASSERT(!m_layerTreeView.isNull()); - m_layerTreeView.setNeedsAnimate(); + if (Platform::current()->compositorSupport()->isThreadingEnabled()) { + ASSERT(m_layerTreeView); + m_layerTreeView->setNeedsAnimate(); } else m_client->scheduleAnimation(); } else @@ -3744,14 +3768,14 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_isAcceleratedCompositingActive = false; // We need to finish all GL rendering before sending didDeactivateCompositor() to prevent // flickering when compositing turns off. - if (!m_layerTreeView.isNull()) - m_layerTreeView.finishAllRendering(); + if (m_layerTreeView) + m_layerTreeView->finishAllRendering(); m_client->didDeactivateCompositor(); - } else if (!m_layerTreeView.isNull()) { + } else if (m_layerTreeView) { m_isAcceleratedCompositingActive = true; updateLayerTreeViewport(); - m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); + m_client->didActivateCompositor(m_inputHandlerIdentifier); } else { TRACE_EVENT0("webkit", "WebViewImpl::setIsAcceleratedCompositingActive(true)"); @@ -3769,8 +3793,8 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) m_nonCompositedContentHost->setShowDebugBorders(page()->settings()->showDebugBorders()); m_nonCompositedContentHost->setOpaque(!isTransparent()); - m_layerTreeView.initialize(this, *m_rootLayer, layerTreeViewSettings); - if (!m_layerTreeView.isNull()) { + m_layerTreeView = adoptPtr(Platform::current()->compositorSupport()->createLayerTreeView(this, *m_rootLayer, layerTreeViewSettings)); + if (m_layerTreeView) { if (m_webSettings->applyDefaultDeviceScaleFactorInCompositor() && page()->deviceScaleFactor() != 1) { ASSERT(page()->deviceScaleFactor()); @@ -3779,13 +3803,13 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) } bool visible = page()->visibilityState() == PageVisibilityStateVisible; - m_layerTreeView.setVisible(visible); - m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); + m_layerTreeView->setVisible(visible); + m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); if (m_compositorSurfaceReady) - m_layerTreeView.setSurfaceReady(); - m_layerTreeView.setHasTransparentBackground(isTransparent()); + m_layerTreeView->setSurfaceReady(); + m_layerTreeView->setHasTransparentBackground(isTransparent()); updateLayerTreeViewport(); - m_client->didActivateCompositor(m_layerTreeView.compositorIdentifier()); + m_client->didActivateCompositor(m_inputHandlerIdentifier); m_isAcceleratedCompositingActive = true; m_compositorCreationFailed = false; if (m_pageOverlays) @@ -3797,7 +3821,7 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) WebRect asciiToRectTable[128]; int fontHeight; SkBitmap bitmap = WebCore::CompositorHUDFontAtlas::generateFontAtlas(asciiToRectTable, fontHeight); - m_layerTreeView.setFontAtlas(bitmap, asciiToRectTable, fontHeight); + m_layerTreeView->setFontAtlas(bitmap, asciiToRectTable, fontHeight); } } else { m_nonCompositedContentHost.clear(); @@ -3871,6 +3895,13 @@ WebCompositorOutputSurface* WebViewImpl::createOutputSurface() return m_client->createOutputSurface(); } +WebInputHandler* WebViewImpl::createInputHandler() +{ + WebCompositorInputHandlerImpl* handler = new WebCompositorInputHandlerImpl(); + m_inputHandlerIdentifier = handler->identifier(); + return handler; +} + void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScaleDelta) { if (!mainFrameImpl() || !mainFrameImpl()->frameView()) @@ -3941,29 +3972,29 @@ void WebViewImpl::didRecreateOutputSurface(bool success) void WebViewImpl::scheduleComposite() { - ASSERT(!WebCompositor::threadingEnabled()); + ASSERT(!Platform::current()->compositorSupport()->isThreadingEnabled()); m_client->scheduleComposite(); } void WebViewImpl::updateLayerTreeViewport() { - if (!page() || !m_nonCompositedContentHost || m_layerTreeView.isNull()) + if (!page() || !m_nonCompositedContentHost || !m_layerTreeView) return; FrameView* view = page()->mainFrame()->view(); IntRect visibleRect = view->visibleContentRect(true /* include scrollbars */); IntPoint scroll(view->scrollX(), view->scrollY()); - // This part of the deviceScale will be used to scale the contents of - // the NCCH's GraphicsLayer. - float deviceScale = m_deviceScaleInCompositor; - m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin(), deviceScale); + m_nonCompositedContentHost->setViewport(visibleRect.size(), view->contentsSize(), scroll, view->scrollOrigin()); IntSize layoutViewportSize = size(); IntSize deviceViewportSize = size(); - deviceViewportSize.scale(deviceScale); - m_layerTreeView.setViewportSize(layoutViewportSize, deviceViewportSize); - m_layerTreeView.setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); + + // This part of the deviceScale will be used to scale the contents of + // the NCCH's GraphicsLayer. + deviceViewportSize.scale(m_deviceScaleInCompositor); + m_layerTreeView->setViewportSize(layoutViewportSize, deviceViewportSize); + m_layerTreeView->setPageScaleFactorAndLimits(pageScaleFactor(), m_minimumPageScaleFactor, m_maximumPageScaleFactor); } WebGraphicsContext3D* WebViewImpl::sharedGraphicsContext3D() @@ -3982,7 +4013,10 @@ void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent::Type touchType) { - ASSERT(touchType == WebInputEvent::GestureTap || touchType == WebInputEvent::GestureLongPress); + ASSERT(touchType == WebInputEvent::GestureTap + || touchType == WebInputEvent::GestureTwoFingerTap + || touchType == WebInputEvent::GestureLongPress); + HitTestResult touchHit = hitTestResultForWindowPos(position); if (touchHit.isContentEditable()) @@ -3992,13 +4026,20 @@ bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent:: if (!node || !node->isTextNode()) return false; - // FIXME: Should we not detect content intents in nodes that have event listeners? + // Ignore when tapping on links or nodes listening to click events, unless the click event is on the + // body element, in which case it's unlikely that the original node itself was intended to be clickable. + for (; node && !node->hasTagName(HTMLNames::bodyTag); node = node->parentNode()) { + if (node->isLink() || (touchType == WebInputEvent::GestureTap + && (node->willRespondToTouchEvents() || node->willRespondToMouseClickEvents()))) { + return false; + } + } WebContentDetectionResult content = m_client->detectContentAround(touchHit); if (!content.isValid()) return false; - if (touchType == WebInputEvent::GestureLongPress) { + if (touchType != WebInputEvent::GestureTap) { // Select the detected content as a block. focusedFrame()->selectRange(content.range()); return true; @@ -4022,9 +4063,9 @@ void WebViewImpl::setVisibilityState(WebPageVisibilityState visibilityState, #endif #if USE(ACCELERATED_COMPOSITING) - if (!m_layerTreeView.isNull()) { + if (m_layerTreeView) { bool visible = visibilityState == WebPageVisibilityStateVisible; - m_layerTreeView.setVisible(visible); + m_layerTreeView->setVisible(visible); } #endif } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 206cf4572..ce5657a2b 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -52,7 +52,6 @@ #include "WebViewBenchmarkSupportImpl.h" #include <public/WebFloatQuad.h> #include <public/WebLayer.h> -#include <public/WebLayerTreeView.h> #include <public/WebLayerTreeViewClient.h> #include <public/WebPoint.h> #include <public/WebRect.h> @@ -95,7 +94,6 @@ class DeviceOrientationClientProxy; class DragScrollTimer; class GeolocationClientProxy; class LinkHighlight; -class WebHelperPluginImpl; class NonCompositedContentHost; class PrerendererClientImpl; class SpeechInputClientImpl; @@ -107,15 +105,17 @@ class WebDevToolsAgentClient; class WebDevToolsAgentPrivate; class WebFrameImpl; class WebGestureEvent; -class WebPagePopupImpl; -class WebPrerendererClient; -class WebViewBenchmarkSupport; +class WebHelperPluginImpl; class WebImage; class WebKeyboardEvent; +class WebLayerTreeView; class WebMouseEvent; class WebMouseWheelEvent; +class WebPagePopupImpl; +class WebPrerendererClient; class WebSettingsImpl; class WebTouchEvent; +class WebViewBenchmarkSupport; class WebViewImpl : public WebView , public WebLayerTreeViewClient @@ -305,11 +305,6 @@ public: virtual void transferActiveWheelFlingAnimation(const WebActiveWheelFlingParameters&); virtual WebViewBenchmarkSupport* benchmarkSupport(); - virtual WebVector<WebFloatQuad> getTouchHighlightQuads(const WebPoint&, - int padding, - WebTouchCandidatesInfo& outTouchInfo, - WebColor& outTapHighlightColor); - // WebLayerTreeViewClient virtual void willBeginFrame(); virtual void didBeginFrame(); @@ -319,6 +314,7 @@ public: virtual void didRebindGraphicsContext(bool success) OVERRIDE; virtual WebCompositorOutputSurface* createOutputSurface() OVERRIDE; virtual void didRecreateOutputSurface(bool success) OVERRIDE; + virtual WebInputHandler* createInputHandler() OVERRIDE; virtual void willCommit(); virtual void didCommit(); virtual void didCommitAndDrawFrame(); @@ -824,7 +820,7 @@ private: #if USE(ACCELERATED_COMPOSITING) WebCore::IntRect m_rootLayerScrollDamage; OwnPtr<NonCompositedContentHost> m_nonCompositedContentHost; - WebLayerTreeView m_layerTreeView; + OwnPtr<WebLayerTreeView> m_layerTreeView; WebLayer* m_rootLayer; WebCore::GraphicsLayer* m_rootGraphicsLayer; bool m_isAcceleratedCompositingActive; @@ -833,6 +829,7 @@ private: bool m_recreatingGraphicsContext; bool m_compositorSurfaceReady; float m_deviceScaleInCompositor; + int m_inputHandlerIdentifier; #endif static const WebInputEvent* m_currentInputEvent; @@ -854,8 +851,8 @@ private: #if ENABLE(MEDIA_STREAM) UserMediaClientImpl m_userMediaClientImpl; #endif -#if ENABLE(REGISTER_PROTOCOL_HANDLER) - OwnPtr<RegisterProtocolHandlerClientImpl> m_registerProtocolHandlerClient; +#if ENABLE(NAVIGATOR_CONTENT_UTILS) + OwnPtr<NavigatorContentUtilsClientImpl> m_navigatorContentUtilsClient; #endif OwnPtr<WebCore::ActivePlatformGestureAnimation> m_gestureAnimation; WebPoint m_lastWheelPosition; diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h index fa70dd261..5c0a59084 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -33,7 +33,6 @@ #if ENABLE(FILE_SYSTEM) && ENABLE(WORKERS) -#include "PlatformString.h" #include "ScriptExecutionContext.h" #include "WebFileError.h" #include "platform/WebVector.h" @@ -41,6 +40,7 @@ #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> +#include <wtf/text/WTFString.h> namespace WebCore { class WorkerLoaderProxy; diff --git a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp index fb723223b..9bc70faca 100644 --- a/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/android/WebInputEventFactory.cpp @@ -50,7 +50,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(WebInputEvent::Type type, result.type = type; result.modifiers = modifiers; result.timeStampSeconds = timeStampSeconds; - result.windowsKeyCode = WebCore::windowsKeyCodeForKeyEvent(keycode); + int windowsKeyCode = WebCore::windowsKeyCodeForKeyEvent(keycode); + result.windowsKeyCode = WebKeyboardEvent::windowsKeyCodeWithoutLocation(windowsKeyCode); + result.modifiers |= WebKeyboardEvent::locationModifiersFromWindowsKeyCode(windowsKeyCode); result.nativeKeyCode = keycode; result.unmodifiedText[0] = unicodeCharacter; if (result.windowsKeyCode == WebCore::VKEY_RETURN) { diff --git a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp index 43c238a69..207d34f01 100644 --- a/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/gtk/WebInputEventFactory.cpp @@ -383,7 +383,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(const GdkEventKey* event) // The key code tells us which physical key was pressed (for example, the // A key went down or up). It does not determine whether A should be lower // or upper case. This is what text does, which should be the keyval. - result.windowsKeyCode = gdkEventToWindowsKeyCode(event); + int windowsKeyCode = gdkEventToWindowsKeyCode(event); + result.windowsKeyCode = WebKeyboardEvent::windowsKeyCodeWithoutLocation(windowsKeyCode); + result.modifiers |= WebKeyboardEvent::locationModifiersFromWindowsKeyCode(windowsKeyCode); result.nativeKeyCode = event->hardware_keycode; if (result.windowsKeyCode == WebCore::VKEY_RETURN) diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index babb1f6cc..b3a22fee1 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -606,7 +606,9 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(NSEvent* event) if (([event type] != NSFlagsChanged) && [event isARepeat]) result.modifiers |= WebInputEvent::IsAutoRepeat; - result.windowsKeyCode = windowsKeyCodeForKeyEvent(event); + int windowsKeyCode = windowsKeyCodeForKeyEvent(event); + result.windowsKeyCode = WebKeyboardEvent::windowsKeyCodeWithoutLocation(windowsKeyCode); + result.modifiers |= WebKeyboardEvent::locationModifiersFromWindowsKeyCode(windowsKeyCode); result.nativeKeyCode = [event keyCode]; NSString* textStr = textFromEvent(event); diff --git a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp index 9da4b4a27..a177ea244 100644 --- a/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp +++ b/Source/WebKit/chromium/src/win/WebInputEventFactory.cpp @@ -42,12 +42,18 @@ static const unsigned long defaultScrollCharsPerWheelDelta = 1; // WebKeyboardEvent ----------------------------------------------------------- -static bool isKeyPad(WPARAM wparam, LPARAM lparam) +static bool isKeyDown(WPARAM wparam) { - bool keypad = false; + return GetKeyState(wparam) & 0x8000; +} + +static int getLocationModifier(WPARAM wparam, LPARAM lparam) +{ + int modifier = 0; switch (wparam) { case VK_RETURN: - keypad = (lparam >> 16) & KF_EXTENDED; + if ((lparam >> 16) & KF_EXTENDED) + modifier = WebInputEvent::IsKeyPad; break; case VK_INSERT: case VK_DELETE: @@ -59,7 +65,8 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam) case VK_DOWN: case VK_LEFT: case VK_RIGHT: - keypad = !((lparam >> 16) & KF_EXTENDED); + if (!((lparam >> 16) & KF_EXTENDED)) + modifier = WebInputEvent::IsKeyPad; break; case VK_NUMLOCK: case VK_NUMPAD0: @@ -78,12 +85,39 @@ static bool isKeyPad(WPARAM wparam, LPARAM lparam) case VK_ADD: case VK_DECIMAL: case VK_CLEAR: - keypad = true; + modifier = WebInputEvent::IsKeyPad; + break; + case VK_SHIFT: + if (isKeyDown(VK_LSHIFT)) + modifier = WebInputEvent::IsLeft; + else if (isKeyDown(VK_RSHIFT)) + modifier = WebInputEvent::IsRight; + break; + case VK_CONTROL: + if (isKeyDown(VK_LCONTROL)) + modifier = WebInputEvent::IsLeft; + else if (isKeyDown(VK_RCONTROL)) + modifier = WebInputEvent::IsRight; + break; + case VK_MENU: + if (isKeyDown(VK_LMENU)) + modifier = WebInputEvent::IsLeft; + else if (isKeyDown(VK_RMENU)) + modifier = WebInputEvent::IsRight; + break; + case VK_LWIN: + modifier = WebInputEvent::IsLeft; + break; + case VK_RWIN: + modifier = WebInputEvent::IsRight; break; - default: - keypad = false; } - return keypad; + + ASSERT(!modifier + || modifier == WebInputEvent::IsKeyPad + || modifier == WebInputEvent::IsLeft + || modifier == WebInputEvent::IsRight); + return modifier; } // Loads the state for toggle keys into the event. @@ -153,8 +187,8 @@ WebKeyboardEvent WebInputEventFactory::keyboardEvent(HWND hwnd, UINT message, if (LOWORD(lparam) > 1) result.modifiers |= WebInputEvent::IsAutoRepeat; - if (isKeyPad(wparam, lparam)) - result.modifiers |= WebInputEvent::IsKeyPad; + + result.modifiers |= getLocationModifier(wparam, lparam); SetToggleKeyState(&result); return result; |