WebCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Jul 2006 15:09:19 +0000 (15:09 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 15 Jul 2006 15:09:19 +0000 (15:09 +0000)
        Reviewed by John Sullivan.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9928
          REGRESSION: Text Encoding menu inoperative (after gcc protocol build fix)

        * bindings/objc/DOM.mm:
        (-[DOMNode addEventListener:::]): Moved into DOMEventTarget category.
        (-[DOMNode removeEventListener:::]): Ditto.
        (-[DOMNode dispatchEvent:]): Ditto.

        * WebCore.xcodeproj/project.pbxproj: Allow Xcode to do its thing.

WebKit:

        Reviewed by John Sullivan.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9928
          REGRESSION: Text Encoding menu inoperative (after gcc protocol build fix)

        * WebView/WebHTMLView.m:
        (-[WebHTMLView _documentRange]): Moved into WebHTMLViewFileInternal category.
        (-[WebHTMLView selectionRect]): Moved into WebDocumentPrivateProtocols category.
        (-[WebHTMLView selectionView]): Ditto.
        (-[WebHTMLView selectionImageForcingWhiteText:]): Ditto.
        (-[WebHTMLView selectionImageRect]): Ditto.
        (-[WebHTMLView pasteboardTypesForSelection]): Ditto.
        (-[WebHTMLView selectAll]): Ditto.
        (-[WebHTMLView deselectAll]): Ditto.
        (-[WebHTMLView string]): Ditto.
        (-[WebHTMLView _attributeStringFromDOMRange:]): Ditto.
        (-[WebHTMLView attributedString]): Ditto.
        (-[WebHTMLView selectedString]): Ditto.
        (-[WebHTMLView selectedAttributedString]): Ditto.
        (-[WebHTMLView supportsTextEncoding]): Ditto.
        (-[WebHTMLView _canProcessDragWithDraggingInfo:]): Moved into WebDocumentInternalProtocols.
        (-[WebHTMLView _isMoveDrag]): Ditto.
        (-[WebHTMLView _isNSColorDrag:]): Ditto.
        (-[WebHTMLView draggingUpdatedWithDraggingInfo:actionMask:]): Ditto.
        (-[WebHTMLView draggingCancelledWithDraggingInfo:]): Ditto.
        (-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): Ditto.
        (-[WebHTMLView elementAtPoint:]): Ditto.
        (-[WebHTMLView elementAtPoint:allowShadowContent:]): Ditto.

        * WebKit.xcodeproj/project.pbxproj: Let Xcode 2.3 do its thing.

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

WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/bindings/objc/DOM.mm
WebKit/ChangeLog
WebKit/WebKit.xcodeproj/project.pbxproj
WebKit/WebView/WebHTMLView.m

index 1156e0ffa1fdd4ba00f0323692b2bbd3d0271de9..b4fe233f71895afd1a0d2a83f57d989d2d4edc73 100644 (file)
@@ -1,3 +1,17 @@
+2006-07-15  Darin Adler  <darin@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9928
+          REGRESSION: Text Encoding menu inoperative (after gcc protocol build fix)
+
+        * bindings/objc/DOM.mm:
+        (-[DOMNode addEventListener:::]): Moved into DOMEventTarget category.
+        (-[DOMNode removeEventListener:::]): Ditto.
+        (-[DOMNode dispatchEvent:]): Ditto.
+
+        * WebCore.xcodeproj/project.pbxproj: Allow Xcode to do its thing.
+
 2006-07-15  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Anders.
index 7401139de4670a56b2c2c753f01dfd0a92ae9087..5fe7223dad9287b83cc3e944aa38cd6105a6433b 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.3";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
index 80684f8c10da7127387f1302428093567e30f5b3..f86629de827d3f2f0b75a25b620c974dc90f2ddf 100644 (file)
@@ -416,36 +416,6 @@ static ListenerMap* listenerMap;
     raiseOnDOMError(ec);
 }
 
-- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
-{
-    if (![self _node]->isEventTargetNode())
-        raiseDOMException(DOM_NOT_SUPPORTED_ERR);
-    
-    EventListener *wrapper = ObjCEventListener::create(listener);
-    EventTargetNodeCast([self _node])->addEventListener(type, wrapper, useCapture);
-    wrapper->deref();
-}
-
-- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
-{
-    if (![self _node]->isEventTargetNode())
-        raiseDOMException(DOM_NOT_SUPPORTED_ERR);
-
-    if (EventListener *wrapper = ObjCEventListener::find(listener))
-        EventTargetNodeCast([self _node])->removeEventListener(type, wrapper, useCapture);
-}
-
-- (BOOL)dispatchEvent:(DOMEvent *)event
-{
-    if (![self _node]->isEventTargetNode())
-        raiseDOMException(DOM_NOT_SUPPORTED_ERR);
-
-    ExceptionCode ec = 0;
-    BOOL result = EventTargetNodeCast([self _node])->dispatchEvent([event _event], ec);
-    raiseOnDOMError(ec);
-    return result;
-}
-
 - (NSRect)boundingBox
 {
     WebCore::RenderObject *renderer = [self _node]->renderer();
@@ -653,6 +623,40 @@ static Class elementClass(const AtomicString& tagName)
 
 @end
 
+@implementation DOMNode (DOMEventTarget)
+
+- (void)addEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
+{
+    if (![self _node]->isEventTargetNode())
+        raiseDOMException(DOM_NOT_SUPPORTED_ERR);
+    
+    EventListener *wrapper = ObjCEventListener::create(listener);
+    EventTargetNodeCast([self _node])->addEventListener(type, wrapper, useCapture);
+    wrapper->deref();
+}
+
+- (void)removeEventListener:(NSString *)type :(id <DOMEventListener>)listener :(BOOL)useCapture
+{
+    if (![self _node]->isEventTargetNode())
+        raiseDOMException(DOM_NOT_SUPPORTED_ERR);
+
+    if (EventListener *wrapper = ObjCEventListener::find(listener))
+        EventTargetNodeCast([self _node])->removeEventListener(type, wrapper, useCapture);
+}
+
+- (BOOL)dispatchEvent:(DOMEvent *)event
+{
+    if (![self _node]->isEventTargetNode())
+        raiseDOMException(DOM_NOT_SUPPORTED_ERR);
+
+    ExceptionCode ec = 0;
+    BOOL result = EventTargetNodeCast([self _node])->dispatchEvent([event _event], ec);
+    raiseOnDOMError(ec);
+    return result;
+}
+
+@end
+
 //------------------------------------------------------------------------------------------
 // DOMNamedNodeMap
 
index c0f6639c79ccc2987e5230f9d1b3dffc6fe586b5..acd40f02fe22ac33d224cd8b3e6c17c7510dd16b 100644 (file)
@@ -1,3 +1,36 @@
+2006-07-15  Darin Adler  <darin@apple.com>
+
+        Reviewed by John Sullivan.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9928
+          REGRESSION: Text Encoding menu inoperative (after gcc protocol build fix)
+
+        * WebView/WebHTMLView.m:
+        (-[WebHTMLView _documentRange]): Moved into WebHTMLViewFileInternal category.
+        (-[WebHTMLView selectionRect]): Moved into WebDocumentPrivateProtocols category.
+        (-[WebHTMLView selectionView]): Ditto.
+        (-[WebHTMLView selectionImageForcingWhiteText:]): Ditto.
+        (-[WebHTMLView selectionImageRect]): Ditto.
+        (-[WebHTMLView pasteboardTypesForSelection]): Ditto.
+        (-[WebHTMLView selectAll]): Ditto.
+        (-[WebHTMLView deselectAll]): Ditto.
+        (-[WebHTMLView string]): Ditto.
+        (-[WebHTMLView _attributeStringFromDOMRange:]): Ditto.
+        (-[WebHTMLView attributedString]): Ditto.
+        (-[WebHTMLView selectedString]): Ditto.
+        (-[WebHTMLView selectedAttributedString]): Ditto.
+        (-[WebHTMLView supportsTextEncoding]): Ditto.
+        (-[WebHTMLView _canProcessDragWithDraggingInfo:]): Moved into WebDocumentInternalProtocols.
+        (-[WebHTMLView _isMoveDrag]): Ditto.
+        (-[WebHTMLView _isNSColorDrag:]): Ditto.
+        (-[WebHTMLView draggingUpdatedWithDraggingInfo:actionMask:]): Ditto.
+        (-[WebHTMLView draggingCancelledWithDraggingInfo:]): Ditto.
+        (-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): Ditto.
+        (-[WebHTMLView elementAtPoint:]): Ditto.
+        (-[WebHTMLView elementAtPoint:allowShadowContent:]): Ditto.
+
+        * WebKit.xcodeproj/project.pbxproj: Let Xcode 2.3 do its thing.
+
 === Safari-521.17 ===
 
 2006-07-14  Timothy Hatcher  <timothy@apple.com>
@@ -12,7 +45,7 @@
         GMail Editor: Operations that use drop down menus blow away the selection
 
         * WebView/WebHTMLView.m:
-        (-[NSArray maintainsInactiveSelection]): Maintain an inactive selection
+        (-[WebHTMLView maintainsInactiveSelection]): Maintain an inactive selection
         when resigning as first responder if the selection is editable
         or if the WebView tells us to.
         * WebView/WebView.m:
@@ -43,7 +76,7 @@
           <rdar://problem/4604703>
           REGRESSION: Focus not removed from password field after ctrl-click in text field
 
-        * WebView/WebHTMLView.m: (-[NSArray menuForEvent:]): Set handlingMouseDownEvent to
+        * WebView/WebHTMLView.m: (-[WebHTMLView menuForEvent:]): Set handlingMouseDownEvent to
         YES while calling sendContextMenuEvent: on the bridge.
 
 2006-07-14  Timothy Hatcher  <timothy@apple.com>
         GMail Editor: Operations that use drop down menus blow away the selection
         
         * WebView/WebHTMLView.m:
-        (-[NSArray maintainsInactiveSelection]): Maintain an inactive selection
+        (-[WebHTMLView maintainsInactiveSelection]): Maintain an inactive selection
         when resigning as first responder if the selection is editable
         or if the WebView tells us to.
         * WebView/WebView.m:
         * WebView/WebHTMLView.m:  Pass granularity to WebCore to handle expansion
         (-[WebHTMLView _deleteRange:killRing:prepend:smartDeleteOK:deletionAction:granularity:]):
         (-[WebHTMLView _deleteSelection]):
-        (-[NSArray _deleteWithDirection:granularity:killRing:isTypingAction:]):
-        (-[NSArray deleteToMark:]):
+        (-[WebHTMLView _deleteWithDirection:granularity:killRing:isTypingAction:]):
+        (-[WebHTMLView deleteToMark:]):
 
 2006-07-07  Brady Eidson  <beidson@apple.com>
 
         * WebView/WebHTMLView.m: Moved code that expanded a selection when the delete
         key is pressed over to WebCore so we can be more intelligent about how to handle it
         (-[WebHTMLView _deleteRange:killRing:prepend:smartDeleteOK:deletionAction:]):
-        (-[NSArray _deleteWithDirection:granularity:killRing:isTypingAction:]):
+        (-[WebHTMLView _deleteWithDirection:granularity:killRing:isTypingAction:]):
 
 2006-07-07  John Sullivan  <sullivan@apple.com>
 
         (-[WebFrameView finalize]):
         * WebView/WebHTMLView.m:
         (-[WebHTMLView close]):
-        (-[NSArray dealloc]):
-        (-[NSArray finalize]):
+        (-[WebHTMLView dealloc]):
+        (-[WebHTMLView finalize]):
         * WebView/WebHTMLViewInternal.h:
         * WebView/WebHTMLViewPrivate.h:
         * WebView/WebScriptDebugDelegate.m:
         * WebView/WebHTMLRepresentation.m:
         (-[WebHTMLRepresentation finishedLoadingWithDataSource:]):
         * WebView/WebHTMLView.m:
-        (-[NSArray _interceptEditingKeyEvent:]):
+        (-[WebHTMLView _interceptEditingKeyEvent:]):
         * WebView/WebView.m:
         (-[WebViewPrivate init]):
         (-[WebView _autoscrollForDraggingInfo:timeDelta:]):
         * WebView/WebHTMLView.m:
         (-[WebHTMLView _frameOrBoundsChanged]):
         use _UIDelegateForwarder mechanism to notify delegate that scrolling occurred
-        (-[NSArray drawSingleRect:]):
+        (-[WebHTMLView drawSingleRect:]):
         use _UIDelegateForwarder mechanism instead of checking respondsToSelector stuff
         here (that's packaged up nicely by the forwarder mechanism)
         
 
         * WebView/WebHTMLView.m:
         (-[WebHTMLView _updateActiveState]):
-        (-[NSArray viewDidMoveToWindow]):
-        (-[NSArray windowDidBecomeKey:]):
-        (-[NSArray windowDidResignKey:]):
-        (-[NSArray becomeFirstResponder]):
-        (-[NSArray resignFirstResponder]):
+        (-[WebHTMLView viewDidMoveToWindow]):
+        (-[WebHTMLView windowDidBecomeKey:]):
+        (-[WebHTMLView windowDidResignKey:]):
+        (-[WebHTMLView becomeFirstResponder]):
+        (-[WebHTMLView resignFirstResponder]):
         (-[WebHTMLView _formControlIsBecomingFirstResponder:]):
         (-[WebHTMLView _formControlIsResigningFirstResponder:]):
         * WebView/WebHTMLViewPrivate.h:
         Change dragging code to not assume that the dragged node is in the current view's document.
         Added checks that the node is an element in a couple places and coordinate conversions.
         (-[WebHTMLView _mayStartDragAtEventLocation:]): Forward to the top HTML view.
-        (-[NSArray addMouseMovedObserver]): Change to do nothing when the dataSource field is 0,
+        (-[WebHTMLView addMouseMovedObserver]): Change to do nothing when the dataSource field is 0,
         since we now use the dataSource field to get to the WebView.
-        (-[NSArray removeMouseMovedObserver]): Added a comment.
-        (-[NSArray dragImage:at:offset:event:pasteboard:source:slideBack:]):
+        (-[WebHTMLView removeMouseMovedObserver]): Added a comment.
+        (-[WebHTMLView dragImage:at:offset:event:pasteboard:source:slideBack:]):
         Forward to the top HTML view.
-        (-[NSArray draggingSourceOperationMaskForLocal:]): Assert that it's the top HTML view.
-        (-[NSArray draggedImage:movedTo:]): Ditto.
-        (-[NSArray draggedImage:endedAt:operation:]): Ditto.
-        (-[NSArray namesOfPromisedFilesDroppedAtDestination:]): Ditto.
-        (-[NSArray _canProcessDragWithDraggingInfo:]): Ditto.
-        (-[NSArray _isMoveDrag]): Ditto.
-        (-[NSArray draggingUpdatedWithDraggingInfo:actionMask:]): Ditto.
-        (-[NSArray draggingCancelledWithDraggingInfo:]): Ditto.
-        (-[NSArray concludeDragForDraggingInfo:actionMask:]): Ditto. Also added code to work
+        (-[WebHTMLView draggingSourceOperationMaskForLocal:]): Assert that it's the top HTML view.
+        (-[WebHTMLView draggedImage:movedTo:]): Ditto.
+        (-[WebHTMLView draggedImage:endedAt:operation:]): Ditto.
+        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): Ditto.
+        (-[WebHTMLView _canProcessDragWithDraggingInfo:]): Ditto.
+        (-[WebHTMLView _isMoveDrag]): Ditto.
+        (-[WebHTMLView draggingUpdatedWithDraggingInfo:actionMask:]): Ditto.
+        (-[WebHTMLView draggingCancelledWithDraggingInfo:]): Ditto.
+        (-[WebHTMLView concludeDragForDraggingInfo:actionMask:]): Ditto. Also added code to work
         with the appropriate bridge when receiving a drag. This fixes the problem where the
         top level frame got a selection intended for the inner frame; the source of the bug.
-        (-[NSArray elementAtPoint:allowShadowContent:]): Added code to convert the coordinates
+        (-[WebHTMLView elementAtPoint:allowShadowContent:]): Added code to convert the coordinates
         so this works properly when returning an element from an inner frame.
-        (-[NSArray setDataSource:]): Added a call to addMouseMovedObserver, needed now that
+        (-[WebHTMLView setDataSource:]): Added a call to addMouseMovedObserver, needed now that
         addMouseMovedObserver won't do anything if called when dataSource is nil.
         (-[WebHTMLView _delegateDragSourceActionMask]): Forward to the top HTML view.
 
         * WebView/WebFrame.m:
         (-[WebFrame _sendRemainingDelegateMessagesWithIdentifier:response:length:error:]):
         * WebView/WebHTMLView.m:
-        (-[NSArray drawRect:]):
+        (-[WebHTMLView drawRect:]):
         (-[WebHTMLView characterIndexForPoint:]):
         (-[WebHTMLView conversationIdentifier]):
         * WebView/WebResourceLoadDelegate.h:
         Switch to use new text field implementation for <textarea>
 
         * WebView/WebHTMLView.m:
-        (-[NSArray insertNewline:]): If we're in plain text mode, insert a line break instead of a paragraph separator.
-        (-[NSArray insertParagraphSeparator:]): ditto.
+        (-[WebHTMLView insertNewline:]): If we're in plain text mode, insert a line break instead of a paragraph separator.
+        (-[WebHTMLView insertParagraphSeparator:]): ditto.
         * WebView/WebView.m: (-[WebView _menuForElement:defaultItems:]):
         Checks for textareas as well as textfields before allowing the delegate to control
         the context menu.  This won't affect the old textareas because AppKit handles those context menus.
         Manual test: manual-tests/dom-manipulation-on-resize.html
 
         * WebView/WebHTMLView.m:
-        (-[NSArray layoutToMinimumPageWidth:maximumPageWidth:adjustingViewSize:]): Relayout if necessary
+        (-[WebHTMLView layoutToMinimumPageWidth:maximumPageWidth:adjustingViewSize:]): Relayout if necessary
         after sending the resize event.
 
 2006-05-12  Maciej Stachowiak  <mjs@apple.com>
         * WebView/WebFrameView.m:
         (-[WebFrameView initWithFrame:]):
         * WebView/WebHTMLView.m:
-        (-[NSArray _addToStyle:fontA:fontB:]):
+        (-[WebHTMLView _addToStyle:fontA:fontB:]):
         * WebView/WebTextView.m:
         (-[WebTextView setFixedWidthFont]):
         * WebView/WebView.m:
         (-[WebHTMLView _webView]):
         (-[WebHTMLView _frameView]):
         (-[WebHTMLView _web_firstResponderCausesFocusDisplay]):
-        (-[NSArray becomeFirstResponder]):
-        (-[NSArray setDataSource:]):
-        (-[NSArray pageUp:]):
-        (-[NSArray pageDown:]):
-        (-[NSArray pageUpAndModifySelection:]):
-        (-[NSArray pageDownAndModifySelection:]):
+        (-[WebHTMLView becomeFirstResponder]):
+        (-[WebHTMLView setDataSource:]):
+        (-[WebHTMLView pageUp:]):
+        (-[WebHTMLView pageDown:]):
+        (-[WebHTMLView pageUpAndModifySelection:]):
+        (-[WebHTMLView pageDownAndModifySelection:]):
         (-[WebHTMLView _frame]):
         * WebView/WebHTMLViewInternal.h:
         * WebView/WebImageView.h:
         * WebView/WebHTMLRepresentation.m:
         * WebView/WebHTMLView.m:
         (-[WebHTMLView _lookUpInDictionaryFromMenu:]):
-        (-[NSArray drawSingleRect:]):
-        (-[NSArray namesOfPromisedFilesDroppedAtDestination:]):
-        (-[NSArray _scaleFactorForPrintOperation:]):
-        (-[NSArray deleteBackwardByDecomposingPreviousCharacter:]):
-        (-[NSArray checkSpelling:]):
-        (-[NSArray showGuessPanel:]):
-        (-[NSArray _changeSpellingToWord:]):
-        (-[NSArray ignoreSpelling:]):
-        (-[NSArray performFindPanelAction:]):
+        (-[WebHTMLView drawSingleRect:]):
+        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]):
+        (-[WebHTMLView _scaleFactorForPrintOperation:]):
+        (-[WebHTMLView deleteBackwardByDecomposingPreviousCharacter:]):
+        (-[WebHTMLView checkSpelling:]):
+        (-[WebHTMLView showGuessPanel:]):
+        (-[WebHTMLView _changeSpellingToWord:]):
+        (-[WebHTMLView ignoreSpelling:]):
+        (-[WebHTMLView performFindPanelAction:]):
         (-[WebTextCompleteController doCompletion]):
         * WebView/WebImageView.m:
         * WebView/WebLoader.m:
 
         Test: manual-tests/tabbing-input-google.html
 
