Title: [128184] trunk
Revision
128184
Author
[email protected]
Date
2012-09-11 07:34:35 -0700 (Tue, 11 Sep 2012)

Log Message

Web Inspector: visualize layout root in Timeline
https://bugs.webkit.org/show_bug.cgi?id=96279

Reviewed by Pavel Feldman.

- pass layout root to InspectorTimelineAgent::didLayout
- show rectangles of the layout root upon hover over the Layout record;

* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didLayoutImpl):
* inspector/InspectorInstrumentation.h:
(WebCore):
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::didLayout):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didLayout):
* inspector/InspectorTimelineAgent.h:
(WebCore):
(InspectorTimelineAgent):
* inspector/TimelineRecordFactory.cpp:
(WebCore::TimelineRecordFactory::createPaintData):
(WebCore::TimelineRecordFactory::addRectData):
(WebCore):
* inspector/TimelineRecordFactory.h:
(TimelineRecordFactory):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._mouseMove):
* page/FrameView.cpp:
(WebCore::FrameView::layout):

Modified Paths

Diff

Modified: trunk/LayoutTests/inspector/timeline/timeline-layout-expected.txt (128183 => 128184)


--- trunk/LayoutTests/inspector/timeline/timeline-layout-expected.txt	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/LayoutTests/inspector/timeline/timeline-layout-expected.txt	2012-09-11 14:34:35 UTC (rev 128184)
@@ -6,6 +6,10 @@
     children : <object>
     counters : <object>
     data : {
+        height : <number>
+        width : <number>
+        x : 0
+        y : 0
     }
     endTime : <number>
     frameId : <string>

Modified: trunk/Source/WebCore/ChangeLog (128183 => 128184)


--- trunk/Source/WebCore/ChangeLog	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/ChangeLog	2012-09-11 14:34:35 UTC (rev 128184)
@@ -1,3 +1,46 @@
+2012-09-10  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: visualize layout root in Timeline
+        https://bugs.webkit.org/show_bug.cgi?id=96279
+
+        Reviewed by Pavel Feldman.
+
+        - pass layout root to InspectorTimelineAgent::didLayout
+        - show rectangles of the layout root upon hover over the Layout record;
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::didLayoutImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore):
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::didLayout):
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::didLayout):
+        * inspector/InspectorTimelineAgent.h:
+        (WebCore):
+        (InspectorTimelineAgent):
+        * inspector/TimelineRecordFactory.cpp:
+        (WebCore::TimelineRecordFactory::createPaintData):
+        (WebCore::TimelineRecordFactory::addRectData):
+        (WebCore):
+        * inspector/TimelineRecordFactory.h:
+        (TimelineRecordFactory):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._mouseMove):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::layout):
+
+2012-09-10  Andrey Kosyakov  <[email protected]>
+
+        Web Inspector: highlight of paint rectangles is broken
+        https://bugs.webkit.org/show_bug.cgi?id=96276
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/InspectorOverlay.cpp:
+        (WebCore::InspectorOverlay::drawRectHighlight): Fix JS method name to match the one in InspectorOverlayPage.html
+
 2012-09-11  Chris Guan  <[email protected]>
 
         [Blackberry] use ReadOnlyLatin1String to save a deep copy

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js (128183 => 128184)


--- trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/English.lproj/localizedStrings.js	2012-09-11 14:34:35 UTC (rev 128184)
@@ -731,7 +731,7 @@
 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["Forced synchronous layout is a possible performance bottleneck."] = "Forced synchronous layout is a possible performance bottleneck.";
 localizedStrings["Styles invalidated"] = "Styles invalidated";
 localizedStrings["Styles recalculation forced"] = "Styles recalculation forced";
 localizedStrings["Layout invalidated"] = "Layout invalidated";

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (128183 => 128184)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-09-11 14:34:35 UTC (rev 128184)
@@ -451,13 +451,13 @@
     return InspectorInstrumentationCookie(instrumentingAgents, timelineAgentId);
 }
 
