Fix by Mitz Pettel, reviewed by Darin.
authorap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Mar 2006 09:35:58 +0000 (09:35 +0000)
committerap <ap@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 5 Mar 2006 09:35:58 +0000 (09:35 +0000)
        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4840
        Frames only resize wider, can't make them narrower

        * khtml/html/html_baseimpl.cpp:
        (WebCore::HTMLFrameSetElementImpl::HTMLFrameSetElementImpl): Removed unused m_resizing flag.
        * khtml/html/html_baseimpl.h:
        * manual-tests/bugzilla-4840.html: Added.
        * page/FrameView.cpp:
        (WebCore::FrameViewPrivate::reset):
        (WebCore::FrameView::viewportMouseMoveEvent):
        (WebCore::FrameView::viewportMouseReleaseEvent):
        (WebCore::FrameView::setResizingFrameSet): New method. When a resizing frameset is set,
        mouse move and mouse release events target it instead of hit-testing.
        * page/FrameView.h:
        * rendering/render_frames.cpp:
        (WebCore::RenderFrameSet::setResizing): Inform the FrameView that we are resizing (or not).

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

WebCore/ChangeLog
WebCore/khtml/html/html_baseimpl.cpp
WebCore/khtml/html/html_baseimpl.h
WebCore/manual-tests/bugzilla-4840.html [new file with mode: 0644]
WebCore/page/FrameView.cpp
WebCore/page/FrameView.h
WebCore/rendering/render_frames.cpp

index b7de3afb158c5a7cee8487188f0b05bd0701d2e6..87a00c28ebf5b16b266455830d521f313ee53ad4 100644 (file)
@@ -1,3 +1,24 @@
+2006-03-05  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin, landed by ap.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=4840
+          Frames only resize wider, can't make them narrower
+
+        * khtml/html/html_baseimpl.cpp:
+        (WebCore::HTMLFrameSetElementImpl::HTMLFrameSetElementImpl): Removed unused m_resizing flag.
+        * khtml/html/html_baseimpl.h:
+        * manual-tests/bugzilla-4840.html: Added.
+        * page/FrameView.cpp:
+        (WebCore::FrameViewPrivate::reset):
+        (WebCore::FrameView::viewportMouseMoveEvent):
+        (WebCore::FrameView::viewportMouseReleaseEvent):
+        (WebCore::FrameView::setResizingFrameSet): New method. When a resizing frameset is set,
+        mouse move and mouse release events target it instead of hit-testing.
+        * page/FrameView.h:
+        * rendering/render_frames.cpp:
+        (WebCore::RenderFrameSet::setResizing): Inform the FrameView that we are resizing (or not).
+
 2006-03-04  David Hyatt  <hyatt@apple.com>
 
         Fix for bug 7586, eliminate QFontMetrics.
index 7465abeb9920839b8bf5457d6d6a71c66338baa4..ea3eb27aa61a52aaacd187f468bf50bdca6d9faf 100644 (file)
@@ -651,8 +651,6 @@ HTMLFrameSetElementImpl::HTMLFrameSetElementImpl(DocumentImpl *doc)
     frameBorderSet = false;
     m_border = 4;
     noresize = false;
-
-    m_resizing = false;
 }
 
 HTMLFrameSetElementImpl::~HTMLFrameSetElementImpl()
index e9bbf31d291bee6d8f762466b067079975e2881b..5e58145c0f21bea21894b51051a133b5a782f2de 100644 (file)
@@ -207,7 +207,6 @@ protected:
     bool frameborder : 1;
     bool frameBorderSet : 1;
     bool noresize : 1;
-    bool m_resizing : 1;  // is the user resizing currently
 };
 
 // -------------------------------------------------------------------------