-        * WebView/WebHTMLView.m: (-[NSArray resignFirstResponder]):
+        * WebView/WebHTMLView.m: (-[WebHTMLView resignFirstResponder]):
         When resigning first responder, reset willBecomeFirstResponderForNodeFocus, so when the WebHTMLView gets focus again
         it knows it can start moving through the tab cycle.
 
         * fast/dom/inner-text-001.html: Added.
 
         * WebView/WebHTMLView.m:
-        (-[NSArray validateUserInterfaceItem:]):
-        (-[NSArray moveToBeginningOfSentence:]):
-        (-[NSArray moveToBeginningOfSentenceAndModifySelection:]):
-        (-[NSArray moveToEndOfSentence:]):
-        (-[NSArray moveToEndOfSentenceAndModifySelection:]):
-        (-[NSArray selectSentence:]):
+        (-[WebHTMLView validateUserInterfaceItem:]):
+        (-[WebHTMLView moveToBeginningOfSentence:]):
+        (-[WebHTMLView moveToBeginningOfSentenceAndModifySelection:]):
+        (-[WebHTMLView moveToEndOfSentence:]):
+        (-[WebHTMLView moveToEndOfSentenceAndModifySelection:]):
+        (-[WebHTMLView selectSentence:]):
         * WebView/WebView.m:
         * WebView/WebViewPrivate.h:
         Add sentence navigation and selection.
         Reviewed by darin
 
         * WebView/WebHTMLView.m:
