From 56b2f6f170d3c2b19db9deb6678e3196f37dd0cb Mon Sep 17 00:00:00 2001 From: "kevino@webkit.org" Date: Fri, 9 Nov 2007 05:38:39 +0000 Subject: [PATCH] Adding Bakefiles for JSCore, WebCore, and WebKit, and adding wxWebKit implementation. Reviewed by Mark Rowe git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27631 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- JavaScriptCore/ChangeLog | 9 + JavaScriptCore/JavaScriptCoreSources.bkl | 123 +++ JavaScriptCore/jscore.bkl | 120 +++ WebCore/ChangeLog | 10 + WebCore/WebCoreSources.bkl | 739 ++++++++++++++ WebCore/webcore-base.bkl | 116 +++ WebCore/webcore-wx.bkl | 147 +++ WebKit/ChangeLog | 8 + WebKit/wx/Bakefiles.bkgen | 112 +++ WebKit/wx/ChangeLog | 42 + WebKit/wx/WebFrame.cpp | 326 +++++++ WebKit/wx/WebFrame.h | 98 ++ WebKit/wx/WebKitSupport/ChromeClientWx.cpp | 311 ++++++ WebKit/wx/WebKitSupport/ChromeClientWx.h | 110 +++ .../wx/WebKitSupport/ContextMenuClientWx.cpp | 86 ++ WebKit/wx/WebKitSupport/ContextMenuClientWx.h | 55 ++ WebKit/wx/WebKitSupport/DragClientWx.cpp | 75 ++ WebKit/wx/WebKitSupport/DragClientWx.h | 45 + WebKit/wx/WebKitSupport/EditorClientWx.cpp | 390 ++++++++ WebKit/wx/WebKitSupport/EditorClientWx.h | 110 +++ .../wx/WebKitSupport/FrameLoaderClientWx.cpp | 913 ++++++++++++++++++ WebKit/wx/WebKitSupport/FrameLoaderClientWx.h | 228 +++++ WebKit/wx/WebKitSupport/InspectorClientWx.cpp | 90 ++ WebKit/wx/WebKitSupport/InspectorClientWx.h | 60 ++ WebKit/wx/WebView.cpp | 537 ++++++++++ WebKit/wx/WebView.h | 312 ++++++ WebKit/wx/WebViewPrivate.h | 64 ++ WebKit/wx/bindings/python/samples/simple.py | 162 ++++ WebKit/wx/bindings/python/webview.i | 59 ++ WebKit/wx/bindings/python/wxwebkit-py.bkl | 119 +++ WebKit/wx/dependencies.bkl | 171 ++++ WebKit/wx/presets/wxwebkit.bkl | 131 +++ WebKit/wx/wxwebkit.bkl | 104 ++ WebKit/wx/wxwk-settings.bkl | 72 ++ 34 files changed, 6054 insertions(+) create mode 100644 JavaScriptCore/JavaScriptCoreSources.bkl create mode 100644 JavaScriptCore/jscore.bkl create mode 100644 WebCore/WebCoreSources.bkl create mode 100644 WebCore/webcore-base.bkl create mode 100644 WebCore/webcore-wx.bkl create mode 100644 WebKit/wx/Bakefiles.bkgen create mode 100644 WebKit/wx/ChangeLog create mode 100644 WebKit/wx/WebFrame.cpp create mode 100644 WebKit/wx/WebFrame.h create mode 100644 WebKit/wx/WebKitSupport/ChromeClientWx.cpp create mode 100644 WebKit/wx/WebKitSupport/ChromeClientWx.h create mode 100644 WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp create mode 100644 WebKit/wx/WebKitSupport/ContextMenuClientWx.h create mode 100644 WebKit/wx/WebKitSupport/DragClientWx.cpp create mode 100644 WebKit/wx/WebKitSupport/DragClientWx.h create mode 100644 WebKit/wx/WebKitSupport/EditorClientWx.cpp create mode 100644 WebKit/wx/WebKitSupport/EditorClientWx.h create mode 100644 WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp create mode 100644 WebKit/wx/WebKitSupport/FrameLoaderClientWx.h create mode 100644 WebKit/wx/WebKitSupport/InspectorClientWx.cpp create mode 100644 WebKit/wx/WebKitSupport/InspectorClientWx.h create mode 100644 WebKit/wx/WebView.cpp create mode 100644 WebKit/wx/WebView.h create mode 100644 WebKit/wx/WebViewPrivate.h create mode 100644 WebKit/wx/bindings/python/samples/simple.py create mode 100644 WebKit/wx/bindings/python/webview.i create mode 100644 WebKit/wx/bindings/python/wxwebkit-py.bkl create mode 100644 WebKit/wx/dependencies.bkl create mode 100644 WebKit/wx/presets/wxwebkit.bkl create mode 100644 WebKit/wx/wxwebkit.bkl create mode 100644 WebKit/wx/wxwk-settings.bkl diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index 4abf76bf64b..d72af61b415 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,12 @@ +2007-11-08 Kevin Ollivier + + Bakefiles for building JavaScriptCore, needed by wx port. + + Reviewed by Mark Rowe. + + * JavaScriptCoreSources.bkl: Added. + * jscore.bkl: Added. + 2007-11-08 Oliver Hunt Reviewed by Maciej. diff --git a/JavaScriptCore/JavaScriptCoreSources.bkl b/JavaScriptCore/JavaScriptCoreSources.bkl new file mode 100644 index 00000000000..61763b73979 --- /dev/null +++ b/JavaScriptCore/JavaScriptCoreSources.bkl @@ -0,0 +1,123 @@ + + + + + + API/JSBase.cpp + API/JSCallbackConstructor.cpp + API/JSCallbackFunction.cpp + API/JSCallbackObject.cpp + API/JSClassRef.cpp + API/JSContextRef.cpp + API/JSObjectRef.cpp + API/JSStringRef.cpp + API/JSValueRef.cpp + + + + + + bindings/c/c_class.cpp + bindings/c/c_instance.cpp + bindings/c/c_runtime.cpp + bindings/c/c_utility.cpp + bindings/NP_jsobject.cpp + bindings/npruntime.cpp + bindings/runtime.cpp + bindings/runtime_array.cpp + bindings/runtime_method.cpp + bindings/runtime_object.cpp + bindings/runtime_root.cpp + + + + + DerivedSources/JavaScriptCore/grammar.cpp + kjs/array_instance.cpp + kjs/array_object.cpp + kjs/bool_object.cpp + kjs/collector.cpp + kjs/CommonIdentifiers.cpp + kjs/date_object.cpp + kjs/DateMath.cpp + kjs/debugger.cpp + kjs/dtoa.cpp + kjs/error_object.cpp + kjs/ExecState.cpp + kjs/fpconst.cpp + kjs/function.cpp + kjs/function_object.cpp + kjs/identifier.cpp + kjs/internal.cpp + kjs/interpreter.cpp + kjs/JSImmediate.cpp + kjs/JSLock.cpp + kjs/JSWrapperObject.cpp + kjs/lexer.cpp + kjs/list.cpp + kjs/lookup.cpp + kjs/math_object.cpp + kjs/nodes.cpp + kjs/nodes2string.cpp + kjs/number_object.cpp + kjs/object.cpp + kjs/object_object.cpp + kjs/operations.cpp + kjs/Parser.cpp + kjs/property_map.cpp + kjs/property_slot.cpp + kjs/PropertyNameArray.cpp + kjs/regexp.cpp + kjs/regexp_object.cpp + kjs/scope_chain.cpp + kjs/string_object.cpp + kjs/ustring.cpp + kjs/value.cpp + + + + pcre/pcre_compile.c + pcre/pcre_exec.c + pcre/pcre_ord2utf8.c + pcre/pcre_tables.c + pcre/pcre_ucp_searchfuncs.c + pcre/pcre_xclass.c + + + + wtf/Assertions.cpp + wtf/FastMalloc.cpp + wtf/FastMallocPCRE.cpp + wtf/HashTable.cpp + wtf/TCSystemAlloc.cpp + + + diff --git a/JavaScriptCore/jscore.bkl b/JavaScriptCore/jscore.bkl new file mode 100644 index 00000000000..27febdf11fa --- /dev/null +++ b/JavaScriptCore/jscore.bkl @@ -0,0 +1,120 @@ + + + + + . + + + + + + + 0 + + + obj-$(FORMAT) + + + + + off + off + on + jscore + $(SRCDIR) + $(WKOUTPUTDIR) + $(SRCDIR)/kjs/testkjs.cpp + + $(WKOUTPUTDIR)/libjscore.a + + + jscore + winmm + $(WKOUTPUTDIR) + + + + + + $(SRCDIR) + $(SRCDIR)/wtf + $(SRCDIR)/pcre/dftables.c + + + + + bash make-generated-sources.sh + + + + + + diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index ddcf09264e2..c6a44812130 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,13 @@ +2007-11-08 Kevin Ollivier + + Bakefiles for building WebCore, needed by wx port. + + Reviewed by Mark Rowe. + + * WebCoreSources.bkl: Added. + * webcore-base.bkl: Added. + * webcore-wx.bkl: Added. + 2007-11-08 Justin Haygood Reviewed by Mark Rowe. diff --git a/WebCore/WebCoreSources.bkl b/WebCore/WebCoreSources.bkl new file mode 100644 index 00000000000..d615540b6f4 --- /dev/null +++ b/WebCore/WebCoreSources.bkl @@ -0,0 +1,739 @@ + + + + + + + bindings/js/GCController.cpp + bindings/js/JSAttrCustom.cpp + bindings/js/JSCanvasRenderingContext2DCustom.cpp + bindings/js/JSCSSRuleCustom.cpp + bindings/js/JSCSSStyleDeclarationCustom.cpp + bindings/js/JSCSSValueCustom.cpp + bindings/js/JSCustomSQLCallback.cpp + bindings/js/JSCustomVersionChangeCallback.cpp + bindings/js/JSCustomXPathNSResolver.cpp + bindings/js/JSDatabaseCustom.cpp + bindings/js/JSDOMExceptionConstructor.cpp + bindings/js/JSDOMWindowCustom.cpp + bindings/js/JSDocumentCustom.cpp + bindings/js/JSElementCustom.cpp + bindings/js/JSEventCustom.cpp + bindings/js/JSEventTargetNode.cpp + bindings/js/JSHTMLAppletElementCustom.cpp + bindings/js/JSHTMLCollectionCustom.cpp + bindings/js/JSHTMLDocumentCustom.cpp + bindings/js/JSHTMLElementCustom.cpp + bindings/js/JSHTMLElementWrapperFactory.cpp + bindings/js/JSHTMLEmbedElementCustom.cpp + bindings/js/JSHTMLFormElementCustom.cpp + bindings/js/JSHTMLFrameElementCustom.cpp + bindings/js/JSHTMLFrameSetElementCustom.cpp + bindings/js/JSHTMLIFrameElementCustom.cpp + bindings/js/JSHTMLInputElementBase.cpp + bindings/js/JSHTMLObjectElementCustom.cpp + bindings/js/JSHTMLOptionElementConstructor.cpp + bindings/js/JSHTMLOptionsCollectionCustom.cpp + bindings/js/JSHTMLSelectElementCustom.cpp + bindings/js/JSNamedNodeMapCustom.cpp + bindings/js/JSNamedNodesCollection.cpp + bindings/js/JSNodeCustom.cpp + bindings/js/JSNodeFilterCondition.cpp + bindings/js/JSNodeFilterCustom.cpp + bindings/js/JSNodeIteratorCustom.cpp + bindings/js/JSNodeListCustom.cpp + bindings/js/JSSQLResultSetRowListCustom.cpp + bindings/js/JSStyleSheetCustom.cpp + bindings/js/JSStyleSheetListCustom.cpp + bindings/js/JSTreeWalkerCustom.cpp + bindings/js/JSXMLHttpRequest.cpp + bindings/js/JSXSLTProcessor.cpp + bindings/js/kjs_binding.cpp + bindings/js/kjs_css.cpp + bindings/js/kjs_dom.cpp + bindings/js/kjs_events.cpp + bindings/js/kjs_html.cpp + bindings/js/kjs_navigator.cpp + bindings/js/kjs_proxy.cpp + bindings/js/kjs_window.cpp + + + + css/CSSBorderImageValue.cpp + css/CSSCharsetRule.cpp + css/CSSComputedStyleDeclaration.cpp + css/CSSCursorImageValue.cpp + css/CSSFontFace.cpp + css/CSSFontFaceRule.cpp + css/CSSFontFaceSource.cpp + css/CSSFontFaceSrcValue.cpp + css/CSSFontSelector.cpp + css/CSSImageValue.cpp + css/CSSImportRule.cpp + css/CSSInheritedValue.cpp + css/CSSInitialValue.cpp + css/CSSMediaRule.cpp + css/CSSMutableStyleDeclaration.cpp + css/CSSPageRule.cpp + css/CSSPrimitiveValue.cpp + css/CSSProperty.cpp + css/CSSRule.cpp + css/CSSRuleList.cpp + css/CSSSelector.cpp + css/CSSStyleDeclaration.cpp + css/CSSStyleRule.cpp + css/CSSStyleSheet.cpp + css/CSSTransformValue.cpp + css/CSSTimingFunctionValue.cpp + css/CSSValueList.cpp + css/FontFamilyValue.cpp + css/FontValue.cpp + css/MediaFeatureNames.cpp + css/MediaList.cpp + css/MediaQuery.cpp + css/MediaQueryEvaluator.cpp + css/MediaQueryExp.cpp + css/ShadowValue.cpp + css/StyleBase.cpp + css/StyleList.cpp + css/StyleSheet.cpp + css/StyleSheetList.cpp + css/csshelper.cpp + css/cssparser.cpp + css/cssstyleselector.cpp + + + + DerivedSources/WebCore/CSSGrammar.cpp + DerivedSources/WebCore/ColorData.c + DerivedSources/WebCore/HTMLEntityNames.c + DerivedSources/WebCore/HTMLNames.cpp + DerivedSources/WebCore/JSAttr.cpp + DerivedSources/WebCore/JSBarInfo.cpp + DerivedSources/WebCore/JSCDATASection.cpp + DerivedSources/WebCore/JSCSSCharsetRule.cpp + DerivedSources/WebCore/JSCSSFontFaceRule.cpp + DerivedSources/WebCore/JSCSSImportRule.cpp + DerivedSources/WebCore/JSCSSMediaRule.cpp + DerivedSources/WebCore/JSCSSPageRule.cpp + DerivedSources/WebCore/JSCSSPrimitiveValue.cpp + DerivedSources/WebCore/JSCSSRule.cpp + DerivedSources/WebCore/JSCSSRuleList.cpp + DerivedSources/WebCore/JSCSSStyleDeclaration.cpp + DerivedSources/WebCore/JSCSSStyleRule.cpp + DerivedSources/WebCore/JSCSSStyleSheet.cpp + DerivedSources/WebCore/JSCSSValue.cpp + DerivedSources/WebCore/JSCSSValueList.cpp + DerivedSources/WebCore/JSCanvasGradient.cpp + DerivedSources/WebCore/JSCanvasPattern.cpp + DerivedSources/WebCore/JSCanvasRenderingContext2D.cpp + DerivedSources/WebCore/JSCharacterData.cpp + DerivedSources/WebCore/JSComment.cpp + DerivedSources/WebCore/JSConsole.cpp + DerivedSources/WebCore/JSCounter.cpp + DerivedSources/WebCore/JSDatabase.cpp + DerivedSources/WebCore/JSDocument.cpp + DerivedSources/WebCore/JSDocumentFragment.cpp + DerivedSources/WebCore/JSDocumentType.cpp + DerivedSources/WebCore/JSDOMImplementation.cpp + DerivedSources/WebCore/JSDOMParser.cpp + DerivedSources/WebCore/JSDOMSelection.cpp + DerivedSources/WebCore/JSDOMWindow.cpp + DerivedSources/WebCore/JSElement.cpp + DerivedSources/WebCore/JSEntity.cpp + DerivedSources/WebCore/JSEntityReference.cpp + DerivedSources/WebCore/JSEvent.cpp + DerivedSources/WebCore/JSHTMLAnchorElement.cpp + DerivedSources/WebCore/JSHTMLAppletElement.cpp + DerivedSources/WebCore/JSHTMLAreaElement.cpp + DerivedSources/WebCore/JSHTMLBRElement.cpp + DerivedSources/WebCore/JSHTMLBaseElement.cpp + DerivedSources/WebCore/JSHTMLBaseFontElement.cpp + DerivedSources/WebCore/JSHTMLBlockquoteElement.cpp + DerivedSources/WebCore/JSHTMLBodyElement.cpp + DerivedSources/WebCore/JSHTMLButtonElement.cpp + DerivedSources/WebCore/JSHTMLCanvasElement.cpp + DerivedSources/WebCore/JSHTMLCollection.cpp + DerivedSources/WebCore/JSHTMLDListElement.cpp + DerivedSources/WebCore/JSHTMLDirectoryElement.cpp + DerivedSources/WebCore/JSHTMLDivElement.cpp + DerivedSources/WebCore/JSHTMLDocument.cpp + DerivedSources/WebCore/JSHTMLElement.cpp + DerivedSources/WebCore/JSHTMLEmbedElement.cpp + DerivedSources/WebCore/JSHTMLFieldSetElement.cpp + DerivedSources/WebCore/JSHTMLFontElement.cpp + DerivedSources/WebCore/JSHTMLFormElement.cpp + DerivedSources/WebCore/JSHTMLFrameElement.cpp + DerivedSources/WebCore/JSHTMLFrameSetElement.cpp + DerivedSources/WebCore/JSHTMLHRElement.cpp + DerivedSources/WebCore/JSHTMLHeadElement.cpp + DerivedSources/WebCore/JSHTMLHeadingElement.cpp + DerivedSources/WebCore/JSHTMLHtmlElement.cpp + DerivedSources/WebCore/JSHTMLIFrameElement.cpp + DerivedSources/WebCore/JSHTMLImageElement.cpp + DerivedSources/WebCore/JSHTMLInputElement.cpp + DerivedSources/WebCore/JSHTMLIsIndexElement.cpp + DerivedSources/WebCore/JSHTMLLIElement.cpp + DerivedSources/WebCore/JSHTMLLabelElement.cpp + DerivedSources/WebCore/JSHTMLLegendElement.cpp + DerivedSources/WebCore/JSHTMLLinkElement.cpp + DerivedSources/WebCore/JSHTMLMapElement.cpp + DerivedSources/WebCore/JSHTMLMarqueeElement.cpp + DerivedSources/WebCore/JSHTMLMenuElement.cpp + DerivedSources/WebCore/JSHTMLMetaElement.cpp + DerivedSources/WebCore/JSHTMLModElement.cpp + DerivedSources/WebCore/JSHTMLObjectElement.cpp + DerivedSources/WebCore/JSHTMLOListElement.cpp + DerivedSources/WebCore/JSHTMLOptGroupElement.cpp + DerivedSources/WebCore/JSHTMLOptionElement.cpp + DerivedSources/WebCore/JSHTMLOptionsCollection.cpp + DerivedSources/WebCore/JSHTMLParagraphElement.cpp + DerivedSources/WebCore/JSHTMLParamElement.cpp + DerivedSources/WebCore/JSHTMLPreElement.cpp + DerivedSources/WebCore/JSHTMLQuoteElement.cpp + DerivedSources/WebCore/JSHTMLScriptElement.cpp + DerivedSources/WebCore/JSHTMLSelectElement.cpp + DerivedSources/WebCore/JSHTMLStyleElement.cpp + DerivedSources/WebCore/JSHTMLTableCaptionElement.cpp + DerivedSources/WebCore/JSHTMLTableCellElement.cpp + DerivedSources/WebCore/JSHTMLTableColElement.cpp + DerivedSources/WebCore/JSHTMLTableElement.cpp + DerivedSources/WebCore/JSHTMLTableRowElement.cpp + DerivedSources/WebCore/JSHTMLTableSectionElement.cpp + DerivedSources/WebCore/JSHTMLTextAreaElement.cpp + DerivedSources/WebCore/JSHTMLTitleElement.cpp + DerivedSources/WebCore/JSHTMLUListElement.cpp + DerivedSources/WebCore/JSHistory.cpp + DerivedSources/WebCore/JSKeyboardEvent.cpp + DerivedSources/WebCore/JSMediaList.cpp + DerivedSources/WebCore/JSMouseEvent.cpp + DerivedSources/WebCore/JSMutationEvent.cpp + DerivedSources/WebCore/JSNamedNodeMap.cpp + DerivedSources/WebCore/JSNode.cpp + DerivedSources/WebCore/JSNodeFilter.cpp + DerivedSources/WebCore/JSNodeIterator.cpp + DerivedSources/WebCore/JSNodeList.cpp + DerivedSources/WebCore/JSNotation.cpp + DerivedSources/WebCore/JSOverflowEvent.cpp + DerivedSources/WebCore/JSProcessingInstruction.cpp + DerivedSources/WebCore/JSProgressEvent.cpp + DerivedSources/WebCore/JSRange.cpp + DerivedSources/WebCore/JSRangeException.cpp + DerivedSources/WebCore/JSRect.cpp + DerivedSources/WebCore/JSScreen.cpp + DerivedSources/WebCore/JSSQLCallback.cpp + DerivedSources/WebCore/JSSQLResultSet.cpp + DerivedSources/WebCore/JSSQLResultSetRowList.cpp + DerivedSources/WebCore/JSStyleSheet.cpp + DerivedSources/WebCore/JSStyleSheetList.cpp + DerivedSources/WebCore/JSText.cpp + DerivedSources/WebCore/JSTextEvent.cpp + DerivedSources/WebCore/JSTreeWalker.cpp + DerivedSources/WebCore/JSUIEvent.cpp + DerivedSources/WebCore/JSWheelEvent.cpp + DerivedSources/WebCore/JSXMLSerializer.cpp + DerivedSources/WebCore/JSXPathEvaluator.cpp + DerivedSources/WebCore/JSXPathExpression.cpp + DerivedSources/WebCore/JSXPathNSResolver.cpp + DerivedSources/WebCore/JSXPathResult.cpp + DerivedSources/WebCore/UserAgentStyleSheetsData.cpp + DerivedSources/WebCore/XLinkNames.cpp + DerivedSources/WebCore/XMLNames.cpp + DerivedSources/WebCore/XPathGrammar.cpp + + + + dom/Attr.cpp + dom/Attribute.cpp + dom/BeforeTextInsertedEvent.cpp + dom/BeforeUnloadEvent.cpp + dom/CDATASection.cpp + dom/CSSMappedAttributeDeclaration.cpp + dom/CharacterData.cpp + dom/ChildNodeList.cpp + dom/Clipboard.cpp + dom/ClipboardEvent.cpp + dom/Comment.cpp + dom/ContainerNode.cpp + dom/DOMImplementation.cpp + dom/Document.cpp + dom/DocumentFragment.cpp + dom/DocumentType.cpp + dom/EditingText.cpp + dom/Element.cpp + dom/Entity.cpp + dom/EntityReference.cpp + dom/Event.cpp + dom/EventNames.cpp + dom/EventTarget.cpp + dom/EventTargetNode.cpp + dom/KeyboardEvent.cpp + dom/MappedAttribute.cpp + dom/MouseEvent.cpp + dom/MouseRelatedEvent.cpp + dom/MutationEvent.cpp + dom/NameNodeList.cpp + dom/NamedAttrMap.cpp + dom/NamedMappedAttrMap.cpp + dom/Node.cpp + dom/NodeFilter.cpp + dom/NodeFilterCondition.cpp + dom/NodeIterator.cpp + dom/NodeList.cpp + dom/Notation.cpp + dom/OverflowEvent.cpp + dom/Position.cpp + dom/PositionIterator.cpp + dom/ProcessingInstruction.cpp + dom/ProgressEvent.cpp + dom/QualifiedName.cpp + dom/Range.cpp + dom/RegisteredEventListener.cpp + dom/StyleElement.cpp + dom/StyledElement.cpp + dom/Text.cpp + dom/TextEvent.cpp + dom/Traversal.cpp + dom/TreeWalker.cpp + dom/UIEvent.cpp + dom/UIEventWithKeyState.cpp + dom/WheelEvent.cpp + dom/XMLTokenizer.cpp + + + + editing/AppendNodeCommand.cpp + editing/ApplyStyleCommand.cpp + editing/BreakBlockquoteCommand.cpp + editing/CompositeEditCommand.cpp + editing/CreateLinkCommand.cpp + editing/DeleteButton.cpp + editing/DeleteButtonController.cpp + editing/DeleteFromTextNodeCommand.cpp + editing/DeleteSelectionCommand.cpp + editing/EditCommand.cpp + editing/Editor.cpp + editing/FormatBlockCommand.cpp + editing/HTMLInterchange.cpp + editing/IndentOutdentCommand.cpp + editing/InsertIntoTextNodeCommand.cpp + editing/InsertLineBreakCommand.cpp + editing/InsertListCommand.cpp + editing/InsertNodeBeforeCommand.cpp + editing/InsertParagraphSeparatorCommand.cpp + editing/InsertTextCommand.cpp + editing/JSEditor.cpp + editing/JoinTextNodesCommand.cpp + editing/MergeIdenticalElementsCommand.cpp + editing/ModifySelectionListLevel.cpp + editing/MoveSelectionCommand.cpp + editing/RemoveCSSPropertyCommand.cpp + editing/RemoveNodeAttributeCommand.cpp + editing/RemoveNodeCommand.cpp + editing/RemoveNodePreservingChildrenCommand.cpp + editing/ReplaceSelectionCommand.cpp + editing/Selection.cpp + editing/SelectionController.cpp + editing/SmartReplace.cpp + editing/SetNodeAttributeCommand.cpp + editing/SplitElementCommand.cpp + editing/SplitTextNodeCommand.cpp + editing/SplitTextNodeContainingElementCommand.cpp + editing/TextIterator.cpp + editing/TypingCommand.cpp + editing/UnlinkCommand.cpp + editing/VisiblePosition.cpp + editing/WrapContentsInDummySpanCommand.cpp + editing/htmlediting.cpp + editing/markup.cpp + editing/visible_units.cpp + + + + history/BackForwardList.cpp + history/CachedPage.cpp + history/PageCache.cpp + history/HistoryItem.cpp + + + + html/CanvasGradient.cpp + html/CanvasPattern.cpp + html/CanvasRenderingContext2D.cpp + html/CanvasStyle.cpp + html/FormDataList.cpp + html/HTMLAnchorElement.cpp + html/HTMLAppletElement.cpp + html/HTMLAreaElement.cpp + html/HTMLBRElement.cpp + html/HTMLBaseElement.cpp + html/HTMLBaseFontElement.cpp + html/HTMLBlockquoteElement.cpp + html/HTMLBodyElement.cpp + html/HTMLButtonElement.cpp + html/HTMLCanvasElement.cpp + html/HTMLCollection.cpp + html/HTMLDListElement.cpp + html/HTMLDirectoryElement.cpp + html/HTMLDivElement.cpp + html/HTMLDocument.cpp + html/HTMLElement.cpp + html/HTMLElementFactory.cpp + html/HTMLEmbedElement.cpp + html/HTMLFieldSetElement.cpp + html/HTMLFontElement.cpp + html/HTMLFormCollection.cpp + html/HTMLFormElement.cpp + html/HTMLFrameElement.cpp + html/HTMLFrameElementBase.cpp + html/HTMLFrameOwnerElement.cpp + html/HTMLFrameSetElement.cpp + html/HTMLGenericFormElement.cpp + html/HTMLHRElement.cpp + html/HTMLHeadElement.cpp + html/HTMLHeadingElement.cpp + html/HTMLHtmlElement.cpp + html/HTMLIFrameElement.cpp + html/HTMLImageElement.cpp + html/HTMLImageLoader.cpp + html/HTMLInputElement.cpp + html/HTMLIsIndexElement.cpp + html/HTMLKeygenElement.cpp + html/HTMLLIElement.cpp + html/HTMLLabelElement.cpp + html/HTMLLegendElement.cpp + html/HTMLLinkElement.cpp + html/HTMLMapElement.cpp + html/HTMLMarqueeElement.cpp + html/HTMLMenuElement.cpp + html/HTMLMetaElement.cpp + html/HTMLModElement.cpp + html/HTMLNameCollection.cpp + html/HTMLOListElement.cpp + html/HTMLObjectElement.cpp + html/HTMLOptGroupElement.cpp + html/HTMLOptionElement.cpp + html/HTMLOptionsCollection.cpp + html/HTMLParagraphElement.cpp + html/HTMLParamElement.cpp + html/HTMLParser.cpp + html/HTMLParserErrorCodes.cpp + html/HTMLPlugInElement.cpp + html/HTMLPreElement.cpp + html/HTMLQuoteElement.cpp + html/HTMLScriptElement.cpp + html/HTMLSelectElement.cpp + html/HTMLStyleElement.cpp + html/HTMLTableCaptionElement.cpp + html/HTMLTableCellElement.cpp + html/HTMLTableColElement.cpp + html/HTMLTableElement.cpp + html/HTMLTablePartElement.cpp + html/HTMLTableRowElement.cpp + html/HTMLTableSectionElement.cpp + html/HTMLTextAreaElement.cpp + html/HTMLTextFieldInnerElement.cpp + html/HTMLTitleElement.cpp + html/HTMLTokenizer.cpp + html/HTMLUListElement.cpp + html/HTMLViewSourceDocument.cpp + + + + loader/Cache.cpp + loader/CachedCSSStyleSheet.cpp + loader/CachedFont.cpp + loader/CachedImage.cpp + loader/CachedResource.cpp + loader/CachedResourceClientWalker.cpp + loader/CachedScript.cpp + loader/CachedXSLStyleSheet.cpp + loader/DocLoader.cpp + loader/DocumentLoader.cpp + loader/FormState.cpp + loader/FrameLoader.cpp + loader/FTPDirectoryDocument.cpp + loader/FTPDirectoryParser.cpp + loader/ImageDocument.cpp + loader/MainResourceLoader.cpp + loader/NavigationAction.cpp + loader/NetscapePlugInStreamLoader.cpp + loader/PluginDocument.cpp + loader/ProgressTracker.cpp + loader/Request.cpp + loader/ResourceLoader.cpp + loader/SubresourceLoader.cpp + loader/TextDocument.cpp + loader/TextResourceDecoder.cpp + loader/loader.cpp + + + + loader/icon/IconDatabase.cpp + loader/icon/IconLoader.cpp + loader/icon/IconRecord.cpp + loader/icon/PageURLRecord.cpp + + + + page/AnimationController.cpp + page/BarInfo.cpp + page/Chrome.cpp + page/Console.cpp + page/ContextMenuController.cpp + page/DOMSelection.cpp + page/DOMWindow.cpp + page/DragController.cpp + page/EventHandler.cpp + page/FocusController.cpp + page/Frame.cpp + page/FrameTree.cpp + page/FrameView.cpp + page/History.cpp + page/InspectorController.cpp + page/MouseEventWithHitTestResults.cpp + page/Page.cpp + page/Screen.cpp + page/Settings.cpp + + + + platform/Arena.cpp + platform/ArrayImpl.cpp + platform/AtomicString.cpp + platform/Base64.cpp + platform/BidiContext.cpp + platform/CString.cpp + platform/ContextMenu.cpp + platform/DeprecatedCString.cpp + platform/DeprecatedPtrListImpl.cpp + platform/DeprecatedString.cpp + platform/DeprecatedStringList.cpp + platform/DeprecatedValueListImpl.cpp + platform/DragImage.cpp + platform/FileChooser.cpp + platform/Font.cpp + platform/FontCache.cpp + platform/FontData.cpp + platform/FontFallbackList.cpp + platform/FontFamily.cpp + platform/GlyphPageTreeNode.cpp + platform/GlyphWidthMap.cpp + platform/KURL.cpp + platform/Logging.cpp + platform/MimeTypeRegistry.cpp + platform/RegularExpression.cpp + platform/ScrollBar.cpp + platform/SecurityOrigin.cpp + platform/SegmentedString.cpp + platform/SharedBuffer.cpp + platform/String.cpp + platform/StringImpl.cpp + platform/TextBreakIteratorICU.cpp + platform/TextCodec.cpp + platform/TextCodecICU.cpp + platform/TextCodecLatin1.cpp + platform/TextCodecUTF16.cpp + platform/TextCodecUserDefined.cpp + platform/TextDecoder.cpp + platform/TextEncoding.cpp + platform/TextEncodingRegistry.cpp + platform/TextStream.cpp + platform/ThreadingNone.cpp + platform/Timer.cpp + platform/Widget.cpp + platform/graphics/AffineTransform.cpp + platform/graphics/BitmapImage.cpp + platform/graphics/Color.cpp + platform/graphics/FloatPoint.cpp + platform/graphics/FloatRect.cpp + platform/graphics/FloatSize.cpp + platform/graphics/GraphicsContext.cpp + platform/graphics/GraphicsTypes.cpp + platform/graphics/Image.cpp + platform/graphics/IntRect.cpp + platform/graphics/Path.cpp + platform/graphics/PathTraversalState.cpp + platform/graphics/Pen.cpp + platform/network/AuthenticationChallenge.cpp + platform/network/Credential.cpp + platform/network/HTTPParsers.cpp + platform/network/FormData.cpp + platform/network/ProtectionSpace.cpp + platform/network/ResourceHandle.cpp + platform/network/ResourceRequestBase.cpp + platform/network/ResourceResponse.cpp + platform/sql/SQLiteAuthorizer.cpp + platform/sql/SQLiteDatabase.cpp + platform/sql/SQLiteStatement.cpp + platform/sql/SQLiteTransaction.cpp + platform/sql/SQLValue.cpp + + + + storage/Database.cpp + storage/DatabaseAuthorizer.cpp + storage/DatabaseCallback.cpp + storage/DatabaseTask.cpp + storage/DatabaseThread.cpp + storage/DatabaseTracker.cpp + storage/SQLResultSet.cpp + storage/SQLResultSetRowList.cpp + + + + platform/image-decoders/gif/GIFImageDecoder.cpp + platform/image-decoders/gif/GIFImageReader.cpp + + + + platform/image-decoders/png/PNGImageDecoder.cpp + + + + platform/image-decoders/zlib/adler32.c + platform/image-decoders/zlib/compress.c + platform/image-decoders/zlib/crc32.c + platform/image-decoders/zlib/deflate.c + platform/image-decoders/zlib/gzio.c + platform/image-decoders/zlib/infback.c + platform/image-decoders/zlib/inffast.c + platform/image-decoders/zlib/inflate.c + platform/image-decoders/zlib/inftrees.c + platform/image-decoders/zlib/trees.c + platform/image-decoders/zlib/uncompr.c + platform/image-decoders/zlib/zutil.c + + + + platform/image-decoders/jpeg/JPEGImageDecoder.cpp + + + + platform/image-decoders/bmp/BMPImageDecoder.cpp + + + + platform/image-decoders/ico/ICOImageDecoder.cpp + + + + platform/image-decoders/xbm/XBMImageDecoder.cpp + + + + + rendering/AutoTableLayout.cpp + rendering/CounterNode.cpp + rendering/EllipsisBox.cpp + rendering/FixedTableLayout.cpp + rendering/HitTestResult.cpp + rendering/InlineBox.cpp + rendering/InlineFlowBox.cpp + rendering/InlineTextBox.cpp + rendering/LayoutState.cpp + rendering/ListMarkerBox.cpp + rendering/RenderApplet.cpp + rendering/RenderArena.cpp + rendering/RenderBR.cpp + rendering/RenderBlock.cpp + rendering/RenderBox.cpp + rendering/RenderButton.cpp + rendering/RenderContainer.cpp + rendering/RenderCounter.cpp + rendering/RenderFieldset.cpp + rendering/RenderFileUploadControl.cpp + rendering/RenderFlexibleBox.cpp + rendering/RenderFlow.cpp + rendering/RenderFrame.cpp + rendering/RenderFrameSet.cpp + rendering/RenderHTMLCanvas.cpp + rendering/RenderImage.cpp + rendering/RenderInline.cpp + rendering/RenderLayer.cpp + rendering/RenderLegend.cpp + rendering/RenderListBox.cpp + rendering/RenderListItem.cpp + rendering/RenderListMarker.cpp + rendering/RenderMenuList.cpp + rendering/RenderObject.cpp + rendering/RenderPart.cpp + rendering/RenderPartObject.cpp + rendering/RenderReplaced.cpp + rendering/RenderSlider.cpp + rendering/RenderStyle.cpp + rendering/RenderTable.cpp + rendering/RenderTableCell.cpp + rendering/RenderTableCol.cpp + rendering/RenderTableRow.cpp + rendering/RenderTableSection.cpp + rendering/RenderText.cpp + rendering/RenderTextControl.cpp + rendering/RenderTextFragment.cpp + rendering/RenderTheme.cpp + rendering/RenderTreeAsText.cpp + rendering/RenderView.cpp + rendering/RenderWidget.cpp + rendering/RenderWordBreak.cpp + rendering/RootInlineBox.cpp + rendering/bidi.cpp + rendering/break_lines.cpp + + + + xml/DOMParser.cpp + xml/NativeXPathNSResolver.cpp + xml/XMLSerializer.cpp + xml/XPathEvaluator.cpp + xml/XPathExpression.cpp + xml/XPathExpressionNode.cpp + xml/XPathFunctions.cpp + xml/XPathNamespace.cpp + xml/XPathNodeSet.cpp + xml/XPathNSResolver.cpp + xml/XPathParser.cpp + xml/XPathPath.cpp + xml/XPathPredicate.cpp + xml/XPathResult.cpp + xml/XPathStep.cpp + xml/XPathUtil.cpp + xml/XPathValue.cpp + xml/XPathVariableReference.cpp + xml/XSLImportRule.cpp + xml/XSLStyleSheet.cpp + xml/XSLTExtensions.cpp + xml/XSLTProcessor.cpp + xml/xmlhttprequest.cpp + + + diff --git a/WebCore/webcore-base.bkl b/WebCore/webcore-base.bkl new file mode 100644 index 00000000000..cc79b0b796b --- /dev/null +++ b/WebCore/webcore-base.bkl @@ -0,0 +1,116 @@ + + + + + + + + + $(WEBCORE_SOURCES_BMP) + $(WEBCORE_SOURCES_CSS) + $(WEBCORE_SOURCES_DERIVEDSOURCES) + $(WEBCORE_SOURCES_DOM) + $(WEBCORE_SOURCES_EDITING) + $(WEBCORE_SOURCES_GIF) + $(WEBCORE_SOURCES_HTML) + $(WEBCORE_SOURCES_ICO) + $(WEBCORE_SOURCES_ICON) + $(WEBCORE_SOURCES_JS) + $(WEBCORE_SOURCES_LOADER) + $(WEBCORE_SOURCES_PAGE) + $(WEBCORE_SOURCES_HISTORY) + $(WEBCORE_SOURCES_PLATFORM) + $(WEBCORE_SOURCES_RENDERING) + $(WEBCORE_SOURCES_STORAGE) + $(WEBCORE_SOURCES_XBM) + $(WEBCORE_SOURCES_XML) + $(WEBCORE_SOURCES_ZLIB) + $(WEBCORE_SOURCES_PNG) + $(WEBCORE_SOURCES_JPEG) + + + obj-$(FORMAT) + + + diff --git a/WebCore/webcore-wx.bkl b/WebCore/webcore-wx.bkl new file mode 100644 index 00000000000..c542ca8cea4 --- /dev/null +++ b/WebCore/webcore-wx.bkl @@ -0,0 +1,147 @@ + + + + + + + + 1 + 1 + + + + + + 0 + + + + + cd $(SRCDIR);bash move-js-headers.sh; bash make-generated-sources.sh platform/wx/wx-encodings.txt;cd Projects/wx + + + + + + webcore-wx + $(WKOUTPUTDIR) + + WXUSINGDLL=1 + + + + + diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog index 904b24a875c..7b09d1844c8 100644 --- a/WebKit/ChangeLog +++ b/WebKit/ChangeLog @@ -1,3 +1,11 @@ +2007-11-08 Kevin Ollivier + + Adding the wx WebKit implementation. + + Reviewed by Mark Rowe. + + * wx: Added. + 2007-11-07 Mark Rowe Reviewed by Kevin Decker. diff --git a/WebKit/wx/Bakefiles.bkgen b/WebKit/wx/Bakefiles.bkgen new file mode 100644 index 00000000000..e7de9a732f4 --- /dev/null +++ b/WebKit/wx/Bakefiles.bkgen @@ -0,0 +1,112 @@ + + + + + + + ../../JavaScriptCore/jscore.bkl + ../../WebCore/webcore-wx.bkl + wxwebkit.bkl + bindings/python/wxwebkit-py.bkl + ../../WebKitTools/wx/browser/browser.bkl + + + + + gnu,msvs2005prj,msvc + + + + + -o../../JavaScriptCore/GNUmakefile + + + -o../../JavaScriptCore/JavaScriptCore.sln + + + -o../../JavaScriptCore/makefile.vc + + + + + + -o../../WebCore/GNUmakefile + + + -o../../WebCore/webcore-wx.sln + + + -o../../WebCore/makefile.vc + + + + -oGNUmakefile + + + -owxWebKit.sln + + + -omakefile.vc + + + + -obindings/python/GNUmakefile + + + -obindings/python/wxWebKit.sln + + + -obindings/python/makefile.vc + + + + -o../../WebKitTools/wx/browser/GNUmakefile + + + -o../../WebKitTools/wx/browser/webcore-wx.sln + + + -o../../WebKitTools/wx/browser/makefile.vc + + + + + + + diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog new file mode 100644 index 00000000000..079d5ae92b9 --- /dev/null +++ b/WebKit/wx/ChangeLog @@ -0,0 +1,42 @@ +2007-11-08 Kevin Ollivier + + Initial commit of wx implementation of WebKit. This includes + the wxWebFrame and wxWebView wx front end classes, the + WebKitSupport directory containing implementations of interfaces + used by WebCore to talk with the wxWebKit front end, and the + language bindings for wxWebKit (bindings dir), currently + only containing bindings and a sample app for wxPython. + + Reviewed by Mark Rowe. + + * Bakefiles.bkgen: Added. + * WebFrame.cpp: Added. + * WebFrame.h: Added. + * WebKitSupport: Added. + * WebKitSupport/ChromeClientWx.cpp: Added. + * WebKitSupport/ChromeClientWx.h: Added. + * WebKitSupport/ContextMenuClientWx.cpp: Added. + * WebKitSupport/ContextMenuClientWx.h: Added. + * WebKitSupport/DragClientWx.cpp: Added. + * WebKitSupport/DragClientWx.h: Added. + * WebKitSupport/EditorClientWx.cpp: Added. + * WebKitSupport/EditorClientWx.h: Added. + * WebKitSupport/FrameLoaderClientWx.cpp: Added. + * WebKitSupport/FrameLoaderClientWx.h: Added. + * WebKitSupport/InspectorClientWx.cpp: Added. + * WebKitSupport/InspectorClientWx.h: Added. + * WebView.cpp: Added. + * WebView.h: Added. + * WebViewPrivate.h: Added. + * bindings: Added. + * bindings/python: Added. + * bindings/python/samples: Added. + * bindings/python/samples/simple.py: Added. + * bindings/python/webview.i: Added. + * bindings/python/wxwebkit-py.bkl: Added. + * dependencies.bkl: Added. + * presets: Added. + * presets/wxwebkit.bkl: Added. + * wxwebkit.bkl: Added. + * wxwk-settings.bkl: Added. + diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp new file mode 100644 index 00000000000..6d3efe88193 --- /dev/null +++ b/WebKit/wx/WebFrame.cpp @@ -0,0 +1,326 @@ +/* + * Copyright (C) 2007 Kevin Ollivier 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This class provides a default new window implementation for wxWebView clients + * who don't want/need to roll their own browser frame UI. + */ + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebView.h" +#include "WebFrame.h" +#include "WebViewPrivate.h" + +#include "wx/artprov.h" + +wxPageSourceViewFrame::wxPageSourceViewFrame(const wxString& source) + : wxFrame(NULL, wxID_ANY, _("Page Source View"), wxDefaultPosition, wxSize(600, 500)) +{ + wxTextCtrl* control = new wxTextCtrl(this, -1, source, wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE); +} + +enum { + ID_LOADFILE = wxID_HIGHEST + 1, + ID_TEXTCTRL = wxID_HIGHEST + 2, + ID_BACK = wxID_HIGHEST + 3, + ID_FORWARD = wxID_HIGHEST + 4, + ID_TOGGLE_BEFORE_LOAD = wxID_HIGHEST + 5, + ID_MAKE_TEXT_LARGER = wxID_HIGHEST + 6, + ID_MAKE_TEXT_SMALLER = wxID_HIGHEST + 7, + ID_STOP = wxID_HIGHEST + 8, + ID_RELOAD = wxID_HIGHEST + 9, + ID_GET_SOURCE = wxID_HIGHEST + 10, + ID_SET_SOURCE = wxID_HIGHEST + 11, + ID_SEARCHCTRL = wxID_HIGHEST + 12, + ID_LOADURL = wxID_HIGHEST + 13, + ID_NEW_WINDOW = wxID_HIGHEST + 14, + ID_BROWSE = wxID_HIGHEST + 15, + ID_EDIT = wxID_HIGHEST + 16, + ID_RUN_SCRIPT = wxID_HIGHEST + 17 +}; + +BEGIN_EVENT_TABLE(wxWebFrame, wxFrame) + EVT_MENU(wxID_EXIT, wxWebFrame::OnQuit) + EVT_MENU(wxID_ABOUT, wxWebFrame::OnAbout) + EVT_MENU(ID_LOADFILE, wxWebFrame::OnLoadFile) + EVT_TEXT_ENTER(ID_TEXTCTRL, wxWebFrame::OnAddressBarEnter) + EVT_TEXT_ENTER(ID_SEARCHCTRL, wxWebFrame::OnSearchCtrlEnter) + EVT_WEBVIEW_STATE_CHANGED(wxWebFrame::OnStateChangedEvent) + EVT_WEBVIEW_BEFORE_LOAD(wxWebFrame::OnBeforeLoad) + EVT_MENU(ID_BACK, wxWebFrame::OnBack) + EVT_MENU(ID_FORWARD, wxWebFrame::OnForward) + EVT_MENU(ID_STOP, wxWebFrame::OnStop) + EVT_MENU(ID_RELOAD, wxWebFrame::OnReload) + EVT_MENU(ID_MAKE_TEXT_LARGER, wxWebFrame::OnMakeTextLarger) + EVT_MENU(ID_MAKE_TEXT_SMALLER, wxWebFrame::OnMakeTextSmaller) + EVT_MENU(ID_GET_SOURCE, wxWebFrame::OnGetSource) + EVT_MENU(ID_SET_SOURCE, wxWebFrame::OnSetSource) + EVT_MENU(ID_BROWSE, wxWebFrame::OnBrowse) + EVT_MENU(ID_EDIT, wxWebFrame::OnEdit) + EVT_MENU(ID_RUN_SCRIPT, wxWebFrame::OnRunScript) +END_EVENT_TABLE() + + +wxWebFrame::wxWebFrame(const wxString& title) : + wxFrame(NULL, wxID_ANY, title, wxDefaultPosition, wxSize(600, 500)), + m_checkBeforeLoad(false) +{ + + // create a menu bar + wxMenu *fileMenu = new wxMenu; + fileMenu->Append(ID_NEW_WINDOW, _T("New Window\tCTRL+N")); + fileMenu->Append(ID_LOADFILE, _T("Open File...\tCTRL+O")); + fileMenu->Append(ID_LOADURL, _("Open Location...\tCTRL+L")); + fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt-X"), _T("Quit this program")); + + wxMenu *editMenu = new wxMenu; + editMenu->Append(wxID_CUT, _T("Cut\tCTRL+X")); + editMenu->Append(wxID_COPY, _T("Copy\tCTRL+C")); + editMenu->Append(wxID_PASTE, _T("Paste\tCTRL+V")); + + wxMenu* viewMenu = new wxMenu; + viewMenu->AppendRadioItem(ID_BROWSE, _("Browse")); + viewMenu->AppendRadioItem(ID_EDIT, _("Edit")); + viewMenu->AppendSeparator(); + viewMenu->Append(ID_STOP, _("Stop")); + viewMenu->Append(ID_RELOAD, _("Reload Page")); + viewMenu->Append(ID_MAKE_TEXT_SMALLER, _("Make Text Smaller\tCTRL+-")); + viewMenu->Append(ID_MAKE_TEXT_LARGER, _("Make Text Bigger\tCTRL++")); + viewMenu->AppendSeparator(); + viewMenu->Append(ID_GET_SOURCE, _("View Page Source")); + viewMenu->AppendSeparator(); + + m_debugMenu = new wxMenu; + m_debugMenu->Append(ID_SET_SOURCE, _("Test SetPageSource")); + m_debugMenu->Append(ID_RUN_SCRIPT, _("Test RunScript")); + + // the "About" item should be in the help menu + wxMenu *helpMenu = new wxMenu; + helpMenu->Append(wxID_ABOUT, _T("&About...\tF1"), _T("Show about dialog")); + + // now append the freshly created menu to the menu bar... + wxMenuBar *menuBar = new wxMenuBar(); + menuBar->Append(fileMenu, _T("&File")); + menuBar->Append(editMenu, _T("&Edit")); + menuBar->Append(viewMenu, _T("&View")); + menuBar->Append(helpMenu, _T("&Help")); + + // ... and attach this menu bar to the frame + SetMenuBar(menuBar); +/* + wxToolBar* toolbar = CreateToolBar(); + toolbar->SetToolBitmapSize(wxSize(32, 32)); + + wxBitmap back = wxArtProvider::GetBitmap(wxART_GO_BACK, wxART_TOOLBAR, wxSize(32,32)); + toolbar->AddTool(ID_BACK, back, wxT("Back")); + + wxBitmap forward = wxArtProvider::GetBitmap(wxART_GO_FORWARD, wxART_TOOLBAR, wxSize(32,32)); + toolbar->AddTool(ID_FORWARD, forward, wxT("Next")); + + addressBar = new wxTextCtrl(toolbar, ID_TEXTCTRL, _T(""), wxDefaultPosition, wxSize(400, -1), wxTE_PROCESS_ENTER); + toolbar->AddControl(addressBar); + + searchCtrl = new wxSearchCtrl(toolbar, ID_SEARCHCTRL, _("Search"), wxDefaultPosition, wxSize(200, -1), wxTE_PROCESS_ENTER); + toolbar->AddControl(searchCtrl); + toolbar->Realize(); + + SetToolBar(toolbar); +*/ + // Create the wxWebView Window + webview = new wxWebView((wxWindow*)this, 1001, wxDefaultPosition, wxSize(200, 200)); + webview->SetBackgroundColour(*wxWHITE); + + // create a status bar just for fun (by default with 1 pane only) + CreateStatusBar(2); +} + +wxWebFrame::~wxWebFrame() +{ + if (m_debugMenu && GetMenuBar()->FindMenu(_("&Debug")) == wxNOT_FOUND) + delete m_debugMenu; +} + +void wxWebFrame::ShowDebugMenu(bool show) +{ + int debugMenu = GetMenuBar()->FindMenu(_("&Debug")); + if (show && debugMenu == wxNOT_FOUND) { + int prevMenu = GetMenuBar()->FindMenu(_("&View")); + if (prevMenu != wxNOT_FOUND) + GetMenuBar()->Insert((size_t)prevMenu+1, m_debugMenu, _("&Debug")); + } + else if (!show && debugMenu != wxNOT_FOUND) { + GetMenuBar()->Remove(debugMenu); + } +} + +// event handlers + +void wxWebFrame::OnQuit(wxCommandEvent& WXUNUSED(event)) +{ + // true is to force the frame to close + Close(true); +} + +void wxWebFrame::OnAbout(wxCommandEvent& WXUNUSED(event)) +{ + wxString msg; + msg.Printf(_T("This is the About dialog of the wxWebKit sample.\n") + _T("Welcome to %s"), wxVERSION_STRING); + + wxMessageBox(msg, _T("About wxWebKit Sample"), wxOK | wxICON_INFORMATION, this); + +} + +void wxWebFrame::OnLoadFile(wxCommandEvent& WXUNUSED(event)) +{ + wxFileDialog* dialog = new wxFileDialog(this, wxT("Choose a file")); + if (dialog->ShowModal() == wxID_OK) { + wxString path = dialog->GetPath().Prepend(wxT("file://")); + + if (webview) + webview->LoadURL(path); + } +} + +void wxWebFrame::OnStateChangedEvent(wxWebViewStateChangedEvent& event) +{ + if (GetStatusBar() != NULL){ + if (event.GetState() == wxWEBVIEW_STATE_NEGOTIATING) { + GetStatusBar()->SetStatusText(_("Contacting ") + event.GetURL()); + } + else if (event.GetState() == wxWEBVIEW_STATE_TRANSFERRING) { + GetStatusBar()->SetStatusText(_("Loading ") + event.GetURL()); + } + else if (event.GetState() == wxWEBVIEW_STATE_STOP) { + GetStatusBar()->SetStatusText(_("Load complete.")); + addressBar->SetValue(event.GetURL()); + SetTitle(webview->GetPageTitle()); + } + else if (event.GetState() == wxWEBVIEW_STATE_FAILED) { + GetStatusBar()->SetStatusText(_("Failed to load ") + event.GetURL()); + } + } +} + +void wxWebFrame::OnBeforeLoad(wxWebViewBeforeLoadEvent& myEvent) +{ + if (m_checkBeforeLoad) { + int reply = wxMessageBox(_("Would you like to continue loading ") + myEvent.GetURL() + wxT("?"), _("Continue Loading?"), wxYES_NO); + if (reply == wxNO) { + myEvent.Cancel(); + } + } +} + +void wxWebFrame::OnAddressBarEnter(wxCommandEvent& event) +{ + if (webview) + webview->LoadURL(addressBar->GetValue()); +} + +void wxWebFrame::OnSearchCtrlEnter(wxCommandEvent& event) +{ + if (webview) { + webview->LoadURL(wxString::Format(wxT("http://www.google.com/search?rls=en&q=%s&ie=UTF-8&oe=UTF-8"), searchCtrl->GetValue().wc_str())); + } +} + +void wxWebFrame::OnBack(wxCommandEvent& event) +{ + if (webview) + webview->GoBack(); +} + +void wxWebFrame::OnForward(wxCommandEvent& event) +{ + if (webview) + webview->GoForward(); +} + +void wxWebFrame::OnStop(wxCommandEvent& myEvent) +{ + if (webview) + webview->Stop(); +} + +void wxWebFrame::OnReload(wxCommandEvent& myEvent) +{ + if (webview) + webview->Reload(); +} + +void wxWebFrame::OnMakeTextLarger(wxCommandEvent& myEvent) +{ + if (webview) { + if (webview->CanIncreaseTextSize()) + webview->IncreaseTextSize(); + } +} + +void wxWebFrame::OnMakeTextSmaller(wxCommandEvent& myEvent) +{ + if (webview) { + if (webview->CanDecreaseTextSize()) + webview->DecreaseTextSize(); + } +} + +void wxWebFrame::OnGetSource(wxCommandEvent& myEvent) +{ + if (webview) { + wxPageSourceViewFrame* wxWebFrame = new wxPageSourceViewFrame(webview->GetPageSource()); + wxWebFrame->Show(); + } +} + +void wxWebFrame::OnSetSource(wxCommandEvent& event) +{ + if (webview) + webview->SetPageSource(wxString(wxT("

