RESOLVED FIXED 44311
Web Inspector: elements dom tree - word wrap toggle
https://bugs.webkit.org/show_bug.cgi?id=44311
Summary Web Inspector: elements dom tree - word wrap toggle
Adam
Reported 2010-08-19 16:55:20 PDT
I'd really like to see a toggle switch for turning word-wrap on/off on the DOM tree. Depending on how deep the tree is, you need a really wide monitor to see everything without it being very cramped. It would be good if it was an option so be able to turn it off and add a scroll bar. Otherwise on a deep tree with word-wrap, it's 80% white space and a tall line of text. It is convenient for shallow trees, it could be annoying to have to keep scrolling half an inch back and forth. So it should really be optional.
Attachments
[IMAGE] Rooted at HTML (108.02 KB, image/png)
2010-08-19 17:04 PDT, Joseph Pecoraro
no flags
[IMAGE] Rooted at div#ten (84.58 KB, image/png)
2010-08-19 17:05 PDT, Joseph Pecoraro
no flags
[PATCH] Suggested solution (7.54 KB, patch)
2011-03-05 06:28 PST, Alexander Pavlov (apavlov)
pfeldman: review-
[IMAGE] Screenshot of a non-word-wrapped DOM with a context menu displayed (18.31 KB, image/png)
2011-03-05 06:29 PST, Alexander Pavlov (apavlov)
no flags
[PATCH] Comments addressed, added revealing of the element's left boundary (if necessary) (7.15 KB, patch)
2011-03-09 04:51 PST, Alexander Pavlov (apavlov)
pfeldman: review-
[PATCH] Comments addressed (8.22 KB, patch)
2011-03-09 06:04 PST, Alexander Pavlov (apavlov)
pfeldman: review+
Joseph Pecoraro
Comment 1 2010-08-19 17:04:14 PDT
That may be nice. Note that you can re-root the tree at a given node. Just double click the node in the breadcrumbs (bottom of the element's panel). This should help some.
Joseph Pecoraro
Comment 2 2010-08-19 17:04:51 PDT
Created attachment 64912 [details] [IMAGE] Rooted at HTML
Joseph Pecoraro
Comment 3 2010-08-19 17:05:09 PDT
Created attachment 64913 [details] [IMAGE] Rooted at div#ten
Adam
Comment 4 2010-08-20 11:37:15 PDT
Sweet, didn't realize that double clicking did that.
Alexander Pavlov (apavlov)
Comment 5 2011-03-05 06:28:39 PST
Created attachment 84861 [details] [PATCH] Suggested solution A "Word Wrap" context menu check item will switch between the word-wrapped and non-word-wrapped modes of the DOM display.
Alexander Pavlov (apavlov)
Comment 6 2011-03-05 06:29:46 PST
Created attachment 84862 [details] [IMAGE] Screenshot of a non-word-wrapped DOM with a context menu displayed
Pavel Feldman
Comment 7 2011-03-06 10:54:48 PST
Comment on attachment 84861 [details] [PATCH] Suggested solution View in context: https://bugs.webkit.org/attachment.cgi?id=84861&action=review Did you check whether revealing element reveals it horizontally Ok? > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:196 > + var x = Math.max(Math.min(root.totalOffsetLeft + root.offsetWidth, root.parentElement.totalOffsetLeft + root.parentElement.offsetWidth) - 20, 1); Could you use wrap / nowrap conditions here and simplify the code? r- for this.
Alexander Pavlov (apavlov)
Comment 8 2011-03-06 11:23:54 PST
(In reply to comment #7) > (From update of attachment 84861 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=84861&action=review > > Did you check whether revealing element reveals it horizontally Ok? Good point, I'm pretty sure it only scrolls to the necessary line. > > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:196 > > + var x = Math.max(Math.min(root.totalOffsetLeft + root.offsetWidth, root.parentElement.totalOffsetLeft + root.parentElement.offsetWidth) - 20, 1); > > Could you use wrap / nowrap conditions here and simplify the code? r- for this. This is not about wrap/nowrap. This code constrains the x coordinate to the visible portion of the corresponding list item. I don't see a point in having two similar conditions instead of one -- it clutters the code (especially given that this code is wrap-agnostic at the moment).
Pavel Feldman
Comment 9 2011-03-06 11:29:00 PST
Comment on attachment 84861 [details] [PATCH] Suggested solution View in context: https://bugs.webkit.org/attachment.cgi?id=84861&action=review >>> Source/WebCore/inspector/front-end/ElementsTreeOutline.js:196 >>> + var x = Math.max(Math.min(root.totalOffsetLeft + root.offsetWidth, root.parentElement.totalOffsetLeft + root.parentElement.offsetWidth) - 20, 1); >> >> Could you use wrap / nowrap conditions here and simplify the code? r- for this. > > This is not about wrap/nowrap. This code constrains the x coordinate to the visible portion of the corresponding list item. I don't see a point in having two similar conditions instead of one -- it clutters the code (especially given that this code is wrap-agnostic at the moment). Two things concern me: 1) Math.min(root.totalOffsetLeft + root.offsetWidth, root.parentElement.totalOffsetLeft + root.parentElement.offsetWidth) So you imply that container can be smaller that the child. Is this related to the scroll? If yes, why not to check explicitly 2) Math.max(, 1) implies we now hit negative numbers Formula this big is 100 times worse that 5 lines of clean conditional code. It is hard to understand, it is hard to maintain, it is hard not to regress.
Alexander Pavlov (apavlov)
Comment 10 2011-03-09 04:51:49 PST
Created attachment 85161 [details] [PATCH] Comments addressed, added revealing of the element's left boundary (if necessary)
Pavel Feldman
Comment 11 2011-03-09 05:07:14 PST
Comment on attachment 85161 [details] [PATCH] Comments addressed, added revealing of the element's left boundary (if necessary) View in context: https://bugs.webkit.org/attachment.cgi?id=85161&action=review > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:188 > + var container = this.element.parentElement; What is wrong with the native implementation? We should use platform capabilities where possible. > Source/WebCore/inspector/front-end/ElementsTreeOutline.js:201 > + // items extend nearly to the right edge of the outer <ol>. However, You could do: var scrollContainerElement = this.element.parentElement; and then leave old code changed to using scrollContainerElement.
Alexander Pavlov (apavlov)
Comment 12 2011-03-09 06:04:38 PST
Created attachment 85168 [details] [PATCH] Comments addressed
Alexander Pavlov (apavlov)
Comment 13 2011-03-10 04:43:08 PST
Committing to http://svn.webkit.org/repository/webkit/trunk ... M Source/WebCore/ChangeLog M Source/WebCore/English.lproj/localizedStrings.js M Source/WebCore/inspector/front-end/ElementsPanel.js M Source/WebCore/inspector/front-end/ElementsTreeOutline.js M Source/WebCore/inspector/front-end/Settings.js M Source/WebCore/inspector/front-end/inspector.css Committed r80708
Note You need to log in before you can comment on or make changes to this bug.