Bug 143164

Summary: Web Inspector: REGRESSION(r179286) Editing Style Metrics Values no longer works
Product: WebKit Reporter: Joseph Pecoraro <joepeck>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
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] Proposed Fix none

Description Joseph Pecoraro 2015-03-27 16:56:34 PDT
* SUMMARY
Editing Style Metrics Values no longer works.

* TEST
<div style="width: 100px; background: blue">Text</div>

* STEPS TO REPRODUCE
1. Inspect div on test
2. Show Styles details sidebar pane
3. Show Metrics tab
4. Double click width/height
5. Input value and commit (return)
  => Nothing happens

* NOTES
- Appears to be because we removed CSSProperty.add and friends which this code was using. r179286
Comment 1 Radar WebKit Bug Importer 2015-03-27 16:56:57 PDT
<rdar://problem/20334620>
Comment 2 Joseph Pecoraro 2015-05-27 14:23:19 PDT
Created attachment 253801 [details]
[PATCH] Proposed Fix
Comment 3 Brian Burg 2015-05-27 15:00:08 PDT
Comment on attachment 253801 [details]
[PATCH] Proposed Fix

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

r=me

> Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js:425
> +            function didToggle()

Reading the callback code, this will get called even if there was an error in the backend (passed: error, result, wasThrown). Should it only update if something actually changed?
Comment 4 Joseph Pecoraro 2015-05-27 15:33:19 PDT
(In reply to comment #3)
> Comment on attachment 253801 [details]
> [PATCH] Proposed Fix
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=253801&action=review
> 
> r=me
> 
> > Source/WebInspectorUI/UserInterface/Views/BoxModelDetailsSectionRow.js:425
> > +            function didToggle()
> 
> Reading the callback code, this will get called even if there was an error
> in the backend (passed: error, result, wasThrown). Should it only update if
> something actually changed?

I thought about doing a "style.getPropertyValue" and seeing if the value changed, but decided against it.

Unknown side effects / errors could happen if someone overrides `CSSStyleDeclaration.prototype.setProperty` and ultimately still could have changed the property and so a refresh would still be useful. Always doing a refresh is the safe bet as long as we are using overridable APIs.

Technically setProperty can trigger an error naturally if invoked on a readonly style, but I don't think that should ever be the case for us.
Comment 5 WebKit Commit Bot 2015-05-27 16:22:16 PDT
Comment on attachment 253801 [details]
[PATCH] Proposed Fix

Clearing flags on attachment: 253801

Committed r184925: <http://trac.webkit.org/changeset/184925>
Comment 6 WebKit Commit Bot 2015-05-27 16:22:20 PDT
All reviewed patches have been landed.  Closing bug.