HTMLQuoteElement.cpp 1018 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2020, the SerenityOS developers.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <AK/Assertions.h>
  7. #include <LibWeb/ARIA/Roles.h>
  8. #include <LibWeb/Bindings/Intrinsics.h>
  9. #include <LibWeb/HTML/HTMLQuoteElement.h>
  10. namespace Web::HTML {
  11. HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  12. : HTMLElement(document, move(qualified_name))
  13. {
  14. }
  15. HTMLQuoteElement::~HTMLQuoteElement() = default;
  16. void HTMLQuoteElement::initialize(JS::Realm& realm)
  17. {
  18. Base::initialize(realm);
  19. set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLQuoteElementPrototype>(realm, "HTMLQuoteElement"));
  20. }
  21. Optional<ARIA::Role> HTMLQuoteElement::default_role() const
  22. {
  23. // https://www.w3.org/TR/html-aria/#el-blockquote
  24. if (local_name() == TagNames::blockquote)
  25. return ARIA::Role::blockquote;
  26. // https://www.w3.org/TR/html-aria/#el-q
  27. if (local_name() == TagNames::q)
  28. return ARIA::Role::generic;
  29. VERIFY_NOT_REACHED();
  30. }
  31. }