-void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie)
+void InspectorInstrumentation::didLayoutImpl(const InspectorInstrumentationCookie& cookie, RenderObject* root)
 {
     if (!cookie.first)
         return;
 
     if (InspectorTimelineAgent* timelineAgent = retrieveTimelineAgent(cookie))
-        timelineAgent->didLayout();
+        timelineAgent->didLayout(root);
 
     if (InspectorPageAgent* pageAgent = cookie.first->inspectorPageAgent())
         pageAgent->didLayout();

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (128183 => 128184)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2012-09-11 14:34:35 UTC (rev 128184)
@@ -65,6 +65,7 @@
 class InstrumentingAgents;
 class KURL;
 class Node;
+class RenderObject;
 class ResourceRequest;
 class ResourceResponse;
 class ScriptArguments;
@@ -144,7 +145,7 @@
     static void didCancelFrame(Page*);
     static void didInvalidateLayout(Frame*);
     static InspectorInstrumentationCookie willLayout(Frame*);
-    static void didLayout(const InspectorInstrumentationCookie&);
+    static void didLayout(const InspectorInstrumentationCookie&, RenderObject*);
     static void didScroll(Page*);
     static InspectorInstrumentationCookie willLoadXHR(ScriptExecutionContext*, XMLHttpRequest*);
     static void didLoadXHR(const InspectorInstrumentationCookie&);
@@ -321,7 +322,7 @@
     static void didCancelFrameImpl(InstrumentingAgents*);
     static void didInvalidateLayoutImpl(InstrumentingAgents*, Frame*);
     static InspectorInstrumentationCookie willLayoutImpl(InstrumentingAgents*, Frame*);
-    static void didLayoutImpl(const InspectorInstrumentationCookie&);
+    static void didLayoutImpl(const InspectorInstrumentationCookie&, RenderObject*);
     static void didScrollImpl(InstrumentingAgents*);
     static InspectorInstrumentationCookie willLoadXHRImpl(InstrumentingAgents*, XMLHttpRequest*, ScriptExecutionContext*);
     static void didLoadXHRImpl(const InspectorInstrumentationCookie&);
@@ -833,12 +834,12 @@
     return InspectorInstrumentationCookie();
 }
 
-inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie)
+inline void InspectorInstrumentation::didLayout(const InspectorInstrumentationCookie& cookie, RenderObject* root)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
     if (cookie.first)
-        didLayoutImpl(cookie);
+        didLayoutImpl(cookie, root);
 #endif
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (128183 => 128184)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2012-09-11 14:34:35 UTC (rev 128184)
@@ -46,6 +46,8 @@
 #include "InspectorState.h"
 #include "InstrumentingAgents.h"
 #include "IntRect.h"
+#include "RenderObject.h"
+#include "RenderView.h"
 #include "ResourceRequest.h"
 #include "ResourceResponse.h"
 #include "TimelineRecordFactory.h"
@@ -242,8 +244,14 @@
     pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Layout, true, frame);
 }
 
-void InspectorTimelineAgent::didLayout()
+void InspectorTimelineAgent::didLayout(RenderObject* root)
 {
+    if (m_recordStack.isEmpty())
+        return;
+    LayoutRect rect = root->frame()->view()->contentsToRootView(root->absoluteBoundingBoxRect());
+    TimelineRecordEntry entry = m_recordStack.last();
+    ASSERT(entry.type == TimelineRecordType::Layout);
+    TimelineRecordFactory::addRectData(entry.data.get(), rect);
     didCompleteCurrentRecord(TimelineRecordType::Layout);
 }
 

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (128183 => 128184)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2012-09-11 14:34:35 UTC (rev 128184)
@@ -52,6 +52,7 @@
 class InspectorState;
 class InstrumentingAgents;
 class IntRect;
+class RenderObject;
 class ResourceRequest;
 class ResourceResponse;
 
@@ -98,7 +99,7 @@
 
     void didInvalidateLayout(Frame*);
     void willLayout(Frame*);
