diff options
Diffstat (limited to 'Source/WebKit/chromium/src')
141 files changed, 1454 insertions, 1214 deletions
diff --git a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp index 2b6a47707..a8f398eb5 100644 --- a/Source/WebKit/chromium/src/ApplicationCacheHost.cpp +++ b/Source/WebKit/chromium/src/ApplicationCacheHost.cpp @@ -44,10 +44,10 @@ #include "WebFrameImpl.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" -#include "platform/WebURL.h" -#include "platform/WebURLError.h" -#include "platform/WebURLResponse.h" -#include "platform/WebVector.h" +#include <public/WebURL.h> +#include <public/WebURLError.h> +#include <public/WebURLResponse.h> +#include <public/WebVector.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/AssertMatchingEnums.cpp b/Source/WebKit/chromium/src/AssertMatchingEnums.cpp index c6bf971f1..95e8b607d 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 "RTCDataChannelDescriptor.h" #include "RTCPeerConnectionHandlerClient.h" #include "ReferrerPolicy.h" #include "ResourceResponse.h" @@ -116,6 +117,7 @@ #include <public/WebMediaStreamSource.h> #include <public/WebPeerConnection00Handler.h> #include <public/WebPeerConnection00HandlerClient.h> +#include <public/WebRTCDataChannel.h> #include <public/WebRTCPeerConnectionHandler.h> #include <public/WebRTCPeerConnectionHandlerClient.h> #include <public/WebReferrerPolicy.h> @@ -124,11 +126,6 @@ #include <wtf/Assertions.h> #include <wtf/text/StringImpl.h> -#if OS(DARWIN) -#include "PlatformSupport.h" -#include <public/mac/WebThemeEngine.h> -#endif - #define COMPILE_ASSERT_MATCHING_ENUM(webkit_name, webcore_name) \ COMPILE_ASSERT(int(WebKit::webkit_name) == int(WebCore::webcore_name), mismatching_enums) @@ -548,22 +545,6 @@ COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorNotSupported, NOT_SUPPORTED_ERR COMPILE_ASSERT_MATCHING_ENUM(WebStorageQuotaErrorAbort, ABORT_ERR); #endif -#if OS(DARWIN) -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateDisabled, PlatformSupport::StateDisabled); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateInactive, PlatformSupport::StateInactive); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StateActive, PlatformSupport::StateActive); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::StatePressed, PlatformSupport::StatePressed); - -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeRegular, PlatformSupport::SizeRegular); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::SizeSmall, PlatformSupport::SizeSmall); - -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationHorizontal, PlatformSupport::ScrollbarOrientationHorizontal); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarOrientationVertical, PlatformSupport::ScrollbarOrientationVertical); - -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentScrollView, PlatformSupport::ScrollbarParentScrollView); -COMPILE_ASSERT_MATCHING_ENUM(WebThemeEngine::ScrollbarParentRenderLayer, PlatformSupport::ScrollbarParentRenderLayer); -#endif - COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateVisible, PageVisibilityStateVisible); COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStateHidden, PageVisibilityStateHidden); COMPILE_ASSERT_MATCHING_ENUM(WebPageVisibilityStatePrerender, PageVisibilityStatePrerender); @@ -612,6 +593,11 @@ COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateConnecte COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateCompleted, RTCPeerConnectionHandlerClient::IceStateCompleted); COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateFailed, RTCPeerConnectionHandlerClient::IceStateFailed); COMPILE_ASSERT_MATCHING_ENUM(WebRTCPeerConnectionHandlerClient::ICEStateClosed, RTCPeerConnectionHandlerClient::IceStateClosed); + +COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateConnecting, RTCDataChannelDescriptor::ReadyStateConnecting); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateOpen, RTCDataChannelDescriptor::ReadyStateOpen); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateClosing, RTCDataChannelDescriptor::ReadyStateClosing); +COMPILE_ASSERT_MATCHING_ENUM(WebRTCDataChannel::ReadyStateClosed, RTCDataChannelDescriptor::ReadyStateClosed); #endif #if ENABLE(SCRIPTED_SPEECH) diff --git a/Source/WebKit/chromium/src/AssociatedURLLoader.h b/Source/WebKit/chromium/src/AssociatedURLLoader.h index 2851f3f82..d202b1861 100644 --- a/Source/WebKit/chromium/src/AssociatedURLLoader.h +++ b/Source/WebKit/chromium/src/AssociatedURLLoader.h @@ -32,7 +32,7 @@ #define AssociatedURLLoader_h #include "WebURLLoaderOptions.h" -#include "platform/WebURLLoader.h" +#include <public/WebURLLoader.h> #include <wtf/Noncopyable.h> #include <wtf/OwnPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/AsyncFileWriterChromium.cpp b/Source/WebKit/chromium/src/AsyncFileWriterChromium.cpp index 6071a0ae6..f9e492b9a 100644 --- a/Source/WebKit/chromium/src/AsyncFileWriterChromium.cpp +++ b/Source/WebKit/chromium/src/AsyncFileWriterChromium.cpp @@ -36,7 +36,7 @@ #include "AsyncFileWriterClient.h" #include "Blob.h" #include "WebFileWriter.h" -#include "platform/WebURL.h" +#include <public/WebURL.h> namespace WebCore { diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp index 380c74b85..12dbba742 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.cpp +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.cpp @@ -29,14 +29,9 @@ #include "config.h" #if ENABLE(WEB_AUDIO) - #include "AudioDestinationChromium.h" - #include "AudioFIFO.h" #include "AudioPullFIFO.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" - #include <public/Platform.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/AudioDestinationChromium.h b/Source/WebKit/chromium/src/AudioDestinationChromium.h index 7d261a7fa..7b148c464 100644 --- a/Source/WebKit/chromium/src/AudioDestinationChromium.h +++ b/Source/WebKit/chromium/src/AudioDestinationChromium.h @@ -33,8 +33,8 @@ #include "AudioDestination.h" #include "AudioIOCallback.h" #include "AudioSourceProvider.h" -#include "platform/WebAudioDevice.h" -#include "platform/WebVector.h" +#include <public/WebAudioDevice.h> +#include <public/WebVector.h> namespace WebKit { class WebAudioDevice; } diff --git a/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp b/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp index 4e643029a..66cb82bd5 100644 --- a/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp +++ b/Source/WebKit/chromium/src/AutofillPopupMenuClient.cpp @@ -44,8 +44,8 @@ #include "WebNode.h" #include "WebViewClient.h" #include "WebViewImpl.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" +#include <public/WebString.h> +#include <public/WebVector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.cpp b/Source/WebKit/chromium/src/ChromeClientImpl.cpp index 985757783..9d0961c46 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.cpp +++ b/Source/WebKit/chromium/src/ChromeClientImpl.cpp @@ -63,7 +63,6 @@ #include "Page.h" #include "PagePopupDriver.h" #include "PlatformScreen.h" -#include "PlatformSupport.h" #include "PopupContainer.h" #include "PopupMenuChromium.h" #include "RenderWidget.h" @@ -90,16 +89,16 @@ #include "WebPopupMenuImpl.h" #include "WebPopupMenuInfo.h" #include "WebPopupType.h" -#include "platform/WebRect.h" #include "WebSettings.h" #include "WebTextDirection.h" -#include "platform/WebURLRequest.h" #include "WebViewClient.h" #include "WebViewImpl.h" #include "WebWindowFeatures.h" #include "WindowFeatures.h" #include "WrappedResourceRequest.h" #include <public/Platform.h> +#include <public/WebRect.h> +#include <public/WebURLRequest.h> #include <wtf/text/CString.h> #include <wtf/text/StringBuilder.h> #include <wtf/text/StringConcatenate.h> @@ -918,7 +917,7 @@ void ChromeClientImpl::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* grap m_webView->setRootGraphicsLayer(graphicsLayer); } -void ChromeClientImpl::scheduleCompositingLayerSync() +void ChromeClientImpl::scheduleCompositingLayerFlush() { m_webView->scheduleCompositingLayerSync(); } @@ -1120,8 +1119,8 @@ bool ChromeClientImpl::isPointerLocked() } #endif -#if ENABLE(WIDGET_REGION) -void ChromeClientImpl::dashboardRegionsChanged() +#if ENABLE(DRAGGABLE_REGION) +void ChromeClientImpl::annotatedRegionsChanged() { WebViewClient* client = m_webView->client(); if (client) diff --git a/Source/WebKit/chromium/src/ChromeClientImpl.h b/Source/WebKit/chromium/src/ChromeClientImpl.h index 7d456fbf5..4a609dadd 100644 --- a/Source/WebKit/chromium/src/ChromeClientImpl.h +++ b/Source/WebKit/chromium/src/ChromeClientImpl.h @@ -138,8 +138,8 @@ public: WebCore::Frame*, const WTF::String& databaseName); virtual void reachedMaxAppCacheSize(int64_t spaceNeeded); virtual void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin*, int64_t totalSpaceNeeded); -#if ENABLE(WIDGET_REGION) - virtual void dashboardRegionsChanged(); +#if ENABLE(DRAGGABLE_REGION) + virtual void annotatedRegionsChanged(); #endif virtual bool paintCustomOverhangArea(WebCore::GraphicsContext*, const WebCore::IntRect&, const WebCore::IntRect&, const WebCore::IntRect&); #if ENABLE(INPUT_TYPE_COLOR) @@ -171,7 +171,7 @@ public: // Sets a flag to specify that the view needs to be updated, so we need // to do an eager layout before the drawing. - virtual void scheduleCompositingLayerSync(); + virtual void scheduleCompositingLayerFlush(); virtual CompositingTriggerFlags allowedCompositingTriggers() const; #endif diff --git a/Source/WebKit/chromium/src/ColorChooserUIController.cpp b/Source/WebKit/chromium/src/ColorChooserUIController.cpp index c77634cff..330f59ce2 100644 --- a/Source/WebKit/chromium/src/ColorChooserUIController.cpp +++ b/Source/WebKit/chromium/src/ColorChooserUIController.cpp @@ -32,14 +32,18 @@ #include "Color.h" #include "ColorChooserClient.h" #include "ColorSuggestionPicker.h" +#include "FrameView.h" #include "IntRect.h" #include "LocalizedStrings.h" #include "PickerCommon.h" #include "WebColorChooser.h" -#include "platform/WebColor.h" -#include "platform/WebKitPlatformSupport.h" +#include "WebViewImpl.h" +#include <public/Platform.h> +#include <public/WebColor.h> #include <public/WebLocalizedString.h> +using namespace WebCore; + namespace WebKit { // Keep in sync with Actions in colorSuggestionPicker.js. @@ -49,10 +53,11 @@ enum ColorPickerPopupAction { ColorPickerPopupActionSetValue = 0 }; -ColorChooserUIController::ColorChooserUIController(ChromeClientImpl* chromeClient, WebCore::ColorChooserClient* client) +ColorChooserUIController::ColorChooserUIController(ChromeClientImpl* chromeClient, ColorChooserClient* client) : m_chromeClient(chromeClient) , m_client(client) , m_popup(0) + , m_localizer(Localizer::createDefault()) { if (m_client->shouldShowSuggestions()) openPopup(); @@ -64,7 +69,7 @@ ColorChooserUIController::~ColorChooserUIController() { } -void ColorChooserUIController::setSelectedColor(const WebCore::Color& color) +void ColorChooserUIController::setSelectedColor(const Color& color) { ASSERT(m_chooser); m_chooser->setSelectedColor(static_cast<WebColor>(color.rgb())); @@ -81,7 +86,7 @@ void ColorChooserUIController::endChooser() void ColorChooserUIController::didChooseColor(const WebColor& color) { ASSERT(m_client); - m_client->didChooseColor(WebCore::Color(static_cast<WebCore::RGBA32>(color))); + m_client->didChooseColor(Color(static_cast<RGBA32>(color))); } void ColorChooserUIController::didEndChooser() @@ -91,29 +96,45 @@ void ColorChooserUIController::didEndChooser() m_client->didEndChooser(); } -WebCore::IntSize ColorChooserUIController::contentSize() +IntSize ColorChooserUIController::contentSize() { - return WebCore::IntSize(0, 0); + return IntSize(0, 0); } -void ColorChooserUIController::writeDocument(WebCore::DocumentWriter& writer) +void ColorChooserUIController::writeDocument(DocumentWriter& writer) { - Vector<WebCore::Color> suggestions = m_client->suggestions(); + Vector<Color> suggestions = m_client->suggestions(); Vector<String> suggestionValues; for (unsigned i = 0; i < suggestions.size(); i++) suggestionValues.append(suggestions[i].serialized()); + IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_client->elementRectRelativeToRootView()); + FrameView* view = static_cast<WebViewImpl*>(m_chromeClient->webView())->page()->mainFrame()->view(); + IntRect rootViewVisibleContentRect = view->visibleContentRect(true /* include scrollbars */); + IntRect rootViewRectInScreen = m_chromeClient->rootViewToScreen(rootViewVisibleContentRect); - WebCore::PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); - writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss)); - writer.addData(WebCore::colorSuggestionPickerCss, sizeof(WebCore::colorSuggestionPickerCss)); - WebCore::PagePopupClient::addString("</style></head><body><div id=main>Loading...</div><script>\n" + PagePopupClient::addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); + writer.addData(pickerCommonCss, sizeof(pickerCommonCss)); + writer.addData(colorSuggestionPickerCss, sizeof(colorSuggestionPickerCss)); + PagePopupClient::addString("</style></head><body><div id=main>Loading...</div><script>\n" "window.dialogArguments = {\n", writer); - WebCore::PagePopupClient::addProperty("values", suggestionValues, writer); - WebCore::PagePopupClient::addProperty("otherColorLabel", Platform::current()->queryLocalizedString(WebLocalizedString::OtherColorLabel), writer); - WebCore::PagePopupClient::addString("};\n", writer); - writer.addData(WebCore::pickerCommonJs, sizeof(WebCore::pickerCommonJs)); - writer.addData(WebCore::colorSuggestionPickerJs, sizeof(WebCore::colorSuggestionPickerJs)); - WebCore::PagePopupClient::addString("</script></body>\n", writer); + PagePopupClient::addProperty("values", suggestionValues, writer); + PagePopupClient::addProperty("otherColorLabel", Platform::current()->queryLocalizedString(WebLocalizedString::OtherColorLabel), writer); + addProperty("anchorRectInScreen", anchorRectInScreen, writer); + addProperty("rootViewRectInScreen", rootViewRectInScreen, writer); +#if OS(MAC_OS_X) + addProperty("confineToRootView", true, writer); +#else + addProperty("confineToRootView", false, writer); +#endif + PagePopupClient::addString("};\n", writer); + writer.addData(pickerCommonJs, sizeof(pickerCommonJs)); + writer.addData(colorSuggestionPickerJs, sizeof(colorSuggestionPickerJs)); + PagePopupClient::addString("</script></body>\n", writer); +} + +Localizer& ColorChooserUIController::localizer() +{ + return *m_localizer; } void ColorChooserUIController::setValueAndClosePopup(int numValue, const String& stringValue) @@ -121,7 +142,7 @@ void ColorChooserUIController::setValueAndClosePopup(int numValue, const String& ASSERT(m_popup); ASSERT(m_client); if (numValue == ColorPickerPopupActionSetValue) - m_client->didChooseColor(WebCore::Color(stringValue)); + m_client->didChooseColor(Color(stringValue)); if (numValue == ColorPickerPopupActionChooseOtherColor) openColorChooser(); closePopup(); diff --git a/Source/WebKit/chromium/src/ColorChooserUIController.h b/Source/WebKit/chromium/src/ColorChooserUIController.h index 98adb6714..40c878b8e 100644 --- a/Source/WebKit/chromium/src/ColorChooserUIController.h +++ b/Source/WebKit/chromium/src/ColorChooserUIController.h @@ -29,6 +29,7 @@ #if ENABLE(INPUT_TYPE_COLOR) #include "ColorChooser.h" +#include "Localizer.h" #include "PagePopupClient.h" #include "WebColorChooserClient.h" #include <wtf/OwnPtr.h> @@ -60,6 +61,7 @@ public: // PagePopupClient functions: virtual WebCore::IntSize contentSize() OVERRIDE; virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE; + virtual WebCore::Localizer& localizer() OVERRIDE; virtual void setValueAndClosePopup(int, const String&) OVERRIDE; virtual void didClosePopup() OVERRIDE; @@ -72,6 +74,7 @@ private: WebCore::ColorChooserClient* m_client; OwnPtr<WebColorChooser> m_chooser; WebCore::PagePopup* m_popup; + OwnPtr<WebCore::Localizer> m_localizer; }; } diff --git a/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h b/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h index 73e07cb55..636e81076 100644 --- a/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h +++ b/Source/WebKit/chromium/src/CompositionUnderlineBuilder.h @@ -32,9 +32,9 @@ #define CompositionUnderlineBuilder_h #include "Editor.h" -#include <wtf/Vector.h> #include "WebCompositionUnderline.h" -#include "platform/WebVector.h" +#include <public/WebVector.h> +#include <wtf/Vector.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h b/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h index b12b92cc6..5d4f08289 100644 --- a/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h +++ b/Source/WebKit/chromium/src/CompositionUnderlineVectorBuilder.h @@ -32,9 +32,9 @@ #define CompositionUnderlineVectorBuilder_h #include "Editor.h" -#include <wtf/Vector.h> #include "WebCompositionUnderline.h" -#include "platform/WebVector.h" +#include <public/WebVector.h> +#include <wtf/Vector.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp index 833a5016d..e5795edc4 100644 --- a/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextFeaturesClientImpl.cpp @@ -140,7 +140,6 @@ bool ContextFeaturesClientImpl::askIfIsEnabled(Document* document, ContextFeatur return defaultValue; switch (type) { - case ContextFeatures::ShadowDOM: case ContextFeatures::StyleScoped: return m_client->allowWebComponents(WebDocument(document), defaultValue); case ContextFeatures::HTMLNotifications: diff --git a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp index 641a585a0..ad116090c 100644 --- a/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp +++ b/Source/WebKit/chromium/src/ContextMenuClientImpl.cpp @@ -47,7 +47,6 @@ #include "HTMLMediaElement.h" #include "HTMLNames.h" #include "HTMLPlugInImageElement.h" - #include "HistoryItem.h" #include "HitTestResult.h" #include "KURL.h" @@ -57,7 +56,6 @@ #include "Settings.h" #include "TextBreakIterator.h" #include "Widget.h" - #include "WebContextMenuData.h" #include "WebDataSourceImpl.h" #include "WebFormElement.h" @@ -65,15 +63,15 @@ #include "WebMenuItemInfo.h" #include "WebPlugin.h" #include "WebPluginContainerImpl.h" -#include "platform/WebPoint.h" #include "WebSearchableFormData.h" #include "WebSpellCheckClient.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "platform/WebURLResponse.h" -#include "platform/WebVector.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <public/WebPoint.h> +#include <public/WebString.h> +#include <public/WebURL.h> +#include <public/WebURLResponse.h> +#include <public/WebVector.h> #include <wtf/text/WTFString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp index 4e2c69e9f..20044add8 100644 --- a/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp +++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.cpp @@ -37,16 +37,18 @@ #include "ChromeClientImpl.h" #include "DateComponents.h" #include "DateTimeChooserClient.h" +#include "FrameView.h" #include "InputTypeNames.h" #include "Language.h" -#include "LocalizedDate.h" +#include "Localizer.h" #include "NotImplemented.h" #include "PickerCommon.h" #include "RenderTheme.h" -#include "platform/WebKitPlatformSupport.h" +#include "WebViewImpl.h" +#include <public/Platform.h> #include <public/WebLocalizedString.h> -using namespace WTF::Unicode; +using namespace WebCore; namespace WebKit { @@ -55,6 +57,7 @@ DateTimeChooserImpl::DateTimeChooserImpl(ChromeClientImpl* chromeClient, WebCore , m_client(client) , m_popup(0) , m_parameters(parameters) + , m_localizer(WebCore::Localizer::createDefault()) { ASSERT(m_chromeClient); ASSERT(m_client); @@ -85,6 +88,11 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer) date.setMillisecondsSinceEpochForDate(m_parameters.maximum); String maxString = date.toString(); String stepString = String::number(m_parameters.step); + String stepBaseString = String::number(m_parameters.stepBase, 11, WTF::TruncateTrailingZeros); + IntRect anchorRectInScreen = m_chromeClient->rootViewToScreen(m_parameters.anchorRectInRootView); + FrameView* view = static_cast<WebViewImpl*>(m_chromeClient->webView())->page()->mainFrame()->view(); + IntRect rootViewVisibleContentRect = view->visibleContentRect(true /* include scrollbars */); + IntRect rootViewRectInScreen = m_chromeClient->rootViewToScreen(rootViewVisibleContentRect); addString("<!DOCTYPE html><head><meta charset='UTF-8'><style>\n", writer); writer.addData(WebCore::pickerCommonCss, sizeof(WebCore::pickerCommonCss)); @@ -95,19 +103,27 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer) writer.addData(extraStyle.data(), extraStyle.length()); addString("</style></head><body><div id=main>Loading...</div><script>\n" "window.dialogArguments = {\n", writer); + addProperty("anchorRectInScreen", anchorRectInScreen, writer); + addProperty("rootViewRectInScreen", rootViewRectInScreen, writer); +#if OS(MAC_OS_X) + addProperty("confineToRootView", true, writer); +#else + addProperty("confineToRootView", false, writer); +#endif addProperty("min", minString, writer); addProperty("max", maxString, writer); addProperty("step", stepString, writer); + addProperty("stepBase", stepBaseString, 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); + addProperty("weekStartDay", m_localizer->firstDayOfWeek(), writer); + addProperty("monthLabels", m_localizer->monthLabels(), writer); + addProperty("dayLabels", m_localizer->weekDayShortLabels(), writer); + addProperty("isCalendarRTL", m_localizer->isRTL(), writer); + addProperty("isRTL", m_parameters.isAnchorElementRTL, writer); if (m_parameters.suggestionValues.size()) { addProperty("inputWidth", static_cast<unsigned>(m_parameters.anchorRectInRootView.width()), writer); addProperty("suggestionValues", m_parameters.suggestionValues, writer); @@ -126,6 +142,11 @@ void DateTimeChooserImpl::writeDocument(WebCore::DocumentWriter& writer) addString("</script></body>\n", writer); } +WebCore::Localizer& DateTimeChooserImpl::localizer() +{ + return *m_localizer; +} + void DateTimeChooserImpl::setValueAndClosePopup(int numValue, const String& stringValue) { if (numValue >= 0) diff --git a/Source/WebKit/chromium/src/DateTimeChooserImpl.h b/Source/WebKit/chromium/src/DateTimeChooserImpl.h index e504592bc..40195ce53 100644 --- a/Source/WebKit/chromium/src/DateTimeChooserImpl.h +++ b/Source/WebKit/chromium/src/DateTimeChooserImpl.h @@ -57,6 +57,7 @@ private: // PagePopupClient functions: virtual WebCore::IntSize contentSize() OVERRIDE; virtual void writeDocument(WebCore::DocumentWriter&) OVERRIDE; + virtual WebCore::Localizer& localizer() OVERRIDE; virtual void setValueAndClosePopup(int, const String&) OVERRIDE; virtual void didClosePopup() OVERRIDE; @@ -64,6 +65,7 @@ private: WebCore::DateTimeChooserClient* m_client; WebCore::PagePopup* m_popup; WebCore::DateTimeChooserParameters m_parameters; + OwnPtr<WebCore::Localizer> m_localizer; }; } diff --git a/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h b/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h index a94d39b7c..5ece4eed1 100644 --- a/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h +++ b/Source/WebKit/chromium/src/DeliveredIntentClientImpl.h @@ -33,7 +33,7 @@ #include "DeliveredIntent.h" #include "SerializedScriptValue.h" -#include "platform/WebCommon.h" +#include <public/WebCommon.h> #include <wtf/PassRefPtr.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/DragClientImpl.cpp b/Source/WebKit/chromium/src/DragClientImpl.cpp index 3974e7ad3..39f48c6b5 100644 --- a/Source/WebKit/chromium/src/DragClientImpl.cpp +++ b/Source/WebKit/chromium/src/DragClientImpl.cpp @@ -35,12 +35,11 @@ #include "ClipboardChromium.h" #include "Frame.h" #include "NativeImageSkia.h" -#include "platform/WebCommon.h" -#include "platform/WebImage.h" #include "WebViewClient.h" #include "WebViewImpl.h" - +#include <public/WebCommon.h> #include <public/WebDragData.h> +#include <public/WebImage.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/DragScrollTimer.h b/Source/WebKit/chromium/src/DragScrollTimer.h index fe19013e2..e6aacd7ae 100644 --- a/Source/WebKit/chromium/src/DragScrollTimer.h +++ b/Source/WebKit/chromium/src/DragScrollTimer.h @@ -33,7 +33,7 @@ #include "IntSize.h" #include "Timer.h" -#include "platform/WebPoint.h" +#include <public/WebPoint.h> namespace WebCore { class FrameView; } diff --git a/Source/WebKit/chromium/src/ExternalPopupMenu.cpp b/Source/WebKit/chromium/src/ExternalPopupMenu.cpp index 1855401c4..3166384c0 100644 --- a/Source/WebKit/chromium/src/ExternalPopupMenu.cpp +++ b/Source/WebKit/chromium/src/ExternalPopupMenu.cpp @@ -38,8 +38,8 @@ #include "WebExternalPopupMenu.h" #include "WebMenuItemInfo.h" #include "WebPopupMenuInfo.h" -#include "platform/WebVector.h" #include "WebViewClient.h" +#include <public/WebVector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp index 643848868..5dbfacc23 100644 --- a/Source/WebKit/chromium/src/FindInPageCoordinates.cpp +++ b/Source/WebKit/chromium/src/FindInPageCoordinates.cpp @@ -67,7 +67,7 @@ static FloatRect toNormalizedRect(const FloatRect& absoluteRect, const RenderObj scrolledOrigin = -IntPoint(container->scrolledContentOffset()); FloatRect overflowRect(scrolledOrigin, container->maxLayoutOverflow()); - FloatRect containerRect = container->localToAbsoluteQuad(FloatQuad(overflowRect), false).enclosingBoundingBox(); + FloatRect containerRect = container->localToAbsoluteQuad(FloatQuad(overflowRect), SnapOffsetForTransforms).enclosingBoundingBox(); if (containerRect.isEmpty()) return FloatRect(); diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp index 0ac5d932c..49e780baf 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.cpp @@ -57,6 +57,9 @@ #include "ProgressTracker.h" #include "ResourceHandleInternal.h" #include "ResourceLoader.h" +#if ENABLE(MEDIA_STREAM) +#include "RTCPeerConnectionHandlerChromium.h" +#endif #include "Settings.h" #include "SocketStreamHandleInternal.h" #include "WebDOMEvent.h" @@ -75,18 +78,17 @@ #include "WebPluginLoadObserver.h" #include "WebPluginParams.h" #include "WebSecurityOrigin.h" -#include "platform/WebSocketStreamHandle.h" #include "WebViewClient.h" #include "WebViewImpl.h" #include "WindowFeatures.h" #include "WrappedResourceRequest.h" #include "WrappedResourceResponse.h" -#include "platform/WebURL.h" -#include "platform/WebURLError.h" -#include "platform/WebVector.h" #include <public/Platform.h> #include <public/WebMimeRegistry.h> - +#include <public/WebSocketStreamHandle.h> +#include <public/WebURL.h> +#include <public/WebURLError.h> +#include <public/WebVector.h> #include <wtf/StringExtras.h> #include <wtf/text/CString.h> #include <wtf/text/WTFString.h> @@ -126,7 +128,7 @@ void FrameLoaderClientImpl::frameLoaderDestroyed() // serves to keep us alive until the FrameLoader is done with us. The // FrameLoader calls this method when it's going away. Therefore, we balance // out that extra reference, which may cause 'this' to be deleted. - m_webFrame->closing(); + ASSERT(!m_webFrame->frame()); m_webFrame->deref(); } @@ -1639,4 +1641,12 @@ void FrameLoaderClientImpl::dispatchWillOpenSocketStream(SocketStreamHandle* han m_webFrame->client()->willOpenSocketStream(SocketStreamHandleInternal::toWebSocketStreamHandle(handle)); } +#if ENABLE(MEDIA_STREAM) +void FrameLoaderClientImpl::dispatchWillStartUsingPeerConnectionHandler(RTCPeerConnectionHandler* handler) +{ + m_webFrame->client()->willStartUsingPeerConnectionHandler(webFrame(), RTCPeerConnectionHandlerChromium::toWebRTCPeerConnectionHandler(handler)); +} +#endif + + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h index 4d33267ce..12a76feee 100644 --- a/Source/WebKit/chromium/src/FrameLoaderClientImpl.h +++ b/Source/WebKit/chromium/src/FrameLoaderClientImpl.h @@ -182,6 +182,7 @@ public: const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const Vector<WTF::String>&, const Vector<WTF::String>&, const WTF::String&, bool loadManually); + virtual void recreatePlugin(WebCore::Widget*) { } virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( const WebCore::IntSize&, @@ -220,6 +221,10 @@ public: virtual void dispatchWillOpenSocketStream(WebCore::SocketStreamHandle*) OVERRIDE; +#if ENABLE(MEDIA_STREAM) + virtual void dispatchWillStartUsingPeerConnectionHandler(WebCore::RTCPeerConnectionHandler*) OVERRIDE; +#endif + private: void makeDocumentView(); diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp index 501ce61fb..29b8c4bf4 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.cpp @@ -66,12 +66,12 @@ IDBDatabaseMetadata IDBDatabaseBackendProxy::metadata() const return m_webIDBDatabase->metadata(); } -PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendProxy::createObjectStore(const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +PassRefPtr<IDBObjectStoreBackendInterface> IDBDatabaseBackendProxy::createObjectStore(int64_t id, const String& name, const IDBKeyPath& keyPath, bool autoIncrement, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, // all implementations of IDB interfaces are proxy objects. IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); - OwnPtr<WebIDBObjectStore> objectStore = adoptPtr(m_webIDBDatabase->createObjectStore(name, keyPath, autoIncrement, *transactionProxy->getWebIDBTransaction(), ec)); + OwnPtr<WebIDBObjectStore> objectStore = adoptPtr(m_webIDBDatabase->createObjectStore(id, name, keyPath, autoIncrement, *transactionProxy->getWebIDBTransaction(), ec)); if (!objectStore) return 0; return IDBObjectStoreBackendProxy::create(objectStore.release()); diff --git a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h index 795610aa6..fc831e8de 100644 --- a/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBDatabaseBackendProxy.h @@ -44,7 +44,7 @@ public: virtual WebCore::IDBDatabaseMetadata metadata() const; - virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(const String& name, const WebCore::IDBKeyPath&, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + virtual PassRefPtr<WebCore::IDBObjectStoreBackendInterface> createObjectStore(int64_t, const String& name, const WebCore::IDBKeyPath&, bool autoIncrement, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void deleteObjectStore(const String& name, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void setVersion(const String& version, PassRefPtr<WebCore::IDBCallbacks>, PassRefPtr<WebCore::IDBDatabaseCallbacks>, WebCore::ExceptionCode&); virtual PassRefPtr<WebCore::IDBTransactionBackendInterface> transaction(WebCore::DOMStringList* storeNames, unsigned short mode, WebCore::ExceptionCode&); diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp index b53eb2c3a..2b9b44a7a 100755 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.cpp @@ -103,6 +103,17 @@ void IDBObjectStoreBackendProxy::clear(PassRefPtr<IDBCallbacks> callbacks, IDBTr m_webIDBObjectStore->clear(new WebIDBCallbacksImpl(callbacks), *transactionProxy->getWebIDBTransaction(), ec); } +PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendProxy::createIndex(int64_t id, const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) +{ + // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, + // all implementations of IDB interfaces are proxy objects. + IDBTransactionBackendProxy* transactionProxy = static_cast<IDBTransactionBackendProxy*>(transaction); + OwnPtr<WebIDBIndex> index = adoptPtr(m_webIDBObjectStore->createIndex(id, name, keyPath, unique, multiEntry, *transactionProxy->getWebIDBTransaction(), ec)); + if (!index) + return 0; + return IDBIndexBackendProxy::create(index.release()); +} + PassRefPtr<IDBIndexBackendInterface> IDBObjectStoreBackendProxy::createIndex(const String& name, const IDBKeyPath& keyPath, bool unique, bool multiEntry, IDBTransactionBackendInterface* transaction, ExceptionCode& ec) { // The transaction pointer is guaranteed to be a pointer to a proxy object as, in the renderer, diff --git a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h index 74cb0bd57..8470c1ad9 100644 --- a/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h +++ b/Source/WebKit/chromium/src/IDBObjectStoreBackendProxy.h @@ -48,6 +48,7 @@ public: virtual void deleteFunction(PassRefPtr<WebCore::IDBKeyRange>, PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void clear(PassRefPtr<WebCore::IDBCallbacks>, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); + PassRefPtr<WebCore::IDBIndexBackendInterface> createIndex(int64_t id, const String& name, const WebCore::IDBKeyPath&, bool unique, bool multiEntry, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); PassRefPtr<WebCore::IDBIndexBackendInterface> createIndex(const String& name, const WebCore::IDBKeyPath&, bool unique, bool multiEntry, WebCore::IDBTransactionBackendInterface*, WebCore::ExceptionCode&); virtual void setIndexKeys(PassRefPtr<WebCore::IDBKey> prpPrimaryKey, const WTF::Vector<WTF::String>&, const WTF::Vector<IndexKeys>&, WebCore::IDBTransactionBackendInterface*); virtual void setIndexesReady(const Vector<String>&, WebCore::IDBTransactionBackendInterface*); diff --git a/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp b/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp index 83d7e3a1d..5bcdb273b 100644 --- a/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp +++ b/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.cpp @@ -31,6 +31,8 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBDatabaseError.h" +#include "WebIDBDatabaseError.h" #include "WebIDBTransactionCallbacks.h" using namespace WebCore; @@ -51,9 +53,9 @@ IDBTransactionCallbacksProxy::~IDBTransactionCallbacksProxy() { } -void IDBTransactionCallbacksProxy::onAbort() +void IDBTransactionCallbacksProxy::onAbort(PassRefPtr<IDBDatabaseError> idbDatabaseError) { - m_callbacks->onAbort(); + m_callbacks->onAbort(WebIDBDatabaseError(idbDatabaseError)); } void IDBTransactionCallbacksProxy::onComplete() diff --git a/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.h b/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.h index 044eecf71..119c8ca75 100644 --- a/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.h +++ b/Source/WebKit/chromium/src/IDBTransactionCallbacksProxy.h @@ -44,7 +44,7 @@ public: static PassRefPtr<IDBTransactionCallbacksProxy> create(PassOwnPtr<WebIDBTransactionCallbacks>); virtual ~IDBTransactionCallbacksProxy(); - virtual void onAbort(); + virtual void onAbort(PassRefPtr<WebCore::IDBDatabaseError>); virtual void onComplete(); private: diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.cpp b/Source/WebKit/chromium/src/InspectorClientImpl.cpp index 6948982c8..402b8695c 100644 --- a/Source/WebKit/chromium/src/InspectorClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorClientImpl.cpp @@ -37,12 +37,12 @@ #include "NotImplemented.h" #include "Page.h" #include "WebDevToolsAgentImpl.h" -#include "platform/WebRect.h" -#include "platform/WebURL.h" -#include "platform/WebURLRequest.h" #include "WebViewClient.h" #include "WebViewImpl.h" #include <public/Platform.h> +#include <public/WebRect.h> +#include <public/WebURL.h> +#include <public/WebURLRequest.h> #include <wtf/Vector.h> using namespace WebCore; @@ -163,6 +163,12 @@ bool InspectorClientImpl::supportsFrameInstrumentation() return true; } +void InspectorClientImpl::getAllocatedObjects(HashSet<const void*>& set) +{ + if (WebDevToolsAgentImpl* agent = devToolsAgent()) + agent->getAllocatedObjects(set); +} + void InspectorClientImpl::willProcessTask() { InspectorInstrumentation::willProcessTask(m_inspectedWebView->page()); diff --git a/Source/WebKit/chromium/src/InspectorClientImpl.h b/Source/WebKit/chromium/src/InspectorClientImpl.h index 7abbd3bf5..9e1ea370e 100644 --- a/Source/WebKit/chromium/src/InspectorClientImpl.h +++ b/Source/WebKit/chromium/src/InspectorClientImpl.h @@ -34,7 +34,7 @@ #include "InspectorClient.h" #include "InspectorController.h" #include "InspectorFrontendChannel.h" -#include "platform/WebThread.h" +#include <public/WebThread.h> #include <wtf/OwnPtr.h> namespace WebKit { @@ -78,6 +78,8 @@ public: virtual bool supportsFrameInstrumentation(); + virtual void getAllocatedObjects(HashSet<const void*>&); + private: // WebThread::TaskObserver virtual void willProcessTask(); diff --git a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp index f2657a7bd..763c85da8 100644 --- a/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp +++ b/Source/WebKit/chromium/src/InspectorFrontendClientImpl.cpp @@ -39,8 +39,8 @@ #include "V8InspectorFrontendHost.h" #include "WebDevToolsFrontendClient.h" #include "WebDevToolsFrontendImpl.h" -#include "platform/WebFloatPoint.h" -#include "platform/WebString.h" +#include <public/WebFloatPoint.h> +#include <public/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 1e72900c4..815a0c300 100644 --- a/Source/WebKit/chromium/src/LinkHighlight.cpp +++ b/Source/WebKit/chromium/src/LinkHighlight.cpp @@ -65,6 +65,7 @@ LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) , m_owningWebViewImpl(owningWebViewImpl) , m_currentGraphicsLayer(0) , m_geometryNeedsUpdate(false) + , m_isAnimating(false) { ASSERT(m_node); ASSERT(owningWebViewImpl); @@ -73,12 +74,11 @@ LinkHighlight::LinkHighlight(Node* node, WebViewImpl* owningWebViewImpl) m_clipLayer = adoptPtr(compositorSupport->createLayer()); m_clipLayer->setAnchorPoint(WebFloatPoint()); m_clipLayer->addChild(m_contentLayer->layer()); - m_contentLayer->layer()->setDrawsContent(false); - - // We don't want to show the highlight until startAnimation is called, even though the highlight - // layer may be added to the tree immediately. - m_contentLayer->layer()->setOpacity(0); m_contentLayer->layer()->setAnimationDelegate(this); + m_contentLayer->layer()->setDrawsContent(true); + m_contentLayer->layer()->setOpacity(1); + m_geometryNeedsUpdate = true; + updateGeometry(); } LinkHighlight::~LinkHighlight() @@ -143,40 +143,84 @@ RenderLayer* LinkHighlight::computeEnclosingCompositingLayer() return renderLayer; } +static void convertTargetSpaceQuadToCompositedLayer(const FloatQuad& targetSpaceQuad, RenderObject* targetRenderer, RenderObject* compositedRenderer, FloatQuad& compositedSpaceQuad) +{ + ASSERT(targetRenderer); + ASSERT(compositedRenderer); + + for (unsigned i = 0; i < 4; ++i) { + IntPoint point; + switch (i) { + case 0: point = roundedIntPoint(targetSpaceQuad.p1()); break; + case 1: point = roundedIntPoint(targetSpaceQuad.p2()); break; + case 2: point = roundedIntPoint(targetSpaceQuad.p3()); break; + case 3: point = roundedIntPoint(targetSpaceQuad.p4()); break; + } + + point = targetRenderer->frame()->view()->contentsToWindow(point); + point = compositedRenderer->frame()->view()->windowToContents(point); + FloatPoint floatPoint = compositedRenderer->absoluteToLocal(point, UseTransforms | SnapOffsetForTransforms); + + switch (i) { + case 0: compositedSpaceQuad.setP1(floatPoint); break; + case 1: compositedSpaceQuad.setP2(floatPoint); break; + case 2: compositedSpaceQuad.setP3(floatPoint); break; + case 3: compositedSpaceQuad.setP4(floatPoint); break; + } + } +} + +static void addQuadToPath(const FloatQuad& quad, Path& path) +{ + // FIXME: Make this create rounded quad-paths, just like the axis-aligned case. + path.moveTo(quad.p1()); + path.addLineTo(quad.p2()); + path.addLineTo(quad.p3()); + path.addLineTo(quad.p4()); + path.closeSubpath(); +} + bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositingLayer) { if (!m_node || !m_node->renderer()) return false; - bool pathHasChanged = false; - 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. - if (boundingRect.size() != m_path.boundingRect().size()) { - FloatSize rectRoundingRadii(3, 3); - m_path.clear(); - m_path.addRoundedRect(boundingRect, rectRoundingRadii); - // Always treat the path as being at the origin of this layer. - m_path.translate(FloatPoint() - boundingRect.location()); - pathHasChanged = true; + ASSERT(compositingLayer); + + // Get quads for node in absolute coordinates. + Vector<FloatQuad> quads; + m_node->renderer()->absoluteQuads(quads); + ASSERT(quads.size()); + + Path newPath; + for (unsigned quadIndex = 0; quadIndex < quads.size(); ++quadIndex) { + + FloatQuad transformedQuad; + + // Transform node quads in target absolute coords to local coordinates in the compositor layer. + convertTargetSpaceQuadToCompositedLayer(quads[quadIndex], m_node->renderer(), compositingLayer->renderer(), transformedQuad); + + // FIXME: for now, we'll only use rounded paths if we have a single node quad. The reason for this is that + // we may sometimes get a chain of adjacent boxes (e.g. for text nodes) which end up looking like sausage + // links: these should ideally be merged into a single rect before creating the path, but that's + // another CL. + if (quads.size() == 1 && transformedQuad.isRectilinear()) { + FloatSize rectRoundingRadii(3, 3); + newPath.addRoundedRect(transformedQuad.boundingBox(), rectRoundingRadii); + } else + addQuadToPath(transformedQuad, newPath); } - FloatRect nodeBounds = boundingRect; + FloatRect boundingRect = newPath.boundingRect(); + newPath.translate(FloatPoint() - boundingRect.location()); - // This is a simplified, but basically correct, transformation of the target location, converted - // from its containing frame view to window coordinates and then back to the containing frame view - // of the composited layer. - // FIXME: We also need to transform the target's size in case of scaling. This can be done by also transforming - // the full rects in the xToY calls, and transforming both the upper-left and lower right corners - // to local coordinates at the end.. - ASSERT(compositingLayer); - IntPoint targetWindow = m_node->renderer()->frame()->view()->contentsToWindow(enclosingIntRect(nodeBounds).location()); - IntPoint targetCompositorAbsolute = compositingLayer->renderer()->frame()->view()->windowToContents(targetWindow); - FloatPoint targetCompositorLocal = compositingLayer->renderer()->absoluteToLocal(targetCompositorAbsolute, false, true); + bool pathHasChanged = !m_path.platformPath() || !(*newPath.platformPath() == *m_path.platformPath()); + if (pathHasChanged) { + m_path = newPath; + m_contentLayer->layer()->setBounds(enclosingIntRect(boundingRect).size()); + } - m_contentLayer->layer()->setBounds(WebSize(enclosingIntRect(nodeBounds).size())); - m_contentLayer->layer()->setPosition(WebFloatPoint(targetCompositorLocal)); + m_contentLayer->layer()->setPosition(boundingRect.location()); return pathHasChanged; } @@ -194,8 +238,12 @@ void LinkHighlight::paintContents(WebCanvas* canvas, const WebRect& webClipRect, gc.fillPath(m_path); } -void LinkHighlight::startHighlightAnimation() +void LinkHighlight::startHighlightAnimationIfNeeded() { + if (m_isAnimating) + return; + + m_isAnimating = true; const float startOpacity = 1; // FIXME: Should duration be configurable? const float duration = 0.1f; diff --git a/Source/WebKit/chromium/src/LinkHighlight.h b/Source/WebKit/chromium/src/LinkHighlight.h index 4eb6f5967..3bac3c729 100644 --- a/Source/WebKit/chromium/src/LinkHighlight.h +++ b/Source/WebKit/chromium/src/LinkHighlight.h @@ -54,7 +54,7 @@ public: WebContentLayer* contentLayer(); WebLayer* clipLayer(); - void startHighlightAnimation(); + void startHighlightAnimationIfNeeded(); void updateGeometry(); // WebContentLayerClient implementation. @@ -90,6 +90,7 @@ private: WebCore::GraphicsLayerChromium* m_currentGraphicsLayer; bool m_geometryNeedsUpdate; + bool m_isAnimating; WebCore::FloatPoint m_graphicsLayerOffset; }; diff --git a/Source/WebKit/chromium/src/LocalizedStrings.cpp b/Source/WebKit/chromium/src/LocalizedStrings.cpp index 40a009369..0cc8e00eb 100644 --- a/Source/WebKit/chromium/src/LocalizedStrings.cpp +++ b/Source/WebKit/chromium/src/LocalizedStrings.cpp @@ -202,7 +202,7 @@ String AXMenuListActionVerb() return String(); } -#if ENABLE(INPUT_TYPE_TIME_MULTIPLE_FIELDS) +#if ENABLE(INPUT_MULTIPLE_FIELDS_UI) String AXAMPMFieldText() { return query(WebLocalizedString::AXAMPMFieldText); @@ -252,6 +252,32 @@ String AXYearFieldText() { return query(WebLocalizedString::AXYearFieldText); } + +String placeholderForDayOfMonthField() +{ + return query(WebLocalizedString::PlaceholderForDayOfMonthField); +} + +String placeholderForMonthField() +{ + return query(WebLocalizedString::PlaceholderForMonthField); +} + +String placeholderForYearField() +{ + return query(WebLocalizedString::PlaceholderForYearField); +} + +String monthFormatInLDML() +{ + return query(WebLocalizedString::MonthFormatInLDML); +} + +String weekFormatInLDML() +{ + return query(WebLocalizedString::WeekFormatInLDML); +} + #endif String missingPluginText() diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp index 9729d05ec..21b9725b0 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.cpp +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.cpp @@ -32,6 +32,7 @@ #include "GraphicsLayer.h" #include "GraphicsLayerChromium.h" #include "PlatformContextSkia.h" +#include "Settings.h" #include "WebViewImpl.h" #include <public/WebContentLayer.h> #include <public/WebFloatPoint.h> @@ -43,12 +44,12 @@ NonCompositedContentHost::NonCompositedContentHost(WebViewImpl* webView) , m_opaque(true) , m_showDebugBorders(false) { - m_graphicsLayer = WebCore::GraphicsLayer::create(this); + m_graphicsLayer = WebCore::GraphicsLayer::create(0, this); #ifndef NDEBUG m_graphicsLayer->setName("non-composited content"); #endif m_graphicsLayer->setDrawsContent(true); - m_graphicsLayer->setAppliesPageScale(true); + m_graphicsLayer->setAppliesPageScale(!m_webView->page()->settings()->applyPageScaleFactorInCompositor()); WebContentLayer* layer = static_cast<WebCore::GraphicsLayerChromium*>(m_graphicsLayer.get())->contentLayer(); layer->setUseLCDText(true); layer->layer()->setOpaque(true); @@ -165,7 +166,7 @@ void NonCompositedContentHost::notifyAnimationStarted(const WebCore::GraphicsLay // Intentionally left empty since we don't support animations on the non-composited content. } -void NonCompositedContentHost::notifySyncRequired(const WebCore::GraphicsLayer*) +void NonCompositedContentHost::notifyFlushRequired(const WebCore::GraphicsLayer*) { m_webView->scheduleCompositingLayerSync(); } diff --git a/Source/WebKit/chromium/src/NonCompositedContentHost.h b/Source/WebKit/chromium/src/NonCompositedContentHost.h index 69776d90f..08e9c69b2 100644 --- a/Source/WebKit/chromium/src/NonCompositedContentHost.h +++ b/Source/WebKit/chromium/src/NonCompositedContentHost.h @@ -69,7 +69,7 @@ protected: private: // GraphicsLayerClient virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time); - virtual void notifySyncRequired(const WebCore::GraphicsLayer*); + virtual void notifyFlushRequired(const WebCore::GraphicsLayer*); 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; diff --git a/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp b/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp index 683e66faa..d6df72efb 100644 --- a/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp +++ b/Source/WebKit/chromium/src/NotificationPresenterImpl.cpp @@ -41,7 +41,7 @@ #include "WebNotification.h" #include "WebNotificationPermissionCallback.h" #include "WebNotificationPresenter.h" -#include "platform/WebURL.h" +#include <public/WebURL.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/PageOverlay.cpp b/Source/WebKit/chromium/src/PageOverlay.cpp index b5d157a4b..a16a01077 100644 --- a/Source/WebKit/chromium/src/PageOverlay.cpp +++ b/Source/WebKit/chromium/src/PageOverlay.cpp @@ -75,7 +75,7 @@ public: virtual void notifyAnimationStarted(const GraphicsLayer*, double time) { } - virtual void notifySyncRequired(const GraphicsLayer*) { } + virtual void notifyFlushRequired(const GraphicsLayer*) { } virtual void paintContents(const GraphicsLayer*, GraphicsContext& gc, GraphicsLayerPaintingPhase, const IntRect& inClip) { diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp index 6ad25d953..071c22a3d 100644 --- a/Source/WebKit/chromium/src/PageWidgetDelegate.cpp +++ b/Source/WebKit/chromium/src/PageWidgetDelegate.cpp @@ -59,8 +59,7 @@ void PageWidgetDelegate::animate(Page* page, double monotonicFrameBeginTime) FrameView* view = mainFrameView(page); if (!view) return; - double timeShift = currentTime() - monotonicallyIncreasingTime(); - view->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(monotonicFrameBeginTime + timeShift)); + view->serviceScriptedAnimations(monotonicFrameBeginTime); #endif } @@ -90,6 +89,7 @@ void PageWidgetDelegate::paint(Page* page, PageOverlayList* overlays, WebCanvas* GraphicsContext& gc = builder.context(); gc.platformContext()->setDrawingToImageBuffer(background == Opaque ? false : true); gc.applyDeviceScaleFactor(page->deviceScaleFactor()); + gc.platformContext()->setDeviceScaleFactor(page->deviceScaleFactor()); IntRect dirtyRect(rect); gc.save(); FrameView* view = mainFrameView(page); diff --git a/Source/WebKit/chromium/src/PageWidgetDelegate.h b/Source/WebKit/chromium/src/PageWidgetDelegate.h index 807e1987b..c9f76bb95 100644 --- a/Source/WebKit/chromium/src/PageWidgetDelegate.h +++ b/Source/WebKit/chromium/src/PageWidgetDelegate.h @@ -33,7 +33,7 @@ #include "Page.h" #include "WebWidget.h" -#include "platform/WebCanvas.h" +#include <public/WebCanvas.h> #include <wtf/OwnPtr.h> namespace WebCore { diff --git a/Source/WebKit/chromium/src/PlatformSupport.cpp b/Source/WebKit/chromium/src/PlatformSupport.cpp index 7cd6453f6..9eb8b68e1 100644 --- a/Source/WebKit/chromium/src/PlatformSupport.cpp +++ b/Source/WebKit/chromium/src/PlatformSupport.cpp @@ -55,7 +55,6 @@ #include "platform/WebSerializedScriptValue.h" #include "platform/WebString.h" #include "platform/WebURL.h" -#include "platform/WebVector.h" #if OS(WINDOWS) #include "platform/WebRect.h" @@ -93,6 +92,7 @@ #include <public/WebCookie.h> #include <public/WebCookieJar.h> #include <public/WebMimeRegistry.h> +#include <public/WebVector.h> #include <wtf/Assertions.h> // We are part of the WebKit implementation. @@ -324,137 +324,6 @@ void PlatformSupport::paintProgressBar( gc->platformContext()->canvas(), barRect, valueRect, determinate, animatedSeconds); } -#elif OS(DARWIN) - -void PlatformSupport::paintScrollbarThumb( - GraphicsContext* gc, ThemePaintState state, ThemePaintSize size, const IntRect& rect, const ThemePaintScrollbarInfo& scrollbarInfo) -{ - WebThemeEngine::ScrollbarInfo webThemeScrollbarInfo; - - webThemeScrollbarInfo.orientation = static_cast<WebThemeEngine::ScrollbarOrientation>(scrollbarInfo.orientation); - webThemeScrollbarInfo.parent = static_cast<WebThemeEngine::ScrollbarParent>(scrollbarInfo.parent); - webThemeScrollbarInfo.maxValue = scrollbarInfo.maxValue; - webThemeScrollbarInfo.currentValue = scrollbarInfo.currentValue; - webThemeScrollbarInfo.visibleSize = scrollbarInfo.visibleSize; - webThemeScrollbarInfo.totalSize = scrollbarInfo.totalSize; - - WebKit::WebCanvas* webCanvas = gc->platformContext()->canvas(); - WebKit::Platform::current()->themeEngine()->paintScrollbarThumb( - webCanvas, - static_cast<WebThemeEngine::State>(state), - static_cast<WebThemeEngine::Size>(size), - rect, - webThemeScrollbarInfo); -} - -#elif OS(UNIX) - -static WebThemeEngine::Part WebThemePart(PlatformSupport::ThemePart part) -{ - switch (part) { - case PlatformSupport::PartScrollbarDownArrow: return WebThemeEngine::PartScrollbarDownArrow; - case PlatformSupport::PartScrollbarLeftArrow: return WebThemeEngine::PartScrollbarLeftArrow; - case PlatformSupport::PartScrollbarRightArrow: return WebThemeEngine::PartScrollbarRightArrow; - case PlatformSupport::PartScrollbarUpArrow: return WebThemeEngine::PartScrollbarUpArrow; - case PlatformSupport::PartScrollbarHorizontalThumb: return WebThemeEngine::PartScrollbarHorizontalThumb; - case PlatformSupport::PartScrollbarVerticalThumb: return WebThemeEngine::PartScrollbarVerticalThumb; - case PlatformSupport::PartScrollbarHorizontalTrack: return WebThemeEngine::PartScrollbarHorizontalTrack; - case PlatformSupport::PartScrollbarVerticalTrack: return WebThemeEngine::PartScrollbarVerticalTrack; - case PlatformSupport::PartCheckbox: return WebThemeEngine::PartCheckbox; - case PlatformSupport::PartRadio: return WebThemeEngine::PartRadio; - case PlatformSupport::PartButton: return WebThemeEngine::PartButton; - case PlatformSupport::PartTextField: return WebThemeEngine::PartTextField; - case PlatformSupport::PartMenuList: return WebThemeEngine::PartMenuList; - case PlatformSupport::PartSliderTrack: return WebThemeEngine::PartSliderTrack; - case PlatformSupport::PartSliderThumb: return WebThemeEngine::PartSliderThumb; - case PlatformSupport::PartInnerSpinButton: return WebThemeEngine::PartInnerSpinButton; - case PlatformSupport::PartProgressBar: return WebThemeEngine::PartProgressBar; - } - ASSERT_NOT_REACHED(); - return WebThemeEngine::PartScrollbarDownArrow; -} - -static WebThemeEngine::State WebThemeState(PlatformSupport::ThemePaintState state) -{ - switch (state) { - case PlatformSupport::StateDisabled: return WebThemeEngine::StateDisabled; - case PlatformSupport::StateHover: return WebThemeEngine::StateHover; - case PlatformSupport::StateNormal: return WebThemeEngine::StateNormal; - case PlatformSupport::StatePressed: return WebThemeEngine::StatePressed; - } - ASSERT_NOT_REACHED(); - return WebThemeEngine::StateDisabled; -} - -static void GetWebThemeExtraParams(PlatformSupport::ThemePart part, PlatformSupport::ThemePaintState state, const PlatformSupport::ThemePaintExtraParams* extraParams, WebThemeEngine::ExtraParams* webThemeExtraParams) -{ - switch (part) { - case PlatformSupport::PartScrollbarHorizontalTrack: - case PlatformSupport::PartScrollbarVerticalTrack: - webThemeExtraParams->scrollbarTrack.trackX = extraParams->scrollbarTrack.trackX; - webThemeExtraParams->scrollbarTrack.trackY = extraParams->scrollbarTrack.trackY; - webThemeExtraParams->scrollbarTrack.trackWidth = extraParams->scrollbarTrack.trackWidth; - webThemeExtraParams->scrollbarTrack.trackHeight = extraParams->scrollbarTrack.trackHeight; - break; - case PlatformSupport::PartCheckbox: - webThemeExtraParams->button.checked = extraParams->button.checked; - webThemeExtraParams->button.indeterminate = extraParams->button.indeterminate; - break; - case PlatformSupport::PartRadio: - webThemeExtraParams->button.checked = extraParams->button.checked; - break; - case PlatformSupport::PartButton: - webThemeExtraParams->button.isDefault = extraParams->button.isDefault; - webThemeExtraParams->button.hasBorder = extraParams->button.hasBorder; - webThemeExtraParams->button.backgroundColor = extraParams->button.backgroundColor; - break; - case PlatformSupport::PartTextField: - webThemeExtraParams->textField.isTextArea = extraParams->textField.isTextArea; - webThemeExtraParams->textField.isListbox = extraParams->textField.isListbox; - webThemeExtraParams->textField.backgroundColor = extraParams->textField.backgroundColor; - break; - case PlatformSupport::PartMenuList: - webThemeExtraParams->menuList.hasBorder = extraParams->menuList.hasBorder; - webThemeExtraParams->menuList.hasBorderRadius = extraParams->menuList.hasBorderRadius; - webThemeExtraParams->menuList.arrowX = extraParams->menuList.arrowX; - webThemeExtraParams->menuList.arrowY = extraParams->menuList.arrowY; - webThemeExtraParams->menuList.backgroundColor = extraParams->menuList.backgroundColor; - break; - case PlatformSupport::PartSliderTrack: - case PlatformSupport::PartSliderThumb: - webThemeExtraParams->slider.vertical = extraParams->slider.vertical; - webThemeExtraParams->slider.inDrag = extraParams->slider.inDrag; - break; - case PlatformSupport::PartInnerSpinButton: - webThemeExtraParams->innerSpin.spinUp = extraParams->innerSpin.spinUp; - webThemeExtraParams->innerSpin.readOnly = extraParams->innerSpin.readOnly; - break; - case PlatformSupport::PartProgressBar: - webThemeExtraParams->progressBar.determinate = extraParams->progressBar.determinate; - webThemeExtraParams->progressBar.valueRectX = extraParams->progressBar.valueRectX; - webThemeExtraParams->progressBar.valueRectY = extraParams->progressBar.valueRectY; - webThemeExtraParams->progressBar.valueRectWidth = extraParams->progressBar.valueRectWidth; - webThemeExtraParams->progressBar.valueRectHeight = extraParams->progressBar.valueRectHeight; - break; - default: - break; // Parts that have no extra params get here. - } -} - -IntSize PlatformSupport::getThemePartSize(ThemePart part) -{ - return WebKit::Platform::current()->themeEngine()->getSize(WebThemePart(part)); -} - -void PlatformSupport::paintThemePart( - GraphicsContext* gc, ThemePart part, ThemePaintState state, const IntRect& rect, const ThemePaintExtraParams* extraParams) -{ - WebThemeEngine::ExtraParams webThemeExtraParams; - GetWebThemeExtraParams(part, state, extraParams, &webThemeExtraParams); - WebKit::Platform::current()->themeEngine()->paint( - gc->platformContext()->canvas(), WebThemePart(part), WebThemeState(state), rect, &webThemeExtraParams); -} - #endif // These are temporary methods that the WebKit layer can use to call to the diff --git a/Source/WebKit/chromium/src/SocketStreamHandle.cpp b/Source/WebKit/chromium/src/SocketStreamHandle.cpp index 5eed90011..3f98a77db 100644 --- a/Source/WebKit/chromium/src/SocketStreamHandle.cpp +++ b/Source/WebKit/chromium/src/SocketStreamHandle.cpp @@ -37,10 +37,9 @@ #include "Logging.h" #include "NotImplemented.h" #include "SocketStreamHandleClient.h" -#include "platform/WebData.h" -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" -#include "platform/WebSocketStreamHandle.h" +#include <public/Platform.h> +#include <public/WebData.h> +#include <public/WebSocketStreamHandle.h> #include <wtf/PassOwnPtr.h> using namespace WebKit; @@ -73,7 +72,13 @@ void SocketStreamHandleInternal::connect(const KURL& url) int SocketStreamHandleInternal::send(const char* data, int len) { LOG(Network, "send len=%d", len); - ASSERT(m_socket); + // FIXME: |m_socket| should not be null here, but it seems that there is the + // case. We should figure out such a path and fix it rather than checking + // null here. + if (!m_socket) { + LOG(Network, "m_socket is null when sending. It should not be."); + return 0; + } if (m_pendingAmountSent + len >= m_maxPendingSendAllowed) len = m_maxPendingSendAllowed - m_pendingAmountSent - 1; diff --git a/Source/WebKit/chromium/src/SocketStreamHandleInternal.h b/Source/WebKit/chromium/src/SocketStreamHandleInternal.h index 857b279e7..04122d8f1 100644 --- a/Source/WebKit/chromium/src/SocketStreamHandleInternal.h +++ b/Source/WebKit/chromium/src/SocketStreamHandleInternal.h @@ -34,8 +34,8 @@ #if ENABLE(WEB_SOCKETS) #include "SocketStreamHandle.h" -#include "platform/WebSocketStreamHandleClient.h" -#include "platform/WebURL.h" +#include <public/WebSocketStreamHandleClient.h> +#include <public/WebURL.h> #include <wtf/PassOwnPtr.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp index 09176ee98..4f09f5f3b 100644 --- a/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp +++ b/Source/WebKit/chromium/src/SpeechInputClientImpl.cpp @@ -35,8 +35,8 @@ #include "SpeechInputListener.h" #include "WebSecurityOrigin.h" #include "WebSpeechInputController.h" -#include "platform/WebString.h" #include "WebViewClient.h" +#include <public/WebString.h> #include <wtf/PassOwnPtr.h> #include <wtf/text/WTFString.h> diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp index aa9b189a7..082747cdb 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.cpp @@ -55,13 +55,13 @@ PassOwnPtr<SpeechRecognitionClientProxy> SpeechRecognitionClientProxy::create(We return adoptPtr(new SpeechRecognitionClientProxy(recognizer)); } -void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous, unsigned long maxAlternatives) +void SpeechRecognitionClientProxy::start(SpeechRecognition* recognition, const SpeechGrammarList* grammarList, const String& lang, bool continuous, bool interimResults, unsigned long maxAlternatives) { WebVector<WebSpeechGrammar> webSpeechGrammars(static_cast<size_t>(grammarList->length())); for (unsigned long i = 0; i < grammarList->length(); ++i) webSpeechGrammars[i] = grammarList->item(i); - WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, maxAlternatives, WebSecurityOrigin(recognition->scriptExecutionContext()->securityOrigin())); + WebSpeechRecognitionParams params(webSpeechGrammars, lang, continuous, interimResults, maxAlternatives, WebSecurityOrigin(recognition->scriptExecutionContext()->securityOrigin())); m_recognizer->start(WebSpeechRecognitionHandle(recognition), params, this); } @@ -119,17 +119,6 @@ void SpeechRecognitionClientProxy::didReceiveNoMatch(const WebSpeechRecognitionH recognition->didReceiveNoMatch(result); } -void SpeechRecognitionClientProxy::didDeleteResult(const WebSpeechRecognitionHandle& handle, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) -{ - RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); - - Vector<RefPtr<SpeechRecognitionResult> > resultHistoryVector(resultHistory.size()); - for (size_t i = 0; i < resultHistory.size(); ++i) - resultHistoryVector[i] = static_cast<PassRefPtr<SpeechRecognitionResult> >(resultHistory[i]); - - recognition->didDeleteResult(resultIndex, SpeechRecognitionResultList::create(resultHistoryVector)); -} - void SpeechRecognitionClientProxy::didReceiveError(const WebSpeechRecognitionHandle& handle, const WebString& message, WebSpeechRecognizerClient::ErrorCode code) { RefPtr<SpeechRecognition> recognition = PassRefPtr<SpeechRecognition>(handle); diff --git a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h index 312e88b13..6194f6600 100644 --- a/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h +++ b/Source/WebKit/chromium/src/SpeechRecognitionClientProxy.h @@ -46,7 +46,7 @@ public: static PassOwnPtr<SpeechRecognitionClientProxy> create(WebSpeechRecognizer*); // WebCore::SpeechRecognitionClient: - virtual void start(WebCore::SpeechRecognition*, const WebCore::SpeechGrammarList*, const String& lang, bool continuous, unsigned long maxAlternatives) OVERRIDE; + virtual void start(WebCore::SpeechRecognition*, const WebCore::SpeechGrammarList*, const String& lang, bool continuous, bool interimResults, unsigned long maxAlternatives) OVERRIDE; virtual void stop(WebCore::SpeechRecognition*) OVERRIDE; virtual void abort(WebCore::SpeechRecognition*) OVERRIDE; @@ -57,7 +57,6 @@ public: virtual void didEndAudio(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didReceiveResult(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&, unsigned long resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE; virtual void didReceiveNoMatch(const WebSpeechRecognitionHandle&, const WebSpeechRecognitionResult&) OVERRIDE; - virtual void didDeleteResult(const WebSpeechRecognitionHandle&, unsigned resultIndex, const WebVector<WebSpeechRecognitionResult>& resultHistory) OVERRIDE; virtual void didReceiveError(const WebSpeechRecognitionHandle&, const WebString& message, WebSpeechRecognizerClient::ErrorCode) OVERRIDE; virtual void didStart(const WebSpeechRecognitionHandle&) OVERRIDE; virtual void didEnd(const WebSpeechRecognitionHandle&) OVERRIDE; diff --git a/Source/WebKit/chromium/src/StorageAreaProxy.cpp b/Source/WebKit/chromium/src/StorageAreaProxy.cpp index efa0c9098..2e33d08fb 100644 --- a/Source/WebKit/chromium/src/StorageAreaProxy.cpp +++ b/Source/WebKit/chromium/src/StorageAreaProxy.cpp @@ -43,9 +43,9 @@ #include "WebFrameImpl.h" #include "WebPermissionClient.h" #include "WebStorageArea.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" #include "WebViewImpl.h" +#include <public/WebString.h> +#include <public/WebURL.h> namespace WebCore { diff --git a/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp b/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp index 6c6845497..9594eb230 100644 --- a/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp +++ b/Source/WebKit/chromium/src/StorageNamespaceProxy.cpp @@ -32,11 +32,11 @@ #include "SecurityOrigin.h" #include "StorageAreaProxy.h" #include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" #include "WebStorageNamespace.h" -#include "platform/WebString.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include "platform/WebKitPlatformSupport.h" +#include <public/WebString.h> namespace WebCore { diff --git a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp index a74aa825a..44bac4038 100644 --- a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp +++ b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.cpp @@ -103,7 +103,7 @@ CachedImage* TextFieldDecoratorImpl::imageForReadonlyState() if (!m_cachedImageForReadonlyState) { WebCString imageName = m_client->imageNameForReadOnlyState(); if (imageName.isEmpty()) - m_cachedImageForDisabledState = imageForDisabledState(); + m_cachedImageForReadonlyState = imageForDisabledState(); else { RefPtr<Image> image = Image::loadPlatformResource(imageName.data()); m_cachedImageForReadonlyState = new CachedImage(image.get()); @@ -112,6 +112,20 @@ CachedImage* TextFieldDecoratorImpl::imageForReadonlyState() return m_cachedImageForReadonlyState.get(); } +CachedImage* TextFieldDecoratorImpl::imageForHoverState() +{ + if (!m_cachedImageForHoverState) { + WebCString imageName = m_client->imageNameForHoverState(); + if (imageName.isEmpty()) + m_cachedImageForHoverState = imageForNormalState(); + else { + RefPtr<Image> image = Image::loadPlatformResource(imageName.data()); + m_cachedImageForHoverState = new CachedImage(image.get()); + } + } + return m_cachedImageForHoverState.get(); +} + void TextFieldDecoratorImpl::handleClick(HTMLInputElement* input) { ASSERT(input); diff --git a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h index 8f52069ba..92ab0dfb3 100644 --- a/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h +++ b/Source/WebKit/chromium/src/TextFieldDecoratorImpl.h @@ -51,6 +51,7 @@ private: virtual WebCore::CachedImage* imageForNormalState() OVERRIDE; virtual WebCore::CachedImage* imageForDisabledState() OVERRIDE; virtual WebCore::CachedImage* imageForReadonlyState() OVERRIDE; + virtual WebCore::CachedImage* imageForHoverState() OVERRIDE; virtual void handleClick(WebCore::HTMLInputElement*) OVERRIDE; virtual void willDetach(WebCore::HTMLInputElement*) OVERRIDE; @@ -60,6 +61,7 @@ private: WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForNormalState; WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForDisabledState; WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForReadonlyState; + WebCore::CachedResourceHandle<WebCore::CachedImage> m_cachedImageForHoverState; }; } diff --git a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp index ca8a98dcb..cf4704cb8 100644 --- a/Source/WebKit/chromium/src/UserMediaClientImpl.cpp +++ b/Source/WebKit/chromium/src/UserMediaClientImpl.cpp @@ -37,7 +37,7 @@ #include "WebUserMediaRequest.h" #include "WebViewClient.h" #include "WebViewImpl.h" -#include "platform/WebMediaStreamSource.h" +#include <public/WebMediaStreamSource.h> #include <wtf/RefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp index a3dd824cc..ebc1dbbbe 100644 --- a/Source/WebKit/chromium/src/WebAccessibilityObject.cpp +++ b/Source/WebKit/chromium/src/WebAccessibilityObject.cpp @@ -46,10 +46,10 @@ #include "UserGestureIndicator.h" #include "WebDocument.h" #include "WebNode.h" -#include "platform/WebPoint.h" -#include "platform/WebRect.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebPoint.h> +#include <public/WebRect.h> +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/text/StringBuilder.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebAnimationControllerImpl.cpp b/Source/WebKit/chromium/src/WebAnimationControllerImpl.cpp index 8af40102e..830d3beda 100644 --- a/Source/WebKit/chromium/src/WebAnimationControllerImpl.cpp +++ b/Source/WebKit/chromium/src/WebAnimationControllerImpl.cpp @@ -36,7 +36,7 @@ #include "WebElement.h" #include "WebFrameImpl.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebCommon.cpp b/Source/WebKit/chromium/src/WebCommon.cpp index cd9795ae3..5e039594e 100644 --- a/Source/WebKit/chromium/src/WebCommon.cpp +++ b/Source/WebKit/chromium/src/WebCommon.cpp @@ -29,7 +29,7 @@ */ #include "config.h" -#include "platform/WebCommon.h" +#include <public/WebCommon.h> #include <wtf/Assertions.h> diff --git a/Source/WebKit/chromium/src/WebDOMEventListenerPrivate.h b/Source/WebKit/chromium/src/WebDOMEventListenerPrivate.h index 8632ec4f2..5cba416d2 100644 --- a/Source/WebKit/chromium/src/WebDOMEventListenerPrivate.h +++ b/Source/WebKit/chromium/src/WebDOMEventListenerPrivate.h @@ -31,8 +31,7 @@ #ifndef WebDOMEventListenerPrivate_h #define WebDOMEventListenerPrivate_h -#include "platform/WebString.h" - +#include <public/WebString.h> #include <wtf/Vector.h> namespace WebCore { diff --git a/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp b/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp index 383c7de21..ad47a0ed1 100644 --- a/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp +++ b/Source/WebKit/chromium/src/WebDOMMessageEvent.cpp @@ -40,7 +40,7 @@ #include "WebFrame.h" #include "WebFrameImpl.h" #include "platform/WebSerializedScriptValue.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDOMStringList.cpp b/Source/WebKit/chromium/src/WebDOMStringList.cpp index dd106461e..5f5a81556 100644 --- a/Source/WebKit/chromium/src/WebDOMStringList.cpp +++ b/Source/WebKit/chromium/src/WebDOMStringList.cpp @@ -32,7 +32,7 @@ #include "WebDOMStringList.h" #include "DOMStringList.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDataSourceImpl.cpp b/Source/WebKit/chromium/src/WebDataSourceImpl.cpp index 501fd447c..cc94b62ec 100644 --- a/Source/WebKit/chromium/src/WebDataSourceImpl.cpp +++ b/Source/WebKit/chromium/src/WebDataSourceImpl.cpp @@ -32,9 +32,9 @@ #include "WebDataSourceImpl.h" #include "ApplicationCacheHostInternal.h" -#include "platform/WebURL.h" -#include "platform/WebURLError.h" -#include "platform/WebVector.h" +#include <public/WebURL.h> +#include <public/WebURLError.h> +#include <public/WebVector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDatabase.cpp b/Source/WebKit/chromium/src/WebDatabase.cpp index d8eb64da4..04d4a4079 100644 --- a/Source/WebKit/chromium/src/WebDatabase.cpp +++ b/Source/WebKit/chromium/src/WebDatabase.cpp @@ -36,7 +36,7 @@ #include "QuotaTracker.h" #include "SecurityOrigin.h" #include "WebDatabaseObserver.h" -#include "platform/WebString.h" +#include <public/WebString.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp index a0a75b48c..7f362036b 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp @@ -54,14 +54,14 @@ #include "WebDataSource.h" #include "WebDevToolsAgentClient.h" #include "WebFrameImpl.h" -#include "platform/WebRect.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "platform/WebURLError.h" -#include "platform/WebURLRequest.h" -#include "platform/WebURLResponse.h" #include "WebViewClient.h" #include "WebViewImpl.h" +#include <public/WebRect.h> +#include <public/WebString.h> +#include <public/WebURL.h> +#include <public/WebURLError.h> +#include <public/WebURLRequest.h> +#include <public/WebURLResponse.h> #include <wtf/CurrentTime.h> #include <wtf/MathExtras.h> #include <wtf/Noncopyable.h> @@ -72,8 +72,6 @@ using namespace WebCore; using namespace std; namespace OverlayZOrders { -static const int viewportGutter = 97; - // Use 99 as a big z-order number so that highlight is above other overlays. static const int highlight = 99; } @@ -183,20 +181,18 @@ private: OwnPtr<WebDevToolsAgent::MessageDescriptor> m_descriptor; }; -class DeviceMetricsSupport : public WebPageOverlay { +class DeviceMetricsSupport { public: DeviceMetricsSupport(WebViewImpl* webView) : m_webView(webView) , m_fitWindow(false) , m_originalZoomFactor(0) { - m_webView->addPageOverlay(this, OverlayZOrders::viewportGutter); } ~DeviceMetricsSupport() { restore(); - m_webView->removePageOverlay(this); } void setDeviceMetrics(int width, int height, float textZoomFactor, bool fitWindow) @@ -285,7 +281,7 @@ private: view->setHorizontalScrollbarLock(false); view->setVerticalScrollbarLock(false); view->setScrollbarModes(ScrollbarAuto, ScrollbarAuto, false, false); - view->resize(IntSize(m_webView->size())); + view->setFrameRect(IntRect(IntPoint(), IntSize(m_webView->size()))); m_webView->sendResizeEventAndRepaint(); } @@ -341,19 +337,6 @@ private: doc->updateLayout(); } - virtual void paintPageOverlay(WebCanvas* canvas) - { - FrameView* frameView = this->frameView(); - if (!frameView) - return; - - GraphicsContextBuilder builder(canvas); - GraphicsContext& gc = builder.context(); - gc.clipOut(IntRect(IntPoint(), frameView->size())); - gc.setFillColor(Color::darkGray, ColorSpaceDeviceRGB); - gc.drawRect(IntRect(IntPoint(), m_webView->size())); - } - WebCore::FrameView* frameView() { return m_webView->mainFrameImpl() ? m_webView->mainFrameImpl()->frameView() : 0; @@ -389,6 +372,7 @@ void WebDevToolsAgentImpl::attach() ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); inspectorController()->connectFrontend(this); + inspectorController()->webViewResized(m_webViewImpl->size()); m_attached = true; } @@ -437,10 +421,12 @@ bool WebDevToolsAgentImpl::metricsOverridden() return !!m_metricsSupport; } -void WebDevToolsAgentImpl::webViewResized() +void WebDevToolsAgentImpl::webViewResized(const WebSize& size) { if (m_metricsSupport) m_metricsSupport->webViewResized(); + if (InspectorController* ic = inspectorController()) + ic->webViewResized(m_metricsSupport ? IntSize(size.width, size.height) : IntSize()); } void WebDevToolsAgentImpl::overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow) @@ -448,12 +434,19 @@ void WebDevToolsAgentImpl::overrideDeviceMetrics(int width, int height, float fo if (!width && !height) { if (m_metricsSupport) m_metricsSupport.clear(); + if (InspectorController* ic = inspectorController()) + ic->webViewResized(IntSize()); return; } if (!m_metricsSupport) m_metricsSupport = adoptPtr(new DeviceMetricsSupport(m_webViewImpl)); + m_metricsSupport->setDeviceMetrics(width, height, fontScaleFactor, fitWindow); + if (InspectorController* ic = inspectorController()) { + WebSize size = m_webViewImpl->size(); + ic->webViewResized(IntSize(size.width, size.height)); + } } void WebDevToolsAgentImpl::autoZoomPageToFitWidth() @@ -462,6 +455,82 @@ void WebDevToolsAgentImpl::autoZoomPageToFitWidth() m_metricsSupport->autoZoomPageToFitWidthOnNavigation(m_webViewImpl->mainFrameImpl()->frame()); } +void WebDevToolsAgentImpl::getAllocatedObjects(HashSet<const void*>& set) +{ + class CountingVisitor : public WebDevToolsAgentClient::AllocatedObjectVisitor { + public: + CountingVisitor() : m_totalObjectsCount(0) + { + } + virtual bool visitObject(const void* ptr) + { + ++m_totalObjectsCount; + return true; + } + size_t totalObjectsCount() + { + return m_totalObjectsCount; + } + + private: + size_t m_totalObjectsCount; + }; + + CountingVisitor counter; + m_client->visitAllocatedObjects(&counter); + + class PointerCollector : public WebDevToolsAgentClient::AllocatedObjectVisitor { + public: + explicit PointerCollector(size_t maxObjectsCount) + : m_maxObjectsCount(maxObjectsCount) + , m_index(0) + , m_success(true) + , m_pointers(new const void*[maxObjectsCount]) + { + } + ~PointerCollector() + { + delete[] m_pointers; + } + virtual bool visitObject(const void* ptr) + { + if (m_index == m_maxObjectsCount) { + m_success = false; + return false; + } + m_pointers[m_index++] = ptr; + return true; + } + + bool success() const { return m_success; } + + void copyTo(HashSet<const void*>& set) + { + for (size_t i = 0; i < m_index; i++) + set.add(m_pointers[i]); + } + + private: + const size_t m_maxObjectsCount; + size_t m_index; + bool m_success; + const void** m_pointers; + }; + + // Double size to allow room for all objects that may have been allocated + // since we counted them. + size_t estimatedMaxObjectsCount = counter.totalObjectsCount() * 2; + while (true) { + PointerCollector collector(estimatedMaxObjectsCount); + m_client->visitAllocatedObjects(&collector); + if (collector.success()) { + collector.copyTo(set); + break; + } + estimatedMaxObjectsCount *= 2; + } +} + void WebDevToolsAgentImpl::dispatchOnInspectorBackend(const WebString& message) { inspectorController()->dispatchMessageFromFrontend(message); diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h index f1af576cb..6a9663127 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h +++ b/Source/WebKit/chromium/src/WebDevToolsAgentImpl.h @@ -36,8 +36,7 @@ #include "WebDevToolsAgentPrivate.h" #include "WebPageOverlay.h" -#include "platform/WebSize.h" - +#include <public/WebSize.h> #include <wtf/Forward.h> #include <wtf/OwnPtr.h> @@ -76,7 +75,7 @@ public: virtual void didCreateScriptContext(WebFrameImpl*, int worldId); virtual void mainFrameViewCreated(WebFrameImpl*); virtual bool metricsOverridden(); - virtual void webViewResized(); + virtual void webViewResized(const WebSize&); // WebDevToolsAgent implementation. virtual void attach(); @@ -106,6 +105,8 @@ public: virtual void overrideDeviceMetrics(int width, int height, float fontScaleFactor, bool fitWindow); virtual void autoZoomPageToFitWidth(); + virtual void getAllocatedObjects(HashSet<const void*>&); + int hostId() { return m_hostId; } // WebPageOverlay diff --git a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h b/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h index 06f5f1815..c1a1d93ae 100644 --- a/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h +++ b/Source/WebKit/chromium/src/WebDevToolsAgentPrivate.h @@ -54,7 +54,7 @@ public: virtual bool metricsOverridden() = 0; // WebViewImpl has been resized. - virtual void webViewResized() = 0; + virtual void webViewResized(const WebSize&) = 0; }; } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebDocument.cpp b/Source/WebKit/chromium/src/WebDocument.cpp index 3486613be..c7a3a834a 100644 --- a/Source/WebKit/chromium/src/WebDocument.cpp +++ b/Source/WebKit/chromium/src/WebDocument.cpp @@ -56,8 +56,7 @@ #include "WebFrameImpl.h" #include "WebNodeCollection.h" #include "WebNodeList.h" -#include "platform/WebURL.h" - +#include <public/WebURL.h> #include <wtf/PassRefPtr.h> using namespace WebCore; @@ -81,6 +80,11 @@ WebString WebDocument::encoding() const return constUnwrap<Document>()->encoding(); } +WebString WebDocument::contentLanguage() const +{ + return constUnwrap<Document>()->contentLanguage(); +} + WebURL WebDocument::openSearchDescriptionURL() const { return const_cast<Document*>(constUnwrap<Document>())->openSearchDescriptionURL(); @@ -256,16 +260,15 @@ WebAccessibilityObject WebDocument::accessibilityObjectFromID(int axID) const WebVector<WebDraggableRegion> WebDocument::draggableRegions() const { WebVector<WebDraggableRegion> draggableRegions; -#if ENABLE(WIDGET_REGION) +#if ENABLE(DRAGGABLE_REGION) const Document* document = constUnwrap<Document>(); - if (document->hasDashboardRegions()) { - const Vector<DashboardRegionValue>& regions = document->dashboardRegions(); + if (document->hasAnnotatedRegions()) { + const Vector<AnnotatedRegionValue>& regions = document->annotatedRegions(); draggableRegions = WebVector<WebDraggableRegion>(regions.size()); for (size_t i = 0; i < regions.size(); i++) { - const DashboardRegionValue& value = regions[i]; - draggableRegions[i].label = value.label; + const AnnotatedRegionValue& value = regions[i]; + draggableRegions[i].draggable = value.draggable; draggableRegions[i].bounds = WebCore::IntRect(value.bounds); - draggableRegions[i].clip = WebCore::IntRect(value.clip); } } #endif diff --git a/Source/WebKit/chromium/src/WebDocumentType.cpp b/Source/WebKit/chromium/src/WebDocumentType.cpp index 32570233f..4a4ed3642 100644 --- a/Source/WebKit/chromium/src/WebDocumentType.cpp +++ b/Source/WebKit/chromium/src/WebDocumentType.cpp @@ -32,8 +32,7 @@ #include "WebDocumentType.h" #include "DocumentType.h" -#include "platform/WebString.h" - +#include <public/WebString.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebDragData.cpp b/Source/WebKit/chromium/src/WebDragData.cpp index bcb0ad38a..33dd72e92 100644 --- a/Source/WebKit/chromium/src/WebDragData.cpp +++ b/Source/WebKit/chromium/src/WebDragData.cpp @@ -34,12 +34,11 @@ #include "ClipboardMimeTypes.h" #include "DataTransferItem.h" #include "DraggedIsolatedFileSystem.h" -#include "platform/WebData.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "platform/WebVector.h" - +#include <public/WebData.h> #include <public/WebDragData.h> +#include <public/WebString.h> +#include <public/WebURL.h> +#include <public/WebVector.h> #include <wtf/HashMap.h> #include <wtf/PassRefPtr.h> diff --git a/Source/WebKit/chromium/src/WebElement.cpp b/Source/WebKit/chromium/src/WebElement.cpp index 1cef30d60..49fff0a07 100644 --- a/Source/WebKit/chromium/src/WebElement.cpp +++ b/Source/WebKit/chromium/src/WebElement.cpp @@ -29,14 +29,13 @@ */ #include "config.h" -#include "platform/WebRect.h" #include "WebElement.h" #include "WebDocument.h" - #include "Element.h" #include "NamedNodeMap.h" #include "RenderBoxModelObject.h" #include "RenderObject.h" +#include <public/WebRect.h> #include <wtf/PassRefPtr.h> @@ -65,6 +64,12 @@ bool WebElement::hasTagName(const WebString& tagName) const tagName.operator String()); } +bool WebElement::hasHTMLTagName(const WebString& tagName) const +{ + const Element* element = constUnwrap<Element>(); + return HTMLNames::xhtmlNamespaceURI == element->namespaceURI() && equalIgnoringCase(element->tagName(), String(tagName)); +} + bool WebElement::hasAttribute(const WebString& attrName) const { return constUnwrap<Element>()->hasAttribute(attrName); diff --git a/Source/WebKit/chromium/src/WebEntities.cpp b/Source/WebKit/chromium/src/WebEntities.cpp index 1175f1bb1..9208e5c6b 100644 --- a/Source/WebKit/chromium/src/WebEntities.cpp +++ b/Source/WebKit/chromium/src/WebEntities.cpp @@ -31,8 +31,7 @@ #include "config.h" #include "WebEntities.h" -#include "platform/WebString.h" - +#include <public/WebString.h> #include <string.h> #include <wtf/HashMap.h> #include <wtf/text/StringBuilder.h> diff --git a/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h b/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h index 3ac63a5e8..2360c97f8 100644 --- a/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h +++ b/Source/WebKit/chromium/src/WebFileChooserCompletionImpl.h @@ -31,11 +31,10 @@ #ifndef WebFileChooserCompletionImpl_h #define WebFileChooserCompletionImpl_h -#include "WebFileChooserCompletion.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" - #include "FileChooser.h" +#include "WebFileChooserCompletion.h" +#include <public/WebString.h> +#include <public/WebVector.h> #include <wtf/PassRefPtr.h> using WebKit::WebFileChooserCompletion; diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp index 06809e54b..25fc9b282 100644 --- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.cpp @@ -38,9 +38,9 @@ #include "ScriptExecutionContext.h" #include "WebFileInfo.h" #include "WebFileSystemEntry.h" -#include "platform/WebString.h" #include "WorkerAsyncFileSystemChromium.h" #include <public/WebFileSystem.h> +#include <public/WebString.h> #include <wtf/Vector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h index e5f04081f..7ce8b2805 100644 --- a/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebFileSystemCallbacksImpl.h @@ -33,8 +33,8 @@ #include "FileSystemType.h" #include "WebFileSystemCallbacks.h" -#include "platform/WebVector.h" #include <public/WebFileSystem.h> +#include <public/WebVector.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> diff --git a/Source/WebKit/chromium/src/WebFontImpl.cpp b/Source/WebKit/chromium/src/WebFontImpl.cpp index cdb83c214..c4f5ac1ab 100644 --- a/Source/WebKit/chromium/src/WebFontImpl.cpp +++ b/Source/WebKit/chromium/src/WebFontImpl.cpp @@ -37,12 +37,11 @@ #include "GraphicsContext.h" #include "painting/GraphicsContextBuilder.h" #include "TextRun.h" -#include "platform/WebFloatPoint.h" -#include "platform/WebFloatRect.h" #include "WebFontDescription.h" -#include "platform/WebRect.h" #include "WebTextRun.h" - +#include <public/WebFloatPoint.h> +#include <public/WebFloatRect.h> +#include <public/WebRect.h> #include <skia/ext/platform_canvas.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebFormElement.cpp b/Source/WebKit/chromium/src/WebFormElement.cpp index 6400f4d96..cdae6620e 100644 --- a/Source/WebKit/chromium/src/WebFormElement.cpp +++ b/Source/WebKit/chromium/src/WebFormElement.cpp @@ -38,8 +38,8 @@ #include "HTMLNames.h" #include "WebFormControlElement.h" #include "WebInputElement.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebFrameImpl.cpp b/Source/WebKit/chromium/src/WebFrameImpl.cpp index 6d68a6f23..ec687147b 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.cpp +++ b/Source/WebKit/chromium/src/WebFrameImpl.cpp @@ -72,15 +72,19 @@ #include "WebFrameImpl.h" #include "AssociatedURLLoader.h" +#include "AsyncFileSystem.h" +#include "AsyncFileSystemChromium.h" #include "BackForwardController.h" #include "Chrome.h" #include "ClipboardUtilitiesChromium.h" #include "Console.h" +#include "DOMFileSystem.h" #include "DOMUtilitiesPrivate.h" #include "DOMWindow.h" #include "DOMWindowIntents.h" #include "DeliveredIntent.h" #include "DeliveredIntentClientImpl.h" +#include "DirectoryEntry.h" #include "Document.h" #include "DocumentLoader.h" #include "DocumentMarker.h" @@ -88,6 +92,7 @@ #include "Editor.h" #include "EventHandler.h" #include "EventListenerWrapper.h" +#include "FileEntry.h" #include "FileSystemType.h" #include "FindInPageCoordinates.h" #include "FocusController.h" @@ -116,7 +121,6 @@ #include "PageOverlay.h" #include "Performance.h" #include "PlatformMessagePortChannel.h" -#include "PlatformSupport.h" #include "PluginDocument.h" #include "PrintContext.h" #include "RenderBox.h" @@ -145,6 +149,10 @@ #include "TextAffinity.h" #include "TextIterator.h" #include "UserGestureIndicator.h" +#include "V8DOMFileSystem.h" +#include "V8DirectoryEntry.h" +#include "V8FileEntry.h" +#include "V8GCController.h" #include "WebAnimationControllerImpl.h" #include "WebConsoleMessage.h" #include "WebDOMEvent.h" @@ -173,33 +181,20 @@ #include "htmlediting.h" #include "markup.h" #include "painting/GraphicsContextBuilder.h" -#include "platform/WebFloatPoint.h" -#include "platform/WebFloatRect.h" -#include "platform/WebPoint.h" -#include "platform/WebRect.h" #include "platform/WebSerializedScriptValue.h" -#include "platform/WebSize.h" -#include "platform/WebURLError.h" -#include "platform/WebVector.h" - #include <algorithm> #include <public/Platform.h> +#include <public/WebFileSystem.h> +#include <public/WebFloatPoint.h> +#include <public/WebFloatRect.h> +#include <public/WebPoint.h> +#include <public/WebRect.h> +#include <public/WebSize.h> +#include <public/WebURLError.h> +#include <public/WebVector.h> #include <wtf/CurrentTime.h> #include <wtf/HashMap.h> -#if USE(V8) -#include "AsyncFileSystem.h" -#include "AsyncFileSystemChromium.h" -#include "DirectoryEntry.h" -#include "DOMFileSystem.h" -#include "FileEntry.h" -#include "V8DirectoryEntry.h" -#include "V8DOMFileSystem.h" -#include "V8FileEntry.h" -#include "V8GCController.h" -#include <public/WebFileSystem.h> -#endif - using namespace WebCore; namespace WebKit { @@ -214,11 +209,12 @@ static const char* const webFrameActiveCount = "WebFrameActiveCount"; // the text of each frame in turn to the |output| up to |maxChars| length. // // The |frame| must be non-null. -static void frameContentAsPlainText(size_t maxChars, Frame* frame, - Vector<UChar>* output) +// +// FIXME: We should use StringBuilder rather than Vector<UChar>. +static void frameContentAsPlainText(size_t maxChars, Frame* frame, Vector<UChar>* output) { - Document* doc = frame->document(); - if (!doc) + Document* document = frame->document(); + if (!document) return; if (!frame->view()) @@ -230,9 +226,9 @@ static void frameContentAsPlainText(size_t maxChars, Frame* frame, frame->view()->layout(); // Select the document body. - RefPtr<Range> range(doc->createRange()); + RefPtr<Range> range(document->createRange()); ExceptionCode exception = 0; - range->selectNodeContents(doc->body(), exception); + range->selectNodeContents(document->body(), exception); if (!exception) { // The text iterator will walk nodes giving us text. This is similar to @@ -364,34 +360,33 @@ public: return m_printedPageWidth / pageRect.width(); } - // Spools the printed page, a subrect of m_frame. Skip the scale step. + // Spools the printed page, a subrect of frame(). Skip the scale step. // NativeTheme doesn't play well with scaling. Scaling is done browser side // instead. Returns the scale to be applied. // On Linux, we don't have the problem with NativeTheme, hence we let WebKit // do the scaling and ignore the return value. - virtual float spoolPage(GraphicsContext& ctx, int pageNumber) + virtual float spoolPage(GraphicsContext& context, int pageNumber) { IntRect pageRect = m_pageRects[pageNumber]; float scale = m_printedPageWidth / pageRect.width(); - ctx.save(); + context.save(); #if OS(UNIX) && !OS(DARWIN) - ctx.scale(WebCore::FloatSize(scale, scale)); + context.scale(WebCore::FloatSize(scale, scale)); #endif - ctx.translate(static_cast<float>(-pageRect.x()), - static_cast<float>(-pageRect.y())); - ctx.clip(pageRect); - m_frame->view()->paintContents(&ctx, pageRect); - ctx.restore(); + context.translate(static_cast<float>(-pageRect.x()), static_cast<float>(-pageRect.y())); + context.clip(pageRect); + frame()->view()->paintContents(&context, pageRect); + context.restore(); return scale; } void spoolAllPagesWithBoundaries(GraphicsContext& graphicsContext, const FloatSize& pageSizeInPixels) { - if (!m_frame->document() || !m_frame->view() || !m_frame->document()->renderer()) + if (!frame()->document() || !frame()->view() || !frame()->document()->renderer()) return; - m_frame->document()->updateLayout(); + frame()->document()->updateLayout(); float pageHeight; computePageRects(FloatRect(FloatPoint(0, 0), pageSizeInPixels), 0, 0, 1, pageHeight); @@ -413,8 +408,7 @@ public: graphicsContext.save(); graphicsContext.setStrokeColor(Color(0, 0, 255), ColorSpaceDeviceRGB); graphicsContext.setFillColor(Color(0, 0, 255), ColorSpaceDeviceRGB); - graphicsContext.drawLine(IntPoint(0, currentHeight), - IntPoint(pageWidth, currentHeight)); + graphicsContext.drawLine(IntPoint(0, currentHeight), IntPoint(pageWidth, currentHeight)); graphicsContext.restore(); } @@ -494,12 +488,12 @@ public: return m_pageCount; } - // Spools the printed page, a subrect of m_frame. Skip the scale step. + // Spools the printed page, a subrect of frame(). Skip the scale step. // NativeTheme doesn't play well with scaling. Scaling is done browser side - // instead. Returns the scale to be applied. - virtual float spoolPage(GraphicsContext& ctx, int pageNumber) + // instead. Returns the scale to be applied. + virtual float spoolPage(GraphicsContext& context, int pageNumber) { - m_plugin->printPage(pageNumber, &ctx); + m_plugin->printPage(pageNumber, &context); return 1.0; } @@ -527,15 +521,9 @@ WebFrameImpl::FindMatch::FindMatch(PassRefPtr<Range> range, int ordinal) { } -// WebFrame ------------------------------------------------------------------- - class WebFrameImpl::DeferredScopeStringMatches { public: - DeferredScopeStringMatches(WebFrameImpl* webFrame, - int identifier, - const WebString& searchText, - const WebFindOptions& options, - bool reset) + DeferredScopeStringMatches(WebFrameImpl* webFrame, int identifier, const WebString& searchText, const WebFindOptions& options, bool reset) : m_timer(this, &DeferredScopeStringMatches::doTimeout) , m_webFrame(webFrame) , m_identifier(identifier) @@ -549,8 +537,7 @@ public: private: void doTimeout(Timer<DeferredScopeStringMatches>*) { - m_webFrame->callScopeStringMatches( - this, m_identifier, m_searchText, m_options, m_reset); + m_webFrame->callScopeStringMatches(this, m_identifier, m_searchText, m_options, m_reset); } Timer<DeferredScopeStringMatches> m_timer; @@ -561,7 +548,6 @@ private: bool m_reset; }; - // WebFrame ------------------------------------------------------------------- int WebFrame::instanceCount() @@ -569,14 +555,6 @@ int WebFrame::instanceCount() return frameCount; } -WebFrame* WebFrame::frameForEnteredContext() -{ - v8::Handle<v8::Context> context = v8::Context::GetEntered(); - if (context.IsEmpty()) - return 0; - return frameForContext(context); -} - WebFrame* WebFrame::frameForCurrentContext() { v8::Handle<v8::Context> context = v8::Context::GetCurrent(); @@ -594,28 +572,22 @@ WebFrame* WebFrame::frameForContext(v8::Handle<v8::Context> context) WebFrame* WebFrame::fromFrameOwnerElement(const WebElement& element) { - return WebFrameImpl::fromFrameOwnerElement( - PassRefPtr<Element>(element).get()); -} - -WebString WebFrameImpl::name() const -{ - return m_frame->tree()->uniqueName(); + return WebFrameImpl::fromFrameOwnerElement(PassRefPtr<Element>(element).get()); } WebString WebFrameImpl::uniqueName() const { - return m_frame->tree()->uniqueName(); + return frame()->tree()->uniqueName(); } WebString WebFrameImpl::assignedName() const { - return m_frame->tree()->name(); + return frame()->tree()->name(); } void WebFrameImpl::setName(const WebString& name) { - m_frame->tree()->setName(name); + frame()->tree()->setName(name); } long long WebFrameImpl::identifier() const @@ -625,39 +597,35 @@ long long WebFrameImpl::identifier() const WebVector<WebIconURL> WebFrameImpl::iconURLs(int iconTypes) const { - FrameLoader* frameLoader = m_frame->loader(); // The URL to the icon may be in the header. As such, only // ask the loader for the icon if it's finished loading. - if (frameLoader->state() == FrameStateComplete) - return frameLoader->icon()->urlsForTypes(iconTypes); + if (frame()->loader()->state() == FrameStateComplete) + return frame()->loader()->icon()->urlsForTypes(iconTypes); return WebVector<WebIconURL>(); } WebSize WebFrameImpl::scrollOffset() const { FrameView* view = frameView(); - if (view) - return view->scrollOffset(); - - return WebSize(); + if (!view) + return WebSize(); + return view->scrollOffset(); } WebSize WebFrameImpl::minimumScrollOffset() const { FrameView* view = frameView(); - if (view) - return view->minimumScrollPosition() - IntPoint(); - - return WebSize(); + if (!view) + return WebSize(); + return view->minimumScrollPosition() - IntPoint(); } WebSize WebFrameImpl::maximumScrollOffset() const { FrameView* view = frameView(); - if (view) - return view->maximumScrollPosition() - IntPoint(); - - return WebSize(); + if (!view) + return WebSize(); + return view->maximumScrollPosition() - IntPoint(); } void WebFrameImpl::setScrollOffset(const WebSize& offset) @@ -673,18 +641,17 @@ WebSize WebFrameImpl::contentsSize() const int WebFrameImpl::contentsPreferredWidth() const { - if (m_frame->document() && m_frame->document()->renderView()) { + if (frame()->document() && frame()->document()->renderView()) { FontCachePurgePreventer fontCachePurgePreventer; - - return m_frame->document()->renderView()->minPreferredLogicalWidth(); + return frame()->document()->renderView()->minPreferredLogicalWidth(); } return 0; } int WebFrameImpl::documentElementScrollHeight() const { - if (m_frame->document() && m_frame->document()->documentElement()) - return m_frame->document()->documentElement()->scrollHeight(); + if (frame()->document() && frame()->document()->documentElement()) + return frame()->document()->documentElement()->scrollHeight(); return 0; } @@ -695,12 +662,12 @@ bool WebFrameImpl::hasVisibleContent() const bool WebFrameImpl::hasHorizontalScrollbar() const { - return m_frame && m_frame->view() && m_frame->view()->horizontalScrollbar(); + return frame() && frame()->view() && frame()->view()->horizontalScrollbar(); } bool WebFrameImpl::hasVerticalScrollbar() const { - return m_frame && m_frame->view() && m_frame->view()->verticalScrollbar(); + return frame() && frame()->view() && frame()->view()->verticalScrollbar(); } WebView* WebFrameImpl::view() const @@ -710,66 +677,76 @@ WebView* WebFrameImpl::view() const WebFrame* WebFrameImpl::opener() const { - Frame* opener = 0; - if (m_frame) - opener = m_frame->loader()->opener(); - return fromFrame(opener); + if (!frame()) + return 0; + return fromFrame(frame()->loader()->opener()); } -void WebFrameImpl::setOpener(const WebFrame* frame) +void WebFrameImpl::setOpener(const WebFrame* webFrame) { - m_frame->loader()->setOpener(frame ? - static_cast<const WebFrameImpl*>(frame)->m_frame : 0); + frame()->loader()->setOpener(webFrame ? static_cast<const WebFrameImpl*>(webFrame)->frame() : 0); } WebFrame* WebFrameImpl::parent() const { - Frame* parent = 0; - if (m_frame) - parent = m_frame->tree()->parent(); - return fromFrame(parent); + if (!frame()) + return 0; + return fromFrame(frame()->tree()->parent()); } WebFrame* WebFrameImpl::top() const { - if (m_frame) - return fromFrame(m_frame->tree()->top()); - - return 0; + if (!frame()) + return 0; + return fromFrame(frame()->tree()->top()); } WebFrame* WebFrameImpl::firstChild() const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->firstChild()); } WebFrame* WebFrameImpl::lastChild() const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->lastChild()); } WebFrame* WebFrameImpl::nextSibling() const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->nextSibling()); } WebFrame* WebFrameImpl::previousSibling() const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->previousSibling()); } WebFrame* WebFrameImpl::traverseNext(bool wrap) const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->traverseNextWithWrap(wrap)); } WebFrame* WebFrameImpl::traversePrevious(bool wrap) const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->traversePreviousWithWrap(wrap)); } WebFrame* WebFrameImpl::findChildByName(const WebString& name) const { + if (!frame()) + return 0; return fromFrame(frame()->tree()->child(name)); } @@ -778,33 +755,25 @@ WebFrame* WebFrameImpl::findChildByExpression(const WebString& xpath) const if (xpath.isEmpty()) return 0; - Document* document = m_frame->document(); + Document* document = frame()->document(); ExceptionCode ec = 0; - PassRefPtr<XPathResult> xpathResult = - document->evaluate(xpath, - document, - 0, // namespace - XPathResult::ORDERED_NODE_ITERATOR_TYPE, - 0, // XPathResult object - ec); + RefPtr<XPathResult> xpathResult = document->evaluate(xpath, document, 0, XPathResult::ORDERED_NODE_ITERATOR_TYPE, 0, ec); if (!xpathResult) return 0; Node* node = xpathResult->iterateNext(ec); - if (!node || !node->isFrameOwnerElement()) return 0; - HTMLFrameOwnerElement* frameElement = - static_cast<HTMLFrameOwnerElement*>(node); + HTMLFrameOwnerElement* frameElement = static_cast<HTMLFrameOwnerElement*>(node); return fromFrame(frameElement->contentFrame()); } WebDocument WebFrameImpl::document() const { - if (!m_frame || !m_frame->document()) + if (!frame() || !frame()->document()) return WebDocument(); - return WebDocument(m_frame->document()); + return WebDocument(frame()->document()); } WebAnimationController* WebFrameImpl::animationController() @@ -814,59 +783,49 @@ WebAnimationController* WebFrameImpl::animationController() WebPerformance WebFrameImpl::performance() const { - if (!m_frame) + if (!frame()) return WebPerformance(); - - return WebPerformance(m_frame->document()->domWindow()->performance()); + return WebPerformance(frame()->document()->domWindow()->performance()); } NPObject* WebFrameImpl::windowObject() const { - if (!m_frame) + if (!frame()) return 0; - - return m_frame->script()->windowScriptNPObject(); + return frame()->script()->windowScriptNPObject(); } void WebFrameImpl::bindToWindowObject(const WebString& name, NPObject* object) { - ASSERT(m_frame); - if (!m_frame || !m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) + if (!frame() || !frame()->script()->canExecuteScripts(NotAboutToExecuteScript)) return; - - String key = name; -#if USE(V8) - m_frame->script()->bindToWindowObject(m_frame, key, object); -#else - notImplemented(); -#endif + frame()->script()->bindToWindowObject(frame(), String(name), object); } void WebFrameImpl::executeScript(const WebScriptSource& source) { + ASSERT(frame()); TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), OrdinalNumber::first()); - m_frame->script()->executeScript( - ScriptSourceCode(source.code, source.url, position)); + frame()->script()->executeScript(ScriptSourceCode(source.code, source.url, position)); } -void WebFrameImpl::executeScriptInIsolatedWorld( - int worldID, const WebScriptSource* sourcesIn, unsigned numSources, - int extensionGroup) +void WebFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup) { - Vector<ScriptSourceCode> sources; + ASSERT(frame()); + Vector<ScriptSourceCode> sources; for (unsigned i = 0; i < numSources; ++i) { TextPosition position(OrdinalNumber::fromOneBasedInt(sourcesIn[i].startLine), OrdinalNumber::first()); - sources.append(ScriptSourceCode( - sourcesIn[i].code, sourcesIn[i].url, position)); + sources.append(ScriptSourceCode(sourcesIn[i].code, sourcesIn[i].url, position)); } - m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0); + frame()->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0); } void WebFrameImpl::setIsolatedWorldSecurityOrigin(int worldID, const WebSecurityOrigin& securityOrigin) { - m_frame->script()->setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get()); + ASSERT(frame()); + frame()->script()->setIsolatedWorldSecurityOrigin(worldID, securityOrigin.get()); } void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message) @@ -897,27 +856,23 @@ void WebFrameImpl::addMessageToConsole(const WebConsoleMessage& message) void WebFrameImpl::collectGarbage() { - if (!m_frame) + if (!frame()) return; - if (!m_frame->settings()->isScriptEnabled()) + if (!frame()->settings()->isScriptEnabled()) return; - // FIXME: Move this to the ScriptController and make it JS neutral. -#if USE(V8) V8GCController::collectGarbage(); -#else - notImplemented(); -#endif } bool WebFrameImpl::checkIfRunInsecureContent(const WebURL& url) const { - FrameLoader* frameLoader = m_frame->loader(); - return frameLoader->checkIfRunInsecureContent(m_frame->document()->securityOrigin(), url); + ASSERT(frame()); + return frame()->loader()->checkIfRunInsecureContent(frame()->document()->securityOrigin(), url); } -#if USE(V8) v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue(const WebScriptSource& source) { + ASSERT(frame()); + // FIXME: This fake user gesture is required to make a bunch of pyauto // tests pass. If this isn't needed in non-test situations, we should // consider removing this code and changing the tests. @@ -925,13 +880,13 @@ v8::Handle<v8::Value> WebFrameImpl::executeScriptAndReturnValue(const WebScriptS UserGestureIndicator gestureIndicator(DefinitelyProcessingUserGesture); TextPosition position(OrdinalNumber::fromOneBasedInt(source.startLine), OrdinalNumber::first()); - return m_frame->script()->executeScript(ScriptSourceCode(source.code, source.url, position)).v8Value(); + return frame()->script()->executeScript(ScriptSourceCode(source.code, source.url, position)).v8Value(); } -void WebFrameImpl::executeScriptInIsolatedWorld( - int worldID, const WebScriptSource* sourcesIn, unsigned numSources, - int extensionGroup, WebVector<v8::Local<v8::Value> >* results) +void WebFrameImpl::executeScriptInIsolatedWorld(int worldID, const WebScriptSource* sourcesIn, unsigned numSources, int extensionGroup, WebVector<v8::Local<v8::Value> >* results) { + ASSERT(frame()); + Vector<ScriptSourceCode> sources; for (unsigned i = 0; i < numSources; ++i) { @@ -941,76 +896,69 @@ void WebFrameImpl::executeScriptInIsolatedWorld( if (results) { Vector<ScriptValue> scriptResults; - m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, &scriptResults); + frame()->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, &scriptResults); WebVector<v8::Local<v8::Value> > v8Results(scriptResults.size()); for (unsigned i = 0; i < scriptResults.size(); i++) v8Results[i] = v8::Local<v8::Value>::New(scriptResults[i].v8Value()); results->swap(v8Results); } else - m_frame->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0); + frame()->script()->evaluateInIsolatedWorld(worldID, sources, extensionGroup, 0); } -// Call the function with the given receiver and arguments, bypassing canExecuteScripts. -v8::Handle<v8::Value> WebFrameImpl::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function, - v8::Handle<v8::Object> receiver, - int argc, - v8::Handle<v8::Value> argv[]) +v8::Handle<v8::Value> WebFrameImpl::callFunctionEvenIfScriptDisabled(v8::Handle<v8::Function> function, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> argv[]) { - return m_frame->script()->callFunctionEvenIfScriptDisabled(function, receiver, argc, argv).v8Value(); + ASSERT(frame()); + return frame()->script()->callFunctionEvenIfScriptDisabled(function, receiver, argc, argv).v8Value(); } -// Returns the V8 context for this frame, or an empty handle if there is none. v8::Local<v8::Context> WebFrameImpl::mainWorldScriptContext() const { - if (!m_frame) + if (!frame()) return v8::Local<v8::Context>(); - - return ScriptController::mainWorldContext(m_frame); + return ScriptController::mainWorldContext(frame()); } -v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type, - const WebString& name, - const WebString& path) +v8::Handle<v8::Value> WebFrameImpl::createFileSystem(WebFileSystem::Type type, const WebString& name, const WebString& path) { + ASSERT(frame()); return toV8(DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create())); } -v8::Handle<v8::Value> WebFrameImpl::createSerializableFileSystem(WebFileSystem::Type type, - const WebString& name, - const WebString& path) +v8::Handle<v8::Value> WebFrameImpl::createSerializableFileSystem(WebFileSystem::Type type, const WebString& name, const WebString& path) { - RefPtr<DOMFileSystem> fs = DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create()); - fs->makeClonable(); - return toV8(fs.release()); + ASSERT(frame()); + RefPtr<DOMFileSystem> fileSystem = DOMFileSystem::create(frame()->document(), name, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, path.utf8().data()), AsyncFileSystemChromium::create()); + fileSystem->makeClonable(); + return toV8(fileSystem.release()); } -v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, - const WebString& fileSystemName, - const WebString& fileSystemPath, - const WebString& filePath, - bool isDirectory) +v8::Handle<v8::Value> WebFrameImpl::createFileEntry(WebFileSystem::Type type, const WebString& fileSystemName, const WebString& fileSystemPath, const WebString& filePath, bool isDirectory) { + ASSERT(frame()); + RefPtr<DOMFileSystemBase> fileSystem = DOMFileSystem::create(frame()->document(), fileSystemName, static_cast<WebCore::FileSystemType>(type), KURL(ParsedURLString, fileSystemPath.utf8().data()), AsyncFileSystemChromium::create()); if (isDirectory) return toV8(DirectoryEntry::create(fileSystem, filePath)); return toV8(FileEntry::create(fileSystem, filePath)); } -#endif void WebFrameImpl::reload(bool ignoreCache) { - m_frame->loader()->history()->saveDocumentAndScrollState(); - m_frame->loader()->reload(ignoreCache); + ASSERT(frame()); + frame()->loader()->history()->saveDocumentAndScrollState(); + frame()->loader()->reload(ignoreCache); } void WebFrameImpl::reloadWithOverrideURL(const WebURL& overrideUrl, bool ignoreCache) { - m_frame->loader()->history()->saveDocumentAndScrollState(); - m_frame->loader()->reloadWithOverrideURL(overrideUrl, ignoreCache); + ASSERT(frame()); + frame()->loader()->history()->saveDocumentAndScrollState(); + frame()->loader()->reloadWithOverrideURL(overrideUrl, ignoreCache); } void WebFrameImpl::loadRequest(const WebURLRequest& request) { + ASSERT(frame()); ASSERT(!request.isNull()); const ResourceRequest& resourceRequest = request.toResourceRequest(); @@ -1019,29 +967,25 @@ void WebFrameImpl::loadRequest(const WebURLRequest& request) return; } - m_frame->loader()->load(resourceRequest, false); + frame()->loader()->load(resourceRequest, false); } void WebFrameImpl::loadHistoryItem(const WebHistoryItem& item) { + ASSERT(frame()); RefPtr<HistoryItem> historyItem = PassRefPtr<HistoryItem>(item); ASSERT(historyItem); - m_frame->loader()->prepareForHistoryNavigation(); - RefPtr<HistoryItem> currentItem = m_frame->loader()->history()->currentItem(); + frame()->loader()->prepareForHistoryNavigation(); + RefPtr<HistoryItem> currentItem = frame()->loader()->history()->currentItem(); m_inSameDocumentHistoryLoad = currentItem && currentItem->shouldDoSameDocumentNavigationTo(historyItem.get()); - m_frame->page()->goToItem(historyItem.get(), - FrameLoadTypeIndexedBackForward); + frame()->page()->goToItem(historyItem.get(), FrameLoadTypeIndexedBackForward); m_inSameDocumentHistoryLoad = false; } -void WebFrameImpl::loadData(const WebData& data, - const WebString& mimeType, - const WebString& textEncoding, - const WebURL& baseURL, - const WebURL& unreachableURL, - bool replace) +void WebFrameImpl::loadData(const WebData& data, const WebString& mimeType, const WebString& textEncoding, const WebURL& baseURL, const WebURL& unreachableURL, bool replace) { + ASSERT(frame()); SubstituteData substData(data, mimeType, textEncoding, unreachableURL); ASSERT(substData.isValid()); @@ -1053,78 +997,74 @@ void WebFrameImpl::loadData(const WebData& data, // instead of the currently loaded URL. ResourceRequest request; if (replace && !unreachableURL.isEmpty()) - request = m_frame->loader()->originalRequest(); + request = frame()->loader()->originalRequest(); request.setURL(baseURL); - m_frame->loader()->load(request, substData, false); + frame()->loader()->load(request, substData, false); if (replace) { // Do this to force WebKit to treat the load as replacing the currently // loaded page. - m_frame->loader()->setReplacing(); + frame()->loader()->setReplacing(); } } -void WebFrameImpl::loadHTMLString(const WebData& data, - const WebURL& baseURL, - const WebURL& unreachableURL, - bool replace) +void WebFrameImpl::loadHTMLString(const WebData& data, const WebURL& baseURL, const WebURL& unreachableURL, bool replace) { - loadData(data, - WebString::fromUTF8("text/html"), - WebString::fromUTF8("UTF-8"), - baseURL, - unreachableURL, - replace); + ASSERT(frame()); + loadData(data, WebString::fromUTF8("text/html"), WebString::fromUTF8("UTF-8"), baseURL, unreachableURL, replace); } bool WebFrameImpl::isLoading() const { - if (!m_frame) + if (!frame()) return false; - return m_frame->loader()->isLoading(); + return frame()->loader()->isLoading(); } void WebFrameImpl::stopLoading() { - if (!m_frame) - return; - + if (!frame()) + return; // FIXME: Figure out what we should really do here. It seems like a bug // that FrameLoader::stopLoading doesn't call stopAllLoaders. - m_frame->loader()->stopAllLoaders(); - m_frame->loader()->stopLoading(UnloadEventPolicyNone); + frame()->loader()->stopAllLoaders(); + frame()->loader()->stopLoading(UnloadEventPolicyNone); } WebDataSource* WebFrameImpl::provisionalDataSource() const { - FrameLoader* frameLoader = m_frame->loader(); + ASSERT(frame()); // We regard the policy document loader as still provisional. - DocumentLoader* docLoader = frameLoader->provisionalDocumentLoader(); - if (!docLoader) - docLoader = frameLoader->policyDocumentLoader(); + DocumentLoader* documentLoader = frame()->loader()->provisionalDocumentLoader(); + if (!documentLoader) + documentLoader = frame()->loader()->policyDocumentLoader(); - return DataSourceForDocLoader(docLoader); + return DataSourceForDocLoader(documentLoader); } WebDataSource* WebFrameImpl::dataSource() const { - return DataSourceForDocLoader(m_frame->loader()->documentLoader()); + ASSERT(frame()); + return DataSourceForDocLoader(frame()->loader()->documentLoader()); } WebHistoryItem WebFrameImpl::previousHistoryItem() const { + ASSERT(frame()); // We use the previous item here because documentState (filled-out forms) // only get saved to history when it becomes the previous item. The caller // is expected to query the history item after a navigation occurs, after // the desired history item has become the previous entry. - return WebHistoryItem(m_frame->loader()->history()->previousItem()); + return WebHistoryItem(frame()->loader()->history()->previousItem()); } WebHistoryItem WebFrameImpl::currentHistoryItem() const { + ASSERT(frame()); + // We're shutting down. - if (!m_frame->loader()->activeDocumentLoader()) + if (!frame()->loader()->activeDocumentLoader()) return WebHistoryItem(); // If we are still loading, then we don't want to clobber the current @@ -1132,35 +1072,30 @@ WebHistoryItem WebFrameImpl::currentHistoryItem() const // document state. However, it is OK for new navigations. // FIXME: Can we make this a plain old getter, instead of worrying about // clobbering here? - if (!m_inSameDocumentHistoryLoad && (m_frame->loader()->loadType() == FrameLoadTypeStandard - || !m_frame->loader()->activeDocumentLoader()->isLoadingInAPISense())) - m_frame->loader()->history()->saveDocumentAndScrollState(); + if (!m_inSameDocumentHistoryLoad && (frame()->loader()->loadType() == FrameLoadTypeStandard + || !frame()->loader()->activeDocumentLoader()->isLoadingInAPISense())) + frame()->loader()->history()->saveDocumentAndScrollState(); - return WebHistoryItem(m_frame->page()->backForward()->currentItem()); + return WebHistoryItem(frame()->page()->backForward()->currentItem()); } void WebFrameImpl::enableViewSourceMode(bool enable) { - if (m_frame) - m_frame->setInViewSourceMode(enable); + if (frame()) + frame()->setInViewSourceMode(enable); } bool WebFrameImpl::isViewSourceModeEnabled() const { - if (m_frame) - return m_frame->inViewSourceMode(); - - return false; + if (!frame()) + return false; + return frame()->inViewSourceMode(); } void WebFrameImpl::setReferrerForRequest(WebURLRequest& request, const WebURL& referrerURL) { - String referrer; - if (referrerURL.isEmpty()) - referrer = m_frame->loader()->outgoingReferrer(); - else - referrer = referrerURL.spec().utf16(); - referrer = SecurityPolicy::generateReferrerHeader(m_frame->document()->referrerPolicy(), request.url(), referrer); + String referrer = referrerURL.isEmpty() ? frame()->loader()->outgoingReferrer() : String(referrerURL.spec().utf16()); + referrer = SecurityPolicy::generateReferrerHeader(frame()->document()->referrerPolicy(), request.url(), referrer); if (referrer.isEmpty()) return; request.setHTTPHeaderField(WebString::fromUTF8("Referer"), referrer); @@ -1169,8 +1104,7 @@ void WebFrameImpl::setReferrerForRequest(WebURLRequest& request, const WebURL& r void WebFrameImpl::dispatchWillSendRequest(WebURLRequest& request) { ResourceResponse response; - m_frame->loader()->client()->dispatchWillSendRequest( - 0, 0, request.toMutableResourceRequest(), response); + frame()->loader()->client()->dispatchWillSendRequest(0, 0, request.toMutableResourceRequest(), response); } WebURLLoader* WebFrameImpl::createAssociatedURLLoader(const WebURLLoaderOptions& options) @@ -1180,7 +1114,7 @@ WebURLLoader* WebFrameImpl::createAssociatedURLLoader(const WebURLLoaderOptions& void WebFrameImpl::commitDocumentData(const char* data, size_t length) { - m_frame->loader()->documentLoader()->commitData(data, length); + frame()->loader()->documentLoader()->commitData(data, length); } unsigned WebFrameImpl::unloadListenerCount() const @@ -1212,21 +1146,16 @@ void WebFrameImpl::replaceSelection(const WebString& text) void WebFrameImpl::insertText(const WebString& text) { - Editor* editor = frame()->editor(); - - if (editor->hasComposition()) - editor->confirmComposition(text); + if (frame()->editor()->hasComposition()) + frame()->editor()->confirmComposition(text); else - editor->insertText(text, 0); + frame()->editor()->insertText(text, 0); } -void WebFrameImpl::setMarkedText( - const WebString& text, unsigned location, unsigned length) +void WebFrameImpl::setMarkedText(const WebString& text, unsigned location, unsigned length) { - Editor* editor = frame()->editor(); - Vector<CompositionUnderline> decorations; - editor->setComposition(text, decorations, location, length); + frame()->editor()->setComposition(text, decorations, location, length); } void WebFrameImpl::unmarkText() @@ -1255,7 +1184,6 @@ bool WebFrameImpl::firstRectForCharacterRange(unsigned location, unsigned length IntRect intRect = frame()->editor()->firstRectForRange(range.get()); rect = WebRect(intRect); rect = frame()->view()->contentsToWindow(rect); - return true; } @@ -1303,38 +1231,29 @@ bool WebFrameImpl::executeCommand(const WebString& name, const WebNode& node) } } - bool rv = true; + bool result = true; // Specially handling commands that Editor::execCommand does not directly // support. if (command == "DeleteToEndOfParagraph") { - Editor* editor = frame()->editor(); - if (!editor->deleteWithDirection(DirectionForward, - ParagraphBoundary, - true, - false)) { - editor->deleteWithDirection(DirectionForward, - CharacterGranularity, - true, - false); - } + if (!frame()->editor()->deleteWithDirection(DirectionForward, ParagraphBoundary, true, false)) + frame()->editor()->deleteWithDirection(DirectionForward, CharacterGranularity, true, false); } else if (command == "Indent") frame()->editor()->indent(); else if (command == "Outdent") frame()->editor()->outdent(); else if (command == "DeleteBackward") - rv = frame()->editor()->command(AtomicString("BackwardDelete")).execute(); + result = frame()->editor()->command(AtomicString("BackwardDelete")).execute(); else if (command == "DeleteForward") - rv = frame()->editor()->command(AtomicString("ForwardDelete")).execute(); + result = frame()->editor()->command(AtomicString("ForwardDelete")).execute(); else if (command == "AdvanceToNextMisspelling") { - // False must be passed here, or the currently selected word will never be - // skipped. + // Wee need to pass false here or else the currently selected word will never be skipped. frame()->editor()->advanceToNextMisspelling(false); } else if (command == "ToggleSpellPanel") frame()->editor()->showSpellingGuessPanel(); else - rv = frame()->editor()->command(command).execute(); - return rv; + result = frame()->editor()->command(command).execute(); + return result; } bool WebFrameImpl::executeCommand(const WebString& name, const WebString& value) @@ -1342,8 +1261,7 @@ bool WebFrameImpl::executeCommand(const WebString& name, const WebString& value) ASSERT(frame()); String webName = name; - // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebKit - // for editable nodes. + // moveToBeginningOfDocument and moveToEndfDocument are only handled by WebKit for editable nodes. if (!frame()->editor()->canEdit() && webName == "moveToBeginningOfDocument") return viewImpl()->propagateScroll(ScrollUp, ScrollByDocument); @@ -1371,13 +1289,11 @@ bool WebFrameImpl::isContinuousSpellCheckingEnabled() const return frame()->editor()->isContinuousSpellCheckingEnabled(); } -void WebFrameImpl::requestTextChecking(const WebElement& webElem) +void WebFrameImpl::requestTextChecking(const WebElement& webElement) { - if (webElem.isNull()) + if (webElement.isNull()) return; - - RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(webElem.constUnwrap<Element>())); - + RefPtr<Range> rangeToCheck = rangeOfContents(const_cast<Element*>(webElement.constUnwrap<Element>())); frame()->editor()->spellChecker()->requestCheckingFor(SpellCheckRequest::create(TextCheckingTypeSpelling | TextCheckingTypeGrammar, TextCheckingProcessBatch, rangeToCheck, rangeToCheck)); } @@ -1445,9 +1361,9 @@ WebString WebFrameImpl::selectionAsMarkup() const return createMarkup(range.get(), 0, AnnotateForInterchange, false, ResolveNonLocalURLs); } -void WebFrameImpl::selectWordAroundPosition(Frame* frame, VisiblePosition pos) +void WebFrameImpl::selectWordAroundPosition(Frame* frame, VisiblePosition position) { - VisibleSelection selection(pos); + VisibleSelection selection(position); selection.expandUsingGranularity(WordGranularity); if (frame->selection()->shouldChangeSelection(selection)) { @@ -1468,42 +1384,33 @@ bool WebFrameImpl::selectWordAroundCaret() void WebFrameImpl::selectRange(const WebPoint& base, const WebPoint& extent) { - VisiblePosition basePos = visiblePositionForWindowPoint(base); - VisiblePosition extentPos = visiblePositionForWindowPoint(extent); - VisibleSelection newSelection = VisibleSelection(basePos, extentPos); + VisiblePosition basePosition = visiblePositionForWindowPoint(base); + VisiblePosition extentPosition = visiblePositionForWindowPoint(extent); + VisibleSelection newSelection = VisibleSelection(basePosition, extentPosition); if (frame()->selection()->shouldChangeSelection(newSelection)) frame()->selection()->setSelection(newSelection, CharacterGranularity); } void WebFrameImpl::selectRange(const WebRange& webRange) { - RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange); - if (range) + if (RefPtr<Range> range = static_cast<PassRefPtr<Range> >(webRange)) frame()->selection()->setSelectedRange(range.get(), WebCore::VP_DEFAULT_AFFINITY, false); } VisiblePosition WebFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) { - HitTestRequest::HitTestRequestType hitType = HitTestRequest::Move; - hitType |= HitTestRequest::ReadOnly; - hitType |= HitTestRequest::Active; - hitType |= HitTestRequest::IgnoreClipping; - HitTestRequest request(hitType); - FrameView* view = frame()->view(); - HitTestResult result(view->windowToContents(IntPoint(point.x, point.y))); + HitTestRequest request = HitTestRequest::Move | HitTestRequest::ReadOnly | HitTestRequest::Active | HitTestRequest::IgnoreClipping; + HitTestResult result(frame()->view()->windowToContents(IntPoint(point))); frame()->document()->renderView()->layer()->hitTest(request, result); Node* node = result.targetNode(); if (!node) return VisiblePosition(); - return node->renderer()->positionForPoint(result.localPoint()); } -int WebFrameImpl::printBegin(const WebPrintParams& printParams, - const WebNode& constrainToNode, - bool* useBrowserOverlays) +int WebFrameImpl::printBegin(const WebPrintParams& printParams, const WebNode& constrainToNode, bool* useBrowserOverlays) { ASSERT(!frame()->document()->isFrameSet()); WebPluginContainerImpl* pluginContainer = 0; @@ -1521,8 +1428,7 @@ int WebFrameImpl::printBegin(const WebPrintParams& printParams, else m_printContext = adoptPtr(new ChromePrintContext(frame())); - FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), - static_cast<float>(printParams.printContentArea.height)); + FloatRect rect(0, 0, static_cast<float>(printParams.printContentArea.width), static_cast<float>(printParams.printContentArea.height)); m_printContext->begin(rect.width(), rect.height()); float pageHeight; // We ignore the overlays calculation for now since they are generated in the @@ -1536,29 +1442,19 @@ int WebFrameImpl::printBegin(const WebPrintParams& printParams, float WebFrameImpl::getPrintPageShrink(int page) { - // Ensure correct state. - if (!m_printContext || page < 0) { - ASSERT_NOT_REACHED(); - return 0; - } - + ASSERT(m_printContext && page >= 0); return m_printContext->getPageShrink(page); } float WebFrameImpl::printPage(int page, WebCanvas* canvas) { #if ENABLE(PRINTING) - // Ensure correct state. - if (!m_printContext || page < 0 || !frame() || !frame()->document()) { - ASSERT_NOT_REACHED(); - return 0; - } + ASSERT(m_printContext && page >= 0 && frame() && frame()->document()); GraphicsContextBuilder builder(canvas); - GraphicsContext& gc = builder.context(); - gc.platformContext()->setPrinting(true); - - return m_printContext->spoolPage(gc, page); + GraphicsContext& graphicsContext = builder.context(); + graphicsContext.platformContext()->setPrinting(true); + return m_printContext->spoolPage(graphicsContext, page); #else return 0; #endif @@ -1567,18 +1463,13 @@ float WebFrameImpl::printPage(int page, WebCanvas* canvas) void WebFrameImpl::printEnd() { ASSERT(m_printContext); - if (m_printContext) - m_printContext->end(); + m_printContext->end(); m_printContext.clear(); } bool WebFrameImpl::isPrintScalingDisabledForPlugin(const WebNode& node) { - WebPluginContainerImpl* pluginContainer = 0; - if (node.isNull()) - pluginContainer = pluginContainerFromFrame(frame()); - else - pluginContainer = pluginContainerFromNode(node); + WebPluginContainerImpl* pluginContainer = node.isNull() ? pluginContainerFromFrame(frame()) : pluginContainerFromNode(node); if (!pluginContainer || !pluginContainer->supportsPaginatedPrint()) return false; @@ -1596,35 +1487,24 @@ bool WebFrameImpl::isPageBoxVisible(int pageIndex) return frame()->document()->isPageBoxVisible(pageIndex); } -void WebFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, - WebSize& pageSize, - int& marginTop, - int& marginRight, - int& marginBottom, - int& marginLeft) -{ - IntSize size(pageSize.width, pageSize.height); - frame()->document()->pageSizeAndMarginsInPixels(pageIndex, - size, - marginTop, - marginRight, - marginBottom, - marginLeft); +void WebFrameImpl::pageSizeAndMarginsInPixels(int pageIndex, WebSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft) +{ + IntSize size = pageSize; + frame()->document()->pageSizeAndMarginsInPixels(pageIndex, size, marginTop, marginRight, marginBottom, marginLeft); pageSize = size; } WebString WebFrameImpl::pageProperty(const WebString& propertyName, int pageIndex) { ASSERT(m_printContext); - return m_printContext->pageProperty(m_frame, propertyName.utf8().data(), pageIndex); + return m_printContext->pageProperty(frame(), propertyName.utf8().data(), pageIndex); } -bool WebFrameImpl::find(int identifier, - const WebString& searchText, - const WebFindOptions& options, - bool wrapWithinFrame, - WebRect* selectionRect) +bool WebFrameImpl::find(int identifier, const WebString& searchText, const WebFindOptions& options, bool wrapWithinFrame, WebRect* selectionRect) { + if (!frame() || !frame()->page()) + return false; + WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); if (!options.findNext) @@ -1718,20 +1598,19 @@ void WebFrameImpl::stopFinding(bool clearSelection) invalidateArea(InvalidateAll); } -void WebFrameImpl::scopeStringMatches(int identifier, - const WebString& searchText, - const WebFindOptions& options, - bool reset) +void WebFrameImpl::scopeStringMatches(int identifier, const WebString& searchText, const WebFindOptions& options, bool reset) { - WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); - if (reset) { // This is a brand new search, so we need to reset everything. // Scoping is just about to begin. - m_scopingComplete = false; + m_scopingInProgress = true; + + // Need to keep the current identifier locally in order to finish the + // request in case the frame is detached during the process. + m_findRequestIdentifier = identifier; // Clear highlighting for this frame. - if (frame() && frame()->editor()->markedTextMatchesAreHighlighted()) + if (frame() && frame()->page() && frame()->editor()->markedTextMatchesAreHighlighted()) frame()->page()->unmarkAllTextMatches(); // Clear the tickmarks and results cache. @@ -1743,14 +1622,12 @@ void WebFrameImpl::scopeStringMatches(int identifier, m_resumeScopingFromRange = 0; - mainFrameImpl->m_framesScopingCount++; + // The view might be null on detached frames. + if (frame() && frame()->page()) + viewImpl()->mainFrameImpl()->m_framesScopingCount++; // Now, defer scoping until later to allow find operation to finish quickly. - scopeStringMatchesSoon( - identifier, - searchText, - options, - false); // false=we just reset, so don't do it again. + scopeStringMatchesSoon(identifier, searchText, options, false); // false means just reset, so don't do it again. return; } @@ -1762,6 +1639,7 @@ void WebFrameImpl::scopeStringMatches(int identifier, return; } + WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); RefPtr<Range> searchRange(rangeOfContents(frame()->document())); Node* originalEndContainer = searchRange->endContainer(); @@ -1891,20 +1769,29 @@ void WebFrameImpl::scopeStringMatches(int identifier, finishCurrentScopingEffort(identifier); } -void WebFrameImpl::finishCurrentScopingEffort(int identifier) +void WebFrameImpl::flushCurrentScopingEffort(int identifier) { + if (!frame() || !frame()->page()) + return; + WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); // This frame has no further scoping left, so it is done. Other frames might, // of course, continue to scope matches. - m_scopingComplete = true; mainFrameImpl->m_framesScopingCount--; - m_lastFindRequestCompletedWithNoMatches = !m_lastMatchCount; // If this is the last frame to finish scoping we need to trigger the final // update to be sent. if (!mainFrameImpl->m_framesScopingCount) mainFrameImpl->increaseMatchCount(0, identifier); +} + +void WebFrameImpl::finishCurrentScopingEffort(int identifier) +{ + flushCurrentScopingEffort(identifier); + + m_scopingInProgress = false; + m_lastFindRequestCompletedWithNoMatches = !m_lastMatchCount; // This frame is done, so show any scrollbar tickmarks we haven't drawn yet. invalidateArea(InvalidateScrollbar); @@ -1917,8 +1804,11 @@ void WebFrameImpl::cancelPendingScopingEffort() m_activeMatchIndexInCurrentFrame = -1; - if (!m_scopingComplete) + // Last request didn't complete. + if (m_scopingInProgress) m_lastFindRequestCompletedWithNoMatches = false; + + m_scopingInProgress = false; } void WebFrameImpl::increaseMatchCount(int count, int identifier) @@ -1936,9 +1826,7 @@ void WebFrameImpl::increaseMatchCount(int count, int identifier) client()->reportFindInPageMatchCount(identifier, m_totalMatchCount, !m_framesScopingCount); } -void WebFrameImpl::reportFindInPageSelection(const WebRect& selectionRect, - int activeMatchOrdinal, - int identifier) +void WebFrameImpl::reportFindInPageSelection(const WebRect& selectionRect, int activeMatchOrdinal, int identifier) { // Update the UI with the latest selection rect. if (client()) @@ -1957,21 +1845,21 @@ void WebFrameImpl::resetMatchCount() void WebFrameImpl::sendOrientationChangeEvent(int orientation) { #if ENABLE(ORIENTATION_EVENTS) - if (m_frame) - m_frame->sendOrientationChangeEvent(orientation); + if (frame()) + frame()->sendOrientationChangeEvent(orientation); #endif } void WebFrameImpl::addEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { - DOMWindow* window = m_frame->document()->domWindow(); + DOMWindow* window = frame()->document()->domWindow(); EventListenerWrapper* listenerWrapper = listener->createEventListenerWrapper(eventType, useCapture, window); window->addEventListener(eventType, adoptRef(listenerWrapper), useCapture); } void WebFrameImpl::removeEventListener(const WebString& eventType, WebDOMEventListener* listener, bool useCapture) { - DOMWindow* window = m_frame->document()->domWindow(); + DOMWindow* window = frame()->document()->domWindow(); EventListenerWrapper* listenerWrapper = listener->getEventListenerWrapper(eventType, useCapture, window); window->removeEventListener(eventType, listenerWrapper, useCapture); } @@ -1979,14 +1867,13 @@ void WebFrameImpl::removeEventListener(const WebString& eventType, WebDOMEventLi bool WebFrameImpl::dispatchEvent(const WebDOMEvent& event) { ASSERT(!event.isNull()); - return m_frame->document()->domWindow()->dispatchEvent(event); + return frame()->document()->domWindow()->dispatchEvent(event); } void WebFrameImpl::dispatchMessageEventWithOriginCheck(const WebSecurityOrigin& intendedTargetOrigin, const WebDOMEvent& event) { ASSERT(!event.isNull()); - // Pass an empty call stack, since we don't have the one from the other process. - m_frame->document()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); + frame()->document()->domWindow()->dispatchMessageEventWithOriginCheck(intendedTargetOrigin.get(), event, 0); } int WebFrameImpl::findMatchMarkersVersion() const @@ -2008,8 +1895,7 @@ bool WebFrameImpl::isActiveMatchFrameValid() const { WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); WebFrameImpl* activeMatchFrame = mainFrameImpl->activeMatchFrame(); - return activeMatchFrame && activeMatchFrame->m_activeMatch - && activeMatchFrame->frame()->tree()->isDescendantOf(mainFrameImpl->frame()); + return activeMatchFrame && activeMatchFrame->m_activeMatch && activeMatchFrame->frame()->tree()->isDescendantOf(mainFrameImpl->frame()); } void WebFrameImpl::updateFindMatchRects() @@ -2193,44 +2079,41 @@ void WebFrameImpl::deliverIntent(const WebIntent& intent, WebMessagePortChannelA (*channels)[i] = MessagePortChannel::create(platformChannel); } } - OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(m_frame->document()), channels.release()); + OwnPtr<MessagePortArray> portArray = WebCore::MessagePort::entanglePorts(*(frame()->document()), channels.release()); - RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(m_frame, client.release(), intent.action(), intent.type(), intentData, portArray.release(), webcoreIntent->extras()); + RefPtr<DeliveredIntent> deliveredIntent = DeliveredIntent::create(frame(), client.release(), intent.action(), intent.type(), intentData, portArray.release(), webcoreIntent->extras()); - DOMWindowIntents::from(m_frame->document()->domWindow())->deliver(deliveredIntent.release()); + DOMWindowIntents::from(frame()->document()->domWindow())->deliver(deliveredIntent.release()); #endif } WebString WebFrameImpl::contentAsText(size_t maxChars) const { - if (!m_frame) + if (!frame()) return WebString(); - Vector<UChar> text; - frameContentAsPlainText(maxChars, m_frame, &text); + frameContentAsPlainText(maxChars, frame(), &text); return String::adopt(text); } WebString WebFrameImpl::contentAsMarkup() const { - return createFullMarkup(m_frame->document()); + if (!frame()) + return WebString(); + return createFullMarkup(frame()->document()); } WebString WebFrameImpl::renderTreeAsText(RenderAsTextControls toShow) const { RenderAsTextBehavior behavior = RenderAsTextBehaviorNormal; - if (toShow & RenderAsTextDebug) { - behavior |= RenderAsTextShowCompositedLayers - | RenderAsTextShowAddresses - | RenderAsTextShowIDAndClass - | RenderAsTextShowLayerNesting; - } + if (toShow & RenderAsTextDebug) + behavior |= RenderAsTextShowCompositedLayers | RenderAsTextShowAddresses | RenderAsTextShowIDAndClass | RenderAsTextShowLayerNesting; if (toShow & RenderAsTextPrinting) behavior |= RenderAsTextPrintingMode; - return externalRepresentation(m_frame, behavior); + return externalRepresentation(frame(), behavior); } WebString WebFrameImpl::markerTextForListItem(const WebElement& webElement) const @@ -2240,36 +2123,34 @@ WebString WebFrameImpl::markerTextForListItem(const WebElement& webElement) cons void WebFrameImpl::printPagesWithBoundaries(WebCanvas* canvas, const WebSize& pageSizeInPixels) { - ASSERT(m_printContext.get()); + ASSERT(m_printContext); GraphicsContextBuilder builder(canvas); GraphicsContext& graphicsContext = builder.context(); graphicsContext.platformContext()->setPrinting(true); - m_printContext->spoolAllPagesWithBoundaries(graphicsContext, - FloatSize(pageSizeInPixels.width, pageSizeInPixels.height)); + m_printContext->spoolAllPagesWithBoundaries(graphicsContext, FloatSize(pageSizeInPixels.width, pageSizeInPixels.height)); } WebRect WebFrameImpl::selectionBoundsRect() const { - if (hasSelection()) - return IntRect(frame()->selection()->bounds(false)); - - return WebRect(); + return hasSelection() ? WebRect(IntRect(frame()->selection()->bounds(false))) : WebRect(); } bool WebFrameImpl::selectionStartHasSpellingMarkerFor(int from, int length) const { - if (!m_frame) + if (!frame()) return false; - return m_frame->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length); + return frame()->editor()->selectionStartHasMarkerFor(DocumentMarker::Spelling, from, length); } WebString WebFrameImpl::layerTreeAsText(bool showDebugInfo) const { - if (!m_frame) + if (!frame()) return WebString(); - return WebString(m_frame->layerTreeAsText(showDebugInfo)); + + LayerTreeFlags flags = showDebugInfo ? LayerTreeFlagsIncludeDebugInfo : 0; + return WebString(frame()->layerTreeAsText(flags)); } // WebFrameImpl public --------------------------------------------------------- @@ -2280,9 +2161,9 @@ PassRefPtr<WebFrameImpl> WebFrameImpl::create(WebFrameClient* client) } WebFrameImpl::WebFrameImpl(WebFrameClient* client) - : m_frameLoaderClient(this) + : FrameDestructionObserver(0) + , m_frameLoaderClient(this) , m_client(client) - , m_frame(0) , m_currentActiveMatchFrame(0) , m_activeMatchIndexInCurrentFrame(-1) , m_locatingActiveRect(false) @@ -2290,7 +2171,8 @@ WebFrameImpl::WebFrameImpl(WebFrameClient* client) , m_lastMatchCount(-1) , m_totalMatchCount(-1) , m_framesScopingCount(-1) - , m_scopingComplete(false) + , m_findRequestIdentifier(-1) + , m_scopingInProgress(false) , m_lastFindRequestCompletedWithNoMatches(false) , m_nextInvalidateAfter(0) , m_findMatchMarkersVersion(0) @@ -2311,10 +2193,16 @@ WebFrameImpl::~WebFrameImpl() cancelPendingScopingEffort(); } +void WebFrameImpl::setWebCoreFrame(WebCore::Frame* frame) +{ + ASSERT(frame); + observeFrame(frame); +} + void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) { - RefPtr<Frame> frame = Frame::create(page, 0, &m_frameLoaderClient); - m_frame = frame.get(); + RefPtr<Frame> mainFrame = Frame::create(page, 0, &m_frameLoaderClient); + setWebCoreFrame(mainFrame.get()); // Add reference on behalf of FrameLoader. See comments in // WebFrameLoaderClient::frameLoaderDestroyed for more info. @@ -2322,11 +2210,10 @@ void WebFrameImpl::initializeAsMainFrame(WebCore::Page* page) // We must call init() after m_frame is assigned because it is referenced // during init(). - m_frame->init(); + frame()->init(); } -PassRefPtr<Frame> WebFrameImpl::createChildFrame( - const FrameLoadRequest& request, HTMLFrameOwnerElement* ownerElement) +PassRefPtr<Frame> WebFrameImpl::createChildFrame(const FrameLoadRequest& request, HTMLFrameOwnerElement* ownerElement) { RefPtr<WebFrameImpl> webframe(adoptRef(new WebFrameImpl(m_client))); @@ -2335,13 +2222,12 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame( // of this file for more info. webframe->ref(); - RefPtr<Frame> childFrame = Frame::create( - m_frame->page(), ownerElement, &webframe->m_frameLoaderClient); - webframe->m_frame = childFrame.get(); + RefPtr<Frame> childFrame = Frame::create(frame()->page(), ownerElement, &webframe->m_frameLoaderClient); + webframe->setWebCoreFrame(childFrame.get()); childFrame->tree()->setName(request.frameName()); - m_frame->tree()->appendChild(childFrame); + frame()->tree()->appendChild(childFrame); // Frame::init() can trigger onload event in the parent frame, // which may detach this frame and trigger a null-pointer access @@ -2356,10 +2242,7 @@ PassRefPtr<Frame> WebFrameImpl::createChildFrame( if (!childFrame->tree()->parent()) return 0; - m_frame->loader()->loadURLIntoChildFrame( - request.resourceRequest().url(), - request.resourceRequest().httpReferrer(), - childFrame.get()); + frame()->loader()->loadURLIntoChildFrame(request.resourceRequest().url(), request.resourceRequest().httpReferrer(), childFrame.get()); // A synchronous navigation (about:blank) would have already processed // onload, so it is possible for the frame to have already been destroyed by @@ -2384,13 +2267,13 @@ void WebFrameImpl::didChangeContentsSize(const IntSize& size) void WebFrameImpl::createFrameView() { - ASSERT(m_frame); // If m_frame doesn't exist, we probably didn't init properly. + ASSERT(frame()); // If frame() doesn't exist, we probably didn't init properly. WebViewImpl* webView = viewImpl(); - bool isMainFrame = webView->mainFrameImpl()->frame() == m_frame; - m_frame->createView(webView->size(), Color::white, webView->isTransparent(), webView->fixedLayoutSize(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0); + bool isMainFrame = webView->mainFrameImpl()->frame() == frame(); + frame()->createView(webView->size(), Color::white, webView->isTransparent(), webView->fixedLayoutSize(), isMainFrame ? webView->isFixedLayoutModeEnabled() : 0); if (webView->shouldAutoResize() && isMainFrame) - m_frame->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize()); + frame()->view()->enableAutoSizeMode(true, webView->minAutoSize(), webView->maxAutoSize()); if (isMainFrame && webView->devToolsAgentPrivate()) webView->devToolsAgentPrivate()->mainFrameViewCreated(this); @@ -2400,29 +2283,23 @@ WebFrameImpl* WebFrameImpl::fromFrame(Frame* frame) { if (!frame) return 0; - return static_cast<FrameLoaderClientImpl*>(frame->loader()->client())->webFrame(); } WebFrameImpl* WebFrameImpl::fromFrameOwnerElement(Element* element) { - if (!element - || !element->isFrameOwnerElement() - || (!element->hasTagName(HTMLNames::iframeTag) - && !element->hasTagName(HTMLNames::frameTag))) + // FIXME: Why do we check specifically for <iframe> and <frame> here? Why can't we get the WebFrameImpl from an <object> element, for example. + if (!element || !element->isFrameOwnerElement() || (!element->hasTagName(HTMLNames::iframeTag) && !element->hasTagName(HTMLNames::frameTag))) return 0; - - HTMLFrameOwnerElement* frameElement = - static_cast<HTMLFrameOwnerElement*>(element); + HTMLFrameOwnerElement* frameElement = static_cast<HTMLFrameOwnerElement*>(element); return fromFrame(frameElement->contentFrame()); } WebViewImpl* WebFrameImpl::viewImpl() const { - if (!m_frame) + if (!frame()) return 0; - - return WebViewImpl::fromPage(m_frame->page()); + return WebViewImpl::fromPage(frame()->page()); } WebDataSourceImpl* WebFrameImpl::dataSourceImpl() const @@ -2508,14 +2385,7 @@ void WebFrameImpl::didFail(const ResourceError& error, bool wasProvisional) void WebFrameImpl::setCanHaveScrollbars(bool canHaveScrollbars) { - m_frame->view()->setCanHaveScrollbars(canHaveScrollbars); -} - -// WebFrameImpl private -------------------------------------------------------- - -void WebFrameImpl::closing() -{ - m_frame = 0; + frame()->view()->setCanHaveScrollbars(canHaveScrollbars); } void WebFrameImpl::invalidateArea(AreaToInvalidate area) @@ -2553,7 +2423,6 @@ void WebFrameImpl::setMarkerActive(Range* range, bool active) WebCore::ExceptionCode ec; if (!range || range->collapsed(ec)) return; - frame()->document()->markers()->setMarkersActive(range, active); } @@ -2563,9 +2432,7 @@ int WebFrameImpl::ordinalOfFirstMatchForFrame(WebFrameImpl* frame) const WebFrameImpl* mainFrameImpl = viewImpl()->mainFrameImpl(); // Iterate from the main frame up to (but not including) |frame| and // add up the number of matches found so far. - for (WebFrameImpl* it = mainFrameImpl; - it != frame; - it = static_cast<WebFrameImpl*>(it->traverseNext(true))) { + for (WebFrameImpl* it = mainFrameImpl; it != frame; it = static_cast<WebFrameImpl*>(it->traverseNext(true))) { if (it->m_lastMatchCount > 0) ordinal += it->m_lastMatchCount; } @@ -2576,7 +2443,8 @@ bool WebFrameImpl::shouldScopeMatches(const String& searchText) { // Don't scope if we can't find a frame or a view. // The user may have closed the tab/application, so abort. - if (!frame() || !frame()->view()) + // Also ignore detached frames, as many find operations report to the main frame. + if (!frame() || !frame()->view() || !frame()->page()) return false; ASSERT(frame()->document() && frame()->view()); @@ -2596,19 +2464,14 @@ bool WebFrameImpl::shouldScopeMatches(const String& searchText) return true; } -void WebFrameImpl::scopeStringMatchesSoon(int identifier, const WebString& searchText, - const WebFindOptions& options, bool reset) +void WebFrameImpl::scopeStringMatchesSoon(int identifier, const WebString& searchText, const WebFindOptions& options, bool reset) { - m_deferredScopingWork.append(new DeferredScopeStringMatches( - this, identifier, searchText, options, reset)); + m_deferredScopingWork.append(new DeferredScopeStringMatches(this, identifier, searchText, options, reset)); } -void WebFrameImpl::callScopeStringMatches(DeferredScopeStringMatches* caller, - int identifier, const WebString& searchText, - const WebFindOptions& options, bool reset) +void WebFrameImpl::callScopeStringMatches(DeferredScopeStringMatches* caller, int identifier, const WebString& searchText, const WebFindOptions& options, bool reset) { m_deferredScopingWork.remove(m_deferredScopingWork.find(caller)); - scopeStringMatches(identifier, searchText, options, reset); // This needs to happen last since searchText is passed by reference. @@ -2617,21 +2480,22 @@ void WebFrameImpl::callScopeStringMatches(DeferredScopeStringMatches* caller, void WebFrameImpl::invalidateIfNecessary() { - if (m_lastMatchCount > m_nextInvalidateAfter) { - // FIXME: (http://b/1088165) Optimize the drawing of the tickmarks and - // remove this. This calculation sets a milestone for when next to - // invalidate the scrollbar and the content area. We do this so that we - // don't spend too much time drawing the scrollbar over and over again. - // Basically, up until the first 500 matches there is no throttle. - // After the first 500 matches, we set set the milestone further and - // further out (750, 1125, 1688, 2K, 3K). - static const int startSlowingDownAfter = 500; - static const int slowdown = 750; - int i = (m_lastMatchCount / startSlowingDownAfter); - m_nextInvalidateAfter += i * slowdown; - - invalidateArea(InvalidateScrollbar); - } + if (m_lastMatchCount <= m_nextInvalidateAfter) + return; + + // FIXME: (http://b/1088165) Optimize the drawing of the tickmarks and + // remove this. This calculation sets a milestone for when next to + // invalidate the scrollbar and the content area. We do this so that we + // don't spend too much time drawing the scrollbar over and over again. + // Basically, up until the first 500 matches there is no throttle. + // After the first 500 matches, we set set the milestone further and + // further out (750, 1125, 1688, 2K, 3K). + static const int startSlowingDownAfter = 500; + static const int slowdown = 750; + + int i = m_lastMatchCount / startSlowingDownAfter; + m_nextInvalidateAfter += i * slowdown; + invalidateArea(InvalidateScrollbar); } void WebFrameImpl::loadJavaScriptURL(const KURL& url) @@ -2644,24 +2508,41 @@ void WebFrameImpl::loadJavaScriptURL(const KURL& url) // location change. We also allow a JS URL to be loaded even if scripts on // the page are otherwise disabled. - if (!m_frame->document() || !m_frame->page()) + if (!frame()->document() || !frame()->page()) return; - RefPtr<Document> ownerDocument(m_frame->document()); + RefPtr<Document> ownerDocument(frame()->document()); // Protect privileged pages against bookmarklets and other javascript manipulations. - if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(m_frame->document()->url().protocol())) + if (SchemeRegistry::shouldTreatURLSchemeAsNotAllowingJavascriptURLs(frame()->document()->url().protocol())) return; String script = decodeURLEscapeSequences(url.string().substring(strlen("javascript:"))); - ScriptValue result = m_frame->script()->executeScript(script, true); + ScriptValue result = frame()->script()->executeScript(script, true); String scriptResult; if (!result.getString(scriptResult)) return; - if (!m_frame->navigationScheduler()->locationChangePending()) - m_frame->document()->loader()->writer()->replaceDocument(scriptResult, ownerDocument.get()); + if (!frame()->navigationScheduler()->locationChangePending()) + frame()->document()->loader()->writer()->replaceDocument(scriptResult, ownerDocument.get()); +} + +void WebFrameImpl::willDetachPage() +{ + if (!frame() || !frame()->page()) + return; + + // Do not expect string scoping results from any frames that got detached + // in the middle of the operation. + if (m_scopingInProgress) { + + // There is a possibility that the frame being detached was the only + // pending one. We need to make sure final replies can be sent. + flushCurrentScopingEffort(m_findRequestIdentifier); + + cancelPendingScopingEffort(); + } } } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebFrameImpl.h b/Source/WebKit/chromium/src/WebFrameImpl.h index a2fe797e3..2686aad1d 100644 --- a/Source/WebKit/chromium/src/WebFrameImpl.h +++ b/Source/WebKit/chromium/src/WebFrameImpl.h @@ -35,6 +35,7 @@ #include "WebFrame.h" #include "Frame.h" +#include "FrameDestructionObserver.h" #include "FrameLoaderClientImpl.h" #include <wtf/Compiler.h> #include <wtf/OwnPtr.h> @@ -69,10 +70,12 @@ struct WebPrintParams; template <typename T> class WebVector; // Implementation of WebFrame, note that this is a reference counted object. -class WebFrameImpl : public WebFrame, public RefCounted<WebFrameImpl> { +class WebFrameImpl + : public WebFrame + , public RefCounted<WebFrameImpl> + , public WebCore::FrameDestructionObserver { public: // WebFrame methods: - virtual WebString name() const; virtual WebString uniqueName() const; virtual WebString assignedName() const; virtual void setName(const WebString&); @@ -240,6 +243,9 @@ public: virtual bool selectionStartHasSpellingMarkerFor(int from, int length) const; virtual WebString layerTreeAsText(bool showDebugInfo = false) const; + // WebCore::FrameDestructionObserver methods. + virtual void willDetachPage(); + static PassRefPtr<WebFrameImpl> create(WebFrameClient* client); virtual ~WebFrameImpl(); @@ -262,8 +268,7 @@ public: WebViewImpl* viewImpl() const; - WebCore::Frame* frame() const { return m_frame; } - WebCore::FrameView* frameView() const { return m_frame ? m_frame->view() : 0; } + WebCore::FrameView* frameView() const { return frame() ? frame()->view() : 0; } // Getters for the impls corresponding to Get(Provisional)DataSource. They // may return 0 if there is no corresponding data source. @@ -325,11 +330,10 @@ private: InvalidateAll // Both content area and the scrollbar. }; - WebFrameImpl(WebFrameClient*); + explicit WebFrameImpl(WebFrameClient*); - // Informs the WebFrame that the Frame is being closed, called by the - // WebFrameLoaderClient - void closing(); + // Sets the local WebCore frame and registers destruction observers. + void setWebCoreFrame(WebCore::Frame*); // Notifies the delegate about a new selection rect. void reportFindInPageSelection( @@ -382,6 +386,11 @@ private: // was searched. bool shouldScopeMatches(const WTF::String& searchText); + // Removes the current frame from the global scoping effort and triggers any + // updates if appropriate. This method does not mark the scoping operation + // as finished. + void flushCurrentScopingEffort(int identifier); + // Finishes the current scoping effort and triggers any updates if appropriate. void finishCurrentScopingEffort(int identifier); @@ -407,10 +416,6 @@ private: WebFrameClient* m_client; - // This is a weak pointer to our corresponding WebCore frame. A reference to - // ourselves is held while frame_ is valid. See our Closing method. - WebCore::Frame* m_frame; - // A way for the main frame to keep track of which frame has an active // match. Should be 0 for all other frames. WebFrameImpl* m_currentActiveMatchFrame; @@ -438,8 +443,7 @@ private: // Keeps track of how many matches this frame has found so far, so that we // don't loose count between scoping efforts, and is also used (in conjunction - // with m_lastSearchString and m_scopingComplete) to figure out if we need to - // search the frame again. + // with m_lastSearchString) to figure out if we need to search the frame again. int m_lastMatchCount; // This variable keeps a cumulative total of matches found so far for ALL the @@ -452,9 +456,12 @@ private: // It should be -1 for all other frames. int m_framesScopingCount; - // Keeps track of whether the scoping effort was completed (the user may - // interrupt it before it completes by submitting a new search). - bool m_scopingComplete; + // Identifier of the latest find-in-page request. Required to be stored in + // the frame in order to reply if required in case the frame is detached. + int m_findRequestIdentifier; + + // Keeps track of whether there is an scoping effort ongoing in the frame. + bool m_scopingInProgress; // Keeps track of whether the last find request completed its scoping effort // without finding any matches in this frame. diff --git a/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp b/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp index a7948a78e..21021ed37 100644 --- a/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp +++ b/Source/WebKit/chromium/src/WebGeolocationClientMock.cpp @@ -41,7 +41,7 @@ #include "WebGeolocationError.h" #include "WebGeolocationPermissionRequest.h" #include "WebGeolocationPosition.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebGeolocationError.cpp b/Source/WebKit/chromium/src/WebGeolocationError.cpp index 3869468c8..aa6e0d7fc 100644 --- a/Source/WebKit/chromium/src/WebGeolocationError.cpp +++ b/Source/WebKit/chromium/src/WebGeolocationError.cpp @@ -27,7 +27,7 @@ #include "WebGeolocationError.h" #include "GeolocationError.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp b/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp index 6d7ec631a..533f6bc11 100644 --- a/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp +++ b/Source/WebKit/chromium/src/WebGeolocationPermissionRequest.cpp @@ -31,7 +31,7 @@ #include "Geolocation.h" #include "SecurityOrigin.h" #include "WebSecurityOrigin.h" -#include "platform/WebURL.h" +#include <public/WebURL.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp b/Source/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp index 4c0ed9cd7..1eeac667b 100644 --- a/Source/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp +++ b/Source/WebKit/chromium/src/WebGeolocationPermissionRequestManager.cpp @@ -64,7 +64,7 @@ bool WebGeolocationPermissionRequestManager::remove(const WebKit::WebGeolocation GeolocationIdMap::iterator it = m_private->m_geolocationIdMap.find(geolocation); if (it == m_private->m_geolocationIdMap.end()) return false; - id = it->second; + id = it->value; m_private->m_geolocationIdMap.remove(it); m_private->m_idGeolocationMap.remove(id); return true; @@ -75,7 +75,7 @@ bool WebGeolocationPermissionRequestManager::remove(int id, WebKit::WebGeolocati IdGeolocationMap::iterator it = m_private->m_idGeolocationMap.find(id); if (it == m_private->m_idGeolocationMap.end()) return false; - Geolocation* geolocation = it->second; + Geolocation* geolocation = it->value; permissionRequest = WebGeolocationPermissionRequest(geolocation); m_private->m_idGeolocationMap.remove(it); m_private->m_geolocationIdMap.remove(geolocation); diff --git a/Source/WebKit/chromium/src/WebHistoryItem.cpp b/Source/WebKit/chromium/src/WebHistoryItem.cpp index 31d2bd564..976594c9c 100644 --- a/Source/WebKit/chromium/src/WebHistoryItem.cpp +++ b/Source/WebKit/chromium/src/WebHistoryItem.cpp @@ -36,12 +36,11 @@ #include "HistoryItem.h" #include "KURL.h" #include "SerializedScriptValue.h" - -#include "platform/WebHTTPBody.h" -#include "platform/WebPoint.h" #include "platform/WebSerializedScriptValue.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" +#include <public/WebHTTPBody.h> +#include <public/WebPoint.h> +#include <public/WebString.h> +#include <public/WebVector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebHitTestResult.cpp b/Source/WebKit/chromium/src/WebHitTestResult.cpp index 5f806b80c..a839fb63e 100644 --- a/Source/WebKit/chromium/src/WebHitTestResult.cpp +++ b/Source/WebKit/chromium/src/WebHitTestResult.cpp @@ -33,8 +33,7 @@ #include "RenderObject.h" #include "VisiblePosition.h" #include "WebNode.h" - -#include "platform/WebPoint.h" +#include <public/WebPoint.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp index b58cd5111..e71029deb 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.cpp @@ -60,9 +60,9 @@ WebIDBMetadata WebIDBDatabaseImpl::metadata() const return m_databaseBackend->metadata(); } -WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec) +WebIDBObjectStore* WebIDBDatabaseImpl::createObjectStore(long long id, const WebString& name, const WebIDBKeyPath& keyPath, bool autoIncrement, const WebIDBTransaction& transaction, WebExceptionCode& ec) { - RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface(), ec); + RefPtr<IDBObjectStoreBackendInterface> objectStore = m_databaseBackend->createObjectStore(id, name, keyPath, autoIncrement, transaction.getIDBTransactionBackendInterface(), ec); if (!objectStore) { ASSERT(ec); return 0; diff --git a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h index 518ffcdb9..769bdf5d0 100644 --- a/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h +++ b/Source/WebKit/chromium/src/WebIDBDatabaseImpl.h @@ -52,7 +52,7 @@ public: virtual WebIDBMetadata metadata() const; - virtual WebIDBObjectStore* createObjectStore(const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&); + virtual WebIDBObjectStore* createObjectStore(long long, const WebString& name, const WebIDBKeyPath&, bool autoIncrement, const WebIDBTransaction&, WebExceptionCode&); virtual void deleteObjectStore(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); virtual void setVersion(const WebString& version, WebIDBCallbacks*, WebExceptionCode&); virtual WebIDBTransaction* transaction(const WebDOMStringList& names, unsigned short mode, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp index b094e77bd..c78b3d98e 100644 --- a/Source/WebKit/chromium/src/WebIDBKeyPath.cpp +++ b/Source/WebKit/chromium/src/WebIDBKeyPath.cpp @@ -30,7 +30,7 @@ #include "IDBKeyPath.h" #include "platform/WebString.h" -#include "platform/WebVector.h" +#include <public/WebVector.h> #include <wtf/Vector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebIDBMetadata.cpp b/Source/WebKit/chromium/src/WebIDBMetadata.cpp index 01d878a0a..dd1c2c8e5 100644 --- a/Source/WebKit/chromium/src/WebIDBMetadata.cpp +++ b/Source/WebKit/chromium/src/WebIDBMetadata.cpp @@ -31,7 +31,7 @@ #include "IDBMetadata.h" #include "WebIDBKeyPath.h" #include "platform/WebString.h" -#include "platform/WebVector.h" +#include <public/WebVector.h> using namespace WebCore; @@ -43,19 +43,21 @@ WebIDBMetadata::WebIDBMetadata(const WebCore::IDBDatabaseMetadata& metadata) version = metadata.version; intVersion = metadata.intVersion; objectStores = WebVector<ObjectStore>(static_cast<size_t>(metadata.objectStores.size())); + maxObjectStoreId = metadata.maxObjectStoreId; size_t i = 0; for (IDBDatabaseMetadata::ObjectStoreMap::const_iterator storeIterator = metadata.objectStores.begin(); storeIterator != metadata.objectStores.end(); ++storeIterator) { - const IDBObjectStoreMetadata& objectStore = storeIterator->second; + const IDBObjectStoreMetadata& objectStore = storeIterator->value; ObjectStore webObjectStore; webObjectStore.name = objectStore.name; webObjectStore.keyPath = objectStore.keyPath; webObjectStore.autoIncrement = objectStore.autoIncrement; webObjectStore.indexes = WebVector<Index>(static_cast<size_t>(objectStore.indexes.size())); + webObjectStore.maxIndexId = objectStore.maxIndexId; size_t j = 0; for (IDBObjectStoreMetadata::IndexMap::const_iterator indexIterator = objectStore.indexes.begin(); indexIterator != objectStore.indexes.end(); ++indexIterator) { - const IDBIndexMetadata& index = indexIterator->second; + const IDBIndexMetadata& index = indexIterator->value; Index webIndex; webIndex.name = index.name; webIndex.keyPath = index.keyPath; @@ -69,14 +71,14 @@ WebIDBMetadata::WebIDBMetadata(const WebCore::IDBDatabaseMetadata& metadata) WebIDBMetadata::operator IDBDatabaseMetadata() const { - IDBDatabaseMetadata db(name, version, intVersion); + IDBDatabaseMetadata db(name, id, version, intVersion, maxObjectStoreId); for (size_t i = 0; i < objectStores.size(); ++i) { const ObjectStore webObjectStore = objectStores[i]; - IDBObjectStoreMetadata objectStore(webObjectStore.name, webObjectStore.keyPath, webObjectStore.autoIncrement); + IDBObjectStoreMetadata objectStore(webObjectStore.name, webObjectStore.id, webObjectStore.keyPath, webObjectStore.autoIncrement, webObjectStore.maxIndexId); for (size_t j = 0; j < webObjectStore.indexes.size(); ++j) { const Index webIndex = webObjectStore.indexes[j]; - IDBIndexMetadata index(webIndex.name, webIndex.keyPath, webIndex.unique, webIndex.multiEntry); + IDBIndexMetadata index(webIndex.name, webIndex.id, webIndex.keyPath, webIndex.unique, webIndex.multiEntry); objectStore.indexes.set(index.name, index); } db.objectStores.set(objectStore.name, objectStore); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp index f5dd913c9..d814093f0 100755 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.cpp @@ -109,9 +109,9 @@ void WebIDBObjectStoreImpl::clear(WebIDBCallbacks* callbacks, const WebIDBTransa m_objectStore->clear(IDBCallbacksProxy::create(adoptPtr(callbacks)), transaction.getIDBTransactionBackendInterface(), ec); } -WebIDBIndex* WebIDBObjectStoreImpl::createIndex(const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) +WebIDBIndex* WebIDBObjectStoreImpl::createIndex(long long id, const WebString& name, const WebIDBKeyPath& keyPath, bool unique, bool multiEntry, const WebIDBTransaction& transaction, WebExceptionCode& ec) { - RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(name, keyPath, unique, multiEntry, transaction.getIDBTransactionBackendInterface(), ec); + RefPtr<IDBIndexBackendInterface> index = m_objectStore->createIndex(id, name, keyPath, unique, multiEntry, transaction.getIDBTransactionBackendInterface(), ec); if (!index) return 0; return new WebIDBIndexImpl(index); diff --git a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h index 04020e558..7e9ed2573 100644 --- a/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h +++ b/Source/WebKit/chromium/src/WebIDBObjectStoreImpl.h @@ -52,7 +52,7 @@ public: void deleteFunction(const WebIDBKeyRange&, WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); void clear(WebIDBCallbacks*, const WebIDBTransaction&, WebExceptionCode&); - WebIDBIndex* createIndex(const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry, const WebIDBTransaction&, WebExceptionCode&); + WebIDBIndex* createIndex(long long, const WebString& name, const WebIDBKeyPath&, bool unique, bool multiEntry, const WebIDBTransaction&, WebExceptionCode&); WebIDBIndex* index(const WebString& name, WebExceptionCode&); void deleteIndex(const WebString& name, const WebIDBTransaction&, WebExceptionCode&); diff --git a/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp b/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp index 2f16477d2..4d41e9fc6 100644 --- a/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp +++ b/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.cpp @@ -28,7 +28,9 @@ #if ENABLE(INDEXED_DATABASE) +#include "IDBDatabaseError.h" #include "IDBTransactionCallbacks.h" +#include "WebIDBDatabaseError.h" using namespace WebCore; @@ -43,9 +45,9 @@ WebIDBTransactionCallbacksImpl::~WebIDBTransactionCallbacksImpl() { } -void WebIDBTransactionCallbacksImpl::onAbort() +void WebIDBTransactionCallbacksImpl::onAbort(const WebIDBDatabaseError& error) { - m_callbacks->onAbort(); + m_callbacks->onAbort(error); } void WebIDBTransactionCallbacksImpl::onComplete() diff --git a/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h b/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h index 8acb09550..5fc843c3b 100644 --- a/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h +++ b/Source/WebKit/chromium/src/WebIDBTransactionCallbacksImpl.h @@ -41,7 +41,7 @@ public: WebIDBTransactionCallbacksImpl(PassRefPtr<WebCore::IDBTransactionCallbacks>); virtual ~WebIDBTransactionCallbacksImpl(); - virtual void onAbort(); + virtual void onAbort(const WebIDBDatabaseError&); virtual void onComplete(); private: diff --git a/Source/WebKit/chromium/src/WebIDBTransactionImpl.h b/Source/WebKit/chromium/src/WebIDBTransactionImpl.h index 323e2be59..66e315300 100644 --- a/Source/WebKit/chromium/src/WebIDBTransactionImpl.h +++ b/Source/WebKit/chromium/src/WebIDBTransactionImpl.h @@ -28,8 +28,8 @@ #if ENABLE(INDEXED_DATABASE) -#include "platform/WebCommon.h" #include "WebIDBTransaction.h" +#include <public/WebCommon.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h b/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h index d6d66db56..305db8f3c 100644 --- a/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h +++ b/Source/WebKit/chromium/src/WebIconLoadingCompletionImpl.h @@ -32,8 +32,8 @@ #define WebIconLoadingCompletionImpl_h #include "FileIconLoader.h" -#include "platform/WebData.h" #include "WebIconLoadingCompletion.h" +#include <public/WebData.h> #include <wtf/PassRefPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/WebImageDecoder.cpp b/Source/WebKit/chromium/src/WebImageDecoder.cpp index ad0a67e51..104ab13fb 100644 --- a/Source/WebKit/chromium/src/WebImageDecoder.cpp +++ b/Source/WebKit/chromium/src/WebImageDecoder.cpp @@ -34,14 +34,11 @@ #include "BMPImageDecoder.h" #include "ICOImageDecoder.h" #include "SharedBuffer.h" -#include "platform/WebData.h" -#include "platform/WebSize.h" - +#include <public/WebData.h> #include <public/WebImage.h> - +#include <public/WebSize.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> - #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebImageSkia.cpp b/Source/WebKit/chromium/src/WebImageSkia.cpp index 0198a6806..9e92f3189 100644 --- a/Source/WebKit/chromium/src/WebImageSkia.cpp +++ b/Source/WebKit/chromium/src/WebImageSkia.cpp @@ -34,12 +34,10 @@ #include "ImageDecoder.h" #include "NativeImageSkia.h" #include "SharedBuffer.h" - -#include "platform/WebData.h" -#include "platform/WebSize.h" - #include <algorithm> +#include <public/WebData.h> #include <public/WebImage.h> +#include <public/WebSize.h> #include <wtf/OwnPtr.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> @@ -125,7 +123,7 @@ WebVector<WebImage> WebImage::framesFromData(const WebData& data) continue; OwnPtr<NativeImageSkia> image = adoptPtr(frame->asNewNativeImage()); - if (image.get()) + if (image.get() && image->isDataComplete()) frames.append(WebImage(image->bitmap())); } diff --git a/Source/WebKit/chromium/src/WebInputElement.cpp b/Source/WebKit/chromium/src/WebInputElement.cpp index 791b2ebff..bdc9f5db2 100644 --- a/Source/WebKit/chromium/src/WebInputElement.cpp +++ b/Source/WebKit/chromium/src/WebInputElement.cpp @@ -41,7 +41,7 @@ #include "TextFieldDecoratorImpl.h" #include "WebNodeCollection.h" #include "WebTextFieldDecoratorClient.h" -#include "platform/WebString.h" +#include <public/WebString.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.cpp b/Source/WebKit/chromium/src/WebInputEventConversion.cpp index 0cc1e0c24..0f4f6d5a8 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.cpp +++ b/Source/WebKit/chromium/src/WebInputEventConversion.cpp @@ -39,6 +39,7 @@ #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" #include "PlatformWheelEvent.h" +#include "RenderObject.h" #include "ScrollView.h" #include "Touch.h" #include "TouchEvent.h" @@ -207,7 +208,7 @@ PlatformGestureEventBuilder::PlatformGestureEventBuilder(Widget* widget, const W // MakePlatformKeyboardEvent -------------------------------------------------- -static inline PlatformEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) +inline PlatformEvent::Type toPlatformKeyboardEventType(WebInputEvent::Type type) { switch (type) { case WebInputEvent::KeyUp: @@ -300,7 +301,7 @@ bool PlatformKeyboardEventBuilder::isCharacterKey() const } #if ENABLE(TOUCH_EVENTS) -static inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type type) +inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent::Type type) { switch (type) { case WebInputEvent::TouchStart: @@ -317,7 +318,7 @@ static inline PlatformEvent::Type toPlatformTouchEventType(const WebInputEvent:: return PlatformEvent::TouchStart; } -static inline PlatformTouchPoint::State toPlatformTouchPointState(const WebTouchPoint::State state) +inline PlatformTouchPoint::State toPlatformTouchPointState(const WebTouchPoint::State state) { switch (state) { case WebTouchPoint::StateReleased: @@ -336,6 +337,19 @@ static inline PlatformTouchPoint::State toPlatformTouchPointState(const WebTouch return PlatformTouchPoint::TouchReleased; } +inline WebTouchPoint::State toWebTouchPointState(const AtomicString& type) +{ + if (type == eventNames().touchendEvent) + return WebTouchPoint::StateReleased; + if (type == eventNames().touchcancelEvent) + return WebTouchPoint::StateCancelled; + if (type == eventNames().touchstartEvent) + return WebTouchPoint::StatePressed; + if (type == eventNames().touchmoveEvent) + return WebTouchPoint::StateMoved; + return WebTouchPoint::StateUndefined; +} + PlatformTouchPointBuilder::PlatformTouchPointBuilder(Widget* widget, const WebTouchPoint& point) { m_id = point.id; @@ -383,7 +397,28 @@ static int getWebInputModifiers(const UIEventWithKeyState& event) return modifiers; } -WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEvent& event) +static IntPoint convertLocationForRenderObject(const LayoutPoint& location, const WebCore::RenderObject& renderObject) +{ + return roundedIntPoint(renderObject.absoluteToLocal(location, UseTransforms | SnapOffsetForTransforms)); +} + +static void updateWebMouseEventFromWebCoreMouseEvent(const MouseEvent& event, const Widget& widget, const WebCore::RenderObject& renderObject, WebMouseEvent& webEvent) +{ + webEvent.timeStampSeconds = event.timeStamp() / millisPerSecond; + webEvent.modifiers = getWebInputModifiers(event); + + ScrollView* view = widget.parent(); + IntPoint windowPoint = view->contentsToWindow(IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y())); + webEvent.globalX = event.screenX(); + webEvent.globalY = event.screenY(); + webEvent.windowX = windowPoint.x(); + webEvent.windowY = windowPoint.y(); + IntPoint localPoint = convertLocationForRenderObject(event.absoluteLocation(), renderObject); + webEvent.x = localPoint.x(); + webEvent.y = localPoint.y(); +} + +WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const MouseEvent& event) { if (event.type() == eventNames().mousemoveEvent) type = WebInputEvent::MouseMove; @@ -399,7 +434,9 @@ WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEven type = WebInputEvent::ContextMenu; else return; // Skip all other mouse events. - timeStampSeconds = event.timeStamp() / millisPerSecond; + + updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *this); + switch (event.button()) { case LeftButton: button = WebMouseEvent::ButtonLeft; @@ -411,7 +448,6 @@ WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEven button = WebMouseEvent::ButtonRight; break; } - modifiers = getWebInputModifiers(event); if (event.buttonDown()) { switch (event.button()) { case LeftButton: @@ -425,15 +461,6 @@ WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEven break; } } - ScrollView* view = widget->parent(); - IntPoint p = view->contentsToWindow( - IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y())); - globalX = event.screenX(); - globalY = event.screenY(); - windowX = p.x(); - windowY = p.y(); - x = event.absoluteLocation().x() - widget->location().x(); - y = event.absoluteLocation().y() - widget->location().y(); #if ENABLE(POINTER_LOCK) movementX = event.webkitMovementX(); movementY = event.webkitMovementY(); @@ -441,22 +468,12 @@ WebMouseEventBuilder::WebMouseEventBuilder(const Widget* widget, const MouseEven clickCount = event.detail(); } -WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const WheelEvent& event) +WebMouseWheelEventBuilder::WebMouseWheelEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const WheelEvent& event) { if (event.type() != eventNames().mousewheelEvent) return; type = WebInputEvent::MouseWheel; - timeStampSeconds = event.timeStamp() / millisPerSecond; - modifiers = getWebInputModifiers(event); - ScrollView* view = widget->parent(); - IntPoint p = view->contentsToWindow( - IntPoint(event.absoluteLocation().x(), event.absoluteLocation().y())); - globalX = event.screenX(); - globalY = event.screenY(); - windowX = p.x(); - windowY = p.y(); - x = event.absoluteLocation().x() - widget->location().x(); - y = event.absoluteLocation().y() - widget->location().y(); + updateWebMouseEventFromWebCoreMouseEvent(event, *widget, *renderObject, *this); deltaX = static_cast<float>(event.rawDeltaX()); deltaY = static_cast<float>(event.rawDeltaY()); // The 120 is from WheelEvent::initWheelEvent(). @@ -502,7 +519,7 @@ WebKeyboardEventBuilder::WebKeyboardEventBuilder(const KeyboardEvent& event) #if ENABLE(TOUCH_EVENTS) -static void addTouchPoints(TouchList* touches, const IntPoint& offset, WebTouchPoint* touchPoints, unsigned* touchPointsLength) +static void addTouchPoints(const AtomicString& touchType, TouchList* touches, WebTouchPoint* touchPoints, unsigned* touchPointsLength, const WebCore::RenderObject* renderObject) { unsigned numberOfTouches = std::min(touches->length(), static_cast<unsigned>(WebTouchEvent::touchesLengthCap)); for (unsigned i = 0; i < numberOfTouches; ++i) { @@ -511,18 +528,19 @@ static void addTouchPoints(TouchList* touches, const IntPoint& offset, WebTouchP WebTouchPoint point; point.id = touch->identifier(); point.screenPosition = WebPoint(touch->screenX(), touch->screenY()); - point.position = WebPoint(touch->pageX() - offset.x(), touch->pageY() - offset.y()); + point.position = convertLocationForRenderObject(LayoutPoint(IntPoint(touch->pageX(), touch->pageY())), *renderObject); point.radiusX = touch->webkitRadiusX(); point.radiusY = touch->webkitRadiusY(); point.rotationAngle = touch->webkitRotationAngle(); point.force = touch->webkitForce(); + point.state = toWebTouchPointState(touchType); touchPoints[i] = point; } *touchPointsLength = numberOfTouches; } -WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const TouchEvent& event) +WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const TouchEvent& event) { if (event.type() == eventNames().touchstartEvent) type = TouchStart; @@ -541,15 +559,15 @@ WebTouchEventBuilder::WebTouchEventBuilder(const Widget* widget, const TouchEven modifiers = getWebInputModifiers(event); timeStampSeconds = event.timeStamp() / millisPerSecond; - addTouchPoints(event.touches(), widget->location(), touches, &touchesLength); - addTouchPoints(event.changedTouches(), widget->location(), changedTouches, &changedTouchesLength); - addTouchPoints(event.targetTouches(), widget->location(), targetTouches, &targetTouchesLength); + addTouchPoints(event.type(), event.touches(), touches, &touchesLength, renderObject); + addTouchPoints(event.type(), event.changedTouches(), changedTouches, &changedTouchesLength, renderObject); + addTouchPoints(event.type(), event.targetTouches(), targetTouches, &targetTouchesLength, renderObject); } #endif // ENABLE(TOUCH_EVENTS) #if ENABLE(GESTURE_EVENTS) -WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const GestureEvent& event) +WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const WebCore::RenderObject* renderObject, const GestureEvent& event) { if (event.type() == eventNames().gesturetapEvent) type = GestureTap; @@ -570,8 +588,9 @@ WebGestureEventBuilder::WebGestureEventBuilder(const Widget* widget, const Gestu globalX = event.screenX(); globalY = event.screenY(); - x = event.absoluteLocation().x() - widget->location().x(); - y = event.absoluteLocation().y() - widget->location().y(); + IntPoint localPoint = convertLocationForRenderObject(event.absoluteLocation(), *renderObject); + x = localPoint.x(); + y = localPoint.y(); } #endif // ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit/chromium/src/WebInputEventConversion.h b/Source/WebKit/chromium/src/WebInputEventConversion.h index 48975a404..3512646eb 100644 --- a/Source/WebKit/chromium/src/WebInputEventConversion.h +++ b/Source/WebKit/chromium/src/WebInputEventConversion.h @@ -42,9 +42,10 @@ namespace WebCore { class GestureEvent; class KeyboardEvent; class MouseEvent; +class RenderObject; class ScrollView; -class WheelEvent; class TouchEvent; +class WheelEvent; class Widget; } @@ -97,21 +98,20 @@ public: }; #endif -// Converts a WebCore::MouseEvent to a corresponding WebMouseEvent. view is -// the ScrollView corresponding to the event. +// Converts a WebCore::MouseEvent to a corresponding WebMouseEvent. // NOTE: This is only implemented for mousemove, mouseover, mouseout, // mousedown and mouseup. If the event mapping fails, the event type will // be set to Undefined. class WebMouseEventBuilder : public WebMouseEvent { public: - WebMouseEventBuilder(const WebCore::Widget*, const WebCore::MouseEvent&); + WebMouseEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::MouseEvent&); }; // Converts a WebCore::WheelEvent to a corresponding WebMouseWheelEvent. // If the event mapping fails, the event type will be set to Undefined. class WebMouseWheelEventBuilder : public WebMouseWheelEvent { public: - WebMouseWheelEventBuilder(const WebCore::Widget*, const WebCore::WheelEvent&); + WebMouseWheelEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::WheelEvent&); }; // Converts a WebCore::KeyboardEvent to a corresponding WebKeyboardEvent. @@ -128,7 +128,7 @@ public: // exceeding that cap will be dropped. class WebTouchEventBuilder : public WebTouchEvent { public: - WebTouchEventBuilder(const WebCore::Widget*, const WebCore::TouchEvent&); + WebTouchEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::TouchEvent&); }; #endif // ENABLE(TOUCH_EVENTS) @@ -137,7 +137,7 @@ public: // NOTE: If event mapping fails, the type will be set to Undefined. class WebGestureEventBuilder : public WebGestureEvent { public: - WebGestureEventBuilder(const WebCore::Widget*, const WebCore::GestureEvent&); + WebGestureEventBuilder(const WebCore::Widget*, const WebCore::RenderObject*, const WebCore::GestureEvent&); }; #endif // ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit/chromium/src/WebIntent.cpp b/Source/WebKit/chromium/src/WebIntent.cpp index 55775ecfc..041c7f2e9 100644 --- a/Source/WebKit/chromium/src/WebIntent.cpp +++ b/Source/WebKit/chromium/src/WebIntent.cpp @@ -188,7 +188,7 @@ WebString WebIntent::extrasValue(const WebString& name) const WTF::HashMap<String, String>::const_iterator val = m_private->extras().find(name); if (val == m_private->extras().end()) return WebString(); - return val->second; + return val->value; #else return WebString(); #endif diff --git a/Source/WebKit/chromium/src/WebKit.cpp b/Source/WebKit/chromium/src/WebKit.cpp index 9331d053a..e357f28e4 100644 --- a/Source/WebKit/chromium/src/WebKit.cpp +++ b/Source/WebKit/chromium/src/WebKit.cpp @@ -44,10 +44,10 @@ #include "WebSocket.h" #include "WorkerContextExecutionProxy.h" #include "platform/WebKitPlatformSupport.h" -#include "platform/WebThread.h" #include "v8.h" #include <public/Platform.h> #include <public/WebPrerenderingSupport.h> +#include <public/WebThread.h> #include <wtf/Assertions.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> diff --git a/Source/WebKit/chromium/src/WebLabelElement.cpp b/Source/WebKit/chromium/src/WebLabelElement.cpp index 15ef3bbe3..4480ae89d 100644 --- a/Source/WebKit/chromium/src/WebLabelElement.cpp +++ b/Source/WebKit/chromium/src/WebLabelElement.cpp @@ -33,7 +33,7 @@ #include "HTMLLabelElement.h" #include "HTMLNames.h" -#include "platform/WebString.h" +#include <public/WebString.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebMediaStreamRegistry.cpp b/Source/WebKit/chromium/src/WebMediaStreamRegistry.cpp index 7ec559d24..d1ad60620 100644 --- a/Source/WebKit/chromium/src/WebMediaStreamRegistry.cpp +++ b/Source/WebKit/chromium/src/WebMediaStreamRegistry.cpp @@ -37,9 +37,9 @@ #include "KURL.h" #include "MediaStreamDescriptor.h" #include "MediaStreamRegistry.h" -#include "platform/WebMediaStreamDescriptor.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebMediaStreamDescriptor.h> +#include <public/WebString.h> +#include <public/WebURL.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebNode.cpp b/Source/WebKit/chromium/src/WebNode.cpp index c5e836d4a..27d57cfbc 100644 --- a/Source/WebKit/chromium/src/WebNode.cpp +++ b/Source/WebKit/chromium/src/WebNode.cpp @@ -37,7 +37,6 @@ #include "FrameLoaderClientImpl.h" #include "Node.h" #include "NodeList.h" - #include "EventListenerWrapper.h" #include "WebDOMEvent.h" #include "WebDOMEventListener.h" @@ -45,10 +44,9 @@ #include "WebElement.h" #include "WebFrameImpl.h" #include "WebNodeList.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" - #include "markup.h" +#include <public/WebString.h> +#include <public/WebVector.h> using namespace WebCore; @@ -225,6 +223,13 @@ bool WebNode::focused() const return m_private->focused(); } +bool WebNode::remove() +{ + ExceptionCode exceptionCode = 0; + m_private->remove(exceptionCode); + return !exceptionCode; +} + bool WebNode::hasNonEmptyBoundingBox() const { m_private->document()->updateLayoutIgnorePendingStylesheets(); diff --git a/Source/WebKit/chromium/src/WebNotification.cpp b/Source/WebKit/chromium/src/WebNotification.cpp index 54209fd97..c8fe815c4 100644 --- a/Source/WebKit/chromium/src/WebNotification.cpp +++ b/Source/WebKit/chromium/src/WebNotification.cpp @@ -37,11 +37,9 @@ #include "Notification.h" #include "UserGestureIndicator.h" #include "WindowFocusAllowedIndicator.h" - -#include "platform/WebString.h" #include "WebTextDirection.h" -#include "platform/WebURL.h" - +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebOptionElement.cpp b/Source/WebKit/chromium/src/WebOptionElement.cpp index 1d50a053e..b511697b4 100644 --- a/Source/WebKit/chromium/src/WebOptionElement.cpp +++ b/Source/WebKit/chromium/src/WebOptionElement.cpp @@ -34,7 +34,7 @@ #include "HTMLNames.h" #include "HTMLOptionElement.h" #include "HTMLSelectElement.h" -#include "platform/WebString.h" +#include <public/WebString.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp index 1e0fcebb5..e4808fd70 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.cpp +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.cpp @@ -151,15 +151,14 @@ WebPagePopupImpl::~WebPagePopupImpl() ASSERT(!m_page); } -bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient, const IntRect& originBoundsInRootView) +bool WebPagePopupImpl::init(WebViewImpl* webView, PagePopupClient* popupClient, const IntRect&) { ASSERT(webView); ASSERT(popupClient); m_webView = webView; m_popupClient = popupClient; - m_originBoundsInRootView = originBoundsInRootView; - reposition(m_popupClient->contentSize()); + resize(m_popupClient->contentSize()); if (!initPage()) return false; @@ -233,22 +232,10 @@ void WebPagePopupImpl::paint(WebCanvas* canvas, const WebRect& rect, PaintOption PageWidgetDelegate::paint(m_page.get(), 0, canvas, rect, PageWidgetDelegate::Opaque); } -void WebPagePopupImpl::reposition(const WebSize& popupSize) -{ - WebSize rootViewSize = m_webView->size(); - IntRect popupBoundsInRootView(IntPoint(max(0, m_originBoundsInRootView.x()), max(0, m_originBoundsInRootView.maxY())), popupSize); - if (popupBoundsInRootView.maxY() > rootViewSize.height) - popupBoundsInRootView.setY(max(0, m_originBoundsInRootView.y() - popupSize.height)); - if (popupBoundsInRootView.maxX() > rootViewSize.width) - popupBoundsInRootView.setX(max(0, rootViewSize.width - popupSize.width)); - IntRect boundsInScreen = m_webView->page()->chrome()->rootViewToScreen(popupBoundsInRootView); - m_widgetClient->setWindowRect(boundsInScreen); - m_windowRectInScreen = boundsInScreen; -} - void WebPagePopupImpl::resize(const WebSize& newSize) { - reposition(newSize); + m_windowRectInScreen = WebRect(m_windowRectInScreen.x, m_windowRectInScreen.y, newSize.width, newSize.height); + m_widgetClient->setWindowRect(m_windowRectInScreen); if (m_page) m_page->mainFrame()->view()->resize(newSize); diff --git a/Source/WebKit/chromium/src/WebPagePopupImpl.h b/Source/WebKit/chromium/src/WebPagePopupImpl.h index e6844bfd0..cf2bbba78 100644 --- a/Source/WebKit/chromium/src/WebPagePopupImpl.h +++ b/Source/WebKit/chromium/src/WebPagePopupImpl.h @@ -87,11 +87,9 @@ private: explicit WebPagePopupImpl(WebWidgetClient*); bool initPage(); - void reposition(const WebSize&); WebWidgetClient* m_widgetClient; WebRect m_windowRectInScreen; - WebCore::IntRect m_originBoundsInRootView; WebViewImpl* m_webView; OwnPtr<WebCore::Page> m_page; OwnPtr<PagePopupChromeClient> m_chromeClient; diff --git a/Source/WebKit/chromium/src/WebPageSerializer.cpp b/Source/WebKit/chromium/src/WebPageSerializer.cpp index 1d771fb00..6b4a4cbd3 100644 --- a/Source/WebKit/chromium/src/WebPageSerializer.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializer.cpp @@ -41,17 +41,16 @@ #include "KURL.h" #include "MHTMLArchive.h" #include "PageSerializer.h" -#include "platform/WebCString.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" -#include "platform/WebVector.h" #include "WebFrame.h" #include "WebFrameImpl.h" #include "WebPageSerializerClient.h" #include "WebPageSerializerImpl.h" #include "WebView.h" #include "WebViewImpl.h" - +#include <public/WebCString.h> +#include <public/WebString.h> +#include <public/WebURL.h> +#include <public/WebVector.h> #include <wtf/Vector.h> #include <wtf/text/StringConcatenate.h> diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp index 02a665a11..b03fbfc67 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.cpp @@ -91,11 +91,10 @@ #include "KURL.h" #include "TextEncoding.h" #include "markup.h" - #include "DOMUtilitiesPrivate.h" #include "WebFrameImpl.h" -#include "platform/WebURL.h" -#include "platform/WebVector.h" +#include <public/WebURL.h> +#include <public/WebVector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebPageSerializerImpl.h b/Source/WebKit/chromium/src/WebPageSerializerImpl.h index acc5b8102..e6cb9d735 100644 --- a/Source/WebKit/chromium/src/WebPageSerializerImpl.h +++ b/Source/WebKit/chromium/src/WebPageSerializerImpl.h @@ -41,8 +41,8 @@ #include "WebEntities.h" #include "WebPageSerializer.h" #include "WebPageSerializerClient.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebString.h> +#include <public/WebURL.h> namespace WebCore { class Document; diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp index 5c164319e..af23011ff 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.cpp @@ -33,6 +33,7 @@ #include "Chrome.h" #include "ChromeClientImpl.h" +#include "ClipboardChromium.h" #include "ScrollbarGroup.h" #include "WebCursorInfo.h" #include "WebDataSourceImpl.h" @@ -73,6 +74,7 @@ #include <public/Platform.h> #include <public/WebClipboard.h> #include <public/WebCompositorSupport.h> +#include <public/WebDragData.h> #include <public/WebExternalTextureLayer.h> #include <public/WebRect.h> #include <public/WebString.h> @@ -115,8 +117,13 @@ void WebPluginContainerImpl::paint(GraphicsContext* gc, const IntRect& damageRec if (!parent()) return; + FloatRect scaledDamageRect = damageRect; + float frameScaleFactor = m_element->document()->frame()->frameScaleFactor(); + scaledDamageRect.scale(frameScaleFactor); + scaledDamageRect.move(-frameRect().x() * (frameScaleFactor - 1), -frameRect().y() * (frameScaleFactor - 1)); + // Don't paint anything if the plugin doesn't intersect the damage rect. - if (!frameRect().intersects(damageRect)) + if (!frameRect().intersects(enclosingIntRect(scaledDamageRect))) return; gc->save(); @@ -132,7 +139,7 @@ void WebPluginContainerImpl::paint(GraphicsContext* gc, const IntRect& damageRec WebCanvas* canvas = gc->platformContext()->canvas(); IntRect windowRect = - IntRect(view->contentsToWindow(damageRect.location()), damageRect.size()); + IntRect(view->contentsToWindow(enclosingIntRect(scaledDamageRect).location()), enclosingIntRect(scaledDamageRect).size()); m_webPlugin->paint(canvas, windowRect); gc->restore(); @@ -653,11 +660,16 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) { ASSERT(parent()->isFrameView()); + if (event->isDragEvent()) { + handleDragEvent(event); + return; + } + // We cache the parent FrameView here as the plugin widget could be deleted // in the call to HandleEvent. See http://b/issue?id=1362948 FrameView* parentView = static_cast<FrameView*>(parent()); - WebMouseEventBuilder webEvent(this, *event); + WebMouseEventBuilder webEvent(this, m_element->renderer(), *event); if (webEvent.type == WebInputEvent::Undefined) return; @@ -696,9 +708,35 @@ void WebPluginContainerImpl::handleMouseEvent(MouseEvent* event) chromeClient->setCursorForPlugin(cursorInfo); } +void WebPluginContainerImpl::handleDragEvent(MouseEvent* event) +{ + ASSERT(event->isDragEvent()); + + WebDragStatus dragStatus = WebDragStatusUnknown; + if (event->type() == eventNames().dragenterEvent) + dragStatus = WebDragStatusEnter; + else if (event->type() == eventNames().dragleaveEvent) + dragStatus = WebDragStatusLeave; + else if (event->type() == eventNames().dragoverEvent) + dragStatus = WebDragStatusOver; + else if (event->type() == eventNames().dropEvent) + dragStatus = WebDragStatusDrop; + + if (dragStatus == WebDragStatusUnknown) + return; + + ClipboardChromium* clipboard = static_cast<ClipboardChromium*>(event->dataTransfer()); + WebDragData dragData = clipboard->dataObject(); + WebDragOperationsMask dragOperationMask = static_cast<WebDragOperationsMask>(clipboard->sourceOperation()); + WebPoint dragScreenLocation(event->screenX(), event->screenY()); + WebPoint dragLocation(event->absoluteLocation().x() - location().x(), event->absoluteLocation().y() - location().y()); + + m_webPlugin->handleDragStatusUpdate(dragStatus, dragData, dragOperationMask, dragLocation, dragScreenLocation); +} + void WebPluginContainerImpl::handleWheelEvent(WheelEvent* event) { - WebMouseWheelEventBuilder webEvent(this, *event); + WebMouseWheelEventBuilder webEvent(this, m_element->renderer(), *event); if (webEvent.type == WebInputEvent::Undefined) return; @@ -747,7 +785,9 @@ void WebPluginContainerImpl::handleKeyboardEvent(KeyboardEvent* event) void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) { - WebTouchEventBuilder webEvent(this, *event); + if (!m_isAcceptingTouchEvents) + return; + WebTouchEventBuilder webEvent(this, m_element->renderer(), *event); if (webEvent.type == WebInputEvent::Undefined) return; WebCursorInfo cursorInfo; @@ -758,7 +798,7 @@ void WebPluginContainerImpl::handleTouchEvent(TouchEvent* event) void WebPluginContainerImpl::handleGestureEvent(GestureEvent* event) { - WebGestureEventBuilder webEvent(this, *event); + WebGestureEventBuilder webEvent(this, m_element->renderer(), *event); if (webEvent.type == WebInputEvent::Undefined) return; WebCursorInfo cursorInfo; diff --git a/Source/WebKit/chromium/src/WebPluginContainerImpl.h b/Source/WebKit/chromium/src/WebPluginContainerImpl.h index e203a7370..e89af0987 100644 --- a/Source/WebKit/chromium/src/WebPluginContainerImpl.h +++ b/Source/WebKit/chromium/src/WebPluginContainerImpl.h @@ -165,6 +165,7 @@ private: ~WebPluginContainerImpl(); void handleMouseEvent(WebCore::MouseEvent*); + void handleDragEvent(WebCore::MouseEvent*); void handleWheelEvent(WebCore::WheelEvent*); void handleKeyboardEvent(WebCore::KeyboardEvent*); void handleTouchEvent(WebCore::TouchEvent*); diff --git a/Source/WebKit/chromium/src/WebPluginListBuilderImpl.cpp b/Source/WebKit/chromium/src/WebPluginListBuilderImpl.cpp index 5c6b6fced..acfb882a4 100644 --- a/Source/WebKit/chromium/src/WebPluginListBuilderImpl.cpp +++ b/Source/WebKit/chromium/src/WebPluginListBuilderImpl.cpp @@ -32,7 +32,7 @@ #include "WebPluginListBuilderImpl.h" #include "PluginData.h" -#include "platform/WebString.h" +#include <public/WebString.h> #include <wtf/Vector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebPluginLoadObserver.h b/Source/WebKit/chromium/src/WebPluginLoadObserver.h index d7648e136..364f40260 100644 --- a/Source/WebKit/chromium/src/WebPluginLoadObserver.h +++ b/Source/WebKit/chromium/src/WebPluginLoadObserver.h @@ -31,7 +31,7 @@ #ifndef WebPluginLoadObserver_h #define WebPluginLoadObserver_h -#include "platform/WebURL.h" +#include <public/WebURL.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp index 51114020b..0d2aeac45 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.cpp @@ -48,7 +48,7 @@ #include "WebViewClient.h" #include "WebWidgetClient.h" #include "painting/GraphicsContextBuilder.h" -#include "platform/WebRect.h" +#include <public/WebRect.h> #include <skia/ext/platform_canvas.h> #if ENABLE(GESTURE_EVENTS) diff --git a/Source/WebKit/chromium/src/WebPopupMenuImpl.h b/Source/WebKit/chromium/src/WebPopupMenuImpl.h index 7f13e4385..3c038acad 100644 --- a/Source/WebKit/chromium/src/WebPopupMenuImpl.h +++ b/Source/WebKit/chromium/src/WebPopupMenuImpl.h @@ -33,8 +33,8 @@ #include "FramelessScrollViewClient.h" #include "WebPopupMenu.h" -#include "platform/WebPoint.h" -#include "platform/WebSize.h" +#include <public/WebPoint.h> +#include <public/WebSize.h> #include <wtf/OwnPtr.h> #include <wtf/RefCounted.h> diff --git a/Source/WebKit/chromium/src/WebRange.cpp b/Source/WebKit/chromium/src/WebRange.cpp index 85df0a3ba..bc2930572 100644 --- a/Source/WebKit/chromium/src/WebRange.cpp +++ b/Source/WebKit/chromium/src/WebRange.cpp @@ -40,8 +40,8 @@ #include "TextIterator.h" #include "WebFrameImpl.h" #include "WebNode.h" -#include "platform/WebFloatQuad.h" -#include "platform/WebString.h" +#include <public/WebFloatQuad.h> +#include <public/WebString.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebRegularExpression.cpp b/Source/WebKit/chromium/src/WebRegularExpression.cpp index 4d0bd53be..0f9074f67 100644 --- a/Source/WebKit/chromium/src/WebRegularExpression.cpp +++ b/Source/WebKit/chromium/src/WebRegularExpression.cpp @@ -32,7 +32,7 @@ #include "WebRegularExpression.h" #include "RegularExpression.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebScriptController.cpp b/Source/WebKit/chromium/src/WebScriptController.cpp index fbf73f689..cdff75ab1 100644 --- a/Source/WebKit/chromium/src/WebScriptController.cpp +++ b/Source/WebKit/chromium/src/WebScriptController.cpp @@ -34,8 +34,7 @@ #include "ScriptController.h" #include "V8Binding.h" #include "V8DOMMap.h" - -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebSecurityOrigin.cpp b/Source/WebKit/chromium/src/WebSecurityOrigin.cpp index afe204d55..eee5b6186 100644 --- a/Source/WebKit/chromium/src/WebSecurityOrigin.cpp +++ b/Source/WebKit/chromium/src/WebSecurityOrigin.cpp @@ -33,8 +33,8 @@ #include "KURL.h" #include "SecurityOrigin.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/PassRefPtr.h> using namespace WebCore; @@ -156,4 +156,9 @@ void WebSecurityOrigin::assign(WebSecurityOriginPrivate* p) m_private = p; } +void WebSecurityOrigin::grantLoadLocalResources() const +{ + get()->grantLoadLocalResources(); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp index e80061889..c1d0d8866 100644 --- a/Source/WebKit/chromium/src/WebSecurityPolicy.cpp +++ b/Source/WebKit/chromium/src/WebSecurityPolicy.cpp @@ -35,9 +35,8 @@ #include "SchemeRegistry.h" #include "SecurityOrigin.h" #include "SecurityPolicy.h" - -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebString.h> +#include <public/WebURL.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebSelectElement.cpp b/Source/WebKit/chromium/src/WebSelectElement.cpp index 3a8238640..28d56e146 100644 --- a/Source/WebKit/chromium/src/WebSelectElement.cpp +++ b/Source/WebKit/chromium/src/WebSelectElement.cpp @@ -34,7 +34,7 @@ #include "HTMLNames.h" #include "HTMLOptionElement.h" #include "HTMLSelectElement.h" -#include "platform/WebString.h" +#include <public/WebString.h> #include <wtf/PassRefPtr.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebSerializedScriptValue.cpp b/Source/WebKit/chromium/src/WebSerializedScriptValue.cpp index fc7af6f3f..34fa4bb25 100644 --- a/Source/WebKit/chromium/src/WebSerializedScriptValue.cpp +++ b/Source/WebKit/chromium/src/WebSerializedScriptValue.cpp @@ -32,7 +32,7 @@ #include "platform/WebSerializedScriptValue.h" #include "SerializedScriptValue.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp b/Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp index e8f96e568..05cfce36d 100644 --- a/Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp +++ b/Source/WebKit/chromium/src/WebSessionDescriptionDescriptor.cpp @@ -32,11 +32,11 @@ #if ENABLE(MEDIA_STREAM) -#include "platform/WebSessionDescriptionDescriptor.h" +#include <public/WebSessionDescriptionDescriptor.h> #include "SessionDescriptionDescriptor.h" -#include "platform/WebICECandidateDescriptor.h" -#include "platform/WebString.h" +#include <public/WebICECandidateDescriptor.h> +#include <public/WebString.h> #include <wtf/Vector.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.cpp b/Source/WebKit/chromium/src/WebSettingsImpl.cpp index 4cc3ef727..988c5e66b 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.cpp +++ b/Source/WebKit/chromium/src/WebSettingsImpl.cpp @@ -33,8 +33,8 @@ #include "FontRenderingMode.h" #include "Settings.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/UnusedParam.h> #if defined(OS_WIN) @@ -54,6 +54,7 @@ WebSettingsImpl::WebSettingsImpl(Settings* settings) , m_viewportEnabled(false) , m_applyDefaultDeviceScaleFactorInCompositor(false) , m_gestureTapHighlightEnabled(true) + , m_autoZoomFocusedNodeToLegibleScale(false) , m_defaultTileSize(WebSize(256, 256)) , m_maxUntiledLayerSize(WebSize(512, 512)) { @@ -140,6 +141,16 @@ void WebSettingsImpl::setApplyDefaultDeviceScaleFactorInCompositor(bool applyDef m_applyDefaultDeviceScaleFactorInCompositor = applyDefaultDeviceScaleFactorInCompositor; } +void WebSettingsImpl::setApplyPageScaleFactorInCompositor(bool applyPageScaleFactorInCompositor) +{ + m_settings->setApplyPageScaleFactorInCompositor(applyPageScaleFactorInCompositor); +} + +void WebSettingsImpl::setAutoZoomFocusedNodeToLegibleScale(bool autoZoomFocusedNodeToLegibleScale) +{ + m_autoZoomFocusedNodeToLegibleScale = autoZoomFocusedNodeToLegibleScale; +} + void WebSettingsImpl::setTextAutosizingEnabled(bool enabled) { #if ENABLE(TEXT_AUTOSIZING) @@ -653,4 +664,9 @@ void WebSettingsImpl::setGestureTapHighlightEnabled(bool enableHighlight) m_gestureTapHighlightEnabled = enableHighlight; } +bool WebSettingsImpl::applyPageScaleFactorInCompositor() const +{ + return m_settings->applyPageScaleFactorInCompositor(); +} + } // namespace WebKit diff --git a/Source/WebKit/chromium/src/WebSettingsImpl.h b/Source/WebKit/chromium/src/WebSettingsImpl.h index e9e01bfcd..1169c31cf 100644 --- a/Source/WebKit/chromium/src/WebSettingsImpl.h +++ b/Source/WebKit/chromium/src/WebSettingsImpl.h @@ -64,8 +64,10 @@ public: virtual void setAllowScriptsToCloseWindows(bool); virtual void setAllowUniversalAccessFromFileURLs(bool); virtual void setApplyDefaultDeviceScaleFactorInCompositor(bool); + virtual void setApplyPageScaleFactorInCompositor(bool); virtual void setAsynchronousSpellCheckingEnabled(bool); virtual void setAuthorAndUserStylesEnabled(bool); + virtual void setAutoZoomFocusedNodeToLegibleScale(bool); virtual void setCaretBrowsingEnabled(bool); virtual void setCookieEnabled(bool); virtual void setCursiveFontFamily(const WebString&, UScriptCode = USCRIPT_COMMON); @@ -160,6 +162,8 @@ public: bool showPaintRects() const { return m_showPaintRects; } bool renderVSyncEnabled() const { return m_renderVSyncEnabled; } bool applyDefaultDeviceScaleFactorInCompositor() const { return m_applyDefaultDeviceScaleFactorInCompositor; } + bool applyPageScaleFactorInCompositor() const; + bool autoZoomFocusedNodeToLegibleScale() const { return m_autoZoomFocusedNodeToLegibleScale; } bool gestureTapHighlightEnabled() { return m_gestureTapHighlightEnabled; } WebSize defaultTileSize() const { return m_defaultTileSize; } WebSize maxUntiledLayerSize() const { return m_maxUntiledLayerSize; } @@ -173,6 +177,7 @@ private: bool m_viewportEnabled; bool m_applyDefaultDeviceScaleFactorInCompositor; bool m_gestureTapHighlightEnabled; + bool m_autoZoomFocusedNodeToLegibleScale; WebSize m_defaultTileSize; WebSize m_maxUntiledLayerSize; }; diff --git a/Source/WebKit/chromium/src/WebSocketImpl.cpp b/Source/WebKit/chromium/src/WebSocketImpl.cpp index 7548c6315..a0849efca 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.cpp +++ b/Source/WebKit/chromium/src/WebSocketImpl.cpp @@ -47,8 +47,8 @@ class WebSocketChannel { #include "WebArrayBuffer.h" #include "WebDocument.h" #include "WebSocketClient.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" +#include <public/WebString.h> +#include <public/WebURL.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebSocketImpl.h b/Source/WebKit/chromium/src/WebSocketImpl.h index ef14b18c7..ebf4e775a 100644 --- a/Source/WebKit/chromium/src/WebSocketImpl.h +++ b/Source/WebKit/chromium/src/WebSocketImpl.h @@ -31,10 +31,10 @@ #ifndef WebSocketImpl_h #define WebSocketImpl_h -#include "platform/WebCommon.h" #include "WebSocket.h" #include "WebSocketChannelClient.h" #include "WebSocketClient.h" +#include <public/WebCommon.h> #include <wtf/OwnPtr.h> #include <wtf/RefPtr.h> diff --git a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp index 95d3bcf88..9f31debc8 100644 --- a/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp +++ b/Source/WebKit/chromium/src/WebStorageEventDispatcherImpl.cpp @@ -35,8 +35,7 @@ #include "SecurityOrigin.h" #include "StorageAreaProxy.h" #include "WebViewImpl.h" - -#include "platform/WebURL.h" +#include <public/WebURL.h> #include <wtf/PassOwnPtr.h> namespace WebKit { diff --git a/Source/WebKit/chromium/src/WebSurroundingText.cpp b/Source/WebKit/chromium/src/WebSurroundingText.cpp index 45db3d1bd..3caadca2e 100644 --- a/Source/WebKit/chromium/src/WebSurroundingText.cpp +++ b/Source/WebKit/chromium/src/WebSurroundingText.cpp @@ -33,8 +33,7 @@ #include "Text.h" #include "VisiblePosition.h" #include "WebHitTestResult.h" - -#include "platform/WebPoint.h" +#include <public/WebPoint.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp index b81ea578b..46fbf2371 100644 --- a/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp +++ b/Source/WebKit/chromium/src/WebTextCheckingCompletionImpl.cpp @@ -35,7 +35,7 @@ #include "SpellChecker.h" #include "TextCheckerClient.h" #include "WebTextCheckingResult.h" -#include "platform/WebVector.h" +#include <public/WebVector.h> #include <wtf/Assertions.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebURLLoadTiming.cpp b/Source/WebKit/chromium/src/WebURLLoadTiming.cpp index 0949c9b2e..2a2777157 100644 --- a/Source/WebKit/chromium/src/WebURLLoadTiming.cpp +++ b/Source/WebKit/chromium/src/WebURLLoadTiming.cpp @@ -29,10 +29,10 @@ */ #include "config.h" -#include "platform/WebURLLoadTiming.h" +#include <public/WebURLLoadTiming.h> #include "ResourceLoadTiming.h" -#include "platform/WebString.h" +#include <public/WebString.h> using namespace WebCore; diff --git a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp index 26f17c35b..ffecb0aed 100644 --- a/Source/WebKit/chromium/src/WebUserMediaRequest.cpp +++ b/Source/WebKit/chromium/src/WebUserMediaRequest.cpp @@ -35,16 +35,18 @@ #include "WebUserMediaRequest.h" #include "Document.h" +#include "MediaConstraints.h" #include "MediaStreamDescriptor.h" #include "MediaStreamSource.h" #include "SecurityOrigin.h" #include "UserMediaRequest.h" #include "WebDocument.h" #include "WebSecurityOrigin.h" -#include "platform/WebMediaStreamDescriptor.h" -#include "platform/WebMediaStreamSource.h" -#include "platform/WebString.h" -#include "platform/WebVector.h" +#include <public/WebMediaConstraints.h> +#include <public/WebMediaStreamDescriptor.h> +#include <public/WebMediaStreamSource.h> +#include <public/WebString.h> +#include <public/WebVector.h> #include <wtf/Vector.h> using namespace WebCore; @@ -73,6 +75,18 @@ bool WebUserMediaRequest::video() const return m_private->video(); } +WebMediaConstraints WebUserMediaRequest::audioConstraints() const +{ + ASSERT(!isNull()); + return m_private->audioConstraints(); +} + +WebMediaConstraints WebUserMediaRequest::videoConstraints() const +{ + ASSERT(!isNull()); + return m_private->videoConstraints(); +} + WebSecurityOrigin WebUserMediaRequest::securityOrigin() const { ASSERT(!isNull() && m_private->scriptExecutionContext()); diff --git a/Source/WebKit/chromium/src/WebViewImpl.cpp b/Source/WebKit/chromium/src/WebViewImpl.cpp index 261f7c357..d6bf94b96 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.cpp +++ b/Source/WebKit/chromium/src/WebViewImpl.cpp @@ -92,7 +92,6 @@ #include "PageGroupLoadDeferrer.h" #include "PagePopupClient.h" #include "PageWidgetDelegate.h" -#include "Pasteboard.h" #include "PlatformContextSkia.h" #include "PlatformKeyboardEvent.h" #include "PlatformMouseEvent.h" @@ -192,13 +191,19 @@ using namespace std; // (such as due to a double tap gesture or find in page etc.). These are // experimentally determined. static const int touchPointPadding = 32; +static const int nonUserInitiatedPointPadding = 11; static const float minScaleDifference = 0.01f; static const float doubleTapZoomContentDefaultMargin = 5; static const float doubleTapZoomContentMinimumMargin = 2; static const double doubleTapZoomAnimationDurationInSeconds = 0.25; +static const float doubleTapZoomAlreadyLegibleRatio = 1.2f; // Constants for zooming in on a focused text field. static const double scrollAndScaleAnimationDurationInSeconds = 0.2; +static const int minReadableCaretHeight = 18; +static const float minScaleChangeToTriggerZoom = 1.05f; +static const float leftBoxRatio = 0.3f; +static const int caretPadding = 10; namespace WebKit { @@ -209,8 +214,8 @@ namespace WebKit { const double WebView::textSizeMultiplierRatio = 1.2; const double WebView::minTextSizeMultiplier = 0.5; const double WebView::maxTextSizeMultiplier = 3.0; -const float WebView::minPageScaleFactor = 0.25; -const float WebView::maxPageScaleFactor = 4.0; +const float WebView::minPageScaleFactor = 0.25f; +const float WebView::maxPageScaleFactor = 4.0f; // The group name identifies a namespace of pages. Page group is used on PLATFORM(MAC) @@ -392,6 +397,8 @@ WebViewImpl::WebViewImpl(WebViewClient* client) , m_ignoreViewportTagMaximumScale(false) , m_pageScaleFactorIsSet(false) , m_savedPageScaleFactor(0) + , m_doubleTapZoomInEffect(false) + , m_shouldUseDoubleTapTimeZero(false) , m_contextMenuAllowed(false) , m_doingDragAndDrop(false) , m_ignoreInputEvents(false) @@ -622,39 +629,6 @@ void WebViewImpl::mouseContextMenu(const WebMouseEvent& event) void WebViewImpl::handleMouseUp(Frame& mainFrame, const WebMouseEvent& event) { -#if OS(UNIX) && !OS(DARWIN) - // If the event was a middle click, attempt to copy text into the focused - // frame. We execute this before we let the page have a go at the event - // because the page may change what is focused during in its event handler. - // - // This code is in the mouse up handler. There is some debate about putting - // this here, as opposed to the mouse down handler. - // xterm: pastes on up. - // GTK: pastes on down. - // Firefox: pastes on up. - // Midori: couldn't paste at all with 0.1.2 - // - // There is something of a webcompat angle to this well, as highlighted by - // crbug.com/14608. Pages can clear text boxes 'onclick' and, if we paste on - // down then the text is pasted just before the onclick handler runs and - // clears the text box. So it's important this happens after the - // handleMouseReleaseEvent() earlier in this function - if (event.button == WebMouseEvent::ButtonMiddle) { - Frame* focused = focusedWebCoreFrame(); - 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); - // 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(); - editor->command(AtomicString("PasteGlobalSelection")).execute(); - } - } -#endif - PageWidgetEventHandler::handleMouseUp(mainFrame, event); #if OS(WINDOWS) @@ -689,6 +663,29 @@ void WebViewImpl::scrollBy(const WebCore::IntPoint& delta) bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) { bool eventSwallowed = false; + + // Handle link highlighting outside the main switch to avoid getting lost in the + // complicated set of cases handled below. + switch (event.type) { + case WebInputEvent::GestureTapDown: + // Queue a highlight animation, then hand off to regular handler. +#if OS(LINUX) + if (settingsImpl()->gestureTapHighlightEnabled()) + enableTouchHighlight(IntPoint(event.x, event.y)); +#endif + break; + case WebInputEvent::GestureTapCancel: + if (m_linkHighlight) + m_linkHighlight->startHighlightAnimationIfNeeded(); + break; + case WebInputEvent::GestureTap: + // If a link highlight is active, kill it. + m_linkHighlight.clear(); + break; + default: + break; + } + switch (event.type) { case WebInputEvent::GestureFlingStart: { m_client->cancelScheduledContentIntents(); @@ -710,7 +707,7 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) break; case WebInputEvent::GestureTap: { m_client->cancelScheduledContentIntents(); - if (detectContentOnTouch(WebPoint(event.x, event.y), event.type)) { + if (detectContentOnTouch(WebPoint(event.x, event.y))) { eventSwallowed = true; break; } @@ -745,37 +742,42 @@ bool WebViewImpl::handleGestureEvent(const WebGestureEvent& event) break; } - case WebInputEvent::GestureTwoFingerTap: - case WebInputEvent::GestureLongPress: { + case WebInputEvent::GestureTwoFingerTap: { if (!mainFrameImpl() || !mainFrameImpl()->frameView()) break; - m_client->cancelScheduledContentIntents(); - if (detectContentOnTouch(WebPoint(event.x, event.y), event.type)) { - eventSwallowed = true; + m_page->contextMenuController()->clearContextMenu(); + m_contextMenuAllowed = true; + PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); + eventSwallowed = mainFrameImpl()->frame()->eventHandler()->sendContextMenuEventForGesture(platformEvent); + m_contextMenuAllowed = false; + + break; + } + case WebInputEvent::GestureLongPress: { + if (!mainFrameImpl() || !mainFrameImpl()->frameView()) break; - } + m_client->cancelScheduledContentIntents(); m_page->contextMenuController()->clearContextMenu(); m_contextMenuAllowed = true; PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); - eventSwallowed = mainFrameImpl()->frame()->eventHandler()->sendContextMenuEventForGesture(platformEvent); + eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); m_contextMenuAllowed = false; break; } case WebInputEvent::GestureTapDown: { m_client->cancelScheduledContentIntents(); - // Queue a highlight animation, then hand off to regular handler. -#if OS(LINUX) - if (settingsImpl()->gestureTapHighlightEnabled()) - enableTouchHighlight(IntPoint(event.x, event.y)); -#endif PlatformGestureEventBuilder platformEvent(mainFrameImpl()->frameView(), event); eventSwallowed = mainFrameImpl()->frame()->eventHandler()->handleGestureEvent(platformEvent); break; } case WebInputEvent::GestureDoubleTap: + m_client->cancelScheduledContentIntents(); + animateZoomAroundPoint(WebPoint(event.x, event.y), DoubleTap); + eventSwallowed = true; + break; case WebInputEvent::GestureScrollBegin: case WebInputEvent::GesturePinchBegin: m_client->cancelScheduledContentIntents(); @@ -815,17 +817,15 @@ void WebViewImpl::renderingStats(WebRenderingStats& stats) const void WebViewImpl::startPageScaleAnimation(const IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds) { - if (!m_layerTreeView) - return; - - IntPoint clampedPoint = targetPosition; + WebPoint clampedPoint = targetPosition; if (!useAnchor) clampedPoint = clampOffsetAtScale(targetPosition, newScale); - - if (!durationInSeconds && !useAnchor) { + if ((!durationInSeconds && !useAnchor) || m_shouldUseDoubleTapTimeZero) { setPageScaleFactor(newScale, clampedPoint); return; } + if (!m_layerTreeView) + return; m_layerTreeView->startPageScaleAnimation(targetPosition, useAnchor, newScale, durationInSeconds); } @@ -1075,24 +1075,37 @@ WebRect WebViewImpl::widenRectWithinPageBounds(const WebRect& source, int target return WebRect(newX, source.y, newWidth, source.height); } -void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType zoomType, float& scale, WebPoint& scroll) +void WebViewImpl::shouldUseAnimateDoubleTapTimeZeroForTesting(bool setToZero) +{ + m_shouldUseDoubleTapTimeZero = setToZero; +} + +void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType zoomType, float& scale, WebPoint& scroll, bool& isAnchor) { scale = pageScaleFactor(); scroll.x = scroll.y = 0; WebRect targetRect = hitRect; + // Padding only depends on page scale when triggered by manually tapping + int padding = (zoomType == DoubleTap) ? touchPointPadding : nonUserInitiatedPointPadding; if (targetRect.isEmpty()) - targetRect.width = targetRect.height = touchPointPadding; - + targetRect.width = targetRect.height = padding; WebRect rect = computeBlockBounds(targetRect, zoomType); + if (zoomType == FindInPage && rect.isEmpty()) { + // Keep current scale (no need to scroll as x,y will normally already + // be visible). FIXME: Revisit this if it isn't always true. + return; + } - const float overviewScale = m_minimumPageScaleFactor; bool scaleUnchanged = true; if (!rect.isEmpty()) { // Pages should be as legible as on desktop when at dpi scale, so no // need to zoom in further when automatically determining zoom level // (after double tap, find in page, etc), though the user should still // be allowed to manually pinch zoom in further if they desire. - const float maxScale = deviceScaleFactor(); + const float defaultScaleWhenAlreadyLegible = m_minimumPageScaleFactor * doubleTapZoomAlreadyLegibleRatio; + float legibleScale = deviceScaleFactor(); + if (legibleScale < defaultScaleWhenAlreadyLegible) + legibleScale = (scale == m_minimumPageScaleFactor) ? defaultScaleWhenAlreadyLegible : m_minimumPageScaleFactor; const float defaultMargin = doubleTapZoomContentDefaultMargin * deviceScaleFactor(); const float minimumMargin = doubleTapZoomContentMinimumMargin * deviceScaleFactor(); @@ -1105,55 +1118,61 @@ void WebViewImpl::computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZo rect = widenRectWithinPageBounds(rect, static_cast<int>(defaultMargin * rect.width / m_size.width), static_cast<int>(minimumMargin * rect.width / m_size.width)); - // Fit block to screen, respecting limits. scale *= static_cast<float>(m_size.width) / rect.width; - scale = min(scale, maxScale); + scale = min(scale, legibleScale); scale = clampPageScaleFactorToLimits(scale); scaleUnchanged = fabs(pageScaleFactor() - scale) < minScaleDifference; } - if (zoomType == DoubleTap) { - if (rect.isEmpty() || scaleUnchanged) { - // Zoom out to overview mode. - if (overviewScale) - scale = overviewScale; - return; - } - } else if (rect.isEmpty()) { - // Keep current scale (no need to scroll as x,y will normally already - // be visible). FIXME: Revisit this if it isn't always true. - return; - } - - // FIXME: If this is being called for auto zoom during find in page, - // then if the user manually zooms in it'd be nice to preserve the relative - // increase in zoom they caused (if they zoom out then it's ok to zoom - // them back in again). This isn't compatible with our current double-tap - // zoom strategy (fitting the containing block to the screen) though. - - float screenHeight = m_size.height / scale * pageScaleFactor(); - float screenWidth = m_size.width / scale * pageScaleFactor(); - - // Scroll to vertically align the block. - if (rect.height < screenHeight) { - // Vertically center short blocks. - rect.y -= 0.5 * (screenHeight - rect.height); + if (zoomType == DoubleTap && (rect.isEmpty() || scaleUnchanged || m_doubleTapZoomInEffect)) { + // Zoom out to minimum scale. + scale = m_minimumPageScaleFactor; + scroll = WebPoint(hitRect.x, hitRect.y); + isAnchor = true; + m_doubleTapZoomInEffect = false; } else { - // Ensure position we're zooming to (+ padding) isn't off the bottom of - // the screen. - rect.y = max<float>(rect.y, hitRect.y + touchPointPadding - screenHeight); - } // Otherwise top align the block. - - // Do the same thing for horizontal alignment. - if (rect.width < screenWidth) - rect.x -= 0.5 * (screenWidth - rect.width); - else - rect.x = max<float>(rect.x, hitRect.x + touchPointPadding - screenWidth); + if (zoomType == DoubleTap && scale != m_minimumPageScaleFactor) + m_doubleTapZoomInEffect = true; + else + m_doubleTapZoomInEffect = false; + // FIXME: If this is being called for auto zoom during find in page, + // then if the user manually zooms in it'd be nice to preserve the + // relative increase in zoom they caused (if they zoom out then it's ok + // to zoom them back in again). This isn't compatible with our current + // double-tap zoom strategy (fitting the containing block to the screen) + // though. + + float screenHeight = m_size.height / scale * pageScaleFactor(); + float screenWidth = m_size.width / scale * pageScaleFactor(); + + // Scroll to vertically align the block. + if (rect.height < screenHeight) { + // Vertically center short blocks. + rect.y -= 0.5 * (screenHeight - rect.height); + } else { + // Ensure position we're zooming to (+ padding) isn't off the bottom of + // the screen. + rect.y = max<float>(rect.y, hitRect.y + padding - screenHeight); + } // Otherwise top align the block. + + // Do the same thing for horizontal alignment. + if (rect.width < screenWidth) + rect.x -= 0.5 * (screenWidth - rect.width); + else + rect.x = max<float>(rect.x, hitRect.x + padding - screenWidth); + scroll.x = rect.x; + scroll.y = rect.y; + isAnchor = false; + } - scroll.x = rect.x; - scroll.y = rect.y; + scale = clampPageScaleFactorToLimits(scale); + scroll = mainFrameImpl()->frameView()->windowToContents(scroll); + float scaleDelta = scale / pageScaleFactor(); + scroll = WebPoint(scroll.x * scaleDelta, scroll.y * scaleDelta); + if (!isAnchor) + scroll = clampOffsetAtScale(scroll, scale); } static bool highlightConditions(Node* node) @@ -1179,10 +1198,10 @@ 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. + // If the document/body have click handlers installed, we don't want to default to applying the highlight to the entire RenderView, or the + // entire body. RenderObject* touchNodeRenderer = bestTouchNode ? bestTouchNode->renderer() : 0; - if (bestTouchNode && (!touchNodeRenderer || touchNodeRenderer->isRenderView() || touchNodeRenderer->isBody() || !touchNodeRenderer->style()->hasAutoZIndex())) + if (bestTouchNode && (!touchNodeRenderer || touchNodeRenderer->isRenderView() || touchNodeRenderer->isBody())) return 0; return bestTouchNode; @@ -1206,7 +1225,6 @@ void WebViewImpl::enableTouchHighlight(IntPoint touchEventLocation) return; m_linkHighlight = LinkHighlight::create(touchNode, this); - m_linkHighlight->startHighlightAnimation(); } #endif @@ -1219,11 +1237,13 @@ void WebViewImpl::animateZoomAroundPoint(const IntPoint& point, AutoZoomType zoo float scale; WebPoint scroll; - computeScaleAndScrollForHitRect(WebRect(point.x(), point.y(), 0, 0), zoomType, scale, scroll); + bool isAnchor; + WebPoint webPoint = point; + computeScaleAndScrollForHitRect(WebRect(webPoint.x, webPoint.y, 0, 0), zoomType, scale, scroll, isAnchor); bool isDoubleTap = (zoomType == DoubleTap); - double durationInSeconds = isDoubleTap ? doubleTapZoomAnimationDurationInSeconds : 0; - startPageScaleAnimation(scroll, isDoubleTap, scale, durationInSeconds); + double durationInSeconds = (isDoubleTap && !m_shouldUseDoubleTapTimeZero) ? doubleTapZoomAnimationDurationInSeconds : 0; + startPageScaleAnimation(scroll, isAnchor, scale, durationInSeconds); #endif } @@ -1555,9 +1575,9 @@ void WebViewImpl::resize(const WebSize& newSize) #endif WebDevToolsAgentPrivate* agentPrivate = devToolsAgentPrivate(); - if (agentPrivate && agentPrivate->metricsOverridden()) - agentPrivate->webViewResized(); - else { + if (agentPrivate) + agentPrivate->webViewResized(newSize); + if (!agentPrivate || !agentPrivate->metricsOverridden()) { WebFrameImpl* webFrame = mainFrameImpl(); if (webFrame->frameView()) webFrame->frameView()->resize(newSize.width, newSize.height); @@ -1723,13 +1743,6 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) #if ENABLE(REQUEST_ANIMATION_FRAME) TRACE_EVENT0("webkit", "WebViewImpl::updateAnimations"); - WebFrameImpl* webframe = mainFrameImpl(); - if (!webframe) - return; - FrameView* view = webframe->frameView(); - if (!view) - return; - // Create synthetic wheel events as necessary for fling. if (m_gestureAnimation) { if (m_gestureAnimation->animate(monotonicFrameBeginTime)) @@ -1738,6 +1751,9 @@ void WebViewImpl::updateAnimations(double monotonicFrameBeginTime) m_gestureAnimation.clear(); } + if (!m_page) + return; + PageWidgetDelegate::animate(m_page.get(), monotonicFrameBeginTime); #endif } @@ -2628,8 +2644,78 @@ void WebViewImpl::scrollFocusedNodeIntoRect(const WebRect& rect) Node* focusedNode = focusedWebCoreNode(); if (!frame || !frame->view() || !focusedNode || !focusedNode->isElementNode()) return; - Element* elementNode = static_cast<Element*>(focusedNode); - frame->view()->scrollElementToRect(elementNode, IntRect(rect.x, rect.y, rect.width, rect.height)); + + if (!m_webSettings->autoZoomFocusedNodeToLegibleScale()) { + Element* elementNode = static_cast<Element*>(focusedNode); + frame->view()->scrollElementToRect(elementNode, IntRect(rect.x, rect.y, rect.width, rect.height)); + return; + } + +#if ENABLE(GESTURE_EVENTS) + focusedNode->document()->updateLayoutIgnorePendingStylesheets(); + + // 'caret' is rect encompassing the blinking cursor. + IntRect textboxRect = focusedNode->document()->view()->contentsToWindow(pixelSnappedIntRect(focusedNode->Node::boundingBox())); + WebRect caret, end; + selectionBounds(caret, end); + + // Pick a scale which is reasonably readable. This is the scale at which + // the caret height will become minReadableCaretHeight (adjusted for dpi + // and font scale factor). + float targetScale = deviceScaleFactor(); +#if ENABLE(TEXT_AUTOSIZING) + if (page() && page()->settings()) + targetScale *= page()->settings()->textAutosizingFontScaleFactor(); +#endif + const float newScale = clampPageScaleFactorToLimits(pageScaleFactor() * minReadableCaretHeight * targetScale / caret.height); + const float deltaScale = newScale / pageScaleFactor(); + + // Convert the rects to absolute space in the new scale. + IntRect textboxRectInDocumentCoordinates = textboxRect; + textboxRectInDocumentCoordinates.move(mainFrame()->scrollOffset()); + textboxRectInDocumentCoordinates.scale(deltaScale); + IntRect caretInDocumentCoordinates = caret; + caretInDocumentCoordinates.move(mainFrame()->scrollOffset()); + caretInDocumentCoordinates.scale(deltaScale); + + IntPoint newOffset; + if (textboxRectInDocumentCoordinates.width() <= m_size.width) { + // Field is narrower than screen. Try to leave padding on left so field's + // label is visible, but it's more important to ensure entire field is + // onscreen. + int idealLeftPadding = m_size.width * leftBoxRatio; + int maxLeftPaddingKeepingBoxOnscreen = m_size.width - textboxRectInDocumentCoordinates.width(); + newOffset.setX(textboxRectInDocumentCoordinates.x() - min<int>(idealLeftPadding, maxLeftPaddingKeepingBoxOnscreen)); + } else { + // Field is wider than screen. Try to left-align field, unless caret would + // be offscreen, in which case right-align the caret. + newOffset.setX(max<int>(textboxRectInDocumentCoordinates.x(), caretInDocumentCoordinates.x() + caretInDocumentCoordinates.width() + caretPadding - m_size.width)); + } + if (textboxRectInDocumentCoordinates.height() <= m_size.height) { + // Field is shorter than screen. Vertically center it. + newOffset.setY(textboxRectInDocumentCoordinates.y() - (m_size.height - textboxRectInDocumentCoordinates.height()) / 2); + } else { + // Field is taller than screen. Try to top align field, unless caret would + // be offscreen, in which case bottom-align the caret. + newOffset.setY(max<int>(textboxRectInDocumentCoordinates.y(), caretInDocumentCoordinates.y() + caretInDocumentCoordinates.height() + caretPadding - m_size.height)); + } + + bool needAnimation = false; + // If we are at less than the target zoom level, zoom in. + if (deltaScale > minScaleChangeToTriggerZoom) + needAnimation = true; + // If the caret is offscreen, then animate. + IntRect sizeRect(0, 0, m_size.width, m_size.height); + if (!sizeRect.contains(caret)) + needAnimation = true; + // If the box is partially offscreen and it's possible to bring it fully + // onscreen, then animate. + if (sizeRect.contains(textboxRectInDocumentCoordinates.width(), textboxRectInDocumentCoordinates.height()) && !sizeRect.contains(textboxRect)) + needAnimation = true; + + if (needAnimation) + startPageScaleAnimation(newOffset, false, newScale, scrollAndScaleAnimationDurationInSeconds); +#endif } void WebViewImpl::advanceFocus(bool reverse) @@ -2756,8 +2842,20 @@ void WebViewImpl::setPageScaleFactor(float scaleFactor, const WebPoint& origin) } scaleFactor = clampPageScaleFactorToLimits(scaleFactor); - WebPoint clampedOrigin = clampOffsetAtScale(origin, scaleFactor); - page()->setPageScaleFactor(scaleFactor, clampedOrigin); + WebPoint scrollOffset; + if (!m_page->settings()->applyPageScaleFactorInCompositor()) { + // If page scale is not applied in the compositor, then the scroll offsets should + // be modified by the scale factor. + scrollOffset = clampOffsetAtScale(origin, scaleFactor); + } else { + IntPoint offset = origin; + WebSize contentSize = mainFrame()->contentsSize(); + offset.shrunkTo(IntPoint(contentSize.width - m_size.width, contentSize.height - m_size.height)); + offset.clampNegativeToZero(); + scrollOffset = offset; + } + + page()->setPageScaleFactor(scaleFactor, scrollOffset); m_pageScaleFactorIsSet = true; } @@ -3195,6 +3293,8 @@ void WebViewImpl::sendResizeEventAndRepaint() m_client->didInvalidateRect(damagedRect); } } + if (m_pageOverlays) + m_pageOverlays->update(); } void WebViewImpl::configureAutoResizeMode() @@ -3412,13 +3512,13 @@ void WebView::addUserScript(const WebString& sourceCode, WebView::UserScriptInjectAt injectAt, WebView::UserContentInjectIn injectIn) { - OwnPtr<Vector<String> > patterns = adoptPtr(new Vector<String>); + Vector<String> patterns; for (size_t i = 0; i < patternsIn.size(); ++i) - patterns->append(patternsIn[i]); + patterns.append(patternsIn[i]); PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); - pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns.release(), nullptr, + pageGroup->addUserScriptToWorld(world.get(), sourceCode, WebURL(), patterns, Vector<String>(), static_cast<UserScriptInjectionTime>(injectAt), static_cast<UserContentInjectedFrames>(injectIn)); } @@ -3428,9 +3528,9 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, WebView::UserContentInjectIn injectIn, WebView::UserStyleInjectionTime injectionTime) { - OwnPtr<Vector<String> > patterns = adoptPtr(new Vector<String>); + Vector<String> patterns; for (size_t i = 0; i < patternsIn.size(); ++i) - patterns->append(patternsIn[i]); + patterns.append(patternsIn[i]); PageGroup* pageGroup = PageGroup::pageGroup(pageGroupName); RefPtr<DOMWrapperWorld> world(DOMWrapperWorld::createUninitializedWorld()); @@ -3439,7 +3539,7 @@ void WebView::addUserStyleSheet(const WebString& sourceCode, // callers specify this though, since in other cases the caller will probably want "user" level. // // FIXME: It would be nice to populate the URL correctly, instead of passing an empty URL. - pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns.release(), nullptr, + pageGroup->addUserStyleSheetToWorld(world.get(), sourceCode, WebURL(), patterns, Vector<String>(), static_cast<UserContentInjectedFrames>(injectIn), UserStyleAuthorLevel, static_cast<WebCore::UserStyleInjectionTime>(injectionTime)); @@ -3462,8 +3562,10 @@ void WebViewImpl::didCommitLoad(bool* isNewNavigation, bool isNavigationWithinPa m_newNavigationLoader = 0; #endif m_observedNewNavigation = false; - if (*isNewNavigation && !isNavigationWithinPage) + if (*isNewNavigation && !isNavigationWithinPage) { m_pageScaleFactorIsSet = false; + m_doubleTapZoomInEffect = false; + } // Make sure link highlight from previous page is cleared. m_linkHighlight.clear(); @@ -3757,6 +3859,8 @@ void WebViewImpl::paintRootLayer(GraphicsContext& context, const IntRect& conten if (!page()) return; FrameView* view = page()->mainFrame()->view(); + if (context.platformContext()) + context.platformContext()->setDeviceScaleFactor(page()->deviceScaleFactor()); view->paintContents(&context, contentRect); double paintEnd = currentTime(); double pixelsPerSec = (contentRect.width() * contentRect.height()) / (paintEnd - paintStart); @@ -3776,8 +3880,9 @@ void WebViewImpl::setIsAcceleratedCompositingActive(bool active) if (!active) { m_isAcceleratedCompositingActive = false; // We need to finish all GL rendering before sending didDeactivateCompositor() to prevent - // flickering when compositing turns off. - if (m_layerTreeView) + // flickering when compositing turns off. This is only necessary if we're not in + // force-compositing-mode. + if (m_layerTreeView && !page()->settings()->forceCompositingMode()) m_layerTreeView->finishAllRendering(); m_client->didDeactivateCompositor(); } else if (m_layerTreeView) { @@ -3921,15 +4026,22 @@ void WebViewImpl::applyScrollAndScale(const WebSize& scrollDelta, float pageScal mainFrameImpl()->frameView()->scrollBy(scrollDelta); } else { // The page scale changed, so apply a scale and scroll in a single - // operation. The old scroll offset (and passed-in delta) are - // in the old coordinate space, so we first need to multiply them - // by the page scale delta. + // operation. WebSize scrollOffset = mainFrame()->scrollOffset(); scrollOffset.width += scrollDelta.width; scrollOffset.height += scrollDelta.height; - WebPoint scaledScrollOffset(scrollOffset.width * pageScaleDelta, - scrollOffset.height * pageScaleDelta); - setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scaledScrollOffset); + + WebPoint scrollPoint(scrollOffset.width, scrollOffset.height); + if (!m_page->settings()->applyPageScaleFactorInCompositor()) { + // The old scroll offset (and passed-in delta) are in the old + // coordinate space, so we first need to multiply them by the page + // scale delta. + scrollPoint.x = scrollPoint.x * pageScaleDelta; + scrollPoint.y = scrollPoint.y * pageScaleDelta; + } + + setPageScaleFactor(pageScaleFactor() * pageScaleDelta, scrollPoint); + m_doubleTapZoomInEffect = false; } } @@ -4020,12 +4132,8 @@ void WebViewImpl::selectAutofillSuggestionAtIndex(unsigned listIndex) m_autofillPopupClient->valueChanged(listIndex); } -bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent::Type touchType) +bool WebViewImpl::detectContentOnTouch(const WebPoint& position) { - ASSERT(touchType == WebInputEvent::GestureTap - || touchType == WebInputEvent::GestureTwoFingerTap - || touchType == WebInputEvent::GestureLongPress); - HitTestResult touchHit = hitTestResultForWindowPos(position); if (touchHit.isContentEditable()) @@ -4038,22 +4146,14 @@ bool WebViewImpl::detectContentOnTouch(const WebPoint& position, WebInputEvent:: // 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()))) { + if (node->isLink() || node->willRespondToTouchEvents() || node->willRespondToMouseClickEvents()) return false; - } } WebContentDetectionResult content = m_client->detectContentAround(touchHit); if (!content.isValid()) return false; - if (touchType != WebInputEvent::GestureTap) { - // Select the detected content as a block. - focusedFrame()->selectRange(content.range()); - return true; - } - m_client->scheduleContentIntent(content.intent()); return true; } diff --git a/Source/WebKit/chromium/src/WebViewImpl.h b/Source/WebKit/chromium/src/WebViewImpl.h index 4c1a974a0..47907f124 100644 --- a/Source/WebKit/chromium/src/WebViewImpl.h +++ b/Source/WebKit/chromium/src/WebViewImpl.h @@ -392,7 +392,7 @@ public: void mouseContextMenu(const WebMouseEvent&); void mouseDoubleClick(const WebMouseEvent&); - bool detectContentOnTouch(const WebPoint&, WebInputEvent::Type); + bool detectContentOnTouch(const WebPoint&); void startPageScaleAnimation(const WebCore::IntPoint& targetPosition, bool useAnchor, float newScale, double durationInSeconds); void numberOfWheelEventHandlersChanged(unsigned); @@ -561,12 +561,14 @@ public: void fullFramePluginZoomLevelChanged(double zoomLevel); #if ENABLE(GESTURE_EVENTS) - void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll); + void computeScaleAndScrollForHitRect(const WebRect& hitRect, AutoZoomType, float& scale, WebPoint& scroll, bool& isAnchor); WebCore::Node* bestTouchLinkNode(WebCore::IntPoint touchEventLocation); void enableTouchHighlight(WebCore::IntPoint touchEventLocation); #endif void animateZoomAroundPoint(const WebCore::IntPoint&, AutoZoomType); + void shouldUseAnimateDoubleTapTimeZeroForTesting(bool); + void loseCompositorContext(int numTimes); void enterFullScreenForElement(WebCore::Element*); @@ -740,6 +742,12 @@ private: float m_savedPageScaleFactor; // 0 means that no page scale factor is saved. WebCore::IntSize m_savedScrollOffset; + // Whether the current scale was achieved by zooming in with double tap. + bool m_doubleTapZoomInEffect; + + // Used for testing purposes. + bool m_shouldUseDoubleTapTimeZero; + bool m_contextMenuAllowed; bool m_doingDragAndDrop; diff --git a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp index e127cfc6d..d287b0905 100644 --- a/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp +++ b/Source/WebKit/chromium/src/WorkerAsyncFileWriterChromium.cpp @@ -37,13 +37,13 @@ #include "Blob.h" #include "ScriptExecutionContext.h" #include "WebFileWriter.h" -#include "platform/WebURL.h" #include "WebWorkerBase.h" #include "WorkerContext.h" #include "WorkerFileWriterCallbacksBridge.h" #include "WorkerLoaderProxy.h" #include "WorkerThread.h" #include <public/WebFileSystem.h> +#include <public/WebURL.h> #include <wtf/Assertions.h> using namespace WebKit; diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp index bd9b1761a..755802380 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.cpp @@ -39,13 +39,13 @@ #include "WebFileInfo.h" #include "WebFileSystemCallbacks.h" #include "WebFileSystemEntry.h" -#include "platform/WebString.h" -#include "platform/WebURL.h" #include "WebWorkerBase.h" #include "WorkerContext.h" #include "WorkerLoaderProxy.h" #include "WorkerScriptController.h" #include "WorkerThread.h" +#include <public/WebString.h> +#include <public/WebURL.h> #include <wtf/MainThread.h> #include <wtf/Threading.h> #include <wtf/UnusedParam.h> diff --git a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h index 5c0a59084..10168f53a 100644 --- a/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h +++ b/Source/WebKit/chromium/src/WorkerFileSystemCallbacksBridge.h @@ -35,8 +35,8 @@ #include "ScriptExecutionContext.h" #include "WebFileError.h" -#include "platform/WebVector.h" #include <public/WebFileSystem.h> +#include <public/WebVector.h> #include <wtf/PassOwnPtr.h> #include <wtf/PassRefPtr.h> #include <wtf/Threading.h> diff --git a/Source/WebKit/chromium/src/js/DevTools.js b/Source/WebKit/chromium/src/js/DevTools.js index f555419e9..bbdbd9805 100644 --- a/Source/WebKit/chromium/src/js/DevTools.js +++ b/Source/WebKit/chromium/src/js/DevTools.js @@ -41,6 +41,7 @@ Preferences.exposeDisableCache = true; Preferences.showDockToRight = true; Preferences.exposeFileSystemInspection = true; + Preferences.experimentsEnabled = false; })();} function buildPlatformExtensionAPI(extensionInfo) diff --git a/Source/WebKit/chromium/src/js/Tests.js b/Source/WebKit/chromium/src/js/Tests.js index 68c6742cc..424e41a26 100644 --- a/Source/WebKit/chromium/src/js/Tests.js +++ b/Source/WebKit/chromium/src/js/Tests.js @@ -555,6 +555,90 @@ TestSuite.prototype.testPauseInSharedWorkerInitialization = function() }; +// Regression test for http://webk.it/97466 +TestSuite.prototype.testPageOverlayUpdate = function() +{ + var test = this; + var records = []; + var dispatchOnRecordType = {} + + function addRecord(event) + { + innerAddRecord(event.data); + } + + function innerAddRecord(record) + { + records.push(record); + if (typeof dispatchOnRecordType[record.type] === "function") + dispatchOnRecordType[record.type](record); + + if (record.children) + record.children.forEach(innerAddRecord); + } + + function populatePage() + { + var div1 = document.createElement("div"); + div1.id = "div1"; + // Force accelerated compositing. + div1.style.webkitTransform = "translateZ(0)"; + document.body.appendChild(div1); + var div2 = document.createElement("div"); + div2.id = "div2"; + document.body.appendChild(div2); + } + + function step1() + { + WebInspector.timelineManager.addEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, addRecord); + WebInspector.timelineManager.start(); + + test.evaluateInConsole_(populatePage.toString() + "; populatePage();" + + "inspect(document.getElementById('div1'))", function() {}); + WebInspector.notifications.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step2); + } + + function step2() + { + WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step2); + setTimeout(step3, 500); + } + + function step3() + { + test.evaluateInConsole_("inspect(document.getElementById('div2'))", function() {}); + WebInspector.notifications.addEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step4); + } + + function step4() + { + WebInspector.notifications.removeEventListener(WebInspector.ElementsTreeOutline.Events.SelectedNodeChanged, step4); + dispatchOnRecordType.TimeStamp = step5; + test.evaluateInConsole_("console.timeStamp('ready')", function() {}); + } + + function step5() + { + var types = {}; + WebInspector.timelineManager.stop(); + WebInspector.timelineManager.removeEventListener(WebInspector.TimelineManager.EventTypes.TimelineEventRecorded, addRecord); + for (var i = 0; i < records.length; ++i) + types[records[i].type] = (types[records[i].type] || 0) + 1; + + var frameCount = types["BeginFrame"]; + // There should be at least two updates caused by selection of nodes. + test.assertTrue(frameCount >= 2, "Not enough DevTools overlay updates"); + // We normally expect up to 3 frames, but allow for a bit more in case + // of some unexpected invalidations. + test.assertTrue(frameCount < 6, "Too many updates caused by DevTools overlay"); + test.releaseControl(); + } + + step1(); + this.takeControl(); +} + TestSuite.prototype.waitForTestResultsInConsole = function() { var messages = WebInspector.console.messages; diff --git a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm index b3a22fee1..4854ae218 100644 --- a/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm +++ b/Source/WebKit/chromium/src/mac/WebInputEventFactory.mm @@ -135,9 +135,6 @@ static bool isKeypadEvent(NSEvent* event) return false; } - if ([event modifierFlags] & NSNumericPadKeyMask) - return true; - switch ([event keyCode]) { case 71: // Clear case 81: // = diff --git a/Source/WebKit/chromium/src/painting/PaintAggregator.cpp b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp index a373342ca..89f28d33d 100644 --- a/Source/WebKit/chromium/src/painting/PaintAggregator.cpp +++ b/Source/WebKit/chromium/src/painting/PaintAggregator.cpp @@ -30,10 +30,7 @@ #include "config.h" #include "PaintAggregator.h" - -#include "WebKit.h" -#include "platform/WebKitPlatformSupport.h" - +#include <public/Platform.h> using namespace WebCore; namespace WebKit { |