Hello World!

"))); +} + +void wxWebFrame::OnBrowse(wxCommandEvent& event) +{ + if (webview) + webview->MakeEditable(!event.IsChecked()); +} + +void wxWebFrame::OnEdit(wxCommandEvent& event) +{ + if (webview) + webview->MakeEditable(event.IsChecked()); +} + +void wxWebFrame::OnRunScript(wxCommandEvent& myEvent){ + if (webview) { + wxTextEntryDialog* dialog = new wxTextEntryDialog(this, _("Type in a JavaScript to exectute.")); + if (dialog->ShowModal() == wxID_OK) + wxMessageBox(wxT("Result is: ") + webview->RunScript(dialog->GetValue())); + + dialog->Destroy(); + } +} diff --git a/WebKit/wx/WebFrame.h b/WebKit/wx/WebFrame.h new file mode 100644 index 00000000000..6077a7fa76b --- /dev/null +++ b/WebKit/wx/WebFrame.h @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WXWEBFRAME_H +#define WXWEBFRAME_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "WebView.h" +#include + +class WXDLLIMPEXP_WEBKIT wxWebFrame : public wxFrame +{ +public: + // ctor(s) +#if SWIG + %pythonAppend wxWebFrame "self._setOORInfo(self)" +#endif + wxWebFrame(const wxString& title); + +#ifndef SWIG + ~wxWebFrame(); +#endif + + void ShowDebugMenu(bool show = true); + wxWebView* webview; + +protected: + + // event handlers (these functions should _not_ be virtual) + void OnQuit(wxCommandEvent& event); + void OnAbout(wxCommandEvent& event); + void OnLoadFile(wxCommandEvent& event); + void OnAddressBarEnter(wxCommandEvent& event); + void OnSearchCtrlEnter(wxCommandEvent& event); + void OnStateChangedEvent(wxWebViewStateChangedEvent& event); + void OnBeforeLoad(wxWebViewBeforeLoadEvent& event); + void OnBack(wxCommandEvent& event); + void OnForward(wxCommandEvent& event); + void OnStop(wxCommandEvent& event); + void OnReload(wxCommandEvent& event); + void OnBrowse(wxCommandEvent& event); + void OnEdit(wxCommandEvent& event); + + void OnMakeTextLarger(wxCommandEvent& event); + void OnMakeTextSmaller(wxCommandEvent& event); + void OnGetSource(wxCommandEvent& event); + + // debug menu items + void OnSetSource(wxCommandEvent& event); + void OnRunScript(wxCommandEvent& myEvent); + +private: + wxTextCtrl* addressBar; + wxSearchCtrl* searchCtrl; + + bool m_checkBeforeLoad; + wxMenu* m_debugMenu; + // any class wishing to process wxWindows events must use this macro +#ifndef SWIG + DECLARE_EVENT_TABLE() +#endif +}; + +class WXDLLIMPEXP_WEBKIT wxPageSourceViewFrame : public wxFrame +{ +public: + wxPageSourceViewFrame(const wxString& source); +}; + +#endif // ifndef WXWEBFRAME_H diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.cpp b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp new file mode 100644 index 00000000000..838afc6f744 --- /dev/null +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.cpp @@ -0,0 +1,311 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ChromeClientWx.h" +#include "FloatRect.h" +#include "FrameLoadRequest.h" +#include "NotImplemented.h" +#include "PlatformString.h" + +#include + +#include +#ifndef WX_PRECOMP + #include +#endif +#include + +#include "WebFrame.h" +#include "WebView.h" +#include "WebViewPrivate.h" + +namespace WebCore { + +ChromeClientWx::~ChromeClientWx() +{ +} + +void ChromeClientWx::chromeDestroyed() +{ + notImplemented(); +} + +void ChromeClientWx::setWindowRect(const FloatRect&) +{ + notImplemented(); +} + +FloatRect ChromeClientWx::windowRect() +{ + notImplemented(); + return FloatRect(); +} + +FloatRect ChromeClientWx::pageRect() +{ + notImplemented(); + return FloatRect(); +} + +float ChromeClientWx::scaleFactor() +{ + notImplemented(); + return 0.0; +} + +void ChromeClientWx::focus() +{ + notImplemented(); +} + +void ChromeClientWx::unfocus() +{ + notImplemented(); +} + +bool ChromeClientWx::canTakeFocus(FocusDirection) +{ + notImplemented(); + return false; +} + +void ChromeClientWx::takeFocus(FocusDirection) +{ + notImplemented(); +} + + +Page* ChromeClientWx::createWindow(Frame*, const FrameLoadRequest& request, const WindowFeatures&) +{ + + // FIXME: Create a EVT_WEBKIT_NEW_WINDOW event, and only run this code + // when that event is not handled. + + Page* myPage = 0; + wxWebFrame* newFrame = new wxWebFrame(wxTheApp->GetAppName()); + + if (newFrame->webview) { + newFrame->webview->LoadURL(request.resourceRequest().url().url()); + newFrame->Show(true); + + WebViewPrivate* impl = newFrame->webview->m_impl; + if (impl) + myPage = impl->frame->page(); + } + + return myPage; +} + +Page* ChromeClientWx::createModalDialog(Frame*, const FrameLoadRequest&) +{ + notImplemented(); + return 0; +} + +void ChromeClientWx::show() +{ + notImplemented(); +} + +bool ChromeClientWx::canRunModal() +{ + notImplemented(); + return false; +} + +void ChromeClientWx::runModal() +{ + notImplemented(); +} + +void ChromeClientWx::setToolbarsVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientWx::toolbarsVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientWx::setStatusbarVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientWx::statusbarVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientWx::setScrollbarsVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientWx::scrollbarsVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientWx::setMenubarVisible(bool) +{ + notImplemented(); +} + +bool ChromeClientWx::menubarVisible() +{ + notImplemented(); + return false; +} + +void ChromeClientWx::setResizable(bool) +{ + notImplemented(); +} + +void ChromeClientWx::addMessageToConsole(const String&, + unsigned int, + const String&) +{ + notImplemented(); +} + +bool ChromeClientWx::canRunBeforeUnloadConfirmPanel() +{ + notImplemented(); + return true; +} + +bool ChromeClientWx::runBeforeUnloadConfirmPanel(const String& string, + Frame* frame) +{ + wxMessageDialog dialog(NULL, string, wxT("Confirm Action?"), wxYES_NO); + return dialog.ShowModal() == wxYES; +} + +void ChromeClientWx::closeWindowSoon() +{ + notImplemented(); +} + +/* + Sites for testing prompts: + Alert - just type in a bad web address or http://www.htmlite.com/JS002.php + Prompt - http://www.htmlite.com/JS007.php + Confirm - http://www.htmlite.com/JS006.php +*/ + +void ChromeClientWx::runJavaScriptAlert(Frame* frame, const String& string) +{ + wxMessageBox(string, wxT("JavaScript Alert"), wxOK); +} + +bool ChromeClientWx::runJavaScriptConfirm(Frame* frame, const String& string) +{ + wxMessageDialog dialog(NULL, string, wxT("JavaScript Confirm"), wxYES_NO); + dialog.Centre(); + return (dialog.ShowModal() == wxID_YES); +} + +bool ChromeClientWx::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result) +{ + wxTextEntryDialog dialog(NULL, message, wxT("JavaScript Prompt"), wxEmptyString, wxOK | wxCANCEL); + dialog.Centre(); + if (dialog.ShowModal() == wxID_OK) { + result = dialog.GetValue(); + return true; + } + + return false; +} + +void ChromeClientWx::setStatusbarText(const String&) +{ + notImplemented(); +} + +bool ChromeClientWx::shouldInterruptJavaScript() +{ + notImplemented(); + return false; +} + +bool ChromeClientWx::tabsToLinks() const +{ + notImplemented(); + return false; +} + +IntRect ChromeClientWx::windowResizerRect() const +{ + notImplemented(); + return IntRect(); +} + +void ChromeClientWx::addToDirtyRegion(const IntRect&) +{ + notImplemented(); +} + +void ChromeClientWx::scrollBackingStore(int dx, int dy, + const IntRect& scrollViewRect, + const IntRect& clipRect) +{ + notImplemented(); +} + +void ChromeClientWx::updateBackingStore() +{ + notImplemented(); +} + +void ChromeClientWx::mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags) +{ + notImplemented(); +} + +void ChromeClientWx::setToolTip(const String&) +{ + notImplemented(); +} +void ChromeClientWx::print(Frame*) +{ + notImplemented(); +} + +bool ChromeClientWx::runDatabaseSizeLimitPrompt(Frame*, const String& origin) +{ + notImplemented(); + return false; +} + +} diff --git a/WebKit/wx/WebKitSupport/ChromeClientWx.h b/WebKit/wx/WebKitSupport/ChromeClientWx.h new file mode 100644 index 00000000000..9a1bfceff04 --- /dev/null +++ b/WebKit/wx/WebKitSupport/ChromeClientWx.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ChromeClientWx_H +#define ChromeClientWx_H + +#include "ChromeClient.h" +#include "FocusDirection.h" +#include "IntRect.h" +#include "WebView.h" + +namespace WebCore { + +class ChromeClientWx : public ChromeClient { +public: + virtual ~ChromeClientWx(); + virtual void chromeDestroyed(); + + virtual void setWindowRect(const FloatRect&); + virtual FloatRect windowRect(); + + virtual FloatRect pageRect(); + + virtual float scaleFactor(); + + virtual void focus(); + virtual void unfocus(); + + virtual bool canTakeFocus(FocusDirection); + virtual void takeFocus(FocusDirection); + + virtual Page* createWindow(Frame*, const FrameLoadRequest&, const WindowFeatures&); + virtual Page* createModalDialog(Frame*, const FrameLoadRequest&); + virtual void show(); + + virtual bool canRunModal(); + virtual void runModal(); + + virtual void setToolbarsVisible(bool); + virtual bool toolbarsVisible(); + + virtual void setStatusbarVisible(bool); + virtual bool statusbarVisible(); + + virtual void setScrollbarsVisible(bool); + virtual bool scrollbarsVisible(); + + virtual void setMenubarVisible(bool); + virtual bool menubarVisible(); + + virtual void setResizable(bool); + + virtual void addMessageToConsole(const String& message, + unsigned int lineNumber, + const String& sourceID); + + virtual bool canRunBeforeUnloadConfirmPanel(); + virtual bool runBeforeUnloadConfirmPanel(const String& message, + Frame* frame); + + virtual void closeWindowSoon(); + + virtual void runJavaScriptAlert(Frame*, const String&); + virtual bool runJavaScriptConfirm(Frame*, const String&); + virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result); + virtual void setStatusbarText(const String&); + virtual bool shouldInterruptJavaScript(); + + virtual bool tabsToLinks() const; + + virtual IntRect windowResizerRect() const; + virtual void addToDirtyRegion(const IntRect&); + virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect); + virtual void updateBackingStore(); + + virtual void mouseDidMoveOverElement(const HitTestResult&, unsigned modifierFlags); + + virtual void setToolTip(const String&); + + virtual void print(Frame*); + + virtual bool runDatabaseSizeLimitPrompt(Frame*, const String& origin); +}; + +} +#endif // ChromeClientWx_H diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp new file mode 100644 index 00000000000..8f88f1afcb7 --- /dev/null +++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.cpp @@ -0,0 +1,86 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "ContextMenuClientWx.h" +#include "NotImplemented.h" +#include + +namespace WebCore { + +ContextMenuClientWx::~ContextMenuClientWx() +{ +} + +void ContextMenuClientWx::contextMenuDestroyed() +{ + notImplemented(); +} + +PlatformMenuDescription ContextMenuClientWx::getCustomMenuFromDefaultItems(ContextMenu*) +{ + notImplemented(); + return 0; +} + +void ContextMenuClientWx::contextMenuItemSelected(ContextMenuItem*, + const ContextMenu*) +{ + notImplemented(); +} + +void ContextMenuClientWx::downloadURL(const KURL&) +{ + notImplemented(); +} + +void ContextMenuClientWx::copyImageToClipboard(const HitTestResult&) +{ + notImplemented(); +} + +void ContextMenuClientWx::searchWithGoogle(const Frame*) +{ + notImplemented(); +} + +void ContextMenuClientWx::lookUpInDictionary(Frame*) +{ + notImplemented(); +} + +void ContextMenuClientWx::speak(const String&) +{ + notImplemented(); +} + +void ContextMenuClientWx::stopSpeaking() +{ + notImplemented(); +} + +} diff --git a/WebKit/wx/WebKitSupport/ContextMenuClientWx.h b/WebKit/wx/WebKitSupport/ContextMenuClientWx.h new file mode 100644 index 00000000000..2655974b854 --- /dev/null +++ b/WebKit/wx/WebKitSupport/ContextMenuClientWx.h @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef ContextMenuClientWx_h +#define ContextMenuClientWx_h + +#include "ContextMenuClient.h" +#include "PlatformMenuDescription.h" + +namespace WebCore { + +class ContextMenuClientWx : public ContextMenuClient { +public: + virtual ~ContextMenuClientWx(); + virtual void contextMenuDestroyed(); + + virtual PlatformMenuDescription getCustomMenuFromDefaultItems(ContextMenu*); + virtual void contextMenuItemSelected(ContextMenuItem*, + const ContextMenu*); + + virtual void downloadURL(const KURL&); + virtual void copyImageToClipboard(const HitTestResult&); + virtual void searchWithGoogle(const Frame*); + virtual void lookUpInDictionary(Frame*); + virtual void speak(const String&); + virtual void stopSpeaking(); +}; + +} + +#endif // ContextMenuClientWx_h diff --git a/WebKit/wx/WebKitSupport/DragClientWx.cpp b/WebKit/wx/WebKitSupport/DragClientWx.cpp new file mode 100644 index 00000000000..dcccc342f6f --- /dev/null +++ b/WebKit/wx/WebKitSupport/DragClientWx.cpp @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DragClientWx.h" +#include "NotImplemented.h" + +#include + +namespace WebCore { + +DragDestinationAction DragClientWx::actionMaskForDrag(DragData*) +{ + notImplemented(); + return DragDestinationActionAny; +} + +void DragClientWx::willPerformDragDestinationAction(DragDestinationAction, + DragData*) +{ + notImplemented(); +} + +void DragClientWx::willPerformDragSourceAction(DragSourceAction, const IntPoint&, Clipboard*) +{ + notImplemented(); +} + +void DragClientWx::dragControllerDestroyed() +{ + notImplemented(); +} + +DragSourceAction DragClientWx::dragSourceActionMaskForPoint(const IntPoint&) +{ + notImplemented(); + return DragSourceActionAny; +} + +void DragClientWx::startDrag(DragImageRef dragImage, + const IntPoint& dragImageOrigin, + const IntPoint& eventPos, Clipboard*, + Frame*, bool linkDrag) +{ + notImplemented(); +} + +DragImageRef DragClientWx::createDragImageForLink(KURL&, const String& label, Frame*) +{ + notImplemented(); + return 0; +} + +} diff --git a/WebKit/wx/WebKitSupport/DragClientWx.h b/WebKit/wx/WebKitSupport/DragClientWx.h new file mode 100644 index 00000000000..0e93e6625d5 --- /dev/null +++ b/WebKit/wx/WebKitSupport/DragClientWx.h @@ -0,0 +1,45 @@ +/* + * Copyright (C) 2007 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "DragClient.h" +#include "DragData.h" + +namespace WebCore { + +class DragClientWx : public WebCore::DragClient { +public: + virtual void willPerformDragDestinationAction(WebCore::DragDestinationAction, + WebCore::DragData*); + virtual void willPerformDragSourceAction(WebCore::DragSourceAction, const WebCore::IntPoint&, WebCore::Clipboard*); + + virtual WebCore::DragDestinationAction actionMaskForDrag(WebCore::DragData*); + virtual void dragControllerDestroyed(); + virtual WebCore::DragSourceAction dragSourceActionMaskForPoint(const WebCore::IntPoint&); + + virtual void startDrag(WebCore::DragImageRef dragImage, const WebCore::IntPoint& dragImageOrigin, const WebCore::IntPoint& eventPos, WebCore::Clipboard*, WebCore::Frame*, bool linkDrag = false); + virtual WebCore::DragImageRef createDragImageForLink(WebCore::KURL&, const WebCore::String& label, WebCore::Frame*); +}; + +} diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.cpp b/WebKit/wx/WebKitSupport/EditorClientWx.cpp new file mode 100644 index 00000000000..1f1a5dfd7f4 --- /dev/null +++ b/WebKit/wx/WebKitSupport/EditorClientWx.cpp @@ -0,0 +1,390 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ +#include "config.h" +#include "EditorClientWx.h" + +#include "EditCommand.h" +#include "Editor.h" +#include "FocusController.h" +#include "Frame.h" +#include "FrameView.h" +#include "KeyboardEvent.h" +#include "KeyboardCodes.h" +#include "NotImplemented.h" +#include "Page.h" +#include "PlatformKeyboardEvent.h" +#include "PlatformString.h" +#include "SelectionController.h" +#include "WebView.h" + +#include + +namespace WebCore { + +EditorClientWx::~EditorClientWx() +{ + m_page = NULL; +} + +void EditorClientWx::setPage(Page* page) +{ + m_page = page; +} + +void EditorClientWx::pageDestroyed() +{ + notImplemented(); +} + +bool EditorClientWx::shouldDeleteRange(Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldShowDeleteInterface(HTMLElement*) +{ + notImplemented(); + return false; +} + +bool EditorClientWx::smartInsertDeleteEnabled() +{ + notImplemented(); + return false; +} + +bool EditorClientWx::isContinuousSpellCheckingEnabled() +{ + notImplemented(); + return false; +} + +void EditorClientWx::toggleContinuousSpellChecking() +{ + notImplemented(); +} + +bool EditorClientWx::isGrammarCheckingEnabled() +{ + notImplemented(); + return false; +} + +void EditorClientWx::toggleGrammarChecking() +{ + notImplemented(); +} + +int EditorClientWx::spellCheckerDocumentTag() +{ + notImplemented(); + return 0; +} + +bool EditorClientWx::selectWordBeforeMenuEvent() +{ + notImplemented(); + return false; +} + +bool EditorClientWx::isEditable() +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + + if (frame) { + wxWebView* webKitWin = dynamic_cast(frame->view()->nativeWindow()); + if (webKitWin) + return webKitWin->IsEditable(); + } + return false; +} + +bool EditorClientWx::shouldBeginEditing(Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldEndEditing(Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldInsertNode(Node*, Range*, + EditorInsertAction) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldInsertText(String, Range*, + EditorInsertAction) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldApplyStyle(CSSStyleDeclaration*, + Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldMoveRangeAfterDelete(Range*, Range*) +{ + notImplemented(); + return true; +} + +bool EditorClientWx::shouldChangeSelectedRange(Range* fromRange, Range* toRange, + EAffinity, bool stillSelecting) +{ + notImplemented(); + return true; +} + +void EditorClientWx::didBeginEditing() +{ + notImplemented(); +} + +void EditorClientWx::respondToChangedContents() +{ + notImplemented(); +} + +void EditorClientWx::didEndEditing() +{ + notImplemented(); +} + +void EditorClientWx::didWriteSelectionToPasteboard() +{ + notImplemented(); +} + +void EditorClientWx::didSetSelectionTypesForPasteboard() +{ + notImplemented(); +} + +void EditorClientWx::registerCommandForUndo(PassRefPtr) +{ + notImplemented(); +} + +void EditorClientWx::registerCommandForRedo(PassRefPtr) +{ + notImplemented(); +} + +void EditorClientWx::clearUndoRedoOperations() +{ + notImplemented(); +} + +bool EditorClientWx::canUndo() const +{ + notImplemented(); + return false; +} + +bool EditorClientWx::canRedo() const +{ + notImplemented(); + return false; +} + +void EditorClientWx::undo() +{ + notImplemented(); +} + +void EditorClientWx::redo() +{ + notImplemented(); +} + +void EditorClientWx::handleInputMethodKeypress(KeyboardEvent* event) +{ +// NOTE: we don't currently need to handle this. When key events occur, +// both this method and handleKeypress get a chance at handling them. +// We might use this method later on for IME-specific handling. +} + +void EditorClientWx::handleKeypress(KeyboardEvent* event) +{ + Frame* frame = m_page->focusController()->focusedOrMainFrame(); + if (!frame) + return; + + const PlatformKeyboardEvent* kevent = event->keyEvent(); + if (!kevent->isKeyUp()) { + Node* start = frame->selectionController()->start().node(); + if (!start || !start->isContentEditable()) + return; + + if (kevent->isWxCharEvent() && !kevent->ctrlKey() && !kevent->altKey()) { + switch(kevent->WindowsKeyCode()) { + // we handled these on key down, ignore them for char events + case VK_BACK: + case VK_DELETE: + case VK_LEFT: + case VK_RIGHT: + case VK_UP: + case VK_DOWN: + case VK_RETURN: + break; + default: + frame->editor()->insertText(kevent->text(), event); + } + event->setDefaultHandled(); + return; + } + + switch(kevent->WindowsKeyCode()) { + case VK_BACK: + frame->editor()->deleteWithDirection(SelectionController::BACKWARD, + CharacterGranularity, false, true); + break; + case VK_DELETE: + frame->editor()->deleteWithDirection(SelectionController::FORWARD, + CharacterGranularity, false, true); + break; + case VK_LEFT: + frame->editor()->execCommand("MoveLeft"); + break; + case VK_RIGHT: + frame->editor()->execCommand("MoveRight"); + break; + case VK_UP: + frame->editor()->execCommand("MoveUp"); + break; + case VK_DOWN: + frame->editor()->execCommand("MoveDown"); + break; + case VK_RETURN: + frame->editor()->execCommand("InsertLineBreak"); + default: + break; + } + + event->setDefaultHandled(); + } +} + +void EditorClientWx::textFieldDidBeginEditing(Element*) +{ + notImplemented(); +} + +void EditorClientWx::textFieldDidEndEditing(Element*) +{ + notImplemented(); +} + +void EditorClientWx::textDidChangeInTextField(Element*) +{ + notImplemented(); +} + +bool EditorClientWx::doTextFieldCommandFromEvent(Element*, KeyboardEvent*) +{ + notImplemented(); + return false; +} + +void EditorClientWx::textWillBeDeletedInTextField(Element*) +{ + notImplemented(); +} + +void EditorClientWx::textDidChangeInTextArea(Element*) +{ + notImplemented(); +} + +void EditorClientWx::respondToChangedSelection() +{ + notImplemented(); +} + +void EditorClientWx::ignoreWordInSpellDocument(const String&) +{ + notImplemented(); +} + +void EditorClientWx::learnWord(const String&) +{ + notImplemented(); +} + +void EditorClientWx::checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength) +{ + notImplemented(); +} + +void EditorClientWx::checkGrammarOfString(const UChar*, int length, Vector&, int* badGrammarLocation, int* badGrammarLength) +{ + notImplemented(); +} + +void EditorClientWx::updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail) +{ + notImplemented(); +} + +void EditorClientWx::updateSpellingUIWithMisspelledWord(const String&) +{ + notImplemented(); +} + +void EditorClientWx::showSpellingUI(bool show) +{ + notImplemented(); +} + +bool EditorClientWx::spellingUIIsShowing() +{ + notImplemented(); + return false; +} + +void EditorClientWx::getGuessesForWord(const String&, Vector& guesses) +{ + notImplemented(); +} + +void EditorClientWx::setInputMethodState(bool enabled) +{ + notImplemented(); +} + +} diff --git a/WebKit/wx/WebKitSupport/EditorClientWx.h b/WebKit/wx/WebKitSupport/EditorClientWx.h new file mode 100644 index 00000000000..81f4fa1750f --- /dev/null +++ b/WebKit/wx/WebKitSupport/EditorClientWx.h @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef EditorClientWx_h +#define EditorClientWx_h + +#include "EditorClient.h" +#include "Page.h" + +namespace WebCore { + +class EditorClientWx : public EditorClient { +public: + virtual ~EditorClientWx(); + void setPage(Page*); + virtual void pageDestroyed(); + + virtual bool shouldDeleteRange(Range*); + virtual bool shouldShowDeleteInterface(HTMLElement*); + virtual bool smartInsertDeleteEnabled(); + virtual bool isContinuousSpellCheckingEnabled(); + virtual void toggleContinuousSpellChecking(); + virtual bool isGrammarCheckingEnabled(); + virtual void toggleGrammarChecking(); + virtual int spellCheckerDocumentTag(); + + virtual bool selectWordBeforeMenuEvent(); + virtual bool isEditable(); + + virtual bool shouldBeginEditing(Range*); + virtual bool shouldEndEditing(Range*); + virtual bool shouldInsertNode(Node*, Range*, + EditorInsertAction); + virtual bool shouldInsertText(String, Range*, + EditorInsertAction); + virtual bool shouldApplyStyle(CSSStyleDeclaration*, + Range*); + virtual bool shouldMoveRangeAfterDelete(Range*, Range*); + virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, + EAffinity, bool stillSelecting); + + virtual void didBeginEditing(); + virtual void respondToChangedContents(); + virtual void respondToChangedSelection(); + virtual void didEndEditing(); + virtual void didWriteSelectionToPasteboard(); + virtual void didSetSelectionTypesForPasteboard(); + + virtual void registerCommandForUndo(PassRefPtr); + virtual void registerCommandForRedo(PassRefPtr); + virtual void clearUndoRedoOperations(); + + virtual bool canUndo() const; + virtual bool canRedo() const; + + virtual void undo(); + virtual void redo(); + + virtual void handleKeypress(KeyboardEvent*); + virtual void handleInputMethodKeypress(KeyboardEvent*); + + virtual void textFieldDidBeginEditing(Element*); + virtual void textFieldDidEndEditing(Element*); + virtual void textDidChangeInTextField(Element*); + virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*); + virtual void textWillBeDeletedInTextField(Element*); + virtual void textDidChangeInTextArea(Element*); + + virtual void ignoreWordInSpellDocument(const String&); + virtual void learnWord(const String&); + virtual void checkSpellingOfString(const UChar*, int length, int* misspellingLocation, int* misspellingLength); + virtual void checkGrammarOfString(const UChar*, int length, Vector&, int* badGrammarLocation, int* badGrammarLength); + virtual void updateSpellingUIWithGrammarString(const String&, const GrammarDetail& detail); + virtual void updateSpellingUIWithMisspelledWord(const String&); + virtual void showSpellingUI(bool show); + virtual bool spellingUIIsShowing(); + virtual void getGuessesForWord(const String&, Vector& guesses); + virtual void setInputMethodState(bool enabled); + +private: + Page* m_page; +}; + +} + +#endif // EditorClientWx_h diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp new file mode 100644 index 00000000000..b523eff26ed --- /dev/null +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.cpp @@ -0,0 +1,913 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "FrameLoaderClientWx.h" + +#include "DocumentLoader.h" +#include "Frame.h" +#include "FrameLoaderTypes.h" +#include "FrameView.h" +#include "FrameTree.h" +#include "HTMLFormElement.h" +#include "NotImplemented.h" +#include "Page.h" +#include "PlatformString.h" +#include "ProgressTracker.h" +#include "ResourceError.h" +#include "ResourceResponse.h" + +#include + +#include "WebView.h" +#include "WebViewPrivate.h" + +namespace WebCore { + +inline int wxNavTypeFromWebNavType(NavigationType type){ + if (type == NavigationTypeLinkClicked) + return wxWEBVIEW_NAV_LINK_CLICKED; + + if (type == NavigationTypeFormSubmitted) + return wxWEBVIEW_NAV_FORM_SUBMITTED; + + if (type == NavigationTypeBackForward) + return wxWEBVIEW_NAV_BACK_NEXT; + + if (type == NavigationTypeReload) + return wxWEBVIEW_NAV_RELOAD; + + if (type == NavigationTypeFormResubmitted) + return wxWEBVIEW_NAV_FORM_RESUBMITTED; + + return wxWEBVIEW_NAV_OTHER; +} + +FrameLoaderClientWx::FrameLoaderClientWx() + : m_frame(0) +{ +} + + +FrameLoaderClientWx::~FrameLoaderClientWx() +{ +} + +void FrameLoaderClientWx::setFrame(Frame *frame) +{ + m_frame = frame; +} + +void FrameLoaderClientWx::detachFrameLoader() +{ + m_frame = 0; +} + +void FrameLoaderClientWx::ref() +{ + Shared::ref(); +} + +void FrameLoaderClientWx::deref() +{ + Shared::deref(); +} + +bool FrameLoaderClientWx::hasWebView() const +{ + notImplemented(); + return true; +} + + +bool FrameLoaderClientWx::hasFrameView() const +{ + notImplemented(); + return true; +} + + +bool FrameLoaderClientWx::hasBackForwardList() const +{ + notImplemented(); + return true; +} + + +void FrameLoaderClientWx::resetBackForwardList() +{ + notImplemented(); +} + + +bool FrameLoaderClientWx::provisionalItemIsTarget() const +{ + notImplemented(); + return false; +} + + +bool FrameLoaderClientWx::privateBrowsingEnabled() const +{ + notImplemented(); + return false; +} + + +void FrameLoaderClientWx::makeDocumentView() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::makeRepresentation(DocumentLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::forceLayout() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::forceLayoutForNonHTML() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::updateHistoryForCommit() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::updateHistoryForBackForwardNavigation() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::updateHistoryForReload() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::updateHistoryForStandardLoad() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::updateHistoryForInternalLoad() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::updateHistoryAfterClientRedirect() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::setCopiesOnScroll() +{ + // apparently mac specific + notImplemented(); +} + + +LoadErrorResetToken* FrameLoaderClientWx::tokenForLoadErrorReset() +{ + notImplemented(); + return 0; +} + + +void FrameLoaderClientWx::resetAfterLoadError(LoadErrorResetToken*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::doNotResetAfterLoadError(LoadErrorResetToken*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::willCloseDocument() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::detachedFromParent1() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::detachedFromParent2() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::detachedFromParent3() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::detachedFromParent4() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::loadedFromCachedPage() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchDidHandleOnloadEvents() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchDidReceiveServerRedirectForProvisionalLoad() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchDidCancelClientRedirect() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchWillPerformClientRedirect(const KURL&, + double interval, + double fireDate) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchDidChangeLocationWithinPage() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchWillClose() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchDidStartProvisionalLoad() +{ + wxWindow* target = m_frame->view()->nativeWindow(); + if (target) { + wxWebViewStateChangedEvent wkEvent(target); + wkEvent.SetState(wxWEBVIEW_STATE_NEGOTIATING); + wkEvent.SetURL(m_frame->loader()->provisionalDocumentLoader()->request().url().url()); + target->GetEventHandler()->ProcessEvent(wkEvent); + } +} + + +void FrameLoaderClientWx::dispatchDidReceiveTitle(const String& title) +{ + wxWebView* target = static_cast(m_frame->view()->nativeWindow()); + if (target) + target->SetPageTitle(title); +} + + +void FrameLoaderClientWx::dispatchDidCommitLoad() +{ + wxWindow* target = m_frame->view()->nativeWindow(); + if (target) { + wxWebViewStateChangedEvent wkEvent(target); + wkEvent.SetState(wxWEBVIEW_STATE_TRANSFERRING); + wkEvent.SetURL(m_frame->loader()->documentLoader()->request().url().url()); + target->GetEventHandler()->ProcessEvent(wkEvent); + } +} + +void FrameLoaderClientWx::dispatchDidFinishDocumentLoad() +{ + wxWindow* target = m_frame->view()->nativeWindow(); + if (target) { + wxWebViewStateChangedEvent wkEvent(target); + wkEvent.SetState(wxWEBVIEW_STATE_STOP); + wkEvent.SetURL(m_frame->loader()->URL().url()); + target->GetEventHandler()->ProcessEvent(wkEvent); + } +} + +void FrameLoaderClientWx::dispatchDidFinishLoad() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchDidFirstLayout() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchShow() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::cancelPolicyCheck() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::dispatchWillSubmitForm(FramePolicyFunction function, + PassRefPtr) +{ + // FIXME: Send an event to allow for alerts and cancellation + if (!m_frame) + return; + (m_frame->loader()->*function)(PolicyUse); +} + + +void FrameLoaderClientWx::dispatchDidLoadMainResource(DocumentLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::revertToProvisionalState(DocumentLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::clearUnarchivingState(DocumentLoader*) +{ + notImplemented(); +} + +void FrameLoaderClientWx::postProgressStartedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientWx::postProgressEstimateChangedNotification() +{ + notImplemented(); +} + +void FrameLoaderClientWx::postProgressFinishedNotification() +{ + wxWindow* target = m_frame->view()->nativeWindow(); + if (target) { + wxWebViewStateChangedEvent wkEvent(target); + wkEvent.SetState(wxWEBVIEW_STATE_STOP); + wkEvent.SetURL(m_frame->loader()->url().url()); + target->GetEventHandler()->ProcessEvent(wkEvent); + } +} + +void FrameLoaderClientWx::progressStarted() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::progressCompleted() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::setMainFrameDocumentReady(bool b) +{ + notImplemented(); + // this is only interesting once we provide an external API for the DOM +} + + +void FrameLoaderClientWx::willChangeTitle(DocumentLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::didChangeTitle(DocumentLoader *l) +{ + setTitle(l->title(), l->URL()); +} + + +void FrameLoaderClientWx::finishedLoading(DocumentLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::finalSetupForReplace(DocumentLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::setDefersLoading(bool) +{ + notImplemented(); +} + + +bool FrameLoaderClientWx::isArchiveLoadPending(ResourceLoader*) const +{ + notImplemented(); + return false; +} + + +void FrameLoaderClientWx::cancelPendingArchiveLoad(ResourceLoader*) +{ + notImplemented(); +} + + +void FrameLoaderClientWx::clearArchivedResources() +{ + notImplemented(); +} + + +bool FrameLoaderClientWx::canShowMIMEType(const String& MIMEType) const +{ + notImplemented(); + return true; +} + + +bool FrameLoaderClientWx::representationExistsForURLScheme(const String& URLScheme) const +{ + notImplemented(); + return false; +} + + +String FrameLoaderClientWx::generatedMIMETypeForURLScheme(const String& URLScheme) const +{ + notImplemented(); + return String(); +} + + +void FrameLoaderClientWx::frameLoadCompleted() +{ + notImplemented(); +} + +void FrameLoaderClientWx::saveViewStateToItem(HistoryItem*) +{ + notImplemented(); +} + +void FrameLoaderClientWx::restoreViewState() +{ + notImplemented(); +} + +void FrameLoaderClientWx::restoreScrollPositionAndViewState() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::provisionalLoadStarted() +{ + notImplemented(); +} + + +bool FrameLoaderClientWx::shouldTreatURLAsSameAsCurrent(const KURL&) const +{ + notImplemented(); + return false; +} + + +void FrameLoaderClientWx::addHistoryItemForFragmentScroll() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::didFinishLoad() +{ + notImplemented(); +} + + +void FrameLoaderClientWx::prepareForDataSourceReplacement() +{ + if (m_frame && m_frame->loader()) + m_frame->loader()->detachChildren(); +} + + +void FrameLoaderClientWx::setTitle(const String& title, const KURL&) +{ + notImplemented(); +} + + +String FrameLoaderClientWx::userAgent(const KURL&) +{ + // FIXME: Use the new APIs introduced by the GTK port to fill in these values. + return String("Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/418.9.1 (KHTML, like Gecko) Safari/419.3"); +} + +void FrameLoaderClientWx::dispatchDidReceiveIcon() +{ + notImplemented(); +} + +void FrameLoaderClientWx::frameLoaderDestroyed() +{ + m_frame = 0; + delete this; +} + +bool FrameLoaderClientWx::canHandleRequest(const WebCore::ResourceRequest&) const +{ + notImplemented(); + return true; +} + +void FrameLoaderClientWx::partClearedInBegin() +{ + notImplemented(); +} + +void FrameLoaderClientWx::setDocumentViewFromCachedPage(WebCore::CachedPage*) +{ + notImplemented(); +} + +void FrameLoaderClientWx::updateGlobalHistoryForStandardLoad(const WebCore::KURL&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::updateGlobalHistoryForReload(const WebCore::KURL&) +{ + notImplemented(); +} + +bool FrameLoaderClientWx::shouldGoToHistoryItem(WebCore::HistoryItem*) const +{ + notImplemented(); + return true; +} + +void FrameLoaderClientWx::saveScrollPositionAndViewStateToItem(WebCore::HistoryItem*) +{ + notImplemented(); +} + +void FrameLoaderClientWx::saveDocumentViewToCachedPage(WebCore::CachedPage*) +{ + notImplemented(); +} + +bool FrameLoaderClientWx::canCachePage() const +{ + return false; +} + +void FrameLoaderClientWx::setMainDocumentError(WebCore::DocumentLoader*, const WebCore::ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::committedLoad(WebCore::DocumentLoader* loader, const char* data, int length) +{ + if (!m_frame) + return; + FrameLoader* fl = loader->frameLoader(); + fl->setEncoding(m_response.textEncodingName(), false); + fl->addData(data, length); +} + +WebCore::ResourceError FrameLoaderClientWx::cancelledError(const WebCore::ResourceRequest&) +{ + notImplemented(); + return ResourceError(); +} + +WebCore::ResourceError FrameLoaderClientWx::blockedError(const ResourceRequest&) +{ + notImplemented(); + return ResourceError(); +} + +WebCore::ResourceError FrameLoaderClientWx::cannotShowURLError(const WebCore::ResourceRequest&) +{ + notImplemented(); + return ResourceError(); +} + +WebCore::ResourceError FrameLoaderClientWx::interruptForPolicyChangeError(const WebCore::ResourceRequest&) +{ + notImplemented(); + return ResourceError(); +} + +WebCore::ResourceError FrameLoaderClientWx::cannotShowMIMETypeError(const WebCore::ResourceResponse&) +{ + notImplemented(); + return ResourceError(); +} + +WebCore::ResourceError FrameLoaderClientWx::fileDoesNotExistError(const WebCore::ResourceResponse&) +{ + notImplemented(); + return ResourceError(); +} + +bool FrameLoaderClientWx::shouldFallBack(const WebCore::ResourceError& error) +{ + notImplemented(); + return false; +} + +WTF::PassRefPtr FrameLoaderClientWx::createDocumentLoader(const ResourceRequest& request, const SubstituteData& substituteData) +{ + RefPtr loader = new DocumentLoader(request, substituteData); + return loader.release(); +} + +void FrameLoaderClientWx::download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest& request, const ResourceResponse& response) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long, const AuthenticationChallenge&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchDidReceiveResponse(DocumentLoader* loader, unsigned long id, const ResourceResponse& response) +{ + notImplemented(); + m_response = response; + m_firstData = true; +} + +void FrameLoaderClientWx::dispatchDidReceiveContentLength(DocumentLoader* loader, unsigned long id, int length) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchDidFinishLoading(DocumentLoader*, unsigned long) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&) +{ + notImplemented(); +} + +bool FrameLoaderClientWx::dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int) +{ + notImplemented(); + return false; +} + +void FrameLoaderClientWx::dispatchDidFailProvisionalLoad(const ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::dispatchDidFailLoad(const ResourceError&) +{ + notImplemented(); +} + +Frame* FrameLoaderClientWx::dispatchCreatePage() +{ + notImplemented(); + return false; +} + +void FrameLoaderClientWx::dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String& mimetype, const ResourceRequest& request) +{ + if (!m_frame) + return; + + notImplemented(); + (m_frame->loader()->*function)(PolicyUse); +} + +void FrameLoaderClientWx::dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, const String&) +{ + if (!m_frame) + return; + + notImplemented(); + (m_frame->loader()->*function)(PolicyUse); +} + +void FrameLoaderClientWx::dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction& action, const ResourceRequest& request) +{ + if (!m_frame) + return; + + wxWindow* target = m_frame->view()->nativeWindow(); + if (target) { + wxWebViewBeforeLoadEvent wkEvent(target); + wkEvent.SetNavigationType(wxNavTypeFromWebNavType(action.type())); + wkEvent.SetURL(request.url().url()); + + target->GetEventHandler()->ProcessEvent(wkEvent); + if (wkEvent.IsCancelled()) + (m_frame->loader()->*function)(PolicyIgnore); + else + (m_frame->loader()->*function)(PolicyUse); + + } +} + +void FrameLoaderClientWx::dispatchUnableToImplementPolicy(const ResourceError&) +{ + notImplemented(); +} + +void FrameLoaderClientWx::startDownload(const ResourceRequest&) +{ + notImplemented(); +} + +bool FrameLoaderClientWx::willUseArchive(ResourceLoader*, const ResourceRequest&, const KURL&) const +{ + notImplemented(); + return false; +} + +PassRefPtr FrameLoaderClientWx::createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight) +{ +/* + FIXME: Temporarily disabling code for loading subframes. While most + (i)frames load and are destroyed properly, the iframe created by + google.com in its new homepage does not get destroyed when + document()->detach() is called, as other (i)frames do. It is destroyed on + app shutdown, but until that point, this 'in limbo' frame will do things + like steal keyboard focus and crash when clicked on. (On some platforms, + it is actually a visible object, even though it's not in a valid state.) + + Since just about every user is probably going to test against Google at + some point, I'm disabling this functionality until I have time to track down + why it is not being destroyed. +*/ + +/* + wxWindow* parent = m_frame->view()->nativeWindow(); + + WebViewFrameData* data = new WebViewFrameData(); + data->name = name; + data->ownerElement = ownerElement; + data->url = url; + data->referrer = referrer; + data->marginWidth = marginWidth; + data->marginHeight = marginHeight; + + wxWebView* newWin = new wxWebView(parent, -1, wxDefaultPosition, wxDefaultSize, data); + + RefPtr childFrame = newWin->m_impl->frame; + + // FIXME: All of the below should probably be moved over into WebCore + childFrame->tree()->setName(name); + m_frame->tree()->appendChild(childFrame); + // ### set override encoding if we have one + + FrameLoadType loadType = m_frame->loader()->loadType(); + FrameLoadType childLoadType = FrameLoadTypeInternal; + + childFrame->loader()->load(url, referrer, childLoadType, + String(), 0, 0); + + // The frame's onload handler may have removed it from the document. + if (!childFrame->tree()->parent()) + return 0; + + delete data; + + return childFrame.get(); +*/ + notImplemented(); + return 0; +} + +ObjectContentType FrameLoaderClientWx::objectContentType(const KURL& url, const String& mimeType) +{ + notImplemented(); + return ObjectContentType(); +} + +Widget* FrameLoaderClientWx::createPlugin(const IntSize&, Element*, const KURL&, const Vector&, const Vector&, const String&, bool loadManually) +{ + notImplemented(); + return 0; +} + +void FrameLoaderClientWx::redirectDataToPlugin(Widget* pluginWidget) +{ + notImplemented(); + return; +} + +Widget* FrameLoaderClientWx::createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, + const Vector& paramNames, const Vector& paramValues) +{ + notImplemented(); + return 0; +} + +String FrameLoaderClientWx::overrideMediaType() const +{ + notImplemented(); + return String(); +} + +void FrameLoaderClientWx::windowObjectCleared() +{ + notImplemented(); +} + +void FrameLoaderClientWx::didPerformFirstNavigation() const +{ + notImplemented(); +} + +void FrameLoaderClientWx::registerForIconNotification(bool listen) +{ + notImplemented(); +} + +} diff --git a/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h new file mode 100644 index 00000000000..ce8e8b44407 --- /dev/null +++ b/WebKit/wx/WebKitSupport/FrameLoaderClientWx.h @@ -0,0 +1,228 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef FrameLoaderClientWx_H +#define FrameLoaderClientWx_H + +#include "FrameLoaderClient.h" +#include "FrameLoader.h" +#include "KURL.h" +#include "ResourceResponse.h" +#include "Shared.h" + + +namespace WebCore { + + class AuthenticationChallenge; + class DocumentLoader; + class Element; + class FormState; + class NavigationAction; + class String; + class ResourceLoader; + + struct LoadErrorResetToken; + + class FrameLoaderClientWx : public FrameLoaderClient, public Shared { + public: + FrameLoaderClientWx(); + ~FrameLoaderClientWx(); + void setFrame(Frame *frame); + virtual void detachFrameLoader(); + + virtual void ref(); + virtual void deref(); + + virtual bool hasWebView() const; // mainly for assertions + virtual bool hasFrameView() const; // ditto + + virtual bool hasBackForwardList() const; + virtual void resetBackForwardList(); + + virtual bool provisionalItemIsTarget() const; + + virtual bool privateBrowsingEnabled() const; + + virtual void makeDocumentView(); + virtual void makeRepresentation(DocumentLoader*); + virtual void forceLayout(); + virtual void forceLayoutForNonHTML(); + + virtual void updateHistoryForCommit(); + + virtual void updateHistoryForBackForwardNavigation(); + virtual void updateHistoryForReload(); + virtual void updateHistoryForStandardLoad(); + virtual void updateHistoryForInternalLoad(); + + virtual void updateHistoryAfterClientRedirect(); + + virtual void setCopiesOnScroll(); + + virtual LoadErrorResetToken* tokenForLoadErrorReset(); + virtual void resetAfterLoadError(LoadErrorResetToken*); + virtual void doNotResetAfterLoadError(LoadErrorResetToken*); + + virtual void willCloseDocument(); + + virtual void detachedFromParent1(); + virtual void detachedFromParent2(); + virtual void detachedFromParent3(); + virtual void detachedFromParent4(); + + virtual void loadedFromCachedPage(); + + virtual void frameLoaderDestroyed(); + virtual bool canHandleRequest(const ResourceRequest&) const; + + virtual void dispatchDidHandleOnloadEvents(); + virtual void dispatchDidReceiveServerRedirectForProvisionalLoad(); + virtual void dispatchDidCancelClientRedirect(); + virtual void dispatchWillPerformClientRedirect(const KURL&, double interval, double fireDate); + virtual void dispatchDidChangeLocationWithinPage(); + virtual void dispatchWillClose(); + virtual void dispatchDidReceiveIcon(); + virtual void dispatchDidStartProvisionalLoad(); + virtual void dispatchDidReceiveTitle(const String& title); + virtual void dispatchDidCommitLoad(); + virtual void dispatchDidFinishDocumentLoad(); + virtual void dispatchDidFinishLoad(); + virtual void dispatchDidFirstLayout(); + + virtual void dispatchShow(); + virtual void cancelPolicyCheck(); + + virtual void dispatchWillSubmitForm(FramePolicyFunction, PassRefPtr); + + virtual void dispatchDidLoadMainResource(DocumentLoader*); + virtual void revertToProvisionalState(DocumentLoader*); + virtual void clearUnarchivingState(DocumentLoader*); + + virtual void postProgressStartedNotification(); + virtual void postProgressEstimateChangedNotification(); + virtual void postProgressFinishedNotification(); + + virtual void progressStarted(); + virtual void progressCompleted(); + virtual void setMainFrameDocumentReady(bool); + virtual void willChangeTitle(DocumentLoader*); + virtual void didChangeTitle(DocumentLoader*); + virtual void finishedLoading(DocumentLoader*); + virtual void finalSetupForReplace(DocumentLoader*); + + virtual void setDefersLoading(bool); + virtual bool isArchiveLoadPending(ResourceLoader*) const; + virtual void cancelPendingArchiveLoad(ResourceLoader*); + virtual void clearArchivedResources(); + virtual bool canShowMIMEType(const String& MIMEType) const; + virtual bool representationExistsForURLScheme(const String& URLScheme) const; + virtual String generatedMIMETypeForURLScheme(const String& URLScheme) const; + + virtual void frameLoadCompleted(); + virtual void saveViewStateToItem(HistoryItem*); + virtual void restoreViewState(); + virtual void restoreScrollPositionAndViewState(); + virtual void provisionalLoadStarted(); + virtual bool shouldTreatURLAsSameAsCurrent(const KURL&) const; + virtual void addHistoryItemForFragmentScroll(); + virtual void didFinishLoad(); + virtual void prepareForDataSourceReplacement(); + virtual void setTitle(const String& title, const KURL&); + + virtual String userAgent(const KURL&); + + + virtual void setDocumentViewFromCachedPage(CachedPage*); + virtual void updateGlobalHistoryForStandardLoad(const KURL&); + virtual void updateGlobalHistoryForReload(const KURL&); + virtual bool shouldGoToHistoryItem(HistoryItem*) const; + virtual void saveScrollPositionAndViewStateToItem(HistoryItem*); + virtual void saveDocumentViewToCachedPage(CachedPage*); + virtual bool canCachePage() const; + + virtual void setMainDocumentError(DocumentLoader*, const ResourceError&); + virtual void committedLoad(DocumentLoader*, const char*, int); + virtual ResourceError cancelledError(const ResourceRequest&); + virtual ResourceError blockedError(const ResourceRequest&); + virtual ResourceError cannotShowURLError(const ResourceRequest&); + virtual ResourceError interruptForPolicyChangeError(const ResourceRequest&); + virtual ResourceError cannotShowMIMETypeError(const ResourceResponse&); + virtual ResourceError fileDoesNotExistError(const ResourceResponse&); + virtual bool shouldFallBack(const ResourceError&); + virtual WTF::PassRefPtr createDocumentLoader(const ResourceRequest&, const SubstituteData&); + virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceRequest&, const ResourceResponse&); + + virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&); + + virtual void dispatchWillSendRequest(DocumentLoader*, unsigned long, ResourceRequest&, const ResourceResponse&); + virtual void dispatchDidReceiveAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); + virtual void dispatchDidCancelAuthenticationChallenge(DocumentLoader*, unsigned long identifier, const AuthenticationChallenge&); + virtual void dispatchDidReceiveResponse(DocumentLoader*, unsigned long, const ResourceResponse&); + virtual void dispatchDidReceiveContentLength(DocumentLoader*, unsigned long, int); + virtual void dispatchDidFinishLoading(DocumentLoader*, unsigned long); + virtual void dispatchDidFailLoading(DocumentLoader*, unsigned long, const ResourceError&); + + virtual bool dispatchDidLoadResourceFromMemoryCache(DocumentLoader*, const ResourceRequest&, const ResourceResponse&, int); + virtual void dispatchDidFailProvisionalLoad(const ResourceError&); + virtual void dispatchDidFailLoad(const ResourceError&); + virtual Frame* dispatchCreatePage(); + virtual void dispatchDecidePolicyForMIMEType(FramePolicyFunction function, const String&, const ResourceRequest&); + virtual void dispatchDecidePolicyForNewWindowAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&, const String&); + virtual void dispatchDecidePolicyForNavigationAction(FramePolicyFunction function, const NavigationAction&, const ResourceRequest&); + virtual void dispatchUnableToImplementPolicy(const ResourceError&); + + virtual void startDownload(const ResourceRequest&); + virtual bool willUseArchive(ResourceLoader*, const ResourceRequest&, const KURL&) const; + + // FIXME: This should probably not be here, but it's needed for the tests currently + virtual void partClearedInBegin(); + + virtual PassRefPtr createFrame(const KURL& url, const String& name, HTMLFrameOwnerElement* ownerElement, + const String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); + virtual Widget* createPlugin(const IntSize&, Element*, const KURL&, const Vector&, const Vector&, const String&, bool loadManually) ; + virtual void redirectDataToPlugin(Widget* pluginWidget); + + virtual Widget* createJavaAppletWidget(const IntSize&, Element*, const KURL& baseURL, const Vector& paramNames, const Vector& paramValues); + + virtual ObjectContentType objectContentType(const KURL& url, const String& mimeType); + virtual String overrideMediaType() const; + + virtual void windowObjectCleared(); + + virtual void didPerformFirstNavigation() const; + + virtual void registerForIconNotification(bool listen = true); + + private: + Frame *m_frame; + ResourceResponse m_response; + bool m_firstData; + }; + +} + +#endif diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.cpp b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp new file mode 100644 index 00000000000..4756dbe0df9 --- /dev/null +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.cpp @@ -0,0 +1,90 @@ +/* + * Copyright (C) 2007 Kevin Ollivier 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "InspectorClientWx.h" + +#include "NotImplemented.h" +#include "Page.h" + +namespace WebCore { + +InspectorClientWx::InspectorClientWx() +{ + notImplemented(); +} + +InspectorClientWx::~InspectorClientWx() +{ + notImplemented(); +} + +void InspectorClientWx::inspectorDestroyed() +{ + notImplemented(); +} + +Page* InspectorClientWx::createPage() +{ + notImplemented(); + return 0; +} + +void InspectorClientWx::showWindow() +{ + notImplemented(); +} + +void InspectorClientWx::closeWindow() +{ + notImplemented(); +} + +void InspectorClientWx::attachWindow() +{ + notImplemented(); +} + +void InspectorClientWx::detachWindow() +{ + notImplemented(); +} + +void InspectorClientWx::highlight(Node*) +{ + notImplemented(); +} + +void InspectorClientWx::hideHighlight() +{ + notImplemented(); +} + +void InspectorClientWx::inspectedURLChanged(const String& newURL) +{ + notImplemented(); +} + +}; diff --git a/WebKit/wx/WebKitSupport/InspectorClientWx.h b/WebKit/wx/WebKitSupport/InspectorClientWx.h new file mode 100644 index 00000000000..09f793866f6 --- /dev/null +++ b/WebKit/wx/WebKitSupport/InspectorClientWx.h @@ -0,0 +1,60 @@ +/* + * Copyright (C) Kevin Ollivier 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef InspectorClientWx_h +#define InspectorClientWx_h + +#include "InspectorClient.h" + +namespace WebCore { + +class Node; +class Page; +class String; + +class InspectorClientWx : public InspectorClient { +public: + InspectorClientWx(); + ~InspectorClientWx(); + + virtual void inspectorDestroyed(); + + virtual Page* createPage(); + + virtual void showWindow(); + virtual void closeWindow(); + + virtual void attachWindow(); + virtual void detachWindow(); + + virtual void highlight(Node*); + virtual void hideHighlight(); + + virtual void inspectedURLChanged(const String& newURL); +}; + +} // namespace WebCore + +#endif // !defined(InspectorClient_h) diff --git a/WebKit/wx/WebView.cpp b/WebKit/wx/WebView.cpp new file mode 100644 index 00000000000..ff51d81304f --- /dev/null +++ b/WebKit/wx/WebView.cpp @@ -0,0 +1,537 @@ +/* + * Copyright (C) 2007 Kevin Ollivier 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +#include "config.h" +#include "DeprecatedString.h" +#include "Document.h" +#include "Editor.h" +#include "EventHandler.h" +#include "Frame.h" +#include "FrameLoader.h" +#include "FrameView.h" +#include "GraphicsContext.h" +#include "HTMLFrameOwnerElement.h" +#include "Logging.h" +#include "Page.h" +#include "PlatformKeyboardEvent.h" +#include "PlatformMouseEvent.h" +#include "PlatformString.h" +#include "PlatformWheelEvent.h" +#include "RenderObject.h" +#include "Settings.h" + +#include "ChromeClientWx.h" +#include "ContextMenuClientWx.h" +#include "DragClientWx.h" +#include "EditorClientWx.h" +#include "FrameLoaderClientWx.h" +#include "InspectorClientWx.h" + +#include "kjs_proxy.h" +#include "kjs_binding.h" +#include +#include + +#include "WebView.h" +#include "WebViewPrivate.h" + +#include +#include + +// Match Safari's min/max zoom sizes by default +#define MinimumTextSizeMultiplier 0.5f +#define MaximumTextSizeMultiplier 3.0f +#define TextSizeMultiplierRatio 1.2f + + +#if defined(_MSC_VER) +int rint(double val) +{ + return (int)(val < 0 ? val - 0.5 : val + 0.5); +} +#endif + +// ---------------------------------------------------------------------------- +// wxWebView Events +// ---------------------------------------------------------------------------- + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewStateChangedEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_STATE_CHANGED) + +wxWebViewStateChangedEvent::wxWebViewStateChangedEvent(wxWindow* win) +{ + SetEventType( wxEVT_WEBVIEW_STATE_CHANGED); + SetEventObject( win ); + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewBeforeLoadEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_BEFORE_LOAD) + +wxWebViewBeforeLoadEvent::wxWebViewBeforeLoadEvent(wxWindow* win) +{ + m_cancelled = false; + SetEventType(wxEVT_WEBVIEW_BEFORE_LOAD); + SetEventObject(win); + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewNewWindowEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_NEW_WINDOW) + +wxWebViewNewWindowEvent::wxWebViewNewWindowEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_NEW_WINDOW); + SetEventObject(win); + SetId(win->GetId()); +} + +IMPLEMENT_DYNAMIC_CLASS(wxWebViewRightClickEvent, wxCommandEvent) + +DEFINE_EVENT_TYPE(wxEVT_WEBVIEW_RIGHT_CLICK) + +wxWebViewRightClickEvent::wxWebViewRightClickEvent(wxWindow* win) +{ + SetEventType(wxEVT_WEBVIEW_RIGHT_CLICK); + SetEventObject(win); + SetId(win->GetId()); +} + +//--------------------------------------------------------- +// DOM Element info data type +//--------------------------------------------------------- + +wxWebViewDOMElementInfo::wxWebViewDOMElementInfo() : + m_domElement(NULL), + m_isSelected(false), + m_text(wxEmptyString), + m_imageSrc(wxEmptyString), + m_link(wxEmptyString) +{ +} + +BEGIN_EVENT_TABLE(wxWebView, wxScrolledWindow) + EVT_PAINT(wxWebView::OnPaint) + EVT_SIZE(wxWebView::OnSize) + EVT_MOUSE_EVENTS(wxWebView::OnMouseEvents) + EVT_KEY_DOWN(wxWebView::OnKeyEvents) + EVT_KEY_UP(wxWebView::OnKeyEvents) + EVT_CHAR(wxWebView::OnKeyEvents) + EVT_SET_FOCUS(wxWebView::OnSetFocus) + EVT_KILL_FOCUS(wxWebView::OnKillFocus) + EVT_ACTIVATE(wxWebView::OnActivate) +END_EVENT_TABLE() + +wxWebView::wxWebView(wxWindow* parent, int id, const wxPoint& position, + const wxSize& size, WebViewFrameData* data) : + m_textMagnifier(1.0), + m_isEditable(false), + m_isInitialized(false), + m_beingDestroyed(false), + m_title(wxEmptyString) +{ + if (!wxScrolledWindow::Create(parent, id, position, size)) + return; + + // this helps reduce flicker on platforms like MSW + SetBackgroundStyle(wxBG_STYLE_CUSTOM); + + m_impl = new WebViewPrivate(); + + WebCore::InitializeLoggingChannelsIfNecessary(); + WebCore::HTMLFrameOwnerElement* parentFrame = 0; + WebCore::Page* page = 0; + + // FIXME: This cast is obviously not as safe as a dynamic + // cast, but this allows us to get around requiring RTTI + // support for the moment. This is only used for subframes + // in any case, which aren't currently supported. + wxWebView* parentWebView = static_cast(parent); + + if (data) { + parentFrame = data->ownerElement; + page = parentWebView->m_impl->frame->page(); + } + else { + WebCore::EditorClientWx* editorClient = new WebCore::EditorClientWx(); + page = new WebCore::Page(new WebCore::ChromeClientWx(), new WebCore::ContextMenuClientWx(), editorClient, new WebCore::DragClientWx(), new WebCore::InspectorClientWx()); + editorClient->setPage(page); + } + + WebCore::FrameLoaderClientWx* loaderClient = new WebCore::FrameLoaderClientWx(); + + m_impl->frame = new WebCore::Frame(page, parentFrame, loaderClient); + m_impl->frame->deref(); + m_impl->frameView = new WebCore::FrameView(m_impl->frame.get()); + m_impl->frameView->deref(); + + m_impl->frame->setView(m_impl->frameView.get()); + m_impl->frame->init(); + + m_impl->frameView->setNativeWindow(this); + loaderClient->setFrame(m_impl->frame.get()); + + // Default settings - we should have wxWebViewSettings class for this + // eventually + WebCore::Settings* settings = page->settings(); + settings->setLoadsImagesAutomatically(true); + settings->setDefaultFixedFontSize(13); + settings->setDefaultFontSize(16); + settings->setSerifFontFamily("Times New Roman"); + settings->setFixedFontFamily("Courier New"); + settings->setSansSerifFontFamily("Arial"); + settings->setStandardFontFamily("Times New Roman"); + settings->setJavaScriptEnabled(true); + + m_isInitialized = true; +} + +wxWebView::~wxWebView() +{ + m_beingDestroyed = true; + + m_impl->frame->loader()->detachFromParent(); + + // This test determines whether or not the frame is a subframe + // or the main (top level) frame. If it's the main frame, then + // delete its page to keep leaks from occurring + if (!m_impl->frame->ownerElement()) { + delete m_impl->frame->page(); + } + m_impl->frameView = 0; + m_impl->frame = 0; + + delete m_impl; +} + +void wxWebView::Stop() +{ + if (m_impl->frame && m_impl->frame->loader()) + m_impl->frame->loader()->stop(); +} + +void wxWebView::Reload() +{ + if (m_impl->frame && m_impl->frame->loader()) + m_impl->frame->loader()->reload(); +} + +wxString wxWebView::GetPageSource() +{ + if (m_impl->frame) { + WebCore::Document* doc = m_impl->frame->document(); + + if (doc) { + wxString source = doc->toString(); + return source; + } + } + return wxEmptyString; +} + +void wxWebView::SetPageSource(const wxString& source, const wxString& baseUrl) +{ + if (m_impl->frame && m_impl->frame->loader()) { + WebCore::FrameLoader* loader = m_impl->frame->loader(); + loader->begin(WebCore::KURL(static_cast(baseUrl.mb_str(wxConvUTF8)))); + loader->write(source); + loader->end(); + } +} + +wxString wxWebView::RunScript(const wxString& javascript) +{ + wxString returnValue = wxEmptyString; + if (m_impl->frame) { + KJS::JSValue* result = m_impl->frame->loader()->executeScript(javascript, true); + if (result) + returnValue = wxString(result->toString(m_impl->frame->scriptProxy()->interpreter()->globalExec()).UTF8String().c_str(), wxConvUTF8); + } + return returnValue; +} + +void wxWebView::LoadURL(wxString url) +{ + if (m_impl->frame && m_impl->frame->loader()) { + WebCore::KURL kurl = WebCore::KURL(static_cast(url.mb_str(wxConvUTF8))); + // NB: This is an ugly fix, but CURL won't load sub-resources if the + // protocol is omitted; sadly, it will not emit an error, either, so + // there's no way for us to catch this problem the correct way yet. + if (kurl.protocol().isEmpty()) { + // is it a file on disk? + if (wxFileExists(url)) { + kurl.setProtocol("file"); + kurl.setPath("//" + kurl.path()); + } + else { + kurl.setProtocol("http"); + kurl.setPath("//" + kurl.path()); + } + } + m_impl->frame->loader()->load(kurl); + } +} + +bool wxWebView::GoBack() +{ + if (m_impl->frame && m_impl->frame->page()) { + return m_impl->frame->page()->goBack(); + } +} + +bool wxWebView::GoForward() +{ + if (m_impl->frame && m_impl->frame->page()) + return m_impl->frame->page()->goForward(); +} + +bool wxWebView::CanIncreaseTextSize() const +{ + if (m_impl->frame) { + if (m_textMagnifier*TextSizeMultiplierRatio <= MaximumTextSizeMultiplier) + return true; + } + return false; +} + +void wxWebView::IncreaseTextSize() +{ + if (CanIncreaseTextSize()) { + m_textMagnifier = m_textMagnifier*TextSizeMultiplierRatio; + m_impl->frame->setZoomFactor((int)rint(m_textMagnifier*100)); + } +} + +bool wxWebView::CanDecreaseTextSize() const +{ + if (m_impl->frame) { + if (m_textMagnifier/TextSizeMultiplierRatio >= MinimumTextSizeMultiplier) + return true; + } + return false; +} + +void wxWebView::DecreaseTextSize() +{ + if (CanDecreaseTextSize()) { + m_textMagnifier = m_textMagnifier/TextSizeMultiplierRatio; + m_impl->frame->setZoomFactor( (int)rint(m_textMagnifier*100)); + } +} + +void wxWebView::MakeEditable(bool enable) +{ + m_isEditable = enable; +} + + +/* + * Event forwarding functions to send events down to WebCore. + */ + +void wxWebView::OnPaint(wxPaintEvent& event) +{ + if (m_beingDestroyed || !m_impl->frameView || !m_impl->frame) + return; + + wxAutoBufferedPaintDC dc(this); + DoPrepareDC(dc); + + if (IsShown() && m_impl->frame && m_impl->frame->document()) { +#if USE(WXGC) + wxGCDC gcdc(dc); +#endif + + if (dc.IsOk()) { + wxRect paintRect = GetUpdateRegion().GetBox(); + int x = 0; + int y = 0; + GetViewStart(&x, &y); + int unitX = 1; + int unitY = 1; + GetScrollPixelsPerUnit(&unitX, &unitY); + paintRect.Offset(x * unitX, y * unitY); + +#if USE(WXGC) + WebCore::GraphicsContext* gc = new WebCore::GraphicsContext(&gcdc); +#else + WebCore::GraphicsContext* gc = new WebCore::GraphicsContext((wxWindowDC*)&dc); +#endif + if (gc && m_impl->frame->renderer()) { + // FIXME: Replace this with layoutIfNeededRecursive + if (m_impl->frameView->needsLayout()) + m_impl->frameView->layout(); + + m_impl->frame->paint(gc, paintRect); + } + } + } +} + +void wxWebView::OnSize(wxSizeEvent& event) +{ + // NOTE: this call can be expensive on heavy pages, particularly on Mac, + // so we probably should set a timer not put x ms between layouts. + + if (m_isInitialized && m_impl->frame && m_impl->frameView) { + m_impl->frameView->layout(); + } + + event.Skip(); + +} + +void wxWebView::OnMouseEvents(wxMouseEvent& event) +{ + event.Skip(); + + if (!m_impl->frame && m_impl->frameView) + return; + + wxPoint globalPoint = ClientToScreen(event.GetPosition()); + + wxEventType type = event.GetEventType(); + + if (type == wxEVT_MOUSEWHEEL) { + WebCore::PlatformWheelEvent wkEvent(event, globalPoint); + m_impl->frame->eventHandler()->handleWheelEvent(wkEvent); + return; + } + + WebCore::PlatformMouseEvent wkEvent(event, globalPoint); + + if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN) + m_impl->frame->eventHandler()->handleMousePressEvent(wkEvent); + + else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP || + type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) + m_impl->frame->eventHandler()->handleMouseReleaseEvent(wkEvent); + + else if (type == wxEVT_MOTION) + m_impl->frame->eventHandler()->handleMouseMoveEvent(wkEvent); +} + +bool wxWebView::CanCopy() +{ + if (m_impl->frame && m_impl->frameView) { + return (m_impl->frame->editor()->canCopy() || m_impl->frame->editor()->canDHTMLCopy()); + } + return false; +} + +void wxWebView::Copy() +{ + if (CanCopy()) { + m_impl->frame->editor()->copy(); + } +} + +bool wxWebView::CanCut() +{ + if (m_impl->frame && m_impl->frameView) { + return (m_impl->frame->editor()->canCut() || m_impl->frame->editor()->canDHTMLCut()); + } + return false; +} + +void wxWebView::Cut() +{ + if (CanCut()) { + m_impl->frame->editor()->cut(); + } +} + +bool wxWebView::CanPaste() +{ + if (m_impl->frame && m_impl->frameView) { + return (m_impl->frame->editor()->canPaste() || m_impl->frame->editor()->canDHTMLPaste()); + } + return false; +} + +void wxWebView::Paste() +{ + if (CanPaste()) { + m_impl->frame->editor()->paste(); + } +} + +void wxWebView::OnKeyEvents(wxKeyEvent& event) +{ + if (m_impl->frame && m_impl->frameView) { + // WebCore doesn't handle these events itself, so we need to do + // it and not send the event down or else CTRL+C will erase the text + // and replace it with c. + if (event.CmdDown() && event.GetKeyCode() == static_cast('C')) { + Copy(); + } + else if (event.CmdDown() && event.GetKeyCode() == static_cast('X')) { + Cut(); + } + else if (event.CmdDown() && event.GetKeyCode() == static_cast('V')) { + Paste(); + } + else { + WebCore::PlatformKeyboardEvent wkEvent(event); + m_impl->frame->eventHandler()->keyEvent(wkEvent); + } + } + + // make sure we get the character event. + if (event.GetEventType() != wxEVT_CHAR) + event.Skip(); +} + +void wxWebView::OnSetFocus(wxFocusEvent& event) +{ + if (m_impl->frame) { + m_impl->frame->setWindowHasFocus(true); + } + event.Skip(); +} + +void wxWebView::OnKillFocus(wxFocusEvent& event) +{ + if (m_impl->frame) { + m_impl->frame->setWindowHasFocus(false); + } + event.Skip(); +} + +void wxWebView::OnActivate(wxActivateEvent& event) +{ + if (m_impl->frame) { + m_impl->frame->setIsActive(event.GetActive()); + } + event.Skip(); +} diff --git a/WebKit/wx/WebView.h b/WebKit/wx/WebView.h new file mode 100644 index 00000000000..ab4346ce79d --- /dev/null +++ b/WebKit/wx/WebView.h @@ -0,0 +1,312 @@ +/* + * Copyright (C) 2007 Kevin Ollivier + * + * 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WXWEBVIEW_H +#define WXWEBVIEW_H + +#include "wx/wxprec.h" +#ifndef WX_PRECOMP + #include "wx/wx.h" +#endif + +class WebViewPrivate; +class WebViewFrameData; + +namespace WebCore { + class ChromeClientWx; +} + +#ifndef SWIG + +#if WXMAKINGDLL_WEBKIT +#define WXDLLIMPEXP_WEBKIT WXEXPORT +#elif defined(WXUSINGDLL_WEBKIT) +#define WXDLLIMPEXP_WEBKIT WXIMPORT +#else +#define WXDLLIMPEXP_WEBKIT +#endif + +#else +#define WXDLLIMPEXP_WEBKIT +#endif // SWIG + +class WXDLLIMPEXP_WEBKIT wxWebView : public wxScrolledWindow +{ + // ChromeClientWx needs to get the Page* stored by the wxWebView + // for the createWindow function. + friend class WebCore::ChromeClientWx; + +public: + // ctor(s) +#if SWIG + %pythonAppend wxWebView "self._setOORInfo(self)" +#endif + wxWebView(wxWindow* parent, int id = wxID_ANY, + const wxPoint& point = wxDefaultPosition, + const wxSize& size = wxDefaultSize, + WebViewFrameData* data = NULL); // For wxWebView internal data passing + +#ifndef SWIG + ~wxWebView(); +#endif + + void LoadURL(wxString url); + bool GoBack(); + bool GoForward(); + void Stop(); + void Reload(); + + bool CanCut(); + bool CanCopy(); + bool CanPaste(); + + void Cut(); + void Copy(); + void Paste(); + + //bool CanGetPageSource(); + wxString GetPageSource(); + void SetPageSource(const wxString& source, const wxString& baseUrl = wxEmptyString); + + wxString RunScript(const wxString& javascript); + + bool CanIncreaseTextSize() const; + void IncreaseTextSize(); + bool CanDecreaseTextSize() const; + void DecreaseTextSize(); + void MakeEditable(bool enable); + bool IsEditable() const { return m_isEditable; } + + wxString GetPageTitle() const { return m_title; } + void SetPageTitle(const wxString& title) { m_title = title; } + +protected: + + // event handlers (these functions should _not_ be virtual) + void OnPaint(wxPaintEvent& event); + void OnSize(wxSizeEvent& event); + void OnMouseEvents(wxMouseEvent& event); + void OnKeyEvents(wxKeyEvent& event); + void OnSetFocus(wxFocusEvent& event); + void OnKillFocus(wxFocusEvent& event); + void OnActivate(wxActivateEvent& event); + +private: + // any class wishing to process wxWindows events must use this macro +#ifndef SWIG + DECLARE_EVENT_TABLE() +#endif + float m_textMagnifier; + bool m_isEditable; + bool m_isInitialized; + bool m_beingDestroyed; + WebViewPrivate* m_impl; + wxString m_title; + +}; + +// ---------------------------------------------------------------------------- +// Web Kit Events +// ---------------------------------------------------------------------------- + +enum { + wxWEBVIEW_STATE_START = 1, + wxWEBVIEW_STATE_NEGOTIATING = 2, + wxWEBVIEW_STATE_REDIRECTING = 4, + wxWEBVIEW_STATE_TRANSFERRING = 8, + wxWEBVIEW_STATE_STOP = 16, + wxWEBVIEW_STATE_FAILED = 32 +}; + +enum { + wxWEBVIEW_NAV_LINK_CLICKED = 1, + wxWEBVIEW_NAV_BACK_NEXT = 2, + wxWEBVIEW_NAV_FORM_SUBMITTED = 4, + wxWEBVIEW_NAV_RELOAD = 8, + wxWEBVIEW_NAV_FORM_RESUBMITTED = 16, + wxWEBVIEW_NAV_OTHER = 32 +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewDOMElementInfo +{ +public: + wxWebViewDOMElementInfo(); + + ~wxWebViewDOMElementInfo() { } + + wxString GetTagName() const { return m_tagName; } + void SetTagName(const wxString& name) { m_tagName = name; } + + bool IsSelected() const { return m_isSelected; } + void SetSelected(bool sel) { m_isSelected = sel; } + + wxString GetText() const { return m_text; } + void SetText(const wxString& text) { m_text = text; } + + wxString GetImageSrc() const { return m_imageSrc; } + void SetImageSrc(const wxString& src) { m_imageSrc = src; } + + wxString GetLink() const { return m_link; } + void SetLink(const wxString& link) { m_link = link; } + +private: + void* m_domElement; + bool m_isSelected; + wxString m_tagName; + wxString m_text; + wxString m_imageSrc; + wxString m_link; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewBeforeLoadEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewBeforeLoadEvent ) +#endif + +public: + bool IsCancelled() const { return m_cancelled; } + void Cancel(bool cancel = true) { m_cancelled = cancel; } + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + void SetNavigationType(int navType) { m_navType = navType; } + int GetNavigationType() const { return m_navType; } + + wxWebViewBeforeLoadEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewBeforeLoadEvent(*this); } + +private: + bool m_cancelled; + wxString m_url; + int m_navType; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewStateChangedEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewStateChangedEvent ) +#endif + +public: + int GetState() const { return m_state; } + void SetState(const int state) { m_state = state; } + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + + wxWebViewStateChangedEvent( wxWindow* win = (wxWindow*) NULL ); + wxEvent *Clone(void) const { return new wxWebViewStateChangedEvent(*this); } + +private: + int m_state; + wxString m_url; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewNewWindowEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewNewWindowEvent ) +#endif + +public: + wxString GetURL() const { return m_url; } + void SetURL(const wxString& url) { m_url = url; } + + wxWebViewNewWindowEvent( wxWindow* win = static_cast(NULL)); + wxEvent *Clone(void) const { return new wxWebViewNewWindowEvent(*this); } + +private: + wxString m_url; +}; + +class WXDLLIMPEXP_WEBKIT wxWebViewRightClickEvent : public wxCommandEvent +{ +#ifndef SWIG + DECLARE_DYNAMIC_CLASS( wxWebViewRightClickEvent ) +#endif + +public: + wxWebViewRightClickEvent( wxWindow* win = static_cast(NULL)); + wxEvent *Clone(void) const { return new wxWebViewRightClickEvent(*this); } + + wxWebViewDOMElementInfo GetInfo() const { return m_info; } + void SetInfo(wxWebViewDOMElementInfo info) { m_info = info; } + + wxPoint GetPosition() const { return m_position; } + void SetPosition(wxPoint pos) { m_position = pos; } + +private: + wxWebViewDOMElementInfo m_info; + wxPoint m_position; +}; + +typedef void (wxEvtHandler::*wxWebViewStateChangedEventFunction)(wxWebViewStateChangedEvent&); +typedef void (wxEvtHandler::*wxWebViewBeforeLoadEventFunction)(wxWebViewBeforeLoadEvent&); +typedef void (wxEvtHandler::*wxWebViewNewWindowEventFunction)(wxWebViewNewWindowEvent&); +typedef void (wxEvtHandler::*wxWebViewRightClickEventFunction)(wxWebViewRightClickEvent&); + +#ifndef SWIG +BEGIN_DECLARE_EVENT_TYPES() + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_BEFORE_LOAD, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_STATE_CHANGED, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_NEW_WINDOW, wxID_ANY) + DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_WEBKIT, wxEVT_WEBVIEW_RIGHT_CLICK, wxID_ANY) +END_DECLARE_EVENT_TYPES() +#endif + +#define EVT_WEBVIEW_STATE_CHANGED(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_STATE_CHANGED, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewStateChangedEventFunction) & func, \ + static_cast(NULL)), + +#define EVT_WEBVIEW_BEFORE_LOAD(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewBeforeLoadEventFunction) & func, \ + static_cast(NULL)), + +#define EVT_WEBVIEW_NEW_WINDOW(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_BEFORE_LOAD, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewBeforeLoadEventFunction) & func, \ + static_cast(NULL)), + +#define EVT_WEBVIEW_RIGHT_CLICK(func) \ + DECLARE_EVENT_TABLE_ENTRY( wxEVT_WEBVIEW_RIGHT_CLICK, \ + wxID_ANY, \ + wxID_ANY, \ + (wxObjectEventFunction) \ + (wxWebViewRightClickEventFunction) & func, \ + static_cast(NULL)), + +#endif // ifndef WXWEBVIEW_H diff --git a/WebKit/wx/WebViewPrivate.h b/WebKit/wx/WebViewPrivate.h new file mode 100644 index 00000000000..7b7b118561a --- /dev/null +++ b/WebKit/wx/WebViewPrivate.h @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007 Kevin Ollivier. 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef WXWEBVIEWPRIVATE_H +#define WXWEBVIEWPRIVATE_H + + +#include "config.h" +#include "Frame.h" +#include "FrameView.h" +#include "wtf/RefPtr.h" +#include "KURL.h" + +class WebViewPrivate +{ +public: + WebViewPrivate() : + frame(0), + frameView(0) + {} + + WTF::RefPtr frame; + WTF::RefPtr frameView; +}; + +class WebViewFrameData +{ +public: + WebCore::KURL url; + WebCore::String name; + WebCore::HTMLFrameOwnerElement* ownerElement; + + WebCore::String referrer; + bool allowsScrolling; + int marginWidth; + int marginHeight; +}; + +#endif diff --git a/WebKit/wx/bindings/python/samples/simple.py b/WebKit/wx/bindings/python/samples/simple.py new file mode 100644 index 00000000000..2ebdf9c1daa --- /dev/null +++ b/WebKit/wx/bindings/python/samples/simple.py @@ -0,0 +1,162 @@ +#!/usr/bin/python + +# Copyright (C) 2007 Kevin Ollivier 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 COMPUTER, INC. ``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 COMPUTER, INC. OR +# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, +# EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +# PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY +# OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +import wx +import wx.webview + +class TestPanel(wx.Panel): + def __init__(self, parent, log, frame=None): + wx.Panel.__init__( + self, parent, -1, + style=wx.TAB_TRAVERSAL|wx.CLIP_CHILDREN|wx.NO_FULL_REPAINT_ON_RESIZE + ) + + self.log = log + self.current = "http://wxPython.org/" + self.frame = frame + + if frame: + self.titleBase = frame.GetTitle() + + sizer = wx.BoxSizer(wx.VERTICAL) + btnSizer = wx.BoxSizer(wx.HORIZONTAL) + + self.webview = wx.webview.WebView(self, -1) + + + btn = wx.Button(self, -1, "Open", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnOpenButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "<--", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnPrevPageButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "-->", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnNextPageButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "Stop", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnStopButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + btn = wx.Button(self, -1, "Refresh", style=wx.BU_EXACTFIT) + self.Bind(wx.EVT_BUTTON, self.OnRefreshPageButton, btn) + btnSizer.Add(btn, 0, wx.EXPAND|wx.ALL, 2) + + txt = wx.StaticText(self, -1, "Location:") + btnSizer.Add(txt, 0, wx.CENTER|wx.ALL, 2) + + self.location = wx.ComboBox( + self, -1, "", style=wx.CB_DROPDOWN|wx.PROCESS_ENTER + ) + + self.Bind(wx.EVT_COMBOBOX, self.OnLocationSelect, self.location) + self.location.Bind(wx.EVT_KEY_UP, self.OnLocationKey) + self.location.Bind(wx.EVT_CHAR, self.IgnoreReturn) + btnSizer.Add(self.location, 1, wx.EXPAND|wx.ALL, 2) + + sizer.Add(btnSizer, 0, wx.EXPAND) + sizer.Add(self.webview, 1, wx.EXPAND) + + self.webview.LoadURL(self.current) + self.location.Append(self.current) + + self.webview.Bind(wx.webview.EVT_WEBVIEW_STATE_CHANGED, self.OnStateChanged) + + self.SetSizer(sizer) + + def OnStateChanged(self, event): + statusbar = self.GetParent().GetStatusBar() + if statusbar: + if event.GetState() == wx.webview.WEBVIEW_STATE_NEGOTIATING: + statusbar.SetStatusText("Contacting " + event.GetURL()) + elif event.GetState() == wx.webview.WEBVIEW_STATE_TRANSFERRING: + statusbar.SetStatusText("Loading " + event.GetURL()) + elif event.GetState() == wx.webview.WEBVIEW_STATE_STOP: + statusbar.SetStatusText("") + self.location.SetValue(event.GetURL()) + self.GetParent().SetTitle("wxWebView - " + self.webview.GetPageTitle()) + + def OnLocationKey(self, evt): + if evt.GetKeyCode() == wx.WXK_RETURN: + URL = self.location.GetValue() + self.location.Append(URL) + self.webview.LoadURL(URL) + else: + evt.Skip() + + def IgnoreReturn(self, evt): + if evt.GetKeyCode() != wx.WXK_RETURN: + evt.Skip() + + def OnLocationSelect(self, evt): + url = self.location.GetStringSelection() + self.webview.LoadURL(url) + + def OnOpenButton(self, event): + dlg = wx.TextEntryDialog(self, "Open Location", + "Enter a full URL or local path", + self.current, wx.OK|wx.CANCEL) + dlg.CentreOnParent() + + if dlg.ShowModal() == wx.ID_OK: + self.current = dlg.GetValue() + self.webview.LoadURL(self.current) + + dlg.Destroy() + + def OnPrevPageButton(self, event): + self.webview.GoBack() + + def OnNextPageButton(self, event): + self.webview.GoForward() + + def OnStopButton(self, evt): + self.webview.Stop() + + def OnRefreshPageButton(self, evt): + self.webview.Reload() + + +class wkFrame(wx.Frame): + def __init__(self): + wx.Frame.__init__(self, None, -1, "WebKit in wxPython!") + + self.panel = TestPanel(self, -1) + self.panel.webview.LoadURL("http://www.wxwidgets.org/") + self.CreateStatusBar() + +class wkApp(wx.App): + def OnInit(self): + self.webFrame = wkFrame() + self.SetTopWindow(self.webFrame) + self.webFrame.Show() + + return True + +app = wkApp(redirect=False) +app.MainLoop() diff --git a/WebKit/wx/bindings/python/webview.i b/WebKit/wx/bindings/python/webview.i new file mode 100644 index 00000000000..565b12cc40a --- /dev/null +++ b/WebKit/wx/bindings/python/webview.i @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007 Kevin Ollivier 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 COMPUTER, INC. ``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 COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +%module(package="wx") webview + +%{ +#include "wx/wxPython/wxPython.h" +#include "wx/wxPython/pyclasses.h" +#include "WebView.h" +#include "WebFrame.h" +%} + +//--------------------------------------------------------------------------- + +%import core.i +%import windows.i + +MustHaveApp(wxWebView); +MustHaveApp(wxWebFrame); + +%include WebView.h +%include WebFrame.h + +%pythoncode { wx = _core } +%pythoncode { __docfilter__ = wx.__DocFilter(globals()) } + +%constant wxEventType wxEVT_WEBVIEW_BEFORE_LOAD; +%constant wxEventType wxEVT_WEBVIEW_STATE_CHANGED; +%constant wxEventType wxEVT_WEBVIEW_NEW_WINDOW; +%constant wxEventType wxEVT_WEBVIEW_RIGHT_CLICK; + +%pythoncode { +EVT_WEBVIEW_BEFORE_LOAD = wx.PyEventBinder( wxEVT_WEBVIEW_BEFORE_LOAD ) +EVT_WEBVIEW_STATE_CHANGED = wx.PyEventBinder( wxEVT_WEBVIEW_STATE_CHANGED ) +EVT_WEBVIEW_NEW_WINDOW = wx.PyEventBinder( wxEVT_WEBVIEW_NEW_WINDOW ) +EVT_WEBVIEW_RIGHT_CLICK = wx.PyEventBinder( wxEVT_WEBVIEW_RIGHT_CLICK ) +} diff --git a/WebKit/wx/bindings/python/wxwebkit-py.bkl b/WebKit/wx/bindings/python/wxwebkit-py.bkl new file mode 100644 index 00000000000..70e70fe0f9e --- /dev/null +++ b/WebKit/wx/bindings/python/wxwebkit-py.bkl @@ -0,0 +1,119 @@ + + + + + 1 + 1 + + + + + 1 + + + + + + + + + + + + + + $(WKOUTPUTDIR)/libjscore.a + $(WKOUTPUTDIR)/libwebcore-wx.a + + + $(WKOUTPUTDIR)/jscore.lib + $(WKOUTPUTDIR)/webcore-wx.lib + + dynamic + _webview + + obj-$(FORMAT) + + $(WK_ROOT)/WebCore/platform/wx + $(WK_ROOT)/WebCore/bridge/wx + $(WK_ROOT)/WebCore/page/wx + $(WK_ROOT)/WebKit/wx + $(WK_ROOT)/WebKit/wx/WebKitSupport + + + png + + -bundle + + + $(MAC_FLAGS) -undefined dynamic_lookup + + + + + python24 + + + python25 + + + libpng + $(PY_LIBNAME) + $(WK_ROOT)/libpng + $(PYTHON_LIBDIR) + + + wxwebkit + $(WKOUTPUTDIR) + + BUILDING_WX__=1 + SWIG_TYPE_TABLE=_wxPython_table + WXP_USE_THREAD=1 + SWIG_PYTHON_OUTPUT_TUPLE + + + webview.cpp + + + + diff --git a/WebKit/wx/dependencies.bkl b/WebKit/wx/dependencies.bkl new file mode 100644 index 00000000000..bedc94c529f --- /dev/null +++ b/WebKit/wx/dependencies.bkl @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/WebKit/wx/presets/wxwebkit.bkl b/WebKit/wx/presets/wxwebkit.bkl new file mode 100644 index 00000000000..0171c1f0b85 --- /dev/null +++ b/WebKit/wx/presets/wxwebkit.bkl @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + msw + + + + + $(DOLLAR)(shell $(WX_CONFIG) --selected-config | cut -d '-' -f 1) + + + + + + + + + + diff --git a/WebKit/wx/wxwebkit.bkl b/WebKit/wx/wxwebkit.bkl new file mode 100644 index 00000000000..cad875a87fc --- /dev/null +++ b/WebKit/wx/wxwebkit.bkl @@ -0,0 +1,104 @@ + + + + + 1 + 1 + + + + + 0 + + + obj-$(FORMAT) + + + + + $(WKOUTPUTDIR)/libjscore.a + $(WKOUTPUTDIR)/libwebcore-wx.a + + + $(WKOUTPUTDIR)/jscore.lib + $(WKOUTPUTDIR)/webcore-wx.lib + + dynamic + wxwebkit + wxwebkit + + + $(WKOUTPUTDIR)/libjscore.a + + + jscore + winmm + $(WKOUTPUTDIR) + + + obj-$(FORMAT) + + $(WK_ROOT)/WebCore/platform/wx + $(WK_ROOT)/WebCore/bridge/wx + $(WK_ROOT)/WebCore/page/wx + $(WK_ROOT)/WebKit/wx + $(WK_ROOT)/WebKit/wx/WebKitSupport + + + png + $(WKOUTPUTDIR)/libwebcore-wx.a + + + webcore-wx + libpng + libjpeg + $(WKOUTPUTDIR) + $(WK_ROOT)/libpng + $(WK_ROOT)/libjpeg + + + + WebKitSupport/ChromeClientWx.cpp + WebKitSupport/ContextMenuClientWx.cpp + WebKitSupport/DragClientWx.cpp + WebKitSupport/EditorClientWx.cpp + WebKitSupport/FrameLoaderClientWx.cpp + WebKitSupport/InspectorClientWx.cpp + + WebView.cpp + WebFrame.cpp + + + + diff --git a/WebKit/wx/wxwk-settings.bkl b/WebKit/wx/wxwk-settings.bkl new file mode 100644 index 00000000000..83badb9cd7e --- /dev/null +++ b/WebKit/wx/wxwk-settings.bkl @@ -0,0 +1,72 @@ + + + + + + + + + + + + -- GitLab