| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "sky/engine/core/animation/DocumentAnimations.h" | 31 #include "sky/engine/core/animation/DocumentAnimations.h" |
| 32 #include "sky/engine/core/css/FontFaceSet.h" | 32 #include "sky/engine/core/css/FontFaceSet.h" |
| 33 #include "sky/engine/core/css/resolver/StyleResolver.h" | 33 #include "sky/engine/core/css/resolver/StyleResolver.h" |
| 34 #include "sky/engine/core/dom/DocumentMarkerController.h" | 34 #include "sky/engine/core/dom/DocumentMarkerController.h" |
| 35 #include "sky/engine/core/editing/FrameSelection.h" | 35 #include "sky/engine/core/editing/FrameSelection.h" |
| 36 #include "sky/engine/core/fetch/ResourceFetcher.h" | 36 #include "sky/engine/core/fetch/ResourceFetcher.h" |
| 37 #include "sky/engine/core/frame/FrameHost.h" | 37 #include "sky/engine/core/frame/FrameHost.h" |
| 38 #include "sky/engine/core/frame/LocalFrame.h" | 38 #include "sky/engine/core/frame/LocalFrame.h" |
| 39 #include "sky/engine/core/frame/Settings.h" | 39 #include "sky/engine/core/frame/Settings.h" |
| 40 #include "sky/engine/core/html/parser/TextResourceDecoder.h" | 40 #include "sky/engine/core/html/parser/TextResourceDecoder.h" |
| 41 #include "sky/engine/core/inspector/InspectorTraceEvents.h" | |
| 42 #include "sky/engine/core/loader/FrameLoaderClient.h" | 41 #include "sky/engine/core/loader/FrameLoaderClient.h" |
| 43 #include "sky/engine/core/page/ChromeClient.h" | 42 #include "sky/engine/core/page/ChromeClient.h" |
| 44 #include "sky/engine/core/page/EventHandler.h" | 43 #include "sky/engine/core/page/EventHandler.h" |
| 45 #include "sky/engine/core/page/FocusController.h" | 44 #include "sky/engine/core/page/FocusController.h" |
| 46 #include "sky/engine/core/page/Page.h" | 45 #include "sky/engine/core/page/Page.h" |
| 47 #include "sky/engine/core/rendering/RenderLayer.h" | 46 #include "sky/engine/core/rendering/RenderLayer.h" |
| 48 #include "sky/engine/core/rendering/RenderView.h" | 47 #include "sky/engine/core/rendering/RenderView.h" |
| 49 #include "sky/engine/core/rendering/style/RenderStyle.h" | 48 #include "sky/engine/core/rendering/style/RenderStyle.h" |
| 50 #include "sky/engine/platform/ScriptForbiddenScope.h" | 49 #include "sky/engine/platform/ScriptForbiddenScope.h" |
| 51 #include "sky/engine/platform/TraceEvent.h" | 50 #include "sky/engine/platform/TraceEvent.h" |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); | 279 TRACE_EVENT_SCOPED_SAMPLING_STATE("blink", "Layout"); |
| 281 | 280 |
| 282 // Protect the view from being deleted during layout (in recalcStyle) | 281 // Protect the view from being deleted during layout (in recalcStyle) |
| 283 RefPtr<FrameView> protector(this); | 282 RefPtr<FrameView> protector(this); |
| 284 | 283 |
| 285 m_hasPendingLayout = false; | 284 m_hasPendingLayout = false; |
| 286 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); | 285 DocumentLifecycle::Scope lifecycleScope(lifecycle(), DocumentLifecycle::Layo
utClean); |
| 287 | 286 |
| 288 RELEASE_ASSERT(!isPainting()); | 287 RELEASE_ASSERT(!isPainting()); |
| 289 | 288 |
| 290 TRACE_EVENT_BEGIN1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout",
"beginData", InspectorLayoutEvent::beginData(this)); | |
| 291 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | |
| 292 | |
| 293 if (!allowSubtree && isSubtreeLayout()) { | 289 if (!allowSubtree && isSubtreeLayout()) { |
| 294 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 290 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
| 295 m_layoutSubtreeRoot = 0; | 291 m_layoutSubtreeRoot = 0; |
| 296 } | 292 } |
| 297 | 293 |
| 298 performPreLayoutTasks(); | 294 performPreLayoutTasks(); |
| 299 | 295 |
| 300 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, | 296 // If there is only one ref to this view left, then its going to be destroye
d as soon as we exit, |
| 301 // so there's no point to continuing to layout | 297 // so there's no point to continuing to layout |
| 302 if (protector->hasOneRef()) | 298 if (protector->hasOneRef()) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 } // Reset m_layoutSchedulingEnabled to its previous value. | 332 } // Reset m_layoutSchedulingEnabled to its previous value. |
| 337 | 333 |
| 338 layer->updateLayerPositionsAfterLayout(); | 334 layer->updateLayerPositionsAfterLayout(); |
| 339 | 335 |
| 340 m_layoutCount++; | 336 m_layoutCount++; |
| 341 | 337 |
| 342 ASSERT(!rootForThisLayout->needsLayout()); | 338 ASSERT(!rootForThisLayout->needsLayout()); |
| 343 | 339 |
| 344 scheduleOrPerformPostLayoutTasks(); | 340 scheduleOrPerformPostLayoutTasks(); |
| 345 | 341 |
| 346 TRACE_EVENT_END1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Layout", "
endData", InspectorLayoutEvent::endData(rootForThisLayout)); | |
| 347 | |
| 348 m_nestedLayoutCount--; | 342 m_nestedLayoutCount--; |
| 349 if (m_nestedLayoutCount) | 343 if (m_nestedLayoutCount) |
| 350 return; | 344 return; |
| 351 | 345 |
| 352 #if ENABLE(ASSERT) | 346 #if ENABLE(ASSERT) |
| 353 // Post-layout assert that nobody was re-marked as needing layout during lay
out. | 347 // Post-layout assert that nobody was re-marked as needing layout during lay
out. |
| 354 document->renderView()->assertSubtreeIsLaidOut(); | 348 document->renderView()->assertSubtreeIsLaidOut(); |
| 355 #endif | 349 #endif |
| 356 } | 350 } |
| 357 | 351 |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 if (isSubtreeLayout()) { | 406 if (isSubtreeLayout()) { |
| 413 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); | 407 m_layoutSubtreeRoot->markContainingBlocksForLayout(false); |
| 414 m_layoutSubtreeRoot = 0; | 408 m_layoutSubtreeRoot = 0; |
| 415 } | 409 } |
| 416 if (!m_layoutSchedulingEnabled) | 410 if (!m_layoutSchedulingEnabled) |
| 417 return; | 411 return; |
| 418 if (!needsLayout()) | 412 if (!needsLayout()) |
| 419 return; | 413 return; |
| 420 if (!m_frame->document()->isActive()) | 414 if (!m_frame->document()->isActive()) |
| 421 return; | 415 return; |
| 422 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); | |
| 423 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | |
| 424 | 416 |
| 425 if (m_hasPendingLayout) | 417 if (m_hasPendingLayout) |
| 426 return; | 418 return; |
| 427 m_hasPendingLayout = true; | 419 m_hasPendingLayout = true; |
| 428 | 420 |
| 429 m_frame->document()->scheduleVisualUpdate(); | 421 m_frame->document()->scheduleVisualUpdate(); |
| 430 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 422 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
| 431 } | 423 } |
| 432 | 424 |
| 433 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) | 425 static bool isObjectAncestorContainerOf(RenderObject* ancestor, RenderObject* de
scendant) |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 } | 465 } |
| 474 } | 466 } |
| 475 } else if (m_layoutSchedulingEnabled) { | 467 } else if (m_layoutSchedulingEnabled) { |
| 476 m_layoutSubtreeRoot = relayoutRoot; | 468 m_layoutSubtreeRoot = relayoutRoot; |
| 477 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); | 469 ASSERT(!m_layoutSubtreeRoot->container() || !m_layoutSubtreeRoot->contai
ner()->needsLayout()); |
| 478 m_hasPendingLayout = true; | 470 m_hasPendingLayout = true; |
| 479 | 471 |
| 480 m_frame->document()->scheduleVisualUpdate(); | 472 m_frame->document()->scheduleVisualUpdate(); |
| 481 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); | 473 lifecycle().ensureStateAtMost(DocumentLifecycle::StyleClean); |
| 482 } | 474 } |
| 483 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Invali
dateLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); | |
| 484 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | |
| 485 } | 475 } |
| 486 | 476 |
| 487 bool FrameView::layoutPending() const | 477 bool FrameView::layoutPending() const |
| 488 { | 478 { |
| 489 // FIXME: This should check Document::lifecycle instead. | 479 // FIXME: This should check Document::lifecycle instead. |
| 490 return m_hasPendingLayout; | 480 return m_hasPendingLayout; |
| 491 } | 481 } |
| 492 | 482 |
| 493 bool FrameView::isInPerformLayout() const | 483 bool FrameView::isInPerformLayout() const |
| 494 { | 484 { |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 676 | 666 |
| 677 RenderView* renderView = this->renderView(); | 667 RenderView* renderView = this->renderView(); |
| 678 if (!renderView) { | 668 if (!renderView) { |
| 679 WTF_LOG_ERROR("called FrameView::paint with nil renderer"); | 669 WTF_LOG_ERROR("called FrameView::paint with nil renderer"); |
| 680 return; | 670 return; |
| 681 } | 671 } |
| 682 | 672 |
| 683 RELEASE_ASSERT(!needsLayout()); | 673 RELEASE_ASSERT(!needsLayout()); |
| 684 ASSERT(m_frame->document()->lifecycle().state() >= DocumentLifecycle::StyleA
ndLayoutClean); | 674 ASSERT(m_frame->document()->lifecycle().state() >= DocumentLifecycle::StyleA
ndLayoutClean); |
| 685 | 675 |
| 686 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(renderView, rect)); | |
| 687 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | |
| 688 | |
| 689 bool isTopLevelPainter = !s_inPaintContents; | 676 bool isTopLevelPainter = !s_inPaintContents; |
| 690 s_inPaintContents = true; | 677 s_inPaintContents = true; |
| 691 | 678 |
| 692 FontCachePurgePreventer fontCachePurgePreventer; | 679 FontCachePurgePreventer fontCachePurgePreventer; |
| 693 | 680 |
| 694 ASSERT(!m_isPainting); | 681 ASSERT(!m_isPainting); |
| 695 m_isPainting = true; | 682 m_isPainting = true; |
| 696 | 683 |
| 697 RenderLayer* rootLayer = renderView->layer(); | 684 RenderLayer* rootLayer = renderView->layer(); |
| 698 | 685 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 719 return m_isPainting; | 706 return m_isPainting; |
| 720 } | 707 } |
| 721 | 708 |
| 722 void FrameView::updateLayoutAndStyleForPainting() | 709 void FrameView::updateLayoutAndStyleForPainting() |
| 723 { | 710 { |
| 724 // Updating layout can run script, which can tear down the FrameView. | 711 // Updating layout can run script, which can tear down the FrameView. |
| 725 RefPtr<FrameView> protector(this); | 712 RefPtr<FrameView> protector(this); |
| 726 | 713 |
| 727 updateLayoutAndStyleIfNeededRecursive(); | 714 updateLayoutAndStyleIfNeededRecursive(); |
| 728 | 715 |
| 729 if (RenderView* view = renderView()) { | 716 if (RenderView* view = renderView()) |
| 730 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "up
dateIFramesAfterLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); | |
| 731 view->updateIFramesAfterLayout(); | 717 view->updateIFramesAfterLayout(); |
| 732 } | |
| 733 | 718 |
| 734 // TODO(ojan): Get rid of this and just have the LayoutClean state. | 719 // TODO(ojan): Get rid of this and just have the LayoutClean state. |
| 735 lifecycle().advanceTo(DocumentLifecycle::StyleAndLayoutClean); | 720 lifecycle().advanceTo(DocumentLifecycle::StyleAndLayoutClean); |
| 736 | 721 |
| 737 DocumentAnimations::startPendingAnimations(*m_frame->document()); | 722 DocumentAnimations::startPendingAnimations(*m_frame->document()); |
| 738 } | 723 } |
| 739 | 724 |
| 740 void FrameView::updateLayoutAndStyleIfNeededRecursive() | 725 void FrameView::updateLayoutAndStyleIfNeededRecursive() |
| 741 { | 726 { |
| 742 // We have to crawl our entire tree looking for any FrameViews that need | 727 // We have to crawl our entire tree looking for any FrameViews that need |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 833 totalObjects = 0; | 818 totalObjects = 0; |
| 834 | 819 |
| 835 for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) { | 820 for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) { |
| 836 ++totalObjects; | 821 ++totalObjects; |
| 837 if (o->needsLayout()) | 822 if (o->needsLayout()) |
| 838 ++needsLayoutObjects; | 823 ++needsLayoutObjects; |
| 839 } | 824 } |
| 840 } | 825 } |
| 841 | 826 |
| 842 } // namespace blink | 827 } // namespace blink |
| OLD | NEW |