Bug 140239

Summary: Web Inspector: Editing Inline Styles Not Working
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Brian Burg <burg>
Status: RESOLVED FIXED    
Severity: Normal CC: burg, commit-queue, graouts, joepeck, jonowells, mattbaker, nvasilyev, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch none

Description Joseph Pecoraro 2015-01-07 20:37:25 PST
* SUMMARY
Editing Inline Styles Not Working.

* TEST

    <style>body { background-color: red; }</style>
    <body bgColor="blue" style="background-color:green"></body>

* STEPS TO REPRODUCE
1. Inspect <body> of test case
2. Disable inline "green" style.
3. Attempt to change "red" style to "purple". Or try to disable.
  => Does not work.
Comment 1 Radar WebKit Bug Importer 2015-01-07 20:37:34 PST
<rdar://problem/19408438>
Comment 2 Joseph Pecoraro 2015-01-07 20:42:45 PST
Regression caused by "purge PassRefPtr from Inspector code and use Ref for typed and untyped protocol objects":
http://trac.webkit.org/changeset/178060

Doh.
Comment 3 Joseph Pecoraro 2015-01-07 21:18:19 PST
Looks like this was due to an InspectorStyleSheet change:

-        RefPtr<Inspector::InspectorValue> ordinalValue = value->get("ordinal");
-        if (!ordinalValue || !ordinalValue->asInteger(m_ordinal))
+        int ordinalValue;
+        if (!value->getInteger("ordinal", ordinalValue))

m_ordinal used to be getting set, but now it isn't, causing it to have a garbage value.
Comment 4 Brian Burg 2015-01-07 21:29:48 PST
Created attachment 244240 [details]
Patch
Comment 5 Joseph Pecoraro 2015-01-07 21:51:56 PST
Comment on attachment 244240 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=244240&action=review

Thanks!

> Source/WebCore/inspector/InspectorStyleSheet.h:69
> -        if (!value->getString("styleSheetId", m_styleSheetId))
> +        if (!value->getString(ASCIILiteral("styleSheetId"), m_styleSheetId))
>              return;
>  
> -        int ordinalValue;
> -        if (!value->getInteger("ordinal", ordinalValue))
> -            m_styleSheetId = "";
> +        if (!value->getInteger(ASCIILiteral("ordinal"), m_ordinal))
> +            m_styleSheetId = String();

We could swap the order of these and avoid this awkward cleanup.
Comment 6 Joseph Pecoraro 2015-01-07 21:55:44 PST
(In reply to comment #5)
> Comment on attachment 244240 [details]
> Patch
> 
> We could swap the order of these and avoid this awkward cleanup.

Bah, then we'd need to clean up ordinal. I guess we do need awkwardness.
Comment 7 WebKit Commit Bot 2015-01-07 22:19:39 PST
Comment on attachment 244240 [details]
Patch

Clearing flags on attachment: 244240

Committed r178105: <http://trac.webkit.org/changeset/178105>
Comment 8 WebKit Commit Bot 2015-01-07 22:19:43 PST
All reviewed patches have been landed.  Closing bug.