OLD | NEW |
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 Loading... |
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& paintInvalidationContaine
r) | 1432 PaintInvalidationReason LayoutBox::invalidatePaintIfNeeded(PaintInvalidationStat
e& paintInvalidationState, const LayoutBoxModelObject& newPaintInvalidationConta
iner) |
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, paintInvalidationContainer); | 1446 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed
ed(paintInvalidationState, newPaintInvalidationContainer); |
1447 | 1447 |
1448 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason(
reason)) | 1448 bool willDoFullInvalidation = view()->doingFullPaintInvalidation() || isFull
PaintInvalidationReason(reason); |
| 1449 if (!willDoFullInvalidation) |
1449 invalidatePaintForOverflowIfNeeded(); | 1450 invalidatePaintForOverflowIfNeeded(); |
1450 | 1451 |
1451 if (PaintLayerScrollableArea* area = scrollableArea()) | 1452 // Issue paint invalidations for any scrollbars if there is a scrollable are
a for this layoutObject. |
1452 area->invalidatePaintOfScrollControlsIfNeeded(paintInvalidationState, pa
intInvalidationContainer); | 1453 if (ScrollableArea* area = scrollableArea()) { |
| 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 } |
1453 | 1469 |
1454 // This is for the next invalidatePaintIfNeeded so must be at the end. | 1470 // This is for the next invalidatePaintIfNeeded so must be at the end. |
1455 savePreviousBoxSizesIfNeeded(); | 1471 savePreviousBoxSizesIfNeeded(); |
1456 return reason; | 1472 return reason; |
1457 } | 1473 } |
1458 | 1474 |
| 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 |
1459 LayoutRect LayoutBox::overflowClipRect(const LayoutPoint& location, OverlayScrol
lbarSizeRelevancy relevancy) const | 1494 LayoutRect LayoutBox::overflowClipRect(const LayoutPoint& location, OverlayScrol
lbarSizeRelevancy relevancy) const |
1460 { | 1495 { |
1461 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert
y | 1496 // FIXME: When overflow-clip (CSS3) is implemented, we'll obtain the propert
y |
1462 // here. | 1497 // here. |
1463 LayoutRect clipRect = borderBoxRect(); | 1498 LayoutRect clipRect = borderBoxRect(); |
1464 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); | 1499 clipRect.setLocation(location + clipRect.location() + LayoutSize(borderLeft(
), borderTop())); |
1465 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); | 1500 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(),
borderTop() + borderBottom())); |
1466 | 1501 |
1467 if (hasOverflowClip()) | 1502 if (hasOverflowClip()) |
1468 excludeScrollbars(clipRect, relevancy); | 1503 excludeScrollbars(clipRect, relevancy); |
(...skipping 3363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4832 StyleImage* borderImage = style()->borderImage().image(); | 4867 StyleImage* borderImage = style()->borderImage().image(); |
4833 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); | 4868 return borderImage && borderImage->canRender(*this, style()->effectiveZoom()
) && borderImage->isLoaded(); |
4834 } | 4869 } |
4835 | 4870 |
4836 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const | 4871 ShapeOutsideInfo* LayoutBox::shapeOutsideInfo() const |
4837 { | 4872 { |
4838 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this)
: nullptr; | 4873 return ShapeOutsideInfo::isEnabledFor(*this) ? ShapeOutsideInfo::info(*this)
: nullptr; |
4839 } | 4874 } |
4840 | 4875 |
4841 } // namespace blink | 4876 } // namespace blink |
OLD | NEW |