-        (-[NSArray drawSingleRect:]):
-        (-[NSArray drawRect:]):
+        (-[WebHTMLView drawSingleRect:]):
+        (-[WebHTMLView drawRect:]):
 
 2006-04-07  Maciej Stachowiak  <mjs@apple.com>
 
         has already been set, so it should not move focus forward or
         backward inside it.
         * WebView/WebHTMLView.m:
-        (-[NSArray needsPanelToBecomeKey]): Override to return YES, oddly enough this
+        (-[WebHTMLView needsPanelToBecomeKey]): Override to return YES, oddly enough this
         is the right way to tell AppKit that you should be in the tab cycle loop.
-        (-[NSArray becomeFirstResponder]): Don't move forward or back in tab cycle
+        (-[WebHTMLView becomeFirstResponder]): Don't move forward or back in tab cycle
         when this becomeFirstResponder is for tabbing from a control in the page.
         (-[WebHTMLView _willMakeFirstResponderForNodeFocus]): Note that the next
         time this view becomes first responder, it will be for in-page focus 
         (-[WebHTMLView _canDecreaseSelectionListLevel]): Ditto.
         (-[WebHTMLView _increaseSelectionListLevel]):
         (-[WebHTMLView _decreaseSelectionListLevel]):
-        (-[NSArray validateUserInterfaceItem:]): 
+        (-[WebHTMLView validateUserInterfaceItem:]): 
         Split rich text editing actions off from ones that can be applied anywhere.
-        (-[NSArray _applyStyleToSelection:withUndoAction:]):
-        (-[NSArray _applyParagraphStyleToSelection:withUndoAction:]):
-        (-[NSArray _alignSelectionUsingCSSValue:withUndoAction:]):
+        (-[WebHTMLView _applyStyleToSelection:withUndoAction:]):
+        (-[WebHTMLView _applyParagraphStyleToSelection:withUndoAction:]):
+        (-[WebHTMLView _alignSelectionUsingCSSValue:withUndoAction:]):
         * WebView/WebHTMLViewPrivate.h:
 
 2006-03-29  Tim Omernick  <timo@apple.com>
         Remove assertion that _inNextKeyViewOutsideWebFrameViews should always be false here.
         
         * WebView/WebHTMLView.m:
-        (-[NSArray nextValidKeyView]):
+        (-[WebHTMLView nextValidKeyView]):
         Removed assertion that the frame should never be the main frame here.
 
 2006-03-27  Tim Omernick  <timo@apple.com>
 
         * WebView/WebDocumentInternal.h: Added elementAtPoint:allowShadowContent:
         * WebView/WebHTMLView.m:
-        (-[NSArray elementAtPoint:]): Does not allow shadow content.  This way, by default, callers would get the input element instead of the inner div.
-        (-[NSArray elementAtPoint:allowShadowContent:]): Allows callers to specify whether or not the element can be a shadow node.
+        (-[WebHTMLView elementAtPoint:]): Does not allow shadow content.  This way, by default, callers would get the input element instead of the inner div.
+        (-[WebHTMLView elementAtPoint:allowShadowContent:]): Allows callers to specify whether or not the element can be a shadow node.
         (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]): Allows shadow content when getting element.
         (-[WebHTMLView _mayStartDragAtEventLocation:]): ditto.
-        (-[NSArray _isSelectionEvent:]): ditto.
-        (-[NSArray _canProcessDragWithDraggingInfo:]): ditto.
+        (-[WebHTMLView _isSelectionEvent:]): ditto.
+        (-[WebHTMLView _canProcessDragWithDraggingInfo:]): ditto.
         * WebView/WebFrame.m: (-[WebFrame _actionInformationForNavigationType:event:originalURL:]): Does not allow shadow content when getting element.
         * WebView/WebImageView.m: (-[WebImageView elementAtPoint:allowShadowContent:]): Added to conform to the WebDocumentElement protocol.
         * WebView/WebPDFView.m: (-[WebPDFView elementAtPoint:allowShadowContent:]): ditto.
         * WebView/WebHTMLView.m:
         (-[WebHTMLView _updateMouseoverWithEvent:]):
         (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
-        (-[NSArray elementAtPoint:]):
+        (-[WebHTMLView elementAtPoint:]):
         * WebView/WebView.m:
         * WebView/WebViewPrivate.h:
 
 
         * WebView/WebHTMLView.m:
         (-[WebHTMLView _updateFocusState]):
-        (-[NSArray viewDidMoveToWindow]):
-        (-[NSArray windowDidBecomeKey:]):
-        (-[NSArray windowDidResignKey:]):
-        (-[NSArray dragImage:at:offset:event:pasteboard:source:slideBack:]):
-        (-[NSArray becomeFirstResponder]):
-        (-[NSArray resignFirstResponder]):
+        (-[WebHTMLView viewDidMoveToWindow]):
+        (-[WebHTMLView windowDidBecomeKey:]):
+        (-[WebHTMLView windowDidResignKey:]):
+        (-[WebHTMLView dragImage:at:offset:event:pasteboard:source:slideBack:]):
+        (-[WebHTMLView becomeFirstResponder]):
+        (-[WebHTMLView resignFirstResponder]):
         (-[WebHTMLView _formControlIsResigningFirstResponder:]):
         * WebView/WebHTMLViewInternal.h:
         * WebView/WebHTMLViewPrivate.h:
index eecf057b3dddd087a419aef969b0d6645b530858..729bc80eb84be4a44a2d4baf7d596e39619ebc2a 100644 (file)
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
-                       compatibilityVersion = "Xcode 2.3";
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                9398100A0824BF01008DF038 /* WebKit */,
                        );
index 04f057a6375e96f62b42b304990ebcdb52fb1f86..dfff3712520eb9f0415998fbafa2b39aacf25c51 100644 (file)
@@ -197,6 +197,8 @@ void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
 - (BOOL)_canSmartReplaceWithPasteboard:(NSPasteboard *)pasteboard;
 - (NSView *)_hitViewForEvent:(NSEvent *)event;
 - (void)_writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard cachedAttributedString:(NSAttributedString *)attributedString;
+- (DOMRange *)_documentRange;
+- (WebFrameBridge *)_bridge;
 @end
 
 @interface WebHTMLView (WebForwardDeclaration) // FIXME: Put this in a normal category and stop doing the forward declaration trick.
