Title: [126754] trunk
Revision
126754
Author
[email protected]
Date
2012-08-27 06:52:59 -0700 (Mon, 27 Aug 2012)

Log Message

Web Inspector: display cause for style recalculation and layout on Timeline
https://bugs.webkit.org/show_bug.cgi?id=95000

Reviewed by Pavel Feldman.

Source/WebCore:

Added instrumentation for didInvalidateLayout and didScheduleStyleRecalculation;
Dispaly stacks of the above records in Layout and Recalculate Style as "call site" stacks (need a better wording?);
Display synchronous Layout records in red, provide a warning that these may affect performance;

* English.lproj/localizedStrings.js: +"Note" and a warning test for sync layout;
* inspector/InspectorInstrumentation.cpp: Plumbing new instrumentation methods through to timeline;
(WebCore):
(WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
(WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
* inspector/InspectorInstrumentation.h: ditto.
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::didInvalidateLayout):
(WebCore):
* inspector/InspectorTimelineAgent.cpp: ditto.
(TimelineRecordType):
(WebCore::InspectorTimelineAgent::didInvalidateLayout):
(WebCore):
(WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
* inspector/InspectorTimelineAgent.h: ditto.
(InspectorTimelineAgent):
* inspector/front-end/TimelineModel.js:
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelineRecordListRow.prototype.update): Display records with warnings in their own style;
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel._initRecordStyles): Renamed, added new records;
(WebInspector.TimelinePresentationModel.recordStyle): Added new records;
(WebInspector.TimelinePresentationModel.prototype.reset):
(WebInspector.TimelinePresentationModel.prototype._innerAddRecord): Add support for new records, make 'em hidden;
(WebInspector.TimelinePresentationModel.Record): Add support for hidden records;
(WebInspector.TimelinePresentationModel.Record.prototype._generatePopupContentWithImagePreview):
(WebInspector.TimelinePresentationModel.Record.prototype._linkifyTopCallFrame): Linkify originator's top frame if no own stack is present;
* inspector/front-end/timelinePanel.css:
(.timeline-tree-item.warning): Reddish text for records with warnings;
* page/FrameView.cpp:
(WebCore::FrameView::scheduleRelayout): Added call to InspectorInstrumentation::didInvalidateLayout()
(WebCore::FrameView::scheduleRelayoutOfSubtree): Ditto.

LayoutTests:

- added new events (ScheduleStyleRecalculation and InvlidateLayout)
- rebaselined a test due to a new event;

* inspector/timeline/timeline-enum-stability-expected.txt:
* inspector/timeline/timeline-script-tag-1-expected.txt:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (126753 => 126754)


--- trunk/LayoutTests/ChangeLog	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/LayoutTests/ChangeLog	2012-08-27 13:52:59 UTC (rev 126754)
@@ -1,3 +1,16 @@
+2012-08-25  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: display cause for style recalculation and layout on Timeline
+        https://bugs.webkit.org/show_bug.cgi?id=95000
+
+        Reviewed by Pavel Feldman.
+
+        - added new events (ScheduleStyleRecalculation and InvlidateLayout)
+        - rebaselined a test due to a new event;
+
+        * inspector/timeline/timeline-enum-stability-expected.txt:
+        * inspector/timeline/timeline-script-tag-1-expected.txt:
+
 2012-08-27  Zoltan Arvai  <[email protected]>
 
         [Qt] Unreviwed gardening. Skip test that fails on 32bit release.

Modified: trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt (126753 => 126754)


--- trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/LayoutTests/inspector/timeline/timeline-enum-stability-expected.txt	2012-08-27 13:52:59 UTC (rev 126754)
@@ -7,8 +7,10 @@
     Program : "Program"
     EventDispatch : "EventDispatch"
     BeginFrame : "BeginFrame"
+    ScheduleStyleRecalculation : "ScheduleStyleRecalculation"
+    RecalculateStyles : "RecalculateStyles"
+    InvalidateLayout : "InvalidateLayout"
     Layout : "Layout"
-    RecalculateStyles : "RecalculateStyles"
     Paint : "Paint"
     DecodeImage : "DecodeImage"
     ResizeImage : "ResizeImage"

Modified: trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt (126753 => 126754)


--- trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/LayoutTests/inspector/timeline/timeline-script-tag-1-expected.txt	2012-08-27 13:52:59 UTC (rev 126754)
@@ -3,9 +3,11 @@
 
 
 ParseHTML
