Regression (r244291): Broken API Test AutoLayoutRenderingProgressRelativeOrdering
[WebKit-https.git] / Source / WebKitLegacy / mac / WebCoreSupport / WebChromeClient.h
1 /*
2  * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
3  * Copyright (C) 2008, 2010 Nokia Corporation and/or its subsidiary(-ies)
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1.  Redistributions of source code must retain the above copyright
10  *     notice, this list of conditions and the following disclaimer.
11  * 2.  Redistributions in binary form must reproduce the above copyright
12  *     notice, this list of conditions and the following disclaimer in the
13  *     documentation and/or other materials provided with the distribution.
14  * 3.  Neither the name of Apple Inc. ("Apple") nor the names of
15  *     its contributors may be used to endorse or promote products derived
16  *     from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #import <WebCore/ChromeClient.h>
31 #import <WebCore/FocusDirection.h>
32 #import <wtf/Forward.h>
33
34 @class WebView;
35
36 // FIXME: This class is used as a concrete class on Mac, but on iOS this is an abstract
37 // base class of the concrete class, WebChromeClientIOS. Because of that, this class and
38 // many of its functions are not marked final. That is messy way to organize things.
39 class WebChromeClient : public WebCore::ChromeClient {
40 public:
41     WebChromeClient(WebView*);
42
43     WebView* webView() const { return m_webView; }
44
45 private:
46     void chromeDestroyed() final;
47
48     void setWindowRect(const WebCore::FloatRect&) override;
49     WebCore::FloatRect windowRect() override;
50
51     WebCore::FloatRect pageRect() final;
52
53     void focus() override;
54     void unfocus() final;
55
56     bool canTakeFocus(WebCore::FocusDirection) final;
57     void takeFocus(WebCore::FocusDirection) override;
58
59     void focusedElementChanged(WebCore::Element*) override;
60     void focusedFrameChanged(WebCore::Frame*) final;
61
62     WebCore::Page* createWindow(WebCore::Frame&, const WebCore::FrameLoadRequest&, const WebCore::WindowFeatures&, const WebCore::NavigationAction&) final;
63     void show() final;
64
65     bool canRunModal() final;
66     void runModal() final;
67
68     void setToolbarsVisible(bool) final;
69     bool toolbarsVisible() final;
70
71     void setStatusbarVisible(bool) final;
72     bool statusbarVisible() final;
73
74     void setScrollbarsVisible(bool) final;
75     bool scrollbarsVisible() final;
76
77     void setMenubarVisible(bool) final;
78     bool menubarVisible() final;
79
80     void setResizable(bool) final;
81
82     void addMessageToConsole(JSC::MessageSource, JSC::MessageLevel, const String& message, unsigned lineNumber, unsigned columnNumber, const String& sourceURL) final;
83
84     bool canRunBeforeUnloadConfirmPanel() final;
85     bool runBeforeUnloadConfirmPanel(const String& message, WebCore::Frame&) final;
86
87     void closeWindowSoon() final;
88
89     void runJavaScriptAlert(WebCore::Frame&, const String&) override;
90     bool runJavaScriptConfirm(WebCore::Frame&, const String&) override;
91     bool runJavaScriptPrompt(WebCore::Frame&, const String& message, const String& defaultValue, String& result) override;
92
93     bool supportsImmediateInvalidation() final;
94     void invalidateRootView(const WebCore::IntRect&) final;
95     void invalidateContentsAndRootView(const WebCore::IntRect&) final;
96     void invalidateContentsForSlowScroll(const WebCore::IntRect&) final;
97     void scroll(const WebCore::IntSize& scrollDelta, const WebCore::IntRect& rectToScroll, const WebCore::IntRect& clipRect) final;
98
99     WebCore::IntPoint screenToRootView(const WebCore::IntPoint&) const final;
100     WebCore::IntRect rootViewToScreen(const WebCore::IntRect&) const final;
101
102     WebCore::IntPoint accessibilityScreenToRootView(const WebCore::IntPoint&) const final;
103     WebCore::IntRect rootViewToAccessibilityScreen(const WebCore::IntRect&) const final;
104
105     PlatformPageClient platformPageClient() const final;
106     void contentsSizeChanged(WebCore::Frame&, const WebCore::IntSize&) const final;
107     void intrinsicContentsSizeChanged(const WebCore::IntSize&) const final { }
108     void scrollRectIntoView(const WebCore::IntRect&) const final;
109
110     void setStatusbarText(const String&) override;
111
112     bool shouldUnavailablePluginMessageBeButton(WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;
113     void unavailablePluginButtonClicked(WebCore::Element&, WebCore::RenderEmbeddedObject::PluginUnavailabilityReason) const final;
114     void mouseDidMoveOverElement(const WebCore::HitTestResult&, unsigned modifierFlags) final;
115
116     void setToolTip(const String&, WebCore::TextDirection) final;
117
118     void print(WebCore::Frame&) final;
119     void exceededDatabaseQuota(WebCore::Frame&, const String& databaseName, WebCore::DatabaseDetails) final;
120     void reachedMaxAppCacheSize(int64_t spaceNeeded) final;
121     void reachedApplicationCacheOriginQuota(WebCore::SecurityOrigin&, int64_t totalSpaceNeeded) final;
122
123 #if ENABLE(DASHBOARD_SUPPORT)
124     void annotatedRegionsChanged() final;
125 #endif
126
127     void runOpenPanel(WebCore::Frame&, WebCore::FileChooser&) override;
128     void showShareSheet(WebCore::ShareDataWithParsedURL&, CompletionHandler<void(bool)>&&) override;
129
130     void loadIconForFiles(const Vector<String>&, WebCore::FileIconLoader&) final;
131     RefPtr<WebCore::Icon> createIconForFiles(const Vector<String>& filenames) override;
132
133 #if !PLATFORM(IOS_FAMILY)
134     void setCursor(const WebCore::Cursor&) final;
135     void setCursorHiddenUntilMouseMoves(bool) final;
136 #endif
137
138 #if ENABLE(INPUT_TYPE_COLOR)
139     std::unique_ptr<WebCore::ColorChooser> createColorChooser(WebCore::ColorChooserClient&, const WebCore::Color&) final;
140 #endif
141
142 #if ENABLE(DATALIST_ELEMENT)
143     std::unique_ptr<WebCore::DataListSuggestionPicker> createDataListSuggestionPicker(WebCore::DataListSuggestionsClient&) final;
144 #endif
145
146 #if ENABLE(POINTER_LOCK)
147     bool requestPointerLock() final;
148     void requestPointerUnlock() final;
149 #endif
150
151     WebCore::KeyboardUIMode keyboardUIMode() final;
152
153     NSResponder *firstResponder() final;
154     void makeFirstResponder(NSResponder *) final;
155
156     void enableSuddenTermination() final;
157     void disableSuddenTermination() final;
158
159     bool shouldReplaceWithGeneratedFileForUpload(const String& path, String &generatedFilename) final;
160     String generateReplacementFile(const String& path) final;
161
162 #if !PLATFORM(IOS_FAMILY)
163     void elementDidFocus(WebCore::Element&) override;
164     void elementDidBlur(WebCore::Element&) override;
165 #endif
166
167     bool shouldPaintEntireContents() const final;
168
169     void attachRootGraphicsLayer(WebCore::Frame&, WebCore::GraphicsLayer*) override;
170     void attachViewOverlayGraphicsLayer(WebCore::GraphicsLayer*) final;
171     void setNeedsOneShotDrawingSynchronization() final;
172     void scheduleCompositingLayerFlush() final;
173
174     CompositingTriggerFlags allowedCompositingTriggers() const final
175     {
176         return static_cast<CompositingTriggerFlags>(
177             ThreeDTransformTrigger |
178             VideoTrigger |
179             PluginTrigger| 
180             CanvasTrigger |
181 #if PLATFORM(IOS_FAMILY)
182             AnimatedOpacityTrigger | // Allow opacity animations to trigger compositing mode for iOS: <rdar://problem/7830677>
183 #endif
184             AnimationTrigger);
185     }
186
187 #if ENABLE(VIDEO) && PLATFORM(MAC) && ENABLE(VIDEO_PRESENTATION_MODE)
188     void setUpPlaybackControlsManager(WebCore::HTMLMediaElement&) final;
189     void clearPlaybackControlsManager() final;
190 #endif
191
192 #if ENABLE(VIDEO)
193     bool supportsVideoFullscreen(WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
194     void enterVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode, bool standby) final;
195     void exitVideoFullscreenForVideoElement(WebCore::HTMLVideoElement&) final;
196     void exitVideoFullscreenToModeWithoutAnimation(WebCore::HTMLVideoElement&, WebCore::HTMLMediaElementEnums::VideoFullscreenMode) final;
197 #endif
198
199 #if ENABLE(FULLSCREEN_API)
200     bool supportsFullScreenForElement(const WebCore::Element&, bool withKeyboard) final;
201     void enterFullScreenForElement(WebCore::Element&) final;
202     void exitFullScreenForElement(WebCore::Element*) final;
203 #endif
204
205     bool selectItemWritingDirectionIsNatural() override;
206     bool selectItemAlignmentFollowsMenuWritingDirection() override;
207     RefPtr<WebCore::PopupMenu> createPopupMenu(WebCore::PopupMenuClient&) const override;
208     RefPtr<WebCore::SearchPopupMenu> createSearchPopupMenu(WebCore::PopupMenuClient&) const override;
209
210     void wheelEventHandlersChanged(bool) final { }
211
212 #if ENABLE(WEB_CRYPTO)
213     bool wrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;
214     bool unwrapCryptoKey(const Vector<uint8_t>&, Vector<uint8_t>&) const final;
215 #endif
216
217 #if ENABLE(SERVICE_CONTROLS)
218     void handleSelectionServiceClick(WebCore::FrameSelection&, const Vector<String>& telephoneNumbers, const WebCore::IntPoint&) final;
219     bool hasRelevantSelectionServices(bool isTextOnly) const final;
220 #endif
221
222 #if ENABLE(WIRELESS_PLAYBACK_TARGET) && !PLATFORM(IOS_FAMILY)
223     void addPlaybackTargetPickerClient(uint64_t /*contextId*/) final;
224     void removePlaybackTargetPickerClient(uint64_t /*contextId*/) final;
225     void showPlaybackTargetPicker(uint64_t /*contextId*/, const WebCore::IntPoint&, bool /* hasVideo */) final;
226     void playbackTargetPickerClientStateDidChange(uint64_t /*contextId*/, WebCore::MediaProducer::MediaStateFlags) final;
227     void setMockMediaPlaybackTargetPickerEnabled(bool) final;
228     void setMockMediaPlaybackTargetPickerState(const String&, WebCore::MediaPlaybackTargetContext::State) final;
229 #endif
230
231     String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String& challengeString, const URL&) const final;
232
233     WebView *m_webView;
234 };