gnash-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-


From: Benjamin Wolsey
Subject: [Gnash-commit] [SCM] Gnash branch, master, updated. release_0_8_9_final-501-g20dd19a
Date: Fri, 15 Jul 2011 16:46:00 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Gnash".

The branch, master has been updated
       via  20dd19a93326f1e31d7816922a5677f4b73d4d26 (commit)
       via  9f881d74be34854dd4f00927e209e7c0aa90cdd4 (commit)
       via  a4730c154700f218265e2b9914e01f56f6a6314e (commit)
       via  168efca45d2abfad72265994e552b8b10fba78d7 (commit)
       via  6f075d81d53882da3f2e60c322562cae5a134aa7 (commit)
       via  77832830e268c029819bddc0347b197acdd3ade6 (commit)
       via  a0a6b4c93752b7159887a50a84eb764d592e14c2 (commit)
       via  15bdde900a1a7cc3ae28281fd59ac42c85dc5bbd (commit)
       via  93919197e81e0e9dc347b3ef8422ed1ad2399817 (commit)
       via  a57860f9a0b514a6d103edaaa3975749ad69d1be (commit)
       via  6c7aff3e7059393d31dfa82cc9b836790627a7d4 (commit)
       via  aee33180f3bab569bddcd919e62aec118a0303fe (commit)
      from  b260e81b67d1d35f3841fa763e90cde003f7656f (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.savannah.gnu.org/cgit//commit/?id=20dd19a93326f1e31d7816922a5677f4b73d4d26


commit 20dd19a93326f1e31d7816922a5677f4b73d4d26
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 18:16:24 2011 +0200

    Add test for ActionStopDrag opcode.

diff --git a/testsuite/misc-ming.all/DragDropTest.as 
b/testsuite/misc-ming.all/DragDropTest.as
index 4593689..6ed02e6 100644
--- a/testsuite/misc-ming.all/DragDropTest.as
+++ b/testsuite/misc-ming.all/DragDropTest.as
@@ -315,8 +315,11 @@ test11 = function()
 {
        note("11. Click on the SECOND GREEN circle.");
 
-    // This should stop any dragging.
-    _root.stopDrag();
+    // Deliberately set target to null and then 
+    // call stopDrag (old version) to make sure it still works.
+    asm { push null settargetexpr };
+    stopDrag();
+
     check_equals(_root.tf._x, 0);
     check_equals(_root.tf._y, 100);
 

http://git.savannah.gnu.org/cgit//commit/?id=9f881d74be34854dd4f00927e209e7c0aa90cdd4


commit 9f881d74be34854dd4f00927e209e7c0aa90cdd4
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 18:12:28 2011 +0200

    Test that MovieClip.startDrag works for TextFields.
    
    It does, and Gnash now does so too.

diff --git a/testsuite/misc-ming.all/DragDropTest.as 
b/testsuite/misc-ming.all/DragDropTest.as
index 5ea0689..4593689 100644
--- a/testsuite/misc-ming.all/DragDropTest.as
+++ b/testsuite/misc-ming.all/DragDropTest.as
@@ -61,7 +61,10 @@ dragOutHandler = function()
        note(this+'.onDragOver called with args: '+dumpObject(arguments));
 };
 
-createEmptyMovieClip("target10", 10);
+ createTextField("tf", 0, 0, 100, 20, 5004);
+tf.text = "Hello";
+
+ createEmptyMovieClip("target10", 10);
 with (target10)
 {
        lineStyle(4, 0);
@@ -302,16 +305,35 @@ test10 = function()
                // move the draggable over the first green square
                _root.draggable50._x = _root.draggable50._y = 50;
 
-               // and stop the drag 
-               _root.draggable50.stopDrag();
-
                test11();
        };
 };
 
