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

Side by Side Diff: Source/core/layout/Layer.cpp

Issue 926193003: Move rendering/RenderBox to layout/LayoutBox. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « Source/core/layout/Layer.h ('k') | Source/core/layout/LayerClipper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 if (updateLayerPosition()) 325 if (updateLayerPosition())
326 m_renderer->setPreviousPaintInvalidationRect(m_renderer->boundsRectForPa intInvalidation(m_renderer->containerForPaintInvalidation())); 326 m_renderer->setPreviousPaintInvalidationRect(m_renderer->boundsRectForPa intInvalidation(m_renderer->containerForPaintInvalidation()));
327 327
328 for (Layer* child = firstChild(); child; child = child->nextSibling()) 328 for (Layer* child = firstChild(); child; child = child->nextSibling())
329 child->updateLayerPositionsAfterScrollRecursive(); 329 child->updateLayerPositionsAfterScrollRecursive();
330 } 330 }
331 331
332 void Layer::updateTransformationMatrix() 332 void Layer::updateTransformationMatrix()
333 { 333 {
334 if (m_transform) { 334 if (m_transform) {
335 RenderBox* box = renderBox(); 335 LayoutBox* box = layoutBox();
336 ASSERT(box); 336 ASSERT(box);
337 m_transform->makeIdentity(); 337 m_transform->makeIdentity();
338 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS ize()), LayoutStyle::IncludeTransformOrigin); 338 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS ize()), LayoutStyle::IncludeTransformOrigin);
339 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng()); 339 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng());
340 } 340 }
341 } 341 }
342 342
343 void Layer::updateTransform(const LayoutStyle* oldStyle, const LayoutStyle& newS tyle) 343 void Layer::updateTransform(const LayoutStyle* oldStyle, const LayoutStyle& newS tyle)
344 { 344 {
345 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle)) 345 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle))
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 return renderingContext; 389 return renderingContext;
390 } 390 }
391 391
392 TransformationMatrix Layer::currentTransform(LayoutStyle::ApplyTransformOrigin a pplyOrigin) const 392 TransformationMatrix Layer::currentTransform(LayoutStyle::ApplyTransformOrigin a pplyOrigin) const
393 { 393 {
394 if (!m_transform) 394 if (!m_transform)
395 return TransformationMatrix(); 395 return TransformationMatrix();
396 396
397 // m_transform includes transform-origin, so we need to recompute the transf orm here. 397 // m_transform includes transform-origin, so we need to recompute the transf orm here.
398 if (applyOrigin == LayoutStyle::ExcludeTransformOrigin) { 398 if (applyOrigin == LayoutStyle::ExcludeTransformOrigin) {
399 RenderBox* box = renderBox(); 399 LayoutBox* box = layoutBox();
400 TransformationMatrix currTransform; 400 TransformationMatrix currTransform;
401 box->style()->applyTransform(currTransform, LayoutSize(box->pixelSnapped Size()), LayoutStyle::ExcludeTransformOrigin); 401 box->style()->applyTransform(currTransform, LayoutSize(box->pixelSnapped Size()), LayoutStyle::ExcludeTransformOrigin);
402 makeMatrixRenderable(currTransform, compositor()->hasAcceleratedComposit ing()); 402 makeMatrixRenderable(currTransform, compositor()->hasAcceleratedComposit ing());
403 return currTransform; 403 return currTransform;
404 } 404 }
405 405
406 return *m_transform; 406 return *m_transform;
407 } 407 }
408 408
409 TransformationMatrix Layer::renderableTransform(PaintBehavior paintBehavior) con st 409 TransformationMatrix Layer::renderableTransform(PaintBehavior paintBehavior) con st
410 { 410 {
411 if (!m_transform) 411 if (!m_transform)
412 return TransformationMatrix(); 412 return TransformationMatrix();
413 413
414 if (paintBehavior & PaintBehaviorFlattenCompositingLayers) { 414 if (paintBehavior & PaintBehaviorFlattenCompositingLayers) {
415 TransformationMatrix matrix = *m_transform; 415 TransformationMatrix matrix = *m_transform;
416 makeMatrixRenderable(matrix, false /* flatten 3d */); 416 makeMatrixRenderable(matrix, false /* flatten 3d */);
417 return matrix; 417 return matrix;
418 } 418 }
419 419
420 return *m_transform; 420 return *m_transform;
421 } 421 }
422 422
423 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere r, RenderBox* ancestorColumnsRenderer) 423 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere r, LayoutBox* ancestorColumnsRenderer)
424 { 424 {
425 RenderView* view = renderer->view(); 425 RenderView* view = renderer->view();
426 LayoutBoxModelObject* prevBlock = renderer; 426 LayoutBoxModelObject* prevBlock = renderer;
427 RenderBlock* containingBlock; 427 RenderBlock* containingBlock;
428 for (containingBlock = renderer->containingBlock(); 428 for (containingBlock = renderer->containingBlock();
429 containingBlock && containingBlock != view && containingBlock != ancesto rColumnsRenderer; 429 containingBlock && containingBlock != view && containingBlock != ancesto rColumnsRenderer;
430 containingBlock = containingBlock->containingBlock()) 430 containingBlock = containingBlock->containingBlock())
431 prevBlock = containingBlock; 431 prevBlock = containingBlock;
432 432
433 // If the columns block wasn't in our containing block chain, then we aren't paginated by it. 433 // If the columns block wasn't in our containing block chain, then we aren't paginated by it.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
543 return; 543 return;
544 } 544 }
545 } 545 }
546 return; 546 return;
547 } 547 }
548 548
549 // If we're not normal flow, then we need to look for a multi-column object between us and our stacking container. 549 // If we're not normal flow, then we need to look for a multi-column object between us and our stacking container.
550 LayerStackingNode* ancestorStackingContextNode = m_stackingNode->ancestorSta ckingContextNode(); 550 LayerStackingNode* ancestorStackingContextNode = m_stackingNode->ancestorSta ckingContextNode();
551 for (Layer* curr = parent(); curr; curr = curr->parent()) { 551 for (Layer* curr = parent(); curr; curr = curr->parent()) {
552 if (curr->renderer()->hasColumns()) { 552 if (curr->renderer()->hasColumns()) {
553 m_isPaginated = checkContainingBlockChainForPagination(renderer(), c urr->renderBox()); 553 m_isPaginated = checkContainingBlockChainForPagination(renderer(), c urr->layoutBox());
554 return; 554 return;
555 } 555 }
556 if (curr->stackingNode() == ancestorStackingContextNode) 556 if (curr->stackingNode() == ancestorStackingContextNode)
557 return; 557 return;
558 } 558 }
559 } 559 }
560 560
561 void Layer::clearPaginationRecursive() 561 void Layer::clearPaginationRecursive()
562 { 562 {
563 m_enclosingPaginationLayer = 0; 563 m_enclosingPaginationLayer = 0;
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 { 808 {
809 LayoutPoint localPoint; 809 LayoutPoint localPoint;
810 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done. 810 LayoutPoint inlineBoundingBoxOffset; // We don't put this into the Layer x/y for inlines, so we need to subtract it out when done.
811 811
812 if (renderer()->isInline() && renderer()->isRenderInline()) { 812 if (renderer()->isInline() && renderer()->isRenderInline()) {
813 RenderInline* inlineFlow = toRenderInline(renderer()); 813 RenderInline* inlineFlow = toRenderInline(renderer());
814 IntRect lineBox = inlineFlow->linesBoundingBox(); 814 IntRect lineBox = inlineFlow->linesBoundingBox();
815 m_size = lineBox.size(); 815 m_size = lineBox.size();
816 inlineBoundingBoxOffset = lineBox.location(); 816 inlineBoundingBoxOffset = lineBox.location();
817 localPoint.moveBy(inlineBoundingBoxOffset); 817 localPoint.moveBy(inlineBoundingBoxOffset);
818 } else if (RenderBox* box = renderBox()) { 818 } else if (LayoutBox* box = layoutBox()) {
819 m_size = pixelSnappedIntSize(box->size(), box->location()); 819 m_size = pixelSnappedIntSize(box->size(), box->location());
820 localPoint.moveBy(box->topLeftLocation()); 820 localPoint.moveBy(box->topLeftLocation());
821 } 821 }
822 822
823 if (!renderer()->isOutOfFlowPositioned() && !renderer()->isColumnSpanAll() & & renderer()->parent()) { 823 if (!renderer()->isOutOfFlowPositioned() && !renderer()->isColumnSpanAll() & & renderer()->parent()) {
824 // We must adjust our position by walking up the render tree looking for the 824 // We must adjust our position by walking up the render tree looking for the
825 // nearest enclosing object with a layer. 825 // nearest enclosing object with a layer.
826 LayoutObject* curr = renderer()->parent(); 826 LayoutObject* curr = renderer()->parent();
827 while (curr && !curr->hasLayer()) { 827 while (curr && !curr->hasLayer()) {
828 if (curr->isBox() && !curr->isTableRow()) { 828 if (curr->isBox() && !curr->isTableRow()) {
829 // Rows and cells share the same coordinate space (that of the s ection). 829 // Rows and cells share the same coordinate space (that of the s ection).
830 // Omit them when computing our xpos/ypos. 830 // Omit them when computing our xpos/ypos.
831 localPoint.moveBy(toRenderBox(curr)->topLeftLocation()); 831 localPoint.moveBy(toLayoutBox(curr)->topLeftLocation());
832 } 832 }
833 curr = curr->parent(); 833 curr = curr->parent();
834 } 834 }
835 if (curr->isBox() && curr->isTableRow()) { 835 if (curr->isBox() && curr->isTableRow()) {
836 // Put ourselves into the row coordinate space. 836 // Put ourselves into the row coordinate space.
837 localPoint.moveBy(-toRenderBox(curr)->topLeftLocation()); 837 localPoint.moveBy(-toLayoutBox(curr)->topLeftLocation());
838 } 838 }
839 } 839 }
840 840
841 // Subtract our parent's scroll offset. 841 // Subtract our parent's scroll offset.
842 if (renderer()->isOutOfFlowPositioned() && enclosingPositionedAncestor()) { 842 if (renderer()->isOutOfFlowPositioned() && enclosingPositionedAncestor()) {
843 Layer* positionedParent = enclosingPositionedAncestor(); 843 Layer* positionedParent = enclosingPositionedAncestor();
844 844
845 // For positioned layers, we subtract out the enclosing positioned layer 's scroll offset. 845 // For positioned layers, we subtract out the enclosing positioned layer 's scroll offset.
846 if (positionedParent->renderer()->hasOverflowClip()) { 846 if (positionedParent->renderer()->hasOverflowClip()) {
847 IntSize offset = positionedParent->renderBox()->scrolledContentOffse t(); 847 IntSize offset = positionedParent->layoutBox()->scrolledContentOffse t();
848 localPoint -= offset; 848 localPoint -= offset;
849 } 849 }
850 850
851 if (positionedParent->renderer()->isRelPositioned() && positionedParent- >renderer()->isRenderInline()) { 851 if (positionedParent->renderer()->isRelPositioned() && positionedParent- >renderer()->isRenderInline()) {
852 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(*toRenderBox(renderer())); 852 LayoutSize offset = toRenderInline(positionedParent->renderer())->of fsetForInFlowPositionedInline(*toLayoutBox(renderer()));
853 localPoint += offset; 853 localPoint += offset;
854 } 854 }
855 } else if (parent()) { 855 } else if (parent()) {
856 // FIXME: This code is very wrong, but luckily only needed in the old/cu rrent multicol 856 // FIXME: This code is very wrong, but luckily only needed in the old/cu rrent multicol
857 // implementation. The compositing system doesn't understand columns and we're hacking 857 // implementation. The compositing system doesn't understand columns and we're hacking
858 // around that fact by faking the position of the Layers when we think w e'll end up 858 // around that fact by faking the position of the Layers when we think w e'll end up
859 // being composited. 859 // being composited.
860 if (hasStyleDeterminedDirectCompositingReasons() && !useRegionBasedColum ns()) { 860 if (hasStyleDeterminedDirectCompositingReasons() && !useRegionBasedColum ns()) {
861 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column. 861 // FIXME: Composited layers ignore pagination, so about the best we can do is make sure they're offset into the appropriate column.
862 // They won't split across columns properly. 862 // They won't split across columns properly.
863 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isD ocumentElement() && renderer()->view()->hasColumns()) 863 if (!parent()->renderer()->hasColumns() && parent()->renderer()->isD ocumentElement() && renderer()->view()->hasColumns())
864 localPoint += renderer()->view()->columnOffset(localPoint); 864 localPoint += renderer()->view()->columnOffset(localPoint);
865 else 865 else
866 localPoint += parent()->renderer()->columnOffset(localPoint); 866 localPoint += parent()->renderer()->columnOffset(localPoint);
867 } 867 }
868 868
869 if (parent()->renderer()->hasOverflowClip()) { 869 if (parent()->renderer()->hasOverflowClip()) {
870 IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset( ); 870 IntSize scrollOffset = parent()->layoutBox()->scrolledContentOffset( );
871 localPoint -= scrollOffset; 871 localPoint -= scrollOffset;
872 } 872 }
873 } 873 }
874 874
875 bool positionOrOffsetChanged = false; 875 bool positionOrOffsetChanged = false;
876 if (renderer()->isRelPositioned()) { 876 if (renderer()->isRelPositioned()) {
877 LayoutSize newOffset = renderer()->offsetForInFlowPosition(); 877 LayoutSize newOffset = renderer()->offsetForInFlowPosition();
878 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition; 878 positionOrOffsetChanged = newOffset != m_offsetForInFlowPosition;
879 m_offsetForInFlowPosition = newOffset; 879 m_offsetForInFlowPosition = newOffset;
880 localPoint.move(m_offsetForInFlowPosition); 880 localPoint.move(m_offsetForInFlowPosition);
(...skipping 17 matching lines...) Expand all
898 TransformationMatrix Layer::perspectiveTransform() const 898 TransformationMatrix Layer::perspectiveTransform() const
899 { 899 {
900 if (!renderer()->hasTransformRelatedProperty()) 900 if (!renderer()->hasTransformRelatedProperty())
901 return TransformationMatrix(); 901 return TransformationMatrix();
902 902
903 const LayoutStyle& style = renderer()->styleRef(); 903 const LayoutStyle& style = renderer()->styleRef();
904 if (!style.hasPerspective()) 904 if (!style.hasPerspective())
905 return TransformationMatrix(); 905 return TransformationMatrix();
906 906
907 // Maybe fetch the perspective from the backing? 907 // Maybe fetch the perspective from the backing?
908 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect (); 908 const IntRect borderBox = toLayoutBox(renderer())->pixelSnappedBorderBoxRect ();
909 const float boxWidth = borderBox.width(); 909 const float boxWidth = borderBox.width();
910 const float boxHeight = borderBox.height(); 910 const float boxHeight = borderBox.height();
911 911
912 float perspectiveOriginX = floatValueForLength(style.perspectiveOriginX(), b oxWidth); 912 float perspectiveOriginX = floatValueForLength(style.perspectiveOriginX(), b oxWidth);
913 float perspectiveOriginY = floatValueForLength(style.perspectiveOriginY(), b oxHeight); 913 float perspectiveOriginY = floatValueForLength(style.perspectiveOriginY(), b oxHeight);
914 914
915 // A perspective origin of 0,0 makes the vanishing point in the center of th e element. 915 // A perspective origin of 0,0 makes the vanishing point in the center of th e element.
916 // We want it to be in the top-left, so subtract half the height and width. 916 // We want it to be in the top-left, so subtract half the height and width.
917 perspectiveOriginX -= boxWidth / 2.0f; 917 perspectiveOriginX -= boxWidth / 2.0f;
918 perspectiveOriginY -= boxHeight / 2.0f; 918 perspectiveOriginY -= boxHeight / 2.0f;
919 919
920 TransformationMatrix t; 920 TransformationMatrix t;
921 t.translate(perspectiveOriginX, perspectiveOriginY); 921 t.translate(perspectiveOriginX, perspectiveOriginY);
922 t.applyPerspective(style.perspective()); 922 t.applyPerspective(style.perspective());
923 t.translate(-perspectiveOriginX, -perspectiveOriginY); 923 t.translate(-perspectiveOriginX, -perspectiveOriginY);
924 924
925 return t; 925 return t;
926 } 926 }
927 927
928 FloatPoint Layer::perspectiveOrigin() const 928 FloatPoint Layer::perspectiveOrigin() const
929 { 929 {
930 if (!renderer()->hasTransformRelatedProperty()) 930 if (!renderer()->hasTransformRelatedProperty())
931 return FloatPoint(); 931 return FloatPoint();
932 932
933 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); 933 const LayoutRect borderBox = toLayoutBox(renderer())->borderBoxRect();
934 const LayoutStyle& style = renderer()->styleRef(); 934 const LayoutStyle& style = renderer()->styleRef();
935 935
936 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox. width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he ight().toFloat())); 936 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox. width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he ight().toFloat()));
937 } 937 }
938 938
939 static inline bool isFixedPositionedContainer(Layer* layer) 939 static inline bool isFixedPositionedContainer(Layer* layer)
940 { 940 {
941 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); 941 return layer->isRootLayer() || layer->hasTransformRelatedProperty();
942 } 942 }
943 943
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1128 } 1128 }
1129 1129
1130 // If we have a reflection, then we need to account for that when we push th e clip. Reflect our entire 1130 // If we have a reflection, then we need to account for that when we push th e clip. Reflect our entire
1131 // current transparencyClipBox to catch all child layers. 1131 // current transparencyClipBox to catch all child layers.
1132 // FIXME: Accelerated compositing will eventually want to do something smart here to avoid incorporating this 1132 // FIXME: Accelerated compositing will eventually want to do something smart here to avoid incorporating this
1133 // size into the parent layer. 1133 // size into the parent layer.
1134 if (layer->renderer()->hasReflection()) { 1134 if (layer->renderer()->hasReflection()) {
1135 LayoutPoint delta; 1135 LayoutPoint delta;
1136 layer->convertToLayerCoords(rootLayer, delta); 1136 layer->convertToLayerCoords(rootLayer, delta);
1137 clipRect.move(-delta.x(), -delta.y()); 1137 clipRect.move(-delta.x(), -delta.y());
1138 clipRect.unite(layer->renderBox()->reflectedRect(clipRect)); 1138 clipRect.unite(layer->layoutBox()->reflectedRect(clipRect));
1139 clipRect.moveBy(delta); 1139 clipRect.moveBy(delta);
1140 } 1140 }
1141 } 1141 }
1142 1142
1143 LayoutRect Layer::transparencyClipBox(const Layer* layer, const Layer* rootLayer , TransparencyClipBoxBehavior transparencyBehavior, 1143 LayoutRect Layer::transparencyClipBox(const Layer* layer, const Layer* rootLayer , TransparencyClipBoxBehavior transparencyBehavior,
1144 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula tion, PaintBehavior paintBehavior) 1144 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula tion, PaintBehavior paintBehavior)
1145 { 1145 {
1146 // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the 1146 // FIXME: Although this function completely ignores CSS-imposed clipping, we did already intersect with the
1147 // paintDirtyRect, and that should cut down on the amount we have to paint. Still it 1147 // paintDirtyRect, and that should cut down on the amount we have to paint. Still it
1148 // would be better to respect clips. 1148 // would be better to respect clips.
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
1516 void Layer::didUpdateNeedsCompositedScrolling() 1516 void Layer::didUpdateNeedsCompositedScrolling()
1517 { 1517 {
1518 updateSelfPaintingLayer(); 1518 updateSelfPaintingLayer();
1519 } 1519 }
1520 1520
1521 void Layer::updateReflectionInfo(const LayoutStyle* oldStyle) 1521 void Layer::updateReflectionInfo(const LayoutStyle* oldStyle)
1522 { 1522 {
1523 ASSERT(!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle) ); 1523 ASSERT(!oldStyle || !renderer()->style()->reflectionDataEquivalent(oldStyle) );
1524 if (renderer()->hasReflection()) { 1524 if (renderer()->hasReflection()) {
1525 if (!m_reflectionInfo) 1525 if (!m_reflectionInfo)
1526 m_reflectionInfo = adoptPtr(new LayerReflectionInfo(*renderBox())); 1526 m_reflectionInfo = adoptPtr(new LayerReflectionInfo(*layoutBox()));
1527 m_reflectionInfo->updateAfterStyleChange(oldStyle); 1527 m_reflectionInfo->updateAfterStyleChange(oldStyle);
1528 } else if (m_reflectionInfo) { 1528 } else if (m_reflectionInfo) {
1529 m_reflectionInfo->destroy(); 1529 m_reflectionInfo->destroy();
1530 m_reflectionInfo = nullptr; 1530 m_reflectionInfo = nullptr;
1531 } 1531 }
1532 } 1532 }
1533 1533
1534 void Layer::updateStackingNode() 1534 void Layer::updateStackingNode()
1535 { 1535 {
1536 if (requiresStackingNode()) 1536 if (requiresStackingNode())
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
2034 newHitTestLocation = HitTestLocation(localPoint); 2034 newHitTestLocation = HitTestLocation(localPoint);
2035 2035
2036 // Now do a hit test with the root layer shifted to be us. 2036 // Now do a hit test with the root layer shifted to be us.
2037 return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset); 2037 return hitTestLayer(this, containerLayer, request, result, localHitTestRect, newHitTestLocation, true, newTransformState.get(), zOffset);
2038 } 2038 }
2039 2039
2040 bool Layer::hitTestContents(const HitTestRequest& request, HitTestResult& result , const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTest Filter hitTestFilter) const 2040 bool Layer::hitTestContents(const HitTestRequest& request, HitTestResult& result , const LayoutRect& layerBounds, const HitTestLocation& hitTestLocation, HitTest Filter hitTestFilter) const
2041 { 2041 {
2042 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant()); 2042 ASSERT(isSelfPaintingLayer() || hasSelfPaintingLayerDescendant());
2043 2043
2044 if (!renderer()->hitTest(request, result, hitTestLocation, toLayoutPoint(lay erBounds.location() - renderBoxLocation()), hitTestFilter)) { 2044 if (!renderer()->hitTest(request, result, hitTestLocation, toLayoutPoint(lay erBounds.location() - layoutBoxLocation()), hitTestFilter)) {
2045 // It's wrong to set innerNode, but then claim that you didn't hit anyth ing, unless it is 2045 // It's wrong to set innerNode, but then claim that you didn't hit anyth ing, unless it is
2046 // a rect-based test. 2046 // a rect-based test.
2047 ASSERT(!result.innerNode() || (request.listBased() && result.listBasedTe stResult().size())); 2047 ASSERT(!result.innerNode() || (request.listBased() && result.listBasedTe stResult().size()));
2048 return false; 2048 return false;
2049 } 2049 }
2050 2050
2051 // For positioned generated content, we might still not have a 2051 // For positioned generated content, we might still not have a
2052 // node by the time we get to the layer level, since none of 2052 // node by the time we get to the layer level, since none of
2053 // the content in the layer has an element. So just walk up 2053 // the content in the layer has an element. So just walk up
2054 // the tree. 2054 // the tree.
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
2102 2102
2103 return resultLayer; 2103 return resultLayer;
2104 } 2104 }
2105 2105
2106 Layer* Layer::hitTestPaginatedChildLayer(Layer* childLayer, Layer* rootLayer, co nst HitTestRequest& request, HitTestResult& result, 2106 Layer* Layer::hitTestPaginatedChildLayer(Layer* childLayer, Layer* rootLayer, co nst HitTestRequest& request, HitTestResult& result,
2107 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset) 2107 const LayoutRect& hitTestRect, const HitTestLocation& hitTestLocation, const HitTestingTransformState* transformState, double* zOffset)
2108 { 2108 {
2109 Vector<Layer*> columnLayers; 2109 Vector<Layer*> columnLayers;
2110 LayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? paren t()->stackingNode() : m_stackingNode->ancestorStackingContextNode(); 2110 LayerStackingNode* ancestorNode = m_stackingNode->isNormalFlowOnly() ? paren t()->stackingNode() : m_stackingNode->ancestorStackingContextNode();
2111 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) { 2111 for (Layer* curr = childLayer->parent(); curr; curr = curr->parent()) {
2112 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina tion(childLayer->renderer(), curr->renderBox())) 2112 if (curr->renderer()->hasColumns() && checkContainingBlockChainForPagina tion(childLayer->renderer(), curr->layoutBox()))
2113 columnLayers.append(curr); 2113 columnLayers.append(curr);
2114 if (curr->stackingNode() == ancestorNode) 2114 if (curr->stackingNode() == ancestorNode)
2115 break; 2115 break;
2116 } 2116 }
2117 2117
2118 ASSERT(columnLayers.size()); 2118 ASSERT(columnLayers.size());
2119 return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitT estRect, hitTestLocation, transformState, zOffset, 2119 return hitTestChildLayerColumns(childLayer, rootLayer, request, result, hitT estRect, hitTestLocation, transformState, zOffset,
2120 columnLayers, columnLayers.size() - 1); 2120 columnLayers, columnLayers.size() - 1);
2121 } 2121 }
2122 2122
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
2248 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415 2248 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415
2249 DisablePaintInvalidationStateAsserts disabler; 2249 DisablePaintInvalidationStateAsserts disabler;
2250 child->invalidatePaintForBlockSelectionGaps(); 2250 child->invalidatePaintForBlockSelectionGaps();
2251 } 2251 }
2252 2252
2253 if (m_blockSelectionGapsBounds.isEmpty()) 2253 if (m_blockSelectionGapsBounds.isEmpty())
2254 return; 2254 return;
2255 2255
2256 LayoutRect rect = m_blockSelectionGapsBounds; 2256 LayoutRect rect = m_blockSelectionGapsBounds;
2257 if (renderer()->hasOverflowClip()) { 2257 if (renderer()->hasOverflowClip()) {
2258 RenderBox* box = renderBox(); 2258 LayoutBox* box = layoutBox();
2259 rect.move(-box->scrolledContentOffset()); 2259 rect.move(-box->scrolledContentOffset());
2260 if (!scrollableArea()->usesCompositedScrolling()) 2260 if (!scrollableArea()->usesCompositedScrolling())
2261 rect.intersect(box->overflowClipRect(LayoutPoint())); 2261 rect.intersect(box->overflowClipRect(LayoutPoint()));
2262 } 2262 }
2263 if (renderer()->hasClip()) 2263 if (renderer()->hasClip())
2264 rect.intersect(toRenderBox(renderer())->clipRect(LayoutPoint())); 2264 rect.intersect(toLayoutBox(renderer())->clipRect(LayoutPoint()));
2265 if (!rect.isEmpty()) { 2265 if (!rect.isEmpty()) {
2266 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415 2266 // FIXME: We should not allow paint invalidation out of paint invalidati on state. crbug.com/457415
2267 DisablePaintInvalidationStateAsserts disabler; 2267 DisablePaintInvalidationStateAsserts disabler;
2268 renderer()->invalidatePaintRectangle(rect); 2268 renderer()->invalidatePaintRectangle(rect);
2269 } 2269 }
2270 } 2270 }
2271 2271
2272 IntRect Layer::blockSelectionGapsBounds() const 2272 IntRect Layer::blockSelectionGapsBounds() const
2273 { 2273 {
2274 if (!renderer()->isRenderBlockFlow()) 2274 if (!renderer()->isRenderBlockFlow())
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2325 // (3) Floats. When a layer has overhanging floats that it paints, we need to make sure to include these overhanging floats 2325 // (3) Floats. When a layer has overhanging floats that it paints, we need to make sure to include these overhanging floats
2326 // as part of our bounding box. We do this because we are the responsible l ayer for both hit testing and painting those 2326 // as part of our bounding box. We do this because we are the responsible l ayer for both hit testing and painting those
2327 // floats. 2327 // floats.
2328 LayoutRect result; 2328 LayoutRect result;
2329 if (renderer()->isInline() && renderer()->isRenderInline()) { 2329 if (renderer()->isInline() && renderer()->isRenderInline()) {
2330 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox(); 2330 result = toRenderInline(renderer())->linesVisualOverflowBoundingBox();
2331 } else if (renderer()->isTableRow()) { 2331 } else if (renderer()->isTableRow()) {
2332 // Our bounding box is just the union of all of our cells' border/overfl ow rects. 2332 // Our bounding box is just the union of all of our cells' border/overfl ow rects.
2333 for (LayoutObject* child = renderer()->slowFirstChild(); child; child = child->nextSibling()) { 2333 for (LayoutObject* child = renderer()->slowFirstChild(); child; child = child->nextSibling()) {
2334 if (child->isTableCell()) { 2334 if (child->isTableCell()) {
2335 LayoutRect bbox = toRenderBox(child)->borderBoxRect(); 2335 LayoutRect bbox = toLayoutBox(child)->borderBoxRect();
2336 result.unite(bbox); 2336 result.unite(bbox);
2337 LayoutRect overflowRect = renderBox()->visualOverflowRect(); 2337 LayoutRect overflowRect = layoutBox()->visualOverflowRect();
2338 if (bbox != overflowRect) 2338 if (bbox != overflowRect)
2339 result.unite(overflowRect); 2339 result.unite(overflowRect);
2340 } 2340 }
2341 } 2341 }
2342 } else { 2342 } else {
2343 RenderBox* box = renderBox(); 2343 LayoutBox* box = layoutBox();
2344 ASSERT(box); 2344 ASSERT(box);
2345 result = box->borderBoxRect(); 2345 result = box->borderBoxRect();
2346 result.unite(box->visualOverflowRect()); 2346 result.unite(box->visualOverflowRect());
2347 } 2347 }
2348 2348
2349 ASSERT(renderer()->view()); 2349 ASSERT(renderer()->view());
2350 return result; 2350 return result;
2351 } 2351 }
2352 2352
2353 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Layou tObject* renderer) 2353 static inline LayoutRect flippedLogicalBoundingBox(LayoutRect boundingBox, Layou tObject* renderer)
2354 { 2354 {
2355 LayoutRect result = boundingBox; 2355 LayoutRect result = boundingBox;
2356 if (renderer->isBox()) 2356 if (renderer->isBox())
2357 toRenderBox(renderer)->flipForWritingMode(result); 2357 toLayoutBox(renderer)->flipForWritingMode(result);
2358 else 2358 else
2359 renderer->containingBlock()->flipForWritingMode(result); 2359 renderer->containingBlock()->flipForWritingMode(result);
2360 return result; 2360 return result;
2361 } 2361 }
2362 2362
2363 LayoutRect Layer::physicalBoundingBox(const Layer* ancestorLayer, const LayoutPo int* offsetFromRoot) const 2363 LayoutRect Layer::physicalBoundingBox(const Layer* ancestorLayer, const LayoutPo int* offsetFromRoot) const
2364 { 2364 {
2365 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), renderer ()); 2365 LayoutRect result = flippedLogicalBoundingBox(logicalBoundingBox(), renderer ());
2366 if (offsetFromRoot) 2366 if (offsetFromRoot)
2367 result.moveBy(*offsetFromRoot); 2367 result.moveBy(*offsetFromRoot);
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
2680 // Some HTML can cause whitespace text nodes to have renderers, like: 2680 // Some HTML can cause whitespace text nodes to have renderers, like:
2681 // <div> 2681 // <div>
2682 // <img src=...> 2682 // <img src=...>
2683 // </div> 2683 // </div>
2684 // so test for 0x0 RenderTexts here 2684 // so test for 0x0 RenderTexts here
2685 for (LayoutObject* child = renderer()->slowFirstChild(); child; child = chil d->nextSibling()) { 2685 for (LayoutObject* child = renderer()->slowFirstChild(); child; child = chil d->nextSibling()) {
2686 if (!child->hasLayer()) { 2686 if (!child->hasLayer()) {
2687 if (child->isRenderInline() || !child->isBox()) 2687 if (child->isRenderInline() || !child->isBox())
2688 return true; 2688 return true;
2689 2689
2690 if (toRenderBox(child)->size().width() > 0 || toRenderBox(child)->si ze().height() > 0) 2690 if (toLayoutBox(child)->size().width() > 0 || toLayoutBox(child)->si ze().height() > 0)
2691 return true; 2691 return true;
2692 } 2692 }
2693 } 2693 }
2694 return false; 2694 return false;
2695 } 2695 }
2696 2696
2697 bool Layer::hasBoxDecorationsOrBackground() const 2697 bool Layer::hasBoxDecorationsOrBackground() const
2698 { 2698 {
2699 return renderer()->style()->hasBoxDecorations() || renderer()->style()->hasB ackground(); 2699 return renderer()->style()->hasBoxDecorations() || renderer()->style()->hasB ackground();
2700 } 2700 }
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2888 computeSelfHitTestRects(rects); 2888 computeSelfHitTestRects(rects);
2889 for (Layer* child = firstChild(); child; child = child->nextSibling()) 2889 for (Layer* child = firstChild(); child; child = child->nextSibling())
2890 child->addLayerHitTestRects(rects); 2890 child->addLayerHitTestRects(rects);
2891 } 2891 }
2892 2892
2893 void Layer::computeSelfHitTestRects(LayerHitTestRects& rects) const 2893 void Layer::computeSelfHitTestRects(LayerHitTestRects& rects) const
2894 { 2894 {
2895 if (!size().isEmpty()) { 2895 if (!size().isEmpty()) {
2896 Vector<LayoutRect> rect; 2896 Vector<LayoutRect> rect;
2897 2897
2898 if (renderBox() && renderBox()->scrollsOverflow()) { 2898 if (layoutBox() && layoutBox()->scrollsOverflow()) {
2899 // For scrolling layers, rects are taken to be in the space of the c ontents. 2899 // For scrolling layers, rects are taken to be in the space of the c ontents.
2900 // We need to include the bounding box of the layer in the space of its parent 2900 // We need to include the bounding box of the layer in the space of its parent
2901 // (eg. for border / scroll bars) and if it's composited then the en tire contents 2901 // (eg. for border / scroll bars) and if it's composited then the en tire contents
2902 // as well as they may be on another composited layer. Skip reportin g contents 2902 // as well as they may be on another composited layer. Skip reportin g contents
2903 // for non-composited layers as they'll get projected to the same la yer as the 2903 // for non-composited layers as they'll get projected to the same la yer as the
2904 // bounding box. 2904 // bounding box.
2905 if (compositingState() != NotComposited) 2905 if (compositingState() != NotComposited)
2906 rect.append(m_scrollableArea->overflowRect()); 2906 rect.append(m_scrollableArea->overflowRect());
2907 2907
2908 rects.set(this, rect); 2908 rects.set(this, rect);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
2951 } 2951 }
2952 } 2952 }
2953 2953
2954 void showLayerTree(const blink::LayoutObject* renderer) 2954 void showLayerTree(const blink::LayoutObject* renderer)
2955 { 2955 {
2956 if (!renderer) 2956 if (!renderer)
2957 return; 2957 return;
2958 showLayerTree(renderer->enclosingLayer()); 2958 showLayerTree(renderer->enclosingLayer());
2959 } 2959 }
2960 #endif 2960 #endif
OLDNEW
« no previous file with comments | « Source/core/layout/Layer.h ('k') | Source/core/layout/LayerClipper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698