| 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 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 660 { | 660 { |
| 661 paintContents(context, rect); | 661 paintContents(context, rect); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) | 664 void FrameView::paintContents(GraphicsContext* p, const IntRect& rect) |
| 665 { | 665 { |
| 666 #ifndef NDEBUG | 666 #ifndef NDEBUG |
| 667 bool fillWithRed; | 667 bool fillWithRed; |
| 668 if (isTransparent()) | 668 if (isTransparent()) |
| 669 fillWithRed = false; // Transparent, don't fill with red. | 669 fillWithRed = false; // Transparent, don't fill with red. |
| 670 else if (m_nodeToDraw) | |
| 671 fillWithRed = false; // Element images are transparent, don't fill with
red. | |
| 672 else | 670 else |
| 673 fillWithRed = true; | 671 fillWithRed = true; |
| 674 | 672 |
| 675 if (fillWithRed) | 673 if (fillWithRed) |
| 676 p->fillRect(rect, Color(0xFF, 0, 0)); | 674 p->fillRect(rect, Color(0xFF, 0, 0)); |
| 677 #endif | 675 #endif |
| 678 | 676 |
| 679 RenderView* renderView = this->renderView(); | 677 RenderView* renderView = this->renderView(); |
| 680 if (!renderView) { | 678 if (!renderView) { |
| 681 WTF_LOG_ERROR("called FrameView::paint with nil renderer"); | 679 WTF_LOG_ERROR("called FrameView::paint with nil renderer"); |
| 682 return; | 680 return; |
| 683 } | 681 } |
| 684 | 682 |
| 685 RELEASE_ASSERT(!needsLayout()); | 683 RELEASE_ASSERT(!needsLayout()); |
| 686 ASSERT(m_frame->document()->lifecycle().state() >= DocumentLifecycle::StyleA
ndLayoutClean); | 684 ASSERT(m_frame->document()->lifecycle().state() >= DocumentLifecycle::StyleA
ndLayoutClean); |
| 687 | 685 |
| 688 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(renderView, rect)); | 686 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Paint", "data"
, InspectorPaintEvent::data(renderView, rect)); |
| 689 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); | 687 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline.stack"), "
CallStack", TRACE_EVENT_SCOPE_PROCESS, "stack", InspectorCallStackEvent::current
CallStack()); |
| 690 | 688 |
| 691 bool isTopLevelPainter = !s_inPaintContents; | 689 bool isTopLevelPainter = !s_inPaintContents; |
| 692 s_inPaintContents = true; | 690 s_inPaintContents = true; |
| 693 | 691 |
| 694 FontCachePurgePreventer fontCachePurgePreventer; | 692 FontCachePurgePreventer fontCachePurgePreventer; |
| 695 | 693 |
| 696 ASSERT(!m_isPainting); | 694 ASSERT(!m_isPainting); |
| 697 m_isPainting = true; | 695 m_isPainting = true; |
| 698 | 696 |
| 699 // m_nodeToDraw is used to draw only one element (and its descendants) | |
| 700 RenderObject* renderer = m_nodeToDraw ? m_nodeToDraw->renderer() : 0; | |
| 701 RenderLayer* rootLayer = renderView->layer(); | 697 RenderLayer* rootLayer = renderView->layer(); |
| 702 | 698 |
| 703 #if ENABLE(ASSERT) | 699 #if ENABLE(ASSERT) |
| 704 renderView->assertSubtreeIsLaidOut(); | 700 renderView->assertSubtreeIsLaidOut(); |
| 705 RenderObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>renderer()); | 701 RenderObject::SetLayoutNeededForbiddenScope forbidSetNeedsLayout(*rootLayer-
>renderer()); |
| 706 #endif | 702 #endif |
| 707 | 703 |
| 708 rootLayer->paint(p, rect, renderer); | 704 rootLayer->paint(p, rect); |
| 709 | 705 |
| 710 m_isPainting = false; | 706 m_isPainting = false; |
| 711 m_lastPaintTime = currentTime(); | 707 m_lastPaintTime = currentTime(); |
| 712 | 708 |
| 713 if (isTopLevelPainter) { | 709 if (isTopLevelPainter) { |
| 714 // Everything that happens after paintContents completions is considered | 710 // Everything that happens after paintContents completions is considered |
| 715 // to be part of the next frame. | 711 // to be part of the next frame. |
| 716 s_currentFrameTimeStamp = currentTime(); | 712 s_currentFrameTimeStamp = currentTime(); |
| 717 s_inPaintContents = false; | 713 s_inPaintContents = false; |
| 718 } | 714 } |
| 719 } | 715 } |
| 720 | 716 |
| 721 bool FrameView::isPainting() const | 717 bool FrameView::isPainting() const |
| 722 { | 718 { |
| 723 return m_isPainting; | 719 return m_isPainting; |
| 724 } | 720 } |
| 725 | 721 |
| 726 void FrameView::setNodeToDraw(Node* node) | |
| 727 { | |
| 728 m_nodeToDraw = node; | |
| 729 } | |
| 730 | |
| 731 void FrameView::updateLayoutAndStyleForPainting() | 722 void FrameView::updateLayoutAndStyleForPainting() |
| 732 { | 723 { |
| 733 // Updating layout can run script, which can tear down the FrameView. | 724 // Updating layout can run script, which can tear down the FrameView. |
| 734 RefPtr<FrameView> protector(this); | 725 RefPtr<FrameView> protector(this); |
| 735 | 726 |
| 736 updateLayoutAndStyleIfNeededRecursive(); | 727 updateLayoutAndStyleIfNeededRecursive(); |
| 737 | 728 |
| 738 if (RenderView* view = renderView()) { | 729 if (RenderView* view = renderView()) { |
| 739 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "up
dateIFramesAfterLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); | 730 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "up
dateIFramesAfterLayout", TRACE_EVENT_SCOPE_PROCESS, "frame", m_frame.get()); |
| 740 view->updateIFramesAfterLayout(); | 731 view->updateIFramesAfterLayout(); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 totalObjects = 0; | 833 totalObjects = 0; |
| 843 | 834 |
| 844 for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) { | 835 for (RenderObject* o = root; o; o = o->nextInPreOrder(root)) { |
| 845 ++totalObjects; | 836 ++totalObjects; |
| 846 if (o->needsLayout()) | 837 if (o->needsLayout()) |
| 847 ++needsLayoutObjects; | 838 ++needsLayoutObjects; |
| 848 } | 839 } |
| 849 } | 840 } |
| 850 | 841 |
| 851 } // namespace blink | 842 } // namespace blink |
| OLD | NEW |