• graouts@apple.com's avatar
    Web Inspector: provide an abstraction for CodeMirror's TextMarker · e69d304a
    graouts@apple.com authored
    Reviewed by Timothy Hatcher.
    Introduce a new WebInspector.TextMarker class which is used by code with CodeMirror knowledge
    to return information related to text markers to objects that should have no direct knowledge
    of CodeMirror. Start using this class in TextEditor and SourceCodeTextEditor to remove the
    last remaining pieces of CodeMirror knowledge added to SourceCodeTextEditor to fix
    * UserInterface/CodeMirrorAdditions.js:
    Stop using __markedColor to identify a color marker and instead use the type on the matching
    WebInspector.TextMarker. Additionally, create a WebInspector.TextMarker with type
    WebInspector.TextMarker.Type.Color in createColorMarkers().
    * UserInterface/CodeMirrorColorEditingController.js:
    Use a WebInspector.TextRange to track the edited range and obtain it directly from the
    WebInspector.TextMaker used to instantiate the object. We also use the new "text" public
    property to create the color.
    (WebInspector.CodeMirrorColorEditingController.prototype.set color):
    Simply assing the serialized color to the new "text" public property.
    (WebInspector.CodeMirrorColorEditingController.prototype.get text):
    (WebInspector.CodeMirrorColorEditingController.prototype.set text):
    New public property to set get and set the text for the edited range, automatically updating
    the range upon setting to a new text.
    Obtain the bounds directly from the WebInspector.TextMarker object.
    * UserInterface/CodeMirrorTokenTrackingController.js:
    Since we're now tracking the hoveredMarker as a WebInspector.TextMarker, get the CodeMirror
    TextMarker from that object to check if it's contained within the text markers at the
    hovered position.
    * UserInterface/Main.html:
    Add the new TextMarker class source.
    * UserInterface/SourceCodeTextEditor.js:
    Use the WebInspector.TextMarker type to identify a given text marker is marking a color.
    Use the renamed markersAtPosition() method from TextEditor.
    Use the WebInspector.TextMarker type to identify a given text marker is marking a color.
    Since the CodeMirrorColorEditingController is now using a WebInspector.TextRange for its range,
    update to use a WebInspector.TextRange API to get the range's start line.
    * UserInterface/TextEditor.js:
    (WebInspector.TextEditor.prototype.get markers):
    Return WebInspector.TextMarker objects instead of CodeMirror TextRange objects.
    Rename method to a better name instead of using the CodeMirror-influenced name. Also, return
    WebInspector.TextMarker objects instead of CodeMirror TextRange objects.
    * UserInterface/TextMarker.js: Added.
    Create a WebInspector.TextMarker with a CodeMirror TextMarker and an optional type.
    Static method to either obtain the existing WebInspector.TextMarker for a given CodeMirror
    TextMarker, or create a new WebInspector.TextMarker.
    (WebInspector.TextMarker.prototype.get codeMirrorTextMarker):
    Public property to access the CodeMirror TextMarker objects for classes that have direct
    knowledge of CodeMirror.
    (WebInspector.TextMarker.prototype.get type):
    Public property to access the type used to create this text marker.
    (WebInspector.TextMarker.prototype.get range):
    (WebInspector.TextMarker.prototype.get bounds):
    Public properties allowing easy access to generally useful information related to marked text.
    Wrapper for the CodeMirror TextMarker clear() method.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160552 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Main.html 21.7 KB