EventHandler.cpp 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. /*
  2. * Copyright (c) 2020-2021, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2021, Max Wipfli <mail@maxwipfli.ch>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #include <LibGUI/Event.h>
  8. #include <LibWeb/DOM/Range.h>
  9. #include <LibWeb/DOM/Text.h>
  10. #include <LibWeb/DOM/Window.h>
  11. #include <LibWeb/HTML/BrowsingContext.h>
  12. #include <LibWeb/HTML/HTMLAnchorElement.h>
  13. #include <LibWeb/HTML/HTMLIFrameElement.h>
  14. #include <LibWeb/HTML/HTMLImageElement.h>
  15. #include <LibWeb/Layout/InitialContainingBlock.h>
  16. #include <LibWeb/Page/EventHandler.h>
  17. #include <LibWeb/Page/Page.h>
  18. #include <LibWeb/UIEvents/EventNames.h>
  19. #include <LibWeb/UIEvents/KeyboardEvent.h>
  20. #include <LibWeb/UIEvents/MouseEvent.h>
  21. namespace Web {
  22. static Gfx::StandardCursor cursor_css_to_gfx(Optional<CSS::Cursor> cursor)
  23. {
  24. if (!cursor.has_value()) {
  25. return Gfx::StandardCursor::None;
  26. }
  27. switch (cursor.value()) {
  28. case CSS::Cursor::Crosshair:
  29. case CSS::Cursor::Cell:
  30. return Gfx::StandardCursor::Crosshair;
  31. case CSS::Cursor::Grab:
  32. case CSS::Cursor::Grabbing:
  33. return Gfx::StandardCursor::Drag;
  34. case CSS::Cursor::Pointer:
  35. return Gfx::StandardCursor::Hand;
  36. case CSS::Cursor::Help:
  37. return Gfx::StandardCursor::Help;
  38. case CSS::Cursor::None:
  39. return Gfx::StandardCursor::Hidden;
  40. case CSS::Cursor::Text:
  41. case CSS::Cursor::VerticalText:
  42. return Gfx::StandardCursor::IBeam;
  43. case CSS::Cursor::Move:
  44. case CSS::Cursor::AllScroll:
  45. return Gfx::StandardCursor::Move;
  46. case CSS::Cursor::Progress:
  47. case CSS::Cursor::Wait:
  48. return Gfx::StandardCursor::Wait;
  49. case CSS::Cursor::ColResize:
  50. return Gfx::StandardCursor::ResizeColumn;
  51. case CSS::Cursor::EResize:
  52. case CSS::Cursor::WResize:
  53. case CSS::Cursor::EwResize:
  54. return Gfx::StandardCursor::ResizeHorizontal;
  55. case CSS::Cursor::RowResize:
  56. return Gfx::StandardCursor::ResizeRow;
  57. case CSS::Cursor::NResize:
  58. case CSS::Cursor::SResize:
  59. case CSS::Cursor::NsResize:
  60. return Gfx::StandardCursor::ResizeVertical;
  61. case CSS::Cursor::NeResize:
  62. case CSS::Cursor::SwResize:
  63. case CSS::Cursor::NeswResize:
  64. return Gfx::StandardCursor::ResizeDiagonalBLTR;
  65. case CSS::Cursor::NwResize:
  66. case CSS::Cursor::SeResize:
  67. case CSS::Cursor::NwseResize:
  68. return Gfx::StandardCursor::ResizeDiagonalTLBR;
  69. default:
  70. return Gfx::StandardCursor::None;
  71. }
  72. }
  73. static Gfx::IntPoint compute_mouse_event_offset(const Gfx::IntPoint& position, const Layout::Node& layout_node)
  74. {
  75. auto top_left_of_layout_node = layout_node.box_type_agnostic_position();
  76. return {
  77. position.x() - static_cast<int>(top_left_of_layout_node.x()),
  78. position.y() - static_cast<int>(top_left_of_layout_node.y())
  79. };
  80. }
  81. EventHandler::EventHandler(Badge<HTML::BrowsingContext>, HTML::BrowsingContext& browsing_context)
  82. : m_browsing_context(browsing_context)
  83. , m_edit_event_handler(make<EditEventHandler>(browsing_context))
  84. {
  85. }
  86. EventHandler::~EventHandler()
  87. {
  88. }
  89. const Layout::InitialContainingBlock* EventHandler::layout_root() const
  90. {
  91. if (!m_browsing_context.active_document())
  92. return nullptr;
  93. return m_browsing_context.active_document()->layout_node();
  94. }
  95. Layout::InitialContainingBlock* EventHandler::layout_root()
  96. {
  97. if (!m_browsing_context.active_document())
  98. return nullptr;
  99. return m_browsing_context.active_document()->layout_node();
  100. }
  101. bool EventHandler::handle_mousewheel(const Gfx::IntPoint& position, unsigned int buttons, unsigned int modifiers, int wheel_delta_x, int wheel_delta_y)
  102. {
  103. if (!layout_root())
  104. return false;
  105. if (modifiers & KeyModifier::Mod_Shift)
  106. swap(wheel_delta_x, wheel_delta_y);
  107. // FIXME: Support wheel events in nested browsing contexts.
  108. auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact);
  109. if (result.layout_node) {
  110. if (result.layout_node->handle_mousewheel({}, position, buttons, modifiers, wheel_delta_x, wheel_delta_y))
  111. return true;
  112. }
  113. if (auto* page = m_browsing_context.page()) {
  114. page->client().page_did_request_scroll(wheel_delta_x * 20, wheel_delta_y * 20);
  115. return true;
  116. }
  117. return false;
  118. }
  119. bool EventHandler::handle_mouseup(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
  120. {
  121. if (!layout_root())
  122. return false;
  123. if (m_mouse_event_tracking_layout_node) {
  124. m_mouse_event_tracking_layout_node->handle_mouseup({}, position, button, modifiers);
  125. return true;
  126. }
  127. bool handled_event = false;
  128. auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact);
  129. if (result.layout_node && result.layout_node->wants_mouse_events()) {
  130. result.layout_node->handle_mouseup({}, position, button, modifiers);
  131. // Things may have changed as a consequence of Layout::Node::handle_mouseup(). Hit test again.
  132. if (!layout_root())
  133. return true;
  134. result = layout_root()->hit_test(position, Layout::HitTestType::Exact);
  135. }
  136. if (result.layout_node && result.layout_node->dom_node()) {
  137. RefPtr<DOM::Node> node = result.layout_node->dom_node();
  138. if (is<HTML::HTMLIFrameElement>(*node)) {
  139. if (auto* nested_browsing_context = static_cast<HTML::HTMLIFrameElement&>(*node).nested_browsing_context())
  140. return nested_browsing_context->event_handler().handle_mouseup(position.translated(compute_mouse_event_offset({}, *result.layout_node)), button, modifiers);
  141. return false;
  142. }
  143. auto offset = compute_mouse_event_offset(position, *result.layout_node);
  144. node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mouseup, offset.x(), offset.y(), position.x(), position.y()));
  145. handled_event = true;
  146. if (node.ptr() == m_mousedown_target) {
  147. node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::click, offset.x(), offset.y(), position.x(), position.y()));
  148. }
  149. }
  150. if (button == GUI::MouseButton::Primary)
  151. m_in_mouse_selection = false;
  152. return handled_event;
  153. }
  154. bool EventHandler::handle_mousedown(const Gfx::IntPoint& position, unsigned button, unsigned modifiers)
  155. {
  156. if (!layout_root())
  157. return false;
  158. if (m_mouse_event_tracking_layout_node) {
  159. m_mouse_event_tracking_layout_node->handle_mousedown({}, position, button, modifiers);
  160. return true;
  161. }
  162. NonnullRefPtr document = *m_browsing_context.active_document();
  163. RefPtr<DOM::Node> node;
  164. {
  165. // TODO: Allow selecting element behind if one on top has pointer-events set to none.
  166. auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact);
  167. if (!result.layout_node)
  168. return false;
  169. auto pointer_events = result.layout_node->computed_values().pointer_events();
  170. // FIXME: Handle other values for pointer-events.
  171. if (pointer_events == CSS::PointerEvents::None)
  172. return false;
  173. node = result.layout_node->dom_node();
  174. document->set_hovered_node(node);
  175. if (result.layout_node->wants_mouse_events()) {
  176. result.layout_node->handle_mousedown({}, position, button, modifiers);
  177. return true;
  178. }
  179. if (!node)
  180. return false;
  181. if (is<HTML::HTMLIFrameElement>(*node)) {
  182. if (auto* nested_browsing_context = static_cast<HTML::HTMLIFrameElement&>(*node).nested_browsing_context())
  183. return nested_browsing_context->event_handler().handle_mousedown(position.translated(compute_mouse_event_offset({}, *result.layout_node)), button, modifiers);
  184. return false;
  185. }
  186. if (auto* page = m_browsing_context.page())
  187. page->set_focused_browsing_context({}, m_browsing_context);
  188. auto offset = compute_mouse_event_offset(position, *result.layout_node);
  189. m_mousedown_target = node;
  190. node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mousedown, offset.x(), offset.y(), position.x(), position.y()));
  191. }
  192. // NOTE: Dispatching an event may have disturbed the world.
  193. if (!layout_root() || layout_root() != node->document().layout_node())
  194. return true;
  195. if (button == GUI::MouseButton::Secondary && is<HTML::HTMLImageElement>(*node)) {
  196. auto& image_element = verify_cast<HTML::HTMLImageElement>(*node);
  197. auto image_url = image_element.document().parse_url(image_element.src());
  198. if (auto* page = m_browsing_context.page())
  199. page->client().page_did_request_image_context_menu(m_browsing_context.to_top_level_position(position), image_url, "", modifiers, image_element.bitmap());
  200. return true;
  201. }
  202. if (RefPtr<HTML::HTMLAnchorElement> link = node->enclosing_link_element()) {
  203. auto href = link->href();
  204. auto url = document->parse_url(href);
  205. dbgln("Web::EventHandler: Clicking on a link to {}", url);
  206. if (button == GUI::MouseButton::Primary) {
  207. if (href.starts_with("javascript:")) {
  208. document->run_javascript(href.substring_view(11, href.length() - 11));
  209. } else if (!url.fragment().is_null() && url.equals(document->url(), AK::URL::ExcludeFragment::Yes)) {
  210. m_browsing_context.scroll_to_anchor(url.fragment());
  211. } else {
  212. document->set_active_element(link);
  213. if (m_browsing_context.is_top_level()) {
  214. if (auto* page = m_browsing_context.page())
  215. page->client().page_did_click_link(url, link->target(), modifiers);
  216. } else {
  217. // FIXME: Handle different targets!
  218. m_browsing_context.loader().load(url, FrameLoader::Type::Navigation);
  219. }
  220. }
  221. } else if (button == GUI::MouseButton::Secondary) {
  222. if (auto* page = m_browsing_context.page())
  223. page->client().page_did_request_link_context_menu(m_browsing_context.to_top_level_position(position), url, link->target(), modifiers);
  224. } else if (button == GUI::MouseButton::Middle) {
  225. if (auto* page = m_browsing_context.page())
  226. page->client().page_did_middle_click_link(url, link->target(), modifiers);
  227. }
  228. } else {
  229. if (button == GUI::MouseButton::Primary) {
  230. auto result = layout_root()->hit_test(position, Layout::HitTestType::TextCursor);
  231. if (result.layout_node && result.layout_node->dom_node()) {
  232. // See if we want to focus something.
  233. bool did_focus_something = false;
  234. for (auto candidate = node; candidate; candidate = candidate->parent()) {
  235. if (candidate->is_focusable()) {
  236. document->set_focused_element(verify_cast<DOM::Element>(candidate.ptr()));
  237. did_focus_something = true;
  238. break;
  239. }
  240. }
  241. // If we didn't focus anything, place the document text cursor at the mouse position.
  242. // FIXME: This is all rather strange. Find a better solution.
  243. if (!did_focus_something) {
  244. m_browsing_context.set_cursor_position(DOM::Position(*result.layout_node->dom_node(), result.index_in_node));
  245. layout_root()->set_selection({ { result.layout_node, result.index_in_node }, {} });
  246. m_in_mouse_selection = true;
  247. }
  248. }
  249. } else if (button == GUI::MouseButton::Secondary) {
  250. if (auto* page = m_browsing_context.page())
  251. page->client().page_did_request_context_menu(m_browsing_context.to_top_level_position(position));
  252. }
  253. }
  254. return true;
  255. }
  256. bool EventHandler::handle_mousemove(const Gfx::IntPoint& position, unsigned buttons, unsigned modifiers)
  257. {
  258. if (!layout_root())
  259. return false;
  260. if (m_mouse_event_tracking_layout_node) {
  261. m_mouse_event_tracking_layout_node->handle_mousemove({}, position, buttons, modifiers);
  262. return true;
  263. }
  264. auto& document = *m_browsing_context.active_document();
  265. bool hovered_node_changed = false;
  266. bool is_hovering_link = false;
  267. Gfx::StandardCursor hovered_node_cursor = Gfx::StandardCursor::None;
  268. auto result = layout_root()->hit_test(position, Layout::HitTestType::Exact);
  269. const HTML::HTMLAnchorElement* hovered_link_element = nullptr;
  270. if (result.layout_node) {
  271. if (result.layout_node->wants_mouse_events()) {
  272. document.set_hovered_node(result.layout_node->dom_node());
  273. result.layout_node->handle_mousemove({}, position, buttons, modifiers);
  274. // FIXME: It feels a bit aggressive to always update the cursor like this.
  275. if (auto* page = m_browsing_context.page())
  276. page->client().page_did_request_cursor_change(Gfx::StandardCursor::None);
  277. return true;
  278. }
  279. RefPtr<DOM::Node> node = result.layout_node->dom_node();
  280. if (node && is<HTML::HTMLIFrameElement>(*node)) {
  281. if (auto* nested_browsing_context = static_cast<HTML::HTMLIFrameElement&>(*node).nested_browsing_context())
  282. return nested_browsing_context->event_handler().handle_mousemove(position.translated(compute_mouse_event_offset({}, *result.layout_node)), buttons, modifiers);
  283. return false;
  284. }
  285. auto pointer_events = result.layout_node->computed_values().pointer_events();
  286. // FIXME: Handle other values for pointer-events.
  287. if (pointer_events == CSS::PointerEvents::None)
  288. return false;
  289. hovered_node_changed = node != document.hovered_node();
  290. document.set_hovered_node(node);
  291. if (node) {
  292. hovered_link_element = node->enclosing_link_element();
  293. if (hovered_link_element)
  294. is_hovering_link = true;
  295. if (node->is_text()) {
  296. auto cursor = result.layout_node->computed_values().cursor();
  297. if (cursor == CSS::Cursor::Auto)
  298. hovered_node_cursor = Gfx::StandardCursor::IBeam;
  299. else
  300. hovered_node_cursor = cursor_css_to_gfx(cursor);
  301. } else if (node->is_element()) {
  302. auto cursor = result.layout_node->computed_values().cursor();
  303. if (cursor == CSS::Cursor::Auto)
  304. hovered_node_cursor = Gfx::StandardCursor::Arrow;
  305. else
  306. hovered_node_cursor = cursor_css_to_gfx(cursor);
  307. }
  308. auto offset = compute_mouse_event_offset(position, *result.layout_node);
  309. node->dispatch_event(UIEvents::MouseEvent::create(UIEvents::EventNames::mousemove, offset.x(), offset.y(), position.x(), position.y()));
  310. // NOTE: Dispatching an event may have disturbed the world.
  311. if (!layout_root() || layout_root() != node->document().layout_node())
  312. return true;
  313. }
  314. if (m_in_mouse_selection) {
  315. auto hit = layout_root()->hit_test(position, Layout::HitTestType::TextCursor);
  316. if (hit.layout_node && hit.layout_node->dom_node()) {
  317. m_browsing_context.set_cursor_position(DOM::Position(*hit.layout_node->dom_node(), result.index_in_node));
  318. layout_root()->set_selection_end({ hit.layout_node, hit.index_in_node });
  319. }
  320. if (auto* page = m_browsing_context.page())
  321. page->client().page_did_change_selection();
  322. }
  323. }
  324. if (auto* page = m_browsing_context.page()) {
  325. page->client().page_did_request_cursor_change(hovered_node_cursor);
  326. if (hovered_node_changed) {
  327. RefPtr<HTML::HTMLElement> hovered_html_element = document.hovered_node() ? document.hovered_node()->enclosing_html_element_with_attribute(HTML::AttributeNames::title) : nullptr;
  328. if (hovered_html_element && !hovered_html_element->title().is_null()) {
  329. page->client().page_did_enter_tooltip_area(m_browsing_context.to_top_level_position(position), hovered_html_element->title());
  330. } else {
  331. page->client().page_did_leave_tooltip_area();
  332. }
  333. if (is_hovering_link)
  334. page->client().page_did_hover_link(document.parse_url(hovered_link_element->href()));
  335. else
  336. page->client().page_did_unhover_link();
  337. }
  338. }
  339. return true;
  340. }
  341. bool EventHandler::focus_next_element()
  342. {
  343. if (!m_browsing_context.active_document())
  344. return false;
  345. auto* element = m_browsing_context.active_document()->focused_element();
  346. if (!element) {
  347. element = m_browsing_context.active_document()->first_child_of_type<DOM::Element>();
  348. if (element && element->is_focusable()) {
  349. m_browsing_context.active_document()->set_focused_element(element);
  350. return true;
  351. }
  352. }
  353. for (element = element->next_element_in_pre_order(); element && !element->is_focusable(); element = element->next_element_in_pre_order())
  354. ;
  355. m_browsing_context.active_document()->set_focused_element(element);
  356. return element;
  357. }
  358. bool EventHandler::focus_previous_element()
  359. {
  360. if (!m_browsing_context.active_document())
  361. return false;
  362. auto* element = m_browsing_context.active_document()->focused_element();
  363. if (!element) {
  364. element = m_browsing_context.active_document()->last_child_of_type<DOM::Element>();
  365. if (element && element->is_focusable()) {
  366. m_browsing_context.active_document()->set_focused_element(element);
  367. return true;
  368. }
  369. }
  370. for (element = element->previous_element_in_pre_order(); element && !element->is_focusable(); element = element->previous_element_in_pre_order())
  371. ;
  372. m_browsing_context.active_document()->set_focused_element(element);
  373. return element;
  374. }
  375. constexpr bool should_ignore_keydown_event(u32 code_point)
  376. {
  377. // FIXME: There are probably also keys with non-zero code points that should be filtered out.
  378. return code_point == 0;
  379. }
  380. bool EventHandler::handle_keydown(KeyCode key, unsigned modifiers, u32 code_point)
  381. {
  382. if (!m_browsing_context.active_document())
  383. return false;
  384. NonnullRefPtr<DOM::Document> document = *m_browsing_context.active_document();
  385. if (!document->layout_node())
  386. return false;
  387. NonnullRefPtr<Layout::InitialContainingBlock> layout_root = *document->layout_node();
  388. if (key == KeyCode::Key_Tab) {
  389. if (modifiers & KeyModifier::Mod_Shift)
  390. return focus_previous_element();
  391. return focus_next_element();
  392. }
  393. if (layout_root->selection().is_valid()) {
  394. auto range = layout_root->selection().to_dom_range()->normalized();
  395. if (range->start_container()->is_editable()) {
  396. layout_root->set_selection({});
  397. // FIXME: This doesn't work for some reason?
  398. m_browsing_context.set_cursor_position({ *range->start_container(), range->start_offset() });
  399. if (key == KeyCode::Key_Backspace || key == KeyCode::Key_Delete) {
  400. m_edit_event_handler->handle_delete(range);
  401. return true;
  402. }
  403. if (!should_ignore_keydown_event(code_point)) {
  404. m_edit_event_handler->handle_delete(range);
  405. m_edit_event_handler->handle_insert(m_browsing_context.cursor_position(), code_point);
  406. m_browsing_context.increment_cursor_position_offset();
  407. return true;
  408. }
  409. }
  410. }
  411. if (m_browsing_context.cursor_position().is_valid() && m_browsing_context.cursor_position().node()->is_editable()) {
  412. if (key == KeyCode::Key_Backspace) {
  413. if (!m_browsing_context.decrement_cursor_position_offset()) {
  414. // FIXME: Move to the previous node and delete the last character there.
  415. return true;
  416. }
  417. m_edit_event_handler->handle_delete_character_after(m_browsing_context.cursor_position());
  418. return true;
  419. }
  420. if (key == KeyCode::Key_Delete) {
  421. if (m_browsing_context.cursor_position().offset_is_at_end_of_node()) {
  422. // FIXME: Move to the next node and delete the first character there.
  423. return true;
  424. }
  425. m_edit_event_handler->handle_delete_character_after(m_browsing_context.cursor_position());
  426. return true;
  427. }
  428. if (key == KeyCode::Key_Right) {
  429. if (!m_browsing_context.increment_cursor_position_offset()) {
  430. // FIXME: Move to the next node.
  431. }
  432. return true;
  433. }
  434. if (key == KeyCode::Key_Left) {
  435. if (!m_browsing_context.decrement_cursor_position_offset()) {
  436. // FIXME: Move to the previous node.
  437. }
  438. return true;
  439. }
  440. if (!should_ignore_keydown_event(code_point)) {
  441. m_edit_event_handler->handle_insert(m_browsing_context.cursor_position(), code_point);
  442. m_browsing_context.increment_cursor_position_offset();
  443. return true;
  444. }
  445. // NOTE: Because modifier keys should be ignored, we need to return true.
  446. return true;
  447. }
  448. auto event = UIEvents::KeyboardEvent::create_from_platform_event(UIEvents::EventNames::keydown, key, modifiers, code_point);
  449. if (RefPtr<DOM::Element> focused_element = document->focused_element())
  450. return focused_element->dispatch_event(move(event));
  451. if (RefPtr<HTML::HTMLElement> body = m_browsing_context.active_document()->body())
  452. return body->dispatch_event(move(event));
  453. return document->root().dispatch_event(move(event));
  454. }
  455. bool EventHandler::handle_keyup(KeyCode key, unsigned modifiers, u32 code_point)
  456. {
  457. RefPtr<DOM::Document> document = m_browsing_context.active_document();
  458. if (!document)
  459. return false;
  460. auto event = UIEvents::KeyboardEvent::create_from_platform_event(UIEvents::EventNames::keyup, key, modifiers, code_point);
  461. if (RefPtr<DOM::Element> focused_element = document->focused_element())
  462. return document->focused_element()->dispatch_event(move(event));
  463. if (RefPtr<HTML::HTMLElement> body = document->body())
  464. return body->dispatch_event(move(event));
  465. return document->root().dispatch_event(move(event));
  466. }
  467. void EventHandler::set_mouse_event_tracking_layout_node(Layout::Node* layout_node)
  468. {
  469. if (layout_node)
  470. m_mouse_event_tracking_layout_node = layout_node->make_weak_ptr();
  471. else
  472. m_mouse_event_tracking_layout_node = nullptr;
  473. }
  474. }