+// Check that startDrag works for a textfield.
+// The textfield should no longer be at 0, 100.
 test11 = function()
 {
-       note("11. Click ANYWHERE OUT of the THIRD BLUE circle (on another 
circle makes a better test)");
+       note("11. Click on the SECOND GREEN circle.");
+
+    // This should stop any dragging.
+    _root.stopDrag();
+    check_equals(_root.tf._x, 0);
+    check_equals(_root.tf._y, 100);
+
+    tf.startDrag = MovieClip.prototype.startDrag;
+    tf.startDrag(true);
+       _root.onMouseDown = function()
+       {
+               check_equals(_root.draggable50._droptarget, 
"/loadedTarget/target100");
+        check(_root.tf._x != 0);
+        check(_root.tf._y != 100);
+               test12();
+       };
+};
+
+test12 = function()
+{
+       note("12. Click ANYWHERE OUT of the THIRD BLUE circle (on another 
circle makes a better test)");
        _root.onMouseDown = function()
        {
                check_equals(_root.draggable50._droptarget, 
"/loadedTarget/target100");
@@ -324,7 +346,7 @@ endOfTest = function()
 {
        _root.ENDOFTEST = true;
        note("END OF TEST");
-       check_totals(21);
+       check_totals(26);
        _root.onMouseDown = undefined;
 };
 
diff --git a/testsuite/misc-ming.all/DragDropTestRunner.cpp 
b/testsuite/misc-ming.all/DragDropTestRunner.cpp
index 75ae989..cb53ad9 100644
--- a/testsuite/misc-ming.all/DragDropTestRunner.cpp
+++ b/testsuite/misc-ming.all/DragDropTestRunner.cpp
@@ -161,7 +161,16 @@ main(int /*argc*/, char** /*argv*/)
        tester.movePointerTo(bc3.x, bc3.y);
        tester.click(); 
 
-       // 11. Click ANYWHERE OUT of the THIRD BLUE circle (on another circle 
makes a better test)
+       // 11. Click on the SECOND GREEN circle.
+    // (Checks that the textfield has moved)
+       tester.movePointerTo(gc2.x, gc2.y);
+
+    // Make sure the position is updated!
+    tester.advance();
+
+       tester.click();
+
+       // 12. Click ANYWHERE OUT of the THIRD BLUE circle (on another circle 
makes a better test)
        tester.movePointerTo(rc1.x, rc1.y);
        tester.click();
 

http://git.savannah.gnu.org/cgit//commit/?id=a4730c154700f218265e2b9914e01f56f6a6314e


commit a4730c154700f218265e2b9914e01f56f6a6314e
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 17:14:42 2011 +0200

    Make MovieClip.prototype.startDrag less picky.
    
    It can also be applied to TextFields and Buttons.

diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index 1b29344..3c0394a 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -783,7 +783,8 @@ movieclip_gotoAndPlay(const fn_call& fn)
     return as_value();
 }
 
-as_value movieclip_gotoAndStop(const fn_call& fn)
+as_value
+movieclip_gotoAndStop(const fn_call& fn)
 {
     MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
 
@@ -812,7 +813,8 @@ as_value movieclip_gotoAndStop(const fn_call& fn)
     return as_value();
 }
 
