
This was resulting in a whole lot of rebuilding whenever a new IDL interface was added. Instead, just directly include the prototype in every C++ file which needs it. While we only really need a forward declaration in each cpp file; including the full prototype header (which itself only includes LibJS/Object.h, which is already transitively brought in by PlatformObject) - it seems like a small price to pay compared to what feels like a full rebuild of LibWeb whenever a new IDL file is added. Given all of these includes are only needed for the ::initialize method, there is probably a smart way of avoiding this problem altogether. I've considered both using some macro trickery or generating these functions somehow instead.
39 lines
846 B
C++
39 lines
846 B
C++
/*
|
|
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibWeb/Bindings/StyleSheetPrototype.h>
|
|
#include <LibWeb/CSS/CSSStyleSheet.h>
|
|
#include <LibWeb/CSS/StyleSheet.h>
|
|
#include <LibWeb/DOM/Element.h>
|
|
|
|
namespace Web::CSS {
|
|
|
|
StyleSheet::StyleSheet(JS::Realm& realm, MediaList& media)
|
|
: PlatformObject(realm)
|
|
, m_media(media)
|
|
{
|
|
}
|
|
|
|
void StyleSheet::visit_edges(Cell::Visitor& visitor)
|
|
{
|
|
Base::visit_edges(visitor);
|
|
visitor.visit(m_owner_node);
|
|
visitor.visit(m_parent_style_sheet);
|
|
visitor.visit(m_media);
|
|
}
|
|
|
|
void StyleSheet::set_owner_node(DOM::Element* element)
|
|
{
|
|
m_owner_node = element;
|
|
}
|
|
|
|
void StyleSheet::set_parent_css_style_sheet(CSSStyleSheet* parent)
|
|
{
|
|
m_parent_style_sheet = parent;
|
|
}
|
|
|
|
}
|