WebCore:
authormjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Feb 2007 07:54:13 +0000 (07:54 +0000)
committermjs <mjs@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 19 Feb 2007 07:54:13 +0000 (07:54 +0000)
        Reviewed by Maciej.

        Additional coding by Maciej, additional review by Oliver.

        Get rid of the FrameMac and FrameQt classes. Instead
        move all methods into Frame directly, and implement
        some platform specific methods in foo/FrameFoo.cpp.

        Some general cleanup in Frame:
        * Move some methods out of Frame, to the place where they
        belong.
        * Unify the different ways of creating the JavaScript wrappers
        for <object>, <embed> and <applet>
        * Some cleanup of the WebCoreFrameBridge

        * ForwardingHeaders/bindings/NP_jsobject.h: Added.
        * ForwardingHeaders/bindings/npruntime_impl.h: Added.
        * ForwardingHeaders/bindings/runtime_root.h: Added.
        * WebCore.exp:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/kjs_binding.cpp:
        (KJS::ScriptInterpreter::shouldInterruptScript):
        * bindings/objc/DOM.mm:
        (-[DOMNode KJS::Bindings::]):
        * bindings/objc/DOMInternal.mm:
        (-[WebScriptObject _initializeScriptDOMNodeImp]):
        * bridge/EditorClient.h:
        * bridge/mac/FrameViewMac.mm:
        (WebCore::FrameView::updateBorder):
        (WebCore::FrameView::updateDashboardRegions):
        * bridge/mac/WebCoreAXObject.mm:
        (-[WebCoreAXObject rendererForView:]):
        * dom/Position.cpp:
        (WebCore::Position::next):
        * editing/CommandByName.cpp:
        (WebCore::Frame::execCopy):
        (WebCore::Frame::execCut):
        (WebCore::Frame::execPaste):
        * editing/Editor.cpp:
        (WebCore::Editor::canEdit):
        (WebCore::Editor::pasteWithPasteboard):
        (WebCore::Editor::paste):
        (WebCore::Editor::pasteAsPlainText):
        * editing/Editor.h:
        * editing/JSEditor.cpp:
        * html/HTMLAppletElement.cpp:
        (WebCore::HTMLAppletElement::getInstance):
        * html/HTMLEmbedElement.cpp:
        (WebCore::HTMLEmbedElement::getInstance):
        * html/HTMLFormElement.cpp:
        (WebCore::HTMLFormElement::formData):
        * html/HTMLObjectElement.cpp:
        (WebCore::HTMLObjectElement::getInstance):
        * loader/FrameLoader.cpp:
        (WebCore::FrameLoader::clear):
        (WebCore::FrameLoader::detachFromParent):
        * loader/mac/ImageDocumentMac.mm:
        (WebCore::finishImageLoad):
        * loader/qt/DocumentLoaderQt.cpp:
        * page/Chrome.cpp:
        (WebCore::Chrome::shouldInterruptJavaScript):
        * page/Chrome.h:
        * page/ChromeClient.h:
        * page/Frame.cpp:
        (WebCore::Frame::~Frame):
        (WebCore::Frame::markedTextRange):
        (WebCore::Frame::shouldChangeSelection):
        (WebCore::Frame::shouldDeleteSelection):
        (WebCore::Frame::isContentEditable):
        (WebCore::Frame::setSecureKeyboardEntry):
        (WebCore::Frame::isSecureKeyboardEntry):
        (WebCore::Frame::bindingRootObject):
        (WebCore::Frame::createRootObject):
        (WebCore::Frame::windowScriptNPObject):
        (WebCore::Frame::cleanupScriptObjects):
        (WebCore::FramePrivate::FramePrivate):
        * page/Frame.h:
        * page/FramePrivate.h:
        * page/FrameView.h:
        * page/mac/EventHandlerMac.mm:
        (WebCore::EventHandler::tabsToLinks):
        (WebCore::EventHandler::tabsToAllControls):
        (WebCore::EventHandler::focusDocumentView):
        (WebCore::EventHandler::passMouseDownEventToWidget):
        (WebCore::EventHandler::handleDrag):
        (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
        (WebCore::EventHandler::keyboardUIMode):
        * page/mac/FrameMac.h: Removed.
        * page/mac/FrameMac.mm:
        (WebCore::Frame::setBridge):
        (WebCore::Frame::bridge):
        (WebCore::Frame::searchForLabelsAboveCell):
        (WebCore::Frame::searchForLabelsBeforeElement):
        (WebCore::Frame::matchLabelsAgainstElement):
        (WebCore::Frame::focusWindow):
        (WebCore::Frame::unfocusWindow):
        (WebCore::Frame::imageFromRect):
        (WebCore::Frame::selectionImage):
        (WebCore::Frame::snapshotDragImage):
        (WebCore::Frame::fontAttributesForSelectionStart):
        (WebCore::Frame::baseWritingDirectionForSelectionStart):
        (WebCore::Frame::print):
        (WebCore::Frame::issuePasteCommand):
        (WebCore::Frame::issueTransposeCommand):
        (WebCore::Frame::respondToChangedSelection):
        (WebCore::Frame::textFieldDidBeginEditing):
        (WebCore::Frame::textFieldDidEndEditing):
        (WebCore::Frame::textDidChangeInTextField):
        (WebCore::Frame::textDidChangeInTextArea):
        (WebCore::Frame::doTextFieldCommandFromEvent):
        (WebCore::Frame::textWillBeDeletedInTextField):
        (WebCore::Frame::setSecureKeyboardEntry):
        (WebCore::Frame::isSecureKeyboardEntry):
        (WebCore::Frame::setMarkedTextRange):
        (WebCore::Frame::dashboardRegionsDictionary):
        (WebCore::Frame::dashboardRegionsChanged):
        (WebCore::Frame::willPopupMenu):
        (WebCore::Frame::isCharacterSmartReplaceExempt):
        (WebCore::Frame::setNeedsReapplyStyles):
        (WebCore::Frame::customHighlightLineRect):
        (WebCore::Frame::paintCustomHighlight):
        (WebCore::Frame::createScriptInstanceForWidget):
        (WebCore::Frame::windowScriptObject):
        (WebCore::Frame::cleanupPlatformScriptObjects):
        * page/mac/WebCoreFrameBridge.h:
        * page/mac/WebCoreFrameBridge.mm:
        (createRootObject):
        (bridge):
        (-[WebCoreFrameBridge _frame]):
        * page/qt/EventHandlerQt.cpp:
        * page/qt/FrameQt.cpp:
        (WebCore::Frame::unfocusWindow):
        (WebCore::Frame::focusWindow):
        (WebCore::Frame::issueTransposeCommand):
        (WebCore::Frame::respondToChangedSelection):
        (WebCore::Frame::print):
        (WebCore::Frame::createScriptInstanceForWidget):
        (WebCore::Frame::cleanupPlatformScriptObjects):
        (WebCore::Frame::isCharacterSmartReplaceExempt):
        * page/qt/FrameQt.h: Removed.
        * platform/MimeTypeRegistry.h:
        * platform/graphics/svg/SVGImage.cpp:
        (WebCore::SVGImage::setData):
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyChromeClient::shouldInterruptJavaScript):
        (WebCore::SVGEmptyEditorClient::shouldChangeSelectedRange):
        * platform/mac/ClipboardMac.h:
        * platform/mac/ClipboardMac.mm:
        (WebCore::ClipboardMac::ClipboardMac):
        * platform/mac/FileChooserMac.mm:
        (-[OpenPanelController beginSheetWithFrame:]):
        * platform/mac/MimeTypeRegistryMac.mm:
        (WebCore::MimeTypeRegistry::getMIMETypeForPath):
        * platform/mac/PopupMenuMac.mm:
        (WebCore::PopupMenu::show):
        * platform/mac/WidgetMac.mm:
        (WebCore::Widget::setFocus):
        (WebCore::Widget::setIsSelected):
        * platform/network/mac/ResourceHandleMac.mm:
        * platform/network/qt/ResourceHandleManagerQt.cpp:
        * platform/network/qt/ResourceHandleQt.cpp:
        (WebCore::ResourceHandle::start):
        * platform/qt/MimeTypeRegistryQt.cpp:
        (WebCore::MimeTypeRegistry::getMIMETypeForPath):
        * platform/qt/PopupMenuQt.cpp:
        * platform/qt/ScrollViewCanvasQt.cpp:
        * platform/qt/ScrollViewQt.cpp:
        * platform/win/TemporaryLinkStubs.cpp:
        * rendering/InlineTextBox.cpp:
        (WebCore::InlineTextBox::paintCustomHighlight):
        * rendering/RenderBox.cpp:
        (WebCore::RenderBox::paintCustomHighlight):
        * rendering/RootInlineBox.cpp:
        (WebCore::RootInlineBox::addHighlightOverflow):
        (WebCore::RootInlineBox::paintCustomHighlight):

WebKit:

        Reviewed by Maciej.

        Additional coding by Maciej, additional review by Oliver.

        Added implementations for the new callbacks in EditorClient
        and ChromeClient (basically moved from WebFrameBridge).
        Cleaned up some code paths that are not called anymore
        and done fully inside WebCore now.

        * DefaultDelegates/WebDefaultContextMenuDelegate.mm:
        * Misc/WebElementDictionary.mm:
        * Misc/WebNSAttributedStringExtras.mm:
        * Plugins/WebBaseNetscapePluginView.mm:
        (-[WebBaseNetscapePluginView getVariable:value:]):
        * Plugins/WebNetscapePluginEmbeddedView.mm:
        * Plugins/WebNetscapePluginStream.mm:
        * Plugins/WebPluginContainerCheck.mm:
        * WebCoreSupport/WebChromeClient.h:
        * WebCoreSupport/WebChromeClient.mm:
        (WebChromeClient::shouldInterruptJavaScript):
        * WebCoreSupport/WebEditorClient.h:
        * WebCoreSupport/WebEditorClient.mm:
        (WebEditorClient::shouldChangeSelectedRange):
        * WebCoreSupport/WebFrameBridge.mm:
        (-[WebFrameBridge finishInitializingWithPage:frameName:frameView:ownerElement:]):
        (-[WebFrameBridge fini]):
        * WebCoreSupport/WebFrameLoaderClient.mm:
        * WebView/WebArchiver.mm:
        * WebView/WebFrame.mm:
        (core):
        (kit):
        (-[WebFrame _updateBackground]):
        * WebView/WebFrameInternal.h:
        * WebView/WebFrameView.mm:
        * WebView/WebHTMLRepresentation.mm:
        * WebView/WebHTMLView.mm:
        (-[WebHTMLView _updateMouseoverWithEvent:]):
        (-[WebHTMLView _isEditable]):
        (-[WebHTMLView validateUserInterfaceItem:]):
        (-[WebHTMLView maintainsInactiveSelection]):
        (-[WebHTMLView scrollWheel:]):
        (-[WebHTMLView acceptsFirstMouse:]):
        (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
        (-[WebHTMLView cut:]):
        (-[WebHTMLView paste:]):
        (-[WebHTMLView selectedAttributedString]):
        * WebView/WebScriptDebugDelegate.mm:
        * WebView/WebView.mm:
        (-[WebView _dashboardRegions]):
        (-[WebView setProhibitsMainFrameScrolling:]):
        (-[WebView _setInViewSourceMode:]):
        (-[WebView _inViewSourceMode]):
        (-[WebView shouldClose]):
        (-[WebView setEditable:]):

WebKitQt:

        Reviewed by Maciej.

        Additional coding by Maciej, additional review by Oliver.

        Add stubs for the new methods in ChormeClient and EditorClient,
        remove all references to FrameQt.

        * Api/qwebframe.cpp:
        (QWebFrame::QWebFrame):
        * Api/qwebframe_p.h:
        * Api/qwebpage.cpp:
        * WebCoreSupport/ChromeClientQt.cpp:
        (WebCore::ChromeClientQt::shouldInterruptJavaScript):
        * WebCoreSupport/ChromeClientQt.h:
        * WebCoreSupport/EditorClientQt.cpp:
        (WebCore::EditorClientQt::shouldChangeSelectedRange):
        (WebCore::EditorClientQt::isEditable):
        * WebCoreSupport/EditorClientQt.h:
        * WebCoreSupport/FrameLoaderClientQt.cpp:
        (WebCore::FrameLoaderClientQt::setFrame):
        (WebCore::FrameLoaderClientQt::webFrame):
        * WebCoreSupport/FrameLoaderClientQt.h:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@19702 268f45cc-cd09-0410-ab3c-d52691b4dbfc

96 files changed:
WebCore/ChangeLog
WebCore/ForwardingHeaders/bindings/NP_jsobject.h [new file with mode: 0644]
WebCore/ForwardingHeaders/bindings/npruntime_impl.h [new file with mode: 0644]
WebCore/ForwardingHeaders/bindings/runtime_root.h [new file with mode: 0644]
WebCore/WebCore.exp
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/js/kjs_binding.cpp
WebCore/bindings/objc/DOM.mm
WebCore/bindings/objc/DOMInternal.mm
WebCore/bridge/EditorClient.h
WebCore/bridge/mac/FrameViewMac.mm
WebCore/bridge/mac/WebCoreAXObject.mm
WebCore/editing/CommandByName.cpp
WebCore/editing/Editor.cpp
WebCore/editing/Editor.h
WebCore/editing/JSEditor.cpp
WebCore/editing/mac/EditorMac.mm
WebCore/html/HTMLAppletElement.cpp
WebCore/html/HTMLEmbedElement.cpp
WebCore/html/HTMLFormElement.cpp
WebCore/html/HTMLObjectElement.cpp
WebCore/loader/FrameLoader.cpp
WebCore/loader/mac/ImageDocumentMac.mm
WebCore/loader/qt/DocumentLoaderQt.cpp
WebCore/page/Chrome.cpp
WebCore/page/Chrome.h
WebCore/page/ChromeClient.h
WebCore/page/EventHandler.cpp
WebCore/page/EventHandler.h
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FramePrivate.h
WebCore/page/FrameView.h
WebCore/page/mac/EventHandlerMac.mm
WebCore/page/mac/FrameMac.h [deleted file]
WebCore/page/mac/FrameMac.mm
WebCore/page/mac/WebCoreFrameBridge.h
WebCore/page/mac/WebCoreFrameBridge.mm
WebCore/page/qt/EventHandlerQt.cpp
WebCore/page/qt/FrameQt.cpp
WebCore/page/qt/FrameQt.h [deleted file]
WebCore/platform/MimeTypeRegistry.cpp
WebCore/platform/MimeTypeRegistry.h
WebCore/platform/graphics/svg/SVGImage.cpp
WebCore/platform/graphics/svg/SVGImageEmptyClients.h
WebCore/platform/mac/ClipboardMac.h
WebCore/platform/mac/ClipboardMac.mm
WebCore/platform/mac/FileChooserMac.mm
WebCore/platform/mac/MimeTypeRegistryMac.mm
WebCore/platform/mac/PopupMenuMac.mm
WebCore/platform/mac/WidgetMac.mm
WebCore/platform/network/mac/ResourceHandleMac.mm
WebCore/platform/network/qt/ResourceHandleManagerQt.cpp
WebCore/platform/network/qt/ResourceHandleQt.cpp
WebCore/platform/qt/MimeTypeRegistryQt.cpp
WebCore/platform/qt/PopupMenuQt.cpp
WebCore/platform/qt/ScrollViewCanvasQt.cpp
WebCore/platform/qt/ScrollViewQt.cpp
WebCore/platform/win/TemporaryLinkStubs.cpp
WebCore/rendering/InlineTextBox.cpp
WebCore/rendering/RenderBox.cpp
WebCore/rendering/RootInlineBox.cpp
WebKit/ChangeLog
WebKit/DefaultDelegates/WebDefaultContextMenuDelegate.mm
WebKit/MigrateHeaders.make
WebKit/Misc/WebElementDictionary.mm
WebKit/Misc/WebNSAttributedStringExtras.mm
WebKit/Plugins/WebBaseNetscapePluginView.mm
WebKit/Plugins/WebNetscapePluginEmbeddedView.mm
WebKit/Plugins/WebNetscapePluginStream.mm
WebKit/Plugins/WebPluginContainerCheck.mm
WebKit/WebCoreSupport/WebChromeClient.h
WebKit/WebCoreSupport/WebChromeClient.mm
WebKit/WebCoreSupport/WebEditorClient.h
WebKit/WebCoreSupport/WebEditorClient.mm
WebKit/WebCoreSupport/WebFrameBridge.mm
WebKit/WebCoreSupport/WebFrameLoaderClient.h
WebKit/WebView/WebArchiver.mm
WebKit/WebView/WebDocumentLoaderMac.h
WebKit/WebView/WebFrame.mm
WebKit/WebView/WebFrameInternal.h
WebKit/WebView/WebFrameView.mm
WebKit/WebView/WebHTMLRepresentation.mm
WebKit/WebView/WebHTMLView.mm
WebKit/WebView/WebScriptDebugDelegate.mm
WebKit/WebView/WebView.mm
WebKitQt/Api/qwebframe.cpp
WebKitQt/Api/qwebframe_p.h
WebKitQt/Api/qwebpage.cpp
WebKitQt/ChangeLog
WebKitQt/WebCoreSupport/ChromeClientQt.cpp
WebKitQt/WebCoreSupport/ChromeClientQt.h
WebKitQt/WebCoreSupport/EditorClientQt.cpp
WebKitQt/WebCoreSupport/EditorClientQt.h
WebKitQt/WebCoreSupport/FrameLoaderClientQt.cpp
WebKitQt/WebCoreSupport/FrameLoaderClientQt.h

index b43316b22af9c4f08767bd5b371c338da3aeaac7..2086aa6d3dab743ac34d5b8566dafe011cf36f36 100644 (file)
@@ -1,3 +1,181 @@
+2007-02-17  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Maciej.
+        
+        Additional coding by Maciej, additional review by Oliver.
+
+        Get rid of the FrameMac and FrameQt classes. Instead
+        move all methods into Frame directly, and implement
+        some platform specific methods in foo/FrameFoo.cpp.
+
+        Some general cleanup in Frame:
+        * Move some methods out of Frame, to the place where they 
+        belong.
+        * Unify the different ways of creating the JavaScript wrappers
+        for <object>, <embed> and <applet>
+        * Some cleanup of the WebCoreFrameBridge
+
+        * ForwardingHeaders/bindings/NP_jsobject.h: Added.
+        * ForwardingHeaders/bindings/npruntime_impl.h: Added.
+        * ForwardingHeaders/bindings/runtime_root.h: Added.
+        * WebCore.exp:
+        * WebCore.xcodeproj/project.pbxproj:
+        * bindings/js/kjs_binding.cpp:
+        (KJS::ScriptInterpreter::shouldInterruptScript):
+        * bindings/objc/DOM.mm:
+        (-[DOMNode KJS::Bindings::]):
+        * bindings/objc/DOMInternal.mm:
+        (-[WebScriptObject _initializeScriptDOMNodeImp]):
+        * bridge/EditorClient.h:
+        * bridge/mac/FrameViewMac.mm:
+        (WebCore::FrameView::updateBorder):
+        (WebCore::FrameView::updateDashboardRegions):
+        * bridge/mac/WebCoreAXObject.mm:
+        (-[WebCoreAXObject rendererForView:]):
+        * dom/Position.cpp:
+        (WebCore::Position::next):
+        * editing/CommandByName.cpp:
+        (WebCore::Frame::execCopy):
+        (WebCore::Frame::execCut):
+        (WebCore::Frame::execPaste):
+        * editing/Editor.cpp:
+        (WebCore::Editor::canEdit):
+        (WebCore::Editor::pasteWithPasteboard):
+        (WebCore::Editor::paste):
+        (WebCore::Editor::pasteAsPlainText):
+        * editing/Editor.h:
+        * editing/JSEditor.cpp:
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::getInstance):
+        * html/HTMLEmbedElement.cpp:
+        (WebCore::HTMLEmbedElement::getInstance):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::formData):
+        * html/HTMLObjectElement.cpp:
+        (WebCore::HTMLObjectElement::getInstance):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::clear):
+        (WebCore::FrameLoader::detachFromParent):
+        * loader/mac/ImageDocumentMac.mm:
+        (WebCore::finishImageLoad):
+        * loader/qt/DocumentLoaderQt.cpp:
+        * page/Chrome.cpp:
+        (WebCore::Chrome::shouldInterruptJavaScript):
+        * page/Chrome.h:
+        * page/ChromeClient.h:
+        * page/Frame.cpp:
+        (WebCore::Frame::~Frame):
+        (WebCore::Frame::markedTextRange):
+        (WebCore::Frame::shouldChangeSelection):
+        (WebCore::Frame::shouldDeleteSelection):
+        (WebCore::Frame::isContentEditable):
+        (WebCore::Frame::setSecureKeyboardEntry):
+        (WebCore::Frame::isSecureKeyboardEntry):
+        (WebCore::Frame::bindingRootObject):
+        (WebCore::Frame::createRootObject):
+        (WebCore::Frame::windowScriptNPObject):
+        (WebCore::Frame::cleanupScriptObjects):
+        (WebCore::FramePrivate::FramePrivate):
+        * page/Frame.h:
+        * page/FramePrivate.h:
+        * page/FrameView.h:
+        * page/mac/EventHandlerMac.mm:
+        (WebCore::EventHandler::tabsToLinks):
+        (WebCore::EventHandler::tabsToAllControls):
+        (WebCore::EventHandler::focusDocumentView):
+        (WebCore::EventHandler::passMouseDownEventToWidget):
+        (WebCore::EventHandler::handleDrag):
+        (WebCore::EventHandler::sendFakeEventsAfterWidgetTracking):
+        (WebCore::EventHandler::keyboardUIMode):
+        * page/mac/FrameMac.h: Removed.
+        * page/mac/FrameMac.mm:
+        (WebCore::Frame::setBridge):
+        (WebCore::Frame::bridge):
+        (WebCore::Frame::searchForLabelsAboveCell):
+        (WebCore::Frame::searchForLabelsBeforeElement):
+        (WebCore::Frame::matchLabelsAgainstElement):
+        (WebCore::Frame::focusWindow):
+        (WebCore::Frame::unfocusWindow):
+        (WebCore::Frame::imageFromRect):
+        (WebCore::Frame::selectionImage):
+        (WebCore::Frame::snapshotDragImage):
+        (WebCore::Frame::fontAttributesForSelectionStart):
+        (WebCore::Frame::baseWritingDirectionForSelectionStart):
+        (WebCore::Frame::print):
+        (WebCore::Frame::issuePasteCommand):
+        (WebCore::Frame::issueTransposeCommand):
+        (WebCore::Frame::respondToChangedSelection):
+        (WebCore::Frame::textFieldDidBeginEditing):
+        (WebCore::Frame::textFieldDidEndEditing):
+        (WebCore::Frame::textDidChangeInTextField):
+        (WebCore::Frame::textDidChangeInTextArea):
+        (WebCore::Frame::doTextFieldCommandFromEvent):
+        (WebCore::Frame::textWillBeDeletedInTextField):
+        (WebCore::Frame::setSecureKeyboardEntry):
+        (WebCore::Frame::isSecureKeyboardEntry):
+        (WebCore::Frame::setMarkedTextRange):
+        (WebCore::Frame::dashboardRegionsDictionary):
+        (WebCore::Frame::dashboardRegionsChanged):
+        (WebCore::Frame::willPopupMenu):
+        (WebCore::Frame::isCharacterSmartReplaceExempt):
+        (WebCore::Frame::setNeedsReapplyStyles):
+        (WebCore::Frame::customHighlightLineRect):
+        (WebCore::Frame::paintCustomHighlight):
+        (WebCore::Frame::createScriptInstanceForWidget):
+        (WebCore::Frame::windowScriptObject):
+        (WebCore::Frame::cleanupPlatformScriptObjects):
+        * page/mac/WebCoreFrameBridge.h:
+        * page/mac/WebCoreFrameBridge.mm:
+        (createRootObject):
+        (bridge):
+        (-[WebCoreFrameBridge _frame]):
+        * page/qt/EventHandlerQt.cpp:
+        * page/qt/FrameQt.cpp:
+        (WebCore::Frame::unfocusWindow):
+        (WebCore::Frame::focusWindow):
+        (WebCore::Frame::issueTransposeCommand):
+        (WebCore::Frame::respondToChangedSelection):
+        (WebCore::Frame::print):
+        (WebCore::Frame::createScriptInstanceForWidget):
+        (WebCore::Frame::cleanupPlatformScriptObjects):
+        (WebCore::Frame::isCharacterSmartReplaceExempt):
+        * page/qt/FrameQt.h: Removed.
+        * platform/MimeTypeRegistry.h:
+        * platform/graphics/svg/SVGImage.cpp:
+        (WebCore::SVGImage::setData):
+        * platform/graphics/svg/SVGImageEmptyClients.h:
+        (WebCore::SVGEmptyChromeClient::shouldInterruptJavaScript):
+        (WebCore::SVGEmptyEditorClient::shouldChangeSelectedRange):
+        * platform/mac/ClipboardMac.h:
+        * platform/mac/ClipboardMac.mm:
+        (WebCore::ClipboardMac::ClipboardMac):
+        * platform/mac/FileChooserMac.mm:
+        (-[OpenPanelController beginSheetWithFrame:]):
+        * platform/mac/MimeTypeRegistryMac.mm:
+        (WebCore::MimeTypeRegistry::getMIMETypeForPath):
+        * platform/mac/PopupMenuMac.mm:
+        (WebCore::PopupMenu::show):
+        * platform/mac/WidgetMac.mm:
+        (WebCore::Widget::setFocus):
+        (WebCore::Widget::setIsSelected):
+        * platform/network/mac/ResourceHandleMac.mm:
+        * platform/network/qt/ResourceHandleManagerQt.cpp:
+        * platform/network/qt/ResourceHandleQt.cpp:
+        (WebCore::ResourceHandle::start):
+        * platform/qt/MimeTypeRegistryQt.cpp:
+        (WebCore::MimeTypeRegistry::getMIMETypeForPath):
+        * platform/qt/PopupMenuQt.cpp:
+        * platform/qt/ScrollViewCanvasQt.cpp:
+        * platform/qt/ScrollViewQt.cpp:
+        * platform/win/TemporaryLinkStubs.cpp:
+        * rendering/InlineTextBox.cpp:
+        (WebCore::InlineTextBox::paintCustomHighlight):
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintCustomHighlight):
+        * rendering/RootInlineBox.cpp:
+        (WebCore::RootInlineBox::addHighlightOverflow):
+        (WebCore::RootInlineBox::paintCustomHighlight):
+
 2007-02-18  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by NOBODY (Buildfix).
