WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
16079
Web Inspector: SVG image content view should toggle between image and source
https://bugs.webkit.org/show_bug.cgi?id=16079
Summary
Web Inspector: SVG image content view should toggle between image and source
Eric Seidel (no email)
Reported
2007-11-21 00:17:34 PST
No way to view source for SVGImage resources in inspector The Inspector has not yet been educated about SVG images and the fact that they have source which is human readable. I discovered this today when looking at if
bug 16056
applied to CachedImage (for the SVGImage case).
bug 16056
does apply to CachedImage, but only if the Inspector is able to display the source for .svg files used by <img> tags or CSS backgrounds.
Attachments
Patch
(10.59 KB, patch)
2017-03-13 18:58 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
[Image] After Patch is applied
(691.26 KB, image/png)
2017-03-13 19:00 PDT
,
Devin Rousso
no flags
Details
Patch
(11.77 KB, patch)
2017-03-13 20:22 PDT
,
Devin Rousso
joepeck
: review+
Details
Formatted Diff
Diff
[Image] After Patch is applied
(689.62 KB, image/png)
2017-03-13 20:22 PDT
,
Devin Rousso
no flags
Details
Patch
(11.34 KB, patch)
2017-03-14 13:44 PDT
,
Devin Rousso
no flags
Details
Formatted Diff
Diff
Archive of layout-test-results from ews126 for ios-simulator-wk2
(
deleted
)
2017-03-14 14:55 PDT
,
Build Bot
no flags
Details
Show Obsolete
(4)
View All
Add attachment
proposed patch, testcase, etc.
Timothy Hatcher
Comment 1
2007-11-21 08:42:04 PST
Where does the SVG image show up in resources? I assume under the Images category? We could have Preview, Source and DOM views for SVG images (a three part segmented-button in the toolbar.)
Eric Seidel (no email)
Comment 2
2007-11-21 11:05:59 PST
Yes, it shows up under Images. Preview/Source/DOM sounds great to me. :) Obviously this is not a high priority issue, but once we work out more of the bugs in SVGImage, I do see that as the major way SVG will be used on the web (in HTML via <img> tags and CSS background-image: properties).
Adam Roben (:aroben)
Comment 3
2008-01-29 11:04:18 PST
<
rdar://problem/5712856
>
Anthony Ricaud
Comment 4
2009-09-14 16:03:08 PDT
Isn't it fixed by now ?
Timothy Hatcher
Comment 5
2009-09-14 16:52:55 PDT
I don't think so. I think we still just show a preview for SVG images, and no way to see the source.
Alexei Masterov
Comment 6
2010-09-16 08:22:15 PDT
There are at least two ways that I know of that and SVG can be included into page: 1. <img="name.svg"> 2. <object data="name.svg"> in the first case - the browser treats it as a static image and renders it as such, in the second case - the browser treats it as an organic part of the page, allows javascript that is inside it to interact with the page DOM, etc. Inspector is consistent with the browser in a way that it displays the content of an SVG in both cases. In the first case it treats it as an image, in the second case it treats it as a source file, allows javascript debugging, and includes it's DOM as a subtree into the DOM of the page. Can you please provide a reason for why it would be beneficial to the end user to show more than what the browser sees in the first case?
Devin Rousso
Comment 7
2017-03-13 18:58:22 PDT
Created
attachment 304332
[details]
Patch
Devin Rousso
Comment 8
2017-03-13 19:00:48 PDT
Created
attachment 304334
[details]
[Image] After Patch is applied
Joseph Pecoraro
Comment 9
2017-03-13 19:20:09 PDT
Comment on
attachment 304332
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=304332&action=review
> Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js:43 > + if (this._resource.mimeTypeComponents.type === "image/svg+xml") { > + if (!this._showSourceButtonNavigationItem) { > + this._showSourceButtonNavigationItem = new WebInspector.ActivateButtonNavigationItem("svg-show-source", WebInspector.UIString("Show Source"), WebInspector.UIString("Show Image"), "Images/NavigationItemCurleyBraces.svg", 13, 13); > + this._showSourceButtonNavigationItem.addEventListener(WebInspector.ButtonNavigationItem.Event.Clicked, this._handleShowSourceClick, this); > + } > + return [this._showSourceButtonNavigationItem]; > + }
I think we should experiment with a ResourceClusterView like approach and have a toggle between "Image" and "Text" or "Source" (and maybe eventually "DOM" or "Tree"). This button is okay, but I think the other approach is more generic and expands to more than 2 displays. I've stopped the review here because I think we both agree we should try out this approach.
Devin Rousso
Comment 10
2017-03-13 20:22:17 PDT
Created
attachment 304341
[details]
Patch
Devin Rousso
Comment 11
2017-03-13 20:22:30 PDT
Created
attachment 304342
[details]
[Image] After Patch is applied
Blaze Burg
Comment 12
2017-03-13 22:07:52 PDT
Comment on
attachment 304332
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=304332&action=review
>> Source/WebInspectorUI/UserInterface/Views/ImageResourceContentView.js:43 >> + } > > I think we should experiment with a ResourceClusterView like approach and have a toggle between "Image" and "Text" or "Source" (and maybe eventually "DOM" or "Tree"). This button is okay, but I think the other approach is more generic and expands to more than 2 displays. I've stopped the review here because I think we both agree we should try out this approach.
I agree as well.
Dean Jackson
Comment 13
2017-03-14 11:08:15 PDT
Comment on
attachment 304341
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=304341&action=review
This looks good to me, but I'll let a WI team member put the r+
> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:140 > + representedObject += contentViewToShow.textEditor.string = fileReader.result;
I'm not sure about WI coding guidelines, but I'd do this in two separate lines. Also, I'm not sure why you need representedObject here at all - you used it above when creating the TextContentView, but I don't see where you use it again.
Joseph Pecoraro
Comment 14
2017-03-14 11:35:13 PDT
Comment on
attachment 304341
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=304341&action=review
r=me
> Source/WebInspectorUI/UserInterface/Main.html:665 > <script src="Views/StorageSidebarPanel.js"></script> > + <script src="Views/SVGImageResourceClusterContentView.js"></script> > <script src="Views/SyntaxHighlightingSupport.js"></script>
Nit: Sort using `sort`. Capitalizes are less than lower case. So "SVG" < "St".
> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:43 > + this._imagePathComponent = createPathComponent(WebInspector.UIString("Image"), "image", WebInspector.SVGImageResourceClusterContentView.Identifier.ShowImage); > + this._sourcePathComponent = createPathComponent(WebInspector.UIString("Source"), "source", WebInspector.SVGImageResourceClusterContentView.Identifier.ShowSource);
Do these have icons? They should have something.
> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:66 > + shown()
Add a `// Protected` comment above these.
> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:137 > + this._resource.requestContent() > + .then((result) => {
Style: I'd read this easier as: this._resource.requestContent().then((result) => { ... }).catch(handlePromiseException); I understand others disagree.
>> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:140 >> + representedObject += contentViewToShow.textEditor.string = fileReader.result; > > I'm not sure about WI coding guidelines, but I'd do this in two separate lines. Also, I'm not sure why you need representedObject here at all - you used it above when creating the TextContentView, but I don't see where you use it again.
Indeed, representedObject is unused here, so you can drop the var everywhere and just inline an empty string above.
> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:168 > +WebInspector.SVGImageResourceClusterContentView.Identifier = { > + ShowImage: "show-image", > + ShowSource: "show-source", > +};
Why the "Show" prefix? Seems Identifier.Image and Identifier.Source would be sufficient.
Devin Rousso
Comment 15
2017-03-14 13:44:22 PDT
Created
attachment 304417
[details]
Patch
Build Bot
Comment 16
2017-03-14 14:55:05 PDT
Comment on
attachment 304417
[details]
Patch
Attachment 304417
[details]
did not pass ios-sim-ews (ios-simulator-wk2): Output:
http://webkit-queues.webkit.org/results/3323797
New failing tests: imported/w3c/web-platform-tests/IndexedDB/fire-success-event-exception.html
Build Bot
Comment 17
2017-03-14 14:55:12 PDT
Created
attachment 304432
[details]
Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.11.6
Joseph Pecoraro
Comment 18
2017-03-15 11:33:43 PDT
Comment on
attachment 304417
[details]
Patch What is left to review of this patch? I still think there should be icons for the options, but other than that this looks good.
Devin Rousso
Comment 19
2017-03-15 11:45:34 PDT
Comment on
attachment 304417
[details]
Patch (In reply to
comment #18
)
> Comment on
attachment 304417
[details]
> Patch > > What is left to review of this patch? I still think there should be icons > for the options, but other than that this looks good.
<
https://webkit.org/b/169687
>
WebKit Commit Bot
Comment 20
2017-03-15 12:15:30 PDT
Comment on
attachment 304417
[details]
Patch Clearing flags on attachment: 304417 Committed
r213999
: <
http://trac.webkit.org/changeset/213999
>
WebKit Commit Bot
Comment 21
2017-03-15 12:15:36 PDT
All reviewed patches have been landed. Closing bug.
Timothy Hatcher
Comment 22
2017-03-15 12:54:01 PDT
Comment on
attachment 304417
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=304417&action=review
> Source/WebInspectorUI/UserInterface/Views/SVGImageResourceClusterContentView.js:42 > + this._imagePathComponent = createPathComponent(WebInspector.UIString("Image"), "image", WebInspector.SVGImageResourceClusterContentView.Identifier.Image);
I'm on the fence on if this should say "Image" or "Preview". Eventually we might even want "DOM Tree", and then it really might be "Preview" if changes to the DOM are allowed.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug