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

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

Issue 1406133005: Calculate paint invalidation rect for scrollbars (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) 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, 2010 Apple Inc. All rights reserv ed. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed.
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. 7 * Copyright (C) 2013 Adobe Systems Incorporated. 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 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 bool LayoutBox::intersectsVisibleViewport() 1422 bool LayoutBox::intersectsVisibleViewport()
1423 { 1423 {
1424 LayoutRect rect = visualOverflowRect(); 1424 LayoutRect rect = visualOverflowRect();
1425 LayoutView* layoutView = view(); 1425 LayoutView* layoutView = view();
1426 while (layoutView->frame()->ownerLayoutObject()) 1426 while (layoutView->frame()->ownerLayoutObject())
1427 layoutView = layoutView->frame()->ownerLayoutObject()->view(); 1427 layoutView = layoutView->frame()->ownerLayoutObject()->view();
1428 mapRectToPaintInvalidationBacking(layoutView, rect, 0); 1428 mapRectToPaintInvalidationBacking(layoutView, rect, 0);
1429 return rect.intersects(LayoutRect(layoutView->frameView()->scrollableArea()- >visibleContentRectDouble())); 1429 return rect.intersects(LayoutRect(layoutView->frameView()->scrollableArea()- >visibleContentRectDouble()));
1430 } 1430 }
1431 1431
1432 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat e& paintInvalidationState, const LayoutBoxModelObject& newPaintInvalidationConta iner) 1432 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat e& paintInvalidationState, const LayoutBoxModelObject& paintInvalidationContaine r)
1433 { 1433 {
1434 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason (); 1434 PaintInvalidationReason fullInvalidationReason = fullPaintInvalidationReason ();
1435 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the 1435 // If the current paint invalidation reason is PaintInvalidationDelayedFull, then this paint invalidation can delayed if the
1436 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original 1436 // LayoutBox in question is not on-screen. The logic to decide whether this is appropriate exists at the site of the original
1437 // paint invalidation that chose PaintInvalidationDelayedFull. 1437 // paint invalidation that chose PaintInvalidationDelayedFull.
1438 if (fullInvalidationReason == PaintInvalidationDelayedFull) { 1438 if (fullInvalidationReason == PaintInvalidationDelayedFull) {
1439 if (!intersectsVisibleViewport()) 1439 if (!intersectsVisibleViewport())
1440 return PaintInvalidationDelayedFull; 1440 return PaintInvalidationDelayedFull;
1441 1441
1442 // Reset state back to regular full paint invalidation if the object is onscreen. 1442 // Reset state back to regular full paint invalidation if the object is onscreen.
1443 setShouldDoFullPaintInvalidation(PaintInvalidationFull); 1443 setShouldDoFullPaintInvalidation(PaintInvalidationFull);
1444 } 1444 }
1445 1445
1446 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed ed(paintInvalidationState, newPaintInvalidationContainer); 1446 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed ed(paintInvalidationState, paintInvalidationContainer);
1447 1447
1448 bool willDoFullInvalidation = view()->doingFullPaintInvalidation() || isFull PaintInvalidationReason(reason); 1448 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason( reason))
1449 if (!willDoFullInvalidation)
1450 invalidatePaintForOverflowIfNeeded(); 1449 invalidatePaintForOverflowIfNeeded();
1451 1450
1452 // Issue paint invalidations for any scrollbars if there is a scrollable are a for this layoutObject. 1451 if (PaintLayerScrollableArea* area = scrollableArea())
1453 if (ScrollableArea* area = scrollableArea()) { 1452 area->invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState, pa intInvalidationContainer);
1454 if (area->hasVerticalBarDamage()) {
1455 if (!willDoFullInvalidation)
1456 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->verticalBarDamage()));
1457 // TODO(wangxianzhu): Pass current bounds of the scrollbar to PaintC ontroller. crbug.com/547119.
1458 if (Scrollbar* verticalScrollbar = area->verticalScrollbar())
1459 invalidateDisplayItemClient(*verticalScrollbar);
1460 }
1461 if (area->hasHorizontalBarDamage()) {
1462 if (!willDoFullInvalidation)
1463 invalidatePaintRectangleNotInvalidatingDisplayItemClients(Layout Rect(area->horizontalBarDamage()));
1464 // TODO(wangxianzhu): Pass current bounds of the scrollbar to PaintC ontroller. crbug.com/547119.
1465 if (Scrollbar* horizontalScrollbar = area->horizontalScrollbar())
1466 invalidateDisplayItemClient(*horizontalScrollbar);
1467 }
1468 }
1469 1453
1470 // This is for the next invalidatePaintIfNeeded so must be at the end. 1454 // This is for the next invalidatePaintIfNeeded so must be at the end.
1471 savePreviousBoxSizesIfNeeded(); 1455 savePreviousBoxSizesIfNeeded();
1472 return reason; 1456 return reason;
1473 } 1457 }
1474 1458
1475 void LayoutBox::clearPaintInvalidationState(const PaintInvalidationState& paintI nvalidationState)
1476 {
1477 LayoutBoxModelObject::clearPaintInvalidationState(paintInvalidationState);
1478
1479 if (ScrollableArea* area = scrollableArea())
1480 area->resetScrollbarDamage();
1481 }
1482
1483 #if ENABLE(ASSERT)
1484 bool LayoutBox::paintInvalidationStateIsDirty() const
1485 {
1486 if (ScrollableArea* area = scrollableArea()) {
1487 if (area->hasVerticalBarDamage() || area->hasHorizontalBarDamage())
1488 return true;
1489 }
1490 return LayoutBoxModelObject::paintInvalidationStateIsDirty();
1491 }
1492 #endif
1493
1494 LayoutRect LayoutBox::overflowClipRect(const LayoutPoint& location, OverlayScrol lbarSizeRelevancy relevancy) const 1459 LayoutRect LayoutBox::overflowClipRect(const LayoutPoint& location, OverlayScrol lbarSizeRelevancy relevancy) const
1495 { 1460 {
1496 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert y 1461 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert y
1497 // here. 1462 // here.
1498 LayoutRect clipRect = borderBoxRect(); 1463 LayoutRect clipRect = borderBoxRect();
1499 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop())); 1464 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft( ), borderTop()));
1500 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom())); 1465 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
1501 1466
1502 if (hasOverflowClip()) 1467 if (hasOverflowClip())
1503 excludeScrollbars(clipRect, relevancy); 1468 excludeScrollbars(clipRect, relevancy);
(...skipping 3363 matching lines...) Expand 10 before | Expand all | Expand 10 after
4867 StyleImage* borderImage = style()->borderImage().image(); 4832 StyleImage* borderImage = style()->borderImage().image();
4868 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded(); 4833 return borderImage && borderImage->canRender(*this, style()->effectiveZoom() ) && borderImage->isLoaded();
4869 } 4834 }
4870 4835
4871 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const 4836 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const
4872 { 4837 {
4873 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr; 4838 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this) : nullptr;
4874 } 4839 }
4875 4840
4876 } // namespace blink 4841 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutBox.h ('k') | third_party/WebKit/Source/core/layout/LayoutBoxModelObject.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698