Title: [147204] trunk
Revision
147204
Author
ca...@chromium.org
Date
2013-03-29 02:44:53 -0700 (Fri, 29 Mar 2013)

Log Message

Web Inspector: timeline paint rectangles are off for transformed layers
https://bugs.webkit.org/show_bug.cgi?id=112919

Reviewed by Pavel Feldman.

Source/WebCore:

- pass RenderObject instead of Frame to InspectorInstrumentation::didPaint;
- take transforms into account and convert paint clip rect into quad;
- emit quads, not rects as Paint and Layout record data;
- adjust client to using quads, compute width/height from quad coords.

* inspector/InspectorInstrumentation.cpp: Pass RenderObject, not frame to {will,did}Paint.
(WebCore):
(WebCore::InspectorInstrumentation::willPaintImpl):
(WebCore::InspectorInstrumentation::didPaintImpl):
(WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Added.
* inspector/InspectorInstrumentation.h:
(WebCore):
(InspectorInstrumentation):
(WebCore::InspectorInstrumentation::willPaint):
(WebCore::InspectorInstrumentation::didPaint):
* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::didLayout):
(WebCore::InspectorTimelineAgent::didPaint):
(WebCore::InspectorTimelineAgent::localToPageQuad): Convert local clip rect to transformed quad.
(WebCore):
* inspector/InspectorTimelineAgent.h:
(WebCore):
(InspectorTimelineAgent):
* inspector/TimelineRecordFactory.cpp: Emit quads as Paint and Layout records data.
(WebCore::createQuad):
(WebCore):
(WebCore::TimelineRecordFactory::createPaintData):
(WebCore::TimelineRecordFactory::createLayoutData):
* inspector/TimelineRecordFactory.h:
(WebCore):
(TimelineRecordFactory):
* inspector/front-end/TimelinePanel.js: Highlight a quad iff formatted record has highlightQuad field.
(WebInspector.TimelinePanel.prototype._mouseOut):
(WebInspector.TimelinePanel.prototype._mouseMove):
(WebInspector.TimelinePanel.prototype._highlightQuad):
(WebInspector.TimelinePanel.prototype._hideQuadHighlight):
* inspector/front-end/TimelinePresentationModel.js:
(WebInspector.TimelinePresentationModel.Record): Set highlightQuad for Paint and Layout
(WebInspector.TimelinePresentationModel.Record.prototype._generatePopupContentWithImagePreview):
(WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails):
(WebInspector.TimelinePresentationModel.quadWidth):
(WebInspector.TimelinePresentationModel.quadHeight):
* page/FrameView.cpp:
(WebCore::FrameView::paintContents):
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::paintContents):

LayoutTests:

- adjust to changed record format;
- simplify test using InspectorTest.evaluateWithTimeline().

* http/tests/inspector/timeline-test.js:
* inspector/timeline/timeline-layout-expected.txt:
* inspector/timeline/timeline-paint-expected.txt:
* inspector/timeline/timeline-paint.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (147203 => 147204)


--- trunk/LayoutTests/ChangeLog	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/LayoutTests/ChangeLog	2013-03-29 09:44:53 UTC (rev 147204)
@@ -1,3 +1,18 @@
+2013-03-22  Andrey Kosyakov  <ca...@chromium.org>
+
+        Web Inspector: timeline paint rectangles are off for transformed layers
+        https://bugs.webkit.org/show_bug.cgi?id=112919
+
+        Reviewed by Pavel Feldman.
+
+        - adjust to changed record format;
+        - simplify test using InspectorTest.evaluateWithTimeline().
+
+        * http/tests/inspector/timeline-test.js:
+        * inspector/timeline/timeline-layout-expected.txt:
+        * inspector/timeline/timeline-paint-expected.txt:
+        * inspector/timeline/timeline-paint.html:
+
 2013-03-29  Zoltan Arvai  <zar...@inf.u-szeged.hu>
 
         [Qt] Unreviewed gardening.

Modified: trunk/LayoutTests/http/tests/inspector/timeline-test.js (147203 => 147204)


