Skip to content

Commit

Permalink
Fix for resize events when building with ASSERTIONS (#21362)
Browse files Browse the repository at this point in the history
Building with ASSERTIONS is failing the safe heap checks when e.detail is undefined.
  • Loading branch information
cwoffenden authored Feb 23, 2024
1 parent c6eacb9 commit 56fc942
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions site/source/docs/api_reference/html5.h.rst
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ Struct
.. c:member:: long detail
Specifies additional detail/information about this event.
For resize and scroll events this is always zero.
.. c:member:: int documentBodyClientWidth
int documentBodyClientHeight
Expand All @@ -616,7 +616,7 @@ Struct
.. c:member:: int scrollTop
int scrollLeft
The page scroll position.
The page scroll position (rounded down to the nearest pixel).
Callback functions
Expand Down
6 changes: 3 additions & 3 deletions src/library_html5.js
Original file line number Diff line number Diff line change
Expand Up @@ -710,15 +710,15 @@ var LibraryHTML5 = {
#else
var uiEvent = JSEvents.uiEvent;
#endif
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.detail, 'e.detail', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.detail, '0', 'i32') }}}; // always zero for resize and scroll
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientWidth, 'b.clientWidth', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.documentBodyClientHeight, 'b.clientHeight', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerWidth, 'innerWidth', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.windowInnerHeight, 'innerHeight', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterWidth, 'outerWidth', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.windowOuterHeight, 'outerHeight', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollTop, 'pageXOffset', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollLeft, 'pageYOffset', 'i32') }}};
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollTop, 'pageXOffset | 0', 'i32') }}}; // scroll offsets are float
{{{ makeSetValue('uiEvent', C_STRUCTS.EmscriptenUiEvent.scrollLeft, 'pageYOffset | 0', 'i32') }}};
#if PTHREADS
if (targetThread) __emscripten_run_callback_on_thread(targetThread, callbackfunc, eventTypeId, uiEvent, userData);
else
Expand Down

0 comments on commit 56fc942

Please sign in to comment.