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

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

Issue 1804963005: Avoid paintInvalidationContainer parameter of invalidatePaintIfNeeded() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 { 349 {
350 if (TransformOperation* translate = style.translate()) { 350 if (TransformOperation* translate = style.translate()) {
351 if (translate->dependsOnBoxSize()) 351 if (translate->dependsOnBoxSize())
352 return true; 352 return true;
353 } 353 }
354 return style.transform().dependsOnBoxSize() 354 return style.transform().dependsOnBoxSize()
355 || (style.transformOriginX() != Length(50, Percent) && style.transformOr iginX().hasPercent()) 355 || (style.transformOriginX() != Length(50, Percent) && style.transformOr iginX().hasPercent())
356 || (style.transformOriginY() != Length(50, Percent) && style.transformOr iginY().hasPercent()); 356 || (style.transformOriginY() != Length(50, Percent) && style.transformOr iginY().hasPercent());
357 } 357 }
358 358
359 void LayoutBoxModelObject::invalidateTreeIfNeeded(PaintInvalidationState& paintI nvalidationState) 359 void LayoutBoxModelObject::invalidateTreeIfNeeded(const PaintInvalidationState& paintInvalidationState)
360 { 360 {
361 ASSERT(!needsLayout()); 361 ASSERT(!needsLayout());
362 362
363 if (!shouldCheckForPaintInvalidation(paintInvalidationState)) 363 if (!shouldCheckForPaintInvalidation(paintInvalidationState))
364 return; 364 return;
365 365
366 bool establishesNewPaintInvalidationContainer = isPaintInvalidationContainer ();
367 const LayoutBoxModelObject& newPaintInvalidationContainer = establishesNewPa intInvalidationContainer ? *this : paintInvalidationState.paintInvalidationConta iner();
368 // FIXME: This assert should be re-enabled when we move paint invalidation t o after compositing update. crbug.com/360286
369 // ASSERT(&newPaintInvalidationContainer == &containerForPaintInvalidation() );
370
371 LayoutRect previousPaintInvalidationRect = this->previousPaintInvalidationRe ct(); 366 LayoutRect previousPaintInvalidationRect = this->previousPaintInvalidationRe ct();
372 367
373 PaintInvalidationReason reason = invalidatePaintIfNeeded(paintInvalidationSt ate, newPaintInvalidationContainer); 368 PaintInvalidationState newPaintInvalidationState(paintInvalidationState, *th is);
374 clearPaintInvalidationState(paintInvalidationState); 369 // TODO(wangxianzhu): Enable this assert after we fix all paintInvalidationC ontainer mismatch issues. crbug.com/360286
370 // ASSERT(&newPaintInvalidationState.paintInvalidationContainer() == &contai nerForPaintInvalidation());
371
372 PaintInvalidationReason reason = invalidatePaintIfNeeded(newPaintInvalidatio nState);
373 clearPaintInvalidationFlags(newPaintInvalidationState);
375 374
376 if (reason == PaintInvalidationDelayedFull) 375 if (reason == PaintInvalidationDelayedFull)
377 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this); 376 paintInvalidationState.pushDelayedPaintInvalidationTarget(*this);
378 377
379 PaintInvalidationState childTreeWalkState(paintInvalidationState, *this, new PaintInvalidationContainer);
380 if (reason == PaintInvalidationLocationChange) 378 if (reason == PaintInvalidationLocationChange)
381 childTreeWalkState.setForceSubtreeInvalidationWithinContainer(); 379 newPaintInvalidationState.setForceSubtreeInvalidationWithinContainer();
382 380
383 // TODO(wangxianzhu): This is a workaround for crbug.com/533277. Will remove when we enable paint offset caching. 381 // TODO(wangxianzhu): This is a workaround for crbug.com/533277. Will remove when we enable paint offset caching.
384 if (reason != PaintInvalidationNone && hasPercentageTransform(styleRef())) 382 if (reason != PaintInvalidationNone && hasPercentageTransform(styleRef()))
385 childTreeWalkState.setForceSubtreeInvalidationWithinContainer(); 383 newPaintInvalidationState.setForceSubtreeInvalidationWithinContainer();
386 384
387 // TODO(wangxianzhu): This is a workaround for crbug.com/490725. We don't ha ve enough saved information to do accurate check 385 // TODO(wangxianzhu): This is a workaround for crbug.com/490725. We don't ha ve enough saved information to do accurate check
388 // of clipping change. Will remove when we remove rect-based paint invalidat ion. 386 // of clipping change. Will remove when we remove rect-based paint invalidat ion.
389 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled() 387 if (!RuntimeEnabledFeatures::slimmingPaintV2Enabled()
390 && previousPaintInvalidationRect != this->previousPaintInvalidationRect( ) 388 && previousPaintInvalidationRect != this->previousPaintInvalidationRect( )
391 && !usesCompositedScrolling() 389 && !usesCompositedScrolling()
392 && hasOverflowClip()) 390 && hasOverflowClip())
393 childTreeWalkState.setForceSubtreeInvalidationRectUpdateWithinContainer( ); 391 newPaintInvalidationState.setForceSubtreeInvalidationRectUpdateWithinCon tainer();
394 392
395 invalidatePaintOfSubtreesIfNeeded(childTreeWalkState); 393 newPaintInvalidationState.updatePaintOffsetAndClipForChildren();
394 invalidatePaintOfSubtreesIfNeeded(newPaintInvalidationState);
396 } 395 }
397 396
398 void LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect(const LayoutRe ct& r, PaintInvalidationReason invalidationReason) const 397 void LayoutBoxModelObject::setBackingNeedsPaintInvalidationInRect(const LayoutRe ct& r, PaintInvalidationReason invalidationReason) const
399 { 398 {
400 // TODO(wangxianzhu): Enable the following assert after paint invalidation f or spv2 is ready. 399 // TODO(wangxianzhu): Enable the following assert after paint invalidation f or spv2 is ready.
401 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled()); 400 // ASSERT(!RuntimeEnabledFeatures::slimmingPaintV2Enabled());
402 401
403 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here, 402 // https://bugs.webkit.org/show_bug.cgi?id=61159 describes an unreproducible crash here,
404 // so assert but check that the layer is composited. 403 // so assert but check that the layer is composited.
405 ASSERT(compositingState() != NotComposited); 404 ASSERT(compositingState() != NotComposited);
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
960 if (rootElementStyle->hasBackground()) 959 if (rootElementStyle->hasBackground())
961 return false; 960 return false;
962 961
963 if (node() != document().firstBodyElement()) 962 if (node() != document().firstBodyElement())
964 return false; 963 return false;
965 964
966 return true; 965 return true;
967 } 966 }
968 967
969 } // namespace blink 968 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698