Title: [134577] trunk/Source/WebCore
Revision
134577
Author
pfeld...@chromium.org
Date
2012-11-14 01:57:24 -0800 (Wed, 14 Nov 2012)

Log Message

Web Inspector: highlight is not updating as one edits CSS properties
https://bugs.webkit.org/show_bug.cgi?id=102191

Reviewed by Alexander Pavlov.

We should update highlight upon layout / style recalculation.

* inspector/InspectorInstrumentation.cpp:
(WebCore):
(WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
* inspector/InspectorPageAgent.cpp:
(WebCore::InspectorPageAgent::InspectorPageAgent):
(WebCore::InspectorPageAgent::enable):
(WebCore::InspectorPageAgent::disable):
(WebCore::InspectorPageAgent::domContentEventFired):
(WebCore::InspectorPageAgent::didPaint):
(WebCore::InspectorPageAgent::didLayout):
(WebCore::InspectorPageAgent::didScroll):
(WebCore):
(WebCore::InspectorPageAgent::didRecalculateStyle):
* inspector/InspectorPageAgent.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134576 => 134577)


--- trunk/Source/WebCore/ChangeLog	2012-11-14 09:54:14 UTC (rev 134576)
+++ trunk/Source/WebCore/ChangeLog	2012-11-14 09:57:24 UTC (rev 134577)
@@ -1,3 +1,27 @@
+2012-11-14  Pavel Feldman  <pfeld...@chromium.org>
+
+        Web Inspector: highlight is not updating as one edits CSS properties
+        https://bugs.webkit.org/show_bug.cgi?id=102191
+
+        Reviewed by Alexander Pavlov.
+
+        We should update highlight upon layout / style recalculation.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore):
+        (WebCore::InspectorInstrumentation::didRecalculateStyleImpl):
+        * inspector/InspectorPageAgent.cpp:
+        (WebCore::InspectorPageAgent::InspectorPageAgent):
+        (WebCore::InspectorPageAgent::enable):
+        (WebCore::InspectorPageAgent::disable):
+        (WebCore::InspectorPageAgent::domContentEventFired):
+        (WebCore::InspectorPageAgent::didPaint):
+        (WebCore::InspectorPageAgent::didLayout):
+        (WebCore::InspectorPageAgent::didScroll):
+        (WebCore):
+        (WebCore::InspectorPageAgent::didRecalculateStyle):
+        * inspector/InspectorPageAgent.h:
+
 2012-11-14  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r134566.

Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (134576 => 134577)


--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-11-14 09:54:14 UTC (rev 134576)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp	2012-11-14 09:57:24 UTC (rev 134577)
@@ -557,6 +557,8 @@
         return;
     if (InspectorResourceAgent* resourceAgent = instrumentingAgents->inspectorResourceAgent())
         resourceAgent->didRecalculateStyle();
+    if (InspectorPageAgent* pageAgent = instrumentingAgents->inspectorPageAgent())
+        pageAgent->didRecalculateStyle();
 }
 
 void InspectorInstrumentation::didScheduleStyleRecalculationImpl(InstrumentingAgents* instrumentingAgents, Document* document)

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.cpp (134576 => 134577)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-11-14 09:54:14 UTC (rev 134576)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.cpp	2012-11-14 09:57:24 UTC (rev 134577)
@@ -331,7 +331,8 @@
     , m_frontend(0)
     , m_overlay(overlay)
     , m_lastScriptIdentifier(0)
-    , m_didLoadEventFire(false)
+    , m_enabled(false)
+    , m_isFirstLayoutAfterOnLoad(false)
     , m_geolocationOverridden(false)
 {
 }
@@ -364,6 +365,7 @@
 
 void InspectorPageAgent::enable(ErrorString*)
 {
+    m_enabled = true;
     m_state->setBoolean(PageAgentState::pageAgentEnabled, true);
     bool scriptExecutionDisabled = m_state->getBoolean(PageAgentState::pageAgentScriptExecutionDisabled);
     setScriptExecutionDisabled(0, scriptExecutionDisabled);
@@ -374,6 +376,7 @@
 
 void InspectorPageAgent::disable(ErrorString*)
 {
+    m_enabled = false;
     m_state->setBoolean(PageAgentState::pageAgentEnabled, false);
     m_instrumentingAgents->setInspectorPageAgent(0);
 
@@ -788,7 +791,7 @@
 
 void InspectorPageAgent::domContentEventFired()
 {
-    m_didLoadEventFire = true;
+    m_isFirstLayoutAfterOnLoad = true;
     m_frontend->domContentEventFired(currentTime());
 }
 
@@ -894,7 +897,7 @@
 
 void InspectorPageAgent::didPaint(GraphicsContext* context, const LayoutRect& rect)
 {
-    if (!m_state->getBoolean(PageAgentState::showPaintRects))
+    if (!m_enabled || !m_state->getBoolean(PageAgentState::showPaintRects))
         return;
 
     static int colorSelector = 0;
@@ -911,23 +914,35 @@
 
 void InspectorPageAgent::didLayout()
 {
-    if (!m_didLoadEventFire)
+    bool isFirstLayout = m_isFirstLayoutAfterOnLoad;
+    if (isFirstLayout)
+        m_isFirstLayoutAfterOnLoad = false;
+
+    if (!m_enabled)
         return;
 
-    m_didLoadEventFire = false;
-    int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
-    int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
+    if (isFirstLayout) {
+        int currentWidth = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride));
+        int currentHeight = static_cast<int>(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride));
 
-    if (currentWidth && currentHeight)
-        m_client->autoZoomPageToFitWidth();
+        if (currentWidth && currentHeight)
+            m_client->autoZoomPageToFitWidth();
+    }
     m_overlay->update();
 }
 
 void InspectorPageAgent::didScroll()
 {
-    m_overlay->update();
+    if (m_enabled)
+        m_overlay->update();
 }
 
+void InspectorPageAgent::didRecalculateStyle()
+{
+    if (m_enabled)
+        m_overlay->update();
+}
+
 PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Frame* frame)
 {
     RefPtr<TypeBuilder::Page::Frame> frameObject = TypeBuilder::Page::Frame::create()

Modified: trunk/Source/WebCore/inspector/InspectorPageAgent.h (134576 => 134577)


--- trunk/Source/WebCore/inspector/InspectorPageAgent.h	2012-11-14 09:54:14 UTC (rev 134576)
+++ trunk/Source/WebCore/inspector/InspectorPageAgent.h	2012-11-14 09:57:24 UTC (rev 134577)
@@ -141,6 +141,7 @@
     void didPaint(GraphicsContext*, const LayoutRect&);
     void didLayout();
     void didScroll();
+    void didRecalculateStyle();
 
     // Inspector Controller API
     virtual void setFrontend(InspectorFrontend*);
@@ -180,7 +181,8 @@
     HashMap<Frame*, String> m_frameToIdentifier;
     HashMap<String, Frame*> m_identifierToFrame;
     HashMap<DocumentLoader*, String> m_loaderToIdentifier;
-    bool m_didLoadEventFire;
+    bool m_enabled;
+    bool m_isFirstLayoutAfterOnLoad;
     bool m_geolocationOverridden;
     RefPtr<GeolocationPosition> m_geolocationPosition;
     RefPtr<GeolocationPosition> m_platformGeolocationPosition;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to