RESOLVED FIXED 66656
Web Inspector: Prepare utilities.js for compilation
https://bugs.webkit.org/show_bug.cgi?id=66656
Summary Web Inspector: Prepare utilities.js for compilation
Pavel Feldman
Reported 2011-08-22 03:13:23 PDT
Do not use "this" within non-prototypes, get rid of WebInspector dependencies
Attachments
Patch (35.30 KB, patch)
2011-08-22 06:16 PDT, Pavel Feldman
no flags
Patch (42.94 KB, patch)
2011-08-22 06:53 PDT, Pavel Feldman
no flags
Patch (43.04 KB, patch)
2011-08-22 07:35 PDT, Pavel Feldman
tonyg: review+
Pavel Feldman
Comment 1 2011-08-22 06:16:54 PDT
Pavel Feldman
Comment 2 2011-08-22 06:53:54 PDT
Andrey Kosyakov
Comment 3 2011-08-22 07:22:56 PDT
Comment on attachment 104673 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=104673&action=review > Source/WebCore/inspector/front-end/ConsoleView.js:999 > + formatters.s = formatters.f = formatters.i = formatters.d = valueFormatter; Split to multiple lines or use a for? > Source/WebCore/inspector/front-end/DOMAgent.js:249 > + var currentNode = node.parentNode; > + while (currentNode) { > + if (this === currentNode) > + return true; > + currentNode = currentNode.parentNode; > + } nit: this is better written as a for loop (I know you're just moving it around, hence just a nit) > Source/WebCore/inspector/front-end/DOMAgent.js:255 > + return descendant !== null && descendant.isAncestor(this); return !!descendant && descendant.isAncestor(this); > Source/WebCore/inspector/front-end/DOMAgent.js:264 > + if (!this.nodeValue.length) > + return true; > + return this.nodeValue.match(/^[\s\xA0]+$/); nit: do we need an explicit optimization here? also, why do we use match() instead of test()? This would be more readable as /^\s*$/.test(this.nodeValue); > Source/WebCore/inspector/front-end/ElementsPanel.js:482 > + if (!updateBreadcrumbs && (this.selectedDOMNode() === parent || this.selectedDOMNode().isAncestor(parent))) This seems to have slightly different semantics to the old code. > Source/WebCore/inspector/front-end/utilities.js:481 > while (currentNode) { > - if (ancestor === currentNode) > + if (this === currentNode) > return true; > currentNode = currentNode.parentNode; > } nit: for? > Source/WebCore/inspector/front-end/utilities.js:487 > + return descendant !== null && descendant.isAncestor(this); !!descendant && ...
Pavel Feldman
Comment 4 2011-08-22 07:32:36 PDT
Comment on attachment 104673 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=104673&action=review >> Source/WebCore/inspector/front-end/ConsoleView.js:999 >> + formatters.s = formatters.f = formatters.i = formatters.d = valueFormatter; > > Split to multiple lines or use a for? Done. >> Source/WebCore/inspector/front-end/DOMAgent.js:249 >> + } > > nit: this is better written as a for loop (I know you're just moving it around, hence just a nit) I don't want to change anything... >> Source/WebCore/inspector/front-end/DOMAgent.js:255 >> + return descendant !== null && descendant.isAncestor(this); > > return !!descendant && descendant.isAncestor(this); Done. >> Source/WebCore/inspector/front-end/utilities.js:481 >> } > > nit: for? Did not want to change much >> Source/WebCore/inspector/front-end/utilities.js:487 >> + return descendant !== null && descendant.isAncestor(this); > > !!descendant && ... Done.
Pavel Feldman
Comment 5 2011-08-22 07:35:02 PDT
Andrey Kosyakov
Comment 6 2011-08-22 07:44:25 PDT
Comment on attachment 104678 [details] Patch LGTM
Tony Gentilcore
Comment 7 2011-08-23 02:10:27 PDT
Comment on attachment 104678 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=104678&action=review > Source/WebCore/inspector/front-end/inspector.js:1720 > +Number.secondsToString = function(seconds, higherResolution) Might as well fix these two methods up with some nice JS doc comments now.
Pavel Feldman
Comment 8 2011-08-23 02:23:46 PDT
Note You need to log in before you can comment on or make changes to this bug.