--- trunk/LayoutTests/http/tests/inspector/timeline-test.js	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/LayoutTests/http/tests/inspector/timeline-test.js	2013-03-29 09:44:53 UTC (rev 147204)
@@ -4,10 +4,8 @@
 InspectorTest.timelinePropertyFormatters = {
     children: "formatAsTypeName",
     endTime: "formatAsTypeName",
-    height: "formatAsTypeName",
     requestId: "formatAsTypeName",
     startTime: "formatAsTypeName",
-    width: "formatAsTypeName",
     stackTrace: "formatAsTypeName",
     url: "formatAsTypeName",
     scriptName: "formatAsTypeName",
@@ -21,7 +19,9 @@
     lineNumber: "formatAsTypeName",
     frameId: "formatAsTypeName",
     encodedDataLength: "formatAsTypeName",
-    identifier: "formatAsTypeName"    
+    identifier: "formatAsTypeName",
+    clip: "formatAsTypeName",
+    root: "formatAsTypeName",
 };
 
 InspectorTest.startTimeline = function(callback)

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


--- trunk/LayoutTests/inspector/timeline/timeline-layout-expected.txt	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/LayoutTests/inspector/timeline/timeline-layout-expected.txt	2013-03-29 09:44:53 UTC (rev 147204)
@@ -6,10 +6,7 @@
     children : <object>
     counters : <object>
     data : {
-        height : <number>
-        width : <number>
-        x : 0
-        y : 0
+        root : <object>
     }
     endTime : <number>
     frameId : <string>

Modified: trunk/LayoutTests/inspector/timeline/timeline-paint-expected.txt (147203 => 147204)


--- trunk/LayoutTests/inspector/timeline/timeline-paint-expected.txt	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/LayoutTests/inspector/timeline/timeline-paint-expected.txt	2013-03-29 09:44:53 UTC (rev 147204)
@@ -6,10 +6,7 @@
     children : <object>
     counters : <object>
     data : {
-        height : <number>
-        width : <number>
-        x : 0
-        y : 0
+        clip : <object>
     }
     endTime : <number>
     frameId : <string>

Modified: trunk/LayoutTests/inspector/timeline/timeline-paint.html (147203 => 147204)


--- trunk/LayoutTests/inspector/timeline/timeline-paint.html	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/LayoutTests/inspector/timeline/timeline-paint.html	2013-03-29 09:44:53 UTC (rev 147204)
@@ -19,19 +19,15 @@
 
 function test()
 {
-    InspectorTest.startTimeline(step1);
+    step1();
+
     function step1()
     {
-        InspectorTest.evaluateInPage("display()", step2);
+        InspectorTest.evaluateWithTimeline("display()", step2);
     }
 
-    function step2()
+    function step2(records)
     {
-        InspectorTest.stopTimeline(step3);
-    }
-
-    function step3(records)
-    {
         for (var i = 0; i < records.length; ++i) {
             var record = records[i];
             if (record.type === WebInspector.TimelineModel.RecordType.Paint) {
@@ -39,21 +35,11 @@
                 break;
             }
         }
-        InspectorTest.startTimeline(step4);
+        InspectorTest.evaluateWithTimeline("updateSubframeAndDisplay()", step3);
     }
 
-    function step4()
+    function step3(records)
     {
-        InspectorTest.evaluateInPage("updateSubframeAndDisplay()", step5);
-    }
-
-    function step5()
-    {
-        InspectorTest.stopTimeline(step6);
-    }
-
-    function step6(records)
-    {
         var paintRecord;
         for (var i = 0; i < records.length; ++i) {
             var record = records[i];
@@ -63,11 +49,20 @@
             }
         }
         InspectorTest.assertTrue(paintRecord, "Paint record with subframe paint not found");
+        var topQuad = paintRecord.data.clip;
         var subframePaint = paintRecord.children[0];
-        InspectorTest.assertGreaterOrEqual(subframePaint.data.x, paintRecord.data.x);
-        InspectorTest.assertGreaterOrEqual(subframePaint.data.y, paintRecord.data.y);
-        InspectorTest.assertGreaterOrEqual(paintRecord.data.x + paintRecord.data.width, subframePaint.data.x + subframePaint.data.width);
-        InspectorTest.assertGreaterOrEqual(paintRecord.data.y + paintRecord.data.height, subframePaint.data.y + subframePaint.data.height);
+        var subframeQuad = subframePaint.data.clip;
+        InspectorTest.assertEquals(8, topQuad.length);
+        InspectorTest.assertEquals(8, subframeQuad.length);
+        InspectorTest.assertGreaterOrEqual(subframeQuad[0], topQuad[0]);
+        InspectorTest.assertGreaterOrEqual(subframeQuad[1], topQuad[1]);
+        InspectorTest.assertGreaterOrEqual(topQuad[2], subframeQuad[2]);
+        InspectorTest.assertGreaterOrEqual(subframeQuad[3], topQuad[3]);
+        InspectorTest.assertGreaterOrEqual(topQuad[4], subframeQuad[4]);
+        InspectorTest.assertGreaterOrEqual(topQuad[5], subframeQuad[5]);
+        InspectorTest.assertGreaterOrEqual(subframeQuad[6], topQuad[6]);
+        InspectorTest.assertGreaterOrEqual(topQuad[7], subframeQuad[7]);
+
         InspectorTest.completeTest();
     }
 }

