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

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

Issue 1413523007: Simplify computation of the invalidation rect for a frame. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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
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 2003 matching lines...) Expand 10 before | Expand all | Expand 10 after
2014 continue; 2014 continue;
2015 2015
2016 toLayoutCounter(layoutObject)->updateCounter(); 2016 toLayoutCounter(layoutObject)->updateCounter();
2017 } 2017 }
2018 } 2018 }
2019 2019
2020 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co nst 2020 IntRect FrameView::windowClipRect(IncludeScrollbarsInRect scrollbarInclusion) co nst
2021 { 2021 {
2022 ASSERT(m_frame->view() == this); 2022 ASSERT(m_frame->view() == this);
2023 2023
2024 // Set our clip rect to be our contents. 2024 LayoutRect clipRect(LayoutPoint(), LayoutSize(visibleContentSize(scrollbarIn clusion)));
2025 IntRect clipRect = contentsToRootFrame(visibleContentRect(scrollbarInclusion )); 2025 layoutView()->mapRectToPaintInvalidationBacking(layoutView()->containerForPa intInvalidation(), clipRect, nullptr);
2026 if (!m_frame->deprecatedLocalOwner()) 2026 return enclosingIntRect(clipRect);
2027 return clipRect;
2028
2029 // Take our owner element and get its clip rect.
2030 // FIXME: Do we need to do this for remote frames?
2031 HTMLFrameOwnerElement* ownerElement = m_frame->deprecatedLocalOwner();
2032 FrameView* parentView = ownerElement->document().view();
2033 if (parentView)
2034 clipRect.intersect(parentView->clipRectsForFrameOwner(ownerElement, null ptr));
2035 return clipRect;
2036 }
2037
2038 IntRect FrameView::clipRectsForFrameOwner(const HTMLFrameOwnerElement* ownerElem ent, IntRect* unobscuredRect) const
2039 {
2040 ASSERT(ownerElement);
2041
2042 if (unobscuredRect)
2043 *unobscuredRect = IntRect();
2044
2045 // The layoutObject can sometimes be null when style="display:none" interact s
2046 // with external content and plugins.
2047 if (!ownerElement->layoutObject())
2048 return windowClipRect();
2049
2050 // If we have no layer, just return our window clip rect.
2051 const PaintLayer* enclosingLayer = ownerElement->layoutObject()->enclosingLa yer();
2052 if (!enclosingLayer)
2053 return windowClipRect();
2054
2055 // FIXME: childrenClipRect relies on compositingState, which is not necessar ily up to date.
2056 // https://code.google.com/p/chromium/issues/detail?id=343769
2057 DisableCompositingQueryAsserts disabler;
2058
2059 // Apply the clip from the layer.
2060 IntRect elementRect = contentsToRootFrame(pixelSnappedIntRect(enclosingLayer ->clipper().childrenClipRect()));
2061
2062 if (unobscuredRect) {
2063 *unobscuredRect = elementRect;
2064
2065 // If element is not in root frame, clip to the local frame.
2066 // FIXME: Do we need to do this for remote frames?
2067 if (m_frame->deprecatedLocalOwner())
2068 unobscuredRect->intersect(contentsToRootFrame(visibleContentRect())) ;
2069 }
2070
2071 return intersection(elementRect, windowClipRect());
2072 } 2027 }
2073 2028
2074 bool FrameView::shouldUseIntegerScrollOffset() const 2029 bool FrameView::shouldUseIntegerScrollOffset() const
2075 { 2030 {
2076 if (m_frame->settings() && !m_frame->settings()->preferCompositingToLCDTextE nabled()) 2031 if (m_frame->settings() && !m_frame->settings()->preferCompositingToLCDTextE nabled())
2077 return true; 2032 return true;
2078 2033
2079 return ScrollableArea::shouldUseIntegerScrollOffset(); 2034 return ScrollableArea::shouldUseIntegerScrollOffset();
2080 } 2035 }
2081 2036
(...skipping 2004 matching lines...) Expand 10 before | Expand all | Expand 10 after
4086 } 4041 }
4087 4042
4088 bool FrameView::canThrottleRendering() const 4043 bool FrameView::canThrottleRendering() const
4089 { 4044 {
4090 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled()) 4045 if (!RuntimeEnabledFeatures::renderingPipelineThrottlingEnabled())
4091 return false; 4046 return false;
4092 return m_hiddenForThrottling && m_crossOriginForThrottling; 4047 return m_hiddenForThrottling && m_crossOriginForThrottling;
4093 } 4048 }
4094 4049
4095 } // namespace blink 4050 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698