Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(40)

Side by Side Diff: Source/core/frame/FrameView.cpp

Issue 168193002: Fix compositing chicken and egg problem in updateControlTints. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: add protectors Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate. 2620 // We do a "fake" paint, and when the theme gets a paint call, it can then d o an invalidate.
2621 // This is only done if the theme supports control tinting. It's up to the t heme and platform 2621 // This is only done if the theme supports control tinting. It's up to the t heme and platform
2622 // to define when controls get the tint and to call this function when that changes. 2622 // to define when controls get the tint and to call this function when that changes.
2623 2623
2624 // Optimize the common case where we bring a window to the front while it's still empty. 2624 // Optimize the common case where we bring a window to the front while it's still empty.
2625 if (m_frame->document()->url().isEmpty()) 2625 if (m_frame->document()->url().isEmpty())
2626 return; 2626 return;
2627 2627
2628 // FIXME: Why do we need this for hasCustomScrollbars? 2628 // FIXME: Why do we need this for hasCustomScrollbars?
2629 // FIXME: supportsControlTints is currently true for a bunch of platforms. 2629 // FIXME: supportsControlTints is currently true for a bunch of platforms.
2630 // It should only be for Mac 10.6.
2631 if (!RenderTheme::theme().supportsControlTints() && !hasCustomScrollbars()) 2630 if (!RenderTheme::theme().supportsControlTints() && !hasCustomScrollbars())
2632 return; 2631 return;
2633 2632
2634 if (needsLayout()) 2633 // Updating layout can run script, which can tear down the FrameView.
2635 layout(); 2634 RefPtr<FrameView> protector(this);
2635 updateLayoutAndStyleForPainting();
2636
2636 // FIXME: The use of paint seems like overkill: crbug.com/236892 2637 // FIXME: The use of paint seems like overkill: crbug.com/236892
2637 GraphicsContext context(0); // NULL canvas to get a non-painting context. 2638 GraphicsContext context(0); // NULL canvas to get a non-painting context.
2638 context.setUpdatingControlTints(true); 2639 context.setUpdatingControlTints(true);
2639 paint(&context, frameRect()); 2640 paint(&context, frameRect());
2640 } 2641 }
2641 2642
2642 bool FrameView::wasScrolledByUser() const 2643 bool FrameView::wasScrolledByUser() const
2643 { 2644 {
2644 return m_wasScrolledByUser; 2645 return m_wasScrolledByUser;
2645 } 2646 }
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2771 return; 2772 return;
2772 2773
2773 if (isMainFrame()) { 2774 if (isMainFrame()) {
2774 if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect)) 2775 if (m_frame->page()->chrome().client().paintCustomOverhangArea(context, horizontalOverhangArea, verticalOverhangArea, dirtyRect))
2775 return; 2776 return;
2776 } 2777 }
2777 2778
2778 ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOver hangArea, dirtyRect); 2779 ScrollView::paintOverhangAreas(context, horizontalOverhangArea, verticalOver hangArea, dirtyRect);
2779 } 2780 }
2780 2781
2782 void FrameView::updateLayoutAndStyleForPainting()
2783 {
2784 // Updating layout can run script, which can tear down the FrameView.
2785 RefPtr<FrameView> protector(this);
2786
2787 updateLayoutAndStyleIfNeededRecursive();
2788 if (RenderView* view = renderView())
2789 view->compositor()->updateCompositingLayers();
2790 }
2791
2781 void FrameView::updateLayoutAndStyleIfNeededRecursive() 2792 void FrameView::updateLayoutAndStyleIfNeededRecursive()
2782 { 2793 {
2783 // We have to crawl our entire tree looking for any FrameViews that need 2794 // We have to crawl our entire tree looking for any FrameViews that need
2784 // layout and make sure they are up to date. 2795 // layout and make sure they are up to date.
2785 // Mac actually tests for intersection with the dirty region and tries not t o 2796 // Mac actually tests for intersection with the dirty region and tries not t o
2786 // update layout for frames that are outside the dirty region. Not only doe s this seem 2797 // update layout for frames that are outside the dirty region. Not only doe s this seem
2787 // pointless (since those frames will have set a zero timer to layout anyway ), but 2798 // pointless (since those frames will have set a zero timer to layout anyway ), but
2788 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty 2799 // it is also incorrect, since if two frames overlap, the first could be exc luded from the dirty
2789 // region but then become included later by the second frame adding rects to the dirty region 2800 // region but then become included later by the second frame adding rects to the dirty region
2790 // when it lays out. 2801 // when it lays out.
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation) 3214 void FrameView::willRemoveScrollbar(Scrollbar* scrollbar, ScrollbarOrientation o rientation)
3204 { 3215 {
3205 ScrollableArea::willRemoveScrollbar(scrollbar, orientation); 3216 ScrollableArea::willRemoveScrollbar(scrollbar, orientation);
3206 if (AXObjectCache* cache = axObjectCache()) { 3217 if (AXObjectCache* cache = axObjectCache()) {
3207 cache->remove(scrollbar); 3218 cache->remove(scrollbar);
3208 cache->handleScrollbarUpdate(this); 3219 cache->handleScrollbarUpdate(this);
3209 } 3220 }
3210 } 3221 }
3211 3222
3212 } // namespace WebCore 3223 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/frame/FrameView.h ('k') | Source/core/page/FocusController.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698