Modified: trunk/Source/WebCore/ChangeLog (147203 => 147204)


--- trunk/Source/WebCore/ChangeLog	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/ChangeLog	2013-03-29 09:44:53 UTC (rev 147204)
@@ -1,3 +1,57 @@
+2013-03-22  Andrey Kosyakov  <ca...@chromium.org>
+
+        Web Inspector: timeline paint rectangles are off for transformed layers
+        https://bugs.webkit.org/show_bug.cgi?id=112919
+
+        Reviewed by Pavel Feldman.
+
+        - pass RenderObject instead of Frame to InspectorInstrumentation::didPaint;
+        - take transforms into account and convert paint clip rect into quad;
+        - emit quads, not rects as Paint and Layout record data;
+        - adjust client to using quads, compute width/height from quad coords.
+
+        * inspector/InspectorInstrumentation.cpp: Pass RenderObject, not frame to {will,did}Paint.
+        (WebCore):
+        (WebCore::InspectorInstrumentation::willPaintImpl):
+        (WebCore::InspectorInstrumentation::didPaintImpl):
+        (WebCore::InspectorInstrumentation::instrumentingAgentsForRenderer): Added.
+        * inspector/InspectorInstrumentation.h:
+        (WebCore):
+        (InspectorInstrumentation):
+        (WebCore::InspectorInstrumentation::willPaint):
+        (WebCore::InspectorInstrumentation::didPaint):
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::didLayout):
+        (WebCore::InspectorTimelineAgent::didPaint):
+        (WebCore::InspectorTimelineAgent::localToPageQuad): Convert local clip rect to transformed quad.
+        (WebCore):
+        * inspector/InspectorTimelineAgent.h:
+        (WebCore):
+        (InspectorTimelineAgent):
+        * inspector/TimelineRecordFactory.cpp: Emit quads as Paint and Layout records data.
+        (WebCore::createQuad):
+        (WebCore):
+        (WebCore::TimelineRecordFactory::createPaintData):
+        (WebCore::TimelineRecordFactory::createLayoutData):
+        * inspector/TimelineRecordFactory.h:
+        (WebCore):
+        (TimelineRecordFactory):
+        * inspector/front-end/TimelinePanel.js: Highlight a quad iff formatted record has highlightQuad field.
+        (WebInspector.TimelinePanel.prototype._mouseOut):
+        (WebInspector.TimelinePanel.prototype._mouseMove):
+        (WebInspector.TimelinePanel.prototype._highlightQuad):
+        (WebInspector.TimelinePanel.prototype._hideQuadHighlight):
+        * inspector/front-end/TimelinePresentationModel.js:
+        (WebInspector.TimelinePresentationModel.Record): Set highlightQuad for Paint and Layout
+        (WebInspector.TimelinePresentationModel.Record.prototype._generatePopupContentWithImagePreview):
+        (WebInspector.TimelinePresentationModel.Record.prototype._getRecordDetails):
+        (WebInspector.TimelinePresentationModel.quadWidth):
+        (WebInspector.TimelinePresentationModel.quadHeight):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::paintContents):
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::RenderLayerBacking::paintContents):
+
 2013-03-21  Andrey Kosyakov  <ca...@chromium.org>
 
         Web Inspector: generalize InspectorDOMAgent::highlightRect() to highlightQuad()

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (147203 => 147204)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2013-03-29 09:44:53 UTC (rev 147204)
@@ -66,6 +66,7 @@
 #include "InstrumentingAgents.h"
 #include "PageDebuggerAgent.h"
 #include "PageRuntimeAgent.h"