+----> InvalidateLayout
 ParseHTML
 ----> EvaluateScript
 --------> TimeStamp : SCRIPT TAG
+----> InvalidateLayout
 EvaluateScript Properties:
 {
     startTime : <number>

Modified: trunk/Source/WebCore/ChangeLog (126753 => 126754)


--- trunk/Source/WebCore/ChangeLog	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/ChangeLog	2012-08-27 13:52:59 UTC (rev 126754)
@@ -1,3 +1,47 @@
+2012-08-25  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: display cause for style recalculation and layout on Timeline
+        https://bugs.webkit.org/show_bug.cgi?id=95000
+
+        Reviewed by Pavel Feldman.
+
+        Added instrumentation for didInvalidateLayout and didScheduleStyleRecalculation;
+        Dispaly stacks of the above records in Layout and Recalculate Style as "call site" stacks (need a better wording?);
+        Display synchronous Layout records in red, provide a warning that these may affect performance;
+
+        * English.lproj/localizedStrings.js: +"Note" and a warning test for sync layout;
+        * inspector/InspectorInstrumentation.cpp: Plumbing new instrumentation methods through to timeline;
+        (WebCore):
+        (WebCore::InspectorInstrumentation::didInvalidateLayoutImpl):
+        (WebCore::InspectorInstrumentation::didScheduleStyleRecalculationImpl):
+        * inspector/InspectorInstrumentation.h: ditto.
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::didInvalidateLayout):
+        (WebCore):
+        * inspector/InspectorTimelineAgent.cpp: ditto.
+        (TimelineRecordType):
+        (WebCore::InspectorTimelineAgent::didInvalidateLayout):
+        (WebCore):
+        (WebCore::InspectorTimelineAgent::didScheduleStyleRecalculation):
+        * inspector/InspectorTimelineAgent.h: ditto.
+        (InspectorTimelineAgent):
+        * inspector/front-end/TimelineModel.js:
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelineRecordListRow.prototype.update): Display records with warnings in their own style;
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel._initRecordStyles): Renamed, added new records;
+        (WebInspector.TimelinePresentationModel.recordStyle): Added new records;
+        (WebInspector.TimelinePresentationModel.prototype.reset):
+        (WebInspector.TimelinePresentationModel.prototype._innerAddRecord): Add support for new records, make 'em hidden;
+        (WebInspector.TimelinePresentationModel.Record): Add support for hidden records;
+        (WebInspector.TimelinePresentationModel.Record.prototype._generatePopupContentWithImagePreview):
+        (WebInspector.TimelinePresentationModel.Record.prototype._linkifyTopCallFrame): Linkify originator's top frame if no own stack is present;
+        * inspector/front-end/timelinePanel.css:
+        (.timeline-tree-item.warning): Reddish text for records with warnings;
+        * page/FrameView.cpp:
+        (WebCore::FrameView::scheduleRelayout): Added call to InspectorInstrumentation::didInvalidateLayout()
+        (WebCore::FrameView::scheduleRelayoutOfSubtree): Ditto.
+
 2012-08-27  KyungTae Kim  <[email protected]>
 
         [EFL] Wrong button height on CSS tests

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (126753 => 126754)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-08-27 13:52:59 UTC (rev 126754)
@@ -732,3 +732,9 @@
 localizedStrings["Override Geolocation"] = "Override Geolocation";
 localizedStrings["Geolocation Position"] = "Geolocation Position";
 localizedStrings["Override Device Orientation"] = "Override Device Orientation";
+localizedStrings["Note"] = "Note";
+localizedStrings["Forced synchronous layout is a possible performance bottlenck."] = "Forced synchronous layout is a possible performance bottlenck.";
+localizedStrings["Styles invalidated"] = "Styles invalidated";
+localizedStrings["Styles recalculation forced"] = "Styles recalculation forced";
+localizedStrings["Layout invalidated"] = "Layout invalidated";
+localizedStrings["Layout forced"] = "Layout forced";

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (126753 => 126754)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-08-27 13:52:59 UTC (rev 126754)
@@ -429,6 +429,12 @@
         timelineAgent->didCancelFrame();
 }
 
