Commit 9ca92892 authored by darin's avatar darin

WebCore:

        Reviewed by Justin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8616
          REGRESSION: TinyMCE: Crash on Undo

        * bridge/mac/WebCoreFrameBridge.mm:
        (-[WebCoreFrameBridge getInnerNonSharedNode:innerNode:URLElement:atPoint:allowShadowContent:]):
        Changed to call nodeInfoAtPoint directly.
        (-[WebCoreFrameBridge _visiblePositionForPoint:]): Changed to call nodeInfoAtPoint directly.
        Also added code to convert coordinates so it works for points that are in nodes in subframes.

        * page/Frame.cpp:
        (WebCore::Frame::setMark): Added assertions to catch if we attempt to set selection
        endpoints in another document.
        (WebCore::Frame::setSelection): Ditto.

WebKit:

        Reviewed by Justin.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8616
          REGRESSION: TinyMCE: Crash on Undo

        * WebView/WebHTMLView.m:
        (-[WebHTMLView _topHTMLView]): Added.
        (-[WebHTMLView _isTopHTMLView]): Added.
        (-[WebHTMLView _insideAnotherHTMLView]): Changed to use _topHTMLView.
        (-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
        Forward to the top HTML view, so that only the top view ever starts a dragging operation.
        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,
        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:]):
        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
        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
        so this works properly when returning an element from an inner frame.
        (-[NSArray 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/WebView.m:
        (-[WebViewPrivate dealloc]): Removed code to release dragCaretBridge since that field
        is now gone.
        (-[WebView moveDragCaretToPoint:]): Always call the main frame's bridge, since the
        drag caret is now a page-level item. Later we'll move it to the page bridge.
        (-[WebView removeDragCaret]): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14770 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bc2c0c7f
2006-06-08 Darin Adler <darin@apple.com>
Reviewed by Justin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8616
REGRESSION: TinyMCE: Crash on Undo
* bridge/mac/WebCoreFrameBridge.mm:
(-[WebCoreFrameBridge getInnerNonSharedNode:innerNode:URLElement:atPoint:allowShadowContent:]):
Changed to call nodeInfoAtPoint directly.
(-[WebCoreFrameBridge _visiblePositionForPoint:]): Changed to call nodeInfoAtPoint directly.
Also added code to convert coordinates so it works for points that are in nodes in subframes.
* page/Frame.cpp:
(WebCore::Frame::setMark): Added assertions to catch if we attempt to set selection
endpoints in another document.
(WebCore::Frame::setSelection): Ditto.
2006-06-07 Justin Garcia <justin.garcia@apple.com>
Reviewed by levi
......
......@@ -111,7 +111,6 @@ NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
@interface WebCoreFrameBridge (WebCoreBridgeInternal)
- (RootObject *)executionContextForView:(NSView *)aView;
- (RenderObject::NodeInfo)nodeInfoAtPoint:(NSPoint)point allowShadowContent:(BOOL)allow;
@end
static RootObject *rootForView(void *v)
......@@ -1164,7 +1163,7 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
return;
}
RenderObject::NodeInfo nodeInfo = [self nodeInfoAtPoint:point allowShadowContent:allow];
RenderObject::NodeInfo nodeInfo = m_frame->nodeInfoAtPoint(IntPoint(point), allow);
*innerNonSharedNode = [DOMNode _nodeWith:nodeInfo.innerNonSharedNode()];
*innerNode = [DOMNode _nodeWith:nodeInfo.innerNode()];
*URLElement = [DOMElement _elementWith:nodeInfo.URLElement()];
......@@ -2070,18 +2069,17 @@ static HTMLFormElement *formElementFromDOMElement(DOMElement *element)
- (VisiblePosition)_visiblePositionForPoint:(NSPoint)point
{
RenderObject *renderer = m_frame->renderer();
if (!renderer) {
IntPoint outerPoint(point);
Node* node = m_frame->nodeInfoAtPoint(outerPoint, true).innerNode();
if (!node)
return VisiblePosition();
}
RenderObject::NodeInfo nodeInfo = [self nodeInfoAtPoint:point allowShadowContent:YES];
Node *node = nodeInfo.innerNode();
if (!node || !node->renderer())
RenderObject* renderer = node->renderer();
if (!renderer)
return VisiblePosition();
return node->renderer()->positionForCoordinates((int)point.x, (int)point.y);
FrameView* outerView = m_frame->view();
FrameView* innerView = node->document()->view();
IntPoint innerPoint = innerView->viewportToContents(outerView->contentsToViewport(outerPoint));
return renderer->positionForCoordinates(innerPoint.x(), innerPoint.y());
}
- (void)moveDragCaretToPoint:(NSPoint)point
......@@ -2585,11 +2583,6 @@ static NSCharacterSet *_getPostSmartSet(void)
return root;
}
- (RenderObject::NodeInfo)nodeInfoAtPoint:(NSPoint)point allowShadowContent:(BOOL)allow
{
return m_frame->nodeInfoAtPoint(IntPoint(point), allow);
}
@end
@implementation WebCoreFrameBridge (WebCoreInternalUse)
......
......@@ -1165,14 +1165,23 @@ const Selection& Frame::mark() const
void Frame::setMark(const Selection& s)
{
ASSERT(!s.base().node() || s.base().node()->document() == document());
ASSERT(!s.extent().node() || s.extent().node()->document() == document());
ASSERT(!s.start().node() || s.start().node()->document() == document());
ASSERT(!s.end().node() || s.end().node()->document() == document());
d->m_mark = s;
}
void Frame::setSelection(const SelectionController& s, bool closeTyping, bool keepTypingStyle)
{
if (d->m_selection == s) {
if (d->m_selection == s)
return;
}
ASSERT(!s.base().node() || s.base().node()->document() == document());
ASSERT(!s.extent().node() || s.extent().node()->document() == document());
ASSERT(!s.start().node() || s.start().node()->document() == document());
ASSERT(!s.end().node() || s.end().node()->document() == document());
clearCaretRectIfNeeded();
......
2006-06-08 Darin Adler <darin@apple.com>
Reviewed by Justin.
- fix http://bugzilla.opendarwin.org/show_bug.cgi?id=8616
REGRESSION: TinyMCE: Crash on Undo
* WebView/WebHTMLView.m:
(-[WebHTMLView _topHTMLView]): Added.
(-[WebHTMLView _isTopHTMLView]): Added.
(-[WebHTMLView _insideAnotherHTMLView]): Changed to use _topHTMLView.
(-[WebHTMLView _startDraggingImage:at:operation:event:sourceIsDHTML:DHTMLWroteData:]):
Forward to the top HTML view, so that only the top view ever starts a dragging operation.
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,
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:]):
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
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
so this works properly when returning an element from an inner frame.
(-[NSArray 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/WebView.m:
(-[WebViewPrivate dealloc]): Removed code to release dragCaretBridge since that field
is now gone.
(-[WebView moveDragCaretToPoint:]): Always call the main frame's bridge, since the
drag caret is now a page-level item. Later we'll move it to the page bridge.
(-[WebView removeDragCaret]): Ditto.
2006-06-07 David Hyatt <hyatt@apple.com>
Add support for custom highlighting to WebKit.
......
This diff is collapsed.
......@@ -279,7 +279,6 @@ @interface WebViewPrivate : NSObject
NSView <WebDocumentDragging> *draggingDocumentView;
unsigned int dragDestinationActionMask;
WebFrameBridge *dragCaretBridge;
BOOL hasSpellCheckerDocumentTag;
WebNSInteger spellCheckerDocumentTag;
......@@ -380,7 +379,6 @@ - (void)dealloc
{
ASSERT(!_pageBridge);
ASSERT(draggingDocumentView == nil);
ASSERT(dragCaretBridge == nil);
[backForwardList release];
[applicationNameForUserAgent release];
......@@ -2301,19 +2299,12 @@ - (void)writeElement:(NSDictionary *)element withPasteboardTypes:(NSArray *)type
- (void)moveDragCaretToPoint:(NSPoint)point
{
WebFrameBridge *bridge = [self _bridgeAtPoint:point];
if (bridge != _private->dragCaretBridge) {
[_private->dragCaretBridge removeDragCaret];
_private->dragCaretBridge = [bridge retain];
}
[_private->dragCaretBridge moveDragCaretToPoint:[self convertPoint:point toView:[[[_private->dragCaretBridge webFrame] frameView] documentView]]];
[[[self mainFrame] _bridge] moveDragCaretToPoint:[self convertPoint:point toView:[[[self mainFrame] frameView] documentView]]];
}
- (void)removeDragCaret
{
[_private->dragCaretBridge removeDragCaret];
[_private->dragCaretBridge release];
_private->dragCaretBridge = nil;
[[[self mainFrame] _bridge] removeDragCaret];
}
- (void)_inspectElement:(id)sender
......@@ -2333,7 +2324,7 @@ - (void)_inspectElement:(id)sender
node = [node parentNode];
node = [node parentNode];
if (node) // set the root node to something retivally close to the focused node
if (node) // set the root node to something relatively close to the focused node
[inspector setRootDOMNode:node];
[inspector showWindow:nil];
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment