Bug 146715

Summary: Web Inspector: Pressing delete in the styles sidebar with no text causes text to become misaligned
Product: WebKit Reporter: Devin Rousso <hi>
Component: Web InspectorAssignee: Nobody <webkit-unassigned>
Status: RESOLVED FIXED    
Severity: Normal CC: 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
Current Functionality
none
Patch none

Description Devin Rousso 2015-07-07 23:59:25 PDT
Created attachment 256362 [details]
Current Functionality

Instead of removing the first indent, pressing delete in an empty rule should not do anything.
Comment 1 Radar WebKit Bug Importer 2015-07-07 23:59:47 PDT
<rdar://problem/21720090>
Comment 2 Devin Rousso 2015-07-08 00:01:39 PDT
Created attachment 256363 [details]
Patch
Comment 3 Timothy Hatcher 2015-07-08 08:24:23 PDT
Comment on attachment 256363 [details]
Patch

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

> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:482
> +        if (change.origin !== "+delete" || (!change.to.line && !change.to.ch) || this._completionController.isShowingCompletions())

Does this happen if there is text or only empty? !change.to.line && !change.to.ch will still be true if there is text.
Comment 4 Devin Rousso 2015-07-08 10:32:41 PDT
Comment on attachment 256363 [details]
Patch

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

>> Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js:482
>> +        if (change.origin !== "+delete" || (!change.to.line && !change.to.ch) || this._completionController.isShowingCompletions())
> 
> Does this happen if there is text or only empty? !change.to.line && !change.to.ch will still be true if there is text.

This is only supposed to happen if the cursor is on the first character of the first line, regardless of whether that line has text.  Since pressing delete removes all markers at the cursor's position, if the cursor is at the beginning of a line it will remove the checkbox marker as well as the newline at the beginning of that line.  On the first line, there is no previous line, so pressing delete would just remove the checkbox marker.  We don't want this to happen.
Comment 5 WebKit Commit Bot 2015-07-08 11:37:23 PDT
Comment on attachment 256363 [details]
Patch

Clearing flags on attachment: 256363

Committed r186517: <http://trac.webkit.org/changeset/186517>
Comment 6 WebKit Commit Bot 2015-07-08 11:37:27 PDT
All reviewed patches have been landed.  Closing bug.