| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights
reserved. |
| 3 * | 3 * |
| 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
| 5 * | 5 * |
| 6 * Other contributors: | 6 * Other contributors: |
| 7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
| 8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
| 9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
| 10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 } | 357 } |
| 358 | 358 |
| 359 updateTransformationMatrix(); | 359 updateTransformationMatrix(); |
| 360 | 360 |
| 361 if (had3DTransform != has3DTransform()) | 361 if (had3DTransform != has3DTransform()) |
| 362 dirty3DTransformedDescendantStatus(); | 362 dirty3DTransformedDescendantStatus(); |
| 363 } | 363 } |
| 364 | 364 |
| 365 static Layer* enclosingLayerForContainingBlock(Layer* layer) | 365 static Layer* enclosingLayerForContainingBlock(Layer* layer) |
| 366 { | 366 { |
| 367 if (RenderObject* containingBlock = layer->renderer()->containingBlock()) | 367 if (LayoutObject* containingBlock = layer->renderer()->containingBlock()) |
| 368 return containingBlock->enclosingLayer(); | 368 return containingBlock->enclosingLayer(); |
| 369 return 0; | 369 return 0; |
| 370 } | 370 } |
| 371 | 371 |
| 372 Layer* Layer::renderingContextRoot() | 372 Layer* Layer::renderingContextRoot() |
| 373 { | 373 { |
| 374 Layer* renderingContext = 0; | 374 Layer* renderingContext = 0; |
| 375 | 375 |
| 376 if (shouldPreserve3D()) | 376 if (shouldPreserve3D()) |
| 377 renderingContext = this; | 377 renderingContext = this; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 } | 551 } |
| 552 } | 552 } |
| 553 | 553 |
| 554 void Layer::clearPaginationRecursive() | 554 void Layer::clearPaginationRecursive() |
| 555 { | 555 { |
| 556 m_enclosingPaginationLayer = 0; | 556 m_enclosingPaginationLayer = 0; |
| 557 for (Layer* child = firstChild(); child; child = child->nextSibling()) | 557 for (Layer* child = firstChild(); child; child = child->nextSibling()) |
| 558 child->clearPaginationRecursive(); | 558 child->clearPaginationRecursive(); |
| 559 } | 559 } |
| 560 | 560 |
| 561 LayoutPoint Layer::positionFromPaintInvalidationBacking(const RenderObject* rend
erObject, const LayoutLayerModelObject* paintInvalidationContainer, const PaintI
nvalidationState* paintInvalidationState) | 561 LayoutPoint Layer::positionFromPaintInvalidationBacking(const LayoutObject* layo
utObject, const LayoutLayerModelObject* paintInvalidationContainer, const PaintI
nvalidationState* paintInvalidationState) |
| 562 { | 562 { |
| 563 FloatPoint point = renderObject->localToContainerPoint(FloatPoint(), paintIn
validationContainer, 0, 0, paintInvalidationState); | 563 FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintIn
validationContainer, 0, 0, paintInvalidationState); |
| 564 | 564 |
| 565 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac
e. | 565 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac
e. |
| 566 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group
edMapping()) | 566 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group
edMapping()) |
| 567 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point); | 567 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point); |
| 568 | 568 |
| 569 return LayoutPoint(point); | 569 return LayoutPoint(point); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void Layer::mapPointToPaintBackingCoordinates(const LayoutLayerModelObject* pain
tInvalidationContainer, FloatPoint& point) | 572 void Layer::mapPointToPaintBackingCoordinates(const LayoutLayerModelObject* pain
tInvalidationContainer, FloatPoint& point) |
| 573 { | 573 { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 600 if (!transformedAncestor) | 600 if (!transformedAncestor) |
| 601 return; | 601 return; |
| 602 | 602 |
| 603 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the | 603 // |paintInvalidationContainer| may have a local 2D transform on it, so take
that into account when mapping into the space of the |
| 604 // transformed ancestor. | 604 // transformed ancestor. |
| 605 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect
(rect), transformedAncestor).boundingBox()); | 605 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect
(rect), transformedAncestor).boundingBox()); |
| 606 | 606 |
| 607 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr
ansformedAncestor()); | 607 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr
ansformedAncestor()); |
| 608 } | 608 } |
| 609 | 609 |
| 610 void Layer::mapRectToPaintInvalidationBacking(const RenderObject* renderObject,
const LayoutLayerModelObject* paintInvalidationContainer, LayoutRect& rect, cons
t PaintInvalidationState* paintInvalidationState) | 610 void Layer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject,
const LayoutLayerModelObject* paintInvalidationContainer, LayoutRect& rect, cons
t PaintInvalidationState* paintInvalidationState) |
| 611 { | 611 { |
| 612 if (!paintInvalidationContainer->layer()->groupedMapping()) { | 612 if (!paintInvalidationContainer->layer()->groupedMapping()) { |
| 613 renderObject->mapRectToPaintInvalidationBacking(paintInvalidationContain
er, rect, paintInvalidationState); | 613 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContain
er, rect, paintInvalidationState); |
| 614 return; | 614 return; |
| 615 } | 615 } |
| 616 | 616 |
| 617 // This code adjusts the paint invalidation rectangle to be in the space of
the transformed ancestor of the grouped (i.e. squashed) | 617 // This code adjusts the paint invalidation rectangle to be in the space of
the transformed ancestor of the grouped (i.e. squashed) |
| 618 // layer. This is because all layers that squash together need to issue pain
t invalidations w.r.t. a single container that is | 618 // layer. This is because all layers that squash together need to issue pain
t invalidations w.r.t. a single container that is |
| 619 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. | 619 // an ancestor of all of them, in order to properly take into account any lo
cal transforms etc. |
| 620 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. | 620 // FIXME: remove this special-case code that works around the paint invalida
tion code structure. |
| 621 renderObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer,
rect, paintInvalidationState); | 621 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContainer,
rect, paintInvalidationState); |
| 622 | 622 |
| 623 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); | 623 mapRectToPaintBackingCoordinates(paintInvalidationContainer, rect); |
| 624 } | 624 } |
| 625 | 625 |
| 626 LayoutRect Layer::computePaintInvalidationRect(const RenderObject* renderObject,
const Layer* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) | 626 LayoutRect Layer::computePaintInvalidationRect(const LayoutObject* layoutObject,
const Layer* paintInvalidationContainer, const PaintInvalidationState* paintInv
alidationState) |
| 627 { | 627 { |
| 628 if (!paintInvalidationContainer->groupedMapping()) | 628 if (!paintInvalidationContainer->groupedMapping()) |
| 629 return renderObject->computePaintInvalidationRect(paintInvalidationConta
iner->renderer(), paintInvalidationState); | 629 return layoutObject->computePaintInvalidationRect(paintInvalidationConta
iner->renderer(), paintInvalidationState); |
| 630 | 630 |
| 631 LayoutRect rect = renderObject->clippedOverflowRectForPaintInvalidation(pain
tInvalidationContainer->renderer(), paintInvalidationState); | 631 LayoutRect rect = layoutObject->clippedOverflowRectForPaintInvalidation(pain
tInvalidationContainer->renderer(), paintInvalidationState); |
| 632 mapRectToPaintBackingCoordinates(paintInvalidationContainer->renderer(), rec
t); | 632 mapRectToPaintBackingCoordinates(paintInvalidationContainer->renderer(), rec
t); |
| 633 return rect; | 633 return rect; |
| 634 } | 634 } |
| 635 | 635 |
| 636 void Layer::dirtyVisibleContentStatus() | 636 void Layer::dirtyVisibleContentStatus() |
| 637 { | 637 { |
| 638 m_visibleContentStatusDirty = true; | 638 m_visibleContentStatusDirty = true; |
| 639 if (parent()) | 639 if (parent()) |
| 640 parent()->dirtyAncestorChainVisibleDescendantStatus(); | 640 parent()->dirtyAncestorChainVisibleDescendantStatus(); |
| 641 } | 641 } |
| (...skipping 16 matching lines...) Expand all Loading... |
| 658 layer->m_visibleDescendantStatusDirty = true; | 658 layer->m_visibleDescendantStatusDirty = true; |
| 659 } | 659 } |
| 660 } | 660 } |
| 661 | 661 |
| 662 // FIXME: this is quite brute-force. We could be more efficient if we were to | 662 // FIXME: this is quite brute-force. We could be more efficient if we were to |
| 663 // track state and update it as appropriate as changes are made in the Render tr
ee. | 663 // track state and update it as appropriate as changes are made in the Render tr
ee. |
| 664 void Layer::updateScrollingStateAfterCompositingChange() | 664 void Layer::updateScrollingStateAfterCompositingChange() |
| 665 { | 665 { |
| 666 TRACE_EVENT0("blink", "Layer::updateScrollingStateAfterCompositingChange"); | 666 TRACE_EVENT0("blink", "Layer::updateScrollingStateAfterCompositingChange"); |
| 667 m_hasVisibleNonLayerContent = false; | 667 m_hasVisibleNonLayerContent = false; |
| 668 for (RenderObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { | 668 for (LayoutObject* r = renderer()->slowFirstChild(); r; r = r->nextSibling()
) { |
| 669 if (!r->hasLayer()) { | 669 if (!r->hasLayer()) { |
| 670 m_hasVisibleNonLayerContent = true; | 670 m_hasVisibleNonLayerContent = true; |
| 671 break; | 671 break; |
| 672 } | 672 } |
| 673 } | 673 } |
| 674 | 674 |
| 675 m_hasNonCompositedChild = false; | 675 m_hasNonCompositedChild = false; |
| 676 for (Layer* child = firstChild(); child; child = child->nextSibling()) { | 676 for (Layer* child = firstChild(); child; child = child->nextSibling()) { |
| 677 if (child->compositingState() == NotComposited) { | 677 if (child->compositingState() == NotComposited) { |
| 678 m_hasNonCompositedChild = true; | 678 m_hasNonCompositedChild = true; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 m_visibleDescendantStatusDirty = false; | 714 m_visibleDescendantStatusDirty = false; |
| 715 } | 715 } |
| 716 | 716 |
| 717 if (m_visibleContentStatusDirty) { | 717 if (m_visibleContentStatusDirty) { |
| 718 bool previouslyHasVisibleContent = m_hasVisibleContent; | 718 bool previouslyHasVisibleContent = m_hasVisibleContent; |
| 719 if (renderer()->style()->visibility() == VISIBLE) { | 719 if (renderer()->style()->visibility() == VISIBLE) { |
| 720 m_hasVisibleContent = true; | 720 m_hasVisibleContent = true; |
| 721 } else { | 721 } else { |
| 722 // layer may be hidden but still have some visible content, check fo
r this | 722 // layer may be hidden but still have some visible content, check fo
r this |
| 723 m_hasVisibleContent = false; | 723 m_hasVisibleContent = false; |
| 724 RenderObject* r = renderer()->slowFirstChild(); | 724 LayoutObject* r = renderer()->slowFirstChild(); |
| 725 while (r) { | 725 while (r) { |
| 726 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { | 726 if (r->style()->visibility() == VISIBLE && !r->hasLayer()) { |
| 727 m_hasVisibleContent = true; | 727 m_hasVisibleContent = true; |
| 728 break; | 728 break; |
| 729 } | 729 } |
| 730 RenderObject* rendererFirstChild = r->slowFirstChild(); | 730 LayoutObject* rendererFirstChild = r->slowFirstChild(); |
| 731 if (rendererFirstChild && !r->hasLayer()) { | 731 if (rendererFirstChild && !r->hasLayer()) { |
| 732 r = rendererFirstChild; | 732 r = rendererFirstChild; |
| 733 } else if (r->nextSibling()) { | 733 } else if (r->nextSibling()) { |
| 734 r = r->nextSibling(); | 734 r = r->nextSibling(); |
| 735 } else { | 735 } else { |
| 736 do { | 736 do { |
| 737 r = r->parent(); | 737 r = r->parent(); |
| 738 if (r == renderer()) | 738 if (r == renderer()) |
| 739 r = 0; | 739 r = 0; |
| 740 } while (r && !r->nextSibling()); | 740 } while (r && !r->nextSibling()); |
| 741 if (r) | 741 if (r) |
| 742 r = r->nextSibling(); | 742 r = r->nextSibling(); |
| 743 } | 743 } |
| 744 } | 744 } |
| 745 } | 745 } |
| 746 m_visibleContentStatusDirty = false; | 746 m_visibleContentStatusDirty = false; |
| 747 | 747 |
| 748 if (hasVisibleContent() != previouslyHasVisibleContent) { | 748 if (hasVisibleContent() != previouslyHasVisibleContent) { |
| 749 setNeedsCompositingInputsUpdate(); | 749 setNeedsCompositingInputsUpdate(); |
| 750 // We need to tell m_renderer to recheck its rect because we | 750 // We need to tell m_renderer to recheck its rect because we |
| 751 // pretend that invisible RenderObjects have 0x0 rects. Changing | 751 // pretend that invisible LayoutObjects have 0x0 rects. Changing |
| 752 // visibility therefore changes our rect and we need to visit | 752 // visibility therefore changes our rect and we need to visit |
| 753 // this RenderObject during the invalidateTreeIfNeeded walk. | 753 // this LayoutObject during the invalidateTreeIfNeeded walk. |
| 754 m_renderer->setMayNeedPaintInvalidation(); | 754 m_renderer->setMayNeedPaintInvalidation(); |
| 755 } | 755 } |
| 756 } | 756 } |
| 757 } | 757 } |
| 758 | 758 |
| 759 void Layer::dirty3DTransformedDescendantStatus() | 759 void Layer::dirty3DTransformedDescendantStatus() |
| 760 { | 760 { |
| 761 LayerStackingNode* stackingNode = m_stackingNode->ancestorStackingContextNod
e(); | 761 LayerStackingNode* stackingNode = m_stackingNode->ancestorStackingContextNod
e(); |
| 762 if (!stackingNode) | 762 if (!stackingNode) |
| 763 return; | 763 return; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 inlineBoundingBoxOffset = lineBox.location(); | 809 inlineBoundingBoxOffset = lineBox.location(); |
| 810 localPoint.moveBy(inlineBoundingBoxOffset); | 810 localPoint.moveBy(inlineBoundingBoxOffset); |
| 811 } else if (RenderBox* box = renderBox()) { | 811 } else if (RenderBox* box = renderBox()) { |
| 812 m_size = pixelSnappedIntSize(box->size(), box->location()); | 812 m_size = pixelSnappedIntSize(box->size(), box->location()); |
| 813 localPoint.moveBy(box->topLeftLocation()); | 813 localPoint.moveBy(box->topLeftLocation()); |
| 814 } | 814 } |
| 815 | 815 |
| 816 if (!renderer()->isOutOfFlowPositioned() && !renderer()->isColumnSpanAll() &
& renderer()->parent()) { | 816 if (!renderer()->isOutOfFlowPositioned() && !renderer()->isColumnSpanAll() &
& renderer()->parent()) { |
| 817 // We must adjust our position by walking up the render tree looking for
the | 817 // We must adjust our position by walking up the render tree looking for
the |
| 818 // nearest enclosing object with a layer. | 818 // nearest enclosing object with a layer. |
| 819 RenderObject* curr = renderer()->parent(); | 819 LayoutObject* curr = renderer()->parent(); |
| 820 while (curr && !curr->hasLayer()) { | 820 while (curr && !curr->hasLayer()) { |
| 821 if (curr->isBox() && !curr->isTableRow()) { | 821 if (curr->isBox() && !curr->isTableRow()) { |
| 822 // Rows and cells share the same coordinate space (that of the s
ection). | 822 // Rows and cells share the same coordinate space (that of the s
ection). |
| 823 // Omit them when computing our xpos/ypos. | 823 // Omit them when computing our xpos/ypos. |
| 824 localPoint.moveBy(toRenderBox(curr)->topLeftLocation()); | 824 localPoint.moveBy(toRenderBox(curr)->topLeftLocation()); |
| 825 } | 825 } |
| 826 curr = curr->parent(); | 826 curr = curr->parent(); |
| 827 } | 827 } |
| 828 if (curr->isBox() && curr->isTableRow()) { | 828 if (curr->isBox() && curr->isTableRow()) { |
| 829 // Put ourselves into the row coordinate space. | 829 // Put ourselves into the row coordinate space. |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 996 | 996 |
| 997 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer | 997 // Return the enclosingCompositedLayerForPaintInvalidation for the given Layer |
| 998 // including crossing frame boundaries. | 998 // including crossing frame boundaries. |
| 999 Layer* Layer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const | 999 Layer* Layer::enclosingLayerForPaintInvalidationCrossingFrameBoundaries() const |
| 1000 { | 1000 { |
| 1001 const Layer* layer = this; | 1001 const Layer* layer = this; |
| 1002 Layer* compositedLayer = 0; | 1002 Layer* compositedLayer = 0; |
| 1003 while (!compositedLayer) { | 1003 while (!compositedLayer) { |
| 1004 compositedLayer = layer->enclosingLayerForPaintInvalidation(); | 1004 compositedLayer = layer->enclosingLayerForPaintInvalidation(); |
| 1005 if (!compositedLayer) { | 1005 if (!compositedLayer) { |
| 1006 RenderObject* owner = layer->renderer()->frame()->ownerRenderer(); | 1006 LayoutObject* owner = layer->renderer()->frame()->ownerRenderer(); |
| 1007 if (!owner) | 1007 if (!owner) |
| 1008 break; | 1008 break; |
| 1009 layer = owner->enclosingLayer(); | 1009 layer = owner->enclosingLayer(); |
| 1010 } | 1010 } |
| 1011 } | 1011 } |
| 1012 return compositedLayer; | 1012 return compositedLayer; |
| 1013 } | 1013 } |
| 1014 | 1014 |
| 1015 Layer* Layer::enclosingLayerForPaintInvalidation() const | 1015 Layer* Layer::enclosingLayerForPaintInvalidation() const |
| 1016 { | 1016 { |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 if (!m_parent && renderer()->parent()) { | 1325 if (!m_parent && renderer()->parent()) { |
| 1326 // We need to connect ourselves when our renderer() has a parent. | 1326 // We need to connect ourselves when our renderer() has a parent. |
| 1327 // Find our enclosingLayer and add ourselves. | 1327 // Find our enclosingLayer and add ourselves. |
| 1328 Layer* parentLayer = renderer()->parent()->enclosingLayer(); | 1328 Layer* parentLayer = renderer()->parent()->enclosingLayer(); |
| 1329 ASSERT(parentLayer); | 1329 ASSERT(parentLayer); |
| 1330 Layer* beforeChild = !parentLayer->reflectionInfo() || parentLayer->refl
ectionInfo()->reflectionLayer() != this ? renderer()->parent()->findNextLayer(pa
rentLayer, renderer()) : 0; | 1330 Layer* beforeChild = !parentLayer->reflectionInfo() || parentLayer->refl
ectionInfo()->reflectionLayer() != this ? renderer()->parent()->findNextLayer(pa
rentLayer, renderer()) : 0; |
| 1331 parentLayer->addChild(this, beforeChild); | 1331 parentLayer->addChild(this, beforeChild); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 // Remove all descendant layers from the hierarchy and add them to the new p
osition. | 1334 // Remove all descendant layers from the hierarchy and add them to the new p
osition. |
| 1335 for (RenderObject* curr = renderer()->slowFirstChild(); curr; curr = curr->n
extSibling()) | 1335 for (LayoutObject* curr = renderer()->slowFirstChild(); curr; curr = curr->n
extSibling()) |
| 1336 curr->moveLayers(m_parent, this); | 1336 curr->moveLayers(m_parent, this); |
| 1337 | 1337 |
| 1338 // Clear out all the clip rects. | 1338 // Clear out all the clip rects. |
| 1339 m_clipper.clearClipRectsIncludingDescendants(); | 1339 m_clipper.clearClipRectsIncludingDescendants(); |
| 1340 } | 1340 } |
| 1341 | 1341 |
| 1342 // Returns the layer reached on the walk up towards the ancestor. | 1342 // Returns the layer reached on the walk up towards the ancestor. |
| 1343 static inline const Layer* accumulateOffsetTowardsAncestor(const Layer* layer, c
onst Layer* ancestorLayer, LayoutPoint& location) | 1343 static inline const Layer* accumulateOffsetTowardsAncestor(const Layer* layer, c
onst Layer* ancestorLayer, LayoutPoint& location) |
| 1344 { | 1344 { |
| 1345 ASSERT(ancestorLayer != layer); | 1345 ASSERT(ancestorLayer != layer); |
| (...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 // Intersect the fragment with our ancestor's background clip so that e.
g., columns in an overflow:hidden block are | 1626 // Intersect the fragment with our ancestor's background clip so that e.
g., columns in an overflow:hidden block are |
| 1627 // properly clipped by the overflow. | 1627 // properly clipped by the overflow. |
| 1628 fragment.intersect(ancestorClipRect.rect()); | 1628 fragment.intersect(ancestorClipRect.rect()); |
| 1629 | 1629 |
| 1630 // Now intersect with our pagination clip. This will typically mean we'r
e just intersecting the dirty rect with the column | 1630 // Now intersect with our pagination clip. This will typically mean we'r
e just intersecting the dirty rect with the column |
| 1631 // clip, so the column clip ends up being all we apply. | 1631 // clip, so the column clip ends up being all we apply. |
| 1632 fragment.intersect(fragment.paginationClip); | 1632 fragment.intersect(fragment.paginationClip); |
| 1633 } | 1633 } |
| 1634 } | 1634 } |
| 1635 | 1635 |
| 1636 static inline LayoutRect frameVisibleRect(RenderObject* renderer) | 1636 static inline LayoutRect frameVisibleRect(LayoutObject* renderer) |
| 1637 { | 1637 { |
| 1638 FrameView* frameView = renderer->document().view(); | 1638 FrameView* frameView = renderer->document().view(); |
| 1639 if (!frameView) | 1639 if (!frameView) |
| 1640 return LayoutRect(); | 1640 return LayoutRect(); |
| 1641 | 1641 |
| 1642 return frameView->visibleContentRect(); | 1642 return frameView->visibleContentRect(); |
| 1643 } | 1643 } |
| 1644 | 1644 |
| 1645 bool Layer::hitTest(const HitTestRequest& request, HitTestResult& result) | 1645 bool Layer::hitTest(const HitTestRequest& request, HitTestResult& result) |
| 1646 { | 1646 { |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 if (node && !result.URLElement()) | 1679 if (node && !result.URLElement()) |
| 1680 result.setURLElement(node->enclosingLinkEventParentOrSelf()); | 1680 result.setURLElement(node->enclosingLinkEventParentOrSelf()); |
| 1681 | 1681 |
| 1682 // Now return whether we were inside this layer (this will always be true fo
r the root | 1682 // Now return whether we were inside this layer (this will always be true fo
r the root |
| 1683 // layer). | 1683 // layer). |
| 1684 return insideLayer; | 1684 return insideLayer; |
| 1685 } | 1685 } |
| 1686 | 1686 |
| 1687 Node* Layer::enclosingElement() const | 1687 Node* Layer::enclosingElement() const |
| 1688 { | 1688 { |
| 1689 for (RenderObject* r = renderer(); r; r = r->parent()) { | 1689 for (LayoutObject* r = renderer(); r; r = r->parent()) { |
| 1690 if (Node* e = r->node()) | 1690 if (Node* e = r->node()) |
| 1691 return e; | 1691 return e; |
| 1692 } | 1692 } |
| 1693 ASSERT_NOT_REACHED(); | 1693 ASSERT_NOT_REACHED(); |
| 1694 return 0; | 1694 return 0; |
| 1695 } | 1695 } |
| 1696 | 1696 |
| 1697 bool Layer::isInTopLayer() const | 1697 bool Layer::isInTopLayer() const |
| 1698 { | 1698 { |
| 1699 Node* node = renderer()->node(); | 1699 Node* node = renderer()->node(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 1729 transformState = HitTestingTransformState::create(*containerTransformSta
te); | 1729 transformState = HitTestingTransformState::create(*containerTransformSta
te); |
| 1730 convertToLayerCoords(containerLayer, offset); | 1730 convertToLayerCoords(containerLayer, offset); |
| 1731 } else { | 1731 } else { |
| 1732 // If this is the first time we need to make transform state, then base
it off of hitTestLocation, | 1732 // If this is the first time we need to make transform state, then base
it off of hitTestLocation, |
| 1733 // which is relative to rootLayer. | 1733 // which is relative to rootLayer. |
| 1734 transformState = HitTestingTransformState::create(hitTestLocation.transf
ormedPoint(), hitTestLocation.transformedRect(), FloatQuad(hitTestRect)); | 1734 transformState = HitTestingTransformState::create(hitTestLocation.transf
ormedPoint(), hitTestLocation.transformedRect(), FloatQuad(hitTestRect)); |
| 1735 convertToLayerCoords(rootLayer, offset); | 1735 convertToLayerCoords(rootLayer, offset); |
| 1736 } | 1736 } |
| 1737 offset.moveBy(translationOffset); | 1737 offset.moveBy(translationOffset); |
| 1738 | 1738 |
| 1739 RenderObject* containerRenderer = containerLayer ? containerLayer->renderer(
) : 0; | 1739 LayoutObject* containerRenderer = containerLayer ? containerLayer->renderer(
) : 0; |
| 1740 if (renderer()->shouldUseTransformFromContainer(containerRenderer)) { | 1740 if (renderer()->shouldUseTransformFromContainer(containerRenderer)) { |
| 1741 TransformationMatrix containerTransform; | 1741 TransformationMatrix containerTransform; |
| 1742 renderer()->getTransformFromContainer(containerRenderer, toLayoutSize(of
fset), containerTransform); | 1742 renderer()->getTransformFromContainer(containerRenderer, toLayoutSize(of
fset), containerTransform); |
| 1743 transformState->applyTransform(containerTransform, HitTestingTransformSt
ate::AccumulateTransform); | 1743 transformState->applyTransform(containerTransform, HitTestingTransformSt
ate::AccumulateTransform); |
| 1744 } else { | 1744 } else { |
| 1745 transformState->translate(offset.x(), offset.y(), HitTestingTransformSta
te::AccumulateTransform); | 1745 transformState->translate(offset.x(), offset.y(), HitTestingTransformSta
te::AccumulateTransform); |
| 1746 } | 1746 } |
| 1747 | 1747 |
| 1748 return transformState; | 1748 return transformState; |
| 1749 } | 1749 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1877 | 1877 |
| 1878 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. | 1878 // Collect the fragments. This will compute the clip rectangles for each lay
er fragment. |
| 1879 LayerFragments layerFragments; | 1879 LayerFragments layerFragments; |
| 1880 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec
ts, IncludeOverlayScrollbarSize); | 1880 collectFragments(layerFragments, rootLayer, hitTestRect, RootRelativeClipRec
ts, IncludeOverlayScrollbarSize); |
| 1881 | 1881 |
| 1882 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { | 1882 if (m_scrollableArea && m_scrollableArea->hitTestResizerInFragments(layerFra
gments, hitTestLocation)) { |
| 1883 renderer()->updateHitTestResult(result, hitTestLocation.point()); | 1883 renderer()->updateHitTestResult(result, hitTestLocation.point()); |
| 1884 return this; | 1884 return this; |
| 1885 } | 1885 } |
| 1886 | 1886 |
| 1887 // Next we want to see if the mouse pos is inside the child RenderObjects of
the layer. Check | 1887 // Next we want to see if the mouse pos is inside the child LayoutObjects of
the layer. Check |
| 1888 // every fragment in reverse order. | 1888 // every fragment in reverse order. |
| 1889 if (isSelfPaintingLayer()) { | 1889 if (isSelfPaintingLayer()) { |
| 1890 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. | 1890 // Hit test with a temporary HitTestResult, because we only want to comm
it to 'result' if we know we're frontmost. |
| 1891 HitTestResult tempResult(result.hitTestLocation()); | 1891 HitTestResult tempResult(result.hitTestLocation()); |
| 1892 bool insideFragmentForegroundRect = false; | 1892 bool insideFragmentForegroundRect = false; |
| 1893 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) | 1893 if (hitTestContentsForFragments(layerFragments, request, tempResult, hit
TestLocation, HitTestDescendants, insideFragmentForegroundRect) |
| 1894 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { | 1894 && isHitCandidate(this, false, zOffsetForContentsPtr, unflattenedTra
nsformState.get())) { |
| 1895 if (result.isRectBasedTest()) | 1895 if (result.isRectBasedTest()) |
| 1896 result.append(tempResult); | 1896 result.append(tempResult); |
| 1897 else | 1897 else |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2301 // (2) Left/Top Overflow. The width/height of layers already includes right
/bottom overflow. However, in the case of left/top | 2301 // (2) Left/Top Overflow. The width/height of layers already includes right
/bottom overflow. However, in the case of left/top |
| 2302 // overflow, we have to create a bounding box that will extend to include th
is overflow. | 2302 // overflow, we have to create a bounding box that will extend to include th
is overflow. |
| 2303 // (3) Floats. When a layer has overhanging floats that it paints, we need
to make sure to include these overhanging floats | 2303 // (3) Floats. When a layer has overhanging floats that it paints, we need
to make sure to include these overhanging floats |
| 2304 // as part of our bounding box. We do this because we are the responsible l
ayer for both hit testing and painting those | 2304 // as part of our bounding box. We do this because we are the responsible l
ayer for both hit testing and painting those |
| 2305 // floats. | 2305 // floats. |
| 2306 LayoutRect result; | 2306 LayoutRect result; |
| 2307 if (renderer()->isInline() && renderer()->isRenderInline()) { | 2307 if (renderer()->isInline() && renderer()->isRenderInline()) { |
| 2308 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox(); | 2308 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox(); |
| 2309 } else if (renderer()->isTableRow()) { | 2309 } else if (renderer()->isTableRow()) { |
| 2310 // Our bounding box is just the union of all of our cells' border/overfl
ow rects. | 2310 // Our bounding box is just the union of all of our cells' border/overfl
ow rects. |
| 2311 for (RenderObject* child = renderer()->slowFirstChild(); child; child =
child->nextSibling()) { | 2311 for (LayoutObject* child = renderer()->slowFirstChild(); child; child =
child->nextSibling()) { |
| 2312 if (child->isTableCell()) { | 2312 if (child->isTableCell()) { |
| 2313 LayoutRect bbox = toRenderBox(child)->borderBoxRect(); | 2313 LayoutRect bbox = toRenderBox(child)->borderBoxRect(); |
| 2314 result.unite(bbox); | 2314 result.unite(bbox); |
| 2315 LayoutRect overflowRect = renderBox()->visualOverflowRect(); | 2315 LayoutRect overflowRect = renderBox()->visualOverflowRect(); |
| 2316 if (bbox != overflowRect) | 2316 if (bbox != overflowRect) |
| 2317 result.unite(overflowRect); | 2317 result.unite(overflowRect); |
| 2318 } | 2318 } |
| 2319 } | 2319 } |
| 2320 } else { | 2320 } else { |
| 2321 RenderBox* box = renderBox(); | 2321 RenderBox* box = renderBox(); |
| 2322 ASSERT(box); | 2322 ASSERT(box); |
| 2323 result = box->borderBoxRect(); | 2323 result = box->borderBoxRect(); |
| 2324 result.unite(box->visualOverflowRect()); | 2324 result.unite(box->visualOverflowRect()); |
| 2325 } | 2325 } |
| 2326 | 2326 |
| 2327 ASSERT(renderer()->view()); | 2327 ASSERT(renderer()->view()); |
| 2328 return result; | 2328 return result; |
| 2329 } | 2329 } |
| 2330 | 2330 |
| 2331 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Rende
rObject* renderer) | 2331 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Layou
tObject* renderer) |
| 2332 { | 2332 { |
| 2333 LayoutRect result = boundingBox; | 2333 LayoutRect result = boundingBox; |
| 2334 if (renderer->isBox()) | 2334 if (renderer->isBox()) |
| 2335 toRenderBox(renderer)->flipForWritingMode(result); | 2335 toRenderBox(renderer)->flipForWritingMode(result); |
| 2336 else | 2336 else |
| 2337 renderer->containingBlock()->flipForWritingMode(result); | 2337 renderer->containingBlock()->flipForWritingMode(result); |
| 2338 return result; | 2338 return result; |
| 2339 } | 2339 } |
| 2340 | 2340 |
| 2341 LayoutRect Layer::physicalBoundingBox(const Layer* ancestorLayer, const LayoutPo
int* offsetFromRoot) const | 2341 LayoutRect Layer::physicalBoundingBox(const Layer* ancestorLayer, const LayoutPo
int* offsetFromRoot) const |
| (...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2653 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); | 2653 parent()->dirtyAncestorChainHasSelfPaintingLayerDescendantStatus(); |
| 2654 } | 2654 } |
| 2655 | 2655 |
| 2656 bool Layer::hasNonEmptyChildRenderers() const | 2656 bool Layer::hasNonEmptyChildRenderers() const |
| 2657 { | 2657 { |
| 2658 // Some HTML can cause whitespace text nodes to have renderers, like: | 2658 // Some HTML can cause whitespace text nodes to have renderers, like: |
| 2659 // <div> | 2659 // <div> |
| 2660 // <img src=...> | 2660 // <img src=...> |
| 2661 // </div> | 2661 // </div> |
| 2662 // so test for 0x0 RenderTexts here | 2662 // so test for 0x0 RenderTexts here |
| 2663 for (RenderObject* child = renderer()->slowFirstChild(); child; child = chil
d->nextSibling()) { | 2663 for (LayoutObject* child = renderer()->slowFirstChild(); child; child = chil
d->nextSibling()) { |
| 2664 if (!child->hasLayer()) { | 2664 if (!child->hasLayer()) { |
| 2665 if (child->isRenderInline() || !child->isBox()) | 2665 if (child->isRenderInline() || !child->isBox()) |
| 2666 return true; | 2666 return true; |
| 2667 | 2667 |
| 2668 if (!toRenderBox(child)->size().isEmpty()) | 2668 if (!toRenderBox(child)->size().isEmpty()) |
| 2669 return true; | 2669 return true; |
| 2670 } | 2670 } |
| 2671 } | 2671 } |
| 2672 return false; | 2672 return false; |
| 2673 } | 2673 } |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2922 { | 2922 { |
| 2923 if (!layer) | 2923 if (!layer) |
| 2924 return; | 2924 return; |
| 2925 | 2925 |
| 2926 if (blink::LocalFrame* frame = layer->renderer()->frame()) { | 2926 if (blink::LocalFrame* frame = layer->renderer()->frame()) { |
| 2927 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh
owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo
sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla
ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState); | 2927 WTF::String output = externalRepresentation(frame, blink::LayoutAsTextSh
owAllLayers | blink::LayoutAsTextShowLayerNesting | blink::LayoutAsTextShowCompo
sitedLayers | blink::LayoutAsTextShowAddresses | blink::LayoutAsTextShowIDAndCla
ss | blink::LayoutAsTextDontUpdateLayout | blink::LayoutAsTextShowLayoutState); |
| 2928 fprintf(stderr, "%s\n", output.utf8().data()); | 2928 fprintf(stderr, "%s\n", output.utf8().data()); |
| 2929 } | 2929 } |
| 2930 } | 2930 } |
| 2931 | 2931 |
| 2932 void showLayerTree(const blink::RenderObject* renderer) | 2932 void showLayerTree(const blink::LayoutObject* renderer) |
| 2933 { | 2933 { |
| 2934 if (!renderer) | 2934 if (!renderer) |
| 2935 return; | 2935 return; |
| 2936 showLayerTree(renderer->enclosingLayer()); | 2936 showLayerTree(renderer->enclosingLayer()); |
| 2937 } | 2937 } |
| 2938 #endif | 2938 #endif |
| OLD | NEW |