Changeset 92212 in webkit


Ignore:
Timestamp:
Aug 2, 2011 11:32:46 AM (13 years ago)
Author:
vsevik@chromium.org
Message:

Web Inspector: SourceFrame should store saved scroll positions in View.
https://bugs.webkit.org/show_bug.cgi?id=65472

Reviewed by Pavel Feldman.

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.FrameResourceTreeElement.prototype._recreateSourceView):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.prototype._sourceFileChanged):

  • inspector/front-end/SourceFrame.js:

(WebInspector.SourceFrame.prototype.show):
(WebInspector.SourceFrame.prototype.hide):
(WebInspector.SourceFrame.prototype.get scrollLeft):
(WebInspector.SourceFrame.prototype.set scrollLeft):
(WebInspector.SourceFrame.prototype.get scrollTop):
(WebInspector.SourceFrame.prototype.set scrollTop):

  • inspector/front-end/View.js:

(WebInspector.View.prototype._innerShow):
(WebInspector.View.prototype._innerHide):
(WebInspector.View.prototype.detach):
(WebInspector.View.prototype.storeScrollPositions):
(WebInspector.View.prototype.inheritScrollPositionsFromView):
(WebInspector.View.prototype.restoreScrollPositions):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r92210 r92212  
     12011-08-02  Vsevolod Vlasov  <vsevik@chromium.org>
     2
     3        Web Inspector: SourceFrame should store saved scroll positions in View.
     4        https://bugs.webkit.org/show_bug.cgi?id=65472
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/ResourcesPanel.js:
     9        (WebInspector.FrameResourceTreeElement.prototype._recreateSourceView):
     10        * inspector/front-end/ScriptsPanel.js:
     11        (WebInspector.ScriptsPanel.prototype._sourceFileChanged):
     12        * inspector/front-end/SourceFrame.js:
     13        (WebInspector.SourceFrame.prototype.show):
     14        (WebInspector.SourceFrame.prototype.hide):
     15        (WebInspector.SourceFrame.prototype.get scrollLeft):
     16        (WebInspector.SourceFrame.prototype.set scrollLeft):
     17        (WebInspector.SourceFrame.prototype.get scrollTop):
     18        (WebInspector.SourceFrame.prototype.set scrollTop):
     19        * inspector/front-end/View.js:
     20        (WebInspector.View.prototype._innerShow):
     21        (WebInspector.View.prototype._innerHide):
     22        (WebInspector.View.prototype.detach):
     23        (WebInspector.View.prototype.storeScrollPositions):
     24        (WebInspector.View.prototype.inheritScrollPositionsFromView):
     25        (WebInspector.View.prototype.restoreScrollPositions):
     26
    1272011-08-02  Jeff Miller  <jeffm@apple.com>
    228
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r90555 r92212  
    14001400
    14011401        var oldViewParentNode = oldView.visible ? oldView.element.parentNode : null;
    1402         var scrollTop = oldView.scrollTop;
     1402        newView.inheritScrollPositionsFromView(oldView);
    14031403
    14041404        this._sourceView.detach();
     
    14071407        if (oldViewParentNode)
    14081408            newView.show(oldViewParentNode);
    1409         if (scrollTop)
    1410             newView.scrollTop = scrollTop;
    14111409
    14121410        return newView;
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r92185 r92212  
    653653
    654654        var newSourceFrame = this._createSourceFrame(sourceFileId)
    655         newSourceFrame.scrollTop = oldSourceFrame.scrollTop;
     655        newSourceFrame.inheritScrollPositionsFromView(oldSourceFrame);
    656656        this.visibleView = newSourceFrame;
    657657    },
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r91749 r92212  
    8484
    8585        this._ensureContentLoaded();
    86 
    87         if (this.loaded) {
    88             if (this._scrollTop)
    89                 this._textViewer.scrollTop = this._scrollTop;
    90             if (this._scrollLeft)
    91                 this._textViewer.scrollLeft = this._scrollLeft;
    92         }
     86       
     87        this.restoreScrollPositions();
     88
    9389        // Resize after setting the initial scroll positions to avoid unnecessary rendering work.
    9490        this._textViewer.resize();
     
    9995        WebInspector.View.prototype.hide.call(this);
    10096
    101         if (this.loaded) {
    102             this._scrollTop = this._textViewer.scrollTop;
    103             this._scrollLeft = this._textViewer.scrollLeft;
     97        if (this.loaded)
    10498            this._textViewer.freeCachedElements();
    105         }
    10699
    107100        this._textViewer.hide();
     
    169162    },
    170163
     164    get scrollLeft()
     165    {
     166        return this.loaded ? this._textViewer.scrollLeft : 0;
     167    },
     168
     169    set scrollLeft(scrollLeft)
     170    {
     171        if (this.loaded)
     172            this._textViewer.scrollLeft = scrollLeft;
     173    },
     174
    171175    get scrollTop()
    172176    {
    173         return this.loaded ? this._textViewer.scrollTop : this._scrollTop;
     177        return this.loaded ? this._textViewer.scrollTop : 0;
    174178    },
    175179
    176180    set scrollTop(scrollTop)
    177181    {
    178         this._scrollTop = scrollTop;
    179182        if (this.loaded)
    180183            this._textViewer.scrollTop = scrollTop;
  • trunk/Source/WebCore/inspector/front-end/View.js

    r91359 r92212  
    5151    {
    5252        this.element.addStyleClass("visible");
     53        this.restoreScrollPositions();
    5354    },
    5455
     
    6768    _innerHide: function()
    6869    {
     70        this.storeScrollPositions();
    6971        this.element.removeStyleClass("visible");
    7072    },
     
    8082        if (this.element.parentNode)
    8183            this.element.parentNode.removeChild(this.element);
     84    },
     85
     86    storeScrollPositions: function()
     87    {
     88        this._scrollLeft = this.scrollLeft;
     89        this._scrollTop = this.scrollTop;
     90    },
     91   
     92    inheritScrollPositionsFromView: function(view)
     93    {
     94        this._scrollLeft = view._scrollLeft;
     95        this._scrollTop = view._scrollTop;
     96    },
     97
     98    restoreScrollPositions: function()
     99    {
     100        this.scrollLeft = this._scrollLeft;
     101        this.scrollTop = this._scrollTop;
    82102    }
    83103}
Note: See TracChangeset for help on using the changeset viewer.