Copy formatted HTML when the console selection contains a table
Copy formatted HTML when the console selection contains a table

The ConsoleViewport script already has 2 functions to copy content of
the console. One does formatted copy (copyWithStyles) and the other one
does text copy only (_onCopy).

copyWithStyles is only used in cases when you right-click on specific
locations of console messages, you get a new menu item to copy a
message with its styles.

This change alters the standard _onCopy handler. It adds a step where it
detects whether there are tables in the selection. If there are, then it
redirects to copyWithStyles.

Later, if we think there are more cases where we want to copy things in
a formatted manner, we can always rename the new _selectionContainsTable
function and make it return true in more cases.

Before: https://i.imgur.com/AQbQwUY.gif
After: https://imgur.com/xmm0mXd.gif

Bug: 1115011
Change-Id: Id03d533843442e2ef0dd51787e2a2938c7014344
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2348602
Reviewed-by: Songtao Xia <efb39a3e57dd0e7c4fd137171d5e7a3f041d1da6@microsoft.com>
Reviewed-by: Mathias Bynens <17a2cbc4e33156874a9862b0f530521117e66a3d@chromium.org>
Commit-Queue: Patrick Brosset <f0b1693d3ec18fb190dd6deddb896f34ba3fd693@microsoft.com>

ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend,ChromeDevTools/devtools-frontend