-    void didLayout();
+    void didLayout(RenderObject*);
 
     void didScheduleStyleRecalculation(Frame*);
     void willRecalculateStyle(Frame*);

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (128183 => 128184)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2012-09-11 14:34:35 UTC (rev 128184)
@@ -173,10 +173,7 @@
 PassRefPtr<InspectorObject> TimelineRecordFactory::createPaintData(const LayoutRect& rect)
 {
     RefPtr<InspectorObject> data = ""
-    data->setNumber("x", rect.x());
-    data->setNumber("y", rect.y());
-    data->setNumber("width", rect.width());
-    data->setNumber("height", rect.height());
+    addRectData(data.get(), rect);
     return data.release();
 }
 
@@ -209,6 +206,14 @@
     return data.release();
 }
 
+void TimelineRecordFactory::addRectData(InspectorObject* data, const LayoutRect& rect)
+{
+    data->setNumber("x", rect.x());
+    data->setNumber("y", rect.y());
+    data->setNumber("width", rect.width());
+    data->setNumber("height", rect.height());
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.h (128183 => 128184)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2012-09-11 14:34:35 UTC (rev 128184)
@@ -77,6 +77,8 @@
 
         static PassRefPtr<InspectorObject> createPaintData(const LayoutRect&);
 
+        static void addRectData(InspectorObject*, const LayoutRect&);
+
         static PassRefPtr<InspectorObject> createDecodeImageData(const String& imageType);
 
         static PassRefPtr<InspectorObject> createResizeImageData(bool shouldCache);

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


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2012-09-11 14:34:35 UTC (rev 128184)
@@ -947,7 +947,8 @@
     {
         var anchor = this._getPopoverAnchor(e.target);
 
-        if (anchor && anchor.row && anchor.row._record.type === "Paint")
+        const recordType = WebInspector.TimelineModel.RecordType;
+        if (anchor && anchor.row && (anchor.row._record.type === recordType.Paint || anchor.row._record.type === recordType.Layout))
             this._highlightRect(anchor.row._record);
         else
             this._hideRectHighlight();

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


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2012-09-11 14:34:35 UTC (rev 128184)
@@ -218,6 +218,12 @@
     return eventDivider;
 }
 
+WebInspector.TimelinePresentationModel._hiddenRecords = { }
+WebInspector.TimelinePresentationModel._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkDOMContent] = 1;
+WebInspector.TimelinePresentationModel._hiddenRecords[WebInspector.TimelineModel.RecordType.MarkLoad] = 1;
+WebInspector.TimelinePresentationModel._hiddenRecords[WebInspector.TimelineModel.RecordType.ScheduleStyleRecalculation] = 1;
+WebInspector.TimelinePresentationModel._hiddenRecords[WebInspector.TimelineModel.RecordType.InvalidateLayout] = 1;
+
 WebInspector.TimelinePresentationModel.prototype = {
     /**
      * @param {WebInspector.TimelinePresentationModel.Filter} filter
@@ -278,13 +284,7 @@
     _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 isHiddenRecord = record.type in WebInspector.TimelinePresentationModel._hiddenRecords;
         var connectedToOldRecord = false;
         if (record.type === recordTypes.Time)
             parentRecord = this._rootRecord;
@@ -788,7 +788,7 @@
                 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."));
+                    contentHelper._appendTextRow(WebInspector.UIString("Note"), WebInspector.UIString("Forced synchronous layout is a possible performance bottleneck."));
                 }
                 break;
             case recordTypes.Time:

Modified: trunk/Source/WebCore/page/FrameView.cpp (128183 => 128184)


--- trunk/Source/WebCore/page/FrameView.cpp	2012-09-11 14:30:18 UTC (rev 128183)
+++ trunk/Source/WebCore/page/FrameView.cpp	2012-09-11 14:34:35 UTC (rev 128184)
@@ -1252,7 +1252,7 @@
         m_actionScheduler->resume();
     }
 
-    InspectorInstrumentation::didLayout(cookie);
+    InspectorInstrumentation::didLayout(cookie, root);
 
     m_nestedLayoutCount--;
     if (m_nestedLayoutCount)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to