diff --git a/WebCore/ForwardingHeaders/bindings/NP_jsobject.h b/WebCore/ForwardingHeaders/bindings/NP_jsobject.h
new file mode 100644 (file)
index 0000000..0d78537
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/NP_jsobject.h>
diff --git a/WebCore/ForwardingHeaders/bindings/npruntime_impl.h b/WebCore/ForwardingHeaders/bindings/npruntime_impl.h
new file mode 100644 (file)
index 0000000..45f2bf1
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/npruntime_impl.h>
diff --git a/WebCore/ForwardingHeaders/bindings/runtime_root.h b/WebCore/ForwardingHeaders/bindings/runtime_root.h
new file mode 100644 (file)
index 0000000..e251d51
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/runtime_root.h>
index 5136c1c296bfa979f97041001a161176a630acbd..ef73c3d705fae0c13d20d1f2b9a4a3e4a8ae8e02 100644 (file)
@@ -321,16 +321,24 @@ __ZN7WebCore4PageD1Ev
 __ZN7WebCore5Cache11setDisabledEb
 __ZN7WebCore5Cache13getStatisticsEv
 __ZN7WebCore5Cache14setMaximumSizeEj
+__ZN7WebCore5Frame11setIsActiveEb
 __ZN7WebCore5Frame11setSettingsEPNS_8SettingsE
 __ZN7WebCore5Frame11shouldCloseEv
+__ZN7WebCore5Frame17bindingRootObjectEv
 __ZN7WebCore5Frame17setWindowHasFocusEb
+__ZN7WebCore5Frame18windowScriptObjectEv
 __ZN7WebCore5Frame20setSelectionFromNoneEv
+__ZN7WebCore5Frame20windowScriptNPObjectEv
 __ZN7WebCore5Frame21setProhibitsScrollingEb
+__ZN7WebCore5Frame26dashboardRegionsDictionaryEv
+__ZN7WebCore5Frame9setBridgeEP18WebCoreFrameBridge
+__ZN7WebCore5FrameC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
 __ZN7WebCore5Image10getNSImageEv
 __ZN7WebCore5Image21getTIFFRepresentationEv
 __ZN7WebCore5RangeC1EPNS_8DocumentEPNS_4NodeEiS4_i
 __ZN7WebCore5RangeD1Ev
 __ZN7WebCore5cacheEv
+__ZN7WebCore5equalEPKNS_10StringImplEPKc
 __ZN7WebCore5equalEPKNS_10StringImplES2_
 __ZN7WebCore6Editor10applyStyleEPNS_19CSSStyleDeclarationENS_10EditActionE
 __ZN7WebCore6Editor10insertTextERKNS_6StringEbPNS_5EventE
@@ -344,6 +352,7 @@ __ZN7WebCore6Editor12tryDHTMLCopyEv
 __ZN7WebCore6Editor13canDHTMLPasteEv
 __ZN7WebCore6Editor13performDeleteEv
 __ZN7WebCore6Editor13tryDHTMLPasteEv
+__ZN7WebCore6Editor16pasteAsPlainTextEv
 __ZN7WebCore6Editor16selectMarkedTextEv
 __ZN7WebCore6Editor17discardMarkedTextEv
 __ZN7WebCore6Editor19deleteWithDirectionENS_19SelectionController10EDirectionENS_15TextGranularityEbb
@@ -374,11 +383,6 @@ __ZN7WebCore8Document13removeMarkersENS_14DocumentMarker10MarkerTypeE
 __ZN7WebCore8Document14setFocusedNodeEN3WTF10PassRefPtrINS_4NodeEEE
 __ZN7WebCore8Document4bodyEv
 __ZN7WebCore8DragDataC1EP11objc_objectRKNS_8IntPointES5_NS_13DragOperationEPNS_16PasteboardHelperE
-__ZN7WebCore8FrameMac18windowScriptObjectEv
-__ZN7WebCore8FrameMac20windowScriptNPObjectEv
-__ZN7WebCore8FrameMac26dashboardRegionsDictionaryEv
-__ZN7WebCore8FrameMac9setBridgeEP18WebCoreFrameBridge
-__ZN7WebCore8FrameMacC1EPNS_4PageEPNS_21HTMLFrameOwnerElementEPNS_17FrameLoaderClientE
 __ZN7WebCore8IntPointC1ERK8_NSPoint
 __ZN7WebCore8Settings14setJavaEnabledEb
 __ZN7WebCore8Settings17setPluginsEnabledEb
@@ -535,18 +539,22 @@ __ZNK7WebCore5Frame10isFrameSetEv
 __ZNK7WebCore5Frame12eventHandlerEv
 __ZNK7WebCore5Frame12ownerElementEv
 __ZNK7WebCore5Frame13selectionRectEv
+__ZNK7WebCore5Frame14selectionImageEb
 __ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE
 __ZNK7WebCore5Frame16inViewSourceModeEv
 __ZNK7WebCore5Frame19selectionControllerEv
 __ZNK7WebCore5Frame19setInViewSourceModeEb
 __ZNK7WebCore5Frame20visibleSelectionRectEv
 __ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
+__ZNK7WebCore5Frame31fontAttributesForSelectionStartEv
 __ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
 __ZNK7WebCore5Frame4pageEv
 __ZNK7WebCore5Frame4treeEv
+__ZNK7WebCore5Frame6bridgeEv
 __ZNK7WebCore5Frame6editorEv
 __ZNK7WebCore5Frame6loaderEv
 __ZNK7WebCore5Frame8documentEv
+__ZNK7WebCore5Frame8settingsEv
 __ZNK7WebCore5Range11pastEndNodeEv
 __ZNK7WebCore5Range11startOffsetERi
 __ZNK7WebCore5Range12endContainerERi
@@ -569,8 +577,6 @@ __ZNK7WebCore7Element12getAttributeERKNS_13QualifiedNameE
 __ZNK7WebCore7IntRectcv7_NSRectEv
 __ZNK7WebCore8Document11defaultViewEv
 __ZNK7WebCore8Document5frameEv
-__ZNK7WebCore8FrameMac14selectionImageEb
-__ZNK7WebCore8FrameMac31fontAttributesForSelectionStartEv
 __ZNK7WebCore8IntPointcv8_NSPointEv
 __ZNK7WebCore9FloatRectcv7_NSRectEv
 __ZNK7WebCore9FrameTree12traverseNextEPKNS_5FrameE
index be83d47c5a575229976aa46d23b848beacc61698..3a11d6cb79f6d469fd1c10854ef820de1ea8291f 100644 (file)
                6593923709AE4346002C531F /* KURL.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6593923509AE4346002C531F /* KURL.cpp */; };
                6593923809AE4346002C531F /* KURL.h in Headers */ = {isa = PBXBuildFile; fileRef = 6593923609AE4346002C531F /* KURL.h */; settings = {ATTRIBUTES = (Private, ); }; };
                6593923A09AE435C002C531F /* KURLMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 6593923909AE435C002C531F /* KURLMac.mm */; };
+               6596F2B30B8731DF001326BD /* DOMHTMLInputElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E711640AC5D5350053270F /* DOMHTMLInputElementInternal.h */; };
+               6596F2C10B87325C001326BD /* DOMHTMLTextAreaElementInternal.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = 85E7117F0AC5D5350053270F /* DOMHTMLTextAreaElementInternal.h */; };
                659A7D130B6DB4D9001155B3 /* SubstituteData.h in Headers */ = {isa = PBXBuildFile; fileRef = 659A7D120B6DB4D9001155B3 /* SubstituteData.h */; settings = {ATTRIBUTES = (Private, ); }; };
                659DDC8209E198BA001BF3C6 /* JSDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 659DDC8009E198BA001BF3C6 /* JSDocument.cpp */; };
                659DDC8309E198BA001BF3C6 /* JSDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = 659DDC8109E198BA001BF3C6 /* JSDocument.h */; };
                65BF022E0974816300C43196 /* Frame.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65BF02290974816300C43196 /* Frame.cpp */; };
                65BF022F0974816300C43196 /* Frame.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF022A0974816300C43196 /* Frame.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65BF02300974816300C43196 /* FramePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF022B0974816300C43196 /* FramePrivate.h */; };
-               65BF02440974819000C43196 /* FrameMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 65BF023B0974819000C43196 /* FrameMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
                65BF02450974819000C43196 /* FrameMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 65BF023C0974819000C43196 /* FrameMac.mm */; };
                65C97AF308EA908800ACD273 /* config.h in Headers */ = {isa = PBXBuildFile; fileRef = 65C97AF208EA908800ACD273 /* config.h */; };
                65CBFEF90974F607001DAC25 /* FrameView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65CBFEF70974F607001DAC25 /* FrameView.cpp */; };
                        dstPath = Versions/A/PrivateHeaders;
                        dstSubfolderSpec = 1;
                        files = (
+                               6596F2C10B87325C001326BD /* DOMHTMLTextAreaElementInternal.h in Copy Generated Headers */,
+                               6596F2B30B8731DF001326BD /* DOMHTMLInputElementInternal.h in Copy Generated Headers */,
                                A8D06B390A265DCD005E7203 /* HTMLNames.h in Copy Generated Headers */,
                                1ACD1B630B029739007E5016 /* DOMCSSStyleDeclarationInternal.h in Copy Generated Headers */,
                                1CB4214A0AF2B2CA0085AD91 /* DOMDocumentInternal.h in Copy Generated Headers */,
                65BF02290974816300C43196 /* Frame.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Frame.cpp; sourceTree = "<group>"; };
                65BF022A0974816300C43196 /* Frame.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Frame.h; sourceTree = "<group>"; };
                65BF022B0974816300C43196 /* FramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FramePrivate.h; sourceTree = "<group>"; };
-               65BF023B0974819000C43196 /* FrameMac.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FrameMac.h; sourceTree = "<group>"; };
                65BF023C0974819000C43196 /* FrameMac.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = FrameMac.mm; sourceTree = "<group>"; };
                65C97AF208EA908800ACD273 /* config.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                65CBFEF70974F607001DAC25 /* FrameView.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FrameView.cpp; sourceTree = "<group>"; };
                        children = (
                                93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */,
                                A718788F0B2D04AC00A16ECE /* DragControllerMac.mm */,
-                               65BF023B0974819000C43196 /* FrameMac.h */,
                                65BF023C0974819000C43196 /* FrameMac.mm */,
                                654EC60F097778F500DAB52C /* WebCoreFrameBridge.h */,
                                654EC610097778F500DAB52C /* WebCoreFrameBridge.mm */,
                                A8136D380973A8E700D74463 /* FormDataList.h in Headers */,
                                65BF022F0974816300C43196 /* Frame.h in Headers */,
                                65BF02300974816300C43196 /* FramePrivate.h in Headers */,
-                               65BF02440974819000C43196 /* FrameMac.h in Headers */,
                                FAE04190097596C9000540BE /* SVGImageLoader.h in Headers */,
                                65CBFEFA0974F607001DAC25 /* FrameView.h in Headers */,
                                A8185F3909765766005826D9 /* DocumentType.h in Headers */,
index d9401823da74463b914297d5ea2bdad88d578025..c8095a0eef34a1fcf3b217b1dc579fa243c6996c 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "kjs_binding.h"
 
+#include "Chrome.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "Frame.h"
index 0d2b65b39d5f60e76cba5a10908c7c8ac8f3b935..4687c75facee27cca6151e47630ce9c7397e7440 100644 (file)
@@ -44,7 +44,7 @@
 #import "ExceptionHandlers.h"
 #import "FontData.h"
 #import "FoundationExtras.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "HTMLDocument.h"
 #import "HTMLNames.h"
 #import "HTMLPlugInElement.h"
@@ -375,8 +375,8 @@ static NSArray *kit(const Vector<IntRect>& rects)
 - (KJS::Bindings::RootObject*)_rootObject
 {
     if (WebCore::Node *n = [self _node]) {
-        if (WebCore::FrameMac* frame = Mac(n->document()->frame()))
-            return frame->rootObjectForDOM();
+        if (WebCore::Frame* frame = n->document()->frame())
+            return frame->bindingRootObject();
     }
     return 0;
 }
index 4043386638396e73e7713edc2abe85aa0977bfbd..e8472eb5ba2956e1d171f7b1a53a0b1286b2c405 100644 (file)
@@ -28,7 +28,7 @@
 
 #import "Document.h"
 #import "Event.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "Node.h"
 #import "PlatformString.h"
 #import "Range.h"
@@ -113,7 +113,7 @@ void removeDOMWrapper(DOMObjectInternal* impl)
     // Get (or create) a cached JS object for the DOM node.
     KJS::JSObject *scriptImp = static_cast<KJS::JSObject*>(KJS::toJS(exec, nodeImpl));
 
-    KJS::Bindings::RootObject* rootObject = WebCore::Mac(frame)->bindingRootObject();
+    KJS::Bindings::RootObject* rootObject = frame->bindingRootObject();
 
     [self _initializeWithObjectImp:scriptImp originRootObject:rootObject rootObject:rootObject];
 }
index e476e617d6ba226b6ef8a916906a090cc06d1f5d..916ed26f3f1300ea1963397a196fa265a0686280 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,6 +28,7 @@
 #define EditorClient_h
 
 #include "EditorInsertAction.h"
+#include "TextAffinity.h"
 #include <wtf/Forward.h>
 
 #if PLATFORM(MAC)
@@ -40,6 +42,7 @@ namespace WebCore {
 
 class CSSStyleDeclaration;
 class EditCommand;
+class Element;
 class Frame;
 class HTMLElement;
 class KeyboardEvent;
@@ -68,7 +71,8 @@ public:
     virtual bool shouldEndEditing(Range*) = 0;
     virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) = 0;
     virtual bool shouldInsertText(String, Range*, EditorInsertAction) = 0;
-//  virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, NSSelectionAffinity, bool stillSelecting) = 0;
+    virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) = 0;
+    
     virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) = 0;
 //  virtual bool shouldChangeTypingStyle(CSSStyleDeclaration* fromStyle, CSSStyleDeclaration* toStyle) = 0;
 //  virtual bool doCommandBySelector(SEL selector) = 0;
@@ -93,6 +97,13 @@ public:
     virtual void redo() = 0;
 
     virtual void handleKeyPress(KeyboardEvent*) = 0;
+    
+    virtual void textFieldDidBeginEditing(Element*) = 0;
+    virtual void textFieldDidEndEditing(Element*) = 0;
+    virtual void textDidChangeInTextField(Element*) = 0;
+    virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) = 0;
+    virtual void textWillBeDeletedInTextField(Element*) = 0;
+    virtual void textDidChangeInTextArea(Element*) = 0;
 
 #if PLATFORM(MAC)
     virtual void markedTextAbandoned(Frame*) = 0;
index cf4db00e93df7fd369b84b1acd3efb590a33c9b1..a84baebbdb9953d66a94a926232766aa4b78bfd9 100644 (file)
@@ -28,7 +28,7 @@
 
 #import "BlockExceptions.h"
 #import "Document.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "MouseEventWithHitTestResults.h"
 #import "PlatformScrollBar.h"
 #import "RenderObject.h"
@@ -39,7 +39,7 @@ namespace WebCore {
 void FrameView::updateBorder()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [Mac(m_frame.get())->bridge() setHasBorder:hasBorder()];
+    [m_frame.get()->bridge() setHasBorder:hasBorder()];
     END_BLOCK_OBJC_EXCEPTIONS;
 }
 
@@ -50,7 +50,7 @@ void FrameView::updateDashboardRegions()
         Vector<DashboardRegionValue> newRegions;
         doc->renderer()->collectDashboardRegions(newRegions);
         doc->setDashboardRegions(newRegions);
-        Mac(m_frame.get())->dashboardRegionsChanged();
+        m_frame.get()->dashboardRegionsChanged();
     }
 }
 
index b3bcf062dfa6b3b5728fbc5a4f029527f0d20838..d142725d6d2536505831e6c5e25e3ed40bda8f83 100644 (file)
@@ -31,7 +31,7 @@
 #import "EventNames.h"
 #import "FontData.h"
 #import "FrameLoader.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "FrameView.h"
 #import "HTMLAreaElement.h"
 #import "HTMLCollection.h"
@@ -2345,11 +2345,11 @@ static VisiblePosition endOfStyleRange (const VisiblePosition visiblePos)
         bridge = [bridgeHolder webCoreBridge];
     }
 
-    FrameMac* frameMac = [bridge _frame];
-    if (!frameMac)
+    Frame* frame = [bridge _frame];
+    if (!frame)
         return NULL;
         
-    Document* document = frameMac->document();
+    Document* document = frame->document();
     if (!document)
         return NULL;
         
index 4261dbb0e45931d94434a7809437411e432d670d..943fa832bcd96969e536a232e22b42b9cdeca80b 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -65,13 +66,13 @@ const CommandImp* commandImp(const String& command)
 
 bool execCopy(Frame* frame)
 {
-    frame->copyToPasteboard();
+    frame->editor()->copy();
     return true;
 }
 
 bool execCut(Frame* frame)
 {
-    frame->cutToPasteboard();
+    frame->editor()->cut();
     return true;
 }
 
@@ -89,7 +90,7 @@ bool execForwardDelete(Frame* frame)
 
 bool execPaste(Frame* frame)
 {
-    frame->pasteFromPasteboard();
+    frame->editor()->paste();
     return true;
 }
 
index 31d7976c7fbb864a7e4bf1781ebae606b4b72e0b..b3c97d066703fa3f398a29884a7cb6dfdd55f8bd 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006, 2007 Apple Inc. All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -294,9 +295,10 @@ void Editor::pasteAsPlainTextWithPasteboard(Pasteboard* pasteboard)
 
 void Editor::pasteWithPasteboard(Pasteboard* pasteboard, bool allowPlainText)
 {
+    RefPtr<Range> range = selectedRange();
     bool chosePlainText;
-    RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, selectedRange(), allowPlainText, chosePlainText);
-    if (fragment && shouldInsertFragment(fragment, selectedRange(), EditorInsertActionPasted))
+    RefPtr<DocumentFragment> fragment = pasteboard->documentFragment(m_frame, range, allowPlainText, chosePlainText);
+    if (fragment && shouldInsertFragment(fragment, range, EditorInsertActionPasted))
         replaceSelectionWithFragment(fragment, false, canSmartReplaceWithPasteboard(pasteboard), chosePlainText);
 }
 
@@ -1343,14 +1345,27 @@ void Editor::copy()
 
 void Editor::paste()
 {
+#if PLATFORM(MAC)
+    // using the platform independent code below requires moving all of
+    // WEBHTMLView: _documentFragmentFromPasteboard over to PasteboardMac.
+    m_frame->issuePasteCommand();
+#else
     if (tryDHTMLPaste())
         return;     // DHTML did the whole operation
     if (!canPaste())
         return;
-    if (canEditRichly()) // or should we call m_frame->selectionController()->isContentRichlyEditable()
+    if (m_frame->selectionController()->isContentRichlyEditable())
         pasteWithPasteboard(Pasteboard::generalPasteboard(), true);
     else
         pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
+#endif
+}
+
+void Editor::pasteAsPlainText()
+{
+   if (!canPaste())
+        return;
+   pasteAsPlainTextWithPasteboard(Pasteboard::generalPasteboard());
 }
 
 void Editor::performDelete()
index 218fc7c4b1f87047a9d31d4321d8025131a043e9..ff1ffc2be7eab00b289ddfcdce691aa7bf12606d 100644 (file)
@@ -86,6 +86,7 @@ public:
     void cut();
     void copy();
     void paste();
+    void pasteAsPlainText();
     void performDelete();
 
     void copyURL(const KURL&, const String&);
index 088505e6144491bd35e6a008dfc4cb4c379567d9..a73e73747241ad5e578f2cf43bfedc2f8b4b6536 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -211,7 +212,7 @@ bool execBold(Frame* frame, bool, const String&)
 
 bool execCopy(Frame* frame, bool, const String&)
 {
-    frame->copyToPasteboard();
+    frame->editor()->copy();
     return true;
 }
 
@@ -230,7 +231,7 @@ bool execCreateLink(Frame* frame, bool userInterface, const String& value)
 
 bool execCut(Frame* frame, bool, const String&)
 {
-    frame->cutToPasteboard();
+    frame->editor()->cut();
     return true;
 }
 
@@ -403,13 +404,13 @@ bool execOutdent(Frame* frame, bool, const String&)
 
 bool execPaste(Frame* frame, bool, const String&)
 {
-    frame->pasteFromPasteboard();
+    frame->editor()->paste();
     return true;
 }
 
 bool execPasteAndMatchStyle(Frame* frame, bool, const String&)
 {
-    frame->pasteAndMatchStyle();
+    frame->editor()->pasteAsPlainText();
     return true;
 }
 
index 22f3db82b587dd96bc737ca8637fdabf9c5be9dc..ce8fbc326d20fb5d72334a0767e011a72b9800e4 100644 (file)
@@ -33,7 +33,7 @@
 #import "EditorClient.h"
 #import "Element.h"
 #import "ExceptionHandlers.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "PlatformString.h"
 #import "Selection.h"
 #import "SelectionController.h"
@@ -648,7 +648,7 @@ void Editor::showColorPanel()
 
 void Editor::unmarkText()
 {
-    Mac(m_frame)->setMarkedTextRange(0, nil, nil);
+    m_frame->setMarkedTextRange(0, nil, nil);
 }
 
 } // namespace WebCore
index 6c7ec3d171603a85d79b3e9c396fd76f2a1daa68..04687c9e4888f71812df5f18fbe0984898db01bf 100644 (file)
@@ -5,6 +5,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -153,9 +154,7 @@ KJS::Bindings::Instance *HTMLAppletElement::getInstance() const
     if (r) {
         r->createWidgetIfNecessary();
         if (r->widget())
-            // Call into the frame (and over the bridge) to pull the Bindings::Instance
-            // from the guts of the plugin.
-            m_instance = frame->getAppletInstanceForWidget(r->widget());
+            m_instance = frame->createScriptInstanceForWidget(r->widget());
     }
     return m_instance.get();
 }
index f04c9c5be3561df4f46501059aecc912b6aefd31..51429b9c22c0473a968cc4c0df057355a385b06f 100644 (file)
@@ -5,6 +5,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -71,15 +72,9 @@ KJS::Bindings::Instance *HTMLEmbedElement::getInstance() const
             r = p->renderer();
     }
 
-    if (r && r->isWidget()){
-        if (Widget* widget = static_cast<RenderWidget*>(r)->widget()) {
-            // Call into the frame (and over the bridge) to pull the Bindings::Instance
-            // from the guts of the Java VM.
-            m_instance = frame->getEmbedInstanceForWidget(widget);
-            // Applet may specified with <embed> tag.
-            if (!m_instance)
-                m_instance = frame->getAppletInstanceForWidget(widget);
-        }
+    if (r && r->isWidget()) {
+        if (Widget* widget = static_cast<RenderWidget*>(r)->widget()) 
+            m_instance = frame->createScriptInstanceForWidget(widget);
     }
     return m_instance.get();
 }
index 2d5ac76897aa002942c6859d76b9d47ff2b13ac3..1f5f66933d0427be29ba582b88cd8ecad969ee02 100644 (file)
@@ -28,6 +28,7 @@
 #include "HTMLFormElement.h"
 
 #include "CString.h"
