Bug 28187

Summary: "Double-click to add" new style button does not always show up
Product: WebKit Reporter: Sam Weinig <sam>
Component: Web Inspector (Deprecated)Assignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: eric, joepeck, timothy
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
URL: http://webkit.org
Attachments:
Description Flags
Quick Fix none

Description Sam Weinig 2009-08-11 14:20:10 PDT
On http://webkit.org, the "Double-click to add" button does not show up for the body element in the elements pane.
Comment 1 Joseph Pecoraro 2009-08-11 14:24:13 PDT
Seems to be due to "could not parse color" warnings.  I'll work on this right now.
Comment 2 Joseph Pecoraro 2009-08-11 14:39:56 PDT
Interesting.  The incoming CSS of:

    url(/images/green.png)

Has the string "green" inside it and "green" swatch is (incorrectly) made for it:

    http://tr.im/wdZz?grabup

WebInspector.Color is invoked if there was a swatch on the massaged CSS value, and it throws an error because it cannot parse the following as a valid color:

    url(<ahref="http://webkit.org/images/green-background.png"class="webkit-html-resource-link"title="http://webkit.org/images/green-background.png"target="_blank">http://webkit.org/images/green-background.png</a>)

Since this affects the WebKit Nightly right now I will throw up a "quick fix" patch that catches the WebInspector.Color error and therefore takes us back to the expected old behavior with the swatch still incorrectly showing.  I'll then work on cleaning this up in general.
Comment 3 Joseph Pecoraro 2009-08-11 14:49:00 PDT
Created attachment 34597 [details]
Quick Fix

This is the quick fix for the Nightly Build.

---

I think a more optimal solution would be to avoid throwing an error at all. Instead something like WebInspector.Color.parseColor() factory method which would return either 'null' or a WebInspector.Color object.  That way we won't have to worry about any throw/catch.  Along with the other improvements mentioned previously, including:

  - swatch shows up accidentally
  - all swatches should be clickable to toggle colors
  - swatches should be clickable in shorthand properties
Comment 4 Eric Seidel (no email) 2009-08-12 09:43:34 PDT
Comment on attachment 34597 [details]
Quick Fix

Clearing flags on attachment: 34597

Committing to http://svn.webkit.org/repository/webkit/trunk ...
	M	WebCore/ChangeLog
	M	WebCore/inspector/front-end/StylesSidebarPane.js
Committed r47116
	M	WebCore/ChangeLog
	M	WebCore/inspector/front-end/StylesSidebarPane.js
r47116 = 339ebebf103c8020a3164de2578c2171389b539a (trunk)
No changes between current HEAD and refs/remotes/trunk
Resetting to the latest refs/remotes/trunk
http://trac.webkit.org/changeset/47116
Comment 5 Eric Seidel (no email) 2009-08-12 09:43:37 PDT
All reviewed patches have been landed.  Closing bug.