2006-03-15 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2006 07:15:34 +0000 (07:15 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 16 Mar 2006 07:15:34 +0000 (07:15 +0000)
        Reviewed by darin.

        Remove unused code and clean-up style.

        * bridge/mac/MacFrame.mm:
        (WebCore::MacFrame::advanceToNextMisspelling):
        (WebCore::MacFrame::wheelEvent):
        (WebCore::MacFrame::nextKeyViewInFrame):
        (WebCore::MacFrame::nextKeyViewInFrameHierarchy):
        (WebCore::MacFrame::nextKeyView):
        * page/Frame.cpp:
        * page/Frame.h:
        * page/FrameView.cpp:
        (WebCore::FrameView::dispatchMouseEvent):

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

WebCore/ChangeLog
WebCore/bridge/mac/MacFrame.mm
WebCore/page/Frame.cpp
WebCore/page/Frame.h
WebCore/page/FrameView.cpp

index de21dc6b8455d47f41aaa0f5cb80f1bc5e028fb6..dce9e76dcacbf8a5e1f79d206cd4dffc31a5d320 100644 (file)
@@ -1,3 +1,20 @@
+2006-03-15  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by darin.
+
+        Remove unused code and clean-up style.
+
+        * bridge/mac/MacFrame.mm:
+        (WebCore::MacFrame::advanceToNextMisspelling):
+        (WebCore::MacFrame::wheelEvent):
+        (WebCore::MacFrame::nextKeyViewInFrame):
+        (WebCore::MacFrame::nextKeyViewInFrameHierarchy):
+        (WebCore::MacFrame::nextKeyView):
+        * page/Frame.cpp:
+        * page/Frame.h:
+        * page/FrameView.cpp:
+        (WebCore::FrameView::dispatchMouseEvent):
+
 2006-03-15  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by mjs.
index 6f2825b387282fd460317dc8a0d99e5675012a7a..75be624664ec9bef08434f3b79bf2fad59cd5683 100644 (file)
@@ -689,9 +689,8 @@ QString MacFrame::advanceToNextMisspelling(bool startBeforeSelection)
             // We match AppKit's rule: Start 1 character before the selection.
             VisiblePosition oneBeforeStart = start.previous();
             setStart(searchRange.get(), oneBeforeStart.isNotNull() ? oneBeforeStart : start);
-        } else {
+        } else
             setStart(searchRange.get(), VisiblePosition(selection().end(), selection().affinity()));
-        }
     }
 
     // If we're not in an editable node, try to find one, make that our range to work in
@@ -718,9 +717,8 @@ QString MacFrame::advanceToNextMisspelling(bool startBeforeSelection)
         } // else we were already at the start of the editable node
     }
     
-    if (searchRange->collapsed(exception)) {
+    if (searchRange->collapsed(exception))
         return QString();       // nothing to search in
-    }
     
     // Get the spell checker if it is available
     NSSpellChecker *checker = [NSSpellChecker sharedSpellChecker];
@@ -819,28 +817,24 @@ bool MacFrame::wheelEvent(NSEvent *event)
     }  else if (deltaY > 0) {
         direction = KWQScrollUp;
         multiplier = deltaY;
-    } else {
+    } else
         return false;
-    }
 
     RenderObject *r = renderer();
-    if (r == 0) {
+    if (!r)
         return false;
-    }
     
     NSPoint point = [d->m_view->getDocumentView() convertPoint:[event locationInWindow] fromView:nil];
     RenderObject::NodeInfo nodeInfo(true, true);
     r->layer()->hitTest(nodeInfo, (int)point.x, (int)point.y);    
     
     NodeImpl *node = nodeInfo.innerNode();
-    if (node == 0) {
+    if (!node)
         return false;
-    }
     
     r = node->renderer();
-    if (r == 0) {
+    if (!r)
         return false;
-    }
     
     return r->scroll(direction, KWQScrollWheel, multiplier);
 }