+void InspectorInstrumentation::didInvalidateLayoutImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+{
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didInvalidateLayout(frame);
+}
+
 InspectorInstrumentationCookie InspectorInstrumentation::willLayoutImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
 {
     int timelineAgentId = 0;
@@ -526,6 +532,8 @@
 
 void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents* instrumentingAgents, Document* document)
 {
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
+        timelineAgent->didScheduleStyleRecalculation(document->frame());
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->didScheduleStyleRecalculation(document);
 }

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (126753 => 126754)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2012-08-27 13:52:59 UTC (rev 126754)
@@ -142,6 +142,7 @@
     static void didFireTimer(const InspectorInstrumentationCookie&);
     static void didBeginFrame(Page*);
     static void didCancelFrame(Page*);
+    static void didInvalidateLayout(Frame*);
     static InspectorInstrumentationCookie willLayout(Frame*);
     static void didLayout(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willLoadXHR(ScriptExecutionContext*, XMLHttpRequest*);
@@ -317,6 +318,7 @@
     static void didFireTimerImpl(const InspectorInstrumentationCookie&);
     static void didBeginFrameImpl(InstrumentingAgents*);
     static void didCancelFrameImpl(InstrumentingAgents*);
+    static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*);
     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*);
     static void didLayoutImpl(const InspectorInstrumentationCookie&);
     static InspectorInstrumentationCookie willLoadXHRImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
@@ -810,6 +812,15 @@
 #endif
 }
 
+inline void InspectorInstrumentation::didInvalidateLayout(Frame* frame)
+{
+#if ENABLE(INSPECTOR)
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        didInvalidateLayoutImpl(instrumentingAgents, frame);
+#endif
+}
+
 inline InspectorInstrumentationCookie InspectorInstrumentation::willLayout(Frame* frame)
 {
 #if ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (126753 => 126754)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-08-27 13:52:59 UTC (rev 126754)
@@ -36,6 +36,7 @@
 
 #include "Event.h"
 #include "Frame.h"
+#include "FrameView.h"
 #include "IdentifiersFactory.h"
 #include "InspectorClient.h"
 #include "InspectorCounters.h"
@@ -65,8 +66,10 @@
 
 static const char EventDispatch[] = "EventDispatch";
 static const char BeginFrame[] = "BeginFrame";
+static const char ScheduleStyleRecalculation[] = "ScheduleStyleRecalculation";
+static const char RecalculateStyles[] = "RecalculateStyles";
+static const char InvalidateLayout[] = "InvalidateLayout";
 static const char Layout[] = "Layout";
-static const char RecalculateStyles[] = "RecalculateStyles";
 static const char Paint[] = "Paint";
 static const char DecodeImage[] = "DecodeImage";
 static const char ResizeImage[] = "ResizeImage";
@@ -227,6 +230,13 @@
     didCompleteCurrentRecord(TimelineRecordType::EventDispatch);
 }
 
+void InspectorTimelineAgent::didInvalidateLayout(Frame* frame)
+{
+    if (frame->view()->layoutPending())
+        return;
+    appendRecord(InspectorObject::create(), TimelineRecordType::InvalidateLayout, true, frame);
+}
+
 void InspectorTimelineAgent::willLayout(Frame* frame)
 {
     pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Layout, true, frame);
@@ -237,6 +247,11 @@
     didCompleteCurrentRecord(TimelineRecordType::Layout);
 }
 