+#include "RenderObject.h"
 #include "ScriptArguments.h"
 #include "ScriptCallStack.h"
 #include "ScriptProfile.h"
@@ -525,20 +526,20 @@
         timelineAgent->didDispatchXHRLoadEvent();
 }
 
-void InspectorInstrumentation::willPaintImpl(InstrumentingAgents* instrumentingAgents, Frame* frame)
+void InspectorInstrumentation::willPaintImpl(InstrumentingAgents* instrumentingAgents, RenderObject* renderer)
 {
 #if PLATFORM(CHROMIUM)
-    TRACE_EVENT_INSTANT1("instrumentation", InstrumentationEvents::Paint, InstrumentationEventArguments::PageId, frame ? reinterpret_cast<unsigned long long>(frame->page()) : 0);
+    TRACE_EVENT_INSTANT1("instrumentation", InstrumentationEvents::Paint, InstrumentationEventArguments::PageId, reinterpret_cast<unsigned long long>(renderer->frame()->page()));
 #endif
 
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->willPaint(frame);
+        timelineAgent->willPaint(renderer->frame());
 }
 
-void InspectorInstrumentation::didPaintImpl(InstrumentingAgents*  instrumentingAgents, Frame* frame, GraphicsContext* context, const LayoutRect& rect)
+void InspectorInstrumentation::didPaintImpl(InstrumentingAgents*  instrumentingAgents, RenderObject* renderer, GraphicsContext* context, const LayoutRect& rect)
 {
     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents->inspectorTimelineAgent())
-        timelineAgent->didPaint(frame, rect);
+        timelineAgent->didPaint(renderer, rect);
     if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
         pageAgent->didPaint(context, rect);
 }
@@ -1329,6 +1330,11 @@
     return instrumentationForPage(page);
 }
 
+InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForRenderer(RenderObject* renderer)
+{
+    return instrumentingAgentsForFrame(renderer->frame());
+}
+
 #if ENABLE(WORKERS)
 InstrumentingAgents* InspectorInstrumentation::instrumentingAgentsForWorkerContext(WorkerContext* workerContext)
 {

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (147203 => 147204)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h	2013-03-29 09:44:53 UTC (rev 147204)
@@ -74,6 +74,7 @@
 class Node;
 class PseudoElement;
 class RenderLayer;
+class RenderLayerBacking;
 class RenderObject;
 class ResourceRequest;
 class ResourceResponse;
@@ -169,8 +170,8 @@
     static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&);
     static void willScrollLayer(Frame*);
     static void didScrollLayer(Frame*);
-    static void willPaint(Frame*);
-    static void didPaint(Frame*, GraphicsContext*, const LayoutRect&);
+    static void willPaint(RenderObject*);
+    static void didPaint(RenderObject*, GraphicsContext*, const LayoutRect&);
     static void willComposite(Page*);
     static void didComposite(Page*);
     static InspectorInstrumentationCookie willRecalculateStyle(Document*);
@@ -373,8 +374,8 @@
     static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&);
     static void willScrollLayerImpl(InstrumentingAgents*, Frame*);
     static void didScrollLayerImpl(InstrumentingAgents*);
