ax_tree_data_mojom_traits.cc 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. // Copyright 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "ui/accessibility/mojom/ax_tree_data_mojom_traits.h"
  5. namespace mojo {
  6. // static
  7. bool StructTraits<ax::mojom::AXTreeDataDataView, ui::AXTreeData>::Read(
  8. ax::mojom::AXTreeDataDataView data,
  9. ui::AXTreeData* out) {
  10. if (!data.ReadTreeId(&out->tree_id))
  11. return false;
  12. if (!data.ReadParentTreeId(&out->parent_tree_id))
  13. return false;
  14. if (!data.ReadFocusedTreeId(&out->focused_tree_id))
  15. return false;
  16. if (!data.ReadDoctype(&out->doctype))
  17. return false;
  18. out->loaded = data.loaded();
  19. out->loading_progress = data.loading_progress();
  20. if (!data.ReadMimetype(&out->mimetype))
  21. return false;
  22. if (!data.ReadTitle(&out->title))
  23. return false;
  24. if (!data.ReadUrl(&out->url))
  25. return false;
  26. out->focus_id = data.focus_id();
  27. out->sel_is_backward = data.sel_is_backward();
  28. out->sel_anchor_object_id = data.sel_anchor_object_id();
  29. out->sel_anchor_offset = data.sel_anchor_offset();
  30. out->sel_anchor_affinity = data.sel_anchor_affinity();
  31. out->sel_focus_object_id = data.sel_focus_object_id();
  32. out->sel_focus_offset = data.sel_focus_offset();
  33. out->sel_focus_affinity = data.sel_focus_affinity();
  34. out->root_scroller_id = data.root_scroller_id();
  35. if (!data.ReadMetadata(&out->metadata))
  36. return false;
  37. return true;
  38. }
  39. } // namespace mojo