Bug 125695

Summary: Web Inspector: provide an abstraction for CodeMirror's TextMarker
Product: WebKit Reporter: Antoine Quint <graouts>
Component: Web InspectorAssignee: Antoine Quint <graouts>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, graouts, graouts, joepeck, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch for landing none

Antoine Quint
Reported 2013-12-13 10:10:09 PST
When we introduced support for editing colors in SourceCodeTextEditor, we started using CodeMirror's TextMarker type directly. This class should have no knowledge of CodeMirror though, so we should provide an abstraction for this type.
Attachments
Patch (16.73 KB, patch)
2013-12-13 10:28 PST, Antoine Quint
no flags
Patch for landing (16.90 KB, patch)
2013-12-13 10:54 PST, Antoine Quint
no flags
Antoine Quint
Comment 1 2013-12-13 10:28:59 PST
Timothy Hatcher
Comment 2 2013-12-13 10:38:03 PST
Comment on attachment 219172 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=219172&action=review > Source/WebInspectorUI/UserInterface/CodeMirrorColorEditingController.js:90 > + this._range = new WebInspector.TextRange(this._range.startLine, this._range.startColumn, this._range.endLine, this._range.startColumn + text.length); Shouldn't this take into account any "\n" in text when making the endLine and endColumn? Or just assert no "\n" is allowed in the text and use startLine for endLine.
Antoine Quint
Comment 3 2013-12-13 10:54:15 PST
Created attachment 219174 [details] Patch for landing
Antoine Quint
Comment 4 2013-12-13 10:55:42 PST
(In reply to comment #2) > (From update of attachment 219172 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=219172&action=review > > > Source/WebInspectorUI/UserInterface/CodeMirrorColorEditingController.js:90 > > + this._range = new WebInspector.TextRange(this._range.startLine, this._range.startColumn, this._range.endLine, this._range.startColumn + text.length); > > Shouldn't this take into account any "\n" in text when making the endLine and endColumn? Or just assert no "\n" is allowed in the text and use startLine for endLine. For the record, this was fixed in the commit after discussion on IRC.
WebKit Commit Bot
Comment 5 2013-12-13 11:29:42 PST
Comment on attachment 219174 [details] Patch for landing Clearing flags on attachment: 219174 Committed r160552: <http://trac.webkit.org/changeset/160552>
WebKit Commit Bot
Comment 6 2013-12-13 11:29:44 PST
All reviewed patches have been landed. Closing bug.
Joseph Pecoraro
Comment 7 2013-12-13 13:02:53 PST
Could this have caused: file:///Volumes/Data/Build/Debug/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:1446:39: JS ERROR: TypeError: undefined is not a function (evaluating 'marker.find()') file:///Volumes/Data/Build/Debug/WebInspectorUI.framework/Resources/Color.js:97:133: JS ERROR: TypeError: undefined is not a function (evaluating 'WebInspector.Color.Nicknames[nickname].concat(1)') No marker.find?
Joseph Pecoraro
Comment 8 2013-12-13 20:20:40 PST
(In reply to comment #7) > Could this have caused: > > file:///Volumes/Data/Build/Debug/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:1446:39: JS ERROR: TypeError: undefined is not a function (evaluating 'marker.find()') > file:///Volumes/Data/Build/Debug/WebInspectorUI.framework/Resources/Color.js:97:133: JS ERROR: TypeError: undefined is not a function (evaluating 'WebInspector.Color.Nicknames[nickname].concat(1)') > > No marker.find? Follow-up fix on: <https://webkit.org/b/125724> Web Inspector: Exception: TypeError: undefined is not a function (evaluating 'marker.find()')
Antoine Quint
Comment 9 2013-12-14 04:06:18 PST
(In reply to comment #8) > (In reply to comment #7) > > Could this have caused: > > > > file:///Volumes/Data/Build/Debug/WebInspectorUI.framework/Resources/External/CodeMirror/codemirror.js:1446:39: JS ERROR: TypeError: undefined is not a function (evaluating 'marker.find()') > > file:///Volumes/Data/Build/Debug/WebInspectorUI.framework/Resources/Color.js:97:133: JS ERROR: TypeError: undefined is not a function (evaluating 'WebInspector.Color.Nicknames[nickname].concat(1)') > > > > No marker.find? > > Follow-up fix on: > <https://webkit.org/b/125724> Web Inspector: Exception: TypeError: undefined is not a function (evaluating 'marker.find()') There shouldn't be a marker.find(), there's a "range" property on WebInspector.TextMarker.
Antoine Quint
Comment 10 2014-02-18 03:26:25 PST
This patch introduced another regression: https://bugs.webkit.org/show_bug.cgi?id=128965, Web Inspector: editing a color in the Styles sidebar using the color picker only works once for a given color.
Radar WebKit Bug Importer
Comment 11 2014-02-18 03:26:44 PST
Note You need to log in before you can comment on or make changes to this bug.