Changeset 142488 in webkit


Ignore:
Timestamp:
Feb 11, 2013 10:15:24 AM (11 years ago)
Author:
caseq@chromium.org
Message:

Web Inspector: Timeline: invalidate and force locations are same for Layout records caused by style recalculaiton
https://bugs.webkit.org/show_bug.cgi?id=109294

Reviewed by Pavel Feldman.

Source/WebCore:

Use the stack that caused style recalculation as a cause for relayout performed due to
layout invalidation caused by style recalculation.

  • inspector/front-end/TimelinePresentationModel.js:

(WebInspector.TimelinePresentationModel.prototype.reset):
(WebInspector.TimelinePresentationModel.Record):

LayoutTests:

  • inspector/timeline/timeline-layout-reason-expected.txt: Added.
  • inspector/timeline/timeline-layout-reason.html: Added.
  • inspector/timeline/timeline-test.js:

(initialize_Timeline.step2):
(initialize_Timeline.InspectorTest.evaluateWithTimeline): Extracted "performActions" step from performActionsAndPrint()
(initialize_Timeline.):
(initialize_Timeline.InspectorTest.performActionsAndPrint):
(initialize_Timeline.InspectorTest.findPresentationRecord.findByType):
(initialize_Timeline.InspectorTest.findPresentationRecord):

Location:
trunk
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r142486 r142488  
     12013-02-11  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Web Inspector: Timeline: invalidate and force locations are same for Layout records caused by style recalculaiton
     4        https://bugs.webkit.org/show_bug.cgi?id=109294
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/timeline/timeline-layout-reason-expected.txt: Added.
     9        * inspector/timeline/timeline-layout-reason.html: Added.
     10        * inspector/timeline/timeline-test.js:
     11        (initialize_Timeline.step2):
     12        (initialize_Timeline.InspectorTest.evaluateWithTimeline): Extracted "performActions" step from performActionsAndPrint()
     13        (initialize_Timeline.):
     14        (initialize_Timeline.InspectorTest.performActionsAndPrint):
     15        (initialize_Timeline.InspectorTest.findPresentationRecord.findByType):
     16        (initialize_Timeline.InspectorTest.findPresentationRecord):
     17
    1182013-02-01  Andrey Kosyakov  <caseq@chromium.org>
    219
  • trunk/LayoutTests/inspector/timeline/timeline-test.js

    r129336 r142488  
    7070};
    7171
    72 InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeStamps)
     72InspectorTest.evaluateWithTimeline = function(actions, doneCallback)
    7373{
    7474    InspectorTest.startTimeline(step1);
     
    8080    function step2()
    8181    {
    82         InspectorTest.stopTimeline(step3);
    83     }
    84 
    85     function step3()
     82        InspectorTest.stopTimeline(doneCallback);
     83    }
     84
     85}
     86
     87InspectorTest.performActionsAndPrint = function(actions, typeName, includeTimeStamps)
     88{
     89    function callback()
    8690    {
    8791        InspectorTest.printTimelineRecords(typeName);
     
    9296        InspectorTest.completeTest();
    9397    }
     98    InspectorTest.evaluateWithTimeline(actions, callback)
    9499};
    95100
     
    157162};
    158163
     164InspectorTest.findPresentationRecord = function(type)
     165{
     166    var result;
     167    function findByType(record)
     168    {
     169        if (record.type !== type)
     170            return false;
     171        result = record;
     172        return true;
     173    }
     174    var records = WebInspector.panel("timeline")._rootRecord().children;
     175    WebInspector.TimelinePresentationModel.forAllRecords(records, findByType);
     176    return result;
     177}
     178
    159179InspectorTest.FakeFileReader = function(input, delegate, callback)
    160180{
  • trunk/Source/WebCore/ChangeLog

    r142486 r142488  
     12013-02-11  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Web Inspector: Timeline: invalidate and force locations are same for Layout records caused by style recalculaiton
     4        https://bugs.webkit.org/show_bug.cgi?id=109294
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Use the stack that caused style recalculation as a cause for relayout performed due to
     9        layout invalidation caused by style recalculation.
     10
     11        * inspector/front-end/TimelinePresentationModel.js:
     12        (WebInspector.TimelinePresentationModel.prototype.reset):
     13        (WebInspector.TimelinePresentationModel.Record):
     14
    1152013-02-01  Andrey Kosyakov  <caseq@chromium.org>
    216
  • trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js

    r140123 r142488  
    266266        this._frames = [];
    267267        this._minimumRecordTime = -1;
    268         this._lastInvalidateLayout = {};
     268        this._layoutInvalidateStack = {};
    269269        this._lastScheduleStyleRecalculation = {};
    270270    },
     
    637637
    638638    case recordTypes.InvalidateLayout:
    639         presentationModel._lastInvalidateLayout[this.frameId] = this;
     639        // Consider style recalculation as a reason for layout invalidation,
     640        // but only if we had no earlier layout invalidation records.
     641        var styleRecalcStack;
     642        if (!presentationModel._layoutInvalidateStack[this.frameId]) {
     643            for (var outerRecord = parentRecord; outerRecord; outerRecord = record.parent) {
     644                if (outerRecord.type === recordTypes.RecalculateStyles) {
     645                    styleRecalcStack = outerRecord.callSiteStackTrace;
     646                    break;
     647                }
     648            }
     649        }
     650        presentationModel._layoutInvalidateStack[this.frameId] = styleRecalcStack || this.stackTrace;
    640651        break;
    641652
    642653    case recordTypes.Layout:
    643         var invalidateLayoutRecord = presentationModel._lastInvalidateLayout[this.frameId];
    644         if (invalidateLayoutRecord)
    645             this.callSiteStackTrace = invalidateLayoutRecord.stackTrace || invalidateLayoutRecord.callSiteStackTrace;
     654        var layoutInvalidateStack = presentationModel._layoutInvalidateStack[this.frameId];
     655        if (layoutInvalidateStack)
     656            this.callSiteStackTrace = layoutInvalidateStack;
    646657        if (this.stackTrace)
    647658            this.setHasWarning();
    648         presentationModel._lastInvalidateLayout[this.frameId] = null;
     659        presentationModel._layoutInvalidateStack[this.frameId] = null;
    649660        break;
    650661    }
Note: See TracChangeset for help on using the changeset viewer.