-    static void willPaintImpl(InstrumentingAgents*, Frame*);
-    static void didPaintImpl(InstrumentingAgents*, Frame*, GraphicsContext*, const LayoutRect&);
+    static void willPaintImpl(InstrumentingAgents*, RenderObject*);
+    static void didPaintImpl(InstrumentingAgents*, RenderObject*, GraphicsContext*, const LayoutRect&);
     static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents*, Frame*);
     static void didRecalculateStyleImpl(const InspectorInstrumentationCookie&);
     static void didScheduleStyleRecalculationImpl(InstrumentingAgents*, Document*);
@@ -483,6 +484,8 @@
     static InstrumentingAgents* instrumentingAgentsForFrame(Frame*);
     static InstrumentingAgents* instrumentingAgentsForContext(ScriptExecutionContext*);
     static InstrumentingAgents* instrumentingAgentsForDocument(Document*);
+    static InstrumentingAgents* instrumentingAgentsForRenderer(RenderObject*);
+
 #if ENABLE(WORKERS)
     static InstrumentingAgents* instrumentingAgentsForWorkerContext(WorkerContext*);
     static InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ScriptExecutionContext*);
@@ -1101,25 +1104,25 @@
 #endif
 }
 
-inline void InspectorInstrumentation::willPaint(Frame* frame)
+inline void InspectorInstrumentation::willPaint(RenderObject* renderer)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        return willPaintImpl(instrumentingAgents, frame);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
+        return willPaintImpl(instrumentingAgents, renderer);
 #else
-    UNUSED_PARAM(frame);
+    UNUSED_PARAM(renderer);
 #endif
 }
 
-inline void InspectorInstrumentation::didPaint(Frame* frame, GraphicsContext* context, const LayoutRect& rect)
+inline void InspectorInstrumentation::didPaint(RenderObject* renderer, GraphicsContext* context, const LayoutRect& rect)
 {
 #if ENABLE(INSPECTOR)
     FAST_RETURN_IF_NO_FRONTENDS(void());
-    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
-        didPaintImpl(instrumentingAgents, frame, context, rect);
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForRenderer(renderer))
+        didPaintImpl(instrumentingAgents, renderer, context, rect);
 #else
-    UNUSED_PARAM(frame);
+    UNUSED_PARAM(renderer);
     UNUSED_PARAM(context);
     UNUSED_PARAM(rect);
 #endif

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (147203 => 147204)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp	2013-03-29 09:44:53 UTC (rev 147204)
@@ -270,10 +270,14 @@
 {
     if (m_recordStack.isEmpty())
         return;
-    LayoutRect rect = root->frame()->view()->contentsToRootView(root->absoluteBoundingBoxRect());
-    TimelineRecordEntry entry = m_recordStack.last();
+    TimelineRecordEntry& entry = m_recordStack.last();
     ASSERT(entry.type == TimelineRecordType::Layout);
-    TimelineRecordFactory::addRectData(entry.data.get(), rect);
+    Vector<FloatQuad> quads;
+    root->absoluteQuads(quads);
+    if (quads.size() >= 1)
+        entry.data = ""
+    else
+        ASSERT_NOT_REACHED();
     didCompleteCurrentRecord(TimelineRecordType::Layout);
 }
 
@@ -297,12 +301,13 @@
     pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true, frame, true);
 }
 
-void InspectorTimelineAgent::didPaint(Frame* frame, const LayoutRect& rect)
+void InspectorTimelineAgent::didPaint(RenderObject* renderer, const LayoutRect& clipRect)
 {
-    TimelineRecordEntry entry = m_recordStack.last();
+    TimelineRecordEntry& entry = m_recordStack.last();
     ASSERT(entry.type == TimelineRecordType::Paint);
-    LayoutRect rectInRootCoordinates = frame->view()->contentsToRootView(pixelSnappedIntRect(rect));
-    TimelineRecordFactory::addRectData(entry.data.get(), rectInRootCoordinates);
+    FloatQuad quad;
+    localToPageQuad(*renderer, clipRect, &quad);
+    entry.data = ""
     didCompleteCurrentRecord(TimelineRecordType::Paint);
 }
 
@@ -697,6 +702,17 @@
     m_id++;
 }
 
