| 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 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 313 } |
| 314 } | 314 } |
| 315 | 315 |
| 316 void RenderLayer::updateTransform(const RenderStyle* oldStyle, RenderStyle* newS
tyle) | 316 void RenderLayer::updateTransform(const RenderStyle* oldStyle, RenderStyle* newS
tyle) |
| 317 { | 317 { |
| 318 if (oldStyle && newStyle->transformDataEquivalent(*oldStyle)) | 318 if (oldStyle && newStyle->transformDataEquivalent(*oldStyle)) |
| 319 return; | 319 return; |
| 320 | 320 |
| 321 // hasTransform() on the renderer is also true when there is transform-style
: preserve-3d or perspective set, | 321 // hasTransform() on the renderer is also true when there is transform-style
: preserve-3d or perspective set, |
| 322 // so check style too. | 322 // so check style too. |
| 323 bool hasTransform = renderer()->hasTransform() && newStyle->hasTransform(); | 323 bool hasTransform = renderer()->hasTransformRelatedProperty() && newStyle->h
asTransform(); |
| 324 bool had3DTransform = has3DTransform(); | 324 bool had3DTransform = has3DTransform(); |
| 325 | 325 |
| 326 bool hadTransform = m_transform; | 326 bool hadTransform = m_transform; |
| 327 if (hasTransform != hadTransform) { | 327 if (hasTransform != hadTransform) { |
| 328 if (hasTransform) | 328 if (hasTransform) |
| 329 m_transform = adoptPtr(new TransformationMatrix); | 329 m_transform = adoptPtr(new TransformationMatrix); |
| 330 else | 330 else |
| 331 m_transform.clear(); | 331 m_transform.clear(); |
| 332 | 332 |
| 333 // Layers with transforms act as clip rects roots, so clear the cached c
lip rects here. | 333 // Layers with transforms act as clip rects roots, so clear the cached c
lip rects here. |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 m_enclosingPaginationLayer = this; | 489 m_enclosingPaginationLayer = this; |
| 490 return; | 490 return; |
| 491 } | 491 } |
| 492 | 492 |
| 493 if (m_stackingNode->isNormalFlowOnly()) { | 493 if (m_stackingNode->isNormalFlowOnly()) { |
| 494 if (regionBasedColumnsUsed) { | 494 if (regionBasedColumnsUsed) { |
| 495 // Content inside a transform is not considered to be paginated, sin
ce we simply | 495 // Content inside a transform is not considered to be paginated, sin
ce we simply |
| 496 // paint the transform multiple times in each column, so we don't ha
ve to use | 496 // paint the transform multiple times in each column, so we don't ha
ve to use |
| 497 // fragments for the transformed content. | 497 // fragments for the transformed content. |
| 498 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer(); | 498 m_enclosingPaginationLayer = parent()->enclosingPaginationLayer(); |
| 499 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra
nsform()) | 499 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->hasTra
nsformRelatedProperty()) |
| 500 m_enclosingPaginationLayer = 0; | 500 m_enclosingPaginationLayer = 0; |
| 501 } else { | 501 } else { |
| 502 m_isPaginated = parent()->renderer()->hasColumns(); | 502 m_isPaginated = parent()->renderer()->hasColumns(); |
| 503 } | 503 } |
| 504 return; | 504 return; |
| 505 } | 505 } |
| 506 | 506 |
| 507 // For the new columns code, we want to walk up our containing block chain l
ooking for an enclosing layer. Once | 507 // For the new columns code, we want to walk up our containing block chain l
ooking for an enclosing layer. Once |
| 508 // we find one, then we just check its pagination status. | 508 // we find one, then we just check its pagination status. |
| 509 if (regionBasedColumnsUsed) { | 509 if (regionBasedColumnsUsed) { |
| 510 RenderView* view = renderer()->view(); | 510 RenderView* view = renderer()->view(); |
| 511 RenderBlock* containingBlock; | 511 RenderBlock* containingBlock; |
| 512 for (containingBlock = renderer()->containingBlock(); | 512 for (containingBlock = renderer()->containingBlock(); |
| 513 containingBlock && containingBlock != view; | 513 containingBlock && containingBlock != view; |
| 514 containingBlock = containingBlock->containingBlock()) { | 514 containingBlock = containingBlock->containingBlock()) { |
| 515 if (containingBlock->hasLayer()) { | 515 if (containingBlock->hasLayer()) { |
| 516 // Content inside a transform is not considered to be paginated,
since we simply | 516 // Content inside a transform is not considered to be paginated,
since we simply |
| 517 // paint the transform multiple times in each column, so we don'
t have to use | 517 // paint the transform multiple times in each column, so we don'
t have to use |
| 518 // fragments for the transformed content. | 518 // fragments for the transformed content. |
| 519 m_enclosingPaginationLayer = containingBlock->layer()->enclosing
PaginationLayer(); | 519 m_enclosingPaginationLayer = containingBlock->layer()->enclosing
PaginationLayer(); |
| 520 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->ha
sTransform()) | 520 if (m_enclosingPaginationLayer && m_enclosingPaginationLayer->ha
sTransformRelatedProperty()) |
| 521 m_enclosingPaginationLayer = 0; | 521 m_enclosingPaginationLayer = 0; |
| 522 return; | 522 return; |
| 523 } | 523 } |
| 524 } | 524 } |
| 525 return; | 525 return; |
| 526 } | 526 } |
| 527 | 527 |
| 528 // If we're not normal flow, then we need to look for a multi-column object
between us and our stacking container. | 528 // If we're not normal flow, then we need to look for a multi-column object
between us and our stacking container. |
| 529 RenderLayerStackingNode* ancestorStackingContextNode = m_stackingNode->ances
torStackingContextNode(); | 529 RenderLayerStackingNode* ancestorStackingContextNode = m_stackingNode->ances
torStackingContextNode(); |
| 530 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { | 530 for (RenderLayer* curr = parent(); curr; curr = curr->parent()) { |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 return localPoint; | 862 return localPoint; |
| 863 } | 863 } |
| 864 | 864 |
| 865 const LayoutSize RenderLayer::offsetForInFlowPosition() const | 865 const LayoutSize RenderLayer::offsetForInFlowPosition() const |
| 866 { | 866 { |
| 867 return renderer()->isRelPositioned() ? toRenderBoxModelObject(renderer())->o
ffsetForInFlowPosition() : LayoutSize(); | 867 return renderer()->isRelPositioned() ? toRenderBoxModelObject(renderer())->o
ffsetForInFlowPosition() : LayoutSize(); |
| 868 } | 868 } |
| 869 | 869 |
| 870 TransformationMatrix RenderLayer::perspectiveTransform() const | 870 TransformationMatrix RenderLayer::perspectiveTransform() const |
| 871 { | 871 { |
| 872 if (!renderer()->hasTransform()) | 872 if (!renderer()->hasTransformRelatedProperty()) |
| 873 return TransformationMatrix(); | 873 return TransformationMatrix(); |
| 874 | 874 |
| 875 RenderStyle* style = renderer()->style(); | 875 RenderStyle* style = renderer()->style(); |
| 876 if (!style->hasPerspective()) | 876 if (!style->hasPerspective()) |
| 877 return TransformationMatrix(); | 877 return TransformationMatrix(); |
| 878 | 878 |
| 879 // Maybe fetch the perspective from the backing? | 879 // Maybe fetch the perspective from the backing? |
| 880 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect
(); | 880 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect
(); |
| 881 const float boxWidth = borderBox.width(); | 881 const float boxWidth = borderBox.width(); |
| 882 const float boxHeight = borderBox.height(); | 882 const float boxHeight = borderBox.height(); |
| 883 | 883 |
| 884 float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(),
boxWidth); | 884 float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(),
boxWidth); |
| 885 float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(),
boxHeight); | 885 float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(),
boxHeight); |
| 886 | 886 |
| 887 // A perspective origin of 0,0 makes the vanishing point in the center of th
e element. | 887 // A perspective origin of 0,0 makes the vanishing point in the center of th
e element. |
| 888 // We want it to be in the top-left, so subtract half the height and width. | 888 // We want it to be in the top-left, so subtract half the height and width. |
| 889 perspectiveOriginX -= boxWidth / 2.0f; | 889 perspectiveOriginX -= boxWidth / 2.0f; |
| 890 perspectiveOriginY -= boxHeight / 2.0f; | 890 perspectiveOriginY -= boxHeight / 2.0f; |
| 891 | 891 |
| 892 TransformationMatrix t; | 892 TransformationMatrix t; |
| 893 t.translate(perspectiveOriginX, perspectiveOriginY); | 893 t.translate(perspectiveOriginX, perspectiveOriginY); |
| 894 t.applyPerspective(style->perspective()); | 894 t.applyPerspective(style->perspective()); |
| 895 t.translate(-perspectiveOriginX, -perspectiveOriginY); | 895 t.translate(-perspectiveOriginX, -perspectiveOriginY); |
| 896 | 896 |
| 897 return t; | 897 return t; |
| 898 } | 898 } |
| 899 | 899 |
| 900 FloatPoint RenderLayer::perspectiveOrigin() const | 900 FloatPoint RenderLayer::perspectiveOrigin() const |
| 901 { | 901 { |
| 902 if (!renderer()->hasTransform()) | 902 if (!renderer()->hasTransformRelatedProperty()) |
| 903 return FloatPoint(); | 903 return FloatPoint(); |
| 904 | 904 |
| 905 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); | 905 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); |
| 906 RenderStyle* style = renderer()->style(); | 906 RenderStyle* style = renderer()->style(); |
| 907 | 907 |
| 908 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox
.width().toFloat()), floatValueForLength(style->perspectiveOriginY(), borderBox.
height().toFloat())); | 908 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox
.width().toFloat()), floatValueForLength(style->perspectiveOriginY(), borderBox.
height().toFloat())); |
| 909 } | 909 } |
| 910 | 910 |
| 911 static inline bool isFixedPositionedContainer(RenderLayer* layer) | 911 static inline bool isFixedPositionedContainer(RenderLayer* layer) |
| 912 { | 912 { |
| 913 return layer->isRootLayer() || layer->hasTransform(); | 913 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); |
| 914 } | 914 } |
| 915 | 915 |
| 916 RenderLayer* RenderLayer::enclosingPositionedAncestor() const | 916 RenderLayer* RenderLayer::enclosingPositionedAncestor() const |
| 917 { | 917 { |
| 918 RenderLayer* curr = parent(); | 918 RenderLayer* curr = parent(); |
| 919 while (curr && !curr->isPositionedContainer()) | 919 while (curr && !curr->isPositionedContainer()) |
| 920 curr = curr->parent(); | 920 curr = curr->parent(); |
| 921 | 921 |
| 922 return curr; | 922 return curr; |
| 923 } | 923 } |
| 924 | 924 |
| 925 RenderLayer* RenderLayer::enclosingTransformedAncestor() const | 925 RenderLayer* RenderLayer::enclosingTransformedAncestor() const |
| 926 { | 926 { |
| 927 RenderLayer* curr = parent(); | 927 RenderLayer* curr = parent(); |
| 928 while (curr && !curr->isRootLayer() && !curr->renderer()->hasTransform()) | 928 while (curr && !curr->isRootLayer() && !curr->renderer()->hasTransformRelate
dProperty()) |
| 929 curr = curr->parent(); | 929 curr = curr->parent(); |
| 930 | 930 |
| 931 return curr; | 931 return curr; |
| 932 } | 932 } |
| 933 | 933 |
| 934 LayoutPoint RenderLayer::computeOffsetFromTransformedAncestor() const | 934 LayoutPoint RenderLayer::computeOffsetFromTransformedAncestor() const |
| 935 { | 935 { |
| 936 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); | 936 const AncestorDependentCompositingInputs& properties = ancestorDependentComp
ositingInputs(); |
| 937 | 937 |
| 938 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 938 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 } | 1118 } |
| 1119 | 1119 |
| 1120 LayoutRect RenderLayer::transparencyClipBox(const RenderLayer* layer, const Rend
erLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior, | 1120 LayoutRect RenderLayer::transparencyClipBox(const RenderLayer* layer, const Rend
erLayer* rootLayer, TransparencyClipBoxBehavior transparencyBehavior, |
| 1121 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula
tion, PaintBehavior paintBehavior) | 1121 TransparencyClipBoxMode transparencyMode, const LayoutSize& subPixelAccumula
tion, PaintBehavior paintBehavior) |
| 1122 { | 1122 { |
| 1123 // FIXME: Although this function completely ignores CSS-imposed clipping, we
did already intersect with the | 1123 // FIXME: Although this function completely ignores CSS-imposed clipping, we
did already intersect with the |
| 1124 // paintDirtyRect, and that should cut down on the amount we have to paint.
Still it | 1124 // paintDirtyRect, and that should cut down on the amount we have to paint.
Still it |
| 1125 // would be better to respect clips. | 1125 // would be better to respect clips. |
| 1126 | 1126 |
| 1127 if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClip
Box && layer->paintsWithTransform(paintBehavior)) | 1127 if (rootLayer != layer && ((transparencyBehavior == PaintingTransparencyClip
Box && layer->paintsWithTransform(paintBehavior)) |
| 1128 || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasT
ransform()))) { | 1128 || (transparencyBehavior == HitTestingTransparencyClipBox && layer->hasT
ransformRelatedProperty()))) { |
| 1129 // The best we can do here is to use enclosed bounding boxes to establis
h a "fuzzy" enough clip to encompass | 1129 // The best we can do here is to use enclosed bounding boxes to establis
h a "fuzzy" enough clip to encompass |
| 1130 // the transformed layer and all of its children. | 1130 // the transformed layer and all of its children. |
| 1131 const RenderLayer* paginationLayer = transparencyMode == DescendantsOfTr
ansparencyClipBox ? layer->enclosingPaginationLayer() : 0; | 1131 const RenderLayer* paginationLayer = transparencyMode == DescendantsOfTr
ansparencyClipBox ? layer->enclosingPaginationLayer() : 0; |
| 1132 const RenderLayer* rootLayerForTransform = paginationLayer ? paginationL
ayer : rootLayer; | 1132 const RenderLayer* rootLayerForTransform = paginationLayer ? paginationL
ayer : rootLayer; |
| 1133 LayoutPoint delta; | 1133 LayoutPoint delta; |
| 1134 layer->convertToLayerCoords(rootLayerForTransform, delta); | 1134 layer->convertToLayerCoords(rootLayerForTransform, delta); |
| 1135 | 1135 |
| 1136 delta.move(subPixelAccumulation); | 1136 delta.move(subPixelAccumulation); |
| 1137 IntPoint pixelSnappedDelta = roundedIntPoint(delta); | 1137 IntPoint pixelSnappedDelta = roundedIntPoint(delta); |
| 1138 TransformationMatrix transform; | 1138 TransformationMatrix transform; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 | 1466 |
| 1467 bool RenderLayer::hasOverflowControls() const | 1467 bool RenderLayer::hasOverflowControls() const |
| 1468 { | 1468 { |
| 1469 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); | 1469 return m_scrollableArea && (m_scrollableArea->hasScrollbar() || m_scrollable
Area->hasScrollCorner() || renderer()->style()->resize() != RESIZE_NONE); |
| 1470 } | 1470 } |
| 1471 | 1471 |
| 1472 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, | 1472 void RenderLayer::collectFragments(LayerFragments& fragments, const RenderLayer*
rootLayer, const LayoutRect& dirtyRect, |
| 1473 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverl
ayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const L
ayoutPoint* offsetFromRoot, | 1473 ClipRectsCacheSlot clipRectsCacheSlot, OverlayScrollbarSizeRelevancy inOverl
ayScrollbarSizeRelevancy, ShouldRespectOverflowClip respectOverflowClip, const L
ayoutPoint* offsetFromRoot, |
| 1474 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) | 1474 const LayoutSize& subPixelAccumulation, const LayoutRect* layerBoundingBox) |
| 1475 { | 1475 { |
| 1476 if (!enclosingPaginationLayer() || hasTransform()) { | 1476 if (!enclosingPaginationLayer() || hasTransformRelatedProperty()) { |
| 1477 // For unpaginated layers, there is only one fragment. | 1477 // For unpaginated layers, there is only one fragment. |
| 1478 LayerFragment fragment; | 1478 LayerFragment fragment; |
| 1479 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl
ayScrollbarSizeRelevancy, subPixelAccumulation); | 1479 ClipRectsContext clipRectsContext(rootLayer, clipRectsCacheSlot, inOverl
ayScrollbarSizeRelevancy, subPixelAccumulation); |
| 1480 if (respectOverflowClip == IgnoreOverflowClip) | 1480 if (respectOverflowClip == IgnoreOverflowClip) |
| 1481 clipRectsContext.setIgnoreOverflowClip(); | 1481 clipRectsContext.setIgnoreOverflowClip(); |
| 1482 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun
ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs
etFromRoot); | 1482 clipper().calculateRects(clipRectsContext, dirtyRect, fragment.layerBoun
ds, fragment.backgroundRect, fragment.foregroundRect, fragment.outlineRect, offs
etFromRoot); |
| 1483 fragments.append(fragment); | 1483 fragments.append(fragment); |
| 1484 return; | 1484 return; |
| 1485 } | 1485 } |
| 1486 | 1486 |
| (...skipping 1376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2863 } | 2863 } |
| 2864 } | 2864 } |
| 2865 | 2865 |
| 2866 void showLayerTree(const blink::RenderObject* renderer) | 2866 void showLayerTree(const blink::RenderObject* renderer) |
| 2867 { | 2867 { |
| 2868 if (!renderer) | 2868 if (!renderer) |
| 2869 return; | 2869 return; |
| 2870 showLayerTree(renderer->enclosingLayer()); | 2870 showLayerTree(renderer->enclosingLayer()); |
| 2871 } | 2871 } |
| 2872 #endif | 2872 #endif |
| OLD | NEW |