don't discard iframe children.
[kdelibs.git] / khtml / svg / graphics / SVGImageEmptyClients.h
blob73061775a870662229a71335080cfa8549d3f16b
1 /*
2 * Copyright (C) 2006 Eric Seidel (eric@webkit.org)
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 #ifndef SVGImageEmptyClients_h
27 #define SVGImageEmptyClients_h
29 #if ENABLE(SVG)
31 #include "ChromeClient.h"
32 #include "ContextMenuClient.h"
33 #include "DragClient.h"
34 #include "EditorClient.h"
35 #include "FocusDirection.h"
36 #include "FrameLoaderClient.h"
37 #include "InspectorClient.h"
38 #include "SharedBuffer.h"
41 This file holds empty Client stubs for use by SVGImage.
42 SVGImage needs to create a dummy Page->Frame->FrameView tree for use in parsing an SVGDocument.
43 This tree depends heavily on Clients (usually provided by WebKit classes).
45 SVGImage has no way to access the current Page (nor should it, since Images are not tied to a page).
46 See http://bugs.webkit.org/show_bug.cgi?id=5971 for more discussion on this issue.
48 Ideally, whenever you change a Client class, you should add a stub here.
49 Brittle, yes. Unfortunate, yes. Hopefully temporary.
52 namespace WebCore {
54 class SVGEmptyChromeClient : public ChromeClient {
55 public:
56 virtual ~SVGEmptyChromeClient() { }
57 virtual void chromeDestroyed() { }
59 virtual void setWindowRect(const FloatRect&) { }
60 virtual FloatRect windowRect() { return FloatRect(); }
62 virtual FloatRect pageRect() { return FloatRect(); }
64 virtual float scaleFactor() { return 1.f; }
66 virtual void focus() { }
67 virtual void unfocus() { }
69 virtual bool canTakeFocus(FocusDirection) { return false; }
70 virtual void takeFocus(FocusDirection) { }
72 virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&) { return 0; }
73 virtual void show() { }
75 virtual bool canRunModal() { return false; }
76 virtual void runModal() { }
78 virtual void setToolbarsVisible(bool) { }
79 virtual bool toolbarsVisible() { return false; }
81 virtual void setStatusbarVisible(bool) { }
82 virtual bool statusbarVisible() { return false; }
84 virtual void setScrollbarsVisible(bool) { }
85 virtual bool scrollbarsVisible() { return false; }
87 virtual void setMenubarVisible(bool) { }
88 virtual bool menubarVisible() { return false; }
90 virtual void setResizable(bool) { }
92 virtual void addMessageToConsole(const String& message, unsigned int lineNumber, const String& sourceID) { }
94 virtual bool canRunBeforeUnloadConfirmPanel() { return false; }
95 virtual bool runBeforeUnloadConfirmPanel(const String& message, Frame* frame) { return true; }
97 virtual void closeWindowSoon() { }
99 virtual void runJavaScriptAlert(Frame*, const String&) { }
100 virtual bool runJavaScriptConfirm(Frame*, const String&) { return false; }
101 virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) { return false; }
102 virtual bool shouldInterruptJavaScript() { return false; }
104 virtual void setStatusbarText(const String&) { }
106 virtual bool tabsToLinks() const { return false; }
108 virtual IntRect windowResizerRect() const { return IntRect(); }
109 virtual void addToDirtyRegion(const IntRect&) { }
110 virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) { }
111 virtual void updateBackingStore() { }
113 virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) { }
115 virtual void setToolTip(const String&) { }
117 virtual void print(Frame*) { }
119 virtual void exceededDatabaseQuota(Frame*, const String&) { }
122 class SVGEmptyFrameLoaderClient : public FrameLoaderClient {
123 public:
124 virtual ~SVGEmptyFrameLoaderClient() { }
125 virtual void frameLoaderDestroyed() { }
127 virtual bool hasWebView() const { return true; } // mainly for assertions
128 virtual bool hasFrameView() const { return true; } // ditto
130 virtual void makeRepresentation(DocumentLoader*) { }
131 virtual void forceLayout() { }
132 virtual void forceLayoutForNonHTML() { }
134 virtual void updateHistoryForCommit() { }
136 virtual void updateHistoryForBackForwardNavigation() { }
137 virtual void updateHistoryForReload() { }
138 virtual void updateHistoryForStandardLoad() { }
139 virtual void updateHistoryForInternalLoad() { }
141 virtual void updateHistoryAfterClientRedirect() { }
143 virtual void setCopiesOnScroll() { }
145 virtual void detachedFromParent2() { }
146 virtual void detachedFromParent3() { }
147 virtual void detachedFromParent4() { }
149 virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) { }
151 virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&) { }
152 virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long identifier, ResourceRequest&, const ResourceResponse& redirectResponse) { }
153 virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) { }
154 virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&) { }
155 virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long identifier, const ResourceResponse&) { }
156 virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long identifier, int lengthReceived) { }
157 virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long identifier) { }
158 virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long identifier, const ResourceError&) { }
159 virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int length) { return false; }
161 virtual void dispatchDidHandleOnloadEvents() { }
162 virtual void dispatchDidReceiveServerRedirectForProvisionalLoad() { }
163 virtual void dispatchDidCancelClientRedirect() { }
164 virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate) { }
165 virtual void dispatchDidChangeLocationWithinPage() { }
166 virtual void dispatchWillClose() { }
167 virtual void dispatchDidReceiveIcon() { }
168 virtual void dispatchDidStartProvisionalLoad() { }
169 virtual void dispatchDidReceiveTitle(const String& title) { }
170 virtual void dispatchDidCommitLoad() { }
171 virtual void dispatchDidFailProvisionalLoad(const ResourceError&) { }
172 virtual void dispatchDidFailLoad(const ResourceError&) { }
173 virtual void dispatchDidFinishDocumentLoad() { }
174 virtual void dispatchDidFinishLoad() { }
175 virtual void dispatchDidFirstLayout() { }
177 virtual Frame* dispatchCreatePage() { return 0; }
178 virtual void dispatchShow() { }
180 virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction, const String& MIMEType, const ResourceRequest&) { }
181 virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&, const String& frameName) { }
182 virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction, const NavigationAction&, const ResourceRequest&) { }
183 virtual void cancelPolicyCheck() { }
185 virtual void dispatchUnableToImplementPolicy(const ResourceError&) { }
187 virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr<FormState>) { }
189 virtual void dispatchDidLoadMainResource(DocumentLoader*) { }
190 virtual void revertToProvisionalState(DocumentLoader*) { }
191 virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) { }
193 virtual void willChangeEstimatedProgress() { }
194 virtual void didChangeEstimatedProgress() { }
195 virtual void postProgressStartedNotification() { }
196 virtual void postProgressEstimateChangedNotification() { }
197 virtual void postProgressFinishedNotification() { }
199 virtual void setMainFrameDocumentReady(bool) { }
201 virtual void startDownload(const ResourceRequest&) { }
203 virtual void willChangeTitle(DocumentLoader*) { }
204 virtual void didChangeTitle(DocumentLoader*) { }
206 virtual void committedLoad(DocumentLoader*, const char*, int) { }
207 virtual void finishedLoading(DocumentLoader*) { }
209 virtual ResourceError cancelledError(const ResourceRequest&) { return ResourceError(); }
210 virtual ResourceError blockedError(const ResourceRequest&) { return ResourceError(); }
211 virtual ResourceError cannotShowURLError(const ResourceRequest&) { return ResourceError(); }
212 virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&) { return ResourceError(); }
214 virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&) { return ResourceError(); }
215 virtual ResourceError fileDoesNotExistError(const ResourceResponse&) { return ResourceError(); }
217 virtual bool shouldFallBack(const ResourceError&) { return false; }
219 virtual bool canHandleRequest(const ResourceRequest&) const { return false; }
220 virtual bool canShowMIMEType(const String& MIMEType) const { return false; }
221 virtual bool representationExistsForURLScheme(const String& URLScheme) const { return false; }
222 virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const { return ""; }
224 virtual void frameLoadCompleted() { }
225 virtual void restoreViewState() { }
226 virtual void provisionalLoadStarted() { }
227 virtual bool shouldTreatURLAsSameAsCurrent(const KURL&) const { return false; }
228 virtual void addHistoryItemForFragmentScroll() { }
229 virtual void didFinishLoad() { }
230 virtual void prepareForDataSourceReplacement() { }
232 virtual PassRefPtr<DocumentLoader> createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) { return new DocumentLoader(request, substituteData); }
233 virtual void setTitle(const String& title, const KURL&) { }
235 virtual String userAgent(const KURL&) { return ""; }
237 virtual void savePlatformDataToCachedPage(CachedPage*) { }
238 virtual void transitionToCommittedFromCachedPage(CachedPage*) { }
239 virtual void transitionToCommittedForNewPage() { }
241 virtual void updateGlobalHistory(const KURL&) { }
242 virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
243 virtual void saveViewStateToItem(HistoryItem*) { }
244 virtual bool canCachePage() const { return false; }
246 virtual PassRefPtr<Frame> createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement,
247 const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) { return 0; }
248 virtual Widget* createPlugin(const IntSize&,Element*, const KURL&, const Vector<String>&, const Vector<String>&, const String&, bool) { return 0; }
249 virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL&, const Vector<String>&, const Vector<String>&) { return 0; }
251 virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType) { return ObjectContentType(); }
252 virtual String overrideMediaType() const { return String(); }
254 virtual void redirectDataToPlugin(Widget*) {}
255 virtual void windowObjectCleared() {}
256 virtual void didPerformFirstNavigation() const {}
258 virtual void registerForIconNotification(bool listen) {}
260 #if PLATFORM(MAC)
261 virtual NSCachedURLResponse* willCacheResponse(DocumentLoader*, unsigned long identifier, NSCachedURLResponse* response) const { return response; }
262 #endif
266 class SVGEmptyEditorClient : public EditorClient {
267 public:
268 virtual ~SVGEmptyEditorClient() { }
269 virtual void pageDestroyed() { }
271 virtual bool shouldDeleteRange(Range*) { return false; }
272 virtual bool shouldShowDeleteInterface(HTMLElement*) { return false; }
273 virtual bool smartInsertDeleteEnabled() { return false; }
274 virtual bool isContinuousSpellCheckingEnabled() { return false; }
275 virtual void toggleContinuousSpellChecking() { }
276 virtual bool isGrammarCheckingEnabled() { return false; }
277 virtual void toggleGrammarChecking() { }
278 virtual int spellCheckerDocumentTag() { return -1; }
280 virtual bool selectWordBeforeMenuEvent() { return false; }
281 virtual bool isEditable() { return false; }
283 virtual bool shouldBeginEditing(Range*) { return false; }
284 virtual bool shouldEndEditing(Range*) { return false; }
285 virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) { return false; }
286 // virtual bool shouldInsertNode(Node*, Range* replacingRange, WebViewInsertAction) { return false; }
287 virtual bool shouldInsertText(const String&, Range*, EditorInsertAction) { return false; }
288 virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) { return false; }
290 virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) { return false; }
291 virtual bool shouldMoveRangeAfterDelete(Range*, Range*) { return false; }
292 // virtual bool shouldChangeTypingStyle(CSSStyleDeclaration* fromStyle, CSSStyleDeclaration* toStyle) { return false; }
293 // virtual bool doCommandBySelector(SEL selector) { return false; }
295 virtual void didBeginEditing() { }
296 virtual void respondToChangedContents() { }
297 virtual void respondToChangedSelection() { }
298 virtual void didEndEditing() { }
299 virtual void didWriteSelectionToPasteboard() { }
300 virtual void didSetSelectionTypesForPasteboard() { }
301 // virtual void webViewDidChangeTypingStyle:(NSNotification *)notification { }
302 // virtual void webViewDidChangeSelection:(NSNotification *)notification { }
303 // virtual NSUndoManager* undoManagerForWebView:(WebView *)webView { return 0; }
305 virtual void registerCommandForUndo(PassRefPtr<EditCommand>) { }
306 virtual void registerCommandForRedo(PassRefPtr<EditCommand>) { }
307 virtual void clearUndoRedoOperations() { }
309 virtual bool canUndo() const { return false; }
310 virtual bool canRedo() const { return false; }
312 virtual void undo() { }
313 virtual void redo() { }
315 virtual void handleKeyboardEvent(KeyboardEvent*) { }
316 virtual void handleInputMethodKeydown(KeyboardEvent*) { }
318 virtual void textFieldDidBeginEditing(Element*) { }
319 virtual void textFieldDidEndEditing(Element*) { }
320 virtual void textDidChangeInTextField(Element*) { }
321 virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) { return false; }
322 virtual void textWillBeDeletedInTextField(Element*) { }
323 virtual void textDidChangeInTextArea(Element*) { }
325 #if PLATFORM(MAC)
326 virtual void markedTextAbandoned(Frame*) { }
328 virtual NSString* userVisibleString(NSURL*) { return 0; }
329 #ifdef BUILDING_ON_TIGER
330 virtual NSArray* pasteboardTypesForSelection(Frame*) { return 0; }
331 #endif
332 #endif
333 virtual void ignoreWordInSpellDocument(const String&) { }
334 virtual void learnWord(const String&) { }
335 virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) { }
336 virtual void checkGrammarOfString(const UChar*, int length, Vector<GrammarDetail>&, int* badGrammarLocation, int* badGrammarLength) { }
337 virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail&) { }
338 virtual void updateSpellingUIWithMisspelledWord(const String&) { }
339 virtual void showSpellingUI(bool show) { }
340 virtual bool spellingUIIsShowing() { return false; }
341 virtual void getGuessesForWord(const String&, Vector<String>& guesses) { }
342 virtual void setInputMethodState(bool enabled) { }
347 class SVGEmptyContextMenuClient : public ContextMenuClient {
348 public:
349 virtual ~SVGEmptyContextMenuClient() { }
350 virtual void contextMenuDestroyed() { }
352 virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*) { return 0; }
353 virtual void contextMenuItemSelected(ContextMenuItem*, const ContextMenu*) { }
355 virtual void downloadURL(const KURL& url) { }
356 virtual void copyImageToClipboard(const HitTestResult&) { }
357 virtual void searchWithGoogle(const Frame*) { }
358 virtual void lookUpInDictionary(Frame*) { }
359 virtual void speak(const String&) { }
360 virtual void stopSpeaking() { }
362 #if PLATFORM(MAC)
363 virtual void searchWithSpotlight() { }
364 #endif
367 class SVGEmptyDragClient : public DragClient {
368 public:
369 virtual ~SVGEmptyDragClient() {}
370 virtual void willPerformDragDestinationAction(DragDestinationAction, DragData*) { }
371 virtual void willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) { }
372 virtual DragDestinationAction actionMaskForDrag(DragData*) { return DragDestinationActionNone; }
373 virtual DragSourceAction dragSourceActionMaskForPoint(const IntPoint&) { return DragSourceActionNone; }
374 virtual void startDrag(DragImageRef, const IntPoint&, const IntPoint&, Clipboard*, Frame*, bool) { }
375 virtual DragImageRef createDragImageForLink(KURL&, const String& label, Frame*) { return 0; }
376 virtual void dragControllerDestroyed() { }
379 class SVGEmptyInspectorClient : public InspectorClient {
380 public:
381 virtual ~SVGEmptyInspectorClient() {}
383 virtual void inspectorDestroyed() {};
385 virtual Page* createPage() { return 0; };
387 virtual String localizedStringsURL() { return String(); };
389 virtual void showWindow() {};
390 virtual void closeWindow() {};
392 virtual void attachWindow() {};
393 virtual void detachWindow() {};
395 virtual void highlight(Node*) {};
396 virtual void hideHighlight() {};
397 virtual void inspectedURLChanged(const String& newURL) {};
402 #endif // ENABLE(SVG)
404 #endif // SVGImageEmptyClients_h