Title: [191478] trunk/Source/WebInspectorUI
Revision
191478
Author
commit-qu...@webkit.org
Date
2015-10-22 14:37:04 -0700 (Thu, 22 Oct 2015)

Log Message

Web Inspector: srcset attributes should have hyperlinks to the resources
https://bugs.webkit.org/show_bug.cgi?id=150409

Patch by Joseph Pecoraro <pecor...@apple.com> on 2015-10-22
Reviewed by Timothy Hatcher.

Follow-up tweaks and fixes that were intended to be landed.

* UserInterface/Views/CodeMirrorAdditions.js:
(tokenizeSrcSetString):
Multiline parsing has issues recovering the state CodeMirror
expects, so we just bail in those cases. Leading whitespace
is also handled poorly, but expected to be rare.

* UserInterface/Views/DOMTreeElement.js:
(WebInspector.DOMTreeElement.prototype._buildAttributeDOM):
Trim to eliminate leading whitespace.

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (191477 => 191478)


--- trunk/Source/WebInspectorUI/ChangeLog	2015-10-22 21:33:38 UTC (rev 191477)
+++ trunk/Source/WebInspectorUI/ChangeLog	2015-10-22 21:37:04 UTC (rev 191478)
@@ -1,5 +1,24 @@
 2015-10-22  Joseph Pecoraro  <pecor...@apple.com>
 
+        Web Inspector: srcset attributes should have hyperlinks to the resources
+        https://bugs.webkit.org/show_bug.cgi?id=150409
+
+        Reviewed by Timothy Hatcher.
+
+        Follow-up tweaks and fixes that were intended to be landed.
+
+        * UserInterface/Views/CodeMirrorAdditions.js:
+        (tokenizeSrcSetString):
+        Multiline parsing has issues recovering the state CodeMirror
+        expects, so we just bail in those cases. Leading whitespace
+        is also handled poorly, but expected to be rare.
+
+        * UserInterface/Views/DOMTreeElement.js:
+        (WebInspector.DOMTreeElement.prototype._buildAttributeDOM):
+        Trim to eliminate leading whitespace.
+
+2015-10-22  Joseph Pecoraro  <pecor...@apple.com>
+
         Web Inspector: Restore :not(:placeholder-shown) behavior on search bars with comments
         https://bugs.webkit.org/show_bug.cgi?id=150452
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js (191477 => 191478)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js	2015-10-22 21:33:38 UTC (rev 191477)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CodeMirrorAdditions.js	2015-10-22 21:37:04 UTC (rev 191478)
@@ -88,14 +88,14 @@
             if (state._linkQuoteCharacter)
                 stream.eatWhile(new RegExp("[^," + state._linkQuoteCharacter + "]"));
             else
-                stream.eatWhile(/[^\s\u00a0=<>\"\',]/);
+                stream.eatWhile(/[^\s\u00a0=<>\"\']/);
             stream.eatWhile(/[\s,]/);
         }
 
         // If the stream isn't at the end of line and we found the end quote
         // change _linkTokenize to parse the end of the link next. Otherwise
         // _linkTokenize will stay as-is to parse more of the srcset.
-        if (!stream.eol() && (!state._linkQuoteCharacter || stream.peek() === state._linkQuoteCharacter))
+        if (stream.eol() || (!state._linkQuoteCharacter || stream.peek() === state._linkQuoteCharacter))
             state._linkTokenize = tokenizeEndOfLinkString;
 
         // Link portion.
@@ -144,7 +144,7 @@
                 state._linkTokenize = tokenizeLinkString;
                 state._linkBaseStyle = style;
 
-                // The attribute should be quoted.
+                // The attribute may or may not be quoted.
                 var quote = current[0];
 
                 state._linkQuoteCharacter = quote === "'" || quote === "\"" ? quote : null;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (191477 => 191478)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2015-10-22 21:33:38 UTC (rev 191477)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2015-10-22 21:37:04 UTC (rev 191478)
@@ -1113,9 +1113,10 @@
             let baseURL = node.ownerDocument ? node.ownerDocument.documentURL : null;
             attrValueElement = attrSpanElement.createChild("span", "html-attribute-value");
 
+            // Leading whitespace.
             let groups = value.split(/\s*,\s*/);
             for (let i = 0; i < groups.length; ++i) {
-                let string = groups[i];
+                let string = groups[i].trim();
                 let spaceIndex = string.search(/\s/);
 
                 if (spaceIndex === -1) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to