+#include "csshelper.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "FormData.h"
@@ -39,7 +40,7 @@
 #include "HTMLImageElement.h"
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
-#include "csshelper.h"
+#include "MimeTypeRegistry.h"
 #include "RenderTextControl.h"
 
 namespace WebCore {
@@ -257,7 +258,7 @@ PassRefPtr<FormData> HTMLFormElement::formData() const
                         hstr += "\"";
 
                         if (!static_cast<HTMLInputElement*>(current)->value().isEmpty()) {
-                            DeprecatedString mimeType = frame ? frame->mimeTypeForFileName(path).deprecatedString() : DeprecatedString();
+                            DeprecatedString mimeType = MimeTypeRegistry::getMIMETypeForPath(path).deprecatedString();
                             if (!mimeType.isEmpty()) {
                                 hstr += "\r\nContent-Type: ";
                                 hstr += mimeType.ascii();
index 1cbe25c01064a03336f8cb03eea40499bfde399b..f23c6356b667bf60d5aac14caa5c18729e6c9b4d 100644 (file)
@@ -5,6 +5,7 @@
  *           (C) 1999 Antti Koivisto (koivisto@kde.org)
  *           (C) 2000 Stefan Schimanski (1Stein@gmx.de)
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -78,17 +79,10 @@ KJS::Bindings::Instance *HTMLObjectElement::getInstance() const
     if (m_instance)
         return m_instance.get();
 
-    if (RenderObject* r = renderer()) {
-        if (r->isWidget()) {
-            if (Widget* widget = static_cast<RenderWidget*>(r)->widget()) {
-                // Call into the frame (and over the bridge) to pull the Bindings::Instance
-                // from the guts of the plugin.
-                m_instance = frame->getObjectInstanceForWidget(widget);
-                // Applet may specified with <object> tag.
-                if (!m_instance)
-                    m_instance = frame->getAppletInstanceForWidget(widget);
-            }
-        }
+    RenderObject* r = renderer();
+    if (r && r->isWidget()) {
+        if (Widget* widget = static_cast<RenderWidget*>(r)->widget()) 
+            m_instance = frame->createScriptInstanceForWidget(widget);
     }
 
     return m_instance.get();
index 367599898adb652ef898ff9b856a7ad94b82a683..faec3b83daa04dd4a3643b8f520f62f2fbb71ccb 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include <kjs/JSLock.h>
 #include <kjs/object.h>
 
-#if PLATFORM(MAC)
-#include "FrameMac.h"
-#endif
-
 using namespace KJS;
 
 namespace WebCore {
@@ -726,7 +723,7 @@ void FrameLoader::clear(bool clearWindowProperties)
     // urlsBridgeKnowsAbout.clear();
 
 #if PLATFORM(MAC)
-    Mac(m_frame)->setMarkedTextRange(0, nil, nil);
+    m_frame->setMarkedTextRange(0, nil, nil);
 #endif
 
     if (!m_needsClear)
@@ -754,7 +751,7 @@ void FrameLoader::clear(bool clearWindowProperties)
     m_decoder = 0;
 
     m_containsPlugIns = false;
-    m_frame->cleanupPluginObjects();
+    m_frame->cleanupScriptObjects();
   
     m_redirectionTimer.stop();
     m_scheduledRedirection.clear();
@@ -2893,7 +2890,7 @@ void FrameLoader::detachFromParent()
         m_frame->pageDestroyed();
     }
 #if PLATFORM(MAC)
-    [Mac(m_frame)->bridge() close];
+    [m_frame->bridge() close];
 #endif
     m_client->detachedFromParent4();
 }
index 585ac4e410ebf84ff6da60d78199da5cf5dd7fbe..755f448812de3296931e03cb2b2f29fa25a71cb4 100644 (file)
@@ -28,7 +28,7 @@
 #include "CachedImage.h"
 #include "Document.h"
 #include "FrameLoader.h"
-#include "FrameMac.h"
+#include "Frame.h"
 #include "WebCoreFrameBridge.h"
 #include "DocumentLoader.h"
 
@@ -41,7 +41,7 @@ void finishImageLoad(Document* document, CachedImage* image)
 
     IntSize size = image->imageSize();
     if (size.width())
-        document->setTitle([Mac(frame)->bridge() imageTitleForFilename:response.suggestedFilename() size:size]);
+        document->setTitle([frame->bridge() imageTitleForFilename:response.suggestedFilename() size:size]);
 }
     
 }
index 618da5c94eafd3b6520620d9bda33eb2bcc2f014..0a27757399e004f26b7333668b8d803d91519b7d 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "Document.h"
 #include "FrameLoader.h"
-#include "FrameQt.h"
+#include "Frame.h"
 #include "PlatformString.h"
 #include "SharedBuffer.h"
 #include "XMLTokenizer.h"
index 88a4102315bc3409b1fc5d9d4326f4dc6949c19c..b642ef989d0e4ebbd086deb949a66ba4392d0772 100644 (file)
@@ -1,6 +1,7 @@
 // -*- mode: c++; c-basic-offset: 4 -*-
 /*
  * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -253,5 +254,25 @@ bool Chrome::shouldInterruptJavaScript()
     return m_client->shouldInterruptJavaScript();
 }
 
+IntRect Chrome::windowResizerRect() const
+{
+    return m_client->windowResizerRect();
+}
+
+void Chrome::addToDirtyRegion(const IntRect& rect)
+{
+    m_client->addToDirtyRegion(rect);
+}
+
+void Chrome::scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect)
+{
+    m_client->scrollBackingStore(dx, dy, scrollViewRect, clipRect);
+}
+
+void Chrome::updateBackingStore()
+{
+    m_client->updateBackingStore();
+}
+
 } // namespace WebCore
 
index 0be1ee3002d16536a54106465f431da9e9b6e2a5..76f4d1e9891001a6b137676dab0cf41d991a7f80 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: c++; c-basic-offset: 4 -*-
 /*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006-2007 Apple Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -31,6 +31,7 @@ namespace WebCore {
     class ContextMenu;
     class FloatRect;
     class Frame;
+    class IntRect;
     class Page;
     class String;
     
@@ -87,9 +88,15 @@ namespace WebCore {
 
         void runJavaScriptAlert(Frame*, const String&);
         bool runJavaScriptConfirm(Frame*, const String&);
-        bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);        
+        bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result);                
         void setStatusbarText(Frame*, const String&);
         bool shouldInterruptJavaScript();
+
+        IntRect windowResizerRect() const;
+        void addToDirtyRegion(const IntRect&);
+        void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect);
+        void updateBackingStore();
+
     private:
         Page* m_page;
         ChromeClient* m_client;
index e22db08b8702962006b2185e6739f5b4f3edeaa9..b366c43ca921314d3dc9d14eb7105635bf8822e7 100644 (file)
@@ -1,6 +1,6 @@
 // -*- mode: c++; c-basic-offset: 4 -*-
 /*
- * Copyright (C) 2006 Apple Computer, Inc.
+ * Copyright (C) 2006-2007 Apple, Inc.
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -27,6 +27,7 @@ namespace WebCore {
 
     class FloatRect;
     class Frame;
+    class IntRect;
     class Page;
     class String;
     
@@ -81,8 +82,15 @@ namespace WebCore {
         virtual void runJavaScriptAlert(Frame*, const String&) = 0;
         virtual bool runJavaScriptConfirm(Frame*, const String&) = 0;
         virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) = 0;
+        
         virtual void setStatusbarText(const String&) = 0;
         virtual bool shouldInterruptJavaScript() = 0;
+        virtual bool tabsToLinks() const = 0;
+
+        virtual IntRect windowResizerRect() const = 0;
+        virtual void addToDirtyRegion(const IntRect&) = 0;
+        virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) = 0;
+        virtual void updateBackingStore() = 0;
 };
 
 }
index 9e9fcbfb0a34b89b4ef2b55f6c41c20c9903d5d2..0cdc6e4ed0e0f023db360a1c0bf2137807962be6 100644 (file)
@@ -28,6 +28,7 @@
 #include "EventHandler.h"
 
 #include "CachedImage.h"
+#include "ChromeClient.h"
 #include "Cursor.h"
 #include "Document.h"
 #include "DragController.h"
@@ -1499,6 +1500,25 @@ bool EventHandler::handleTextInputEvent(const String& text, Event* underlyingEve
 }
     
     
+#if !PLATFORM(MAC) && !PLATFORM(QT)
+bool EventHandler::invertSenseOfTabsToLinks(KeyboardEvent*) const
+{
+    return false;
+}
+#endif
+
+bool EventHandler::tabsToLinks(KeyboardEvent* event) const
+{
+    Page* page = m_frame->page();
+    if (!page)
+        return false;
+
+    if (page->chrome()->client()->tabsToLinks())
+        return !invertSenseOfTabsToLinks(event);
+
+    return invertSenseOfTabsToLinks(event);
+}
+
 void EventHandler::defaultTextInputEventHandler(TextEvent* event)
 {
     String data = event->data();
index 59b6d17ade35d2db24e5baec61242a45c0192ea1..de907b1fcdd7ec0e484c214b20a78c5727e3b8ce 100644 (file)
@@ -248,6 +248,8 @@ private:
     bool eventLoopHandleMouseDragged(const MouseEventWithHitTestResults&) { return false; }
 #endif
 
+    bool invertSenseOfTabsToLinks(KeyboardEvent*) const;
+
     Frame* m_frame;
 
     bool m_mousePressed;
index 04b7fdbf66114d94bdf24919f84f845cac6e9e3c..db16a38eed03081a319f139ac2ce43c76ad5454d 100644 (file)
@@ -8,6 +8,7 @@
  *                     2001 George Staikos <staikos@kde.org>
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
  * Copyright (C) 2005 Alexey Proskuryakov <ap@nypop.com>
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
@@ -41,6 +42,7 @@
 #include "DocLoader.h"
 #include "DocumentType.h"
 #include "EditingText.h"
+#include "EditorClient.h"
 #include "Event.h"
 #include "EventNames.h"
 #include "FloatRect.h"
@@ -56,6 +58,7 @@
 #include "HTMLInputElement.h"
 #include "HTMLNames.h"
 #include "HTMLObjectElement.h"
+#include "HTMLTableCellElement.h"
 #include "HitTestRequest.h"
 #include "HitTestResult.h"
 #include "IconDatabase.h"
 #include "NodeList.h"
 #include "Page.h"
 #include "PlatformScrollBar.h"
+#include "RegularExpression.h"
 #include "RenderListBox.h"
 #include "RenderObject.h"
 #include "RenderPart.h"
+#include "RenderTableCell.h"
 #include "RenderTextControl.h"
 #include "RenderTheme.h"
 #include "RenderView.h"
@@ -90,9 +95,9 @@
 #include <sys/types.h>
 #include <wtf/Platform.h>
 
-#if PLATFORM(MAC)
-#include "FrameMac.h"
-#endif
+#include "bindings/NP_jsobject.h"
+#include "bindings/npruntime_impl.h"
+#include "bindings/runtime_root.h"
 
 #if !PLATFORM(WIN_OS)
 #include <unistd.h>
@@ -203,6 +208,15 @@ Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient*
 
 Frame::~Frame()
 {
+    setView(0);
+    loader()->clearRecordedFormValues();
+
+#if PLATFORM(MAC)
+    setBridge(0);
+#endif
+    
+    loader()->cancelAndClear();
+    
     // FIXME: We should not be doing all this work inside the destructor
 
     ASSERT(!d->m_lifeSupportTimer.isActive());
@@ -323,6 +337,11 @@ String Frame::selectedText() const
     return plainText(selectionController()->toRange().get());
 }
 
+Range* Frame::markedTextRange() const
+{
+    return d->m_markedTextRange.get();
+}
+
 SelectionController* Frame::selectionController() const
 {
     return &d->m_selectionController;
@@ -353,6 +372,159 @@ SelectionController* Frame::dragCaretController() const
     return d->m_page->dragCaretController();
 }
 
+
+// Either get cached regexp or build one that matches any of the labels.
+// The regexp we build is of the form:  (STR1|STR2|STRN)
+static RegularExpression *regExpForLabels(const Vector<String>& labels)
+{
+    // REVIEW- version of this call in FrameMac.mm caches based on the NSArray ptrs being
+    // the same across calls.  We can't do that.
+
+    static RegularExpression wordRegExp = RegularExpression("\\w");
+    DeprecatedString pattern("(");
+    unsigned int numLabels = labels.size();
+    unsigned int i;
+    for (i = 0; i < numLabels; i++) {
+        DeprecatedString label = labels[i].deprecatedString();
+
+        bool startsWithWordChar = false;
+        bool endsWithWordChar = false;
+        if (label.length() != 0) {
+            startsWithWordChar = wordRegExp.search(label.at(0)) >= 0;
+            endsWithWordChar = wordRegExp.search(label.at(label.length() - 1)) >= 0;
+        }
+        
+        if (i != 0)
+            pattern.append("|");
+        // Search for word boundaries only if label starts/ends with "word characters".
+        // If we always searched for word boundaries, this wouldn't work for languages
+        // such as Japanese.
+        if (startsWithWordChar) {
+            pattern.append("\\b");
+        }
+        pattern.append(label);
+        if (endsWithWordChar) {
+            pattern.append("\\b");
+        }
+    }
+    pattern.append(")");
+    return new RegularExpression(pattern, false);
+}
+
+String Frame::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
+{
+    RenderTableCell* cellRenderer = static_cast<RenderTableCell*>(cell->renderer());
+
+    if (cellRenderer && cellRenderer->isTableCell()) {
+        RenderTableCell* cellAboveRenderer = cellRenderer->table()->cellAbove(cellRenderer);
+
+        if (cellAboveRenderer) {
+            HTMLTableCellElement* aboveCell =
+                static_cast<HTMLTableCellElement*>(cellAboveRenderer->element());
+
+            if (aboveCell) {
+                // search within the above cell we found for a match
+                for (Node* n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
+                    if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
+                        // For each text chunk, run the regexp
+                        DeprecatedString nodeString = n->nodeValue().deprecatedString();
+                        int pos = regExp->searchRev(nodeString);
+                        if (pos >= 0)
+                            return nodeString.mid(pos, regExp->matchedLength());
+                    }
+                }
+            }
+        }
+    }
+    // Any reason in practice to search all cells in that are above cell?
+    return String();
+}
+
+String Frame::searchForLabelsBeforeElement(const Vector<String>& labels, Element* element)
+{
+    RegularExpression* regExp = regExpForLabels(labels);
+    // We stop searching after we've seen this many chars
+    const unsigned int charsSearchedThreshold = 500;
+    // This is the absolute max we search.  We allow a little more slop than
+    // charsSearchedThreshold, to make it more likely that we'll search whole nodes.
+    const unsigned int maxCharsSearched = 600;
+    // If the starting element is within a table, the cell that contains it
+    HTMLTableCellElement* startingTableCell = 0;
+    bool searchedCellAbove = false;
+
+    // walk backwards in the node tree, until another element, or form, or end of tree
+    int unsigned lengthSearched = 0;
+    Node* n;
+    for (n = element->traversePreviousNode();
+         n && lengthSearched < charsSearchedThreshold;
+         n = n->traversePreviousNode())
+    {
+        if (n->hasTagName(formTag)
+            || (n->isHTMLElement()
+                && static_cast<HTMLElement*>(n)->isGenericFormElement()))
+        {
+            // We hit another form element or the start of the form - bail out
+            break;
+        } else if (n->hasTagName(tdTag) && !startingTableCell) {
+            startingTableCell = static_cast<HTMLTableCellElement*>(n);
+        } else if (n->hasTagName(trTag) && startingTableCell) {
+            String result = searchForLabelsAboveCell(regExp, startingTableCell);
+            if (!result.isEmpty())
+                return result;
+            searchedCellAbove = true;
+        } else if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
+            // For each text chunk, run the regexp
+            DeprecatedString nodeString = n->nodeValue().deprecatedString();
+            // add 100 for slop, to make it more likely that we'll search whole nodes
+            if (lengthSearched + nodeString.length() > maxCharsSearched)
+                nodeString = nodeString.right(charsSearchedThreshold - lengthSearched);
+            int pos = regExp->searchRev(nodeString);
+            if (pos >= 0)
+                return nodeString.mid(pos, regExp->matchedLength());
+            else
+                lengthSearched += nodeString.length();
+        }
+    }
+
+    // If we started in a cell, but bailed because we found the start of the form or the
+    // previous element, we still might need to search the row above us for a label.
+    if (startingTableCell && !searchedCellAbove) {
+         return searchForLabelsAboveCell(regExp, startingTableCell);
+    }
+    return String();
+}
+
+String Frame::matchLabelsAgainstElement(const Vector<String>& labels, Element* element)
+{
+    DeprecatedString name = element->getAttribute(nameAttr).deprecatedString();
+    // Make numbers and _'s in field names behave like word boundaries, e.g., "address2"
+    name.replace(RegularExpression("[[:digit:]]"), " ");
+    name.replace('_', ' ');
+    
+    RegularExpression* regExp = regExpForLabels(labels);
+    // Use the largest match we can find in the whole name string
+    int pos;
+    int length;
+    int bestPos = -1;
+    int bestLength = -1;
+    int start = 0;
+    do {
+        pos = regExp->search(name, start);
+        if (pos != -1) {
+            length = regExp->matchedLength();
+            if (length >= bestLength) {
+                bestPos = pos;
+                bestLength = length;
+            }
+            start = pos+1;
+        }
+    } while (pos != -1);
+
+    if (bestPos != -1)
+        return name.mid(bestPos, bestLength);
+    return String();
+}
+
 const Selection& Frame::mark() const
 {
     return d->m_mark;
@@ -573,42 +745,37 @@ bool Frame::shouldChangeSelection(const Selection& newSelection) const
     return shouldChangeSelection(selectionController()->selection(), newSelection, newSelection.affinity(), false);
 }
 
-bool Frame::shouldDeleteSelection(const Selection& newSelection) const
+bool Frame::shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity affinity, bool stillSelecting) const
 {
-    return true;
+    return editor()->client()->shouldChangeSelectedRange(oldSelection.toRange().get(), newSelection.toRange().get(),
+                                                         affinity, stillSelecting);
+}
+
+bool Frame::shouldDeleteSelection(const Selection& selection) const
+{
+    return editor()->client()->shouldDeleteRange(selection.toRange().get());
 }
 
 bool Frame::isContentEditable() const 
 {
+    if (d->m_editor.clientIsEditable())
+        return true;
     if (!d->m_doc)
         return false;
     return d->m_doc->inDesignMode();
 }
 
-void Frame::textFieldDidBeginEditing(Element* input)
-{
-}
-
-void Frame::textFieldDidEndEditing(Element* input)
-{
-}
-
-void Frame::textDidChangeInTextField(Element* input)
+#if !PLATFORM(MAC)
+void Frame::setSecureKeyboardEntry(bool)
 {
 }
 
-bool Frame::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
+bool Frame::isSecureKeyboardEntry()
 {
     return false;
 }
 
-void Frame::textWillBeDeletedInTextField(Element* input)
-{
-}
-
-void Frame::textDidChangeInTextArea(Element* input)
-{
-}
+#endif
 
 CSSMutableStyleDeclaration *Frame::typingStyle() const
 {
@@ -625,26 +792,6 @@ void Frame::clearTypingStyle()
     d->m_typingStyle = 0;
 }
 
-void Frame::copyToPasteboard()
-{
-    issueCopyCommand();
-}
-
-void Frame::cutToPasteboard()
-{
-    issueCutCommand();
-}
-
-void Frame::pasteFromPasteboard()
-{
-    issuePasteCommand();
-}
-
-void Frame::pasteAndMatchStyle()
-{
-    issuePasteAndMatchStyleCommand();
-}
-
 void Frame::transpose()
 {
     issueTransposeCommand();
@@ -798,6 +945,44 @@ CSSComputedStyleDeclaration *Frame::selectionComputedStyle(Node *&nodeToRemove)
     return new CSSComputedStyleDeclaration(styleElement);
 }
 
+void Frame::textFieldDidBeginEditing(Element* e)
+{
+    if (editor()->client())
+        editor()->client()->textFieldDidBeginEditing(e);
+}
+
+void Frame::textFieldDidEndEditing(Element* e)
+{
+    if (editor()->client())
+        editor()->client()->textFieldDidEndEditing(e);
+}
+
+void Frame::textDidChangeInTextField(Element* e)
+{
+    if (editor()->client())
+        editor()->client()->textDidChangeInTextField(e);
+}
+
+bool Frame::doTextFieldCommandFromEvent(Element* e, KeyboardEvent* ke)
+{
+    if (editor()->client())
+        return editor()->client()->doTextFieldCommandFromEvent(e, ke);
+
+    return false;
+}
+
+void Frame::textWillBeDeletedInTextField(Element* input)
+{
+    if (editor()->client())
+        editor()->client()->textWillBeDeletedInTextField(input);
+}
+
+void Frame::textDidChangeInTextArea(Element* e)
+{
+    if (editor()->client())
+        editor()->client()->textDidChangeInTextArea(e);
+}
+
 void Frame::applyEditingStyleToBodyElement() const
 {
     if (!d->m_doc)
@@ -843,12 +1028,6 @@ void Frame::removeEditingStyleFromElement(Element*) const
 {
 }
 
-bool Frame::isCharacterSmartReplaceExempt(UChar, bool)
-{
-    // no smart replace
-    return true;
-}
-
 #ifndef NDEBUG
 static HashSet<Frame*>& keepAliveSet()
 {
@@ -889,6 +1068,71 @@ void Frame::lifeSupportTimerFired(Timer<Frame>*)
     deref();
 }
 
+KJS::Bindings::RootObject* Frame::bindingRootObject()
+{
+    if (!settings()->isJavaScriptEnabled())
+        return 0;
+
+    if (!d->m_bindingRootObject) {
+        JSLock lock;
+        d->m_bindingRootObject = KJS::Bindings::RootObject::create(0, scriptProxy()->interpreter());
+    }
+    return d->m_bindingRootObject.get();
+}
+
+PassRefPtr<KJS::Bindings::RootObject> Frame::createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter> interpreter)
+{
+    RefPtr<KJS::Bindings::RootObject> rootObject = KJS::Bindings::RootObject::create(nativeHandle, interpreter);
+    d->m_rootObjects.append(rootObject);
+    return rootObject.release();
+}
+
+NPObject* Frame::windowScriptNPObject()
+{
+    if (!d->m_windowScriptNPObject) {
+        if (settings()->isJavaScriptEnabled()) {
+            // JavaScript is enabled, so there is a JavaScript window object.  Return an NPObject bound to the window
+            // object.
+            KJS::JSObject* win = KJS::Window::retrieveWindow(this);
+            ASSERT(win);
+            KJS::Bindings::RootObject* root = bindingRootObject();
+            d->m_windowScriptNPObject = _NPN_CreateScriptObject(0, win, root, root);
+        } else {
+            // JavaScript is not enabled, so we cannot bind the NPObject to the JavaScript window object.
+            // Instead, we create an NPObject of a different class, one which is not bound to a JavaScript object.
+            d->m_windowScriptNPObject = _NPN_CreateNoScriptObject();
+        }
+    }
+
+    return d->m_windowScriptNPObject;
+}
+
+void Frame::cleanupScriptObjects()
+{
+    cleanupPlatformScriptObjects();
+    JSLock lock;
+    
+    unsigned count = d->m_rootObjects.size();
+    for (unsigned i = 0; i < count; i++)
+        d->m_rootObjects[i]->invalidate();
+    d->m_rootObjects.clear();
+
+    if (d->m_bindingRootObject) {
+        d->m_bindingRootObject->invalidate();
+        d->m_bindingRootObject = 0;
+    }
+
+    if (d->m_windowScriptNPObject) {
+        // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window
+        // script object properly.
+        // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point.
+        _NPN_DeallocateObject(d->m_windowScriptNPObject);
+        d->m_windowScriptNPObject = 0;
+    }
+}
+
+
+
 void Frame::setSettings(Settings *settings)
 {
     d->m_settings = settings;
@@ -1062,6 +1306,11 @@ void Frame::paint(GraphicsContext* p, const IntRect& rect)
         LOG_ERROR("called Frame::paint with nil renderer");
 }
 
+void Frame::setPaintRestriction(PaintRestriction pr)
+{
+  d->m_paintRestriction = pr;
+}
+
 void Frame::adjustPageHeight(float *newBottom, float oldTop, float oldBottom, float bottomLimit)
 {
     RenderView *root = static_cast<RenderView*>(document()->renderer());
@@ -1559,7 +1808,8 @@ void Frame::scheduleClose()
         chrome->closeWindowSoon();
 }
 
-FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient)
+FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, HTMLFrameOwnerElement* ownerElement,
+                           FrameLoaderClient* frameLoaderClient)
     : m_page(page)
     , m_treeNode(thisFrame, parent)
     , m_ownerElement(ownerElement)
@@ -1584,6 +1834,11 @@ FramePrivate::FramePrivate(Page* page, Frame* parent, Frame* thisFrame, HTMLFram
     , m_inViewSourceMode(false)
     , frameCount(0)
     , m_prohibitsScrolling(false)
+    , m_windowScriptNPObject(0)
+#if PLATFORM(MAC)
+    , m_windowScriptObject(nil)
+    , m_bridge(nil)
+#endif
 {
 }
 
index 3a0a5119e5f8e0076ff352f999abb14c5ebe6793..bbfee0a7130ee676d0c065cc5ff1d7dfa235bd30 100644 (file)
@@ -8,6 +8,7 @@
  *                     2000-2001 Dirk Mueller <mueller@kde.org>
  *                     2000 Stefan Schimanski <1Stein@gmx.de>
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
 #include <wtf/Forward.h>
 #include <wtf/Vector.h>
 
+class NPObject;
+
 namespace KJS {
+    class Interpreter;
+    class JSObject;
+    
     namespace Bindings {
         class Instance;
         class RootObject;
     }
 }
 
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class WebCoreFrameBridge;
+@class WebScriptObject;
+@class NSArray;
+@class NSDictionary;
+@class NSFont;
+@class NSImage;
+@class NSMenu;
+@class NSMutableDictionary;
+@class NSString;
+@class WebCoreFrameBridge;
+#else
+class WebCoreFrameBridge;
+class WebScriptObject;
+class NSArray;
+class NSDictionary;
+class NSFont;
+class NSImage;
+class NSMenu;
+class NSMutableDictionary;
+class NSString;
+class WebCoreFrameBridge;
+typedef unsigned int NSDragOperation;
+typedef int NSWritingDirection;
+#endif
+#endif
+
 namespace WebCore {
 
 class CSSComputedStyleDeclaration;
@@ -59,6 +93,7 @@ class FloatRect;
 class FrameLoader;
 class FrameLoaderClient;
 class HTMLFrameOwnerElement;
+class HTMLTableCellElement;
 class FramePrivate;
 class FrameTree;
 class FrameView;
@@ -99,6 +134,11 @@ public:
     virtual void setView(FrameView*);
     virtual ~Frame();
     
+#if PLATFORM(MAC)    
+    void setBridge(WebCoreFrameBridge*);
+    WebCoreFrameBridge* bridge() const;
+#endif
+
     Page* page() const;
     HTMLFrameOwnerElement* ownerElement() const;
 
@@ -119,18 +159,14 @@ public:
     RenderObject* renderer() const; // root renderer for the document contained in this frame
     RenderPart* ownerRenderer(); // renderer for the element that contains this frame
 
-    friend class FrameGdk;
     friend class FrameLoader;
-    friend class FrameMac;
     friend class FramePrivate;
-    friend class FrameQt;
-    friend class FrameWin;
 
     DragImageRef dragImageForSelection();
     
 private:
     FramePrivate* d;
-
+    
 // === undecided, may or may not belong here
 
 public:
@@ -140,7 +176,9 @@ public:
     const Settings* settings() const;
     void reparseConfiguration();
 
+    // should move to FrameView
     void paint(GraphicsContext*, const IntRect&);
+    void setPaintRestriction(PaintRestriction pr);
 
     void setUserStyleSheetLocation(const KURL&);
     void setUserStyleSheet(const String& styleSheetData);
@@ -156,19 +194,21 @@ public:
     String jsStatusBarText() const;
     String jsDefaultStatusBarText() const;
 
-    virtual void setupRootForPrinting(bool onOrOff) { }
-    virtual Vector<IntRect> computePageRects(const IntRect& printRect, float userScaleFactor) { return Vector<IntRect>(); }
-
     void keepAlive(); // Used to keep the frame alive when running a script that might destroy it.
 #ifndef NDEBUG
     static void cancelAllKeepAlive();
 #endif
 
-    virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*) = 0;
-    virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*) = 0;
-    virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*) = 0;
-    virtual KJS::Bindings::RootObject* bindingRootObject() = 0;
+    KJS::Bindings::Instance* createScriptInstanceForWidget(Widget*);
+    KJS::Bindings::RootObject* bindingRootObject();
+    
+    PassRefPtr<KJS::Bindings::RootObject> createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter>);
 
+#if PLATFORM(MAC)
+    WebScriptObject* windowScriptObject();
+#endif
+    NPObject* windowScriptNPObject();
+    
     void setDocument(Document*);
 
     KJSProxy* scriptProxy();
@@ -187,7 +227,7 @@ public:
     static void clearTimers(FrameView*);
 
     bool isActive() const;
-    virtual void setIsActive(bool flag);
+    void setIsActive(bool flag);
     void setWindowHasFocus(bool flag);
 
     // Convenience, to avoid repeating the code to dig down to get this.
@@ -199,25 +239,25 @@ public:
     bool prohibitsScrolling() const;
     void setProhibitsScrolling(const bool);
 
-protected:
-    virtual void cleanupPluginObjects() { }
-
 private:
-    void lifeSupportTimerFired(Timer<Frame>*);
+    void cleanupScriptObjects();
+    void cleanupPlatformScriptObjects();
 
+    void lifeSupportTimerFired(Timer<Frame>*);
+    
 // === to be moved into Chrome
 
 public:
-    virtual void focusWindow();
-    virtual void unfocusWindow();
-    virtual void print() = 0;
+    void focusWindow();
+    void unfocusWindow();
+    void print();
     bool shouldClose();
     void scheduleClose();
 
 // === to be moved into Editor
 
 public:
-    virtual String selectedText() const;  
+    String selectedText() const;  
     bool findString(const String&, bool forward, bool caseFlag, bool wrapFlag, bool startInSelection);
 
     const Selection& mark() const; // Mark, to be used as emacs uses it.
@@ -225,10 +265,6 @@ public:
 
     void transpose();
 
-    void copyToPasteboard();
-    void cutToPasteboard();
-    void pasteFromPasteboard();
-    void pasteAndMatchStyle();
     void computeAndSetTypingStyle(CSSStyleDeclaration* , EditAction = EditActionUnspecified);
     enum TriState { falseTriState, trueTriState, mixedTriState };
     TriState selectionHasStyle(CSSStyleDeclaration*) const;
@@ -238,14 +274,13 @@ public:
     void applyEditingStyleToElement(Element*) const;
     void removeEditingStyleFromElement(Element*) const;
 
-    virtual Range* markedTextRange() const = 0;
-    virtual void issueCutCommand() = 0;
-    virtual void issueCopyCommand() = 0;
-    virtual void issuePasteCommand() = 0;
-    virtual void issuePasteAndMatchStyleCommand() = 0;
-    virtual void issueTransposeCommand() = 0;
-    virtual void respondToChangedSelection(const Selection& oldSelection, bool closeTyping) = 0;
-    virtual bool shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity, bool stillSelecting) const = 0;
+    Range* markedTextRange() const;
+#if PLATFORM(MAC)
+    void issuePasteCommand();
+#endif
+    void issueTransposeCommand();
+    void respondToChangedSelection(const Selection& oldSelection, bool closeTyping);
+    bool shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity, bool stillSelecting) const;
 
     RenderStyle* styleForSelectionStart(Node*& nodeToRemove) const;
 
@@ -258,12 +293,12 @@ public:
 
     CSSComputedStyleDeclaration* selectionComputedStyle(Node*& nodeToRemove) const;
 
-    virtual void textFieldDidBeginEditing(Element*);
-    virtual void textFieldDidEndEditing(Element*);
-    virtual void textDidChangeInTextField(Element*);
-    virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
-    virtual void textWillBeDeletedInTextField(Element* input);
-    virtual void textDidChangeInTextArea(Element*);
+    void textFieldDidBeginEditing(Element*);
+    void textFieldDidEndEditing(Element*);
+    void textDidChangeInTextField(Element*);
+    bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*);
+    void textWillBeDeletedInTextField(Element* input);
+    void textDidChangeInTextArea(Element*);
 
 // === to be moved into SelectionController
 
@@ -272,7 +307,7 @@ public:
     void setSelectionGranularity(TextGranularity) const;
 
     bool shouldChangeSelection(const Selection&) const;
-    virtual bool shouldDeleteSelection(const Selection&) const;
+    bool shouldDeleteSelection(const Selection&) const;
     void clearCaretRectIfNeeded();
     void setFocusedNodeIfNeeded();
     void selectionLayoutChanged();
@@ -287,10 +322,10 @@ public:
     void setXPosForVerticalArrowNavigation(int);
     int xPosForVerticalArrowNavigation() const;
 
-    virtual bool isContentEditable() const; // if true, everything in frame is editable
+    bool isContentEditable() const; // if true, everything in frame is editable
 
-    virtual void setSecureKeyboardEntry(bool) { }
-    virtual bool isSecureKeyboardEntry() { return false; }
+    void setSecureKeyboardEntry(bool);
+    bool isSecureKeyboardEntry();
 
     CSSMutableStyleDeclaration* typingStyle() const;
     void setTypingStyle(CSSMutableStyleDeclaration*);
@@ -311,14 +346,52 @@ private:
 // === to be moved into the Platform directory
 
 public:
-    virtual String mimeTypeForFileName(const String&) const = 0;
-    virtual bool isCharacterSmartReplaceExempt(UChar, bool);
+    bool isCharacterSmartReplaceExempt(UChar, bool);
 
 // === to be deleted
 
 public:
     SelectionController* dragCaretController() const;
 
+    String searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
+    String searchForLabelsBeforeElement(const Vector<String>& labels, Element*);
+    String matchLabelsAgainstElement(const Vector<String>& labels, Element*);
+
+#if PLATFORM(MAC)
+// === undecided, may or may not belong here
+
+public:
+    NSString* searchForNSLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
+    NSString* searchForLabelsBeforeElement(NSArray* labels, Element*);
+    NSString* matchLabelsAgainstElement(NSArray* labels, Element*);
+
+    NSMutableDictionary* dashboardRegionsDictionary();
+    void dashboardRegionsChanged();
+
+    void willPopupMenu(NSMenu*);
+
+    NSImage* selectionImage(bool forceWhiteText = false) const;
+    NSImage* snapshotDragImage(Node*, NSRect* imageRect, NSRect* elementRect) const;
+
+private:    
+    NSImage* imageFromRect(NSRect) const;
+
+// === to be moved into Chrome
+
+public:
+
+    FloatRect customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect);
+    void paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line);
+
+// === to be moved into Editor
+
+public:
+
+    NSDictionary* fontAttributesForSelectionStart() const;
+    NSWritingDirection baseWritingDirectionForSelectionStart() const;
+
+    void setMarkedTextRange(const Range* , NSArray* attributes, NSArray* ranges);
+#endif
 };
 
 } // namespace WebCore
index 66ff2eb5c4f3f81c9577771cda46bc17a96974f3..ba2b064a5de8243ab65d8c17e6ca7323d8d5ac50 100644 (file)
@@ -7,6 +7,7 @@
  *                     2000-2001 Dirk Mueller <mueller@kde.org>
  *                     2000 Stefan Schimanski <1Stein@gmx.de>
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Library General Public
 #include "Editor.h"
 #include "EventHandler.h"
 #include "FrameTree.h"
+#include "Range.h"
 #include "SelectionController.h"
 #include "StringHash.h"
 
+namespace KJS {
+    class Interpreter;
+        
+    namespace Bindings {
+        class Instance;
+        class RootObject;
+    }
+}
+
+#if PLATFORM(MAC)
+#ifdef __OBJC__
+@class WebCoreFrameBridge;
+@class WebScriptObject;
+#else
+class WebCoreFrameBridge;
+class WebScriptObject;
+#endif
+#endif
+
+#if PLATFORM(WIN)
+#include "FrameWin.h"
+#endif
+
 namespace WebCore {
 
     class UserStyleSheetLoader;
@@ -79,6 +104,7 @@ namespace WebCore {
         Timer<Frame> m_lifeSupportTimer;
 
         FrameLoader* m_loader;
+        
         UserStyleSheetLoader* m_userStyleSheetLoader;
         
         RefPtr<Node> m_elementToDraw;
@@ -94,6 +120,17 @@ namespace WebCore {
         unsigned frameCount;
 
         bool m_prohibitsScrolling;
+
+        RefPtr<Range> m_markedTextRange;
+
+        // The root object used for objects bound outside the context of a plugin.
+        RefPtr<KJS::Bindings::RootObject> m_bindingRootObject; 
+        Vector<RefPtr<KJS::Bindings::RootObject> > m_rootObjects;
+        NPObject* m_windowScriptNPObject;
+#if PLATFORM(MAC)
+        WebScriptObject* m_windowScriptObject;
+        WebCoreFrameBridge* m_bridge;
+#endif
     };
 }
 
index 41f4860783b5332d68b4f7a5b772d0156bdd2e9e..7944fa7165935bb7a54831d1cf780a0f08a0c5a7 100644 (file)
@@ -72,8 +72,6 @@ public:
     virtual void setHScrollbarMode(ScrollbarMode);
     virtual void setScrollbarsMode(ScrollbarMode);
     
-    void print();
-
     void layout(bool allowSubtree = true);
     bool didFirstLayout() const;
     void layoutTimerFired(Timer<FrameView>*);
index e45867514439377e11012753a7220f5a2eb17999..9ca4f0c5cd90d202781b1d9b2ac077a3a848c0a8 100644 (file)
@@ -36,7 +36,7 @@
 #include "FocusController.h"
 #include "FoundationExtras.h"
 #include "FrameLoader.h"
-#include "FrameMac.h"
+#include "Frame.h"
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "HTMLFrameOwnerElement.h"
@@ -92,24 +92,22 @@ PassRefPtr<KeyboardEvent> EventHandler::currentKeyboardEvent() const
     }
 }
 
-static bool isKeyboardOptionTab(KeyboardEvent* event)
+static inline bool isKeyboardOptionTab(KeyboardEvent* event)
 {
     return event
-        && (event->type() == keydownEvent || event->type() == keypressEvent)
-        && event->altKey()
-        && event->keyIdentifier() == "U+000009";
+    && (event->type() == keydownEvent || event->type() == keypressEvent)
+    && event->altKey()
+    && event->keyIdentifier() == "U+000009";    
 }
 
-bool EventHandler::tabsToLinks(KeyboardEvent* event) const
+bool EventHandler::invertSenseOfTabsToLinks(KeyboardEvent* event) const
 {
-    if ([Mac(m_frame)->bridge() keyboardUIMode] & KeyboardAccessTabsToLinks)
-        return !isKeyboardOptionTab(event);
     return isKeyboardOptionTab(event);
 }
 
 bool EventHandler::tabsToAllControls(KeyboardEvent* event) const
 {
-    KeyboardUIMode keyboardUIMode = [Mac(m_frame)->bridge() keyboardUIMode];
+    KeyboardUIMode keyboardUIMode = [m_frame->bridge() keyboardUIMode];
     bool handlingOptionTab = isKeyboardOptionTab(event);
 
     // If tab-to-links is off, option-tab always highlights all controls
@@ -154,8 +152,8 @@ void EventHandler::focusDocumentView()
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     NSView *view = m_frame->view()->getDocumentView();
-    if ([Mac(m_frame)->bridge() firstResponder] != view)
-        [Mac(m_frame)->bridge() makeFirstResponder:view];
+    if ([m_frame->bridge() firstResponder] != view)
+        [m_frame->bridge() makeFirstResponder:view];
     END_BLOCK_OBJC_EXCEPTIONS;
     if (Page* page = m_frame->page())
         page->focusController()->setFocusedFrame(m_frame);
@@ -217,7 +215,7 @@ bool EventHandler::passMouseDownEventToWidget(Widget* widget)
         // We probably hit the border of a RenderWidget
         return true;
     
-    if ([Mac(m_frame)->bridge() firstResponder] == view) {
+    if ([m_frame->bridge() firstResponder] == view) {
         // In the case where we just became first responder, we should send the mouseDown:
         // to the NSTextField, not the NSTextField's editor. This code makes sure that happens.
         // If we don't do this, we see a flash of selected text when clicking in a text field.
@@ -225,7 +223,7 @@ bool EventHandler::passMouseDownEventToWidget(Widget* widget)
         // eliminate all use of NSTextField/NSTextView in form fields we can eliminate this code,
         // and textViewWasFirstResponderAtMouseDownTime:, and the instance variable WebHTMLView
         // keeps solely to support textViewWasFirstResponderAtMouseDownTime:.
-        if ([view isKindOfClass:[NSTextView class]] && ![Mac(m_frame)->bridge() textViewWasFirstResponderAtMouseDownTime:(NSTextView *)view]) {
+        if ([view isKindOfClass:[NSTextView class]] && ![m_frame->bridge() textViewWasFirstResponderAtMouseDownTime:(NSTextView *)view]) {
             NSView *superview = view;
             while (superview != nodeView) {
                 superview = [superview superview];
@@ -242,7 +240,7 @@ bool EventHandler::passMouseDownEventToWidget(Widget* widget)
         // Normally [NSWindow sendEvent:] handles setting the first responder.
         // But in our case, the event was sent to the view representing the entire web page.
         if ([currentEvent clickCount] <= 1 && [view acceptsFirstResponder] && [view needsPanelToBecomeKey]) {
-            [Mac(m_frame)->bridge() makeFirstResponder:view];
+            [m_frame->bridge() makeFirstResponder:view];
         }
     }
 
@@ -347,7 +345,7 @@ Clipboard* EventHandler::createDraggingClipboard() const
     // Must be done before ondragstart adds types and data to the pboard,
     // also done for security, as it erases data from the last drag
     [pasteboard declareTypes:[NSArray array] owner:nil];
-    return new ClipboardMac(true, pasteboard, ClipboardWritable, Mac(m_frame));
+    return new ClipboardMac(true, pasteboard, ClipboardWritable, m_frame);
 }
     
 bool EventHandler::eventLoopHandleMouseUp(const MouseEventWithHitTestResults&)
@@ -572,7 +570,7 @@ void EventHandler::sendFakeEventsAfterWidgetTracking(NSEvent *initiatingEvent)
         // them in Cocoa, and because the event stream was stolen by the Carbon menu code we have
         // no up-to-date cache of them anywhere.
         fakeEvent = [NSEvent mouseEventWithType:NSMouseMoved
-                                       location:[[Mac(m_frame)->bridge() window] convertScreenToBase:[NSEvent mouseLocation]]
+                                       location:[[m_frame->bridge() window] convertScreenToBase:[NSEvent mouseLocation]]
                                   modifierFlags:[initiatingEvent modifierFlags]
                                       timestamp:[initiatingEvent timestamp]
                                    windowNumber:[initiatingEvent windowNumber]
diff --git a/WebCore/page/mac/FrameMac.h b/WebCore/page/mac/FrameMac.h
deleted file mode 100644 (file)
index ab55c36..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * Copyright (C) 2004, 2005, 2006 Apple Computer, 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. 
- */
-
-#ifndef FrameMac_h
-#define FrameMac_h
-
-#import "Frame.h"
-
-class NPObject;
-
-namespace KJS {
-    class Interpreter;
-        
-    namespace Bindings {
-        class Instance;
-        class RootObject;
-    }
-}
-
-#ifdef __OBJC__
-
-@class NSArray;
-@class NSDictionary;
-@class NSFont;
-@class NSImage;
-@class NSMenu;
-@class NSMutableDictionary;
-@class NSString;
-@class WebCoreFrameBridge;
-@class WebScriptObject;
-
-#else
-
-class NSArray;
-class NSDictionary;
-class NSFont;
-class NSImage;
-class NSMenu;
-class NSMutableDictionary;
-class NSString;
-class WebCoreFrameBridge;
-class WebScriptObject;
-
-typedef unsigned int NSDragOperation;
-typedef int NSWritingDirection;
-
-#endif
-
-namespace WebCore {
-
-class HTMLTableCellElement;
-
-class FrameMac : public Frame {
-    friend class Frame;
-
-public:
-    FrameMac(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
-    ~FrameMac();
-
-    void setBridge(WebCoreFrameBridge*);
-    WebCoreFrameBridge* bridge() const { return _bridge; }
-
-private:    
-    WebCoreFrameBridge* _bridge;
-
-// === undecided, may or may not belong here
-
-public:
-    NSString* searchForLabelsAboveCell(RegularExpression*, HTMLTableCellElement*);
-    NSString* searchForLabelsBeforeElement(NSArray* labels, Element*);
-    NSString* matchLabelsAgainstElement(NSArray* labels, Element*);
-
-    virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*);
-    virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
-    virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
-    virtual KJS::Bindings::RootObject* bindingRootObject();
-
-    PassRefPtr<KJS::Bindings::RootObject> createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter>);
-
-    KJS::Bindings::RootObject* rootObjectForDOM();
-    
-    WebScriptObject* windowScriptObject();
-    NPObject* windowScriptNPObject();
-    
-    NSMutableDictionary* dashboardRegionsDictionary();
-    void dashboardRegionsChanged();
-
-    void willPopupMenu(NSMenu *);
-
-    void cleanupPluginObjects();
-
-    NSImage* selectionImage(bool forceWhiteText = false) const;
-    NSImage* snapshotDragImage(Node*, NSRect* imageRect, NSRect* elementRect) const;
-
-private:    
-    NSImage* imageFromRect(NSRect) const;
-
-    RefPtr<KJS::Bindings::RootObject> _bindingRootObject; // The root object used for objects bound outside the context of a plugin.
-    Vector<RefPtr<KJS::Bindings::RootObject> > m_rootObjects;
-    WebScriptObject* _windowScriptObject;
-    NPObject* _windowScriptNPObject;
-
-// === to be moved into Chrome
-
-public:
-    virtual void focusWindow();
-    virtual void unfocusWindow();
-
-    FloatRect customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect);
-    void paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line);
-
-    virtual void print();
-
-// === to be moved into Editor
-
-public:
-
-    NSDictionary* fontAttributesForSelectionStart() const;
-    
-    NSWritingDirection baseWritingDirectionForSelectionStart() const;
-
-    virtual void issueCutCommand();
-    virtual void issueCopyCommand();
-    virtual void issuePasteCommand();
-    virtual void issuePasteAndMatchStyleCommand();
-    virtual void issueTransposeCommand();
-    virtual void respondToChangedSelection(const Selection& oldSelection, bool closeTyping);
-    virtual bool isContentEditable() const;
-    virtual bool shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity affinity, bool stillSelecting) const;
-    virtual bool shouldDeleteSelection(const Selection&) const;
-    
-    virtual void setSecureKeyboardEntry(bool);
-    virtual bool isSecureKeyboardEntry();
-
-    void setMarkedTextRange(const Range* , NSArray* attributes, NSArray* ranges);
-    virtual Range* markedTextRange() const { return m_markedTextRange.get(); }
-
-    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*);
-    
-private:
-    RefPtr<Range> m_markedTextRange;
-    
-// === to be moved into the Platform directory
-
-public:
-    virtual String mimeTypeForFileName(const String&) const;
-    virtual bool isCharacterSmartReplaceExempt(UChar, bool);
-    
-};
-
-inline FrameMac* Mac(Frame* frame) { return static_cast<FrameMac*>(frame); }
-inline const FrameMac* Mac(const Frame* frame) { return static_cast<const FrameMac*>(frame); }
-
-}
-
-#endif
index 7e4a9e49b8fa01af1195333c4c2c3c825b7809ee..22f5fd9183802f6cca6cf289d067ca5ab63a6727 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2004, 2005, 2006 Apple Computer, Inc.  All rights reserved.
  * Copyright (C) 2006 Alexey Proskuryakov (ap@nypop.com)
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,7 +26,7 @@
  */
 
 #import "config.h"
