MathMLElement.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  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/MathML/MathMLElement.h>
  8. #include <LibWeb/MathML/TagNames.h>
  9. namespace Web::MathML {
  10. JS_DEFINE_ALLOCATOR(MathMLElement);
  11. MathMLElement::~MathMLElement() = default;
  12. MathMLElement::MathMLElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  13. : DOM::Element(document, move(qualified_name))
  14. {
  15. }
  16. void MathMLElement::initialize(JS::Realm& realm)
  17. {
  18. Base::initialize(realm);
  19. WEB_SET_PROTOTYPE_FOR_INTERFACE(MathMLElement);
  20. }
  21. JS::NonnullGCPtr<HTML::DOMStringMap> MathMLElement::dataset()
  22. {
  23. if (!m_dataset)
  24. m_dataset = HTML::DOMStringMap::create(*this);
  25. return *m_dataset;
  26. }
  27. Optional<ARIA::Role> MathMLElement::default_role() const
  28. {
  29. // https://www.w3.org/TR/html-aria/#el-math
  30. if (local_name() == TagNames::math)
  31. return ARIA::Role::math;
  32. return {};
  33. }
  34. void MathMLElement::focus()
  35. {
  36. dbgln("(STUBBED) MathMLElement::focus()");
  37. }
  38. void MathMLElement::blur()
  39. {
  40. dbgln("(STUBBED) MathMLElement::blur()");
  41. }
  42. void MathMLElement::visit_edges(JS::Cell::Visitor& visitor)
  43. {
  44. Base::visit_edges(visitor);
  45. visitor.visit(m_dataset);
  46. }
  47. }