@@ -912,32 +906,29 @@ QString MacFrame::mimeTypeForFileName(const QString &fileName) const
 NSView *MacFrame::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection direction)
 {
     DocumentImpl *doc = document();
-    if (!doc) {
+    if (!doc)
         return nil;
-    }
+    
     for (;;) {
         node = direction == KWQSelectingNext
             ? doc->nextFocusNode(node) : doc->previousFocusNode(node);
-        if (!node) {
+        if (!node)
             return nil;
-        }
+        
         RenderObject *renderer = node->renderer();
         if (renderer->isWidget()) {
             RenderWidget *renderWidget = static_cast<RenderWidget *>(renderer);
             Widget *widget = renderWidget->widget();
             FrameView *childFrameWidget = widget->isFrameView() ? static_cast<FrameView *>(widget) : 0;
             NSView *view = nil;
-            if (childFrameWidget) {
+            if (childFrameWidget)
                 view = Mac(childFrameWidget->frame())->nextKeyViewInFrame(0, direction);
-            } else if (widget) {
+            else if (widget)
                 view = widget->getView();
-            }
-            if (view) {
+            if (view)
                 return view;
-            }
-        } else {
+        } else
             static_cast<ElementImpl *>(node)->focus(); 
-        } 
         [_bridge makeFirstResponder:[_bridge documentView]];
         return [_bridge documentView];
     }
@@ -946,19 +937,14 @@ NSView *MacFrame::nextKeyViewInFrame(NodeImpl *node, KWQSelectionDirection direc
 NSView *MacFrame::nextKeyViewInFrameHierarchy(NodeImpl *node, KWQSelectionDirection direction)
 {
     NSView *next = nextKeyViewInFrame(node, direction);
-    if (!next) {
-        MacFrame *parent = Mac(tree()->parent());
-        if (parent)
+    if (!next)
+        if (MacFrame *parent = Mac(tree()->parent()))
             next = parent->nextKeyViewInFrameHierarchy(ownerElement(), direction);
-    }
     
     // remove focus from currently focused node if we're giving focus to another view
-    if (next && (next != [_bridge documentView])) {
-        DocumentImpl *doc = document();
-        if (doc) {
+    if (next && (next != [_bridge documentView]))
+        if (DocumentImpl *doc = document())
             doc->setFocusNode(0);
-        }            
-    }    
     
     return next;
 }
@@ -969,9 +955,8 @@ NSView *MacFrame::nextKeyView(NodeImpl *node, KWQSelectionDirection direction)
     KWQ_BLOCK_EXCEPTIONS;
 
     next = nextKeyViewInFrameHierarchy(node, direction);
-    if (next) {
+    if (next)
         return next;
-    }
 
     // Look at views from the top level part up, looking for a next key view that we can use.
 
@@ -979,9 +964,8 @@ NSView *MacFrame::nextKeyView(NodeImpl *node, KWQSelectionDirection direction)
         ? [_bridge nextKeyViewOutsideWebFrameViews]
         : [_bridge previousKeyViewOutsideWebFrameViews];
 
-    if (next) {
+    if (next)
         return next;
-    }
 
     KWQ_UNBLOCK_EXCEPTIONS;
     
index a466604d28d2240935d73c81d9048b3cff8d762d..068e11d9968fac945e664eff16228358dfeaafe4 100644 (file)
@@ -2879,13 +2879,6 @@ NodeImpl* Frame::nodeForWidget(const Widget* widget)
     return client->element(const_cast<Widget*>(widget));
 }
 
-void Frame::setDocumentFocus(Widget *widget)
-{
-    NodeImpl *node = nodeForWidget(widget);
-    ASSERT(node);
-    node->getDocument()->setFocusNode(node);
-}
-
 void Frame::clearDocumentFocus(Widget *widget)
 {
     NodeImpl *node = nodeForWidget(widget);
index 4bba90aad07ce1b2c558b000959a396242c51af7..d33ad9acddce28f9119658bafb060de28a7b628a 100644 (file)
@@ -730,7 +730,6 @@ private:
   static NodeImpl *nodeForWidget(const Widget *);
   static Frame *frameForNode(NodeImpl *);
 
-  static void setDocumentFocus(Widget *);
   static void clearDocumentFocus(Widget *);
 
   static const QPtrList<Frame> &instances() { return mutableInstances(); }    
index eb43ed40993c7ace543c4e6ae5e3387fc1334380..9f2e2bd2749caf2e2d63e4a682f255d5b3511e87 100644 (file)
@@ -1004,7 +1004,7 @@ bool FrameView::dispatchMouseEvent(const AtomicString& eventType, NodeImpl* targ
                 swallowEvent = true;
         } else if (!node || !node->focused()) {
             if (!m_frame->document()->setFocusNode(0))
-            swallowEvent = true;
+                swallowEvent = true;
         }
     }