@@ -265,6 +267,11 @@ void *_NSSoftLinkingGetFrameworkFuncPtr(NSString *inUmbrellaFrameworkName,
 
 @implementation WebHTMLView (WebHTMLViewFileInternal)
 
+- (DOMRange *)_documentRange
+{
+    return [[[self _bridge] DOMDocument] _documentRange];
+}
+
 - (BOOL)_imageExistsAtPaths:(NSArray *)paths
 {
     NSArray *imageMIMETypes = [WebFrameBridge supportedImageResourceMIMETypes];
@@ -1986,22 +1993,6 @@ static WebHTMLView *lastHitView = nil;
     [NSPasteboard _web_setFindPasteboardString:[self selectedString] withOwner:self];
 }
 
-- (NSArray *)pasteboardTypesForSelection
-{
-    if ([self _canSmartCopyOrDelete]) {
-        NSMutableArray *types = [[[[self class] _selectionPasteboardTypes] mutableCopy] autorelease];
-        [types addObject:WebSmartPastePboardType];
-        return types;
-    } else {
-        return [[self class] _selectionPasteboardTypes];
-    }
-}
-
-- (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard
-{
-    [self _writeSelectionWithPasteboardTypes:types toPasteboard:pasteboard cachedAttributedString:nil];
-}
-
 - (BOOL)writeSelectionToPasteboard:(NSPasteboard *)pasteboard types:(NSArray *)types
 {
     [pasteboard declareTypes:types owner:nil];
@@ -2043,31 +2034,6 @@ static WebHTMLView *lastHitView = nil;
     [self centerSelectionInVisibleArea:sender];
 }
 
-- (NSRect)selectionRect
-{
-    return [[self _bridge] selectionRect];
-}
-
-- (NSView *)selectionView
-{
-    return self;
-}
-
-- (NSImage *)selectionImageForcingWhiteText:(BOOL)forceWhiteText
-{
-    if ([self _hasSelection])
-        return [[self _bridge] selectionImageForcingWhiteText:forceWhiteText];
-
-    return nil;
-}
-
-- (NSRect)selectionImageRect
-{
-    if ([self _hasSelection])
-        return [[self _bridge] visibleSelectionRect];
-    return NSZeroRect;
-}
-
 - (BOOL)validateUserInterfaceItem:(id <NSValidatedUserInterfaceItem>)item 
 {
     SEL action = [item action];
@@ -2559,67 +2525,6 @@ static WebHTMLView *lastHitView = nil;
     return [[self _bridge] searchFor:string direction:forward caseSensitive:caseFlag wrap:wrapFlag];
 }
 
-- (DOMRange *)_documentRange
-{
-    return [[[self _bridge] DOMDocument] _documentRange];
-}
-
-- (NSString *)string
-{
-    return [[self _bridge] stringForRange:[self _documentRange]];
-}
-
-- (NSAttributedString *)_attributeStringFromDOMRange:(DOMRange *)range
-{
-    NSAttributedString *attributedString;
-#if !LOG_DISABLED        
-    double start = CFAbsoluteTimeGetCurrent();
-#endif    
-    attributedString = [[[NSAttributedString alloc] _initWithDOMRange:range] autorelease];
-#if !LOG_DISABLED
-    double duration = CFAbsoluteTimeGetCurrent() - start;
-    LOG(Timing, "creating attributed string from selection took %f seconds.", duration);
-#endif
-    return attributedString;
-}
-
-- (NSAttributedString *)attributedString
-{
-    WebFrameBridge *bridge = [self _bridge];
-    DOMDocument *document = [bridge DOMDocument];
-    NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]];
-    if (attributedString == nil) {
-        attributedString = [bridge attributedStringFrom:document startOffset:0 to:nil endOffset:0];
-    }
-    return attributedString;
-}
-
-- (NSString *)selectedString
-{
-    return [[self _bridge] selectedString];
-}
-
-- (NSAttributedString *)selectedAttributedString
-{
-    WebFrameBridge *bridge = [self _bridge];
-    NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[self _selectedRange]];
-    if (attributedString == nil) {
-        attributedString = [bridge selectedAttributedString];
-    }
-    return attributedString;
-}
-
-- (void)selectAll
-{
-    [[self _bridge] selectAll];
-}
-
-// Remove the selection.
-- (void)deselectAll
-{
-    [[self _bridge] deselectAll];
-}
-
 - (void)deselectText
 {
     [[self _bridge] deselectText];
@@ -2997,251 +2902,91 @@ done:
     return [NSArray arrayWithObject:[path lastPathComponent]];
 }
 
-- (BOOL)_canProcessDragWithDraggingInfo:(id <NSDraggingInfo>)draggingInfo
+- (void)mouseUp:(NSEvent *)event
 {
-    ASSERT([self _isTopHTMLView]);
+    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
+    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
+        return;
 
-    NSPasteboard *pasteboard = [draggingInfo draggingPasteboard];
-    NSMutableSet *types = [NSMutableSet setWithArray:[pasteboard types]];
-    [types intersectSet:[NSSet setWithArray:[WebHTMLView _insertablePasteboardTypes]]];
-    if ([types count] == 0)
-        return NO;
-    if ([types count] == 1
-            && [types containsObject:NSFilenamesPboardType]
-            && ![self _imageExistsAtPaths:[pasteboard propertyListForType:NSFilenamesPboardType]])
-        return NO;
+    [self retain];
 
-    NSPoint point = [self convertPoint:[draggingInfo draggingLocation] fromView:nil];
-    NSDictionary *element = [self elementAtPoint:point allowShadowContent:YES];
-    if ([[self _webView] isEditable] || [[element objectForKey:WebElementDOMNodeKey] isContentEditable]) {
-        // Can't drag onto the selection being dragged.
-        if (_private->initiatedDrag && [[element objectForKey:WebElementIsSelectedKey] boolValue])
-            return NO;
-        return YES;
-    }
+    [self _stopAutoscrollTimer];
+    [[self _bridge] mouseUp:event];
+    [self _updateMouseoverWithFakeEvent];
 
-    return NO;
+    [self release];
 }
 