+void InspectorTimelineAgent::didScheduleStyleRecalculation(Frame* frame)
+{
+    appendRecord(InspectorObject::create(), TimelineRecordType::ScheduleStyleRecalculation, true, frame);
+}
+
 void InspectorTimelineAgent::willRecalculateStyle(Frame* frame)
 {
     pushCurrentRecord(InspectorObject::create(), TimelineRecordType::RecalculateStyles, true, frame);

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (126753 => 126754)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-08-27 13:52:59 UTC (rev 126754)
@@ -96,9 +96,11 @@
     void didBeginFrame();
     void didCancelFrame();
 
+    void didInvalidateLayout(Frame*);
     void willLayout(Frame*);
     void didLayout();
 
+    void didScheduleStyleRecalculation(Frame*);
     void willRecalculateStyle(Frame*);
     void didRecalculateStyle();
 

Modified: trunk/Source/WebCore/inspector/front-end/TimelineModel.js (126753 => 126754)


--- trunk/Source/WebCore/inspector/front-end/TimelineModel.js	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/front-end/TimelineModel.js	2012-08-27 13:52:59 UTC (rev 126754)
@@ -49,8 +49,10 @@
     EventDispatch: "EventDispatch",
 
     BeginFrame: "BeginFrame",
+    ScheduleStyleRecalculation: "ScheduleStyleRecalculation",
+    RecalculateStyles: "RecalculateStyles",
+    InvalidateLayout: "InvalidateLayout",
     Layout: "Layout",
-    RecalculateStyles: "RecalculateStyles",
     Paint: "Paint",
     DecodeImage: "DecodeImage",
     ResizeImage: "ResizeImage",

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePanel.js (126753 => 126754)


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-08-27 13:52:59 UTC (rev 126754)
@@ -1112,7 +1112,12 @@
         this._record = record;
         this._offset = offset;
 
-        this.element.className = "timeline-tree-item timeline-category-" + record.category.name + (isEven ? " even" : "");
+        this.element.className = "timeline-tree-item timeline-category-" + record.category.name;
+        if (isEven)
+            this.element.addStyleClass("even");
+        if (record.hasWarning)
+            this.element.addStyleClass("warning");
+
         this._typeElement.textContent = record.title;
 
         if (this._dataElement.firstChild)

Modified: trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js (126753 => 126754)


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-08-27 13:52:59 UTC (rev 126754)
@@ -59,7 +59,7 @@
 /**
  * @return {!Object.<string, {title: string, category}>}
  */
-WebInspector.TimelinePresentationModel.initRecordStyles_ = function()
+WebInspector.TimelinePresentationModel._initRecordStyles = function()
 {
     if (WebInspector.TimelinePresentationModel._recordStylesMap)
         return WebInspector.TimelinePresentationModel._recordStylesMap;
@@ -72,8 +72,10 @@
     recordStyles[recordTypes.Program] = { title: WebInspector.UIString("Program"), category: categories["program"] };
     recordStyles[recordTypes.EventDispatch] = { title: WebInspector.UIString("Event"), category: categories["scripting"] };
     recordStyles[recordTypes.BeginFrame] = { title: WebInspector.UIString("Frame Start"), category: categories["rendering"] };
+    recordStyles[recordTypes.ScheduleStyleRecalculation] = { title: WebInspector.UIString("Schedule Style Recalculation"), category: categories["rendering"] };
+    recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] };
+    recordStyles[recordTypes.InvalidateLayout] = { title: WebInspector.UIString("Invalidate Layout"), category: categories["rendering"] };
     recordStyles[recordTypes.Layout] = { title: WebInspector.UIString("Layout"), category: categories["rendering"] };
-    recordStyles[recordTypes.RecalculateStyles] = { title: WebInspector.UIString("Recalculate Style"), category: categories["rendering"] };
     recordStyles[recordTypes.Paint] = { title: WebInspector.UIString("Paint"), category: categories["painting"] };
     recordStyles[recordTypes.DecodeImage] = { title: WebInspector.UIString("Image Decode"), category: categories["painting"] };
     recordStyles[recordTypes.ResizeImage] = { title: WebInspector.UIString("Image Resize"), category: categories["painting"] };
