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

Side by Side Diff: third_party/WebKit/Source/core/layout/PaintInvalidationState.cpp

Issue 2203123004: Don't adjust for scrolling of the ancestor, rather than un-adjusting for it later. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: none Created 4 years, 4 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/layout/PaintInvalidationState.h" 5 #include "core/layout/PaintInvalidationState.h"
6 6
7 #include "core/frame/FrameView.h" 7 #include "core/frame/FrameView.h"
8 #include "core/frame/LocalFrame.h" 8 #include "core/frame/LocalFrame.h"
9 #include "core/frame/Settings.h" 9 #include "core/frame/Settings.h"
10 #include "core/layout/LayoutInline.h" 10 #include "core/layout/LayoutInline.h"
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 193
194 if (position == FixedPosition) { 194 if (position == FixedPosition) {
195 if (m_paintInvalidationContainer != m_currentObject.view() && m_paintInv alidationContainer->view() == m_currentObject.view()) { 195 if (m_paintInvalidationContainer != m_currentObject.view() && m_paintInv alidationContainer->view() == m_currentObject.view()) {
196 // TODO(crbug.com/598762): localToAncestorPoint() is incorrect for f ixed-position when paintInvalidationContainer 196 // TODO(crbug.com/598762): localToAncestorPoint() is incorrect for f ixed-position when paintInvalidationContainer
197 // is under the containing LayoutView. 197 // is under the containing LayoutView.
198 m_cachedOffsetsEnabled = false; 198 m_cachedOffsetsEnabled = false;
199 return; 199 return;
200 } 200 }
201 // Use slow path to get the offset of the fixed-position, and enable fas t path for descendants. 201 // Use slow path to get the offset of the fixed-position, and enable fas t path for descendants.
202 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint(FloatPoint (), m_paintInvalidationContainer, TraverseDocumentBoundaries); 202 FloatPoint fixedOffset = m_currentObject.localToAncestorPoint(FloatPoint (), m_paintInvalidationContainer, TraverseDocumentBoundaries);
203 if (m_paintInvalidationContainer->isBox()) {
204 const LayoutBox* box = toLayoutBox(m_paintInvalidationContainer);
205 if (box->hasOverflowClip())
206 fixedOffset.move(box->scrolledContentOffset());
207 }
203 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y()); 208 m_paintOffset = LayoutSize(fixedOffset.x(), fixedOffset.y());
204 // In the above way to get paint offset, we can't get accurate clip rect , so just assume no clip. 209 // In the above way to get paint offset, we can't get accurate clip rect , so just assume no clip.
205 // Clip on fixed-position is rare, in case that paintInvalidationContain er crosses frame boundary 210 // Clip on fixed-position is rare, in case that paintInvalidationContain er crosses frame boundary
206 // and the LayoutView is clipped by something in owner document. 211 // and the LayoutView is clipped by something in owner document.
207 if (m_clipped) { 212 if (m_clipped) {
208 m_clipped = false; 213 m_clipped = false;
209 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY 214 #ifdef CHECK_FAST_PATH_SLOW_PATH_EQUALITY
210 m_canCheckFastPathSlowPathEquality = false; 215 m_canCheckFastPathSlowPathEquality = false;
211 #endif 216 #endif
212 } 217 }
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 } else if (m_currentObject.isTableRow()) { 305 } else if (m_currentObject.isTableRow()) {
301 // Child table cell's locationOffset() includes its row's locationOffset (). 306 // Child table cell's locationOffset() includes its row's locationOffset ().
302 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset(); 307 m_paintOffset -= toLayoutBox(m_currentObject).locationOffset();
303 } 308 }
304 309
305 if (!m_currentObject.hasOverflowClip()) 310 if (!m_currentObject.hasOverflowClip())
306 return; 311 return;
307 312
308 const LayoutBox& box = toLayoutBox(m_currentObject); 313 const LayoutBox& box = toLayoutBox(m_currentObject);
309 314
310 // Do not clip scroll layer contents because the compositor expects the whol e layer 315 // Do not clip or scroll for the paint invalidation container, if it scrolls overflow, because it will always use composited
311 // to be always invalidated in-time. 316 // scrolling in this case.
312 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) 317 if (box == m_paintInvalidationContainer && box.scrollsOverflow()) {
313 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited. 318 ASSERT(!m_clipped); // The box establishes paint invalidation container, so no m_clipped inherited.
314 else 319 } else {
315 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint())); 320 addClipRectRelativeToPaintOffset(box.overflowClipRect(LayoutPoint()));
316 321 m_paintOffset -= box.scrolledContentOffset();
317 m_paintOffset -= box.scrolledContentOffset(); 322 }
318 323
319 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present. 324 // FIXME: <http://bugs.webkit.org/show_bug.cgi?id=13443> Apply control clip if present.
320 } 325 }
321 326
322 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point) 327 static FloatPoint slowLocalToAncestorPoint(const LayoutObject& object, const Lay outBoxModelObject& ancestor, const FloatPoint& point)
323 { 328 {
324 if (object.isLayoutView()) 329 if (object.isLayoutView())
325 return toLayoutView(object).localToAncestorPoint(point, &ancestor, Trave rseDocumentBoundaries | InputIsInFrameCoordinates); 330 return toLayoutView(object).localToAncestorPoint(point, &ancestor, Trave rseDocumentBoundaries | InputIsInFrameCoordinates);
326 return object.localToAncestorPoint(point, &ancestor, TraverseDocumentBoundar ies); 331 FloatPoint result = object.localToAncestorPoint(point, &ancestor, TraverseDo cumentBoundaries);
332 // Paint invalidation does not include scroll of the ancestor.
333 if (ancestor.isBox()) {
334 const LayoutBox* box = toLayoutBox(&ancestor);
335 if (box->hasOverflowClip())
336 result.move(box->scrolledContentOffset());
337 }
338 return result;
327 } 339 }
328 340
329 LayoutPoint PaintInvalidationState::computePositionFromPaintInvalidationBacking( ) const 341 LayoutPoint PaintInvalidationState::computePositionFromPaintInvalidationBacking( ) const
330 { 342 {
331 ASSERT(!m_didUpdateForChildren); 343 ASSERT(!m_didUpdateForChildren);
332 344
333 FloatPoint point; 345 FloatPoint point;
334 if (m_paintInvalidationContainer != &m_currentObject) { 346 if (m_paintInvalidationContainer != &m_currentObject) {
335 if (m_cachedOffsetsEnabled) { 347 if (m_cachedOffsetsEnabled) {
336 if (m_currentObject.isSVG() && !m_currentObject.isSVGRoot()) 348 if (m_currentObject.isSVG() && !m_currentObject.isSVGRoot())
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
494 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast : %s vs slow: %s", 506 WTFLogAlways("Fast path paint invalidation rect differs from slow path: fast : %s vs slow: %s",
495 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii(). data()); 507 fastPathRect.toString().ascii().data(), slowPathRect.toString().ascii(). data());
496 showLayoutTree(&m_currentObject); 508 showLayoutTree(&m_currentObject);
497 509
498 ASSERT_NOT_REACHED(); 510 ASSERT_NOT_REACHED();
499 } 511 }
500 512
501 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY 513 #endif // CHECK_FAST_PATH_SLOW_PATH_EQUALITY
502 514
503 } // namespace blink 515 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698