[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gnash-commit] /srv/bzr/gnash/trunk r10371: Improve and unify focus hand
From: |
Benjamin Wolsey |
Subject: |
[Gnash-commit] /srv/bzr/gnash/trunk r10371: Improve and unify focus handling for all characters that can accept it. |
Date: |
Mon, 01 Dec 2008 22:30:39 +0100 |
User-agent: |
Bazaar (1.5) |
------------------------------------------------------------
revno: 10371
committer: Benjamin Wolsey <address@hidden>
branch nick: trunk
timestamp: Mon 2008-12-01 22:30:39 +0100
message:
Improve and unify focus handling for all characters that can accept it.
Add (some) tests for Selection focus methods and implement them. Fixes some
problems in bug #24201.
modified:
libcore/Button.cpp
libcore/Button.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/SWFStream.cpp
libcore/TextField.cpp
libcore/TextField.h
libcore/asobj/Selection.cpp
libcore/character.cpp
libcore/character.h
libcore/movie_root.cpp
libcore/movie_root.h
libcore/namedStrings.cpp
libcore/namedStrings.h
libcore/swf/tag_loaders.cpp
testsuite/actionscript.all/MovieClip.as
testsuite/actionscript.all/Selection.as
testsuite/misc-ming.all/DefineEditTextTest.c
testsuite/swfdec/PASSING
------------------------------------------------------------
revno: 10369.1.1
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 14:46:15 +0100
message:
Test focusEnabled property of MovieClip.
Add virtual character::setFocus() to handle checking for focus ability and
to invoke TextField focus actions (already implemented). Incomplete
implementation of Selection.getFocus() and Selection.setFocus().
modified:
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/TextField.cpp
libcore/TextField.h
libcore/asobj/Selection.cpp
libcore/character.h
libcore/movie_root.cpp
libcore/movie_root.h
libcore/namedStrings.cpp
libcore/namedStrings.h
testsuite/actionscript.all/MovieClip.as
testsuite/actionscript.all/Selection.as
------------------------------------------------------------
revno: 10369.1.2
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 15:58:22 +0100
message:
Move most focus handling to movie_root::setFocus(), allow buttons to
handle focus.
modified:
libcore/Button.cpp
libcore/Button.h
libcore/TextField.cpp
libcore/asobj/Selection.cpp
libcore/movie_root.cpp
libcore/movie_root.h
------------------------------------------------------------
revno: 10369.1.3
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 16:16:02 +0100
message:
Rename character::setFocus() to handleFocus() to avoid confusion with
movie_root::setFocus().
modified:
libcore/Button.cpp
libcore/Button.h
libcore/MovieClip.cpp
libcore/MovieClip.h
libcore/TextField.cpp
libcore/TextField.h
libcore/character.h
libcore/movie_root.cpp
------------------------------------------------------------
revno: 10369.1.4
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 17:03:58 +0100
message:
MovieClips can also handle focus when mouse event handlers are defined.
modified:
libcore/MovieClip.cpp
libcore/asobj/Selection.cpp
libcore/movie_root.cpp
------------------------------------------------------------
revno: 10369.1.5
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 18:19:03 +0100
message:
Minor corrections, mark current focus reachable.
modified:
libcore/MovieClip.cpp
libcore/TextField.cpp
libcore/asobj/Selection.cpp
libcore/movie_root.cpp
libcore/movie_root.h
------------------------------------------------------------
revno: 10369.1.6
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 18:52:26 +0100
message:
Don't remove focus when clicking on non-mouse entities.
modified:
libcore/asobj/Selection.cpp
libcore/movie_root.cpp
------------------------------------------------------------
revno: 10369.1.7
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 20:24:05 +0100
message:
Some line breaks.
Test and fix focus and visibility cases.
modified:
libcore/SWFStream.cpp
libcore/asobj/Selection.cpp
libcore/character.cpp
libcore/character.h
libcore/swf/tag_loaders.cpp
testsuite/actionscript.all/Selection.as
------------------------------------------------------------
revno: 10369.1.8
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 21:07:01 +0100
message:
Test Selection.setFocus and getFocus with TextFields.
modified:
testsuite/misc-ming.all/DefineEditTextTest.c
------------------------------------------------------------
revno: 10369.1.9
committer: Benjamin Wolsey <address@hidden>
branch nick: work
timestamp: Mon 2008-12-01 21:58:08 +0100
message:
Clean up implementation. Don't set focus on _level0. Correct comments
for setFocus. Passes in swfdec testsuite.
modified:
libcore/MovieClip.cpp
libcore/asobj/Selection.cpp
libcore/movie_root.cpp
testsuite/actionscript.all/Selection.as
=== modified file 'libcore/Button.cpp'
--- a/libcore/Button.cpp 2008-11-26 15:26:24 +0000
+++ b/libcore/Button.cpp 2008-12-01 15:16:02 +0000
@@ -382,6 +382,13 @@
return xec.called;
}
+bool
+Button::handleFocus() {
+ /// Nothing to do, but can receive focus.
+ return true;
+}
+
+
void
Button::restart()
{
=== modified file 'libcore/Button.h'
--- a/libcore/Button.h 2008-11-26 13:59:04 +0000
+++ b/libcore/Button.h 2008-12-01 15:16:02 +0000
@@ -98,7 +98,8 @@
//
/// I.e. check against ourself.
///
- virtual character* get_topmost_mouse_entity(boost::int32_t x,
boost::int32_t y);
+ virtual character* get_topmost_mouse_entity(boost::int32_t x,
+ boost::int32_t y);
virtual bool wantsInstanceName() const
{
@@ -110,6 +111,8 @@
virtual void on_button_event(const event_id& event);
+ virtual bool handleFocus();
+
//
// ActionScript overrides
//
=== modified file 'libcore/MovieClip.cpp'
--- a/libcore/MovieClip.cpp 2008-11-26 15:26:24 +0000
+++ b/libcore/MovieClip.cpp 2008-12-01 20:58:08 +0000
@@ -1410,13 +1410,16 @@
}
}
-void MovieClip::remove_display_object(const SWF::PlaceObject2Tag* tag,
DisplayList& dlist)
+void
+MovieClip::remove_display_object(const SWF::PlaceObject2Tag* tag,
+ DisplayList& dlist)
{
set_invalidated();
dlist.remove_character(tag->getDepth());
}
-void MovieClip::replace_display_object(character* ch, int depth,
+void
+MovieClip::replace_display_object(character* ch, int depth,
bool use_old_cxform, bool use_old_matrix)
{
assert(ch);
@@ -1424,14 +1427,16 @@
use_old_cxform, use_old_matrix);
}
-int MovieClip::get_id_at_depth(int depth)
+int
+MovieClip::get_id_at_depth(int depth)
{
character* ch = m_display_list.get_character_at_depth(depth);
if ( ! ch ) return -1;
return ch->get_id();
}
-void MovieClip::increment_frame_and_check_for_loop()
+void
+MovieClip::increment_frame_and_check_for_loop()
{
size_t frame_count = get_loaded_frames();
if ( ++m_current_frame >= frame_count )
@@ -1445,11 +1450,24 @@
}
}
-#if 0 // debugging
- log_debug(_("Frame %u/%u, bytes %u/%u"),
- m_current_frame, frame_count,
- get_bytes_loaded(), get_bytes_total());
-#endif
+}
+
+bool
+MovieClip::handleFocus()
+{
+
+ // For SWF6 and above: the MovieClip can always receive focus if
+ // focusEnabled evaluates to true.
+ if (_vm.getSWFVersion() > 5) {
+ as_value focusEnabled;
+ if (get_member(NSV::PROP_FOCUS_ENABLED, &focusEnabled)) {
+ if (focusEnabled.to_bool() == true) return true;
+ }
+ }
+
+ // If focusEnabled doesn't evaluate to true or for SWF5, return true
+ // only if at least one mouse event handler is defined.
+ return can_handle_mouse_event();
}
/// Find a character hit by the given coordinates.
=== modified file 'libcore/MovieClip.h'
--- a/libcore/MovieClip.h 2008-11-26 13:59:04 +0000
+++ b/libcore/MovieClip.h 2008-12-01 15:16:02 +0000
@@ -747,6 +747,11 @@
_drawable->clear();
}
+ /// Set focus to this MovieClip
+ //
+ /// @return true if this MovieClip can receive focus.
+ virtual bool handleFocus();
+
/// @} Drawing API
=== modified file 'libcore/SWFStream.cpp'
--- a/libcore/SWFStream.cpp 2008-11-28 08:23:30 +0000
+++ b/libcore/SWFStream.cpp 2008-12-01 19:24:05 +0000
@@ -547,7 +547,7 @@
if ( tagLength > 1024*64 )
{
- log_debug("Tag %d has a size of %d bytes !!", tagType, tagLength);
+ //log_debug("Tag %d has a size of %d bytes !!", tagType, tagLength);
}
unsigned long tagEnd = tell() + tagLength;
=== modified file 'libcore/TextField.cpp'
--- a/libcore/TextField.cpp 2008-11-14 08:01:07 +0000
+++ b/libcore/TextField.cpp 2008-12-01 17:19:03 +0000
@@ -395,11 +395,11 @@
switch (id.m_id)
{
case event_id::SETFOCUS:
- setFocus();
+ onSetFocus();
break;
case event_id::KILLFOCUS:
- killFocus();
+ onKillFocus();
break;
case event_id::KEY_PRESS:
@@ -1894,10 +1894,12 @@
callMethod(NSV::PROP_ON_KILL_FOCUS);
}
-void
-TextField::setFocus()
+bool
+TextField::handleFocus()
{
- if ( m_has_focus ) return; // nothing to do
+
+ /// Only selectable TextFields can receive focus.
+ if (!_selectable) return false;
set_invalidated();
@@ -1909,8 +1911,7 @@
m_cursor = _text.size();
format_text();
-
- onSetFocus();
+ return true;
}
void
@@ -1923,11 +1924,9 @@
m_has_focus = false;
movie_root& root = _vm.getRoot();
- root.setFocus(NULL);
root.remove_key_listener(this);
format_text(); // is this needed ?
- onKillFocus();
}
void
=== modified file 'libcore/TextField.h'
--- a/libcore/TextField.h 2008-11-11 12:51:35 +0000
+++ b/libcore/TextField.h 2008-12-01 15:16:02 +0000
@@ -466,8 +466,11 @@
void insertTab(SWF::TextRecord& rec, int& x, float scale);
- /// Set focus
- void setFocus();
+ /// What happens when setFocus() is called on this TextField.
+ //
+ /// @return true if focus was set. A TextField can always receive focus,
+ /// so this always returns true.
+ virtual bool handleFocus();
/// Kill focus
void killFocus();
=== modified file 'libcore/asobj/Selection.cpp'
--- a/libcore/asobj/Selection.cpp 2008-11-27 20:59:20 +0000
+++ b/libcore/asobj/Selection.cpp 2008-12-01 20:58:08 +0000
@@ -129,10 +129,16 @@
{
boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
- UNUSED(ptr);
- log_unimpl("Selection.getFocus()");
-
- return as_value();
+ movie_root& mr = ptr->getVM().getRoot();
+
+ boost::intrusive_ptr<character> ch = mr.getFocus();
+ if (!ch.get()) {
+ as_value null;
+ null.set_null();
+ return null;
+ }
+
+ return as_value(ch->getTarget());
}
@@ -146,33 +152,66 @@
// Documented to return true when setFocus succeeds, but that seems like the
// usual Adobe crap.
//
-// TODO: clean this up when it's better tested.
-//
-// Returns true if the character can normally receive focus (TextField), false
-// if it can't (MovieClip, any other object), regardless of whether focus
-// was set or not.
-//
-// A MovieClip must have the focusEnabled property evaluate to true in order
-// to receive focus.
-//
-// At least MovieClip behaves differently for SWF5, where focusEnabled
-// is probably irrelevant and setFocus can return true for MovieClips.
-// No idea what a TextField has to do to receive focus.
-//
-// Button? Should be able to receive focus normally, so perhaps like TextField.
+// Returns true if focus is set to 0 (no focus), otherwise false. It is
+// irrelevant whether focus was set.
+//
+// A MovieClip must have the focusEnabled property evaluate to true or at
+// least one mouse event handler defined in order to receive focus.
+//
+// TextFields can only receive focus if selectable (TODO: check this).
+// Buttons are documented to be able to receive focus always.
+//
+// focusEnabled has no effect in SWF5.
//
// Any number of arguments other than one returns false and does nothing. The
-// single argument can be a character or a full target path.
+// single argument can be a character or a full target path, otherwise it's
+// a no-op and returns false.
as_value
selection_setfocus(const fn_call& fn)
{
boost::intrusive_ptr<as_object> ptr = ensureType<as_object>(fn.this_ptr);
-
- UNUSED(ptr);
- log_unimpl("Selection.setFocus()");
-
- return as_value();
+
+ /// Handle invalid arguments: must be one argument, or no action is
+ /// taken.
+ if (!fn.nargs || fn.nargs > 1) {
+ IF_VERBOSE_ASCODING_ERRORS(
+ log_aserror("Selection.setFocus: expected 1 argument, got %d",
+ fn.nargs);
+ );
+ return as_value(false);
+ }
+
+ bool ret = false;
+
+ movie_root& mr = ptr->getVM().getRoot();
+
+ const as_value& focus = fn.arg(0);
+
+ /// These should remove focus.
+ if (focus.is_null() || focus.is_undefined()) {
+ mr.setFocus(0);
+ return as_value(true);
+ }
+
+ boost::intrusive_ptr<character> ch;
+
+ if (focus.is_string()) {
+ const std::string& target = focus.to_string();
+ ch = fn.env().find_target(target);
+ }
+ else {
+ /// Try converting directly to character.
+ ch = dynamic_cast<character*>(focus.to_object().get());
+ }
+
+ // If the argument is not a character, do nothing.
+ if (!ch) return as_value(false);
+
+ // Will handle whether to set focus or not.
+ mr.setFocus(ch);
+
+ return as_value(ret);
}
=== modified file 'libcore/character.cpp'
--- a/libcore/character.cpp 2008-11-26 13:59:04 +0000
+++ b/libcore/character.cpp 2008-12-01 19:24:05 +0000
@@ -540,7 +540,7 @@
boost::intrusive_ptr<character> ptr =
ensureType<character>(fn.this_ptr);
as_value rv;
- if ( fn.nargs == 0 ) // getter
+ if (!fn.nargs) // getter
{
rv = as_value(ptr->get_visible());
}
@@ -618,6 +618,21 @@
}
void
+character::set_visible(bool visible)
+{
+ if (m_visible != visible) set_invalidated(__FILE__, __LINE__);
+
+ // Remove focus from this character if it changes from visible to
+ // invisible (see Selection.as).
+ if (m_visible && !visible) {
+ movie_root& mr = _vm.getRoot();
+ if (mr.getFocus().get() == this) {
+ mr.setFocus(0);
+ }
+ }
+ m_visible = visible;
+}
+void
character::set_width(double newwidth)
{
rect bounds = getBounds();
=== modified file 'libcore/character.h'
--- a/libcore/character.h 2008-11-26 13:59:04 +0000
+++ b/libcore/character.h 2008-12-01 19:24:05 +0000
@@ -73,6 +73,18 @@
typedef tree<StringPair> InfoTree; // ifdef USE_MENU
#endif
+ /// Set the current focus to this character.
+ //
+ /// @return false if the character cannot receive focus, true if it can
+ /// (and does).
+ //
+ /// Button, Textfield and MovieClip can receive focus. In SWF6 and above,
+ /// MovieClip can only receive focus if the focusEnabled property
+ /// evaluates to true.
+ virtual bool handleFocus() {
+ return false;
+ }
+
private:
int m_id;
@@ -871,11 +883,7 @@
}
// Set whether this character should be rendered
- void set_visible(bool visible)
- {
- if (m_visible!=visible) set_invalidated(__FILE__, __LINE__);
- m_visible = visible;
- }
+ void set_visible(bool visible);
// Return true if this character should be rendered
bool get_visible() const { return m_visible; }
=== modified file 'libcore/movie_root.cpp'
--- a/libcore/movie_root.cpp 2008-11-22 09:58:45 +0000
+++ b/libcore/movie_root.cpp 2008-12-01 20:58:08 +0000
@@ -109,7 +109,7 @@
m_mouse_y(0),
m_mouse_buttons(0),
_lastTimerId(0),
- m_active_input_text(NULL),
+ _currentFocus(0),
m_time_remainder(0.0f),
m_drag_state(),
_movies(),
@@ -795,29 +795,12 @@
{
// onPress
- // set/kill focus for current root
- character* current_active_entity = getFocus();
-
- // It's another entity ?
- if (current_active_entity != ms.activeEntity.get())
- {
- // First to clean focus
- if (current_active_entity != NULL)
- {
-
current_active_entity->on_event(event_id::KILLFOCUS);
- need_redisplay=true;
- setFocus(NULL);
- }
-
- // Then to set focus
- if (ms.activeEntity)
- {
- if
(ms.activeEntity->on_event(event_id::SETFOCUS))
- {
- setFocus(ms.activeEntity.get());
- }
- }
- }
+ // Try setting focus on the new character. This will handle
+ // all necessary events and removal of current focus.
+ // Do not set focus to NULL.
+ if (ms.activeEntity.get() && setFocus(ms.activeEntity)) {
+ need_redisplay=true;
+ }
if (ms.activeEntity)
{
@@ -1252,7 +1235,8 @@
}
/* static private */
-void movie_root::add_listener(CharacterList& ll, character* listener)
+void
+movie_root::add_listener(CharacterList& ll, character* listener)
{
assert(listener);
for(CharacterList::const_iterator i = ll.begin(), e = ll.end(); i != e;
++i)
@@ -1330,18 +1314,47 @@
}
}
-character*
+boost::intrusive_ptr<character>
movie_root::getFocus()
{
assert(testInvariant());
- return m_active_input_text;
+ return _currentFocus;
}
-void
-movie_root::setFocus(character* ch)
+bool
+movie_root::setFocus(boost::intrusive_ptr<character> ch)
{
- m_active_input_text = ch;
+
+ // Nothing to do if current focus is the same as the new focus.
+ // _level0 also seems unable to receive focus under any circumstances
+ // TODO: what about _level1 etc ?
+ if (ch == _currentFocus || ch == static_cast<character*>(getRootMovie())) {
+ return false;
+ }
+
+ // Undefined or NULL character removes current focus. Otherwise, try
+ // setting focus to the new character. If it fails, remove current
+ // focus anyway.
+ if (!ch) {
+ if (_currentFocus) _currentFocus->on_event(event_id::KILLFOCUS);
+ _currentFocus = 0;
+ return true;
+ }
+
+ if (!ch->handleFocus()) {
+ // TODO: not clear whether to remove focus in this case.
+ return false;
+ }
+
+ if (_currentFocus) _currentFocus->on_event(event_id::KILLFOCUS);
+ _currentFocus = ch;
+ _currentFocus->on_event(event_id::SETFOCUS);
+
+ log_debug("%s", ch->getTarget());
+
assert(testInvariant());
+
+ return true;
}
character*
@@ -1785,13 +1798,15 @@
movie_root::markReachableResources() const
{
// Mark movie levels as reachable
- for (Levels::const_reverse_iterator i=_movies.rbegin(), e=_movies.rend();
i!=e; ++i)
+ for (Levels::const_reverse_iterator i=_movies.rbegin(), e=_movies.rend();
+ i!=e; ++i)
{
i->second->setReachable();
}
// Mark childs as reachable
- for (Childs::const_reverse_iterator i=_childs.rbegin(), e=_childs.rend();
i!=e; ++i)
+ for (Childs::const_reverse_iterator i=_childs.rbegin(), e=_childs.rend();
+ i!=e; ++i)
{
i->second->setReachable();
}
@@ -1804,8 +1819,8 @@
m_mouse_button_state.markReachableResources();
// Mark timer targets
- for (TimerMap::const_iterator i=_intervalTimers.begin(),
e=_intervalTimers.end();
- i != e; ++i)
+ for (TimerMap::const_iterator i=_intervalTimers.begin(),
+ e=_intervalTimers.end(); i != e; ++i)
{
i->second->markReachableResources();
}
@@ -1827,6 +1842,8 @@
// Mark global Mouse object
if ( _mouseobject ) _mouseobject->setReachable();
+ if (_currentFocus) _currentFocus->setReachable();
+
// Mark character being dragged, if any
m_drag_state.markReachableResources();
@@ -1835,7 +1852,8 @@
// parent.
//std::for_each(_liveChars.begin(), _liveChars.end(),
boost::bind(&character::setReachable, _1));
#if GNASH_PARANOIA_LEVEL > 1
- for (LiveChars::const_iterator i=_liveChars.begin(), e=_liveChars.end();
i!=e; ++i)
+ for (LiveChars::const_iterator i=_liveChars.begin(), e=_liveChars.end();
+ i!=e; ++i)
{
assert((*i)->isReachable());
}
=== modified file 'libcore/movie_root.h'
--- a/libcore/movie_root.h 2008-11-12 10:39:11 +0000
+++ b/libcore/movie_root.h 2008-12-01 17:19:03 +0000
@@ -433,14 +433,16 @@
///
/// @return the character having focus or NULL of none.
///
- character* getFocus();
+ boost::intrusive_ptr<character> getFocus();
/// Set the character having focus
//
/// @param ch
/// The character having focus. NULL to kill focus.
- ///
- void setFocus(character* ch);
+ /// @return true if the focus operation succeeded, false if the passed
+ /// character cannot receive focus. setFocus(0) is a valid operation, so
+ /// returns true (always succeeds).
+ bool setFocus(boost::intrusive_ptr<character> ch);
DSOEXPORT void add_invalidated_bounds(InvalidatedRanges& ranges,
bool force);
@@ -981,7 +983,9 @@
/// Objects listening for mouse events (down,up,move)
MouseListeners m_mouse_listeners;
- character* m_active_input_text;
+ /// The character currently holding focus, or 0 if no focus.
+ boost::intrusive_ptr<character> _currentFocus;
+
float m_time_remainder;
/// @todo fold this into m_mouse_button_state?
=== modified file 'libcore/namedStrings.cpp'
--- a/libcore/namedStrings.cpp 2008-12-01 12:21:59 +0000
+++ b/libcore/namedStrings.cpp 2008-12-01 21:30:39 +0000
@@ -56,6 +56,7 @@
string_table::svt( "_droptarget", NSV::PROP_uDROPTARGET ),
string_table::svt( "enabled", NSV::PROP_ENABLED ),
string_table::svt( "useHandCursor", NSV::PROP_USEHANDCURSOR ),
+ string_table::svt( "focusEnabled", NSV::PROP_FOCUS_ENABLED ),
string_table::svt( "_focusrect", NSV::PROP_uFOCUSRECT ),
string_table::svt( "_framesloaded", NSV::PROP_uFRAMESLOADED ),
string_table::svt( "_height", NSV::PROP_uHEIGHT ),
=== modified file 'libcore/namedStrings.h'
--- a/libcore/namedStrings.h 2008-12-01 12:21:59 +0000
+++ b/libcore/namedStrings.h 2008-12-01 21:30:39 +0000
@@ -118,6 +118,7 @@
PROP_DECODE,
PROP_E,
PROP_ENABLED,
+ PROP_FOCUS_ENABLED,
PROP_G,
PROP_H,
PROP_HEIGHT,
=== modified file 'libcore/swf/tag_loaders.cpp'
--- a/libcore/swf/tag_loaders.cpp 2008-11-14 00:46:35 +0000
+++ b/libcore/swf/tag_loaders.cpp 2008-12-01 19:24:05 +0000
@@ -238,7 +238,8 @@
if ( ! jpegHeaderSize )
{
- log_debug(_("No bytes to read in JPEGTABLES tag at offset %d"),
currPos);
+ log_debug(_("No bytes to read in JPEGTABLES tag at offset %d"),
+ currPos);
}
std::auto_ptr<JpegImageInput> input;
=== modified file 'testsuite/actionscript.all/MovieClip.as'
--- a/testsuite/actionscript.all/MovieClip.as 2008-11-15 13:25:03 +0000
+++ b/testsuite/actionscript.all/MovieClip.as 2008-12-01 13:46:15 +0000
@@ -111,19 +111,19 @@
endOfTest = function()
{
#if OUTPUT_VERSION <= 5
- check_totals(321); // SWF5
+ check_totals(327); // SWF5
#endif
#if OUTPUT_VERSION == 6
- check_totals(823); // SWF6
+ check_totals(829); // SWF6
#endif
#if OUTPUT_VERSION == 7
- check_totals(840); // SWF7
+ check_totals(846); // SWF7
#endif
#if OUTPUT_VERSION >= 8
- check_totals(914); // SWF8+
+ check_totals(920); // SWF8+
#endif
play();
@@ -2160,6 +2160,18 @@
check_equals(vis._visible, false);
#endif
+check_equals(_root.focusEnabled, undefined);
+_root.focusEnabled = 5;
+check_equals(_root.focusEnabled, 5);
+_root.focusEnabled = 0;
+check_equals(_root.focusEnabled, 0);
+_root.focusEnabled = true;
+check_equals(_root.focusEnabled, true);
+_root.focusEnabled = false;
+check_equals(_root.focusEnabled, false);
+_root.focusEnabled = "hello";
+check_equals(_root.focusEnabled, "hello");
+
//_root.loadVariables(MEDIA(vars.txt), "GET");
// Can't rely on this to call onData!
=== modified file 'testsuite/actionscript.all/Selection.as'
--- a/testsuite/actionscript.all/Selection.as 2008-11-27 20:39:13 +0000
+++ b/testsuite/actionscript.all/Selection.as 2008-12-01 20:58:08 +0000
@@ -54,20 +54,23 @@
// test the Selection::setSelection method
check_equals (typeof(Selection.setSelection), 'function');
-xcheck_equals(typeof(Selection.getFocus()), "null");
+check_equals(typeof(Selection.getFocus()), "null");
ret = Selection.setFocus();
-xcheck_equals(ret, false);
+check_equals(ret, false);
ret = Selection.setFocus(4);
-xcheck_equals(ret, false);
+check_equals(ret, false);
ret = Selection.setFocus(_root);
-xcheck_equals(ret, false);
-
-ret = Selection.setFocus(_root, 5);
-xcheck_equals(ret, false);
-
+check_equals(ret, false);
+
+ret = Selection.setFocus(_root, 5);
+check_equals(ret, false);
+
+_root.focusEnabled = false;
+ret = Selection.setFocus(_root, 5);
+check_equals(ret, false);
// Methods added in version 6
#if OUTPUT_VERSION >= 6
@@ -84,49 +87,82 @@
_root.createEmptyMovieClip("mc", getNextHighestDepth());
check(mc instanceof MovieClip);
ret = Selection.setFocus(mc);
- xcheck_equals(ret, false);
+ check_equals(ret, false);
check_equals(Selection.getFocus(), null);
mc.createTextField("tx", getNextHighestDepth(), 400, 400, 10, 10);
check_equals(Selection.getFocus(), null);
ret = Selection.setFocus(tx);
- xcheck_equals(typeof(ret), "boolean");
- xcheck_equals(ret, true);
+ check_equals(typeof(ret), "boolean");
+ check_equals(ret, true);
// An extra argument when the first argument is valid.
ret = Selection.setFocus(tx, 5);
- xcheck_equals(ret, false);
+ check_equals(ret, false);
check_equals(Selection.getFocus(), null);
tx.focusEnabled = true;
check_equals(Selection.getFocus(), null);
ret = Selection.setFocus(tx);
- xcheck_equals(ret, true);
+ check_equals(ret, true);
check_equals(Selection.getFocus(), null);
ret = Selection.setFocus("tx");
- xcheck_equals(ret, false);
+ check_equals(ret, false);
check_equals(Selection.getFocus(), null);
mc.focusEnabled = true;
check_equals(Selection.getFocus(), null);
ret = Selection.setFocus(mc);
- xcheck_equals(ret, false);
- xcheck_equals(Selection.getFocus(), "_level0.mc");
+ check_equals(ret, false);
+ check_equals(Selection.getFocus(), "_level0.mc");
ret = Selection.setFocus("mc");
- xcheck_equals(ret, false);
- xcheck_equals(Selection.getFocus(), "_level0.mc");
+ check_equals(ret, false);
+ check_equals(Selection.getFocus(), "_level0.mc");
ret = Selection.setFocus(5);
- xcheck_equals(ret, false);
- xcheck_equals(Selection.getFocus(), "_level0.mc");
+ check_equals(ret, false);
+ check_equals(Selection.getFocus(), "_level0.mc");
+
+ // Setting _visible to false removes focus, otherwise visibility seems
+ // to have no effect.
+ mc._visible = false;
+ check_equals(mc._visible, false);
+ check_equals(Selection.getFocus(), null);
+ ret = Selection.setFocus(mc);
+ check_equals(ret, false);
+ check_equals(Selection.getFocus(), "_level0.mc");
+ mc._visible = false;
+ check_equals(Selection.getFocus(), "_level0.mc");
+
+ ret = Selection.setFocus(null);
+ check_equals(ret, true);
+ check_equals(Selection.getFocus(), null);
+
+ ret = Selection.setFocus(mc);
+ check_equals(ret, false);
+ mc._visible = false;
+ check_equals(Selection.getFocus(), "_level0.mc");
+ mc._visible = true;
+ check_equals(Selection.getFocus(), "_level0.mc");
+ mc._visible = false;
+ check_equals(Selection.getFocus(), null);
+
+ // Check setting mouse events.
+ Selection.setFocus(mc);
+ check_equals(Selection.getFocus(), "_level0.mc");
+ mc.onRelease = function() {};
+ check_equals(Selection.getFocus(), "_level0.mc");
+ Selection.setFocus(mc);
+ check_equals(Selection.getFocus(), "_level0.mc");
+
Selection.setFocus(tx);
check_equals(Selection.getFocus(), null);
ret = Selection.setFocus("tx");
- xcheck_equals(ret, false);
+ check_equals(ret, false);
check_equals(Selection.getFocus(), null);
ret = Selection.setFocus(tx);
- xcheck_equals(ret, true);
+ check_equals(ret, true);
check_equals(Selection.getFocus(), null);
#endif // OUTPUT_VERSION >= 6
=== modified file 'testsuite/misc-ming.all/DefineEditTextTest.c'
--- a/testsuite/misc-ming.all/DefineEditTextTest.c 2008-11-06 14:04:55
+0000
+++ b/testsuite/misc-ming.all/DefineEditTextTest.c 2008-12-01 20:07:01
+0000
@@ -179,8 +179,19 @@
check_equals(mo, "etext1.embedFonts", "true");
check_equals(mo, "etext1.hasOwnProperty('embedFonts')", "false");
+ add_actions(mo, "ret = Selection.setFocus(dtext1);"
+ "check_equals(ret, false);"
+ "check_equals(Selection.getFocus(), '_level0.dtext1');");
+ add_actions(mo, "ret = Selection.setFocus(etext1);"
+ "check_equals(ret, false);"
+ "check_equals(Selection.getFocus(), '_level0.etext1');");
+
add_actions(mo, "createTextField('dynamictext1', 99, 10, 10, 10, 10);");
+ add_actions(mo, "ret = Selection.setFocus(dynamictext1);"
+ "check_equals(ret, false);"
+ "check_equals(Selection.getFocus(), '_level0.dynamictext1');");
+
check_equals(mo, "dtext1.__proto__", "TextField.prototype");
check_equals(mo, "etext1.__proto__", "TextField.prototype");
check_equals(mo, "etext1.__proto__", "dynamictext1.__proto__");
=== modified file 'testsuite/swfdec/PASSING'
--- a/testsuite/swfdec/PASSING 2008-12-01 12:21:59 +0000
+++ b/testsuite/swfdec/PASSING 2008-12-01 21:30:39 +0000
@@ -919,6 +919,10 @@
scope-chain-with-and-scope-chain-7.swf:6287e166df07684fc7b55fb19925280f
scope-chain-with-and-scope-chain-8.swf:7185d1d16490d2daf41bb1fc444e5fd3
scope.swf:09ecbb50f2ac03ebf401a1511d4b1334
+selection-focus-5.swf:70e26fec0c60ddb355392e873dd9363c
+selection-focus-6.swf:afb6fc45177ed23a3a862792a65d572a
+selection-focus-7.swf:a921151f59ae6746acfce846b2408111
+selection-focus-8.swf:65fed7eea65afbacd0ea030ac4799ce7
selection-focus-events-5.swf:03ef025ff52765706b0154b972fce288
setinterval2.swf:f2a17dbddcd0a72a672fbb9a63e0ea5b
setinterval-arguments.swf:bf5653c905e58846b5a9ee8841c3bcb3
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gnash-commit] /srv/bzr/gnash/trunk r10371: Improve and unify focus handling for all characters that can accept it.,
Benjamin Wolsey <=