-#import "FrameMac.h"
+#import "Frame.h"
 
 #import "AXObjectCache.h"
 #import "BeforeUnloadEvent.h"
@@ -97,7 +98,7 @@
 - (id)objectForWebScript;
 - (NPObject *)createPluginScriptableObject;
 @end
-
 using namespace std;
 using namespace KJS::Bindings;
 
@@ -108,51 +109,30 @@ namespace WebCore {
 using namespace EventNames;
 using namespace HTMLNames;
 
-static SEL selectorForKeyEvent(KeyboardEvent* event)
-{
-    // FIXME: This helper function is for the auto-fill code so the bridge can pass a selector to the form delegate.  
-    // Eventually, we should move all of the auto-fill code down to WebKit and remove the need for this function by
-    // not relying on the selector in the new implementation.
-    String key = event->keyIdentifier();
-    if (key == "Up")
-        return @selector(moveUp:);
-    if (key == "Down")
-        return @selector(moveDown:);
-    if (key == "U+00001B")
-        return @selector(cancel:);
-    if (key == "U+000009") {
-        if (event->shiftKey())
-            return @selector(insertBacktab:);
-        return @selector(insertTab:);
-    }
-    if (key == "Enter")
-        return @selector(insertNewline:);
-    return 0;
-}
+void Frame::setBridge(WebCoreFrameBridge* bridge)
+{ 
+    if (d->m_bridge == bridge)
+        return;
 
-FrameMac::FrameMac(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient)
-    : Frame(page, ownerElement, frameLoaderClient)
-    , _bridge(nil)
-    , _windowScriptObject(0)
-    , _windowScriptNPObject(0)
-{
+    if (!bridge) {
+        [d->m_bridge clearFrame];
+        HardRelease(d->m_bridge);
+        d->m_bridge = nil;
+        return;
+    }
+    HardRetain(bridge);
+    HardRelease(d->m_bridge);
+    d->m_bridge = bridge;
 }
 
-FrameMac::~FrameMac()
+WebCoreFrameBridge* Frame::bridge() const
 {
-    setView(0);
-    loader()->clearRecordedFormValues();    
-    
-    [_bridge clearFrame];
-    HardRelease(_bridge);
-    _bridge = nil;
-
-    loader()->cancelAndClear();
+    return d->m_bridge;
 }
 
 // Either get cached regexp or build one that matches any of the labels.
 // The regexp we build is of the form:  (STR1|STR2|STRN)
-RegularExpression *regExpForLabels(NSArray *labels)
+RegularExpression* regExpForLabels(NSArray* labels)
 {
     // All the ObjC calls in this method are simple array and string
     // calls which we can assume do not raise exceptions
@@ -161,11 +141,11 @@ RegularExpression *regExpForLabels(NSArray *labels)
     // Parallel arrays that we use to cache regExps.  In practice the number of expressions
     // that the app will use is equal to the number of locales is used in searching.
     static const unsigned int regExpCacheSize = 4;
-    static NSMutableArray *regExpLabels = nil;
+    static NSMutableArrayregExpLabels = nil;
     static Vector<RegularExpression*> regExps;
     static RegularExpression wordRegExp = RegularExpression("\\w");
 
-    RegularExpression *result;
+    RegularExpressionresult;
     if (!regExpLabels)
         regExpLabels = [[NSMutableArray alloc] initWithCapacity:regExpCacheSize];
     CFIndex cacheHit = [regExpLabels indexOfObject:labels];
@@ -176,7 +156,7 @@ RegularExpression *regExpForLabels(NSArray *labels)
         unsigned int numLabels = [labels count];
         unsigned int i;
         for (i = 0; i < numLabels; i++) {
-            DeprecatedString label = DeprecatedString::fromNSString((NSString *)[labels objectAtIndex:i]);
+            DeprecatedString label = DeprecatedString::fromNSString((NSString*)[labels objectAtIndex:i]);
 
             bool startsWithWordChar = false;
             bool endsWithWordChar = false;
@@ -215,7 +195,7 @@ RegularExpression *regExpForLabels(NSArray *labels)
         // trim if too big
         if ([regExpLabels count] > regExpCacheSize) {
             [regExpLabels removeObjectAtIndex:regExpCacheSize];
-            RegularExpression *last = regExps.last();
+            RegularExpressionlast = regExps.last();
             regExps.removeLast();
             delete last;
         }
@@ -223,7 +203,7 @@ RegularExpression *regExpForLabels(NSArray *labels)
     return result;
 }
 
-NSString* FrameMac::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
+NSString* Frame::searchForNSLabelsAboveCell(RegularExpression* regExp, HTMLTableCellElement* cell)
 {
     RenderTableCell* cellRenderer = static_cast<RenderTableCell*>(cell->renderer());
 
@@ -231,12 +211,12 @@ NSString* FrameMac::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTabl
         RenderTableCell* cellAboveRenderer = cellRenderer->table()->cellAbove(cellRenderer);
 
         if (cellAboveRenderer) {
-            HTMLTableCellElement *aboveCell =
+            HTMLTableCellElementaboveCell =
                 static_cast<HTMLTableCellElement*>(cellAboveRenderer->element());
 
             if (aboveCell) {
                 // search within the above cell we found for a match
-                for (Node *n = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
+                for (Noden = aboveCell->firstChild(); n; n = n->traverseNextNode(aboveCell)) {
                     if (n->isTextNode() && n->renderer() && n->renderer()->style()->visibility() == VISIBLE) {
                         // For each text chunk, run the regexp
                         DeprecatedString nodeString = n->nodeValue().deprecatedString();
@@ -252,21 +232,21 @@ NSString* FrameMac::searchForLabelsAboveCell(RegularExpression* regExp, HTMLTabl
     return nil;
 }
 
-NSString *FrameMac::searchForLabelsBeforeElement(NSArray *labels, Element *element)
+NSString* Frame::searchForLabelsBeforeElement(NSArray* labels, Element* element)
 {
-    RegularExpression *regExp = regExpForLabels(labels);
+    RegularExpressionregExp = regExpForLabels(labels);
     // We stop searching after we've seen this many chars
     const unsigned int charsSearchedThreshold = 500;
     // This is the absolute max we search.  We allow a little more slop than
     // charsSearchedThreshold, to make it more likely that we'll search whole nodes.
     const unsigned int maxCharsSearched = 600;
     // If the starting element is within a table, the cell that contains it
-    HTMLTableCellElement *startingTableCell = 0;
+    HTMLTableCellElementstartingTableCell = 0;
     bool searchedCellAbove = false;
 
     // walk backwards in the node tree, until another element, or form, or end of tree
     int unsigned lengthSearched = 0;
-    Node *n;
+    Noden;
     for (n = element->traversePreviousNode();
          n && lengthSearched < charsSearchedThreshold;
          n = n->traversePreviousNode())
@@ -280,7 +260,7 @@ NSString *FrameMac::searchForLabelsBeforeElement(NSArray *labels, Element *eleme
         } else if (n->hasTagName(tdTag) && !startingTableCell) {
             startingTableCell = static_cast<HTMLTableCellElement*>(n);
         } else if (n->hasTagName(trTag) && startingTableCell) {
-            NSString *result = searchForLabelsAboveCell(regExp, startingTableCell);
+            NSStringresult = searchForLabelsAboveCell(regExp, startingTableCell);
             if (result) {
                 return result;
             }
@@ -308,14 +288,14 @@ NSString *FrameMac::searchForLabelsBeforeElement(NSArray *labels, Element *eleme
     }
 }
 
-NSString *FrameMac::matchLabelsAgainstElement(NSArray *labels, Element *element)
+NSString* Frame::matchLabelsAgainstElement(NSArray* labels, Element* element)
 {
     DeprecatedString name = element->getAttribute(nameAttr).deprecatedString();
     // Make numbers and _'s in field names behave like word boundaries, e.g., "address2"
     name.replace(RegularExpression("[[:digit:]]"), " ");
     name.replace('_', ' ');
     
-    RegularExpression *regExp = regExpForLabels(labels);
+    RegularExpressionregExp = regExpForLabels(labels);
     // Use the largest match we can find in the whole name string
     int pos;
     int length;
@@ -339,112 +319,13 @@ NSString *FrameMac::matchLabelsAgainstElement(NSArray *labels, Element *element)
     return nil;
 }
 
-void FrameMac::focusWindow()
-{
-    Frame::focusWindow();
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
-    // Might not have a view yet: this could be a child frame that has not yet received its first byte of data.
-    // FIXME: Should remember that the frame needs focus.  See <rdar://problem/4645685>.
-    if (d->m_view) {
-        NSView *view = d->m_view->getDocumentView();
-        if ([_bridge firstResponder] != view)
-            [_bridge makeFirstResponder:view];
-    }
-
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void FrameMac::unfocusWindow()
-{
-    Frame::unfocusWindow();
-
-    // Might not have a view yet: this could be a child frame that has not yet received its first byte of data.
-    // FIXME: Should remember that the frame needs to unfocus.  See <rdar://problem/4645685>.
-    if (!d->m_view)
-        return;
-
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    NSView *view = d->m_view->getDocumentView();
-    if ([_bridge firstResponder] == view) {
-        if (tree()->parent()) {
-            // If we're not the top level window, we want to shift focus to our parent.
-            FrameMac* parentFrame = static_cast<FrameMac*>(tree()->parent());
-            NSView* parentView = parentFrame->d->m_view->getDocumentView();
-            [parentFrame->_bridge makeFirstResponder:parentView];
-        }
-    }
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-    
-String FrameMac::mimeTypeForFileName(const String& fileName) const
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    return [_bridge MIMETypeForPath:fileName];
-    END_BLOCK_OBJC_EXCEPTIONS;
-
-    return String();
-}
-
-RootObject* FrameMac::rootObjectForDOM()
+NSImage* Frame::imageFromRect(NSRect rect) const
 {
-    if (!settings()->isJavaScriptEnabled())
-        return 0;
-
-    return bindingRootObject();
-}
-
-RootObject* FrameMac::bindingRootObject()
-{
-    ASSERT(settings()->isJavaScriptEnabled());
-    if (!_bindingRootObject) {
-        JSLock lock;
-        _bindingRootObject = RootObject::create(0, scriptProxy()->interpreter());
-    }
-    return _bindingRootObject.get();
-}
-
-WebScriptObject *FrameMac::windowScriptObject()
-{
-    if (!settings()->isJavaScriptEnabled())
-        return 0;
-
-    if (!_windowScriptObject) {
-        KJS::JSLock lock;
-        KJS::JSObject *win = KJS::Window::retrieveWindow(this);
-        _windowScriptObject = HardRetainWithNSRelease([[WebScriptObject alloc] _initWithJSObject:win originRootObject:bindingRootObject() rootObject:bindingRootObject()]);
-    }
-
-    return _windowScriptObject;
-}
-
-NPObject *FrameMac::windowScriptNPObject()
-{
-    if (!_windowScriptNPObject) {
-        if (settings()->isJavaScriptEnabled()) {
-            // JavaScript is enabled, so there is a JavaScript window object.  Return an NPObject bound to the window
-            // object.
-            KJS::JSObject *win = KJS::Window::retrieveWindow(this);
-            assert(win);
-            _windowScriptNPObject = _NPN_CreateScriptObject(0, win, bindingRootObject(), bindingRootObject());
-        } else {
-            // JavaScript is not enabled, so we cannot bind the NPObject to the JavaScript window object.
-            // Instead, we create an NPObject of a different class, one which is not bound to a JavaScript object.
-            _windowScriptNPObject = _NPN_CreateNoScriptObject();
-        }
-    }
-
-    return _windowScriptNPObject;
-}
-
-NSImage *FrameMac::imageFromRect(NSRect rect) const
-{
-    NSView *view = d->m_view->getDocumentView();
+    NSView* view = d->m_view->getDocumentView();
     if (!view)
         return nil;
     
-    NSImage *resultImage;
+    NSImageresultImage;
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
     
     NSRect bounds = [view bounds];
@@ -478,17 +359,17 @@ NSImage *FrameMac::imageFromRect(NSRect rect) const
     return nil;
 }
 
-NSImage* FrameMac::selectionImage(bool forceWhiteText) const
+NSImage* Frame::selectionImage(bool forceWhiteText) const
 {
     d->m_paintRestriction = forceWhiteText ? PaintRestrictionSelectionOnlyWhiteText : PaintRestrictionSelectionOnly;
-    NSImage *result = imageFromRect(visibleSelectionRect());
+    NSImageresult = imageFromRect(visibleSelectionRect());
     d->m_paintRestriction = PaintRestrictionNone;
     return result;
 }
 
-NSImage *FrameMac::snapshotDragImage(Node *node, NSRect *imageRect, NSRect *elementRect) const
+NSImage* Frame::snapshotDragImage(Node* node, NSRect* imageRect, NSRect* elementRect) const
 {
-    RenderObject *renderer = node->renderer();
+    RenderObjectrenderer = node->renderer();
     if (!renderer)
         return nil;
     
@@ -499,7 +380,7 @@ NSImage *FrameMac::snapshotDragImage(Node *node, NSRect *imageRect, NSRect *elem
     NSRect paintingRect = renderer->paintingRootRect(topLevelRect);
 
     d->m_elementToDraw = node;              // invoke special sub-tree drawing mode
-    NSImage *result = imageFromRect(paintingRect);
+    NSImageresult = imageFromRect(paintingRect);
     renderer->updateDragState(false);
     d->m_doc->updateLayout();
     d->m_elementToDraw = 0;
@@ -511,14 +392,14 @@ NSImage *FrameMac::snapshotDragImage(Node *node, NSRect *imageRect, NSRect *elem
     return result;
 }
 
-NSDictionary *FrameMac::fontAttributesForSelectionStart() const
+NSDictionary* Frame::fontAttributesForSelectionStart() const
 {
-    Node *nodeToRemove;
-    RenderStyle *style = styleForSelectionStart(nodeToRemove);
+    NodenodeToRemove;
+    RenderStylestyle = styleForSelectionStart(nodeToRemove);
     if (!style)
         return nil;
 
-    NSMutableDictionary *result = [NSMutableDictionary dictionary];
+    NSMutableDictionaryresult = [NSMutableDictionary dictionary];
 
     if (style->backgroundColor().isValid() && style->backgroundColor().alpha() != 0)
         [result setObject:nsColor(style->backgroundColor()) forKey:NSBackgroundColorAttributeName];
@@ -529,9 +410,9 @@ NSDictionary *FrameMac::fontAttributesForSelectionStart() const
     if (style->color().isValid() && style->color() != Color::black)
         [result setObject:nsColor(style->color()) forKey:NSForegroundColorAttributeName];
 
-    ShadowData *shadow = style->textShadow();
+    ShadowDatashadow = style->textShadow();
     if (shadow) {
-        NSShadow *s = [[NSShadow alloc] init];
+        NSShadows = [[NSShadow alloc] init];
         [s setShadowOffset:NSMakeSize(shadow->x, shadow->y)];
         [s setShadowBlurRadius:shadow->blur];
         [s setShadowColor:nsColor(shadow->color)];
@@ -575,15 +456,15 @@ NSDictionary *FrameMac::fontAttributesForSelectionStart() const
     return result;
 }
 
-NSWritingDirection FrameMac::baseWritingDirectionForSelectionStart() const
+NSWritingDirection Frame::baseWritingDirectionForSelectionStart() const
 {
     NSWritingDirection result = NSWritingDirectionLeftToRight;
 
     Position pos = selectionController()->selection().visibleStart().deepEquivalent();
-    Node *node = pos.node();
+    Nodenode = pos.node();
     if (!node || !node->renderer() || !node->renderer()->containingBlock())
         return result;
-    RenderStyle *style = node->renderer()->containingBlock()->style();
+    RenderStylestyle = node->renderer()->containingBlock()->style();
     if (!style)
         return result;
         
@@ -599,144 +480,22 @@ NSWritingDirection FrameMac::baseWritingDirectionForSelectionStart() const
     return result;
 }
 
-void FrameMac::setBridge(WebCoreFrameBridge *bridge)
-{ 
-    if (_bridge == bridge)
-        return;
-
-    HardRetain(bridge);
-    HardRelease(_bridge);
-    _bridge = bridge;
-}
-
-void FrameMac::print()
-{
-    [Mac(this)->_bridge print];
-}
-
-Instance* FrameMac::getAppletInstanceForWidget(Widget* widget)
-{
-    NSView *aView = widget->getView();
-    if (!aView)
-        return 0;
-    jobject applet;
-    
-    // Get a pointer to the actual Java applet instance.
-    if ([_bridge respondsToSelector:@selector(getAppletInView:)])
-        applet = [_bridge getAppletInView:aView];
-    else
-        applet = [_bridge pollForAppletInView:aView];
-    
-    if (applet) {
-        // Wrap the Java instance in a language neutral binding and hand
-        // off ownership to the APPLET element.
-        void* nativeHandle = aView;
-        CreateRootObjectFunction createRootObject = RootObject::createRootObject();
-        RefPtr<RootObject> rootObject = createRootObject(nativeHandle);
-        Instance* instance = Instance::createBindingForLanguageInstance(Instance::JavaLanguage, applet, rootObject.release());
-        return instance;
-    }
-    
-    return 0;
-}
-
-static Instance* getPluginInstanceForWidget(Widget* widget)
-{
-    NSView *aView = widget->getView();
-    if (!aView)
-        return 0;
-
-    void* nativeHandle = aView;
-    CreateRootObjectFunction createRootObject = RootObject::createRootObject();
-    RefPtr<RootObject> rootObject = createRootObject(nativeHandle);
-
-    if ([aView respondsToSelector:@selector(objectForWebScript)]) {
-        id objectForWebScript = [aView objectForWebScript];
-        if (objectForWebScript)
-            return Instance::createBindingForLanguageInstance(Instance::ObjectiveCLanguage, objectForWebScript, rootObject.release());
-    } else if ([aView respondsToSelector:@selector(createPluginScriptableObject)]) {
-        NPObject* npObject = [aView createPluginScriptableObject];
-        if (npObject) {
-            Instance* instance = Instance::createBindingForLanguageInstance(Instance::CLanguage, npObject, rootObject.release());
-
-            // -createPluginScriptableObject returns a retained NPObject.  The caller is expected to release it.
-            _NPN_ReleaseObject(npObject);
-            return instance;
-        }
-    }
-
-    return 0;
-}
-
-Instance* FrameMac::getEmbedInstanceForWidget(Widget* widget)
+void Frame::print()
 {
-    return getPluginInstanceForWidget(widget);
+    [d->m_bridge print];
 }
 
-Instance* FrameMac::getObjectInstanceForWidget(Widget* widget)
+void Frame::issuePasteCommand()
 {
-    return getPluginInstanceForWidget(widget);
+    [d->m_bridge issuePasteCommand];
 }
 
-PassRefPtr<RootObject> FrameMac::createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter> interpreter)
+void Frame::issueTransposeCommand()
 {
-    RefPtr<RootObject> rootObject = RootObject::create(nativeHandle, interpreter);
-    m_rootObjects.append(rootObject);
-    return rootObject.release();
+    [d->m_bridge issueTransposeCommand];
 }
 
-void FrameMac::cleanupPluginObjects()
-{
-    JSLock lock;
-    
-    unsigned count = m_rootObjects.size();
-    for (unsigned i = 0; i < count; i++)
-        m_rootObjects[i]->invalidate();
-    m_rootObjects.clear();
-
-    if (_bindingRootObject) {
-        _bindingRootObject->invalidate();
-        _bindingRootObject = 0;
-    }
-
-    HardRelease(_windowScriptObject);
-    _windowScriptObject = 0;
-    
-    if (_windowScriptNPObject) {
-        // Call _NPN_DeallocateObject() instead of _NPN_ReleaseObject() so that we don't leak if a plugin fails to release the window
-        // script object properly.
-        // This shouldn't cause any problems for plugins since they should have already been stopped and destroyed at this point.
-        _NPN_DeallocateObject(_windowScriptNPObject);
-        _windowScriptNPObject = 0;
-    }
-}
-
-void FrameMac::issueCutCommand()
-{
-    [_bridge issueCutCommand];
-}
-
-void FrameMac::issueCopyCommand()
-{
-    [_bridge issueCopyCommand];
-}
-
-void FrameMac::issuePasteCommand()
-{
-    [_bridge issuePasteCommand];
-}
-
-void FrameMac::issuePasteAndMatchStyleCommand()
-{
-    [_bridge issuePasteAndMatchStyleCommand];
-}
-
-void FrameMac::issueTransposeCommand()
-{
-    [_bridge issueTransposeCommand];
-}
-
-void FrameMac::respondToChangedSelection(const Selection &oldSelection, bool closeTyping)
+void Frame::respondToChangedSelection(const Selection &oldSelection, bool closeTyping)
 {
     if (document()) {
         if (editor()->isContinuousSpellCheckingEnabled()) {
@@ -767,76 +526,11 @@ void FrameMac::respondToChangedSelection(const Selection &oldSelection, bool clo
         }
     }
     
-    [_bridge respondToChangedSelection];
-}
-
-bool FrameMac::shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity affinity, bool stillSelecting) const
-{
-    return [_bridge shouldChangeSelectedDOMRange:[DOMRange _rangeWith:oldSelection.toRange().get()]
-                                      toDOMRange:[DOMRange _rangeWith:newSelection.toRange().get()]
-                                        affinity:affinity
-                                  stillSelecting:stillSelecting];
-}
-
-bool FrameMac::shouldDeleteSelection(const Selection& selection) const
-{
-    return [_bridge shouldDeleteSelectedDOMRange:[DOMRange _rangeWith:selection.toRange().get()]];
-}
-
-bool FrameMac::isContentEditable() const
-{
-    return Frame::isContentEditable() || [_bridge isEditable];
-}
-
-void FrameMac::textFieldDidBeginEditing(Element* input)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge textFieldDidBeginEditing:(DOMHTMLInputElement *)[DOMElement _elementWith:input]];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void FrameMac::textFieldDidEndEditing(Element* input)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge textFieldDidEndEditing:(DOMHTMLInputElement *)[DOMElement _elementWith:input]];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void FrameMac::textDidChangeInTextField(Element* input)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge textDidChangeInTextField:(DOMHTMLInputElement *)[DOMElement _elementWith:input]];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-void FrameMac::textDidChangeInTextArea(Element* textarea)
-{
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge textDidChangeInTextArea:(DOMHTMLTextAreaElement *)[DOMElement _elementWith:textarea]];
-    END_BLOCK_OBJC_EXCEPTIONS;
-}
-
-bool FrameMac::doTextFieldCommandFromEvent(Element* input, KeyboardEvent* event)
-{
-    bool result = false;
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    SEL selector = selectorForKeyEvent(event);
-    if (selector)
-        result = [_bridge textField:(DOMHTMLInputElement *)[DOMElement _elementWith:input] doCommandBySelector:selector];
-    END_BLOCK_OBJC_EXCEPTIONS;
-    return result;
-}
-
-void FrameMac::textWillBeDeletedInTextField(Element* input)
-{
-    // We're using the deleteBackward selector for all deletion operations since the autofill code treats all deletions the same way.
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-    [_bridge textField:(DOMHTMLInputElement *)[DOMElement _elementWith:input] doCommandBySelector:@selector(deleteBackward:)];
-    END_BLOCK_OBJC_EXCEPTIONS;
+    [d->m_bridge respondToChangedSelection];
 }
 
 const short enableRomanKeyboardsOnly = -23;
-void FrameMac::setSecureKeyboardEntry(bool enable)
+void Frame::setSecureKeyboardEntry(bool enable)
 {
     if (enable) {
         EnableSecureEventInput();
@@ -852,12 +546,12 @@ void FrameMac::setSecureKeyboardEntry(bool enable)
     }
 }
 
-bool FrameMac::isSecureKeyboardEntry()
+bool Frame::isSecureKeyboardEntry()
 {
     return IsSecureEventInputEnabled();
 }
 
-static void convertAttributesToUnderlines(Vector<MarkedTextUnderline>& result, const Range *markedTextRange, NSArray *attributes, NSArray *ranges)
+static void convertAttributesToUnderlines(Vector<MarkedTextUnderline>& result, const Range* markedTextRange, NSArray* attributes, NSArray* ranges)
 {
     int exception = 0;
     int baseOffset = markedTextRange->startOffset(exception);
@@ -866,11 +560,11 @@ static void convertAttributesToUnderlines(Vector<MarkedTextUnderline>& result, c
     ASSERT([ranges count] == length);
 
     for (unsigned i = 0; i < length; i++) {
-        NSNumber *style = [[attributes objectAtIndex:i] objectForKey:NSUnderlineStyleAttributeName];
+        NSNumberstyle = [[attributes objectAtIndex:i] objectForKey:NSUnderlineStyleAttributeName];
         if (!style)
             continue;
         NSRange range = [[ranges objectAtIndex:i] rangeValue];
-        NSColor *color = [[attributes objectAtIndex:i] objectForKey:NSUnderlineColorAttributeName];
+        NSColorcolor = [[attributes objectAtIndex:i] objectForKey:NSUnderlineColorAttributeName];
         Color qColor = Color::black;
         if (color) {
             NSColor* deviceColor = [color colorUsingColorSpaceName:NSDeviceRGBColorSpace];
@@ -887,7 +581,7 @@ static void convertAttributesToUnderlines(Vector<MarkedTextUnderline>& result, c
     }
 }
 
-void FrameMac::setMarkedTextRange(const Range *range, NSArray *attributes, NSArray *ranges)
+void Frame::setMarkedTextRange(const Range* range, NSArray* attributes, NSArray* ranges)
 {
     int exception = 0;
 
@@ -902,21 +596,21 @@ void FrameMac::setMarkedTextRange(const Range *range, NSArray *attributes, NSArr
         convertAttributesToUnderlines(d->m_markedTextUnderlines, range, attributes, ranges);
     }
 
-    if (m_markedTextRange.get() && document() && m_markedTextRange->startContainer(exception)->renderer())
-        m_markedTextRange->startContainer(exception)->renderer()->repaint();
+    if (d->m_markedTextRange.get() && document() && d->m_markedTextRange->startContainer(exception)->renderer())
+        d->m_markedTextRange->startContainer(exception)->renderer()->repaint();
 
     if (range && range->collapsed(exception))
-        m_markedTextRange = 0;
+        d->m_markedTextRange = 0;
     else
-        m_markedTextRange = const_cast<Range*>(range);
+        d->m_markedTextRange = const_cast<Range*>(range);
 
-    if (m_markedTextRange.get() && document() && m_markedTextRange->startContainer(exception)->renderer())
-        m_markedTextRange->startContainer(exception)->renderer()->repaint();
+    if (d->m_markedTextRange.get() && document() && d->m_markedTextRange->startContainer(exception)->renderer())
+        d->m_markedTextRange->startContainer(exception)->renderer()->repaint();
 }
 
-NSMutableDictionary *FrameMac::dashboardRegionsDictionary()
+NSMutableDictionary* Frame::dashboardRegionsDictionary()
 {
-    Document *doc = document();
+    Documentdoc = document();
     if (!doc)
         return nil;
 
@@ -924,7 +618,7 @@ NSMutableDictionary *FrameMac::dashboardRegionsDictionary()
     size_t n = regions.size();
 
     // Convert the Vector<DashboardRegionValue> into a NSDictionary of WebDashboardRegions
-    NSMutableDictionary *webRegions = [NSMutableDictionary dictionaryWithCapacity:n];
+    NSMutableDictionarywebRegions = [NSMutableDictionary dictionaryWithCapacity:n];
     for (size_t i = 0; i < n; i++) {
         const DashboardRegionValue& region = regions[i];
 
@@ -952,42 +646,109 @@ NSMutableDictionary *FrameMac::dashboardRegionsDictionary()
     return webRegions;
 }
 
-void FrameMac::dashboardRegionsChanged()
+void Frame::dashboardRegionsChanged()
 {
     NSMutableDictionary *webRegions = dashboardRegionsDictionary();
-    [_bridge dashboardRegionsChanged:webRegions];
+    [d->m_bridge dashboardRegionsChanged:webRegions];
 }
 
-void FrameMac::willPopupMenu(NSMenu * menu)
+void Frame::willPopupMenu(NSMenu * menu)
 {
-    [_bridge willPopupMenu:menu];
+    [d->m_bridge willPopupMenu:menu];
 }
 
-bool FrameMac::isCharacterSmartReplaceExempt(UChar c, bool isPreviousChar)
+bool Frame::isCharacterSmartReplaceExempt(UChar c, bool isPreviousChar)
 {
-    return [_bridge isCharacterSmartReplaceExempt:c isPreviousCharacter:isPreviousChar];
+    return [d->m_bridge isCharacterSmartReplaceExempt:c isPreviousCharacter:isPreviousChar];
 }
 
 void Frame::setNeedsReapplyStyles()
 {
-    [Mac(this)->_bridge setNeedsReapplyStyles];
+    [d->m_bridge setNeedsReapplyStyles];
 }
 
-FloatRect FrameMac::customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect)
+FloatRect Frame::customHighlightLineRect(const AtomicString& type, const FloatRect& lineRect)
 {
-    return [_bridge customHighlightRect:type forLine:lineRect];
+    return [d->m_bridge customHighlightRect:type forLine:lineRect];
 }
 
-void FrameMac::paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line)
+void Frame::paintCustomHighlight(const AtomicString& type, const FloatRect& boxRect, const FloatRect& lineRect, bool text, bool line)
 {
-    [_bridge paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text entireLine:line];
+    [d->m_bridge paintCustomHighlight:type forBox:boxRect onLine:lineRect behindText:text entireLine:line];
 }
     
 DragImageRef Frame::dragImageForSelection() 
 {
     if (!selectionController()->isRange())
         return nil;
-    return static_cast<FrameMac*>(this)->selectionImage();
+    return selectionImage();
+}
+
+
+KJS::Bindings::Instance* Frame::createScriptInstanceForWidget(WebCore::Widget* widget)
+{
+    NSView* aView = widget->getView();
+    if (!aView)
+        return 0;
+
+    void* nativeHandle = aView;
+    CreateRootObjectFunction createRootObject = RootObject::createRootObject();
+    RefPtr<RootObject> rootObject = createRootObject(nativeHandle);
+
+    if ([aView respondsToSelector:@selector(objectForWebScript)]) {
+        id objectForWebScript = [aView objectForWebScript];
+        if (objectForWebScript)
+            return Instance::createBindingForLanguageInstance(Instance::ObjectiveCLanguage, objectForWebScript, rootObject.release());
+        return 0;
+    } else if ([aView respondsToSelector:@selector(createPluginScriptableObject)]) {
+        NPObject* npObject = [aView createPluginScriptableObject];
+        if (npObject) {
+            Instance* instance = Instance::createBindingForLanguageInstance(Instance::CLanguage, npObject, rootObject.release());
+
+            // -createPluginScriptableObject returns a retained NPObject.  The caller is expected to release it.
+            _NPN_ReleaseObject(npObject);
+            return instance;
+        }
+        return 0;
+    }
+
+    jobject applet;
+    
+    // Get a pointer to the actual Java applet instance.
+    if ([d->m_bridge respondsToSelector:@selector(getAppletInView:)])
+        applet = [d->m_bridge getAppletInView:aView];
+    else
+        applet = [d->m_bridge pollForAppletInView:aView];
+    
+    if (applet) {
+        // Wrap the Java instance in a language neutral binding and hand
+        // off ownership to the APPLET element.
+        Instance* instance = Instance::createBindingForLanguageInstance(Instance::JavaLanguage, applet, rootObject.release());
+        return instance;
+    }
+    
+    return 0;
+}
+
+WebScriptObject* Frame::windowScriptObject()
+{
+    if (!d->m_settings->isJavaScriptEnabled())
+        return 0;
+
+    if (!d->m_windowScriptObject) {
+        KJS::JSLock lock;
+        KJS::JSObject* win = KJS::Window::retrieveWindow(this);
+        KJS::Bindings::RootObject *root = bindingRootObject();
+        d->m_windowScriptObject = HardRetainWithNSRelease([[WebScriptObject alloc] _initWithJSObject:win originRootObject:root rootObject:root]);
+    }
+
+    return d->m_windowScriptObject;
+}
+
+void Frame::cleanupPlatformScriptObjects()
+{
+    HardRelease(d->m_windowScriptObject);
+    d->m_windowScriptObject = 0;
 }
 
 } // namespace WebCore
index 9c39ec8518d09c17c8b98ad87577f8a1eed1d297..5674d980807989602163a2987074113859eac301 100644 (file)
@@ -33,7 +33,7 @@
 #import <WebCore/TextGranularity.h>
 
 namespace WebCore {
-    class FrameMac;
+    class Frame;
     class HTMLFrameOwnerElement;
     class Page;
     class String;
@@ -96,12 +96,12 @@ typedef enum ObjectElementType {
 @interface WebCoreFrameBridge : NSObject
 {
 @public
-    WebCore::FrameMac* m_frame;
+    WebCore::Frame* m_frame;
     BOOL _shouldCreateRenderers;
     BOOL _closed;
 }
 
-- (WebCore::FrameMac*)_frame; // underscore to prevent conflict with -[NSView frame]
+- (WebCore::Frame*)_frame; // underscore to prevent conflict with -[NSView frame]
 
 + (WebCoreFrameBridge *)bridgeForDOMDocument:(DOMDocument *)document;
 
@@ -292,18 +292,8 @@ typedef enum ObjectElementType {
 
 - (ObjectElementType)determineObjectFromMIMEType:(NSString*)MIMEType URL:(NSURL*)URL;
 
-- (NSString *)MIMETypeForPath:(NSString *)path;
-
 - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData;
 
-- (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element;
-- (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element;
-- (void)textDidChangeInTextField:(DOMHTMLInputElement *)element;
-- (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element;
-
-- (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector;
-- (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event;
-
 - (void)setHasBorder:(BOOL)hasBorder;
 
 - (void)print;
@@ -313,16 +303,10 @@ typedef enum ObjectElementType {
 // Deprecated, use getAppletInView: instead.
 - (jobject)pollForAppletInView:(NSView *)view;
 
-- (void)issueCutCommand;
-- (void)issueCopyCommand;
 - (void)issuePasteCommand;
-- (void)issuePasteAndMatchStyleCommand;
 - (void)issueTransposeCommand;
 - (void)respondToChangedSelection;
 - (void)setIsSelected:(BOOL)isSelected forView:(NSView *)view;
-- (BOOL)isEditable;
-- (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(WebCore::EAffinity)selectionAffinity stillSelecting:(BOOL)flag;
-- (BOOL)shouldDeleteSelectedDOMRange:(DOMRange *)currentRange;
 
 - (NSString *)overrideMediaType;
 
index 560b2b687a9a1984be57c0b4fec936a15c30396c..f5f75dd8c7b92709b9966a75e3750e740178c655 100644 (file)
@@ -43,9 +43,9 @@
 #import "EventHandler.h"
 #import "FloatRect.h"
 #import "FontData.h"
+#import "Frame.h"
 #import "FrameLoader.h"
 #import "FrameLoaderClient.h"
-#import "FrameMac.h"
 #import "FrameTree.h"
 #import "FrameView.h"
 #import "GraphicsContext.h"
@@ -126,7 +126,7 @@ static PassRefPtr<RootObject> createRootObject(void* nativeHandle)
     if (!bridge)
         return 0;
 
-    FrameMac* frame = [bridge _frame];
+    Frame* frame = [bridge _frame];
     return frame->createRootObject(nativeHandle, frame->scriptProxy()->interpreter());
 }
 
@@ -227,7 +227,7 @@ static inline WebCoreFrameBridge *bridge(Frame *frame)
 {
     if (!frame)
         return nil;
-    return Mac(frame)->bridge();
+    return frame->bridge();
 }
 
 - (NSString *)domain
@@ -1484,7 +1484,7 @@ static NSCharacterSet *_getPostSmartSet(void)
 
 // -------------------
 
-- (FrameMac*)_frame
+- (Frame*)_frame
 {
     return m_frame;
 }
index 8ac463873d3b62fc0ef596a69e32bb8236735ebc..1932823d693008b960d5ab4eee44a5b349143b38 100644 (file)
@@ -32,8 +32,8 @@
 #include "EventNames.h"
 #include "FloatPoint.h"
 #include "FocusController.h"
+#include "Frame.h"
 #include "FrameLoader.h"
-#include "FrameQt.h"
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "HTMLFrameSetElement.h"
@@ -61,7 +61,7 @@ static bool isKeyboardOptionTab(KeyboardEvent* event)
         && event->keyIdentifier() == "U+000009";
 }
 
-bool EventHandler::tabsToLinks(KeyboardEvent* event) const
+bool EventHandler::invertSenseOfTabsToLinks(KeyboardEvent* event) const
 {
     return isKeyboardOptionTab(event);
 }
index 370960728885374770532ee1fd09fbe32e8abbc4..83c139300f782db0e9e19bca275b535682f611fe 100644 (file)
@@ -5,6 +5,7 @@
  * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
  * Copyright (C) 2006 Rob Buis <buis@kde.org>
  * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
+ * Copyright (C) 2007 Trolltech ASA
  *
  * All rights reserved.
  *
@@ -31,7 +32,7 @@
  */
 
 #include "config.h"
-#include "FrameQt.h"
+#include "Frame.h"
 
 #include "Element.h"
 #include "RenderObject.h"
@@ -66,8 +67,6 @@
 #include "runtime_root.h"
 #include <QScrollArea>
 
-using namespace KJS;
-
 #define notImplemented() qDebug("FIXME: UNIMPLEMENTED: %s:%d (%s)", __FILE__, __LINE__, __FUNCTION__)
 
 namespace WebCore {
@@ -98,180 +97,36 @@ static void doScroll(const RenderObject* r, bool isHorizontal, int multiplier)
 }
 #endif
 
-FrameQt::FrameQt(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoader)
-    : Frame(page, ownerElement, frameLoader)
-{
-}
-
-FrameQt::~FrameQt()
-{
-    setView(0);
-    loader()->clearRecordedFormValues();
-
-    loader()->cancelAndClear();
-}
-
-bool FrameQt::passMouseDownEventToWidget(Widget*)
-{
-    notImplemented();
-    return false;
-}
-
-bool FrameQt::isLoadTypeReload()
+void Frame::issueTransposeCommand()
 {
     notImplemented();
-    return false;
-}
-
-Range* FrameQt::markedTextRange() const
-{
-    // FIXME: Handle selections.
-    return 0;
-}
-
-String FrameQt::mimeTypeForFileName(const String&) const
-{
-    notImplemented();
-    return String();
-}
-
-void FrameQt::unfocusWindow()
-{
-    if (!view())
-        return;
-
-    if (!tree()->parent())
-        view()->qwidget()->clearFocus();
-}
-
-void FrameQt::focusWindow()
-{
-    if (!view())
-        return;
-
-    if (!tree()->parent())
-        view()->qwidget()->setFocus();
 }
 
-KJS::Bindings::Instance* FrameQt::getEmbedInstanceForWidget(Widget*)
+void Frame::respondToChangedSelection(const Selection& oldSelection, bool closeTyping)
 {
-    notImplemented();
-    return 0;
+    // TODO: If we want continous spell checking, we need to implement this.
 }
 
-KJS::Bindings::Instance* FrameQt::getObjectInstanceForWidget(Widget*)
+void Frame::print()
 {
     notImplemented();
-    return 0;
 }
 
-KJS::Bindings::Instance* FrameQt::getAppletInstanceForWidget(Widget*)
+KJS::Bindings::Instance* Frame::createScriptInstanceForWidget(WebCore::Widget* widget)
 {
-    notImplemented();
     return 0;
 }
 
-void FrameQt::issueCutCommand()
-{
-    notImplemented();
-}
-
-void FrameQt::issueCopyCommand()
-{
-    notImplemented();
-}
-
-void FrameQt::issuePasteCommand()
-{
-    notImplemented();
-}
-
-void FrameQt::issuePasteAndMatchStyleCommand()
+void Frame::cleanupPlatformScriptObjects()
 {
-    notImplemented();
 }
 
-void FrameQt::issueTransposeCommand()
+bool Frame::isCharacterSmartReplaceExempt(UChar, bool)
 {
-    notImplemented();
-}
-
-void FrameQt::respondToChangedSelection(const Selection& oldSelection, bool closeTyping)
-{
-    // TODO: If we want continous spell checking, we need to implement this.
-}
-
-bool FrameQt::shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection, EAffinity affinity, bool stillSelecting) const
-{
-    // no-op
+    // no smart replace
     return true;
 }
 
-void FrameQt::print()
-{
-    notImplemented();
-}
-
-bool FrameQt::shouldInterruptJavaScript()
-{
-    notImplemented();
-    return false;
-}
-
-void FrameQt::setFrameGeometry(const IntRect& r)
-{
-    setFrameGeometry(QRect(r));
-}
-
-void FrameQt::createNewWindow(const FrameLoadRequest& request, const WindowFeatures& args, Frame*& frame)
-{
-    notImplemented();
-}
-
-void FrameQt::goBackOrForward(int)
-{
-    notImplemented();
-}
-
-KURL FrameQt::historyURL(int distance)
-{
-    notImplemented();
-    return KURL();
-}
-
-void FrameQt::runJavaScriptAlert(const String& message) 
-{
-    notImplemented();
-} 
-bool FrameQt::runJavaScriptConfirm(const String& message) 
-{
-    notImplemented();
-}
-
-bool FrameQt::runJavaScriptPrompt(const String& message, const String& defaultValue, String& result) 
-{
-    notImplemented();
-}
-
-KJS::Bindings::RootObject* FrameQt::bindingRootObject() 
-{
-    ASSERT(settings()->isJavaScriptEnabled()); 
-    if (!m_bindingRoot) {
-        JSLock lock;
-        // The root gets deleted by JavaScriptCore.
-        m_bindingRoot = KJS::Bindings::RootObject::create(0, scriptProxy()->interpreter());
-    }
-    return m_bindingRoot.get();
-}
-
-PassRefPtr<KJS::Bindings::RootObject> FrameQt::createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter> interpreter)
-{
-    RefPtr<KJS::Bindings::RootObject> rootObject = KJS::Bindings::RootObject::create(nativeHandle, interpreter);
-    m_rootObjects.append(rootObject);
-    return rootObject.release();
-}
-
 DragImageRef Frame::dragImageForSelection() 
 {
     return 0;
diff --git a/WebCore/page/qt/FrameQt.h b/WebCore/page/qt/FrameQt.h
deleted file mode 100644 (file)
index ffe0341..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-/*
- * Copyright (C) 2006 Dirk Mueller <mueller@kde.org>
- * Copyright (C) 2006 Zack Rusin <zack@kde.org>
- * Copyright (C) 2006 George Staikos <staikos@kde.org>
- * Copyright (C) 2006 Simon Hausmann <hausmann@kde.org>
- * Copyright (C) 2006 Rob Buis <buis@kde.org>
- * Copyright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
- * 
- * 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 FrameQt_h
-#define FrameQt_h
-
-#include "Frame.h"
-#include "WindowFeatures.h"
-
-class QWidget;
-class QPaintEvent;
-
-namespace KJS {
-    class Interpreter;
-    namespace Bindings {
-        class Instance;
-        class RootObject;
-    }
-}
-
-namespace WebCore {
-
-class EditorClient;
-
-class FrameQt : public Frame {
-public:
-    FrameQt(Page*, HTMLFrameOwnerElement*, FrameLoaderClient*);
-    virtual ~FrameQt();
-
-    virtual KJS::Bindings::Instance* getEmbedInstanceForWidget(Widget*);
-    virtual KJS::Bindings::Instance* getObjectInstanceForWidget(Widget*);
-    virtual KJS::Bindings::Instance* getAppletInstanceForWidget(Widget*);
-    virtual KJS::Bindings::RootObject* bindingRootObject();
-
-    PassRefPtr<KJS::Bindings::RootObject> createRootObject(void* nativeHandle, PassRefPtr<KJS::Interpreter>);
-
-    //should be in Chrome
-    virtual void runJavaScriptAlert(const String& message);
-    virtual bool runJavaScriptConfirm(const String& message);
-    virtual bool runJavaScriptPrompt(const String& message, const String& defaultValue,
-                                     String& result);
-    virtual bool shouldInterruptJavaScript();
-    virtual void focusWindow();
-    virtual void unfocusWindow();
-    virtual void print();
-
-    //should be in Editor
-    virtual Range* markedTextRange() const;
-    virtual void issueCutCommand();
-    virtual void issueCopyCommand();
-    virtual void issuePasteCommand();
-    virtual void issuePasteAndMatchStyleCommand();
-    virtual void issueTransposeCommand();
-    virtual void respondToChangedSelection(const Selection& oldSelection, bool closeTyping);
-    virtual bool shouldChangeSelection(const Selection& oldSelection, const Selection& newSelection,
-                                       EAffinity, bool stillSelecting) const;
-
-    //should be somewhere in platform
-    virtual String mimeTypeForFileName(const String&) const;
-
-    void setFrameGeometry(const IntRect&);
-
-    void createNewWindow(const FrameLoadRequest&, const WindowFeatures&, Frame*&);
-    void goBackOrForward(int);
-
-    KURL historyURL(int distance);
-private:
-    void init();
-
-    virtual bool isLoadTypeReload();
-    virtual bool passMouseDownEventToWidget(Widget*);
-
-    bool m_beginCalled : 1;    
-
-    RefPtr<KJS::Bindings::RootObject> m_bindingRoot; // The root object used for objects bound outside the context of a plugin.
-    Vector<RefPtr<KJS::Bindings::RootObject> > m_rootObjects;
-
-};
-
-inline FrameQt* QtFrame(Frame* frame) { return static_cast<FrameQt*>(frame); }
-inline const FrameQt* QtFrame(const Frame* frame) { return static_cast<const FrameQt*>(frame); }
-
-}
-
-#endif 
-// vim: ts=4 sw=4 et
index 8823b28a29f7efcf9cf67f7d252fcec0061acd6f..d636853d446c3e45b59fbce2c6e309952bdb8836 100644 (file)
@@ -126,6 +126,16 @@ static void initialiseMimeTypeRegistry()
     initialiseSupportedImageMIMETypes();
 }
 
+String MimeTypeRegistry::getMIMETypeForPath(const String& path)
+{
+    int pos = path.reverseFind('.');
+    if(pos >= 0) {
+        String extension = path.substring(pos + 1);
+        return getMIMETypeForExtension(extension);
+    }
+    return "application/octet-stream";
+}
+
 bool MimeTypeRegistry::isSupportedImageMIMEType(const String &mimeType)
 { 
     if (!supportedImageMIMETypes)
index aeb9f8e7754f1a798c127ab19d50fa115ba86706..9342da433587bcb293e44b70c9656ee43a8be660 100644 (file)
@@ -35,6 +35,7 @@ namespace WebCore {
 class MimeTypeRegistry {
 public:
     static String getMIMETypeForExtension(const String& ext);
+    static String getMIMETypeForPath(const String& path);
     
     // Check to see if a mime type is suitable for being loaded inline as an
     // image (e.g., <img> tags).
index 91d4a05cc965b7a37655c3f660b340e0c5fed56a..874851de1ffc5867624359f00cbac7fdb47f6bc8 100644 (file)
 
 #include "DocumentLoader.h"
 #include "FloatRect.h"
+#include "Frame.h"
 #include "FrameLoader.h"
-#if PLATFORM(MAC)
-#include "FrameMac.h"
-#elif PLATFORM(QT)
-#include "FrameQt.h"
-#endif
 #include "FrameView.h"
 #include "GraphicsContext.h"
 #include "Page.h"
@@ -139,11 +135,7 @@ bool SVGImage::setData(bool allDataReceived)
         // FIXME: If this SVG ends up loading itself, we'll leak this Frame (and associated DOM & render trees).
         // The Cache code does not know about CachedImages holding Frames and won't know to break the cycle.
         m_page.set(new Page(dummyChromeClient, dummyContextMenuClient, dummyEditorClient, dummyDragClient));
-#if PLATFORM(MAC)
-        m_frame = new FrameMac(m_page.get(), 0, dummyFrameLoaderClient);
-#elif PLATFORM(QT)
-        m_frame = new FrameQt(m_page.get(), 0, dummyFrameLoaderClient);
-#endif
+        m_frame = new Frame(m_page.get(), 0, dummyFrameLoaderClient);
         m_frameView = new FrameView(m_frame.get());
         m_frameView->deref(); // FIXME: FrameView starts with a refcount of 1
         m_frame->setView(m_frameView.get());
index 170ed66b335f2d7950aab99af97374b19f7bc9a2..5989d6714468f6d608d7a00dd74d2aea73f7ee55 100644 (file)
@@ -99,8 +99,17 @@ public:
     virtual void runJavaScriptAlert(Frame*, const String&) { }
     virtual bool runJavaScriptConfirm(Frame*, const String&) { return false; }
     virtual bool runJavaScriptPrompt(Frame*, const String& message, const String& defaultValue, String& result) { return false; }
-    virtual void setStatusbarText(const String&) { }
     virtual bool shouldInterruptJavaScript() { return false; }
+    
+    virtual void setStatusbarText(const String&) { }
+    
+    virtual bool tabsToLinks() const { return false; }
+    
+    virtual IntRect windowResizerRect() const { return IntRect(); }
+    virtual void addToDirtyRegion(const IntRect&) { }
+    virtual void scrollBackingStore(int dx, int dy, const IntRect& scrollViewRect, const IntRect& clipRect) { }
+    virtual void updateBackingStore() { }
+    
 };
 
 class SVGEmptyFrameLoaderClient : public FrameLoaderClient {
@@ -282,7 +291,8 @@ public:
     virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction) { return false; }
     //  virtual bool shouldInsertNode(Node*, Range* replacingRange, WebViewInsertAction) { return false; }
     virtual bool shouldInsertText(String, Range*, EditorInsertAction) { return false; }
-    //  virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, NSSelectionAffinity, bool stillSelecting) { return false; }
+    virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting) { return false; }
+
     virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*) { return false; }
     //  virtual bool shouldChangeTypingStyle(CSSStyleDeclaration* fromStyle, CSSStyleDeclaration* toStyle) { return false; }
     //  virtual bool doCommandBySelector(SEL selector) { return false; }
@@ -308,6 +318,13 @@ public:
 
     virtual void handleKeyPress(KeyboardEvent*) { }
 
+    virtual void textFieldDidBeginEditing(Element*) { }
+    virtual void textFieldDidEndEditing(Element*) { }
+    virtual void textDidChangeInTextField(Element*) { }
+    virtual bool doTextFieldCommandFromEvent(Element*, KeyboardEvent*) { return false; }
+    virtual void textWillBeDeletedInTextField(Element*) { }
+    virtual void textDidChangeInTextArea(Element*) { }
+    
 #if PLATFORM(MAC)
     virtual void markedTextAbandoned(Frame*) { }
 
index e50b5fc46f104d112f94d2730e6625e7fb63c5c9..ff7c593b17db862e117c871c910d2a51a74146c7 100644 (file)
@@ -45,11 +45,11 @@ typedef unsigned NSDragOperation;
 
 namespace WebCore {
 
-class FrameMac;
+class Frame;
 
 class ClipboardMac : public Clipboard, public CachedResourceClient {
 public:
-    ClipboardMac(bool forDragging, NSPasteboard *, ClipboardAccessPolicy, FrameMac* = 0);
+    ClipboardMac(bool forDragging, NSPasteboard *, ClipboardAccessPolicy, Frame* = 0);
     virtual ~ClipboardMac();
 
     bool isForDragging() const;
@@ -87,7 +87,7 @@ private:
     CachedImage* m_dragImage;
     RefPtr<Node> m_dragImageElement;
     int m_changeCount;
-    FrameMac* m_frame; // used on the source side to generate dragging images
+    Frame* m_frame; // used on the source side to generate dragging images
 };
 
 }
index b0e0bf1c0180289ca33d11ce596530ccef5b019e..78158f782e52d9809c93217611f0818eeaa2473b 100644 (file)
@@ -35,7 +35,7 @@
 #import "EventHandler.h"
 #import "FloatRect.h"
 #import "FoundationExtras.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "HTMLImageElement.h"
 #import "Image.h"
 #import "Page.h"
@@ -49,7 +49,7 @@
 
 namespace WebCore {
 
-ClipboardMac::ClipboardMac(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, FrameMac *frame)
+ClipboardMac::ClipboardMac(bool forDragging, NSPasteboard *pasteboard, ClipboardAccessPolicy policy, Frame *frame)
     : Clipboard(policy)
     , m_pasteboard(pasteboard)
     , m_forDragging(forDragging)
index 2c3a4c063693407e10a754b3bd60e63b9b4621e0..39ff0624cb6e78d4e2d67c64f5276817136c5804 100644 (file)
@@ -32,7 +32,7 @@
 
 #import "Document.h"
 #import "FontData.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "Icon.h"
 #import "LocalizedStrings.h"
 #import "WebCoreFrameBridge.h"
@@ -71,7 +71,7 @@ using namespace WebCore;
     if (!_fileChooser)
         return;
     
-    _bridge = Mac(frame)->bridge();
+    _bridge = frame->bridge();
     [_bridge retain];
     [_bridge runOpenPanelForFileButtonWithResultListener:self];
 }
index 3590beb126c1bff0a971dd9cd66ce315d34ab096..b75ebb7d259576d3ed4326e198b8384d09401909 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index 15aaf75a95cc91c82021bfa0fad7016a14917cbe..a7c2ff3fc9e2ec8738f1bb5386f1d9be493b65ed 100644 (file)
@@ -22,7 +22,7 @@
 
 #import "EventHandler.h"
 #import "FontData.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "FrameView.h"
 #import "HTMLNames.h"
 #import "HTMLOptGroupElement.h"
@@ -138,7 +138,7 @@ void PopupMenu::show(const IntRect& r, FrameView* v, int index)
 
     // Save the current event that triggered the popup, so we can clean up our event
     // state after the NSMenu goes away.
-    RefPtr<FrameMac> frame = Mac(v->frame());
+    RefPtr<Frame> frame = v->frame();
     NSEvent* event = [frame->eventHandler()->currentNSEvent() retain];
     
     RefPtr<PopupMenu> protector(this);
index 740f114a0ec5cba2720fd813ba03184c81681eac..26410208a441f4899ee0ed25ea8ef57edbc8ffc2 100644 (file)
@@ -30,7 +30,7 @@
 #import "Cursor.h"
 #import "Document.h"
 #import "Font.h"
-#import "FrameMac.h"
+#import "Frame.h"
 #import "GraphicsContext.h"
 #import "RetainPtr.h"
 #import "WebCoreFrameBridge.h"
@@ -119,7 +119,7 @@ void Widget::setFocus()
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
  
     NSView *view = [getView() _webcore_effectiveFirstResponder];
-    WebCoreFrameBridge *bridge = Mac(frame)->bridge();
+    WebCoreFrameBridge *bridge = frame->bridge();
     id firstResponder = [bridge firstResponder];
     if (firstResponder && firstResponder == view)
         return;
@@ -292,7 +292,7 @@ void Widget::sendConsumedMouseUp()
 void Widget::setIsSelected(bool isSelected)
 {
     if (Frame* frame = Frame::frameForWidget(this))
-        [Mac(frame)->bridge() setIsSelected:isSelected forView:getView()];
+        [frame->bridge() setIsSelected:isSelected forView:getView()];
 }
 
 void Widget::addToSuperview(NSView *superview)
index 0630bc287b8e7318a1528f60f44c939d907de3e2..2ea60eea8380b3b80d2564040c593c7a0acc89db 100644 (file)
@@ -30,8 +30,8 @@
 #import "AuthenticationMac.h"
 #import "BlockExceptions.h"
 #import "DocLoader.h"
+#import "Frame.h"
 #import "FrameLoader.h"
-#import "FrameMac.h"
 #import "ResourceError.h"
 #import "ResourceResponse.h"
 #import "SharedBuffer.h"
index 4fe8aab700289531b63431fb5340ad5e9fddaeea..4467e3de00d550001d4aa26016b075904b67ffa2 100644 (file)
@@ -30,7 +30,6 @@
 
 #include "CString.h"
 #include "CookieJar.h"
-#include "FrameQt.h"
 #include "ResourceHandle.h"
 #include "ResourceHandleClient.h"
 #include "ResourceResponse.h"
index 95d7d469f7f40cd19e93cac56aa9797e4656df58..2c2a86d76be8f22674fb2a31be31edc1195ec7cb 100644 (file)
@@ -33,7 +33,7 @@
 
 #include <QRegExp>
 
-#include "FrameQt.h"
+#include "Frame.h"
 #include "DocLoader.h"
 #include "ResourceHandle.h"
 #include "DeprecatedString.h"
@@ -56,7 +56,6 @@ ResourceHandle::~ResourceHandle()
 bool ResourceHandle::start(Frame* frame)
 {
     ASSERT(frame);
-    FrameQt* f = QtFrame(frame);
 
     ResourceHandleManager::self()->add(this);
     return true;
index 0873f9a5c8d14efd2b2c98a557c298e75d14815e..2363c43713cbf731c3571b84a9ba063e0ee9bf41 100644 (file)
@@ -1,6 +1,7 @@
 /*
  * Copyright (C) 2006 Zack Rusin <zack@kde.org>
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
index a6bd43006873be53c2bc3912c74880456c8343b5..a2073463ceed5865ba7d1fd4e1a7a8ccc33984a2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the popup menu implementation for <select> elements in WebCore.
  *
- * Copyright (C) 2007 Trolltech
+ * Copyright (C) 2007 Trolltech ASA
  * Copyright (C) 2006 Apple Computer, Inc.
  * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com 
  * Coypright (C) 2006 Nikolas Zimmermann <zimmermann@kde.org>
@@ -26,7 +26,7 @@
 #include "config.h"
 #include "PopupMenu.h"
 
-#include "FrameQt.h"
+#include "Frame.h"
 #include "FrameView.h"
 #include "PopupMenuClient.h"
 
index 8c6b46272e3404c035f95ea8444b613cf928fc12..5c8eff6cd18f1f8d6b76f174f5fb6044a2dd14c5 100644 (file)
@@ -35,7 +35,7 @@
 #include "ScrollViewCanvasQt.moc"
 
 #include "EventHandler.h"
-#include "FrameQt.h"
+#include "Frame.h"
 #include "FrameView.h"
 #include "TypingCommand.h"
 #include "KeyboardCodes.h"
index 0ae05fa39959ec530c450a3a22e1379b507e7b2a..98c90552df4fd7c8a8716f6f4a80ee417314c7e7 100644 (file)
@@ -36,7 +36,7 @@
 #include "IntPoint.h"
 #include "PlatformMouseEvent.h"
 
-#include "FrameQt.h"
+#include "Frame.h"
 #include "ScrollViewCanvasQt.h"
 
 #include <QDebug>
index 0d27e79f38f7a87d429af93c417cdb687e50c6ec..93225a15a182603c9df2b57ab33e35c20d6ba901 100644 (file)
@@ -50,7 +50,6 @@
 #include "FrameLoader.h"
 #include "FrameLoadRequest.h"
 #include "FrameView.h"
-#include "FrameWin.h"
 #include "GraphicsContext.h"
 #include "History.h"
 #include "HTMLFormElement.h"
index 8b8713e9241eb4b4a81c366cd53a60febc4d6698..116349e359c45185a37f521cd873f87ca9d31145 100644 (file)
 #include "break_lines.h"
 #include <wtf/AlwaysInline.h>
 
-#if PLATFORM(MAC)
-#include "FrameMac.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {
@@ -567,7 +563,7 @@ void InlineTextBox::paintCustomHighlight(int tx, int ty, const AtomicString& typ
     FloatRect rootRect(tx + r->xPos(), ty + selectionTop(), r->width(), selectionHeight());
     FloatRect textRect(tx + xPos(), rootRect.y(), width(), rootRect.height());
 
-    Mac(object()->document()->frame())->paintCustomHighlight(type, textRect, rootRect, true, false);
+    object()->document()->frame()->paintCustomHighlight(type, textRect, rootRect, true, false);
 }
 #endif
 
index a5ed5daf7b4b5ba736e8358134abf6368ddd528b..9185953c5f7b30f66fd9b445022248b2e15f5744 100644 (file)
@@ -33,6 +33,7 @@
 #include "GraphicsContext.h"
 #include "HTMLElement.h"
 #include "HTMLNames.h"
+#include "Frame.h"
 #include "RenderArena.h"
 #include "RenderFlexibleBox.h"
 #include "RenderLayer.h"
 #include <algorithm>
 #include <math.h>
 
-#if PLATFORM(MAC)
-#include "FrameMac.h"
-#endif
-
 using std::min;
 using std::max;
 
@@ -676,10 +673,10 @@ void RenderBox::paintCustomHighlight(int tx, int ty, const AtomicString& type, b
     if (r) {
         FloatRect rootRect(tx + r->xPos(), ty + r->selectionTop(), r->width(), r->selectionHeight());
         FloatRect imageRect(tx + m_x, rootRect.y(), width(), rootRect.height());
-        Mac(document()->frame())->paintCustomHighlight(type, imageRect, rootRect, behindText, false);
+        document()->frame()->paintCustomHighlight(type, imageRect, rootRect, behindText, false);
     } else {
         FloatRect imageRect(tx + m_x, ty + m_y, width(), height());
-        Mac(document()->frame())->paintCustomHighlight(type, imageRect, imageRect, behindText, false);
+        document()->frame()->paintCustomHighlight(type, imageRect, imageRect, behindText, false);
     }
 }
 #endif
index 3f48acf8f9fe5221a1da290162e2d930d3646166..c0bbfff63dc9f6b6d1d76ea32aa15b4fe333a421 100644 (file)
 
 #include "Document.h"
 #include "EllipsisBox.h"
+#include "Frame.h"
 #include "GraphicsContext.h"
 #include "HitTestResult.h"
 #include "RenderBlock.h"
 
-#if PLATFORM(MAC)
-#include "FrameMac.h"
-#endif
-
 using namespace std;
 
 namespace WebCore {
@@ -111,7 +108,7 @@ void RootInlineBox::addHighlightOverflow()
 {
     // Highlight acts as a selection inflation.
     FloatRect rootRect(0, selectionTop(), width(), selectionHeight());
-    IntRect inflatedRect = enclosingIntRect(Mac(object()->document()->frame())->customHighlightLineRect(object()->style()->highlight(), rootRect));
+    IntRect inflatedRect = enclosingIntRect(object()->document()->frame()->customHighlightLineRect(object()->style()->highlight(), rootRect));
     m_leftOverflow = min(m_leftOverflow, inflatedRect.x());
     m_rightOverflow = max(m_rightOverflow, inflatedRect.right());
     m_topOverflow = min(m_topOverflow, inflatedRect.y());
@@ -125,9 +122,9 @@ void RootInlineBox::paintCustomHighlight(RenderObject::PaintInfo& paintInfo, int
 
     // Get the inflated rect so that we can properly hit test.
     FloatRect rootRect(tx + xPos(), ty + selectionTop(), width(), selectionHeight());
-    FloatRect inflatedRect = Mac(object()->document()->frame())->customHighlightLineRect(highlightType, rootRect);
+    FloatRect inflatedRect = object()->document()->frame()->customHighlightLineRect(highlightType, rootRect);
     if (inflatedRect.intersects(paintInfo.rect))
-        Mac(object()->document()->frame())->paintCustomHighlight(highlightType, rootRect, rootRect, false, true);
+        object()->document()->frame()->paintCustomHighlight(highlightType, rootRect, rootRect, false, true);
 }
 #endif
 
index a2226fbd15f96a20886c07bd2c8b19c76761f71a..bcd1a0d7c6a27816bc0a7068974e7283f67e1b3b 100644 (file)
@@ -1,3 +1,60 @@
+2007-02-17  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Maciej.
+
+        Additional coding by Maciej, additional review by Oliver.
+
+        Added implementations for the new callbacks in EditorClient
+        and ChromeClient (basically moved from WebFrameBridge).
+        Cleaned up some code paths that are not called anymore
+        and done fully inside WebCore now.
+
+        * DefaultDelegates/WebDefaultContextMenuDelegate.mm:
+        * Misc/WebElementDictionary.mm:
+        * Misc/WebNSAttributedStringExtras.mm:
+        * Plugins/WebBaseNetscapePluginView.mm:
+        (-[WebBaseNetscapePluginView getVariable:value:]):
+        * Plugins/WebNetscapePluginEmbeddedView.mm:
+        * Plugins/WebNetscapePluginStream.mm:
+        * Plugins/WebPluginContainerCheck.mm:
+        * WebCoreSupport/WebChromeClient.h:
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::shouldInterruptJavaScript):
+        * WebCoreSupport/WebEditorClient.h:
+        * WebCoreSupport/WebEditorClient.mm:
+        (WebEditorClient::shouldChangeSelectedRange):
+        * WebCoreSupport/WebFrameBridge.mm:
+        (-[WebFrameBridge finishInitializingWithPage:frameName:frameView:ownerElement:]):
+        (-[WebFrameBridge fini]):
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        * WebView/WebArchiver.mm:
+        * WebView/WebFrame.mm:
+        (core):
+        (kit):
+        (-[WebFrame _updateBackground]):
+        * WebView/WebFrameInternal.h:
+        * WebView/WebFrameView.mm:
+        * WebView/WebHTMLRepresentation.mm:
+        * WebView/WebHTMLView.mm:
+        (-[WebHTMLView _updateMouseoverWithEvent:]):
+        (-[WebHTMLView _isEditable]):
+        (-[WebHTMLView validateUserInterfaceItem:]):
+        (-[WebHTMLView maintainsInactiveSelection]):
+        (-[WebHTMLView scrollWheel:]):
+        (-[WebHTMLView acceptsFirstMouse:]):
+        (-[WebHTMLView shouldDelayWindowOrderingForEvent:]):
+        (-[WebHTMLView cut:]):
+        (-[WebHTMLView paste:]):
+        (-[WebHTMLView selectedAttributedString]):
+        * WebView/WebScriptDebugDelegate.mm:
+        * WebView/WebView.mm:
+        (-[WebView _dashboardRegions]):
+        (-[WebView setProhibitsMainFrameScrolling:]):
+        (-[WebView _setInViewSourceMode:]):
+        (-[WebView _inViewSourceMode]):
+        (-[WebView shouldClose]):
+        (-[WebView setEditable:]):
+
 2007-02-18  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by Adam.
index 2948cee68802631f47ebc0a6332c84718e636b6f..2936c5dab58fca2426f21ae3b6e216d9f1fe7ba8 100644 (file)
@@ -46,8 +46,8 @@
 #import <Foundation/NSURLRequest.h>
 #import <JavaScriptCore/Assertions.h>
 #import <WebCore/Editor.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
-#import <WebCore/FrameMac.h>
 #import <WebCore/KURL.h>
 #import <WebCore/WebCoreFrameBridge.h>
 #import <WebKit/DOM.h>
index b33767b5b61ebb4bb3de03e351112babc2fa3868..2462baf0e8b153cf31b7addee11a376bba341c5e 100644 (file)
@@ -111,6 +111,7 @@ all : \
     $(PRIVATE_HEADERS_DIR)/DOMHTMLImageElementPrivate.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLInputElement.h \
     $(PRIVATE_HEADERS_DIR)/DOMHTMLInputElementPrivate.h \
+    $(INTERNAL_HEADERS_DIR)/DOMHTMLInputElementInternal.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLIsIndexElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLLIElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLLabelElement.h \
@@ -146,6 +147,7 @@ all : \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLTableSectionElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLTextAreaElement.h \
     $(PRIVATE_HEADERS_DIR)/DOMHTMLTextAreaElementPrivate.h \
+    $(INTERNAL_HEADERS_DIR)/DOMHTMLTextAreaElementInternal.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLTitleElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMHTMLUListElement.h \
     $(PUBLIC_HEADERS_DIR)/DOMKeyboardEvent.h \
index 6c097661416d4e895b840a44442de56ef63105fd..d8e7250a11af97895448f806ac4e443d83a34d4d 100644 (file)
@@ -37,7 +37,7 @@
 
 #import <WebKit/DOMCore.h>
 #import <WebKit/DOMExtensions.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/HitTestResult.h>
 #import <WebCore/Image.h>
 #import <WebCore/KURL.h>
index 6d82024cb9fb5d19f6bb11892bc9063c402493a1..303cd45847c5f142b4de8e220804fcf08c4670aa 100644 (file)
@@ -38,8 +38,8 @@
 #import <WebCore/Document.h>
 #import <WebCore/Element.h>
 #import <WebCore/FontData.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
-#import <WebCore/FrameMac.h>
 #import <WebCore/HTMLNames.h>
 #import <WebCore/Image.h>
 #import <WebCore/InlineTextBox.h>
index 93ed47f1483538b4e2a620504e00ea68956393df..e8f827e405e86cfc3438379c8c9be53dccef126c 100644 (file)
@@ -52,8 +52,8 @@
 #import <JavaScriptCore/npruntime_impl.h>
 #import <WebCore/Document.h>
 #import <WebCore/Element.h>
+#import <WebCore/Frame.h> 
 #import <WebCore/FrameLoader.h> 
-#import <WebCore/FrameMac.h> 
 #import <WebCore/FrameTree.h> 
 #import <WebCore/Page.h> 
 #import <WebKit/DOMPrivate.h>
@@ -2278,7 +2278,7 @@ static OSStatus TSMEventHandler(EventHandlerCallRef inHandlerRef, EventRef inEve
     switch (variable) {
         case NPNVWindowNPObject:
         {
-            FrameMac* frame = core([self webFrame]);
+            Frame* frame = core([self webFrame]);
             NPObject* windowScriptObject = frame ? frame->windowScriptNPObject() : 0;
 
             // Return value is expected to be retained, as described here: <http://www.mozilla.org/projects/plugins/npruntime.html#browseraccess>
index 78fa1404c073d9b21f9791dcda8fc4cf16f8acd1..1c91abfe59ff449a40fd97a44ab91637e26fe17b 100644 (file)
@@ -41,7 +41,7 @@
 #import "WebNetscapePluginStream.h"
 #import "WebView.h"
 #import <JavaScriptCore/Assertions.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
 
 @implementation WebNetscapePluginEmbeddedView
index 6919b46b27b346f6ae5e3a1f84e6e50e4af8ca0d..af4ab8630d172695bc2894882edf5241132db95d 100644 (file)
@@ -29,8 +29,8 @@
 #import <WebKit/WebNetscapePluginStream.h>
 
 #import <Foundation/NSURLConnection.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
-#import <WebCore/FrameMac.h>
 #import <WebCore/NetscapePlugInStreamLoader.h>
 #import <WebKit/WebDataSourceInternal.h>
 #import <WebKit/WebFrameBridge.h>
index be7ad48e87024686bb92180eb89e57226512a6c3..b6acbef7e17847edebeaab85571e5f29f8aad358 100644 (file)
@@ -41,9 +41,9 @@
 #import <Foundation/NSURL.h>
 #import <Foundation/NSURLRequest.h>
 #import <JavaScriptCore/Assertions.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameLoaderTypes.h>
-#import <WebCore/FrameMac.h>
 #import <objc/objc-runtime.h>
 
 using namespace WebCore;
index 6626e5bbc5e0b83c5b2685816bb642ea680d77be..58493882ca1ffbf42c24336ac5529d4d1beda714 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -83,9 +84,17 @@ public:
     virtual void runJavaScriptAlert(WebCore::Frame*, const WebCore::String&);
     virtual bool runJavaScriptConfirm(WebCore::Frame*, const WebCore::String&);
     virtual bool runJavaScriptPrompt(WebCore::Frame*, const WebCore::String& message, const WebCore::String& defaultValue, WebCore::String& result);
-    virtual void setStatusbarText(const WebCore::String&);
     virtual bool shouldInterruptJavaScript();
 
+    virtual bool tabsToLinks() const;
+    
+    virtual WebCore::IntRect windowResizerRect() const;
+    virtual void addToDirtyRegion(const WebCore::IntRect&);
+    virtual void scrollBackingStore(int dx, int dy, const WebCore::IntRect& scrollViewRect, const WebCore::IntRect& clipRect);
+    virtual void updateBackingStore();
+    
+    virtual void setStatusbarText(const WebCore::String&);
+
 private:
     WebView *m_webView;
 };
index c1a89c6d9038c14b3e9a169dcbcf370712c46f49..bfa6ed6d29ce6d42da3cbc743e7275dbf3e6d247 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #import "WebUIDelegatePrivate.h"
 #import "WebView.h"
 #import "WebViewInternal.h"
+#import <WebCore/BlockExceptions.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/FrameLoadRequest.h>
+#import <WebCore/IntRect.h>
 #import <WebCore/PlatformString.h>
 #import <WebCore/ResourceRequest.h>
 #import <WebCore/Screen.h>
@@ -307,6 +310,18 @@ bool WebChromeClient::runJavaScriptPrompt(Frame* frame, const String& prompt, co
     return !result.isNull();
 }
 
+bool WebChromeClient::shouldInterruptJavaScript()
+{
+    BEGIN_BLOCK_OBJC_EXCEPTIONS;
+    id wd = [m_webView UIDelegate];
+    if ([wd respondsToSelector:@selector(webViewShouldInterruptJavaScript:)])
+        return [wd webViewShouldInterruptJavaScript:m_webView];
+    return false;
+    END_BLOCK_OBJC_EXCEPTIONS;
+    
+    return false;
+}
+
 void WebChromeClient::setStatusbarText(const WebCore::String& status)
 {
     id wd = [m_webView UIDelegate];
@@ -322,11 +337,24 @@ void WebChromeClient::setStatusbarText(const WebCore::String& status)
     }
 }
 
-bool WebChromeClient::shouldInterruptJavaScript()
+bool WebChromeClient::tabsToLinks() const
 {
-    id wd = [m_webView UIDelegate];
-    if ([wd respondsToSelector:@selector(webViewShouldInterruptJavaScript:)])
-        return [wd webViewShouldInterruptJavaScript:m_webView];
+    return [[m_webView preferences] tabsToLinks];
+}
+
+IntRect WebChromeClient::windowResizerRect() const
+{
+    return IntRect();
+}
 
-    return NO;
+void WebChromeClient::addToDirtyRegion(const IntRect&)
+{
+}
+
+void WebChromeClient::scrollBackingStore(int, int, const IntRect&, const IntRect&)
+{
+}
+
+void WebChromeClient::updateBackingStore()
+{
 }
index 86fd7f8c5ca4c30bfa593867db8d0c4a38ec4792..c8a7e98730d79c5a10103a7383ca405fbaf74dbd 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -56,6 +57,7 @@ public:
     virtual bool shouldEndEditing(WebCore::Range*);
     virtual bool shouldInsertNode(WebCore::Node*, WebCore::Range*, WebCore::EditorInsertAction);
     virtual bool shouldInsertText(WebCore::String, WebCore::Range*, WebCore::EditorInsertAction);
+    virtual bool shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity, bool stillSelecting);
 
     virtual bool shouldApplyStyle(WebCore::CSSStyleDeclaration*, WebCore::Range*);
 
@@ -81,11 +83,18 @@ public:
     
     virtual void undo();
     virtual void redo();
-
+    
     virtual void handleKeyPress(WebCore::KeyboardEvent*);
 
     virtual void markedTextAbandoned(WebCore::Frame*);
 
+    virtual void textFieldDidBeginEditing(WebCore::Element*);
+    virtual void textFieldDidEndEditing(WebCore::Element*);
+    virtual void textDidChangeInTextField(WebCore::Element*);
+    virtual bool doTextFieldCommandFromEvent(WebCore::Element*, WebCore::KeyboardEvent*);
+    virtual void textWillBeDeletedInTextField(WebCore::Element*);
+    virtual void textDidChangeInTextArea(WebCore::Element*);
+    
 private:
     void registerCommandForUndoOrRedo(PassRefPtr<WebCore::EditCommand>, bool isRedo);
     WebEditorClient();
index 0907586452d954409acc16da5a7a01ba7cf2b199..d1807578f9070092a5788f6dc19cb628e522f1d3 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2007 Trolltech ASA
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #import "WebEditorClient.h"
 
+#import "DOMHTMLInputElementInternal.h"
+#import "DOMHTMLTextAreaElementInternal.h"
+#import "DOMRangeInternal.h"
 #import "WebArchive.h"
 #import "WebArchiver.h"
 #import "WebDataSourceInternal.h"
 #import "WebDocument.h"
 #import "WebEditingDelegatePrivate.h"
+#import "WebFormDelegate.h"
 #import "WebFrameInternal.h"
 #import "WebHTMLView.h"
 #import "WebHTMLViewInternal.h"
 #import "WebLocalizableStrings.h"
+#import "WebKitLogging.h"
 #import "WebNSURLExtras.h"
 #import "WebViewInternal.h"
 #import <WebCore/Document.h>
@@ -227,6 +233,11 @@ bool WebEditorClient::shouldInsertText(String text, Range* range, EditorInsertAc
     return [[webView _editingDelegateForwarder] webView:webView shouldInsertText:text replacingDOMRange:kit(range) givenAction:kit(action)];
 }
 
+bool WebEditorClient::shouldChangeSelectedRange(WebCore::Range* fromRange, WebCore::Range* toRange, WebCore::EAffinity selectionAffinity, bool stillSelecting)
+{
+    return [m_webView _shouldChangeSelectedDOMRange:kit(fromRange) toDOMRange:kit(toRange) affinity:kit(selectionAffinity) stillSelecting:stillSelecting];
+}
+
 void WebEditorClient::didBeginEditing()
 {
     [[NSNotificationCenter defaultCenter] postNotificationName:WebViewDidBeginEditingNotification object:m_webView];
@@ -401,3 +412,79 @@ void WebEditorClient::markedTextAbandoned(Frame* frame)
     WebHTMLView *webHTMLView = [[kit(frame) frameView] documentView];
     [[NSInputManager currentInputManager] markedTextAbandoned:webHTMLView];
 }
+
+#define FormDelegateLog(ctrl)  LOG(FormDelegate, "control=%@", ctrl)
+
+void WebEditorClient::textFieldDidBeginEditing(WebCore::Element* element)
+{
+    DOMHTMLInputElement* inputElement = [DOMHTMLInputElement _HTMLInputElementWith:(WebCore::HTMLInputElement*)element];
+    FormDelegateLog(inputElement);
+    [[m_webView _formDelegate] textFieldDidBeginEditing:inputElement inFrame:kit(element->document()->frame())];
+}
+
+void WebEditorClient::textFieldDidEndEditing(WebCore::Element* element)
+{
+    DOMHTMLInputElement* inputElement = [DOMHTMLInputElement _HTMLInputElementWith:(WebCore::HTMLInputElement*)element];
+    FormDelegateLog(inputElement);
+    [[m_webView _formDelegate] textFieldDidEndEditing:inputElement inFrame:kit(element->document()->frame())];
+}
+    
+void WebEditorClient::textDidChangeInTextField(WebCore::Element* element)
+{
+    DOMHTMLInputElement* inputElement = [DOMHTMLInputElement _HTMLInputElementWith:(WebCore::HTMLInputElement*)element];
+    FormDelegateLog(inputElement);
+    [[m_webView _formDelegate] textDidChangeInTextField:(DOMHTMLInputElement *)inputElement inFrame:kit(element->document()->frame())];
+}
+
+static SEL selectorForKeyEvent(KeyboardEvent* event)
+{
+    // FIXME: This helper function is for the auto-fill code so the bridge can pass a selector to the form delegate.  
+    // Eventually, we should move all of the auto-fill code down to WebKit and remove the need for this function by
+    // not relying on the selector in the new implementation.
+    String key = event->keyIdentifier();
+    if (key == "Up")
+        return @selector(moveUp:);
+    if (key == "Down")
+        return @selector(moveDown:);
+    if (key == "U+00001B")
+        return @selector(cancel:);
+    if (key == "U+000009") {
+        if (event->shiftKey())
+            return @selector(insertBacktab:);
+        return @selector(insertTab:);
+    }
+    if (key == "Enter")
+        return @selector(insertNewline:);
+    return 0;
+}
+
+bool WebEditorClient::doTextFieldCommandFromEvent(WebCore::Element* element, WebCore::KeyboardEvent* event)
+{
+    DOMHTMLInputElement* inputElement = [DOMHTMLInputElement _HTMLInputElementWith:(WebCore::HTMLInputElement*)element];
+
+    bool result = false;
+    FormDelegateLog(inputElement);
+
+    SEL selector = selectorForKeyEvent(event);
+    if (selector)
+        result = [[m_webView _formDelegate] textField:inputElement doCommandBySelector:selector inFrame:kit(element->document()->frame())];
+
+    return result;
+}
+
+void WebEditorClient::textWillBeDeletedInTextField(WebCore::Element* element)
+{
+    DOMHTMLInputElement* inputElement = [DOMHTMLInputElement _HTMLInputElementWith:(WebCore::HTMLInputElement*)element];
+
+    // We're using the deleteBackward selector for all deletion operations since the autofill code treats all deletions the same way.
+    FormDelegateLog(inputElement);
+    [[m_webView _formDelegate] textField:inputElement doCommandBySelector:@selector(deleteBackward:) inFrame:kit(element->document()->frame())];
+}
+
+void WebEditorClient::textDidChangeInTextArea(WebCore::Element* element)
+{
+    DOMHTMLTextAreaElement* textAreaElement = [DOMHTMLTextAreaElement _HTMLTextAreaElementWith:(WebCore::HTMLTextAreaElement*)element];
+
+    FormDelegateLog(textAreaElement);
+    [[m_webView _formDelegate] textDidChangeInTextArea:textAreaElement inFrame:kit(element->document()->frame())];
+}
index dcf9f46af90cae75aef466832187864b67ef84bb..dd2d845debe38a14a9fa760b81e00b56ae388ae4 100644 (file)
 #import <Foundation/NSURLRequest.h>
 #import <Foundation/NSURLResponse.h>
 #import <JavaScriptCore/Assertions.h>
+#import <JavaScriptCore/JSLock.h>
+#import <JavaScriptCore/object.h>
 #import <JavaVM/jni.h>
 #import <WebCore/Cache.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentLoader.h>
 #import <WebCore/DragController.h>
 #import <WebCore/Element.h>
+#import <WebCore/FoundationExtras.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
 #import <WebCore/FrameLoaderClient.h>
-#import <WebCore/FrameMac.h>
 #import <WebCore/FrameTree.h>
 #import <WebCore/HTMLFrameOwnerElement.h>
 #import <WebCore/Page.h>
@@ -133,7 +136,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
 
     _frame = [[WebFrame alloc] _initWithWebFrameView:frameView webView:webView bridge:self];
 
-    m_frame = new FrameMac(page, ownerElement, new WebFrameLoaderClient(_frame));
+    m_frame = new Frame(page, ownerElement, new WebFrameLoaderClient(_frame));
     m_frame->setBridge(self);
     m_frame->tree()->setName(name);
     
@@ -170,6 +173,7 @@ NSString *WebPluginContainerKey =   @"WebPluginContainer";
         [[NSNotificationCenter defaultCenter] 
             removeObserver:self name:WebPreferencesChangedNotification object:nil];
     }
+
     ASSERT(_frame == nil);
     --WebBridgeCount;
 }
@@ -695,14 +699,6 @@ static BOOL loggedObjectCacheSize = NO;
     return ObjectElementNone;
 }
 
-- (NSString *)MIMETypeForPath:(NSString *)path
-{
-    ASSERT(path);
-    NSString *extension = [path pathExtension];
-    NSString *type = WKGetMIMETypeForExtension(extension);
-    return [type length] == 0 ? (NSString *)@"application/octet-stream" : type;
-}
-
 - (BOOL)startDraggingImage:(NSImage *)dragImage at:(NSPoint)dragLoc operation:(NSDragOperation)op
     event:(NSEvent *)event sourceIsDHTML:(BOOL)flag DHTMLWroteData:(BOOL)dhtmlWroteData
 {
@@ -714,50 +710,6 @@ static BOOL loggedObjectCacheSize = NO;
         sourceIsDHTML:flag DHTMLWroteData:dhtmlWroteData];
 }
 
-static id <WebFormDelegate> formDelegate(WebFrameBridge *self)
-{
-    ASSERT(self->_frame != nil);
-    return [[self->_frame webView] _formDelegate];
-}
-
-#define FormDelegateLog(ctrl)  LOG(FormDelegate, "control=%@", ctrl)
-
-- (void)textFieldDidBeginEditing:(DOMHTMLInputElement *)element
-{
-    FormDelegateLog(element);
-    [formDelegate(self) textFieldDidBeginEditing:element inFrame:_frame];
-}
-
-- (void)textFieldDidEndEditing:(DOMHTMLInputElement *)element
-{
-    FormDelegateLog(element);
-    [formDelegate(self) textFieldDidEndEditing:element inFrame:_frame];
-}
-
-- (void)textDidChangeInTextField:(DOMHTMLInputElement *)element
-{
-    FormDelegateLog(element);
-    [formDelegate(self) textDidChangeInTextField:(DOMHTMLInputElement *)element inFrame:_frame];
-}
-
-- (void)textDidChangeInTextArea:(DOMHTMLTextAreaElement *)element
-{
-    FormDelegateLog(element);
-    [formDelegate(self) textDidChangeInTextArea:element inFrame:_frame];
-}
-
-- (BOOL)textField:(DOMHTMLInputElement *)element doCommandBySelector:(SEL)commandSelector
-{
-    FormDelegateLog(element);
-    return [formDelegate(self) textField:element doCommandBySelector:commandSelector inFrame:_frame];
-}
-
-- (BOOL)textField:(DOMHTMLInputElement *)element shouldHandleEvent:(NSEvent *)event
-{
-    FormDelegateLog(element);
-    return [formDelegate(self) textField:element shouldHandleEvent:event inFrame:_frame];
-}
-
 - (void)setHasBorder:(BOOL)hasBorder
 {
     [[_frame frameView] _setHasBorder:hasBorder];
@@ -815,20 +767,6 @@ static id <WebFormDelegate> formDelegate(WebFrameBridge *self)
     return [[self webView] undoManager];
 }
 
-- (void)issueCutCommand
-{
-    NSView* documentView = [[_frame frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView*)documentView cut:nil];
-}
-
-- (void)issueCopyCommand
-{
-    NSView* documentView = [[_frame frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView*)documentView copy:nil];
-}
-
 - (void)issuePasteCommand
 {
     NSView* documentView = [[_frame frameView] documentView];
@@ -836,13 +774,6 @@ static id <WebFormDelegate> formDelegate(WebFrameBridge *self)
         [(WebHTMLView*)documentView paste:nil];
 }
 
-- (void)issuePasteAndMatchStyleCommand
-{
-    NSView <WebDocumentView> *documentView = [[_frame frameView] documentView];
-    if ([documentView isKindOfClass:[WebHTMLView class]])
-        [(WebHTMLView*)documentView pasteAsPlainText:nil];
-}
-
 - (void)issueTransposeCommand
 {
     NSView <WebDocumentView> *view = [[_frame frameView] documentView];
@@ -863,22 +794,6 @@ static id <WebFormDelegate> formDelegate(WebFrameBridge *self)
     return [[self webView] mediaStyle];
 }
 
-- (BOOL)isEditable
-{
-    return [[self webView] isEditable];
-}
-
-- (BOOL)shouldChangeSelectedDOMRange:(DOMRange *)currentRange toDOMRange:(DOMRange *)proposedRange affinity:(EAffinity)selectionAffinity stillSelecting:(BOOL)flag
-{
-    return [[self webView] _shouldChangeSelectedDOMRange:currentRange toDOMRange:proposedRange affinity:kit(selectionAffinity) stillSelecting:flag];
-}
-
-- (BOOL)shouldDeleteSelectedDOMRange:(DOMRange *)range
-{
-    WebView *webView = [self webView];
-    return [[webView _editingDelegateForwarder] webView:webView shouldDeleteDOMRange:range];
-}
-
 - (void)windowObjectCleared
 {
     WebView *wv = [self webView];
index 265a29aefe906962e21cb40d5b5cfaec1918f4c7..d04751abef7d5054e4ba31899393d270f2775ad0 100644 (file)
@@ -146,7 +146,6 @@ private:
     virtual void updateGlobalHistoryForReload(const WebCore::KURL&);
     virtual bool shouldGoToHistoryItem(WebCore::HistoryItem*) const;
 
-
     virtual WebCore::ResourceError cancelledError(const WebCore::ResourceRequest&);
     virtual WebCore::ResourceError cannotShowURLError(const WebCore::ResourceRequest&);
     virtual WebCore::ResourceError interruptForPolicyChangeError(const WebCore::ResourceRequest&);
index 983780ff3d845b5af4bdba9f57177cc69e3263d3..437171bf91eaa7a1692cb2aa94de3db572aa4f71 100644 (file)
@@ -37,7 +37,7 @@
 #import "WebFrameInternal.h"
 #import "WebResource.h"
 #import <JavaScriptCore/Assertions.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/SelectionController.h>
 #import <WebKit/DOM.h>
 
index 484663aa11655ee8ae071135dcbaa29b56dce151..973ca5a3fe992d89382874b44a252949bb340bba 100644 (file)
 
 @class WebDataSource;
 
+namespace WebCore {
+    class ResourceRequest;
+}
+
 class WebDocumentLoaderMac : public WebCore::DocumentLoader
 {
 public:
index 5017b3b10e3850917a1a219254018c9c7ae3a50e..833fd636cedb9ed53487b67f4117175b600d9f02 100644 (file)
@@ -62,7 +62,7 @@
 #import <WebCore/Document.h>
 #import <WebCore/Event.h>
 #import <WebCore/FrameLoader.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameTree.h>
 #import <WebCore/HistoryItem.h>
 #import <WebCore/HTMLFormElement.h>
@@ -228,7 +228,7 @@ static inline WebFrame *frame(WebCoreFrameBridge *bridge)
     return ((WebFrameBridge *)bridge)->_frame;
 }
 
-FrameMac* core(WebFrame *frame)
+Frame* core(WebFrame *frame)
 {
     if (!frame)
         return 0;
@@ -241,7 +241,7 @@ FrameMac* core(WebFrame *frame)
 
 WebFrame *kit(Frame* frame)
 {
-    return frame ? ((WebFrameBridge *)Mac(frame)->bridge())->_frame : nil;
+    return frame ? ((WebFrameBridge *)frame->bridge())->_frame : nil;
 }
 
 Page* core(WebView *webView)
@@ -425,7 +425,7 @@ WebView *getWebView(WebFrame *webFrame)
 
     Frame* coreFrame = core(self);
     for (Frame* frame = coreFrame; frame; frame = frame->tree()->traverseNext(coreFrame)) {
-        WebFrameBridge *bridge = (WebFrameBridge *)Mac(frame)->bridge();
+        WebFrameBridge *bridge = (WebFrameBridge *)frame->bridge();
         WebFrame *webFrame = [bridge webFrame];
         // Never call setDrawsBackground:YES here on the scroll view or the background color will
         // flash between pages loads. setDrawsBackground:YES will be called in _frameLoadCompleted.
index 656ced7a3a945d8a43f87d02af9b16e85ec232cf..04aad5b2cbaa6b8c0129dc58bc7377b862d6b222 100644 (file)
@@ -54,7 +54,7 @@ namespace WebCore {
     class DocumentLoader;
     class Element;
     class Frame;
-    class FrameMac;
+    class Frame;
     class FrameLoader;
     class HistoryItem;
     class HTMLElement;
@@ -68,7 +68,7 @@ typedef WebCore::HistoryItem WebCoreHistoryItem;
 WebCore::CSSStyleDeclaration* core(DOMCSSStyleDeclaration *);
 DOMCSSStyleDeclaration *kit(WebCore::CSSStyleDeclaration*);
 
-WebCore::FrameMac* core(WebFrame *);
+WebCore::Frame* core(WebFrame *);
 WebFrame *kit(WebCore::Frame *);
 
 WebCore::Element* core(DOMElement *);
index de22f545a920e59eb832562c3a7ba32fd7d54c17..f2df7aa4649b13bf1e5b912933e079299b63c771 100644 (file)
@@ -56,7 +56,7 @@
 #import <Foundation/NSURLRequest.h>
 #import <JavaScriptCore/Assertions.h>
 #import <WebCore/DragController.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/HistoryItem.h>
 #import <WebCore/Page.h>
 #import <WebCore/WebCoreFrameView.h>
index da1f6515bbc5ec044c483978b0ee3e89bc8cbc7a..464b53a79ff3b6095c1b65c392ca21471ed1a810 100644 (file)
@@ -46,8 +46,8 @@
 #import <JavaScriptCore/Assertions.h>
 #import <WebCore/Document.h>
 #import <WebCore/DocumentLoader.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
-#import <WebCore/FrameMac.h>
 #import <WebCore/MimeTypeRegistry.h>
 #import <WebCore/Range.h>
 
index 168e1ffed49a5e6710f9c58e54153976d359c789..0d0af0e9bef96d2afc67a95e412b6ed2fcbf34d1 100644 (file)
@@ -79,7 +79,7 @@
 #import <WebCore/DragController.h>
 #import <WebCore/FloatRect.h>
 #import <WebCore/FocusController.h>
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/HitTestResult.h>
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/MimeTypeRegistry.h>
@@ -1191,14 +1191,14 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
                          windowNumber:[[view window] windowNumber]
                          context:[[NSApp currentEvent] context]
                          eventNumber:0 clickCount:0 pressure:0];
-        if (FrameMac* lastHitCoreFrame = core([lastHitView _frame]))
+        if (Frame* lastHitCoreFrame = core([lastHitView _frame]))
             lastHitCoreFrame->eventHandler()->mouseMoved(event);
     }
 
     lastHitView = view;
 
     if (view) {
-        if (FrameMac* coreFrame = core([view _frame]))
+        if (Frame* coreFrame = core([view _frame]))
             coreFrame->eventHandler()->mouseMoved(event);
 
         NSPoint point = [view convertPoint:[event locationInWindow] fromView:nil];
@@ -1646,7 +1646,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
 
 - (BOOL)_isEditable
 {
-    FrameMac* coreFrame = core([self _frame]);
+    Frame* coreFrame = core([self _frame]);
     if (!coreFrame)
         return NO;
     return coreFrame->selectionController()->isContentEditable();
@@ -2028,7 +2028,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item 
 {
     SEL action = [item action];
-    FrameMac* frame = core([self _frame]);
+    Frame* frame = core([self _frame]);
 
     if (action == @selector(changeSpelling:)
             || action == @selector(_changeSpellingFromMenu:)
@@ -2298,7 +2298,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     if (nextResponder == self)
         return YES;
 
-    FrameMac* coreFrame = core([self _frame]);
+    Frame* coreFrame = core([self _frame]);
     bool selectionIsEditable = coreFrame && coreFrame->selectionController()->isContentEditable();
     bool nextResponderIsInWebView = [nextResponder isKindOfClass:[NSView class]]
         && [nextResponder isDescendantOf:[[[self _webView] mainFrame] frameView]];
@@ -2791,7 +2791,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
 - (void)scrollWheel:(NSEvent *)event
 {
     [self retain];
-    FrameMac* frame = core([self _frame]);
+    Frame* frame = core([self _frame]);
     if (!frame || !frame->eventHandler()->wheelEvent(event))
         [[self nextResponder] scrollWheel:event];    
     [self release];
@@ -2813,7 +2813,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     
     if (hitHTMLView) {
         bool result = false;
-        if (FrameMac* coreFrame = core([hitHTMLView _frame])) {
+        if (Frame* coreFrame = core([hitHTMLView _frame])) {
             coreFrame->eventHandler()->setActivationEventNumber([event eventNumber]);
             [hitHTMLView _setMouseDownEvent:event];
             if ([hitHTMLView _isSelectionEvent:event])
@@ -2832,7 +2832,7 @@ static NSURL* uniqueURLWithRelativePart(NSString *relativePart)
     if (hitHTMLView) {
         bool result = false;
         if ([hitHTMLView _isSelectionEvent:event])
-            if (FrameMac* coreFrame = core([hitHTMLView _frame])) {
+            if (Frame* coreFrame = core([hitHTMLView _frame])) {
                 [hitHTMLView _setMouseDownEvent:event];
                 result = coreFrame->eventHandler()->eventMayStartDrag(event);
                 [hitHTMLView _setMouseDownEvent:nil];
@@ -4991,7 +4991,7 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     if (coreFrame)
         coreFrame->editor()->cut();
 #else
-    FrameMac* coreFrame = core([self _frame]);
+    Frame* coreFrame = core([self _frame]);
     if (coreFrame && coreFrame->editor()->tryDHTMLCut())
         return; // DHTML did the whole operation
     if (!coreFrame->editor()->canCut()) {
@@ -5014,7 +5014,7 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     if (coreFrame)
         coreFrame->editor()->paste();
 #else
-    FrameMac* coreFrame = core([self _frame]);
+    Frame* coreFrame = core([self _frame]);
     if (coreFrame && coreFrame->editor()->tryDHTMLPaste())
         return; // DHTML did the whole operation
     if (!coreFrame->editor()->canPaste())
@@ -5022,7 +5022,7 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
     if (coreFrame && coreFrame->selectionController()->isContentRichlyEditable())
         [self _pasteWithPasteboard:[NSPasteboard generalPasteboard] allowPlainText:YES];
     else
-        [self _pasteAsPlainTextWithPasteboard:[NSPasteboard generalPasteboard]];
+        coreFrame->editor()->pasteAsPlainText();
 #endif
 }
 
@@ -5880,7 +5880,7 @@ static CGPoint coreGraphicsScreenPointForAppKitScreenPoint(NSPoint point)
 {
     NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[self _selectedRange]];
     if (!attributedString) {
-        FrameMac* coreFrame = core([self _frame]);
+        Frame* coreFrame = core([self _frame]);
         if (coreFrame) {
             RefPtr<Range> range = coreFrame->selectionController()->selection().toRange();
             attributedString = [NSAttributedString _web_attributedStringFromRange:range.get()];
index 21efdffa9b39d458605a5514885d4974bbe7a488..71ad1effd620a188a02d7bc1da6500ef1020b589 100644 (file)
@@ -34,7 +34,7 @@
 #import "WebFrameInternal.h"
 #import "WebScriptDebugServerPrivate.h"
 #import "WebViewInternal.h"
-#import <WebCore/FrameMac.h>
+#import <WebCore/Frame.h>
 #import <WebCore/WebCoreScriptDebugger.h>
 
 using namespace WebCore;
index 1349039d56f49a3c3c0150b2c7b314606c0389eb..1fe67e6783db025478d24ab3eba260bfbb2aec9f 100644 (file)
@@ -98,8 +98,8 @@
 #import <WebCore/DragData.h>
 #import <WebCore/Editor.h>
 #import <WebCore/ExceptionHandlers.h>
+#import <WebCore/Frame.h>
 #import <WebCore/FrameLoader.h>
-#import <WebCore/FrameMac.h>
 #import <WebCore/FrameTree.h>
 #import <WebCore/HTMLNames.h>
 #import <WebCore/HistoryItem.h>
@@ -1211,7 +1211,7 @@ WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementat
 - (NSDictionary *)_dashboardRegions
 {
     // Only return regions from main frame.
-    FrameMac* mainFrame = [[[self mainFrame] _bridge] _frame];
+    Frame* mainFrame = [[[self mainFrame] _bridge] _frame];
     if (!mainFrame)
         return nil;
     NSMutableDictionary *regions = mainFrame->dashboardRegionsDictionary();
@@ -1324,7 +1324,7 @@ WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementat
 
 - (void)setProhibitsMainFrameScrolling:(BOOL)prohibits
 {
-    FrameMac* mainFrame = [[[self mainFrame] _bridge] _frame];
+    Frame* mainFrame = [[[self mainFrame] _bridge] _frame];
     if (mainFrame)
         mainFrame->setProhibitsScrolling(prohibits);
 }
@@ -1337,14 +1337,14 @@ WebResourceDelegateImplementationCache WebViewGetResourceLoadDelegateImplementat
 
 - (void)_setInViewSourceMode:(BOOL)flag
 {
-    FrameMac* mainFrame = [[[self mainFrame] _bridge] _frame];
+    Frame* mainFrame = [[[self mainFrame] _bridge] _frame];
     if (mainFrame)
         mainFrame->setInViewSourceMode(flag);
 }
 
 - (BOOL)_inViewSourceMode
 {
-    FrameMac* mainFrame = [[[self mainFrame] _bridge] _frame];
+    Frame* mainFrame = [[[self mainFrame] _bridge] _frame];
     return mainFrame && mainFrame->inViewSourceMode();
 }
 
@@ -2721,7 +2721,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
 
 - (BOOL)shouldClose
 {
-    FrameMac* coreFrame = core([self mainFrame]);
+    Frame* coreFrame = core([self mainFrame]);
     if (!coreFrame)
         return YES;
     return coreFrame->shouldClose();
@@ -3006,7 +3006,7 @@ static WebFrame *incrementFrame(WebFrame *curr, BOOL forward, BOOL wrapFlag)
         _private->editable = flag;
         if (!_private->tabKeyCyclesThroughElementsChanged)
             _private->page->setTabKeyCyclesThroughElements(!flag);
-        FrameMac* mainFrame = [[[self mainFrame] _bridge] _frame];
+        Frame* mainFrame = [[[self mainFrame] _bridge] _frame];
         if (mainFrame) {
             if (flag) {
                 mainFrame->applyEditingStyleToBodyElement();
index d6857136a73f55a96da323de49cfab14edd3f29c..296ea442a6d0047064f3093995abb4b6b84c7495 100644 (file)
@@ -28,7 +28,7 @@
 #include <qdebug.h>
 
 #include "FrameLoaderClientQt.h"
-#include "FrameQt.h"
+#include "Frame.h"
 #include "FrameTree.h"
 #include "FrameView.h"
 #include "ResourceRequest.h"
@@ -55,7 +55,7 @@ QWebFrame::QWebFrame(QWebPage *parent, QWebFrameData *frameData)
     d->page = parent;
 
     d->frameLoaderClient = new FrameLoaderClientQt();
-    d->frame = new FrameQt(parent->d->page, frameData->ownerElement, d->frameLoaderClient);
+    d->frame = new Frame(parent->d->page, frameData->ownerElement, d->frameLoaderClient);
     d->frameLoaderClient->setFrame(this, d->frame.get());
 
     d->frameView = new FrameView(d->frame.get());
@@ -83,7 +83,7 @@ QWebFrame::QWebFrame(QWebFrame *parent, QWebFrameData *frameData)
     d->page = parent->d->page;
 
     d->frameLoaderClient = new FrameLoaderClientQt();
-    d->frame = new FrameQt(parent->d->page->d->page, frameData->ownerElement, d->frameLoaderClient);
+    d->frame = new Frame(parent->d->page->d->page, frameData->ownerElement, d->frameLoaderClient);
     d->frameLoaderClient->setFrame(this, d->frame.get());
 
     d->frameView = new FrameView(d->frame.get());
index d9d130c6ca0139d84889272c54fd9655053e97c3..5aa44ca975b85c8129d9ad2e3b1ed7633a4afce3 100644 (file)
@@ -34,7 +34,7 @@
 namespace WebCore
 {
     class FrameLoaderClientQt;
-    class FrameQt;
+    class Frame;
     class FrameView;
     class HTMLFrameOwnerElement;
 }
@@ -50,7 +50,7 @@ public:
         , page(0)
         {}
     WebCore::FrameLoaderClientQt *frameLoaderClient;
-    WTF::RefPtr<WebCore::FrameQt> frame;
+    WTF::RefPtr<WebCore::Frame> frame;
     WTF::RefPtr<WebCore::FrameView> frameView;
     QWebPage *page;
 };
index b12b632c401c2bd2c5c53652012392ec7dd70f5b..8b9eaec0eaf622d98aeaa9981d65710f7740c084 100644 (file)
@@ -28,7 +28,7 @@
 #include "qwebpagehistory.h"
 #include "qwebpagehistory_p.h"
 
-#include "FrameQt.h"
+#include "Frame.h"
 #include "ChromeClientQt.h"
 #include "ContextMenuClientQt.h"
 #include "DragClientQt.h"
index 6b90d3bfa6afb0e54bf18a8ef350bd9056185b58..48fa0d26f90e2ae8694308899dc44139165c0b5e 100644 (file)
@@ -1,3 +1,28 @@
+2007-02-17  Lars Knoll <lars@trolltech.com>
+
+        Reviewed by Maciej.
+
+        Additional coding by Maciej, additional review by Oliver.
+
+        Add stubs for the new methods in ChormeClient and EditorClient,
+        remove all references to FrameQt.
+
+        * Api/qwebframe.cpp:
+        (QWebFrame::QWebFrame):
+        * Api/qwebframe_p.h:
+        * Api/qwebpage.cpp:
+        * WebCoreSupport/ChromeClientQt.cpp:
+        (WebCore::ChromeClientQt::shouldInterruptJavaScript):
+        * WebCoreSupport/ChromeClientQt.h:
+        * WebCoreSupport/EditorClientQt.cpp:
+        (WebCore::EditorClientQt::shouldChangeSelectedRange):
+        (WebCore::EditorClientQt::isEditable):
+        * WebCoreSupport/EditorClientQt.h:
+        * WebCoreSupport/FrameLoaderClientQt.cpp:
+        (WebCore::FrameLoaderClientQt::setFrame):
+        (WebCore::FrameLoaderClientQt::webFrame):
+        * WebCoreSupport/FrameLoaderClientQt.h:
+
 2007-02-18  Oliver Hunt  <oliver@apple.com>
 
         Reviewed by NOBODY (Buildfix).
index 3de81ee05b5430c48f948a256d1c2eeac7a0fbed..3a264727cb4e9e122aa1e30ae9fabd9af3758882 100644 (file)
@@ -262,6 +262,28 @@ bool ChromeClientQt::shouldInterruptJavaScript()
     notImplemented();
 }
 
+bool ChromeClientQt::tabsToLinks() const
+{
+    return false;
+}
+
+IntRect ChromeClientQt::windowResizerRect() const
+{
+    return IntRect();
+}
+
+void ChromeClientQt::addToDirtyRegion(const IntRect&)
+{
+}
+
+void ChromeClientQt::scrollBackingStore(int, int, const IntRect&, const IntRect&)
+{
+}
+
+void ChromeClientQt::updateBackingStore()
+{
+}
+
 }
 
 
index 9971d1c7ed07160fe79a7316488625d6f4be13a9..5f2a5f937575489564a9bc9a597bf56dac76f181 100644 (file)
@@ -92,8 +92,15 @@ namespace WebCore {
         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 void setStatusbarText(const String&);
+
+        virtual bool tabsToLinks() const;
+        virtual IntRect windowResizerRect() const;
+        virtual void addToDirtyRegion(const IntRect&);
+        virtual void scrollBackingStore(int, int, const IntRect&, const IntRect&);
+        virtual void updateBackingStore();
 
         QWebPage* m_webPage;
     };
index 1d2005a7976c564a51a62bb9f409c3b65756774c..9d1f843a6c422a3ff4a4170a04a92dc288881881 100644 (file)
@@ -96,6 +96,12 @@ bool EditorClientQt::shouldInsertText(String, Range*, EditorInsertAction)
     return false;
 }
 
+bool EditorClientQt::shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting)
+{
+    notImplemented();
+    return false;
+}
+
 bool EditorClientQt::shouldApplyStyle(WebCore::CSSStyleDeclaration*,
                                       WebCore::Range*)
 {
@@ -136,10 +142,8 @@ bool EditorClientQt::selectWordBeforeMenuEvent()
 
 bool EditorClientQt::isEditable()
 {
-    Frame* frame = m_page->d->page->focusController()->focusedOrMainFrame();
-    if (!frame)
-        return false;
-    return frame->selectionController()->isContentEditable();
+    // FIXME: should be controllable by a setting in QWebPage
+    return true;
 }
 
 void EditorClientQt::registerCommandForUndo(WTF::PassRefPtr<WebCore::EditCommand>)
@@ -249,6 +253,31 @@ EditorClientQt::EditorClientQt(QWebPage* page)
 {
 }
 
+void EditorClientQt::textFieldDidBeginEditing(Element*)
+{
+}
+
+void EditorClientQt::textFieldDidEndEditing(Element*)
+{
+}
+
+void EditorClientQt::textDidChangeInTextField(Element*)
+{
+}
+
+bool EditorClientQt::doTextFieldCommandFromEvent(Element*, KeyboardEvent*)
+{
+    return false;
+}
+
+void EditorClientQt::textWillBeDeletedInTextField(Element*)
+{
+}
+
+void EditorClientQt::textDidChangeInTextArea(Element*)
+{
+}
+
 }
 
 // vim: ts=4 sw=4 et
index 73933c28b2d62af8b65350726eed42e133777436..75177ad5e29879968a3bfa552aacbfec4d0d06ae 100644 (file)
@@ -61,6 +61,8 @@ public:
     virtual bool shouldEndEditing(Range*);
     virtual bool shouldInsertNode(Node*, Range*, EditorInsertAction);
     virtual bool shouldInsertText(String, Range*, EditorInsertAction);
+    virtual bool shouldChangeSelectedRange(Range* fromRange, Range* toRange, EAffinity, bool stillSelecting);
+
     virtual bool shouldApplyStyle(CSSStyleDeclaration*, Range*);
 
     virtual void didBeginEditing();
@@ -80,6 +82,14 @@ public:
     virtual void redo();
 
     virtual void handleKeyPress(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*);
+
 private:
     QWebPage* m_page;
 };
index 6f3c925cfc717a4bac7da123cfbd9dff427f0b8d..b7a6c16b6bc6cd14f64206fdd5186cc05821a9d3 100644 (file)
@@ -66,7 +66,7 @@ FrameLoaderClientQt::~FrameLoaderClientQt()
 {
 }
 
-void FrameLoaderClientQt::setFrame(QWebFrame *webFrame, FrameQt *frame)
+void FrameLoaderClientQt::setFrame(QWebFrame* webFrame, Frame* frame)
 {
     m_webFrame = webFrame;
     m_frame = frame;
@@ -85,7 +85,7 @@ void FrameLoaderClientQt::setFrame(QWebFrame *webFrame, FrameQt *frame)
             m_webFrame, SIGNAL(titleChanged(const QString&)));
 }
 
-QWebFrame *FrameLoaderClientQt::webFrame() const
+QWebFrameFrameLoaderClientQt::webFrame() const
 {
     return m_webFrame;
 }
index 09845ff6080a2ef256b6c05b398e5777eaaad667..c248cce7e39fd9df204ce10710b98db18c12ebed 100644 (file)
@@ -33,7 +33,7 @@
 
 #include "FrameLoaderClient.h"
 #include "KURL.h"
-#include "FrameQt.h"
+#include "Frame.h"
 #include "FrameLoader.h"
 #include "Shared.h"
 #include "ResourceResponse.h"
@@ -67,8 +67,8 @@ namespace WebCore {
     public:
         FrameLoaderClientQt();
         ~FrameLoaderClientQt();
-        void setFrame(QWebFrame *webFrame, FrameQt *frame);
-        QWebFrame *webFrame() const;
+        void setFrame(QWebFrame* webFrame, Frame* frame);
+        QWebFramewebFrame() const;
 
         virtual bool hasWebView() const; // mainly for assertions
         virtual bool hasFrameView() const; // ditto