1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:48:10 +00:00

LibWeb: Make wrapper factory functions take JS::GlobalObject&

Instead of taking the JS::Heap&. This allows us to get rid of some
calls to JS::Interpreter::global_object(). We're getting closer and
closer to multiple global objects. :^)
This commit is contained in:
Andreas Kling 2020-06-23 16:57:39 +02:00
parent c24f5585b2
commit fc4ed8d444
12 changed files with 33 additions and 36 deletions

View file

@ -24,18 +24,17 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include <LibJS/Interpreter.h>
#include <LibWeb/Bindings/EventWrapper.h>
#include <LibWeb/Bindings/MouseEventWrapper.h>
namespace Web {
namespace Bindings {
EventWrapper* wrap(JS::Heap& heap, Event& event)
EventWrapper* wrap(JS::GlobalObject& global_object, Event& event)
{
if (event.is_mouse_event())
return static_cast<MouseEventWrapper*>(wrap_impl(heap, static_cast<MouseEvent&>(event)));
return static_cast<EventWrapper*>(wrap_impl(heap, event));
return static_cast<MouseEventWrapper*>(wrap_impl(global_object, static_cast<MouseEvent&>(event)));
return static_cast<EventWrapper*>(wrap_impl(global_object, event));
}
}