blob: 29dc0a47b9f327ffbcc8dfaf3edc3a337398ada9 [file] [log] [blame] [view]
Kristyn Hamasaki3be83c7eb2019-07-16 06:23:211# UI DevTools Overview
2
3UI DevTools allows UI developers to inspect the Chrome desktop UI system like a webpage using the frontend DevTools Inspector. It is
4currently supported on Linux, Windows, Mac, and ChromeOS.
5
6* [Old Ash Doc](https://www.chromium.org/developers/how-tos/inspecting-ash)
7* [Backend Source Code](https://cs.chromium.org/chromium/src/components/ui_devtools/)
8* [Inspector Frontend Source Code](https://cs.chromium.org/chromium/src/third_party/blink/renderer/devtools/front_end/)
9
10## How to run
11
121. Run Chromium with default port 9223 and start Chromium with UI DevTools flag:
13
14 $ out/Default/chrome --enable-ui-devtools
15
16 * If you want to use different port, add port in the flag `--enable-ui-devtools=<port>`.
172. In the Chrome Omnibox, go to chrome://inspect#other and click `inspect` under UIDevToolsClient.
18 * Direct link is chrome-devtools://devtools/bundled/inspector.html?ws=localhost:9223/0.
19
20
Kristyn Hamasaki0f6e4252019-08-16 22:13:1121## How to Use
Kristyn Hamasaki3be83c7eb2019-07-16 06:23:2122
Kristyn Hamasaki0f6e4252019-08-16 22:13:1123### Elements Tree
24
25View, Window, and Widget elements are displayed in the hierarchal elements tree. To expand the elements
26tree, right click the root element and then select Expand Recursively from the context menu.
27Then, to inspect an element's properties, click on its elements node.
28
29![expand elements]
30
31### Views Property Inspection
32
33When an element in the elements tree is selected, the property panel on the right side displays the
34element's properties. All elements have the basic properties (height, width, x, y, visibility).
35For Window and View elements, if that element has Layer properties, they will be displayed in
36a separate section.
37
38![browser frame properties]
39
40For View elements with Metadata properties, each parent class's properties from the Metadata
41will be displayed in an additional section.
42
43![image view properties]
44
45Elements' basic properties can be modified from the properties panel and changes will be shown.
46
47![edit property]
48
49### Inspect Mode
50
51To enter inspect mode, click the inspect icon at top left corner of UI Devtools.
52
53![inspector button]
54
55Hovering over a UI element highlights that element with a blue rectangular border and reveals
56the element's node in the elements tree.
57
58![hovering over elements]
59
60Clicking on a highlighted element will pin that element. Clicking the corresponding node
61in the elements tree will reveal that element's properties.
62
63![hover and inspect]
64
65When an element is pinned, hovering over other elements will reveal the vertical and horizontal
66distance between the two elements.
67
68![hovering distances]
69
70To exit inspect mode, either click the inspect icon again or press the Esc key.
71
72### Sources Panel
73
74In the properties panel, each section has a source link in the upper right corner. When right-clicked,
75the context menu shows the option to "Open in new tab," which opens the class's header file in Chromium
76code search.
77
78![properties panel right click link]
79
80If the link is simply clicked, it will open the source code in the sources panel of UI DevTools, which
81is read in from local files.
82
83![sources panel]
84
85### View Bounds Highlighting
86
87Red border rectangles around each View element can be drawn using the command Ctrl+R (Meta+R for mac).
88The rectangles can be toggled off and on using the same command.
89
90![debug bounds rectangles]
91
92### Bubble Locking
93
94In order to inspect a bubble, the command Ctrl+Shift+R (Meta+Shift+R for mac) locks bubbles to prevent
95them from dismissing upon losing focus. This allows a bubble's inner elements to be inspected. Bubble
96locking can be toggled off and on using the same command.
97
98![lock and inspect bubble]
99
Andrew Lee11cbca62019-08-21 16:39:08100### UI Element Tree Search
101
102In the elements panel, Ctrl+F to open the search bar at the bottom. The search functionality allows
103developers to search the UI element tree quickly by name, tag <>, and style properties.
104The search can do substring matches or exact matches (specified with quotations). The search returns
105all matches and highlights the specific nodes on the tree that are matched. The up and down arrows
106on the right of the search bar or ENTER are used to traverse through the matches.
107
108![ui element tree search]
109
110The search feature can also search the element's style properties in the UI element tree. The special
111key word 'style:' must be typed in the search bar.
112
113![search style]
114
Kristyn Hamasaki0f6e4252019-08-16 22:13:11115[expand elements]: images/expand_elements.gif
116[browser frame properties]: images/browser_frame_properties.png
117[image view properties]: images/image_view_properties.png
118[edit property]: images/edit_property.gif
119[inspector button]: images/inspector_button.png
120[hovering over elements]: images/hovering_over_elements.gif
121[hover and inspect]: images/hover_and_inspect.gif
122[hovering distances]: images/hovering_distances.gif
123[properties panel right click link]: images/properties_panel_right_click_link.png
124[sources panel]: images/sources_panel.png
125[debug bounds rectangles]: images/debug_bounds_rectangles.png
126[lock and inspect bubble]: images/lock_and_inspect_bubble.gif
Andrew Lee11cbca62019-08-21 16:39:08127[ui element tree search]: images/ui_element_tree_search.gif
128[search style]: images/search_style.png