Walking up the parent-chain doesn't really work (even when the view's bounds are checked), does it? For example in this testcase, when you right click on the red-view, you should get the "foo"-contextmenu (like in swf). But in dhtml, the "bar"-view will receive the mouse-event, so looking up the parent-chain will only find the default contextmenu on canvas, but not the red view's contextmenu:

<canvas>
  <view width="100" height="100" bgcolor="red">
    <contextmenu>
      <contextmenuitem caption="foo" />
    </contextmenu>
  </view>
  <view id="bar" width="100" height="100" />
</canvas>


On 2/14/2009 8:56 AM, Max Carlson wrote:
Change 20090213-maxcarlson-v by [email protected] on 2009-02-13 22:25:50 PST
    in /Users/maxcarlson/openlaszlo/trunk-clean
    for http://svn.openlaszlo.org/openlaszlo/trunk

Summary: Fix contextmenus for text, clickable views and offset views

Bugs Fixed: LPP-7661 - Views without bgcolor allow context menus to receive clicks in SWF but not in DHTML

Technical Reviewer: [email protected]
QA Reviewer: promanik

Release Notes:

Details: LzSprite - Show context menus when clickable sprites get an onmousedown event with event.button == 2 (the context button).

LzTextSprite - Set owner property of scrolldiv so context menus work.

LzMouseKernel - Move context menu handling to __showContextMenu(). Walk up the sprite hierarchy looking for sprites with a context menu that have the mouse over them. If found, show the context menu, otherwise hide any that are showing.

Tests: See LPP-7661.

Files:
M      WEB-INF/lps/lfc/kernel/dhtml/LzSprite.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzTextSprite.js
M      WEB-INF/lps/lfc/kernel/dhtml/LzMouseKernel.js

Changeset: http://svn.openlaszlo.org/openlaszlo/patches/20090213-maxcarlson-v.tar

Reply via email to