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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1129 return std::max(LayoutUnit(), height); | 1129 return std::max(LayoutUnit(), height); |
1130 } | 1130 } |
1131 | 1131 |
1132 // Hit Testing | 1132 // Hit Testing |
1133 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) | 1133 bool RenderBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result
, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffs
et, HitTestAction action) |
1134 { | 1134 { |
1135 LayoutPoint adjustedLocation = accumulatedOffset + location(); | 1135 LayoutPoint adjustedLocation = accumulatedOffset + location(); |
1136 | 1136 |
1137 // Check kids first. | 1137 // Check kids first. |
1138 for (LayoutObject* child = slowLastChild(); child; child = child->previousSi
bling()) { | 1138 for (LayoutObject* child = slowLastChild(); child; child = child->previousSi
bling()) { |
1139 if ((!child->hasLayer() || !toLayoutLayerModelObject(child)->layer()->is
SelfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer,
adjustedLocation, action)) { | 1139 if ((!child->hasLayer() || !toLayoutBoxModelObject(child)->layer()->isSe
lfPaintingLayer()) && child->nodeAtPoint(request, result, locationInContainer, a
djustedLocation, action)) { |
1140 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); | 1140 updateHitTestResult(result, locationInContainer.point() - toLayoutSi
ze(adjustedLocation)); |
1141 return true; | 1141 return true; |
1142 } | 1142 } |
1143 } | 1143 } |
1144 | 1144 |
1145 // Check our bounds next. For this purpose always assume that we can only be
hit in the | 1145 // Check our bounds next. For this purpose always assume that we can only be
hit in the |
1146 // foreground phase (which is true for replaced elements like images). | 1146 // foreground phase (which is true for replaced elements like images). |
1147 LayoutRect boundsRect = borderBoxRect(); | 1147 LayoutRect boundsRect = borderBoxRect(); |
1148 boundsRect.moveBy(adjustedLocation); | 1148 boundsRect.moveBy(adjustedLocation); |
1149 if (visibleToHitTestRequest(request) && action == HitTestForeground && locat
ionInContainer.intersects(boundsRect)) { | 1149 if (visibleToHitTestRequest(request) && action == HitTestForeground && locat
ionInContainer.intersects(boundsRect)) { |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1379 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex
t()) { | 1379 for (const FillLayer* curLayer = &layers; curLayer; curLayer = curLayer->nex
t()) { |
1380 if (curLayer->image() && image == curLayer->image()->data() && curLayer-
>image()->canRender(*this, style()->effectiveZoom())) { | 1380 if (curLayer->image() && image == curLayer->image()->data() && curLayer-
>image()->canRender(*this, style()->effectiveZoom())) { |
1381 for (LayoutObject* layerRenderer : layerRenderers) | 1381 for (LayoutObject* layerRenderer : layerRenderers) |
1382 layerRenderer->setShouldDoFullPaintInvalidation(); | 1382 layerRenderer->setShouldDoFullPaintInvalidation(); |
1383 return true; | 1383 return true; |
1384 } | 1384 } |
1385 } | 1385 } |
1386 return false; | 1386 return false; |
1387 } | 1387 } |
1388 | 1388 |
1389 PaintInvalidationReason RenderBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState, const LayoutLayerModelObject& newPaintInvalidat
ionContainer) | 1389 PaintInvalidationReason RenderBox::invalidatePaintIfNeeded(const PaintInvalidati
onState& paintInvalidationState, const LayoutBoxModelObject& newPaintInvalidatio
nContainer) |
1390 { | 1390 { |
1391 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed
ed(paintInvalidationState, newPaintInvalidationContainer); | 1391 PaintInvalidationReason reason = LayoutBoxModelObject::invalidatePaintIfNeed
ed(paintInvalidationState, newPaintInvalidationContainer); |
1392 | 1392 |
1393 // If we are set to do a full paint invalidation that means the RenderView w
ill be | 1393 // If we are set to do a full paint invalidation that means the RenderView w
ill be |
1394 // issue paint invalidations. We can then skip issuing of paint invalidation
s for the child | 1394 // issue paint invalidations. We can then skip issuing of paint invalidation
s for the child |
1395 // renderers as they'll be covered by the RenderView. | 1395 // renderers as they'll be covered by the RenderView. |
1396 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason(
reason)) { | 1396 if (!view()->doingFullPaintInvalidation() && !isFullPaintInvalidationReason(
reason)) { |
1397 invalidatePaintForOverflowIfNeeded(); | 1397 invalidatePaintForOverflowIfNeeded(); |
1398 | 1398 |
1399 // Issue paint invalidations for any scrollbars if there is a scrollable
area for this renderer. | 1399 // Issue paint invalidations for any scrollbars if there is a scrollable
area for this renderer. |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1552 ? view()->frameView()->unscaledVisibleContentSize().height() | 1552 ? view()->frameView()->unscaledVisibleContentSize().height() |
1553 : view()->frameView()->unscaledVisibleContentSize().width(); | 1553 : view()->frameView()->unscaledVisibleContentSize().width(); |
1554 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); | 1554 LayoutUnit fillAvailableExtent = containingBlock()->availableLogicalHeig
ht(ExcludeMarginBorderPadding); |
1555 return std::min(fillAvailableExtent, fillFallbackExtent); | 1555 return std::min(fillAvailableExtent, fillFallbackExtent); |
1556 } | 1556 } |
1557 | 1557 |
1558 // Use the content box logical height as specified by the style. | 1558 // Use the content box logical height as specified by the style. |
1559 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); | 1559 return cb->adjustContentBoxLogicalHeightForBoxSizing(logicalHeightLength.val
ue()); |
1560 } | 1560 } |
1561 | 1561 |
1562 void RenderBox::mapLocalToContainer(const LayoutLayerModelObject* paintInvalidat
ionContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wa
sFixed, const PaintInvalidationState* paintInvalidationState) const | 1562 void RenderBox::mapLocalToContainer(const LayoutBoxModelObject* paintInvalidatio
nContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* wasF
ixed, const PaintInvalidationState* paintInvalidationState) const |
1563 { | 1563 { |
1564 if (paintInvalidationContainer == this) | 1564 if (paintInvalidationContainer == this) |
1565 return; | 1565 return; |
1566 | 1566 |
1567 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { | 1567 if (paintInvalidationState && paintInvalidationState->canMapToContainer(pain
tInvalidationContainer)) { |
1568 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); | 1568 LayoutSize offset = paintInvalidationState->paintOffset() + locationOffs
et(); |
1569 if (style()->hasInFlowPosition() && layer()) | 1569 if (style()->hasInFlowPosition() && layer()) |
1570 offset += layer()->offsetForInFlowPosition(); | 1570 offset += layer()->offsetForInFlowPosition(); |
1571 transformState.move(offset); | 1571 transformState.move(offset); |
1572 return; | 1572 return; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 ensureRareData().m_spannerPlaceholder = &placeholder; | 1759 ensureRareData().m_spannerPlaceholder = &placeholder; |
1760 } | 1760 } |
1761 | 1761 |
1762 void RenderBox::clearSpannerPlaceholder() | 1762 void RenderBox::clearSpannerPlaceholder() |
1763 { | 1763 { |
1764 if (!m_rareData) | 1764 if (!m_rareData) |
1765 return; | 1765 return; |
1766 m_rareData->m_spannerPlaceholder = 0; | 1766 m_rareData->m_spannerPlaceholder = 0; |
1767 } | 1767 } |
1768 | 1768 |
1769 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const LayoutLayerM
odelObject* paintInvalidationContainer, const PaintInvalidationState* paintInval
idationState) const | 1769 LayoutRect RenderBox::clippedOverflowRectForPaintInvalidation(const LayoutBoxMod
elObject* paintInvalidationContainer, const PaintInvalidationState* paintInvalid
ationState) const |
1770 { | 1770 { |
1771 if (style()->visibility() != VISIBLE) { | 1771 if (style()->visibility() != VISIBLE) { |
1772 Layer* layer = enclosingLayer(); | 1772 Layer* layer = enclosingLayer(); |
1773 layer->updateDescendantDependentFlags(); | 1773 layer->updateDescendantDependentFlags(); |
1774 if (layer->subtreeIsInvisible()) | 1774 if (layer->subtreeIsInvisible()) |
1775 return LayoutRect(); | 1775 return LayoutRect(); |
1776 } | 1776 } |
1777 | 1777 |
1778 LayoutRect r = visualOverflowRect(); | 1778 LayoutRect r = visualOverflowRect(); |
1779 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | 1779 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); |
1780 return r; | 1780 return r; |
1781 } | 1781 } |
1782 | 1782 |
1783 void RenderBox::mapRectToPaintInvalidationBacking(const LayoutLayerModelObject*
paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* pain
tInvalidationState) const | 1783 void RenderBox::mapRectToPaintInvalidationBacking(const LayoutBoxModelObject* pa
intInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintI
nvalidationState) const |
1784 { | 1784 { |
1785 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. | 1785 // The rect we compute at each step is shifted by our x/y offset in the pare
nt container's coordinate space. |
1786 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate | 1786 // Only when we cross a writing mode boundary will we have to possibly flipF
orWritingMode (to convert into a more appropriate |
1787 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations | 1787 // offset corner for the enclosing container). This allows for a fully RL or
BT document to issue paint invalidations |
1788 // properly even during layout, since the rect remains flipped all the way u
ntil the end. | 1788 // properly even during layout, since the rect remains flipped all the way u
ntil the end. |
1789 // | 1789 // |
1790 // RenderView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to | 1790 // RenderView::computeRectForPaintInvalidation then converts the rect to phy
sical coordinates. We also convert to |
1791 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the | 1791 // physical when we hit a paintInvalidationContainer boundary. Therefore the
final rect returned is always in the |
1792 // physical coordinate space of the paintInvalidationContainer. | 1792 // physical coordinate space of the paintInvalidationContainer. |
1793 const LayoutStyle& styleToUse = styleRef(); | 1793 const LayoutStyle& styleToUse = styleRef(); |
(...skipping 2094 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3888 if (LayerScrollableArea* scrollableArea = layer->scrollableArea()) { | 3888 if (LayerScrollableArea* scrollableArea = layer->scrollableArea()) { |
3889 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->lay
erForHorizontalScrollbar()) | 3889 if (scrollableArea->hasHorizontalScrollbar() && !scrollableArea->lay
erForHorizontalScrollbar()) |
3890 return true; | 3890 return true; |
3891 if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layer
ForVerticalScrollbar()) | 3891 if (scrollableArea->hasVerticalScrollbar() && !scrollableArea->layer
ForVerticalScrollbar()) |
3892 return true; | 3892 return true; |
3893 } | 3893 } |
3894 } | 3894 } |
3895 return false; | 3895 return false; |
3896 } | 3896 } |
3897 | 3897 |
3898 PaintInvalidationReason RenderBox::paintInvalidationReason(const LayoutLayerMode
lObject& paintInvalidationContainer, | 3898 PaintInvalidationReason RenderBox::paintInvalidationReason(const LayoutBoxModelO
bject& paintInvalidationContainer, |
3899 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) const | 3899 const LayoutRect& oldBounds, const LayoutPoint& oldLocation, const LayoutRec
t& newBounds, const LayoutPoint& newLocation) const |
3900 { | 3900 { |
3901 PaintInvalidationReason invalidationReason = LayoutBoxModelObject::paintInva
lidationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, ne
wLocation); | 3901 PaintInvalidationReason invalidationReason = LayoutBoxModelObject::paintInva
lidationReason(paintInvalidationContainer, oldBounds, oldLocation, newBounds, ne
wLocation); |
3902 if (isFullPaintInvalidationReason(invalidationReason)) | 3902 if (isFullPaintInvalidationReason(invalidationReason)) |
3903 return invalidationReason; | 3903 return invalidationReason; |
3904 | 3904 |
3905 // If the transform is not identity or translation, incremental invalidation
is not applicable | 3905 // If the transform is not identity or translation, incremental invalidation
is not applicable |
3906 // because the difference between oldBounds and newBounds doesn't cover all
area needing invalidation. | 3906 // because the difference between oldBounds and newBounds doesn't cover all
area needing invalidation. |
3907 // FIXME: Should also consider ancestor transforms since paintInvalidationCo
ntainer. crbug.com/426111. | 3907 // FIXME: Should also consider ancestor transforms since paintInvalidationCo
ntainer. crbug.com/426111. |
3908 if (invalidationReason == PaintInvalidationIncremental | 3908 if (invalidationReason == PaintInvalidationIncremental |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3941 } | 3941 } |
3942 | 3942 |
3943 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) | 3943 if (oldBorderBoxSize.width() != newBorderBoxSize.width() && mustInvalidateBa
ckgroundOrBorderPaintOnWidthChange()) |
3944 return PaintInvalidationBorderBoxChange; | 3944 return PaintInvalidationBorderBoxChange; |
3945 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) | 3945 if (oldBorderBoxSize.height() != newBorderBoxSize.height() && mustInvalidate
BackgroundOrBorderPaintOnHeightChange()) |
3946 return PaintInvalidationBorderBoxChange; | 3946 return PaintInvalidationBorderBoxChange; |
3947 | 3947 |
3948 return PaintInvalidationIncremental; | 3948 return PaintInvalidationIncremental; |
3949 } | 3949 } |
3950 | 3950 |
3951 void RenderBox::incrementallyInvalidatePaint(const LayoutLayerModelObject& paint
InvalidationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds,
const LayoutPoint& positionFromPaintInvalidationBacking) | 3951 void RenderBox::incrementallyInvalidatePaint(const LayoutBoxModelObject& paintIn
validationContainer, const LayoutRect& oldBounds, const LayoutRect& newBounds, c
onst LayoutPoint& positionFromPaintInvalidationBacking) |
3952 { | 3952 { |
3953 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); | 3953 LayoutObject::incrementallyInvalidatePaint(paintInvalidationContainer, oldBo
unds, newBounds, positionFromPaintInvalidationBacking); |
3954 | 3954 |
3955 bool hasBoxDecorations = style()->hasBoxDecorations(); | 3955 bool hasBoxDecorations = style()->hasBoxDecorations(); |
3956 if (!style()->hasBackground() && !hasBoxDecorations) | 3956 if (!style()->hasBackground() && !hasBoxDecorations) |
3957 return; | 3957 return; |
3958 | 3958 |
3959 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; | 3959 LayoutSize oldBorderBoxSize = computePreviousBorderBoxSize(oldBounds.size())
; |
3960 LayoutSize newBorderBoxSize = size(); | 3960 LayoutSize newBorderBoxSize = size(); |
3961 | 3961 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3994 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde
rBottomRightRadius().height(), smallerHeight); | 3994 LayoutUnit borderBottomRightRadiusHeight = valueForLength(style()->borde
rBottomRightRadius().height(), smallerHeight); |
3995 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max(
borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); | 3995 LayoutUnit borderHeight = std::max<LayoutUnit>(borderBottom(), std::max(
borderBottomLeftRadiusHeight, borderBottomRightRadiusHeight)); |
3996 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), | 3996 LayoutRect bottomDeltaRect(positionFromPaintInvalidationBacking.x(), |
3997 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei
ght, | 3997 positionFromPaintInvalidationBacking.y() + smallerHeight - borderHei
ght, |
3998 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), | 3998 std::max(oldBorderBoxSize.width(), newBorderBoxSize.width()), |
3999 deltaHeight + borderHeight); | 3999 deltaHeight + borderHeight); |
4000 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer,
bottomDeltaRect, oldBounds, newBounds); | 4000 invalidatePaintRectClippedByOldAndNewBounds(paintInvalidationContainer,
bottomDeltaRect, oldBounds, newBounds); |
4001 } | 4001 } |
4002 } | 4002 } |
4003 | 4003 |
4004 void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutLayerMod
elObject& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect&
oldBounds, const LayoutRect& newBounds) | 4004 void RenderBox::invalidatePaintRectClippedByOldAndNewBounds(const LayoutBoxModel
Object& paintInvalidationContainer, const LayoutRect& rect, const LayoutRect& ol
dBounds, const LayoutRect& newBounds) |
4005 { | 4005 { |
4006 if (rect.isEmpty()) | 4006 if (rect.isEmpty()) |
4007 return; | 4007 return; |
4008 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); | 4008 LayoutRect rectClippedByOldBounds = intersection(rect, oldBounds); |
4009 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); | 4009 LayoutRect rectClippedByNewBounds = intersection(rect, newBounds); |
4010 // Invalidate only once if the clipped rects equal. | 4010 // Invalidate only once if the clipped rects equal. |
4011 if (rectClippedByOldBounds == rectClippedByNewBounds) { | 4011 if (rectClippedByOldBounds == rectClippedByNewBounds) { |
4012 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy
OldBounds, PaintInvalidationIncremental); | 4012 invalidatePaintUsingContainer(&paintInvalidationContainer, rectClippedBy
OldBounds, PaintInvalidationIncremental); |
4013 return; | 4013 return; |
4014 } | 4014 } |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4623 } | 4623 } |
4624 | 4624 |
4625 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c
onst | 4625 void RenderBox::invalidateDisplayItemClients(DisplayItemList* displayItemList) c
onst |
4626 { | 4626 { |
4627 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList); | 4627 LayoutBoxModelObject::invalidateDisplayItemClients(displayItemList); |
4628 if (LayerScrollableArea* area = scrollableArea()) | 4628 if (LayerScrollableArea* area = scrollableArea()) |
4629 displayItemList->invalidate(area->displayItemClient()); | 4629 displayItemList->invalidate(area->displayItemClient()); |
4630 } | 4630 } |
4631 | 4631 |
4632 } // namespace blink | 4632 } // namespace blink |
OLD | NEW |