+void InspectorTimelineAgent::localToPageQuad(const RenderObject& renderer, const LayoutRect& rect, FloatQuad* quad)
+{
+    Frame* frame = renderer.frame();
+    FrameView* view = frame->view();
+    FloatQuad absolute = renderer.localToAbsoluteQuad(FloatQuad(rect));
+    quad->setP1(view->contentsToRootView(roundedIntPoint(absolute.p1())));
+    quad->setP2(view->contentsToRootView(roundedIntPoint(absolute.p2())));
+    quad->setP3(view->contentsToRootView(roundedIntPoint(absolute.p3())));
+    quad->setP4(view->contentsToRootView(roundedIntPoint(absolute.p4())));
+}
+
 double InspectorTimelineAgent::timestamp()
 {
     return m_timeConverter.fromMonotonicallyIncreasingTime(WTF::monotonicallyIncreasingTime());

Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (147203 => 147204)


--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h	2013-03-29 09:44:53 UTC (rev 147204)
@@ -46,6 +46,7 @@
 
 namespace WebCore {
 class Event;
+class FloatQuad;
 class Frame;
 class InspectorClient;
 class InspectorFrontend;
@@ -129,7 +130,7 @@
     void didRecalculateStyle();
 
     void willPaint(Frame*);
-    void didPaint(Frame*, const LayoutRect&);
+    void didPaint(RenderObject*, const LayoutRect&);
 
     void willScroll(Frame*);
     void didScroll();
@@ -228,6 +229,7 @@
     void innerAddRecordToTimeline(PassRefPtr<InspectorObject>, const String& type);
     void clearRecordStack();
 
+    void localToPageQuad(const RenderObject& renderer, const LayoutRect&, FloatQuad*);
     const TimelineTimeConverter& timeConverter() const { return m_timeConverter; }
     double timestamp();
     Page* page();

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp (147203 => 147204)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.cpp	2013-03-29 09:44:53 UTC (rev 147204)
@@ -35,6 +35,7 @@
 #include "TimelineRecordFactory.h"
 
 #include "Event.h"
+#include "FloatQuad.h"
 #include "InspectorValues.h"
 #include "IntRect.h"
 #include "LayoutRect.h"
@@ -213,14 +214,34 @@
     return data.release();
 }
 
-void TimelineRecordFactory::addRectData(InspectorObject* data, const LayoutRect& rect)
+static PassRefPtr<InspectorArray> createQuad(const FloatQuad& quad)
 {
-    data->setNumber("x", rect.x());
-    data->setNumber("y", rect.y());
-    data->setNumber("width", rect.width());
-    data->setNumber("height", rect.height());
+    RefPtr<InspectorArray> array = InspectorArray::create();
+    array->pushNumber(quad.p1().x());
+    array->pushNumber(quad.p1().y());
+    array->pushNumber(quad.p2().x());
+    array->pushNumber(quad.p2().y());
+    array->pushNumber(quad.p3().x());
+    array->pushNumber(quad.p3().y());
+    array->pushNumber(quad.p4().x());
+    array->pushNumber(quad.p4().y());
+    return array.release();
 }
 
+PassRefPtr<InspectorObject> TimelineRecordFactory::createPaintData(const FloatQuad& quad)
+{
+    RefPtr<InspectorObject> data = ""
+    data->setArray("clip", createQuad(quad));
+    return data.release();
+}
+
+PassRefPtr<InspectorObject> TimelineRecordFactory::createLayoutData(const FloatQuad& quad)
+{
+    RefPtr<InspectorObject> data = ""
+    data->setArray("root", createQuad(quad));
+    return data.release();
+}
+
 } // namespace WebCore
 
 #endif // ENABLE(INSPECTOR)

Modified: trunk/Source/WebCore/inspector/TimelineRecordFactory.h (147203 => 147204)


--- trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/TimelineRecordFactory.h	2013-03-29 09:44:53 UTC (rev 147204)
@@ -40,6 +40,7 @@
 namespace WebCore {
 
     class Event;
+    class FloatQuad;
     class InspectorFrontend;
     class InspectorObject;
     class IntRect;
@@ -91,6 +92,10 @@
 
         static PassRefPtr<InspectorObject> createAnimationFrameData(int callbackId);
 
+        static PassRefPtr<InspectorObject> createPaintData(const FloatQuad&);
+
+        static PassRefPtr<InspectorObject> createLayoutData(const FloatQuad&);
+
 #if ENABLE(WEB_SOCKETS)
         static inline PassRefPtr<InspectorObject> createWebSocketCreateData(unsigned long identifier, const KURL& url, const String& protocol)
         {

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


--- trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePanel.js	2013-03-29 09:44:53 UTC (rev 147204)
@@ -1062,18 +1062,20 @@
 
     _mouseOut: function(e)
     {
-        this._hideRectHighlight();
+        this._hideQuadHighlight();
     },
 
+    /**
+     * @param {Event} e
+     */
     _mouseMove: function(e)
     {
         var anchor = this._getPopoverAnchor(e.target);
 
-        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);
+        if (anchor && anchor.row && anchor.row._record.highlightQuad)
+            this._highlightQuad(anchor.row._record.highlightQuad);
         else
-            this._hideRectHighlight();
+            this._hideQuadHighlight();
 
         if (anchor && anchor._tasksInfo) {
             var offset = anchor.offsetLeft;
@@ -1082,20 +1084,21 @@
             this._timelineGrid.hideCurtains();
     },
 
-    _highlightRect: function(record)
+    /**
+     * @param {Array.<number>} quad
+     */
+    _highlightQuad: function(quad)
     {
-        if (record.coalesced)
+        if (this._highlightedQuad === quad)
             return;
-        if (this._highlightedRect === record.data)
-            return;
-        this._highlightedRect = record.data;
-        DOMAgent.highlightRect(this._highlightedRect.x, this._highlightedRect.y, this._highlightedRect.width, this._highlightedRect.height, WebInspector.Color.PageHighlight.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtocolRGBA());
+        this._highlightedQuad = quad;
+        DOMAgent.highlightQuad(quad, WebInspector.Color.PageHighlight.Content.toProtocolRGBA(), WebInspector.Color.PageHighlight.ContentOutline.toProtocolRGBA());
     },
 
-    _hideRectHighlight: function()
+    _hideQuadHighlight: function()
     {
-        if (this._highlightedRect) {
-            delete this._highlightedRect;
+        if (this._highlightedQuad) {
+            delete this._highlightedQuad;
             DOMAgent.hideHighlight();
         }
     },

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


--- trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/inspector/front-end/TimelinePresentationModel.js	2013-03-29 09:44:53 UTC (rev 147204)
@@ -748,8 +748,13 @@
         if (this.stackTrace)
             this.setHasWarning();
         presentationModel._layoutInvalidateStack[this.frameId] = null;
+        this.highlightQuad = record.data.root;
         break;
 
+    case recordTypes.Paint:
+        this.highlightQuad = record.data.clip;
+        break;
+
     case recordTypes.WebSocketCreate:
         this.webSocketURL = record.data["url"];
         if (typeof record.data["webSocketProtocol"] !== "undefined")
@@ -1030,8 +1035,10 @@
                     contentHelper.appendElementRow(WebInspector.UIString("Script"), this._linkifyLocation(this.url, this.data["lineNumber"]));
                 break;
             case recordTypes.Paint:
-                contentHelper.appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data["x"], this.data["y"]));
-                contentHelper.appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", this.data["width"], this.data["height"]));
+                contentHelper.appendTextRow(WebInspector.UIString("Location"), WebInspector.UIString("(%d, %d)", this.data.clip[0], this.data.clip[1]));
+                var clipWidth = WebInspector.TimelinePresentationModel.quadWidth(this.data.clip);
+                var clipHeight = WebInspector.TimelinePresentationModel.quadHeight(this.data.clip);
+                contentHelper.appendTextRow(WebInspector.UIString("Dimensions"), WebInspector.UIString("%d × %d", clipWidth, clipHeight));
                 break;
             case recordTypes.RecalculateStyles: // We don't want to see default details.
                 callSiteStackTraceLabel = WebInspector.UIString("Styles invalidated");
@@ -1142,7 +1149,7 @@
             details = this.data ? this.data["type"] : null;
             break;
         case WebInspector.TimelineModel.RecordType.Paint:
-            details = this.data["width"] + "\u2009\u00d7\u2009" + this.data["height"];
+            details = WebInspector.TimelinePresentationModel.quadWidth(this.data.clip)  + "\u2009\u00d7\u2009" + WebInspector.TimelinePresentationModel.quadHeight(this.data.clip);
             break;
         case WebInspector.TimelineModel.RecordType.DecodeImage:
             details = this.data["imageType"];
@@ -1365,6 +1372,24 @@
 }
 
 /**
+ * @param {Array.<number>} quad
+ * @return {number}
+ */
+WebInspector.TimelinePresentationModel.quadWidth = function(quad)
+{
+    return Math.round(Math.sqrt(Math.pow(quad[0] - quad[2], 2) + Math.pow(quad[1] - quad[3], 2)));
+}
+
+/**
+ * @param {Array.<number>} quad
+ * @return {number}
+ */
+WebInspector.TimelinePresentationModel.quadHeight = function(quad)
+{
+    return Math.round(Math.sqrt(Math.pow(quad[0] - quad[6], 2) + Math.pow(quad[1] - quad[7], 2)));
+}
+
+/**
  * @interface
  */
 WebInspector.TimelinePresentationModel.Filter = function()

