From 9daf1655d7e4eaaa6ed5f44055a4b4fd399fd25c Mon Sep 17 00:00:00 2001 From: Konstantin Tokarev Date: Wed, 28 Sep 2016 16:39:37 +0300 Subject: Imported WebKit commit eb954cdcf58f9b915b2fcb6f8e4cb3a60650a4f3 Change-Id: I8dda875c38075d43b76fe3a21acb0ffa102bb82d Reviewed-by: Konstantin Tokarev --- .../WebProcess/WebPage/TapHighlightController.cpp | 12 +++--- .../WebProcess/WebPage/TapHighlightController.h | 11 ++--- Source/WebKit2/WebProcess/WebPage/WebPage.cpp | 10 ++--- Source/WebKit2/WebProcess/WebPage/WebPage.h | 1 + .../WebProcess/WebPage/qt/WebInspectorQt.cpp | 49 ---------------------- .../WebProcess/WebPage/qt/WebInspectorUIQt.cpp | 48 +++++++++++++++++++++ Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp | 4 +- 7 files changed, 68 insertions(+), 67 deletions(-) delete mode 100644 Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp create mode 100644 Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp (limited to 'Source/WebKit2/WebProcess/WebPage') diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp index 508595b0f..e086edab4 100644 --- a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp +++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.cpp @@ -75,11 +75,11 @@ void TapHighlightController::hideHighlight() m_webPage->mainFrame()->pageOverlayController().uninstallPageOverlay(m_overlay, PageOverlay::FadeMode::Fade); } -void TapHighlightController::pageOverlayDestroyed(PageOverlay*) +void TapHighlightController::pageOverlayDestroyed(PageOverlay&) { } -void TapHighlightController::willMoveToWebPage(PageOverlay*, WebPage* webPage) +void TapHighlightController::willMoveToPage(PageOverlay&, WebCore::Page* webPage) { if (webPage) return; @@ -89,7 +89,7 @@ void TapHighlightController::willMoveToWebPage(PageOverlay*, WebPage* webPage) m_overlay = 0; } -void TapHighlightController::didMoveToWebPage(PageOverlay*, WebPage*) +void TapHighlightController::didMoveToPage(PageOverlay&, WebCore::Page*) { } @@ -98,19 +98,19 @@ static Color highlightColor(Color baseColor, float fractionFadedIn) return Color(baseColor.red(), baseColor.green(), baseColor.blue(), int(baseColor.alpha() * fractionFadedIn)); } -void TapHighlightController::drawRect(PageOverlay* /*pageOverlay*/, GraphicsContext& context, const IntRect& /*dirtyRect*/) +void TapHighlightController::drawRect(PageOverlay& /*pageOverlay*/, GraphicsContext& context, const IntRect& /*dirtyRect*/) { if (m_path.isEmpty()) return; { GraphicsContextStateSaver stateSaver(context); - context.setFillColor(highlightColor(m_color, 0.5f), ColorSpaceSRGB); + context.setFillColor(highlightColor(m_color, 0.5f)); context.fillPath(m_path); } } -bool TapHighlightController::mouseEvent(PageOverlay*, const WebMouseEvent&) +bool TapHighlightController::mouseEvent(PageOverlay&, const WebCore::PlatformMouseEvent&) { return false; } diff --git a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h index 5c39f7e64..f78b7f469 100644 --- a/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h +++ b/Source/WebKit2/WebProcess/WebPage/TapHighlightController.h @@ -36,6 +36,7 @@ namespace WebCore { class Frame; class IntRect; class Node; +class Page; } namespace WebKit { @@ -54,11 +55,11 @@ public: private: // PageOverlay::Client. - virtual void pageOverlayDestroyed(WebCore::PageOverlay*); - virtual void willMoveToWebPage(WebCore::PageOverlay*, WebPage*); - virtual void didMoveToWebPage(WebCore::PageOverlay*, WebPage*); - virtual bool mouseEvent(WebCore::PageOverlay*, const WebMouseEvent&); - virtual void drawRect(WebCore::PageOverlay*, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect); + void pageOverlayDestroyed(WebCore::PageOverlay&) override; + void willMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; + void didMoveToPage(WebCore::PageOverlay&, WebCore::Page*) override; + bool mouseEvent(WebCore::PageOverlay&, const WebCore::PlatformMouseEvent&) override; + void drawRect(WebCore::PageOverlay&, WebCore::GraphicsContext&, const WebCore::IntRect& dirtyRect) override; private: WebPage* m_webPage; diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp index 71fe0688e..2cd709f22 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.cpp +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.cpp @@ -834,8 +834,8 @@ EditorState WebPage::editorState(IncludePostLayoutDataHint shouldIncludePostLayo if (!scope) return result; - if (isHTMLInputElement(scope)) { - HTMLInputElement* input = toHTMLInputElement(scope); + if (is(scope)) { + HTMLInputElement* input = downcast(scope); if (input->isTelephoneField()) result.inputMethodHints |= Qt::ImhDialableCharactersOnly; else if (input->isNumberField()) @@ -881,8 +881,8 @@ EditorState WebPage::editorState(IncludePostLayoutDataHint shouldIncludePostLayo // FIXME: We should only transfer innerText when it changes and do this on the UI side. if (result.isContentEditable) { - if (isHTMLTextFormControlElement(scope)) - result.surroundingText = toHTMLTextFormControlElement(scope)->innerTextValue(); + if (is(scope)) + result.surroundingText = downcast(scope)->innerTextValue(); else result.surroundingText = scope->innerText(); @@ -2306,7 +2306,7 @@ void WebPage::highlightPotentialActivation(const IntPoint& point, const IntSize& break; // We always highlight focusable (form-elements), image links or content-editable elements. - if ((node->isElementNode() && toElement(node)->isMouseFocusable()) || node->isLink() || node->isContentEditable()) + if ((node->isElementNode() && downcast(node)->isMouseFocusable()) || node->isLink() || node->isContentEditable()) activationNode = node; else if (node->willRespondToMouseClickEvents()) { // Highlight elements with default mouse-click handlers, but highlight only inline elements with diff --git a/Source/WebKit2/WebProcess/WebPage/WebPage.h b/Source/WebKit2/WebProcess/WebPage/WebPage.h index 0a7516c12..8be9a42a9 100644 --- a/Source/WebKit2/WebProcess/WebPage/WebPage.h +++ b/Source/WebKit2/WebProcess/WebPage/WebPage.h @@ -83,6 +83,7 @@ #include "QtNetworkReply.h" #include "QtNetworkReplyData.h" #include "QtNetworkRequestData.h" +#include "TapHighlightController.h" #include #include #endif diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp deleted file mode 100644 index 1d7d539cc..000000000 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorQt.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2010 Apple Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, - * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS - * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF - * THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "config.h" -#include "WebInspector.h" - -#if ENABLE(INSPECTOR) - -#include -#include - -namespace WebKit { - -bool WebInspector::canSave() const -{ - return false; -} - -String WebInspector::localizedStringsURL() const -{ - notImplemented(); - return String(); -} - -} // namespace WebKit - -#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp new file mode 100644 index 000000000..838627309 --- /dev/null +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebInspectorUIQt.cpp @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2010 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "WebInspectorUI.h" + +#if ENABLE(INSPECTOR) + +#include +#include + +namespace WebKit { + +bool WebInspectorUI::canSave() +{ + return false; +} + +String WebInspectorUI::localizedStringsURL() +{ + return ASCIILiteral("qrc:///org/webkitgtk/inspector/Localizations/en.lproj/localizedStrings.js"); +} + +} // namespace WebKit + +#endif // ENABLE(INSPECTOR) diff --git a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp index 6ee8a1d12..654829487 100644 --- a/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp +++ b/Source/WebKit2/WebProcess/WebPage/qt/WebPageQt.cpp @@ -300,7 +300,7 @@ PassRefPtr WebPage::cachedResponseDataForURL(const URL&) void WebPage::registerApplicationScheme(const String& scheme) { - QtNetworkAccessManager* qnam = qobject_cast(WebProcess::shared().networkAccessManager()); + QtNetworkAccessManager* qnam = qobject_cast(WebProcess::singleton().networkAccessManager()); if (!qnam) return; qnam->registerApplicationScheme(this, QString(scheme)); @@ -334,7 +334,7 @@ void WebPage::hidePopupMenu() return; m_activePopupMenu->client()->popupDidHide(); - m_activePopupMenu = 0; + m_activePopupMenu = nullptr; } } // namespace WebKit -- cgit v1.2.1