mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 11:07:35 +00:00
LibWeb: Make StyleSheetList.item an IDL getter
This commit is contained in:
parent
398435277b
commit
881e9d1341
4 changed files with 16 additions and 2 deletions
|
@ -1460,6 +1460,7 @@ void generate_implementation(IDL::Interface const& interface)
|
||||||
#include <LibJS/Runtime/Value.h>
|
#include <LibJS/Runtime/Value.h>
|
||||||
#include <LibWeb/Bindings/@prototype_class@.h>
|
#include <LibWeb/Bindings/@prototype_class@.h>
|
||||||
#include <LibWeb/Bindings/@wrapper_class@.h>
|
#include <LibWeb/Bindings/@wrapper_class@.h>
|
||||||
|
#include <LibWeb/Bindings/CSSStyleSheetWrapper.h>
|
||||||
#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
|
#include <LibWeb/Bindings/CanvasRenderingContext2DWrapper.h>
|
||||||
#include <LibWeb/Bindings/CommentWrapper.h>
|
#include <LibWeb/Bindings/CommentWrapper.h>
|
||||||
#include <LibWeb/Bindings/DOMImplementationWrapper.h>
|
#include <LibWeb/Bindings/DOMImplementationWrapper.h>
|
||||||
|
|
|
@ -18,4 +18,15 @@ StyleSheetList::StyleSheetList(DOM::Document& document)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// https://drafts.csswg.org/cssom/#ref-for-dfn-supported-property-indices%E2%91%A1
|
||||||
|
bool StyleSheetList::is_supported_property_index(u32 index) const
|
||||||
|
{
|
||||||
|
// The object’s supported property indices are the numbers in the range zero to one less than the number of CSS style sheets represented by the collection.
|
||||||
|
// If there are no such CSS style sheets, then there are no supported property indices.
|
||||||
|
if (m_sheets.is_empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return index < m_sheets.size();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,6 +37,8 @@ public:
|
||||||
|
|
||||||
size_t length() const { return m_sheets.size(); }
|
size_t length() const { return m_sheets.size(); }
|
||||||
|
|
||||||
|
bool is_supported_property_index(u32) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit StyleSheetList(DOM::Document&);
|
explicit StyleSheetList(DOM::Document&);
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
|
[Exposed=Window]
|
||||||
interface StyleSheetList {
|
interface StyleSheetList {
|
||||||
// FIXME: item() should be a WebIDL "getter"
|
getter CSSStyleSheet? item(unsigned long index);
|
||||||
CSSStyleSheet? item(unsigned long index);
|
|
||||||
readonly attribute unsigned long length;
|
readonly attribute unsigned long length;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue