Index: Source/WebCore/inspector/InspectorPageAgent.cpp |
=================================================================== |
--- Source/WebCore/inspector/InspectorPageAgent.cpp (revision 135283) |
+++ Source/WebCore/inspector/InspectorPageAgent.cpp (working copy) |
@@ -330,7 +330,8 @@ |
, m_frontend(0) |
, m_overlay(overlay) |
, m_lastScriptIdentifier(0) |
- , m_didLoadEventFire(false) |
+ , m_enabled(false) |
+ , m_isFirstLayoutAfterOnLoad(false) |
, m_geolocationOverridden(false) |
{ |
} |
@@ -371,12 +372,14 @@ |
void InspectorPageAgent::enable(ErrorString*) |
{ |
+ m_enabled = true; |
m_state->setBoolean(PageAgentState::pageAgentEnabled, true); |
m_instrumentingAgents->setInspectorPageAgent(this); |
} |
void InspectorPageAgent::disable(ErrorString*) |
{ |
+ m_enabled = false; |
m_state->setBoolean(PageAgentState::pageAgentEnabled, false); |
m_instrumentingAgents->setInspectorPageAgent(0); |
@@ -776,7 +779,7 @@ |
void InspectorPageAgent::domContentEventFired() |
{ |
- m_didLoadEventFire = true; |
+ m_isFirstLayoutAfterOnLoad = true; |
m_frontend->domContentEventFired(currentTime()); |
} |
@@ -882,7 +885,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; |
@@ -899,23 +902,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() |