@@ -110,7 +112,7 @@
  */
 WebInspector.TimelinePresentationModel.recordStyle = function(record)
 {
-    var recordStyles = WebInspector.TimelinePresentationModel.initRecordStyles_();
+    var recordStyles = WebInspector.TimelinePresentationModel._initRecordStyles();
     var result = recordStyles[record.type];
     if (!result) {
         result = {
@@ -238,7 +240,7 @@
     reset: function()
     {
         this._linkifier.reset();
-        this._rootRecord = new WebInspector.TimelinePresentationModel.Record(this, { type: WebInspector.TimelineModel.RecordType.Root }, null, null);
+        this._rootRecord = new WebInspector.TimelinePresentationModel.Record(this, { type: WebInspector.TimelineModel.RecordType.Root }, null, null, false);
         this._sendRequestRecords = {};
         this._scheduledResourceRequests = {};
         this._timerRecords = {};
@@ -246,6 +248,8 @@
         this._timeRecords = {};
         this._frames = [];
         this._minimumRecordTime = -1;
+        this._lastInvalidateLayout = {};
+        this._lastScheduleStyleRecalculation = {};
     },
 
     addFrame: function(frame)
@@ -273,19 +277,18 @@
 
     _innerAddRecord: function(record, parentRecord)
     {
+        const recordTypes = WebInspector.TimelineModel.RecordType;
+        const hiddenRecords = [
+            recordTypes.MarkDOMContent,
+            recordTypes.MarkLoad,
+            recordTypes.ScheduleStyleRecalculation,
+            recordTypes.InvalidateLayout
+        ];
+        var isHiddenRecord = hiddenRecords.indexOf(record.type) >= 0;
         var connectedToOldRecord = false;
-        var recordTypes = WebInspector.TimelineModel.RecordType;
-
-        switch (record.type) {
-        // No bar entry for load events.
-        case recordTypes.MarkDOMContent:
-        case recordTypes.MarkLoad:
-            parentRecord = null;
-            break;
-        case recordTypes.Time:
+        if (record.type === recordTypes.Time)
             parentRecord = this._rootRecord;
-            break;
-        default:
+        else if (!isHiddenRecord) {
             var newParentRecord = this._findParentRecord(record);
             if (newParentRecord) {
                 parentRecord = newParentRecord;
@@ -313,9 +316,9 @@
             }
         }
 
-        var formattedRecord = new WebInspector.TimelinePresentationModel.Record(this, record, parentRecord, scriptDetails);
+        var formattedRecord = new WebInspector.TimelinePresentationModel.Record(this, record, parentRecord, scriptDetails, isHiddenRecord);
 
-        if (record.type === recordTypes.MarkDOMContent || record.type === recordTypes.MarkLoad)
+        if (isHiddenRecord)
             return formattedRecord;
 
         formattedRecord.collapsed = (parentRecord === this._rootRecord);
@@ -424,16 +427,22 @@
 
 /**
  * @constructor
+ * @param {WebInspector.TimelinePresentationModel} presentationModel
+ * @param {Object} record
+ * @param {WebInspector.TimelinePresentationModel.Record} parentRecord
+ * @param {Object|undefined} scriptDetails
+ * @param {boolean} hidden
  */
-WebInspector.TimelinePresentationModel.Record = function(presentationModel, record, parentRecord, scriptDetails)
+WebInspector.TimelinePresentationModel.Record = function(presentationModel, record, parentRecord, scriptDetails, hidden)
 {
     this._linkifier = presentationModel._linkifier;
     this._aggregatedStats = [];
     this._record = record;
     this._children = [];
-    this.parent = parentRecord;
-    if (parentRecord)
+    if (!hidden && parentRecord) {
+        this.parent = parentRecord;
         parentRecord.children.push(this);
+    }
 
     this._selfTime = this.endTime - this.startTime;
     this._lastChildEndTime = this.endTime;
@@ -445,6 +454,8 @@
         this.scriptName = scriptDetails.scriptName;
         this.scriptLine = scriptDetails.scriptLine;
     }
+    if (parentRecord && parentRecord.callSiteStackTrace)
+        this.callSiteStackTrace = parentRecord.callSiteStackTrace;
 
     var recordTypes = WebInspector.TimelineModel.RecordType;
     switch (record.type) {
@@ -512,6 +523,30 @@
             timeRecord.intervalDuration = intervalDuration;
         }
         break;
+
+    case recordTypes.ScheduleStyleRecalculation:
+        presentationModel._lastScheduleStyleRecalculation[this.frameId] = this;
+        break;
+
+    case recordTypes.RecalculateStyles:
+        var scheduleStyleRecalculationRecord = presentationModel._lastScheduleStyleRecalculation[this.frameId];
+        if (!scheduleStyleRecalculationRecord)
+            break;
+        this.callSiteStackTrace = scheduleStyleRecalculationRecord.stackTrace;
+        break;
+
+    case recordTypes.InvalidateLayout:
+        presentationModel._lastInvalidateLayout[this.frameId] = this;
+        break;
+
+    case recordTypes.Layout:
+        var invalidateLayoutRecord = presentationModel._lastInvalidateLayout[this.frameId];
+        if (invalidateLayoutRecord)
+            this.callSiteStackTrace = invalidateLayoutRecord.stackTrace || invalidateLayoutRecord.callSiteStackTrace;
+        if (this.stackTrace)
+            this.hasWarning = true;
+        presentationModel._lastInvalidateLayout[this.frameId] = null;
+        break;
     }
 }
 
@@ -688,6 +723,10 @@
         }
         const recordTypes = WebInspector.TimelineModel.RecordType;
 
+        // The messages may vary per record type;
+        var callSiteStackTraceLabel;
+        var callStackLabel;
+
         switch (this.type) {
             case recordTypes.GCEvent:
                 contentHelper._appendTextRow(WebInspector.UIString("Collected"), Number.bytesToString(this.data["usedHeapSizeDelta"]));
@@ -733,7 +772,16 @@
                 contentHelper._appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
                 break;
             case recordTypes.RecalculateStyles: // We don't want to see default details.
+                callSiteStackTraceLabel = WebInspector.UIString("Styles invalidated");
+                callStackLabel = WebInspector.UIString("Styles recalculation forced");
                 break;
+            case recordTypes.Layout:
+                callSiteStackTraceLabel = WebInspector.UIString("Layout invalidated");
+                if (this.stackTrace) {
+                    callStackLabel = WebInspector.UIString("Layout forced");
+                    contentHelper._appendTextRow(WebInspector.UIString("Note"), WebInspector.UIString("Forced synchronous layout is a possible performance bottlenck."));
+                }
+                break;
             case recordTypes.Time:
             case recordTypes.TimeEnd:
                 if (typeof this.intervalDuration === "number")
@@ -751,11 +799,11 @@
         if (this.usedHeapSize)
             contentHelper._appendTextRow(WebInspector.UIString("Used Heap Size"), WebInspector.UIString("%s of %s", Number.bytesToString(this.usedHeapSize), Number.bytesToString(this.totalHeapSize)));
 
-        if (this.callSiteStackTrace && this.callSiteStackTrace.length)
-            contentHelper._appendStackTrace(WebInspector.UIString("Call Site stack"), this.callSiteStackTrace, this._linkifyCallFrame.bind(this));
+        if (this.callSiteStackTrace)
+            contentHelper._appendStackTrace(callSiteStackTraceLabel || WebInspector.UIString("Call Site stack"), this.callSiteStackTrace, this._linkifyCallFrame.bind(this));
 
         if (this.stackTrace)
-            contentHelper._appendStackTrace(WebInspector.UIString("Call Stack"), this.stackTrace, this._linkifyCallFrame.bind(this));
+            contentHelper._appendStackTrace(callStackLabel || WebInspector.UIString("Call Stack"), this.stackTrace, this._linkifyCallFrame.bind(this));
 
         callback(contentHelper._contentTable);
     },
@@ -843,7 +891,11 @@
      */
     _linkifyTopCallFrame: function(defaultValue)
     {
-        return this.stackTrace ? this._linkifyCallFrame(this.stackTrace[0]) : defaultValue;
+        if (this.stackTrace)
+            return this._linkifyCallFrame(this.stackTrace[0]);
+        if (this.callSiteStackTrace)
+            return this._linkifyCallFrame(this.callSiteStackTrace[0]);
+        return defaultValue;
     },
 
     /**

Modified: trunk/Source/WebCore/inspector/front-end/timelinePanel.css (126753 => 126754)


--- trunk/Source/WebCore/inspector/front-end/timelinePanel.css	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/inspector/front-end/timelinePanel.css	2012-08-27 13:52:59 UTC (rev 126754)
@@ -271,6 +271,12 @@
     background-color: rgba(0, 0, 0, 0.05);
 }
 
+.timeline-tree-item.warning::after {
+    content: url(Images/warningIcon.png);
+    float: right;
+    padding-top: 1px;
+}
+
 .timeline-tree-item .data.dimmed {
     color: rgba(0, 0, 0, 0.7);
 }

Modified: trunk/Source/WebCore/page/FrameView.cpp (126753 => 126754)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-08-27 13:22:43 UTC (rev 126753)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-08-27 13:52:59 UTC (rev 126754)
@@ -2090,7 +2090,7 @@
         return;
     if (!m_frame->document()->shouldScheduleLayout())
         return;
-
+    InspectorInstrumentation::didInvalidateLayout(m_frame.get());
     // When frame flattening is enabled, the contents of the frame could affect the layout of the parent frames.
     // Also invalidate parent frame starting from the owner element of this frame.
     if (m_frame->ownerRenderer() && isInChildFrameWithFrameFlattening())
@@ -2152,6 +2152,7 @@
             }
         }
     } else if (m_layoutSchedulingEnabled) {
+        InspectorInstrumentation::didInvalidateLayout(m_frame.get());
         int delay = m_frame->document()->minimumLayoutDelay();
         m_layoutRoot = relayoutRoot;
         ASSERT(!m_layoutRoot->container() || !m_layoutRoot->container()->needsLayout());
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to