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

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

Issue 945803004: Merge back LayoutLayerModelObject into RenderBoxModelObject (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Better rebasing. 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 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 namespace { 94 namespace {
95 95
96 static CompositingQueryMode gCompositingQueryMode = 96 static CompositingQueryMode gCompositingQueryMode =
97 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases; 97 CompositingQueriesAreOnlyAllowedInCertainDocumentLifecyclePhases;
98 98
99 } // namespace 99 } // namespace
100 100
101 using namespace HTMLNames; 101 using namespace HTMLNames;
102 102
103 Layer::Layer(LayoutLayerModelObject* renderer, LayerType type) 103 Layer::Layer(LayoutBoxModelObject* renderer, LayerType type)
104 : m_layerType(type) 104 : m_layerType(type)
105 , m_hasSelfPaintingLayerDescendant(false) 105 , m_hasSelfPaintingLayerDescendant(false)
106 , m_hasSelfPaintingLayerDescendantDirty(false) 106 , m_hasSelfPaintingLayerDescendantDirty(false)
107 , m_isRootLayer(renderer->isRenderView()) 107 , m_isRootLayer(renderer->isRenderView())
108 , m_visibleContentStatusDirty(true) 108 , m_visibleContentStatusDirty(true)
109 , m_hasVisibleContent(false) 109 , m_hasVisibleContent(false)
110 , m_visibleDescendantStatusDirty(false) 110 , m_visibleDescendantStatusDirty(false)
111 , m_hasVisibleDescendant(false) 111 , m_hasVisibleDescendant(false)
112 , m_hasVisibleNonLayerContent(false) 112 , m_hasVisibleNonLayerContent(false)
113 , m_isPaginated(false) 113 , m_isPaginated(false)
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(LayoutLayerModelObject* rende rer, RenderBox* ancestorColumnsRenderer) 423 static bool checkContainingBlockChainForPagination(LayoutBoxModelObject* rendere r, RenderBox* ancestorColumnsRenderer)
424 { 424 {
425 RenderView* view = renderer->view(); 425 RenderView* view = renderer->view();
426 LayoutLayerModelObject* 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.
434 if (containingBlock != ancestorColumnsRenderer) 434 if (containingBlock != ancestorColumnsRenderer)
435 return false; 435 return false;
436 436
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 } 558 }
559 } 559 }
560 560
561 void Layer::clearPaginationRecursive() 561 void Layer::clearPaginationRecursive()
562 { 562 {
563 m_enclosingPaginationLayer = 0; 563 m_enclosingPaginationLayer = 0;
564 for (Layer* child = firstChild(); child; child = child->nextSibling()) 564 for (Layer* child = firstChild(); child; child = child->nextSibling())
565 child->clearPaginationRecursive(); 565 child->clearPaginationRecursive();
566 } 566 }
567 567
568 LayoutPoint Layer::positionFromPaintInvalidationBacking(const LayoutObject* layo utObject, const LayoutLayerModelObject* paintInvalidationContainer, const PaintI nvalidationState* paintInvalidationState) 568 LayoutPoint Layer::positionFromPaintInvalidationBacking(const LayoutObject* layo utObject, const LayoutBoxModelObject* paintInvalidationContainer, const PaintInv alidationState* paintInvalidationState)
569 { 569 {
570 FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintIn validationContainer, 0, 0, paintInvalidationState); 570 FloatPoint point = layoutObject->localToContainerPoint(FloatPoint(), paintIn validationContainer, 0, 0, paintInvalidationState);
571 571
572 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac e. 572 // FIXME: Eventually we are going to unify coordinates in GraphicsLayer spac e.
573 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group edMapping()) 573 if (paintInvalidationContainer && paintInvalidationContainer->layer()->group edMapping())
574 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point); 574 mapPointToPaintBackingCoordinates(paintInvalidationContainer, point);
575 575
576 return LayoutPoint(point); 576 return LayoutPoint(point);
577 } 577 }
578 578
579 void Layer::mapPointToPaintBackingCoordinates(const LayoutLayerModelObject* pain tInvalidationContainer, FloatPoint& point) 579 void Layer::mapPointToPaintBackingCoordinates(const LayoutBoxModelObject* paintI nvalidationContainer, FloatPoint& point)
580 { 580 {
581 Layer* paintInvalidationLayer = paintInvalidationContainer->layer(); 581 Layer* paintInvalidationLayer = paintInvalidationContainer->layer();
582 if (!paintInvalidationLayer->groupedMapping()) { 582 if (!paintInvalidationLayer->groupedMapping()) {
583 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs etInCompositingLayer()); 583 point.move(paintInvalidationLayer->compositedLayerMapping()->contentOffs etInCompositingLayer());
584 return; 584 return;
585 } 585 }
586 586
587 LayoutLayerModelObject* transformedAncestor = paintInvalidationLayer->enclos ingTransformedAncestor()->renderer(); 587 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin gTransformedAncestor()->renderer();
588 if (!transformedAncestor) 588 if (!transformedAncestor)
589 return; 589 return;
590 590
591 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the 591 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
592 // transformed ancestor. 592 // transformed ancestor.
593 point = paintInvalidationContainer->localToContainerPoint(point, transformed Ancestor); 593 point = paintInvalidationContainer->localToContainerPoint(point, transformed Ancestor);
594 594
595 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT ransformedAncestor()); 595 point.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromT ransformedAncestor());
596 } 596 }
597 597
598 void Layer::mapRectToPaintBackingCoordinates(const LayoutLayerModelObject* paint InvalidationContainer, LayoutRect& rect) 598 void Layer::mapRectToPaintBackingCoordinates(const LayoutBoxModelObject* paintIn validationContainer, LayoutRect& rect)
599 { 599 {
600 Layer* paintInvalidationLayer = paintInvalidationContainer->layer(); 600 Layer* paintInvalidationLayer = paintInvalidationContainer->layer();
601 if (!paintInvalidationLayer->groupedMapping()) { 601 if (!paintInvalidationLayer->groupedMapping()) {
602 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse tInCompositingLayer()); 602 rect.move(paintInvalidationLayer->compositedLayerMapping()->contentOffse tInCompositingLayer());
603 return; 603 return;
604 } 604 }
605 605
606 LayoutLayerModelObject* transformedAncestor = paintInvalidationLayer->enclos ingTransformedAncestor()->renderer(); 606 LayoutBoxModelObject* transformedAncestor = paintInvalidationLayer->enclosin gTransformedAncestor()->renderer();
607 if (!transformedAncestor) 607 if (!transformedAncestor)
608 return; 608 return;
609 609
610 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the 610 // |paintInvalidationContainer| may have a local 2D transform on it, so take that into account when mapping into the space of the
611 // transformed ancestor. 611 // transformed ancestor.
612 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect (rect), transformedAncestor).boundingBox()); 612 rect = LayoutRect(paintInvalidationContainer->localToContainerQuad(FloatRect (rect), transformedAncestor).boundingBox());
613 613
614 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr ansformedAncestor()); 614 rect.moveBy(-paintInvalidationLayer->groupedMapping()->squashingOffsetFromTr ansformedAncestor());
615 } 615 }
616 616
617 void Layer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutLayerModelObject* paintInvalidationContainer, LayoutRect& rect, cons t PaintInvalidationState* paintInvalidationState) 617 void Layer::mapRectToPaintInvalidationBacking(const LayoutObject* layoutObject, const LayoutBoxModelObject* paintInvalidationContainer, LayoutRect& rect, const PaintInvalidationState* paintInvalidationState)
618 { 618 {
619 if (!paintInvalidationContainer->layer()->groupedMapping()) { 619 if (!paintInvalidationContainer->layer()->groupedMapping()) {
620 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContain er, rect, paintInvalidationState); 620 layoutObject->mapRectToPaintInvalidationBacking(paintInvalidationContain er, rect, paintInvalidationState);
621 return; 621 return;
622 } 622 }
623 623
624 // This code adjusts the paint invalidation rectangle to be in the space of the transformed ancestor of the grouped (i.e. squashed) 624 // This code adjusts the paint invalidation rectangle to be in the space of the transformed ancestor of the grouped (i.e. squashed)
625 // layer. This is because all layers that squash together need to issue pain t invalidations w.r.t. a single container that is 625 // layer. This is because all layers that squash together need to issue pain t invalidations w.r.t. a single container that is
626 // an ancestor of all of them, in order to properly take into account any lo cal transforms etc. 626 // an ancestor of all of them, in order to properly take into account any lo cal transforms etc.
627 // FIXME: remove this special-case code that works around the paint invalida tion code structure. 627 // FIXME: remove this special-case code that works around the paint invalida tion code structure.
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
867 } 867 }
868 868
869 if (parent()->renderer()->hasOverflowClip()) { 869 if (parent()->renderer()->hasOverflowClip()) {
870 IntSize scrollOffset = parent()->renderBox()->scrolledContentOffset( ); 870 IntSize scrollOffset = parent()->renderBox()->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 = toLayoutBoxModelObject(renderer())->offsetForInFl owPosition(); 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);
881 } else { 881 } else {
882 m_offsetForInFlowPosition = LayoutSize(); 882 m_offsetForInFlowPosition = LayoutSize();
883 } 883 }
884 884
885 // FIXME: We'd really like to just get rid of the concept of a layer rectang le and rely on the renderers. 885 // FIXME: We'd really like to just get rid of the concept of a layer rectang le and rely on the renderers.
886 localPoint.moveBy(-inlineBoundingBoxOffset); 886 localPoint.moveBy(-inlineBoundingBoxOffset);
887 887
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
1099 1099
1100 m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants; 1100 m_shouldIsolateCompositedDescendants = shouldIsolateCompositedDescendants;
1101 1101
1102 if (hasCompositedLayerMapping()) 1102 if (hasCompositedLayerMapping())
1103 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat eLocal); 1103 compositedLayerMapping()->setNeedsGraphicsLayerUpdate(GraphicsLayerUpdat eLocal);
1104 } 1104 }
1105 1105
1106 bool Layer::hasAncestorWithFilterOutsets() const 1106 bool Layer::hasAncestorWithFilterOutsets() const
1107 { 1107 {
1108 for (const Layer* curr = this; curr; curr = curr->parent()) { 1108 for (const Layer* curr = this; curr; curr = curr->parent()) {
1109 LayoutLayerModelObject* renderer = curr->renderer(); 1109 LayoutBoxModelObject* renderer = curr->renderer();
1110 if (renderer->style()->hasFilterOutsets()) 1110 if (renderer->style()->hasFilterOutsets())
1111 return true; 1111 return true;
1112 } 1112 }
1113 return false; 1113 return false;
1114 } 1114 }
1115 1115
1116 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons t Layer* layer, const Layer* rootLayer, 1116 static void expandClipRectForDescendantsAndReflection(LayoutRect& clipRect, cons t Layer* layer, const Layer* rootLayer,
1117 Layer::TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& s ubPixelAccumulation, PaintBehavior paintBehavior) 1117 Layer::TransparencyClipBoxBehavior transparencyBehavior, const LayoutSize& s ubPixelAccumulation, PaintBehavior paintBehavior)
1118 { 1118 {
1119 // If we have a mask, then the clip is limited to the border box area (and t here is 1119 // If we have a mask, then the clip is limited to the border box area (and t here is
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 1344
1345 // Clear out all the clip rects. 1345 // Clear out all the clip rects.
1346 m_clipper.clearClipRectsIncludingDescendants(); 1346 m_clipper.clearClipRectsIncludingDescendants();
1347 } 1347 }
1348 1348
1349 // Returns the layer reached on the walk up towards the ancestor. 1349 // Returns the layer reached on the walk up towards the ancestor.
1350 static inline const Layer* accumulateOffsetTowardsAncestor(const Layer* layer, c onst Layer* ancestorLayer, LayoutPoint& location) 1350 static inline const Layer* accumulateOffsetTowardsAncestor(const Layer* layer, c onst Layer* ancestorLayer, LayoutPoint& location)
1351 { 1351 {
1352 ASSERT(ancestorLayer != layer); 1352 ASSERT(ancestorLayer != layer);
1353 1353
1354 const LayoutLayerModelObject* renderer = layer->renderer(); 1354 const LayoutBoxModelObject* renderer = layer->renderer();
1355 EPosition position = renderer->style()->position(); 1355 EPosition position = renderer->style()->position();
1356 1356
1357 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in a LayoutFlowThread 1357 // FIXME: Positioning of out-of-flow(fixed, absolute) elements collected in a LayoutFlowThread
1358 // may need to be revisited in a future patch. 1358 // may need to be revisited in a future patch.
1359 // If the fixed renderer is inside a LayoutFlowThread, we should not compute location using localToAbsolute, 1359 // If the fixed renderer is inside a LayoutFlowThread, we should not compute location using localToAbsolute,
1360 // since localToAbsolute maps the coordinates from flow thread to regions co ordinates and regions can be 1360 // since localToAbsolute maps the coordinates from flow thread to regions co ordinates and regions can be
1361 // positioned in a completely different place in the viewport (RenderView). 1361 // positioned in a completely different place in the viewport (RenderView).
1362 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == rendere r->view()->layer())) { 1362 if (position == FixedPosition && (!ancestorLayer || ancestorLayer == rendere r->view()->layer())) {
1363 // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling 1363 // If the fixed layer's container is the root, just add in the offset of the view. We can obtain this by calling
1364 // localToAbsolute() on the RenderView. 1364 // localToAbsolute() on the RenderView.
(...skipping 1586 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