HTMLQuoteElement.cpp 997 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. JS_DEFINE_ALLOCATOR(HTMLQuoteElement);
  12. HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, DOM::QualifiedName qualified_name)
  13. : HTMLElement(document, move(qualified_name))
  14. {
  15. }
  16. HTMLQuoteElement::~HTMLQuoteElement() = default;
  17. void HTMLQuoteElement::initialize(JS::Realm& realm)
  18. {
  19. Base::initialize(realm);
  20. WEB_SET_PROTOTYPE_FOR_INTERFACE(HTMLQuoteElement);
  21. }
  22. Optional<ARIA::Role> HTMLQuoteElement::default_role() const
  23. {
  24. // https://www.w3.org/TR/html-aria/#el-blockquote
  25. if (local_name() == TagNames::blockquote)
  26. return ARIA::Role::blockquote;
  27. // https://www.w3.org/TR/html-aria/#el-q
  28. if (local_name() == TagNames::q)
  29. return ARIA::Role::generic;
  30. VERIFY_NOT_REACHED();
  31. }
  32. }