-- (BOOL)_isMoveDrag
+- (void)mouseMovedNotification:(NSNotification *)notification
 {
-    ASSERT([self _isTopHTMLView]);
-    return _private->initiatedDrag
-        && [self _isEditable] && [self _hasSelection]
-        && !([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask);
+    [self _updateMouseoverWithEvent:[[notification userInfo] objectForKey:@"NSEvent"]];
 }
 
-- (BOOL)_isNSColorDrag:(id <NSDraggingInfo>)draggingInfo
+// returning YES from this method is the way we tell AppKit that it is ok for this view
+// to be in the key loop even when "tab to all controls" is not on.
+- (BOOL)needsPanelToBecomeKey
 {
-    return [[[draggingInfo draggingPasteboard] types] containsObject:NSColorPboardType];
+    return YES;
 }
 
-- (NSDragOperation)draggingUpdatedWithDraggingInfo:(id <NSDraggingInfo>)draggingInfo actionMask:(unsigned int)actionMask
+- (NSView *)nextValidKeyView
 {
-    ASSERT([self _isTopHTMLView]);
-
-    NSDragOperation operation = NSDragOperationNone;
-    if (actionMask & WebDragDestinationActionDHTML)
-        operation = [[self _bridge] dragOperationForDraggingInfo:draggingInfo];
-    _private->webCoreHandlingDrag = (operation != NSDragOperationNone);
-
-    if ((actionMask & WebDragDestinationActionEdit) && !_private->webCoreHandlingDrag && [self _canProcessDragWithDraggingInfo:draggingInfo]) {
-        if ([self _isNSColorDrag:draggingInfo])
-            operation = NSDragOperationGeneric;
-        else {
-            WebView *webView = [self _webView];
-            [webView moveDragCaretToPoint:[webView convertPoint:[draggingInfo draggingLocation] fromView:nil]];
-            operation = [self _isMoveDrag] ? NSDragOperationMove : NSDragOperationCopy;
+    NSView *view = nil;
+    BOOL lookInsideWebFrameViews = YES;
+    if ([self isHiddenOrHasHiddenAncestor]) {
+        lookInsideWebFrameViews = NO;
+    } else if ([self _frame] == [[self _webView] mainFrame]) {
+        // Check for case where first responder is last frame in a frameset, and we are
+        // the top-level documentView.
+        NSResponder *firstResponder = [[self window] firstResponder];
+        if ((firstResponder != self) && [firstResponder isKindOfClass:[WebHTMLView class]] && ([(NSView *)firstResponder nextKeyView] == nil)) {
+            lookInsideWebFrameViews = NO;
         }
-    } else
-        [[self _webView] removeDragCaret];
-
-    return operation;
+    }
+    
+    if (lookInsideWebFrameViews) {
+        view = [[self _bridge] nextKeyViewInsideWebFrameViews];
+    }
+    
+    if (view == nil) {
+        view = [super nextValidKeyView];
+        // If there's no next view wired up, we must be in the last subframe, or we are
+        // being called at an unusual time when the views have not yet been wired together.
+        // There's no direct link to the next valid key view; get it from the bridge.
+        // Note that view == self here when nextKeyView returns nil, due to AppKit oddness.
+        // We'll check for both nil and self in case the AppKit oddness goes away.
+        // WebFrameView has this same kind of logic for the previousValidKeyView case.
+        if (view == nil || view == self) {
+            view = [[self _bridge] nextValidKeyViewOutsideWebFrameViews];
+        }
+    }
+        
+    return view;
 }
 
-- (void)draggingCancelledWithDraggingInfo:(id <NSDraggingInfo>)draggingInfo
+- (NSView *)previousValidKeyView
 {
-    ASSERT([self _isTopHTMLView]);
-
-    [[self _bridge] dragExitedWithDraggingInfo:draggingInfo];
-    [[self _webView] removeDragCaret];
+    NSView *view = nil;
+    if (![self isHiddenOrHasHiddenAncestor])
+        view = [[self _bridge] previousKeyViewInsideWebFrameViews];
+    if (view == nil)
+        view = [super previousValidKeyView];
+    return view;
 }
 
-- (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)draggingInfo actionMask:(unsigned int)actionMask
+- (BOOL)becomeFirstResponder
 {
-    ASSERT([self _isTopHTMLView]);
-
-    WebView *webView = [self _webView];
-    WebFrameBridge *bridge = [self _bridge];
-    if (_private->webCoreHandlingDrag) {
-        ASSERT(actionMask & WebDragDestinationActionDHTML);
-        [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionDHTML forDraggingInfo:draggingInfo];
-        [bridge concludeDragForDraggingInfo:draggingInfo];
-        return YES;
-    }
-
-    if (!(actionMask & WebDragDestinationActionEdit))
-        return NO;
-
-    NSPoint point = [self convertPoint:[draggingInfo draggingLocation] fromView:nil];
-    NSDictionary *element = [self elementAtPoint:point allowShadowContent:YES];
-    ASSERT(element);
-    WebFrame *innerFrame = (WebFrame *)[element objectForKey:WebElementFrameKey];
-    ASSERT(innerFrame);
-    ASSERT([innerFrame isKindOfClass:[WebFrame class]]);
-    WebFrameBridge *innerBridge = [innerFrame _bridge];
-
-    if ([self _isNSColorDrag:draggingInfo]) {
-        NSColor *color = [NSColor colorFromPasteboard:[draggingInfo draggingPasteboard]];
-        if (!color)
-            return NO;
-        DOMCSSStyleDeclaration *style = [self _emptyStyle];
-        [style setProperty:@"color" :[self _colorAsString:color] :@""];
-        if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:[innerBridge selectedDOMRange]]) {
-            [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
-            [innerBridge applyStyle:style withUndoAction:WebUndoActionSetColor];
-            return YES;
-        }
-        return NO;
-    }
-
-    BOOL didInsert = NO;
-    if ([self _canProcessDragWithDraggingInfo:draggingInfo]) {
-        NSPasteboard *pasteboard = [draggingInfo draggingPasteboard];
-        if ([self _isMoveDrag] || [innerBridge isDragCaretRichlyEditable]) { 
-            BOOL chosePlainText;
-            DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard allowPlainText:YES chosePlainText:&chosePlainText];
-            if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:[innerBridge dragCaretDOMRange] givenAction:WebViewInsertActionDropped]) {
-                [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
-                if ([self _isMoveDrag]) {
-                    BOOL smartMove = [innerBridge selectionGranularity] == WebBridgeSelectByWord && [self _canSmartReplaceWithPasteboard:pasteboard];
-                    [innerBridge moveSelectionToDragCaret:fragment smartMove:smartMove];
-                } else {
-                    [innerBridge setSelectionToDragCaret];
-                    [innerBridge replaceSelectionWithFragment:fragment selectReplacement:YES smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle:chosePlainText];
-                }
-                didInsert = YES;
-            }
-        } else {
-            NSString *text = [self _plainTextFromPasteboard:pasteboard];
-            if (text && [self _shouldInsertText:text replacingDOMRange:[innerBridge dragCaretDOMRange] givenAction:WebViewInsertActionDropped]) {
-                [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
-                [innerBridge setSelectionToDragCaret];
-                [innerBridge replaceSelectionWithText:text selectReplacement:YES smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard]];
-                didInsert = YES;
-            }
-        }
-    }
-    [webView removeDragCaret];
-    return didInsert;
-}
-
-- (NSDictionary *)elementAtPoint:(NSPoint)point
-{
-    return [self elementAtPoint:point allowShadowContent:NO];
-}
-
-- (NSDictionary *)elementAtPoint:(NSPoint)point allowShadowContent:(BOOL)allow;
-{
-    DOMNode *innerNode = nil;
-    DOMNode *innerNonSharedNode = nil;
-    DOMElement *URLElement = nil;
-    [[self _bridge] getInnerNonSharedNode:&innerNonSharedNode innerNode:&innerNode URLElement:&URLElement atPoint:point allowShadowContent:allow];
-    NSView *innerView = [[[[innerNonSharedNode ownerDocument] webFrame] frameView] documentView];
-    NSPoint innerPoint = innerView ? [self convertPoint:point toView:innerView] : point;
-    return [[[WebElementDictionary alloc] initWithInnerNonSharedNode:innerNonSharedNode innerNode:innerNode URLElement:URLElement andPoint:innerPoint] autorelease];
-}
-
-- (void)mouseUp:(NSEvent *)event
-{
-    NSInputManager *currentInputManager = [NSInputManager currentInputManager];
-    if ([currentInputManager wantsToHandleMouseEvents] && [currentInputManager handleMouseEvent:event])
-        return;
-
-    [self retain];
-
-    [self _stopAutoscrollTimer];
-    [[self _bridge] mouseUp:event];
-    [self _updateMouseoverWithFakeEvent];
-
-    [self release];
-}
-
-- (void)mouseMovedNotification:(NSNotification *)notification
-{
-    [self _updateMouseoverWithEvent:[[notification userInfo] objectForKey:@"NSEvent"]];
-}
-
-- (BOOL)supportsTextEncoding
-{
-    return YES;
-}
-
-// returning YES from this method is the way we tell AppKit that it is ok for this view
-// to be in the key loop even when "tab to all controls" is not on.
-- (BOOL)needsPanelToBecomeKey
-{
-    return YES;
-}
-
-- (NSView *)nextValidKeyView
-{
-    NSView *view = nil;
-    BOOL lookInsideWebFrameViews = YES;
-    if ([self isHiddenOrHasHiddenAncestor]) {
-        lookInsideWebFrameViews = NO;
-    } else if ([self _frame] == [[self _webView] mainFrame]) {
-        // Check for case where first responder is last frame in a frameset, and we are
-        // the top-level documentView.
-        NSResponder *firstResponder = [[self window] firstResponder];
-        if ((firstResponder != self) && [firstResponder isKindOfClass:[WebHTMLView class]] && ([(NSView *)firstResponder nextKeyView] == nil)) {
-            lookInsideWebFrameViews = NO;
-        }
-    }
-    
-    if (lookInsideWebFrameViews) {
-        view = [[self _bridge] nextKeyViewInsideWebFrameViews];
-    }
-    
-    if (view == nil) {
-        view = [super nextValidKeyView];
-        // If there's no next view wired up, we must be in the last subframe, or we are
-        // being called at an unusual time when the views have not yet been wired together.
-        // There's no direct link to the next valid key view; get it from the bridge.
-        // Note that view == self here when nextKeyView returns nil, due to AppKit oddness.
-        // We'll check for both nil and self in case the AppKit oddness goes away.
-        // WebFrameView has this same kind of logic for the previousValidKeyView case.
-        if (view == nil || view == self) {
-            view = [[self _bridge] nextValidKeyViewOutsideWebFrameViews];
-        }
-    }
-        
-    return view;
-}
-
-- (NSView *)previousValidKeyView
-{
-    NSView *view = nil;
-    if (![self isHiddenOrHasHiddenAncestor])
-        view = [[self _bridge] previousKeyViewInsideWebFrameViews];
-    if (view == nil)
-        view = [super previousValidKeyView];
-    return view;
-}
-
-- (BOOL)becomeFirstResponder
-{
-    NSView *view = nil;
-    if (![[self _webView] _isPerformingProgrammaticFocus] && !_private->willBecomeFirstResponderForNodeFocus) {
-        switch ([[self window] keyViewSelectionDirection]) {
-            case NSDirectSelection:
-                break;
-            case NSSelectingNext:
-                view = [[self _bridge] nextKeyViewInsideWebFrameViews];
-                break;
-            case NSSelectingPrevious:
-                view = [[self _bridge] previousKeyViewInsideWebFrameViews];
-                break;
+    NSView *view = nil;
+    if (![[self _webView] _isPerformingProgrammaticFocus] && !_private->willBecomeFirstResponderForNodeFocus) {
+        switch ([[self window] keyViewSelectionDirection]) {
+            case NSDirectSelection:
+                break;
+            case NSSelectingNext:
+                view = [[self _bridge] nextKeyViewInsideWebFrameViews];
+                break;
+            case NSSelectingPrevious:
+                view = [[self _bridge] previousKeyViewInsideWebFrameViews];
+                break;
         }
     }
     _private->willBecomeFirstResponderForNodeFocus = NO;
@@ -5770,3 +5515,267 @@ static DOMRange *unionDOMRanges(DOMRange *a, DOMRange *b)
 }
 
 @end
+
+@implementation WebHTMLView (WebDocumentPrivateProtocols)
+
+- (NSRect)selectionRect
+{
+    return [[self _bridge] selectionRect];
+}
+
+- (NSView *)selectionView
+{
+    return self;
+}
+
+- (NSImage *)selectionImageForcingWhiteText:(BOOL)forceWhiteText
+{
+    if ([self _hasSelection])
+        return [[self _bridge] selectionImageForcingWhiteText:forceWhiteText];
+
+    return nil;
+}
+
+- (NSRect)selectionImageRect
+{
+    if ([self _hasSelection])
+        return [[self _bridge] visibleSelectionRect];
+    return NSZeroRect;
+}
+
+- (NSArray *)pasteboardTypesForSelection
+{
+    if ([self _canSmartCopyOrDelete]) {
+        NSMutableArray *types = [[[[self class] _selectionPasteboardTypes] mutableCopy] autorelease];
+        [types addObject:WebSmartPastePboardType];
+        return types;
+    } else {
+        return [[self class] _selectionPasteboardTypes];
+    }
+}
+
+- (void)writeSelectionWithPasteboardTypes:(NSArray *)types toPasteboard:(NSPasteboard *)pasteboard
+{
+    [self _writeSelectionWithPasteboardTypes:types toPasteboard:pasteboard cachedAttributedString:nil];
+}
+
+- (void)selectAll
+{
+    [[self _bridge] selectAll];
+}
+
+- (void)deselectAll
+{
+    [[self _bridge] deselectAll];
+}
+
+- (NSString *)string
+{
+    return [[self _bridge] stringForRange:[self _documentRange]];
+}
+
+- (NSAttributedString *)_attributeStringFromDOMRange:(DOMRange *)range
+{
+    NSAttributedString *attributedString;
+#if !LOG_DISABLED        
+    double start = CFAbsoluteTimeGetCurrent();
+#endif    
+    attributedString = [[[NSAttributedString alloc] _initWithDOMRange:range] autorelease];
+#if !LOG_DISABLED
+    double duration = CFAbsoluteTimeGetCurrent() - start;
+    LOG(Timing, "creating attributed string from selection took %f seconds.", duration);
+#endif
+    return attributedString;
+}
+
+- (NSAttributedString *)attributedString
+{
+    WebFrameBridge *bridge = [self _bridge];
+    DOMDocument *document = [bridge DOMDocument];
+    NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[document _documentRange]];
+    if (attributedString == nil) {
+        attributedString = [bridge attributedStringFrom:document startOffset:0 to:nil endOffset:0];
+    }
+    return attributedString;
+}
+
+- (NSString *)selectedString
+{
+    return [[self _bridge] selectedString];
+}
+
+- (NSAttributedString *)selectedAttributedString
+{
+    WebFrameBridge *bridge = [self _bridge];
+    NSAttributedString *attributedString = [self _attributeStringFromDOMRange:[self _selectedRange]];
+    if (attributedString == nil) {
+        attributedString = [bridge selectedAttributedString];
+    }
+    return attributedString;
+}
+
+- (BOOL)supportsTextEncoding
+{
+    return YES;
+}
+
+@end
+
+@implementation WebHTMLView (WebDocumentInternalProtocols)
+
+- (BOOL)_canProcessDragWithDraggingInfo:(id <NSDraggingInfo>)draggingInfo
+{
+    ASSERT([self _isTopHTMLView]);
+
+    NSPasteboard *pasteboard = [draggingInfo draggingPasteboard];
+    NSMutableSet *types = [NSMutableSet setWithArray:[pasteboard types]];
+    [types intersectSet:[NSSet setWithArray:[WebHTMLView _insertablePasteboardTypes]]];
+    if ([types count] == 0)
+        return NO;
+    if ([types count] == 1
+            && [types containsObject:NSFilenamesPboardType]
+            && ![self _imageExistsAtPaths:[pasteboard propertyListForType:NSFilenamesPboardType]])
+        return NO;
+
+    NSPoint point = [self convertPoint:[draggingInfo draggingLocation] fromView:nil];
+    NSDictionary *element = [self elementAtPoint:point allowShadowContent:YES];
+    if ([[self _webView] isEditable] || [[element objectForKey:WebElementDOMNodeKey] isContentEditable]) {
+        // Can't drag onto the selection being dragged.
+        if (_private->initiatedDrag && [[element objectForKey:WebElementIsSelectedKey] boolValue])
+            return NO;
+        return YES;
+    }
+
+    return NO;
+}
+
+- (BOOL)_isMoveDrag
+{
+    ASSERT([self _isTopHTMLView]);
+    return _private->initiatedDrag
+        && [self _isEditable] && [self _hasSelection]
+        && !([[NSApp currentEvent] modifierFlags] & NSAlternateKeyMask);
+}
+
+- (BOOL)_isNSColorDrag:(id <NSDraggingInfo>)draggingInfo
+{
+    return [[[draggingInfo draggingPasteboard] types] containsObject:NSColorPboardType];
+}
+
+- (NSDragOperation)draggingUpdatedWithDraggingInfo:(id <NSDraggingInfo>)draggingInfo actionMask:(unsigned int)actionMask
+{
+    ASSERT([self _isTopHTMLView]);
+
+    NSDragOperation operation = NSDragOperationNone;
+    if (actionMask & WebDragDestinationActionDHTML)
+        operation = [[self _bridge] dragOperationForDraggingInfo:draggingInfo];
+    _private->webCoreHandlingDrag = (operation != NSDragOperationNone);
+
+    if ((actionMask & WebDragDestinationActionEdit) && !_private->webCoreHandlingDrag && [self _canProcessDragWithDraggingInfo:draggingInfo]) {
+        if ([self _isNSColorDrag:draggingInfo])
+            operation = NSDragOperationGeneric;
+        else {
+            WebView *webView = [self _webView];
+            [webView moveDragCaretToPoint:[webView convertPoint:[draggingInfo draggingLocation] fromView:nil]];
+            operation = [self _isMoveDrag] ? NSDragOperationMove : NSDragOperationCopy;
+        }
+    } else
+        [[self _webView] removeDragCaret];
+
+    return operation;
+}
+
+- (void)draggingCancelledWithDraggingInfo:(id <NSDraggingInfo>)draggingInfo
+{
+    ASSERT([self _isTopHTMLView]);
+
+    [[self _bridge] dragExitedWithDraggingInfo:draggingInfo];
+    [[self _webView] removeDragCaret];
+}
+
+- (BOOL)concludeDragForDraggingInfo:(id <NSDraggingInfo>)draggingInfo actionMask:(unsigned int)actionMask
+{
+    ASSERT([self _isTopHTMLView]);
+
+    WebView *webView = [self _webView];
+    WebFrameBridge *bridge = [self _bridge];
+    if (_private->webCoreHandlingDrag) {
+        ASSERT(actionMask & WebDragDestinationActionDHTML);
+        [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionDHTML forDraggingInfo:draggingInfo];
+        [bridge concludeDragForDraggingInfo:draggingInfo];
+        return YES;
+    }
+
+    if (!(actionMask & WebDragDestinationActionEdit))
+        return NO;
+
+    NSPoint point = [self convertPoint:[draggingInfo draggingLocation] fromView:nil];
+    NSDictionary *element = [self elementAtPoint:point allowShadowContent:YES];
+    ASSERT(element);
+    WebFrame *innerFrame = (WebFrame *)[element objectForKey:WebElementFrameKey];
+    ASSERT(innerFrame);
+    ASSERT([innerFrame isKindOfClass:[WebFrame class]]);
+    WebFrameBridge *innerBridge = [innerFrame _bridge];
+
+    if ([self _isNSColorDrag:draggingInfo]) {
+        NSColor *color = [NSColor colorFromPasteboard:[draggingInfo draggingPasteboard]];
+        if (!color)
+            return NO;
+        DOMCSSStyleDeclaration *style = [self _emptyStyle];
+        [style setProperty:@"color" :[self _colorAsString:color] :@""];
+        if ([[webView _editingDelegateForwarder] webView:webView shouldApplyStyle:style toElementsInDOMRange:[innerBridge selectedDOMRange]]) {
+            [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
+            [innerBridge applyStyle:style withUndoAction:WebUndoActionSetColor];
+            return YES;
+        }
+        return NO;
+    }
+
+    BOOL didInsert = NO;
+    if ([self _canProcessDragWithDraggingInfo:draggingInfo]) {
+        NSPasteboard *pasteboard = [draggingInfo draggingPasteboard];
+        if ([self _isMoveDrag] || [innerBridge isDragCaretRichlyEditable]) { 
+            BOOL chosePlainText;
+            DOMDocumentFragment *fragment = [self _documentFragmentFromPasteboard:pasteboard allowPlainText:YES chosePlainText:&chosePlainText];
+            if (fragment && [self _shouldInsertFragment:fragment replacingDOMRange:[innerBridge dragCaretDOMRange] givenAction:WebViewInsertActionDropped]) {
+                [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
+                if ([self _isMoveDrag]) {
+                    BOOL smartMove = [innerBridge selectionGranularity] == WebBridgeSelectByWord && [self _canSmartReplaceWithPasteboard:pasteboard];
+                    [innerBridge moveSelectionToDragCaret:fragment smartMove:smartMove];
+                } else {
+                    [innerBridge setSelectionToDragCaret];
+                    [innerBridge replaceSelectionWithFragment:fragment selectReplacement:YES smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard] matchStyle:chosePlainText];
+                }
+                didInsert = YES;
+            }
+        } else {
+            NSString *text = [self _plainTextFromPasteboard:pasteboard];
+            if (text && [self _shouldInsertText:text replacingDOMRange:[innerBridge dragCaretDOMRange] givenAction:WebViewInsertActionDropped]) {
+                [[webView _UIDelegateForwarder] webView:webView willPerformDragDestinationAction:WebDragDestinationActionEdit forDraggingInfo:draggingInfo];
+                [innerBridge setSelectionToDragCaret];
+                [innerBridge replaceSelectionWithText:text selectReplacement:YES smartReplace:[self _canSmartReplaceWithPasteboard:pasteboard]];
+                didInsert = YES;
+            }
+        }
+    }
+    [webView removeDragCaret];
+    return didInsert;
+}
+
+- (NSDictionary *)elementAtPoint:(NSPoint)point
+{
+    return [self elementAtPoint:point allowShadowContent:NO];
+}
+
+- (NSDictionary *)elementAtPoint:(NSPoint)point allowShadowContent:(BOOL)allow;
+{
+    DOMNode *innerNode = nil;
+    DOMNode *innerNonSharedNode = nil;
+    DOMElement *URLElement = nil;
+    [[self _bridge] getInnerNonSharedNode:&innerNonSharedNode innerNode:&innerNode URLElement:&URLElement atPoint:point allowShadowContent:allow];
+    NSView *innerView = [[[[innerNonSharedNode ownerDocument] webFrame] frameView] documentView];
+    NSPoint innerPoint = innerView ? [self convertPoint:point toView:innerView] : point;
+    return [[[WebElementDictionary alloc] initWithInnerNonSharedNode:innerNonSharedNode innerNode:innerNode URLElement:URLElement andPoint:innerPoint] autorelease];
+}
+
+@end