MathMLElement.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. /*
  2. * Copyright (c) 2023, Jonah Shafran <jonahshafran@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/ExceptionOrUtils.h>
  7. #include <LibWeb/Bindings/MathMLElementPrototype.h>
  8. #include <LibWeb/MathML/MathMLElement.h>
  9. #include <LibWeb/MathML/TagNames.h>
  10. namespace Web::MathML {
  11. JS_DEFINE_ALLOCATOR(MathMLElement);
  12. MathMLElement::~MathMLElement() = default;
  13. MathMLElement::MathMLElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  14. : DOM::Element(document, move(qualified_name))
  15. {
  16. }
  17. void MathMLElement::initialize(JS::Realm& realm)
  18. {
  19. Base::initialize(realm);
  20. WEB_SET_PROTOTYPE_FOR_INTERFACE(MathMLElement);
  21. }
  22. JS::NonnullGCPtr<HTML::DOMStringMap> MathMLElement::dataset()
  23. {
  24. if (!m_dataset)
  25. m_dataset = HTML::DOMStringMap::create(*this);
  26. return *m_dataset;
  27. }
  28. Optional<ARIA::Role> MathMLElement::default_role() const
  29. {
  30. // https://www.w3.org/TR/html-aria/#el-math
  31. if (local_name() == TagNames::math)
  32. return ARIA::Role::math;
  33. return {};
  34. }
  35. void MathMLElement::focus()
  36. {
  37. dbgln("(STUBBED) MathMLElement::focus()");
  38. }
  39. void MathMLElement::blur()
  40. {
  41. dbgln("(STUBBED) MathMLElement::blur()");
  42. }
  43. void MathMLElement::visit_edges(JS::Cell::Visitor& visitor)
  44. {
  45. Base::visit_edges(visitor);
  46. visitor.visit(m_dataset);
  47. }
  48. }