HTMLQuoteElement.cpp 1.0 KB

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