Modified: trunk/Source/WebCore/page/FrameView.cpp (147203 => 147204)


--- trunk/Source/WebCore/page/FrameView.cpp	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/page/FrameView.cpp	2013-03-29 09:44:53 UTC (rev 147204)
@@ -3406,8 +3406,6 @@
     if (!frame())
         return;
 
-    InspectorInstrumentation::willPaint(m_frame.get());
-
     Document* document = m_frame->document();
 
 #ifndef NDEBUG
@@ -3439,6 +3437,8 @@
     if (needsLayout())
         return;
 
+    InspectorInstrumentation::willPaint(renderView);
+
     bool isTopLevelPainter = !sCurrentPaintTimeStamp;
     if (isTopLevelPainter)
         sCurrentPaintTimeStamp = currentTime();
@@ -3501,7 +3501,7 @@
     if (isTopLevelPainter)
         sCurrentPaintTimeStamp = 0;
 
-    InspectorInstrumentation::didPaint(m_frame.get(), p, rect);
+    InspectorInstrumentation::didPaint(renderView, p, rect);
 }
 
 void FrameView::setPaintBehavior(PaintBehavior behavior)

Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (147203 => 147204)


--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-03-29 09:33:41 UTC (rev 147203)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp	2013-03-29 09:44:53 UTC (rev 147204)
@@ -1897,8 +1897,7 @@
         || graphicsLayer == m_backgroundLayer.get()
         || graphicsLayer == m_maskLayer.get()
         || graphicsLayer == m_scrollingContentsLayer.get()) {
-        Frame* frame = m_owningLayer->renderer()->frame();
-        InspectorInstrumentation::willPaint(frame);
+        InspectorInstrumentation::willPaint(renderer());
 
         // The dirtyRect is in the coords of the painting root.
         IntRect dirtyRect = clip;
@@ -1909,9 +1908,9 @@
         paintIntoLayer(graphicsLayer, &context, dirtyRect, PaintBehaviorNormal, paintingPhase);
 
         if (m_usingTiledCacheLayer)
-            frame->view()->setLastPaintTime(currentTime());
+            renderer()->frame()->view()->setLastPaintTime(currentTime());
 
-        InspectorInstrumentation::didPaint(frame, &context, clip);
+        InspectorInstrumentation::didPaint(renderer(), &context, clip);
     } else if (graphicsLayer == layerForHorizontalScrollbar()) {
         paintScrollbar(m_owningLayer->horizontalScrollbar(), context, clip);
     } else if (graphicsLayer == layerForVerticalScrollbar()) {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to