diff --git a/WebCore/manual-tests/bugzilla-4840.html b/WebCore/manual-tests/bugzilla-4840.html
new file mode 100644 (file)
index 0000000..d58368a
--- /dev/null
@@ -0,0 +1,26 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
+        "http://www.w3.org/TR/html4/strict.dtd">
+<html lang="en">
+<head>
+</head>
+<body>
+<p><b>BUG ID:</b> <a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=4840">Bugzilla bug 4840</a> Frames only resize wider, can't make them narrower</p>
+
+<p id="test" style="background-color:skyblue; padding:3px;"><b>STEPS TO TEST:</b> 
+Drag the vertical split bar below to the left and release it.
+</p>
+
+<p id="success" style="background-color:palegreen; padding:3px;"><b>TEST PASS:</b> 
+The frames will resize accordingly, with the split bar where you released it.
+</p>
+
+<p id="failure" style="background-color:#FF3300; padding:3px;"><b>TEST FAIL:</b>  
+The split bar will not follow the mouse when dragged to the left. After releasing
+the mouse button, the frames will not resize and the split bar will continue to
+follow the mouse.
+</p>
+
+<iframe style="width: 100%; height: 200px;" src="data:text/html,<frameset cols=%22*, *%22><frameset rows=%22*, *%22><frame src=%22about:blank%22><frame src=%22about:blank%22></frameset><frame src=%22about:blank%22></frameset>"></iframe>
+
+</body>
+</html>
index cc7b5c81ac037bf6f32f67d70db967d975b4a396..915c0b8f5e2fb5740e0c647143cf49710833b140 100644 (file)
@@ -101,6 +101,7 @@ public:
         hoverTimer.stop();
         if (repaintRects)
             repaintRects->clear();
+        resizingFrameSet = 0;
     }
 
     RefPtr<NodeImpl> underMouse;
@@ -142,6 +143,7 @@ public:
     QPtrList<RenderObject::RepaintInfo>* repaintRects;
     
     RefPtr<NodeImpl> dragTarget;
+    RefPtr<HTMLFrameSetElementImpl> resizingFrameSet;
 };
 
 FrameView::FrameView(Frame *frame)
@@ -606,6 +608,11 @@ void FrameView::viewportMouseMoveEvent(MouseEvent* mouseEvent)
     int xm, ym;
     viewportToContents(mouseEvent->x(), mouseEvent->y(), xm, ym);
 
+    if (d->resizingFrameSet) {
+        dispatchMouseEvent(mousemoveEvent, d->resizingFrameSet.get(), false, 0, mouseEvent, false);
+        return;
+    }
+
     // Treat mouse move events while the mouse is pressed as "read-only" in prepareMouseEvent
     // if we are allowed to select.
     // This means that :hover and :active freeze in the state they were in when the mouse
@@ -639,6 +646,11 @@ void FrameView::viewportMouseReleaseEvent(MouseEvent* mouseEvent)
 
     d->mousePressed = false;
 
+    if (d->resizingFrameSet) {
+        dispatchMouseEvent(mouseupEvent, d->resizingFrameSet.get(), true, d->clickCount, mouseEvent, false);
+        return;
+    }
+
     MouseEventWithHitTestResults mev = m_frame->document()->prepareMouseEvent(false, false, false, xm, ym, mouseEvent);
 
     if (m_frame->passSubframeEventToSubframe(mev))
@@ -923,6 +935,11 @@ void FrameView::restoreScrollBar()
     suppressScrollBars(false);
 }
 
+void FrameView::setResizingFrameSet(HTMLFrameSetElementImpl *frameSet)
+{
+    d->resizingFrameSet = frameSet;
+}
+
 bool FrameView::dispatchMouseEvent(const AtomicString& eventType, NodeImpl* targetNode, bool cancelable,
     int detail, MouseEvent* mouseEvent, bool setUnder)
 {
index e3d5359f7f2265f3131bc5588e98f07ef5ce2185..9ad4268682352f8ec73bd2644f03341d8e54cf71 100644 (file)
@@ -46,6 +46,7 @@ class HTMLAnchorElementImpl;
 class HTMLDocumentImpl;
 class HTMLElementImpl;
 class HTMLFormElementImpl;
+class HTMLFrameSetElementImpl;
 class HTMLGenericFormElementImpl;
 class HTMLTitleElementImpl;
 class InlineBox;
@@ -173,6 +174,8 @@ public:
     void setHasBorder(bool);
     bool hasBorder() const;
     
+    void setResizingFrameSet(HTMLFrameSetElementImpl *);
+
 #if __APPLE__
     void updateDashboardRegions();
 #endif
index c2a8a910bf5eefb9699de7c175f5cba711986963..8d4dac90e54932ed5ff6421723fefe32ed9d7eea 100644 (file)
@@ -544,6 +544,7 @@ void RenderFrameSet::setResizing(bool e)
     for (RenderObject* p = parent(); p; p = p->parent())
         if (p->isFrameSet())
             static_cast<RenderFrameSet*>(p)->m_clientResizing = m_resizing;
+    canvas()->view()->setResizingFrameSet(e ? element() : 0);
 }
 
 bool RenderFrameSet::canResize( int _x, int _y )