| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 338 InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client) | 338 InspectorOverlay::InspectorOverlay(Page* page, InspectorClient* client) |
| 339 : m_page(page) | 339 : m_page(page) |
| 340 , m_client(client) | 340 , m_client(client) |
| 341 , m_inspectModeEnabled(false) | 341 , m_inspectModeEnabled(false) |
| 342 , m_overlayHost(InspectorOverlayHost::create()) | 342 , m_overlayHost(InspectorOverlayHost::create()) |
| 343 , m_drawViewSize(false) | 343 , m_drawViewSize(false) |
| 344 , m_drawViewSizeWithGrid(false) | 344 , m_drawViewSizeWithGrid(false) |
| 345 , m_omitTooltip(false) | 345 , m_omitTooltip(false) |
| 346 , m_timer(this, &InspectorOverlay::onTimer) | 346 , m_timer(this, &InspectorOverlay::onTimer) |
| 347 , m_activeProfilerCount(0) | 347 , m_activeProfilerCount(0) |
| 348 , m_updating(false) |
| 348 { | 349 { |
| 349 } | 350 } |
| 350 | 351 |
| 351 InspectorOverlay::~InspectorOverlay() | 352 InspectorOverlay::~InspectorOverlay() |
| 352 { | 353 { |
| 353 ASSERT(!m_overlayPage); | 354 ASSERT(!m_overlayPage); |
| 354 } | 355 } |
| 355 | 356 |
| 356 void InspectorOverlay::paint(GraphicsContext& context) | 357 void InspectorOverlay::paint(GraphicsContext& context) |
| 357 { | 358 { |
| 358 if (isEmpty()) | 359 if (isEmpty()) |
| 359 return; | 360 return; |
| 360 GraphicsContextStateSaver stateSaver(context); | 361 GraphicsContextStateSaver stateSaver(context); |
| 361 FrameView* view = toLocalFrame(overlayPage()->mainFrame())->view(); | 362 FrameView* view = toLocalFrame(overlayPage()->mainFrame())->view(); |
| 362 ASSERT(!view->needsLayout()); | 363 ASSERT(!view->needsLayout()); |
| 363 view->paint(&context, IntRect(0, 0, view->width(), view->height())); | 364 view->paint(&context, IntRect(0, 0, view->width(), view->height())); |
| 364 } | 365 } |
| 365 | 366 |
| 366 void InspectorOverlay::invalidate() | 367 void InspectorOverlay::invalidate() |
| 367 { | 368 { |
| 369 // Don't invalidate during an update, because that will lead to Document::sc
heduleRenderTreeUpdate |
| 370 // being called within Document::updateRenderTree which violates document li
fecycle expectations. |
| 371 if (m_updating) |
| 372 return; |
| 373 |
| 368 m_client->highlight(); | 374 m_client->highlight(); |
| 369 } | 375 } |
| 370 | 376 |
| 371 bool InspectorOverlay::handleGestureEvent(const PlatformGestureEvent& event) | 377 bool InspectorOverlay::handleGestureEvent(const PlatformGestureEvent& event) |
| 372 { | 378 { |
| 373 if (isEmpty()) | 379 if (isEmpty()) |
| 374 return false; | 380 return false; |
| 375 | 381 |
| 376 return toLocalFrame(overlayPage()->mainFrame())->eventHandler().handleGestur
eEvent(event); | 382 return toLocalFrame(overlayPage()->mainFrame())->eventHandler().handleGestur
eEvent(event); |
| 377 } | 383 } |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 { | 476 { |
| 471 if (m_activeProfilerCount) | 477 if (m_activeProfilerCount) |
| 472 return true; | 478 return true; |
| 473 bool hasAlwaysVisibleElements = m_highlightNode || m_eventTargetNode || m_hi
ghlightQuad || m_drawViewSize; | 479 bool hasAlwaysVisibleElements = m_highlightNode || m_eventTargetNode || m_hi
ghlightQuad || m_drawViewSize; |
| 474 bool hasInvisibleInInspectModeElements = !m_pausedInDebuggerMessage.isNull()
; | 480 bool hasInvisibleInInspectModeElements = !m_pausedInDebuggerMessage.isNull()
; |
| 475 return !(hasAlwaysVisibleElements || (hasInvisibleInInspectModeElements && !
m_inspectModeEnabled)); | 481 return !(hasAlwaysVisibleElements || (hasInvisibleInInspectModeElements && !
m_inspectModeEnabled)); |
| 476 } | 482 } |
| 477 | 483 |
| 478 void InspectorOverlay::update() | 484 void InspectorOverlay::update() |
| 479 { | 485 { |
| 486 TemporaryChange<bool> scoped(m_updating, true); |
| 487 |
| 480 if (isEmpty()) { | 488 if (isEmpty()) { |
| 481 m_client->hideHighlight(); | 489 m_client->hideHighlight(); |
| 482 return; | 490 return; |
| 483 } | 491 } |
| 484 | 492 |
| 485 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); | 493 FrameView* view = m_page->deprecatedLocalMainFrame()->view(); |
| 486 if (!view) | 494 if (!view) |
| 487 return; | 495 return; |
| 488 | 496 |
| 489 // Include scrollbars to avoid masking them by the gutter. | 497 // Include scrollbars to avoid masking them by the gutter. |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 870 hideHighlight(); | 878 hideHighlight(); |
| 871 } | 879 } |
| 872 | 880 |
| 873 void InspectorOverlay::startedRecordingProfile() | 881 void InspectorOverlay::startedRecordingProfile() |
| 874 { | 882 { |
| 875 if (!m_activeProfilerCount++) | 883 if (!m_activeProfilerCount++) |
| 876 freePage(); | 884 freePage(); |
| 877 } | 885 } |
| 878 | 886 |
| 879 } // namespace blink | 887 } // namespace blink |
| OLD | NEW |