-as_value movieclip_nextFrame(const fn_call& fn)
+as_value
+movieclip_nextFrame(const fn_call& fn)
 {
     MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
 
@@ -1880,17 +1882,19 @@ movieclip_beginGradientFill(const fn_call& fn)
 
 // startDrag([lockCenter:Boolean], [left:Number], [top:Number],
 //    [right:Number], [bottom:Number]) : Void`
+//
+//    This can also be applied to other DisplayObjects such as TextFields.
 as_value
 movieclip_startDrag(const fn_call& fn)
 {
-    MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
+    DisplayObject* o = ensure<IsDisplayObject<> >(fn);
 
     // mark this DisplayObject is transformed.
-    movieclip->transformedByScript();
+    o->transformedByScript();
 
     const bool lock = fn.nargs ? toBool(fn.arg(0), getVM(fn)) : false;
 
-    DragState st(movieclip, lock);
+    DragState st(o, lock);
 
     if (fn.nargs > 4) {
         double x0 = toNumber(fn.arg(1), getVM(fn));
@@ -1947,8 +1951,6 @@ movieclip_startDrag(const fn_call& fn)
 as_value
 movieclip_stopDrag(const fn_call& fn)
 {
-    // Should this be a MovieClip only function? It isn't
-    // necessary.
     getRoot(fn).stop_drag();
     return as_value();
 }
@@ -2031,7 +2033,6 @@ movieclip_lineGradientStyle(const fn_call& fn)
 as_value
 movieclip_attachBitmap(const fn_call& fn)
 {
-
     MovieClip* ptr = ensure<IsDisplayObject<MovieClip> >(fn);
 
     if (fn.nargs < 2) {

http://git.savannah.gnu.org/cgit//commit/?id=168efca45d2abfad72265994e552b8b10fba78d7


commit 168efca45d2abfad72265994e552b8b10fba78d7
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 17:07:05 2011 +0200

    Add used headers.

diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index e584516..1b29344 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -20,6 +20,10 @@
 #include "MovieClip_as.h"
 
 #include <boost/lexical_cast.hpp>
+#include <vector>
+#include <string>
+#include <sstream>
+#include <algorithm>
 
 #include "MovieClip.h"
 #include "Movie.h"

http://git.savannah.gnu.org/cgit//commit/?id=6f075d81d53882da3f2e60c322562cae5a134aa7


commit 6f075d81d53882da3f2e60c322562cae5a134aa7
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 17:04:55 2011 +0200

    Use boost::optional and make DragState less mutable.

diff --git a/libcore/DragState.h b/libcore/DragState.h
index ce7dd1d..22bcb37 100644
--- a/libcore/DragState.h
+++ b/libcore/DragState.h
@@ -19,6 +19,8 @@
 #ifndef GNASH_DRAG_STATE_H
 #define GNASH_DRAG_STATE_H
 
+#include <boost/optional.hpp>
+
 #include "SWFRect.h"
 #include "DisplayObject.h"
 
@@ -34,12 +36,10 @@ class DragState
 {
 public:
 
-    DragState(DisplayObject* d)
+    DragState(DisplayObject* d, bool lock)
         :
-        _hasbounds(false),
-        _bounds(),
         _displayObject(d),
-        _lock_centered(false)
+        _lock_centered(lock)
     {
     }
 
@@ -47,10 +47,6 @@ public:
         return _lock_centered;
     }
 
-    void setLockCentered(bool lock) {
-        _lock_centered = lock;
-    }
-
     /// Set displacement offset from origin
     /// at time of drag start.
     /// Coordinates are in stage space (twips)
@@ -64,7 +60,7 @@ public:
     boost::int32_t yOffset() const { return _yoffset; }
 
     bool hasBounds() const {
-        return _hasbounds;
+        return (_bounds);
     }
 
     /// \brief
@@ -78,7 +74,7 @@ public:
     /// the returned rectangle is the NULL
     /// rectangle - see SWFRect::is_null().
     ///
-    const SWFRect& getBounds() const { return _bounds; }
+    const SWFRect& getBounds() const { return *_bounds; }
 
     /// \brief
     /// Set the boundaries to constraint
@@ -89,7 +85,6 @@ public:
     ///
     void setBounds(const SWFRect& bounds) {
         _bounds = bounds;
-        _hasbounds = true;
     }
 
     /// May return NULL !!
@@ -100,8 +95,7 @@ public:
     /// Reset drag state to its initial condition
     void reset() {
         _displayObject = 0;
-        _hasbounds = false;
-        _bounds.set_null();
+        _bounds.reset();
         _lock_centered = false;
     }
 
@@ -112,11 +106,9 @@ public:
 
 private:
 
-    bool _hasbounds;
-
     /// Boundaries to constrain the drag into.
     /// Coordinates in TWIPS.
-    SWFRect _bounds;
+    boost::optional<SWFRect> _bounds;
 
     DisplayObject* _displayObject;
 
diff --git a/libcore/asobj/MovieClip_as.cpp b/libcore/asobj/MovieClip_as.cpp
index 6e8112b..e584516 100644
--- a/libcore/asobj/MovieClip_as.cpp
+++ b/libcore/asobj/MovieClip_as.cpp
@@ -1881,59 +1881,57 @@ movieclip_startDrag(const fn_call& fn)
 {
     MovieClip* movieclip = ensure<IsDisplayObject<MovieClip> >(fn);
 
-    DragState st(movieclip);
-
     // mark this DisplayObject is transformed.
     movieclip->transformedByScript();
 
-    if (fn.nargs) {
-        st.setLockCentered(toBool(fn.arg(0), getVM(fn)));
-
-        if (fn.nargs > 4) {
-            double x0 = toNumber(fn.arg(1), getVM(fn));
-            double y0 = toNumber(fn.arg(2), getVM(fn));
-            double x1 = toNumber(fn.arg(3), getVM(fn));
-            double y1 = toNumber(fn.arg(4), getVM(fn));
-
-            // check for infinite values
-            bool gotinf = false;
-            if (!isFinite(x0)) { x0=0; gotinf=true; }
-            if (!isFinite(y0)) { y0=0; gotinf=true; }
-            if (!isFinite(x1)) { x1=0; gotinf=true; }
-            if (!isFinite(y1)) { y1=0; gotinf=true; }
-
-            // check for swapped values
-            bool swapped = false;
-            if (y1 < y0) {
-                std::swap(y1, y0);
-                swapped = true;
-            }
+    const bool lock = fn.nargs ? toBool(fn.arg(0), getVM(fn)) : false;
 
-            if (x1 < x0) {
-                std::swap(x1, x0);
-                swapped = true;
-            }
+    DragState st(movieclip, lock);
 
-            IF_VERBOSE_ASCODING_ERRORS(
-                if (gotinf || swapped) {
-                    std::stringstream ss; fn.dump_args(ss);
-                    if (swapped) { 
-                        log_aserror(_("min/max bbox values in "
-                            "MovieClip.startDrag(%s) swapped, fixing"),
-                            ss.str());
-                    }
-                    if (gotinf) {
-                        log_aserror(_("non-finite bbox values in "
-                            "MovieClip.startDrag(%s), took as zero"),
-                            ss.str());
-                    }
-                }
-            );
+    if (fn.nargs > 4) {
+        double x0 = toNumber(fn.arg(1), getVM(fn));
+        double y0 = toNumber(fn.arg(2), getVM(fn));
+        double x1 = toNumber(fn.arg(3), getVM(fn));
+        double y1 = toNumber(fn.arg(4), getVM(fn));
+
+        // check for infinite values
+        bool gotinf = false;
+        if (!isFinite(x0)) { x0=0; gotinf=true; }
+        if (!isFinite(y0)) { y0=0; gotinf=true; }
+        if (!isFinite(x1)) { x1=0; gotinf=true; }
+        if (!isFinite(y1)) { y1=0; gotinf=true; }
+
+        // check for swapped values
+        bool swapped = false;
+        if (y1 < y0) {
+            std::swap(y1, y0);
+            swapped = true;
+        }
 
-            SWFRect bounds(pixelsToTwips(x0), pixelsToTwips(y0),
-                    pixelsToTwips(x1), pixelsToTwips(y1));
-            st.setBounds(bounds);
+        if (x1 < x0) {
+            std::swap(x1, x0);
+            swapped = true;
         }
+
+        IF_VERBOSE_ASCODING_ERRORS(
+            if (gotinf || swapped) {
+                std::stringstream ss; fn.dump_args(ss);
+                if (swapped) { 
+                    log_aserror(_("min/max bbox values in "
+                        "MovieClip.startDrag(%s) swapped, fixing"),
+                        ss.str());
+                }
+                if (gotinf) {
+                    log_aserror(_("non-finite bbox values in "
+                        "MovieClip.startDrag(%s), took as zero"),
+                        ss.str());
+                }
+            }
+        );
+
+        SWFRect bounds(pixelsToTwips(x0), pixelsToTwips(y0),
+                pixelsToTwips(x1), pixelsToTwips(y1));
+        st.setBounds(bounds);
     }
 
     getRoot(fn).setDragState(st);
diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index cc83576..3bc899a 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -145,7 +145,6 @@ movie_root::movie_root(VirtualClock& clock, const 
RunResources& runResources)
     _lastTimerId(0),
     _lastKeyEvent(key::INVALID),
     _currentFocus(0),
-    _dragState(0),
     _movies(),
     _rootMovie(0),
     _invalidated(true),
@@ -730,8 +729,10 @@ void
 movie_root::setDragState(const DragState& st)
 {
     _dragState = st;
-    DisplayObject* ch = st.getCharacter();
-    if (ch && !st.isLockCentered()) {
+
+    DisplayObject* ch = _dragState->getCharacter();
+
+    if (ch && !_dragState->isLockCentered()) {
         // Get coordinates of the DisplayObject's origin
         point origin(0, 0);
         SWFMatrix chmat = getWorldMatrix(*ch);
@@ -739,12 +740,12 @@ movie_root::setDragState(const DragState& st)
         chmat.transform(&world_origin, origin);
 
         // Get current mouse coordinates
-        point world_mouse(pixelsToTwips(_mouseX), pixelsToTwips(_mouseY));
+        const point world_mouse(pixelsToTwips(_mouseX), 
pixelsToTwips(_mouseY));
 
         boost::int32_t xoffset = world_mouse.x - world_origin.x;
         boost::int32_t yoffset = world_mouse.y - world_origin.y;
 
-        _dragState.setOffset(xoffset, yoffset);
+        _dragState->setOffset(xoffset, yoffset);
     }
     assert(testInvariant());
 }
@@ -769,16 +770,16 @@ movie_root::doMouseDrag()
         parent_world_mat = getWorldMatrix(*p);
     }
 
-    if (!_dragState.isLockCentered()) {
-        world_mouse.x -= _dragState.xOffset();
-        world_mouse.y -= _dragState.yOffset();
+    if (!_dragState->isLockCentered()) {
+        world_mouse.x -= _dragState->xOffset();
+        world_mouse.y -= _dragState->yOffset();
     }
 
-    if (_dragState.hasBounds()) {
+    if (_dragState->hasBounds()) {
         SWFRect bounds;
         // bounds are in local coordinate space
         bounds.enclose_transformed_rect(parent_world_mat,
-                _dragState.getBounds());
+                _dragState->getBounds());
         // Clamp mouse coords within a defined SWFRect.
         bounds.clamp(world_mouse);
     }
@@ -1085,7 +1086,7 @@ movie_root::getActiveEntityUnderPointer() const
 DisplayObject*
 movie_root::getDraggingCharacter() const
 {
-    return _dragState.getCharacter();
+    return _dragState ? _dragState->getCharacter() : 0;
 }
 
 const DisplayObject*
@@ -1710,7 +1711,7 @@ movie_root::markReachableResources() const
     if (_currentFocus) _currentFocus->setReachable();
 
     // Mark DisplayObject being dragged, if any
-    _dragState.markReachableResources();
+    if (_dragState) _dragState->markReachableResources();
 
     // NOTE: cleanupDisplayList() should have cleaned up all
     // unloaded live characters. The remaining ones should be marked
diff --git a/libcore/movie_root.h b/libcore/movie_root.h
index 2e6e4ed..09c29d3 100644
--- a/libcore/movie_root.h
+++ b/libcore/movie_root.h
@@ -78,6 +78,7 @@
 #include <boost/ptr_container/ptr_deque.hpp>
 #include <boost/noncopyable.hpp>
 #include <boost/any.hpp>
+#include <boost/optional.hpp>
 
 #include "dsodefs.h" // DSOEXPORT
 #include "MouseButtonState.h" // for composition
@@ -999,7 +1000,7 @@ private:
     DisplayObject* _currentFocus;
 
     /// @todo fold this into m_mouse_button_state?
-    DragState _dragState;
+    boost::optional<DragState> _dragState;
 
     typedef std::map<int, MovieClip*> Levels;
 
diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index f0f3922..7d2347b 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -1205,10 +1205,9 @@ ActionStartDragMovie(ActionExec& thread)
             log_aserror(_("startDrag: unknown target '%s'"), env.top(0));
         );
     }
-    DragState st(tgt);
 
     const bool lock = toBool(env.top(1), getVM(env));
-    st.setLockCentered(lock);
+    DragState st(tgt, lock);
 
     // toNumber because we found out that ming writes "0" for the third
     // argument, and this converts to true when converted to a bool when

http://git.savannah.gnu.org/cgit//commit/?id=77832830e268c029819bddc0347b197acdd3ade6


commit 77832830e268c029819bddc0347b197acdd3ade6
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 16:48:25 2011 +0200

    Don't waste space.

diff --git a/libcore/DisplayObject.cpp b/libcore/DisplayObject.cpp
index 978c6b7..e6bf097 100644
--- a/libcore/DisplayObject.cpp
+++ b/libcore/DisplayObject.cpp
@@ -218,7 +218,6 @@ DisplayObject::set_invalidated(const char* debug_file, int 
debug_line)
         m_old_invalidated_ranges.setNull();
         add_invalidated_bounds(m_old_invalidated_ranges, true);
     }
-
 }
 
 void
@@ -236,11 +235,10 @@ DisplayObject::add_invalidated_bounds(InvalidatedRanges& 
ranges, bool force)
 void
 DisplayObject::set_child_invalidated()
 {
-  if ( ! _child_invalidated ) 
-  {
-    _child_invalidated=true;
-      if ( _parent ) _parent->set_child_invalidated();
-  } 
+    if (!_child_invalidated) {
+        _child_invalidated=true;
+        if (_parent) _parent->set_child_invalidated();
+    } 
 }
 
 void
@@ -1100,7 +1098,6 @@ setHighQuality(DisplayObject& o, const as_value& val)
 void
 setY(DisplayObject& o, const as_value& val)
 {
-
     const double newy = toNumber(val, getVM(*getObject(&o)));
 
     // NaN is skipped, Infinite isn't
@@ -1162,7 +1159,6 @@ getX(DisplayObject& o)
 void
 setScaleX(DisplayObject& o, const as_value& val)
 {
-
     const double scale_percent = toNumber(val, getVM(*getObject(&o)));
 
     // NaN is skipped, Infinite is not, see actionscript.all/setProperty.as
@@ -1189,7 +1185,6 @@ getScaleX(DisplayObject& o)
 void
 setScaleY(DisplayObject& o, const as_value& val)
 {
-
     const double scale_percent = toNumber(val, getVM(*getObject(&o)));
 
     // NaN is skipped, Infinite is not, see actionscript.all/setProperty.as
@@ -1222,7 +1217,6 @@ getVisible(DisplayObject& o)
 void
 setVisible(DisplayObject& o, const as_value& val)
 {
-
     /// We cast to number and rely (mostly) on C++'s automatic
     /// cast to bool, as string "0" should be converted to
     /// its numeric equivalent, not interpreted as 'true', which
@@ -1253,7 +1247,6 @@ getAlpha(DisplayObject& o)
 void
 setAlpha(DisplayObject& o, const as_value& val)
 {
-
     // The new internal alpha value is input / 100.0 * 256.
     // We test for finiteness later, but the multiplication
     // won't make any difference.
@@ -1322,7 +1315,6 @@ getRotation(DisplayObject& o)
 void
 setRotation(DisplayObject& o, const as_value& val)
 {
-
     // input is in degrees
     const double rotation_val = toNumber(val, getVM(*getObject(&o)));
 

http://git.savannah.gnu.org/cgit//commit/?id=a0a6b4c93752b7159887a50a84eb764d592e14c2


commit a0a6b4c93752b7159887a50a84eb764d592e14c2
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 16:44:25 2011 +0200

    Split long line.

diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index 5f7ba7e..f0f3922 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -47,7 +47,7 @@
 #include "as_object.h"
 #include "DragState.h"
 #include "VM.h" // for getting the root
-#include "movie_root.h" // for set_DragState (ActionStartDragMovie)
+#include "movie_root.h" 
 #include "sound_handler.h"
 #include "namedStrings.h"
 #include "utf8.h"
@@ -464,7 +464,10 @@ ActionNextFrame(ActionExec& thread)
     DisplayObject* tgtch = env.target();
     MovieClip* tgt = tgtch ? tgtch->to_movie() : 0;
     if (tgt) tgt->goto_frame(tgt->get_current_frame() + 1);
-    else log_debug(_("ActionNextFrame: as_environment target is null or not a 
sprite"));
+    else {
+        log_debug(_("ActionNextFrame: as_environment target is null "
+                    "or not a sprite"));
+    }
 }
 
 void

http://git.savannah.gnu.org/cgit//commit/?id=15bdde900a1a7cc3ae28281fd59ac42c85dc5bbd


commit 15bdde900a1a7cc3ae28281fd59ac42c85dc5bbd
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 12:58:40 2011 +0200

    Trim some long lines.

diff --git a/libmedia/gst/MediaParserGst.cpp b/libmedia/gst/MediaParserGst.cpp
index ab0aaad..78b2c5f 100644
--- a/libmedia/gst/MediaParserGst.cpp
+++ b/libmedia/gst/MediaParserGst.cpp
@@ -320,58 +320,59 @@ MediaParserGst::link_to_fakesink(GstPad* pad)
 
 // static 
 void
-MediaParserGst::cb_typefound (GstElement* typefind, guint /* probability */,
+MediaParserGst::cb_typefound(GstElement* typefind, guint /*probability*/,
                               GstCaps* caps, gpointer data)
 {
     print_caps(caps);
 
     MediaParserGst* parser = static_cast<MediaParserGst*>(data);
 
-    GstElementFactory* demuxfactory = swfdec_gst_get_demuxer_factory (caps);
+    GstElementFactory* demuxfactory = swfdec_gst_get_demuxer_factory(caps);
     
     if (!demuxfactory) {
-    
-        GstPad* srcpad = gst_element_get_static_pad (typefind, "src");
+        GstPad* srcpad = gst_element_get_static_pad(typefind, "src");
+
         if (!srcpad) {
             throw MediaException(_("MediaParserGst: couldn't get the typefind "
                                    "src element."));
         }
 
         cb_pad_added(typefind, srcpad, parser);
-
         gst_object_unref(GST_OBJECT(srcpad));
-        
         parser->_demux_probe_ended = true;
+        return;
+    }
 
-    } else {
-
-        GstElement* demuxer = gst_element_factory_create (demuxfactory, 
"demuxer");
-        
-        gst_object_unref(GST_OBJECT(demuxfactory));
+    // We have a factory, so create the demuxer.
+    GstElement* demuxer = gst_element_factory_create(demuxfactory, "demuxer");
+    gst_object_unref(GST_OBJECT(demuxfactory));
 
-        if (!demuxer) {
-            throw MediaException(_("MediaParserGst: couldn't create the 
demuxer"));
-        }
-        
-        gboolean success = gst_bin_add(GST_BIN(parser->_bin), demuxer);
-        if (!success) {
-            log_error(_("MediaParserGst: failed adding demuxer to bin."));
-            // This error might not be fatal, so we'll continue.
-        }        
-        
-        success = gst_element_link(typefind, demuxer);
-        if (!success) {
-            throw MediaException(_("MediaParserGst: failed adding demuxer to 
bin."));
-        }
-        
-        g_signal_connect (demuxer, "pad-added", G_CALLBACK 
(MediaParserGst::cb_pad_added), parser);
-        g_signal_connect (demuxer, "no-more-pads", G_CALLBACK 
(MediaParserGst::cb_no_more_pads), parser);
-        
-        if (!gst_element_set_state (parser->_bin, GST_STATE_PLAYING) == 
GST_STATE_CHANGE_SUCCESS) {
-            throw GnashException(_("MediaParserGst could not change element 
state"));
-        }
+    if (!demuxer) {
+        throw MediaException(_("MediaParserGst: couldn't create the "
+                    "demuxer"));
+    }
+    
+    gboolean success = gst_bin_add(GST_BIN(parser->_bin), demuxer);
+    if (!success) {
+        log_error(_("MediaParserGst: failed adding demuxer to bin."));
+    }        
+    
+    success = gst_element_link(typefind, demuxer);
+    if (!success) {
+        throw MediaException(_("MediaParserGst: failed adding demuxer "
+                    "to bin."));
+    }
+    
+    g_signal_connect(demuxer, "pad-added",
+            G_CALLBACK(MediaParserGst::cb_pad_added), parser);
+    g_signal_connect(demuxer, "no-more-pads", 
+            G_CALLBACK(MediaParserGst::cb_no_more_pads), parser);
+    
+    if (!gst_element_set_state(parser->_bin, GST_STATE_PLAYING) ==
+            GST_STATE_CHANGE_SUCCESS) {
+        throw GnashException(_("MediaParserGst could not change "
+                    "element state"));
     }
-
 }
 
 //static 

http://git.savannah.gnu.org/cgit//commit/?id=93919197e81e0e9dc347b3ef8422ed1ad2399817


commit 93919197e81e0e9dc347b3ef8422ed1ad2399817
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 16:27:18 2011 +0200

    Minor cleanup.

diff --git a/libcore/movie_root.cpp b/libcore/movie_root.cpp
index 87a9983..cc83576 100644
--- a/libcore/movie_root.cpp
+++ b/libcore/movie_root.cpp
@@ -677,7 +677,6 @@ movie_root::mouseClick(bool mouse_pressed)
 bool
 movie_root::fire_mouse_event()
 {
-
     assert(testInvariant());
 
     boost::int32_t x = pixelsToTwips(_mouseX);
@@ -687,20 +686,20 @@ movie_root::fire_mouse_event()
     _mouseButtonState.topmostEntity = getTopmostMouseEntity(x, y);
 
     // Set _droptarget if dragging a sprite
-    MovieClip* dragging = 0;
     DisplayObject* draggingChar = getDraggingCharacter();
-    if (draggingChar) dragging = draggingChar->to_movie();
-    if (dragging) {
-        // TODO: optimize making findDropTarget and getTopmostMouseEntity
-        //       use a single scan.
-        const DisplayObject* dropChar = findDropTarget(x, y, dragging);
-        if (dropChar) {
-            // Use target of closest script DisplayObject containing this
-            dropChar = getNearestObject(dropChar);
-            dragging->setDropTarget(dropChar->getTargetPath());
+    if (draggingChar) {
+        MovieClip* dragging = draggingChar->to_movie();
+        if (dragging) {
+            // TODO: optimize making findDropTarget and getTopmostMouseEntity
+            //       use a single scan.
+            const DisplayObject* dropChar = findDropTarget(x, y, dragging);
+            if (dropChar) {
+                // Use target of closest script DisplayObject containing this
+                dropChar = getNearestObject(dropChar);
+                dragging->setDropTarget(dropChar->getTargetPath());
+            }
+            else dragging->setDropTarget("");
         }
-        else dragging->setDropTarget("");
-
     }
 
     bool need_redraw = false;
@@ -999,12 +998,11 @@ movie_root::notify_mouse_listeners(const event_id& event)
         try {
             callMethod(mouseObj, propBroadcastMessage, event.functionName());
         }
-        catch (ActionLimitException &e) {
+        catch (const ActionLimitException& e) {
             log_error(_("ActionLimits hit notifying mouse events: %s."),
                     e.what());
             clear(_actionQueue);
         }
-        
     }
 
     assert(testInvariant());

http://git.savannah.gnu.org/cgit//commit/?id=a57860f9a0b514a6d103edaaa3975749ad69d1be


commit a57860f9a0b514a6d103edaaa3975749ad69d1be
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 16:26:47 2011 +0200

    Drop some unneeded things.
    
    Functions, typedefs, comments.

diff --git a/libcore/MovieClip.cpp b/libcore/MovieClip.cpp
index 44889d0..af75323 100644
--- a/libcore/MovieClip.cpp
+++ b/libcore/MovieClip.cpp
@@ -1557,12 +1557,6 @@ MovieClip::mouseEnabled() const
 }
 
 void
-MovieClip::stop_drag()
-{
-    stage().stop_drag();
-}
-
-void
 MovieClip::set_background_color(const rgba& color)
 {
     stage().set_background_color(color);
@@ -2049,18 +2043,15 @@ MovieClip::getAsRoot()
     //                we might as well just return _swf, 
     //                the whole chain from this movieclip to it's
     //                _swf should have the same version...
-    //
-    // TODO2: implement this with iteration rather
-    //                then recursion.
-    //                
-
     DisplayObject* p = parent();
-    if (!p) return this; // no parent, we're the root
+
+    // no parent, we're the root
+    if (!p) return this; 
 
     // If we have a parent, we descend to it unless 
     // our _lockroot is true AND our or the VM's
     // SWF version is > 6
-    int topSWFVersion = stage().getRootMovie().version();
+    const int topSWFVersion = stage().getRootMovie().version();
 
     if (getDefinitionVersion() > 6 || topSWFVersion > 6) {
         if (getLockRoot()) return this;
diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index b14f2e7..fa2ec3a 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -93,8 +93,6 @@ public:
 
     typedef std::map<std::string, std::string> MovieVariables;
 
-    typedef std::list<const action_buffer*> ActionList;
-
     typedef movie_definition::PlayList PlayList;
 
     enum PlayState
@@ -474,9 +472,6 @@ public:
     /// The frame_spec could be an integer or a string.
     virtual void call_frame_actions(const as_value& frame_spec);
 
-    // delegates to movie_root 
-    virtual void stop_drag();
-
     /// Duplicate this sprite in its timeline
     //
     /// Add the new DisplayObject at a the given depth to this sprite

http://git.savannah.gnu.org/cgit//commit/?id=6c7aff3e7059393d31dfa82cc9b836790627a7d4


commit 6c7aff3e7059393d31dfa82cc9b836790627a7d4
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 16:24:38 2011 +0200

    Fixes to dragging.
    
    ming erroneously compiles startDrag(this, true) by pushing "0" instead
    of a false value to the stack, but the pp still converts it to false.
    Fix by using toNumber instead of toBool.
    
    Gnash was checking for a valid target before calling stopDrag(), but
    this is unnecessary.

diff --git a/libcore/vm/ASHandlers.cpp b/libcore/vm/ASHandlers.cpp
index 29374f5..5f7ba7e 100644
--- a/libcore/vm/ASHandlers.cpp
+++ b/libcore/vm/ASHandlers.cpp
@@ -1204,13 +1204,14 @@ ActionStartDragMovie(ActionExec& thread)
     }
     DragState st(tgt);
 
-    st.setLockCentered(toBool(env.top(1), getVM(env)));
+    const bool lock = toBool(env.top(1), getVM(env));
+    st.setLockCentered(lock);
+
+    // toNumber because we found out that ming writes "0" for the third
+    // argument, and this converts to true when converted to a bool when
+    // it should actually convert to false!
+    if (toNumber(env.top(2), getVM(env))) {
 
-    // Handle bounds.
-    if (toBool(env.top(2), getVM(env))) {
-        // strk: this works if we didn't drop any before, in
-        // a contrary case (if we used pop(), which I suggest)
-        // we must remember to updated this as required
         boost::int32_t y1 = pixelsToTwips(toNumber(env.top(3), getVM(env)));
         boost::int32_t x1 = pixelsToTwips(toNumber(env.top(4), getVM(env)));
         boost::int32_t y0 = pixelsToTwips(toNumber(env.top(5), getVM(env)));
@@ -1247,11 +1248,9 @@ void
 ActionStopDragMovie(ActionExec& thread)
 {
     as_environment& env = thread.env;
-    DisplayObject* tgtch = env.target();
-    MovieClip* root_movie = tgtch ? tgtch->get_root() : 0;
-    if (root_movie) root_movie->stop_drag();
-    else log_debug(_("ActionStopDragMovie: as_environment target is "
-                "null or not a sprite"));
+    // Previously this checked the target, but manual tests show no
+    // need to do that; the drag is always stopped.
+    getRoot(env).stop_drag();
 }
 
 void

http://git.savannah.gnu.org/cgit//commit/?id=aee33180f3bab569bddcd919e62aec118a0303fe


commit aee33180f3bab569bddcd919e62aec118a0303fe
Author: Benjamin Wolsey <address@hidden>
Date:   Fri Jul 15 15:02:26 2011 +0200

    Make notifyEvent nonvirtual.

diff --git a/libcore/MovieClip.h b/libcore/MovieClip.h
index 4f00225..b14f2e7 100644
--- a/libcore/MovieClip.h
+++ b/libcore/MovieClip.h
@@ -507,7 +507,7 @@ public:
     //
     /// This handles key, mouse, and specific MovieClip events.
     /// TODO: split this sensibly.
-    virtual void notifyEvent(const event_id& id);
+    void notifyEvent(const event_id& id);
 
     // inherited from DisplayObject class, see dox in DisplayObject.h
     virtual as_environment& get_environment() {

-----------------------------------------------------------------------

Summary of changes:
 libcore/DisplayObject.cpp                      |   16 +---
 libcore/DragState.h                            |   24 ++----
 libcore/MovieClip.cpp                          |   17 +---
 libcore/MovieClip.h                            |    7 +--
 libcore/asobj/MovieClip_as.cpp                 |  111 ++++++++++++------------
 libcore/movie_root.cpp                         |   53 ++++++------
 libcore/movie_root.h                           |    3 +-
 libcore/vm/ASHandlers.cpp                      |   29 +++---
 libmedia/gst/MediaParserGst.cpp                |   67 +++++++-------
 testsuite/misc-ming.all/DragDropTest.as        |   37 +++++++--
 testsuite/misc-ming.all/DragDropTestRunner.cpp |   11 ++-
 11 files changed, 192 insertions(+), 183 deletions(-)


hooks/post-receive
-- 
Gnash



reply via email to

[Prev in Thread] Current Thread [Next in Thread]