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

Side by Side Diff: Source/core/paint/DeprecatedPaintLayer.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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
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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 paintInvalidationContainerWasScrolled && !child->isPaintInvalidation Container()); 337 paintInvalidationContainerWasScrolled && !child->isPaintInvalidation Container());
338 } 338 }
339 } 339 }
340 340
341 void DeprecatedPaintLayer::updateTransformationMatrix() 341 void DeprecatedPaintLayer::updateTransformationMatrix()
342 { 342 {
343 if (m_transform) { 343 if (m_transform) {
344 LayoutBox* box = layoutBox(); 344 LayoutBox* box = layoutBox();
345 ASSERT(box); 345 ASSERT(box);
346 m_transform->makeIdentity(); 346 m_transform->makeIdentity();
347 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS ize()), LayoutStyle::IncludeTransformOrigin); 347 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS ize()), ComputedStyle::IncludeTransformOrigin);
348 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng()); 348 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng());
349 } 349 }
350 } 350 }
351 351
352 void DeprecatedPaintLayer::updateTransform(const LayoutStyle* oldStyle, const La youtStyle& newStyle) 352 void DeprecatedPaintLayer::updateTransform(const ComputedStyle* oldStyle, const ComputedStyle& newStyle)
353 { 353 {
354 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle)) 354 if (oldStyle && newStyle.transformDataEquivalent(*oldStyle))
355 return; 355 return;
356 356
357 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 357 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
358 // so check style too. 358 // so check style too.
359 bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyl e.hasTransform(); 359 bool hasTransform = layoutObject()->hasTransformRelatedProperty() && newStyl e.hasTransform();
360 bool had3DTransform = has3DTransform(); 360 bool had3DTransform = has3DTransform();
361 361
362 bool hadTransform = m_transform; 362 bool hadTransform = m_transform;
(...skipping 28 matching lines...) Expand all
391 391
392 if (shouldPreserve3D()) 392 if (shouldPreserve3D())
393 renderingContext = this; 393 renderingContext = this;
394 394
395 for (DeprecatedPaintLayer* current = enclosingLayerForContainingBlock(this); current && current->shouldPreserve3D(); current = enclosingLayerForContainingBl ock(current)) 395 for (DeprecatedPaintLayer* current = enclosingLayerForContainingBlock(this); current && current->shouldPreserve3D(); current = enclosingLayerForContainingBl ock(current))
396 renderingContext = current; 396 renderingContext = current;
397 397
398 return renderingContext; 398 return renderingContext;
399 } 399 }
400 400
401 TransformationMatrix DeprecatedPaintLayer::currentTransform(LayoutStyle::ApplyTr ansformOrigin applyOrigin) const 401 TransformationMatrix DeprecatedPaintLayer::currentTransform(ComputedStyle::Apply TransformOrigin applyOrigin) const
402 { 402 {
403 if (!m_transform) 403 if (!m_transform)
404 return TransformationMatrix(); 404 return TransformationMatrix();
405 405
406 // m_transform includes transform-origin, so we need to recompute the transf orm here. 406 // m_transform includes transform-origin, so we need to recompute the transf orm here.
407 if (applyOrigin == LayoutStyle::ExcludeTransformOrigin) { 407 if (applyOrigin == ComputedStyle::ExcludeTransformOrigin) {
408 LayoutBox* box = layoutBox(); 408 LayoutBox* box = layoutBox();
409 TransformationMatrix currTransform; 409 TransformationMatrix currTransform;
410 box->style()->applyTransform(currTransform, LayoutSize(box->pixelSnapped Size()), LayoutStyle::ExcludeTransformOrigin); 410 box->style()->applyTransform(currTransform, LayoutSize(box->pixelSnapped Size()), ComputedStyle::ExcludeTransformOrigin);
411 makeMatrixRenderable(currTransform, compositor()->hasAcceleratedComposit ing()); 411 makeMatrixRenderable(currTransform, compositor()->hasAcceleratedComposit ing());
412 return currTransform; 412 return currTransform;
413 } 413 }
414 414
415 return *m_transform; 415 return *m_transform;
416 } 416 }
417 417
418 TransformationMatrix DeprecatedPaintLayer::renderableTransform(PaintBehavior pai ntBehavior) const 418 TransformationMatrix DeprecatedPaintLayer::renderableTransform(PaintBehavior pai ntBehavior) const
419 { 419 {
420 if (!m_transform) 420 if (!m_transform)
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 m_needsPositionUpdate = false; 897 m_needsPositionUpdate = false;
898 #endif 898 #endif
899 return positionOrOffsetChanged; 899 return positionOrOffsetChanged;
900 } 900 }
901 901
902 TransformationMatrix DeprecatedPaintLayer::perspectiveTransform() const 902 TransformationMatrix DeprecatedPaintLayer::perspectiveTransform() const
903 { 903 {
904 if (!layoutObject()->hasTransformRelatedProperty()) 904 if (!layoutObject()->hasTransformRelatedProperty())
905 return TransformationMatrix(); 905 return TransformationMatrix();
906 906
907 const LayoutStyle& style = layoutObject()->styleRef(); 907 const ComputedStyle& style = layoutObject()->styleRef();
908 if (!style.hasPerspective()) 908 if (!style.hasPerspective())
909 return TransformationMatrix(); 909 return TransformationMatrix();
910 910
911 // Maybe fetch the perspective from the backing? 911 // Maybe fetch the perspective from the backing?
912 const IntRect borderBox = toLayoutBox(layoutObject())->pixelSnappedBorderBox Rect(); 912 const IntRect borderBox = toLayoutBox(layoutObject())->pixelSnappedBorderBox Rect();
913 const float boxWidth = borderBox.width(); 913 const float boxWidth = borderBox.width();
914 const float boxHeight = borderBox.height(); 914 const float boxHeight = borderBox.height();
915 915
916 float perspectiveOriginX = floatValueForLength(style.perspectiveOriginX(), b oxWidth); 916 float perspectiveOriginX = floatValueForLength(style.perspectiveOriginX(), b oxWidth);
917 float perspectiveOriginY = floatValueForLength(style.perspectiveOriginY(), b oxHeight); 917 float perspectiveOriginY = floatValueForLength(style.perspectiveOriginY(), b oxHeight);
(...skipping 10 matching lines...) Expand all
928 928
929 return t; 929 return t;
930 } 930 }
931 931
932 FloatPoint DeprecatedPaintLayer::perspectiveOrigin() const 932 FloatPoint DeprecatedPaintLayer::perspectiveOrigin() const
933 { 933 {
934 if (!layoutObject()->hasTransformRelatedProperty()) 934 if (!layoutObject()->hasTransformRelatedProperty())
935 return FloatPoint(); 935 return FloatPoint();
936 936
937 const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect(); 937 const LayoutRect borderBox = toLayoutBox(layoutObject())->borderBoxRect();
938 const LayoutStyle& style = layoutObject()->styleRef(); 938 const ComputedStyle& style = layoutObject()->styleRef();
939 939
940 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox. width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he ight().toFloat())); 940 return FloatPoint(floatValueForLength(style.perspectiveOriginX(), borderBox. width().toFloat()), floatValueForLength(style.perspectiveOriginY(), borderBox.he ight().toFloat()));
941 } 941 }
942 942
943 static inline bool isFixedPositionedContainer(DeprecatedPaintLayer* layer) 943 static inline bool isFixedPositionedContainer(DeprecatedPaintLayer* layer)
944 { 944 {
945 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); 945 return layer->isRootLayer() || layer->hasTransformRelatedProperty();
946 } 946 }
947 947
948 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingPositionedAncestor() const 948 DeprecatedPaintLayer* DeprecatedPaintLayer::enclosingPositionedAncestor() const
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after
1517 offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)) ; 1517 offset.moveBy(-ancestorLayer->visualOffsetFromAncestor(paginationLayer)) ;
1518 } 1518 }
1519 return offset; 1519 return offset;
1520 } 1520 }
1521 1521
1522 void DeprecatedPaintLayer::didUpdateNeedsCompositedScrolling() 1522 void DeprecatedPaintLayer::didUpdateNeedsCompositedScrolling()
1523 { 1523 {
1524 updateSelfPaintingLayer(); 1524 updateSelfPaintingLayer();
1525 } 1525 }
1526 1526
1527 void DeprecatedPaintLayer::updateReflectionInfo(const LayoutStyle* oldStyle) 1527 void DeprecatedPaintLayer::updateReflectionInfo(const ComputedStyle* oldStyle)
1528 { 1528 {
1529 ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldSt yle)); 1529 ASSERT(!oldStyle || !layoutObject()->style()->reflectionDataEquivalent(oldSt yle));
1530 if (layoutObject()->hasReflection()) { 1530 if (layoutObject()->hasReflection()) {
1531 if (!m_reflectionInfo) 1531 if (!m_reflectionInfo)
1532 m_reflectionInfo = adoptPtr(new DeprecatedPaintLayerReflectionInfo(* layoutBox())); 1532 m_reflectionInfo = adoptPtr(new DeprecatedPaintLayerReflectionInfo(* layoutBox()));
1533 m_reflectionInfo->updateAfterStyleChange(oldStyle); 1533 m_reflectionInfo->updateAfterStyleChange(oldStyle);
1534 } else if (m_reflectionInfo) { 1534 } else if (m_reflectionInfo) {
1535 m_reflectionInfo->destroy(); 1535 m_reflectionInfo->destroy();
1536 m_reflectionInfo = nullptr; 1536 m_reflectionInfo = nullptr;
1537 } 1537 }
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after
2716 } 2716 }
2717 2717
2718 bool DeprecatedPaintLayer::hasVisibleBoxDecorations() const 2718 bool DeprecatedPaintLayer::hasVisibleBoxDecorations() const
2719 { 2719 {
2720 if (!hasVisibleContent()) 2720 if (!hasVisibleContent())
2721 return false; 2721 return false;
2722 2722
2723 return hasBoxDecorationsOrBackground() || hasOverflowControls(); 2723 return hasBoxDecorationsOrBackground() || hasOverflowControls();
2724 } 2724 }
2725 2725
2726 void DeprecatedPaintLayer::updateFilters(const LayoutStyle* oldStyle, const Layo utStyle& newStyle) 2726 void DeprecatedPaintLayer::updateFilters(const ComputedStyle* oldStyle, const Co mputedStyle& newStyle)
2727 { 2727 {
2728 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter())) 2728 if (!newStyle.hasFilter() && (!oldStyle || !oldStyle->hasFilter()))
2729 return; 2729 return;
2730 2730
2731 updateOrRemoveFilterClients(); 2731 updateOrRemoveFilterClients();
2732 updateOrRemoveFilterEffectRenderer(); 2732 updateOrRemoveFilterEffectRenderer();
2733 } 2733 }
2734 2734
2735 bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const LayoutStyle* oldStyle) 2735 bool DeprecatedPaintLayer::attemptDirectCompositingUpdate(StyleDifference diff, const ComputedStyle* oldStyle)
2736 { 2736 {
2737 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp ositingReasonsFromStyle; 2737 CompositingReasons oldPotentialCompositingReasonsFromStyle = m_potentialComp ositingReasonsFromStyle;
2738 compositor()->updatePotentialCompositingReasonsFromStyle(this); 2738 compositor()->updatePotentialCompositingReasonsFromStyle(this);
2739 2739
2740 // This function implements an optimization for transforms and opacity. 2740 // This function implements an optimization for transforms and opacity.
2741 // A common pattern is for a touchmove handler to update the transform 2741 // A common pattern is for a touchmove handler to update the transform
2742 // and/or an opacity of an element every frame while the user moves their 2742 // and/or an opacity of an element every frame while the user moves their
2743 // finger across the screen. The conditions below recognize when the 2743 // finger across the screen. The conditions below recognize when the
2744 // compositing state is set up to receive a direct transform or opacity 2744 // compositing state is set up to receive a direct transform or opacity
2745 // update. 2745 // update.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2783 2783
2784 // FIXME: Consider introducing a smaller graphics layer update scope 2784 // FIXME: Consider introducing a smaller graphics layer update scope
2785 // that just handles transforms and opacity. GraphicsLayerUpdateLocal 2785 // that just handles transforms and opacity. GraphicsLayerUpdateLocal
2786 // will also program bounds, clips, and many other properties that could 2786 // will also program bounds, clips, and many other properties that could
2787 // not possibly have changed. 2787 // not possibly have changed.
2788 m_compositedDeprecatedPaintLayerMapping->setNeedsGraphicsLayerUpdate(Graphic sLayerUpdateLocal); 2788 m_compositedDeprecatedPaintLayerMapping->setNeedsGraphicsLayerUpdate(Graphic sLayerUpdateLocal);
2789 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange ); 2789 compositor()->setNeedsCompositingUpdate(CompositingUpdateAfterGeometryChange );
2790 return true; 2790 return true;
2791 } 2791 }
2792 2792
2793 void DeprecatedPaintLayer::styleChanged(StyleDifference diff, const LayoutStyle* oldStyle) 2793 void DeprecatedPaintLayer::styleChanged(StyleDifference diff, const ComputedStyl e* oldStyle)
2794 { 2794 {
2795 if (attemptDirectCompositingUpdate(diff, oldStyle)) 2795 if (attemptDirectCompositingUpdate(diff, oldStyle))
2796 return; 2796 return;
2797 2797
2798 m_stackingNode->updateIsNormalFlowOnly(); 2798 m_stackingNode->updateIsNormalFlowOnly();
2799 m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle); 2799 m_stackingNode->updateStackingNodesAfterStyleChange(oldStyle);
2800 2800
2801 if (m_scrollableArea) 2801 if (m_scrollableArea)
2802 m_scrollableArea->updateAfterStyleChange(oldStyle); 2802 m_scrollableArea->updateAfterStyleChange(oldStyle);
2803 2803
(...skipping 15 matching lines...) Expand all
2819 } 2819 }
2820 2820
2821 bool DeprecatedPaintLayer::scrollsOverflow() const 2821 bool DeprecatedPaintLayer::scrollsOverflow() const
2822 { 2822 {
2823 if (DeprecatedPaintLayerScrollableArea* scrollableArea = this->scrollableAre a()) 2823 if (DeprecatedPaintLayerScrollableArea* scrollableArea = this->scrollableAre a())
2824 return scrollableArea->scrollsOverflow(); 2824 return scrollableArea->scrollsOverflow();
2825 2825
2826 return false; 2826 return false;
2827 } 2827 }
2828 2828
2829 FilterOperations DeprecatedPaintLayer::computeFilterOperations(const LayoutStyle & style) 2829 FilterOperations DeprecatedPaintLayer::computeFilterOperations(const ComputedSty le& style)
2830 { 2830 {
2831 const FilterOperations& filters = style.filter(); 2831 const FilterOperations& filters = style.filter();
2832 if (filters.hasReferenceFilter()) { 2832 if (filters.hasReferenceFilter()) {
2833 for (size_t i = 0; i < filters.size(); ++i) { 2833 for (size_t i = 0; i < filters.size(); ++i) {
2834 FilterOperation* filterOperation = filters.operations().at(i).get(); 2834 FilterOperation* filterOperation = filters.operations().at(i).get();
2835 if (filterOperation->type() != FilterOperation::REFERENCE) 2835 if (filterOperation->type() != FilterOperation::REFERENCE)
2836 continue; 2836 continue;
2837 ReferenceFilterOperation* referenceOperation = toReferenceFilterOper ation(filterOperation); 2837 ReferenceFilterOperation* referenceOperation = toReferenceFilterOper ation(filterOperation);
2838 // FIXME: Cache the ReferenceFilter if it didn't change. 2838 // FIXME: Cache the ReferenceFilter if it didn't change.
2839 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte r::create(style.effectiveZoom()); 2839 RefPtrWillBeRawPtr<ReferenceFilter> referenceFilter = ReferenceFilte r::create(style.effectiveZoom());
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
2968 } 2968 }
2969 } 2969 }
2970 2970
2971 void showLayerTree(const blink::LayoutObject* renderer) 2971 void showLayerTree(const blink::LayoutObject* renderer)
2972 { 2972 {
2973 if (!renderer) 2973 if (!renderer)
2974 return; 2974 return;
2975 showLayerTree(renderer->enclosingLayer()); 2975 showLayerTree(renderer->enclosingLayer());
2976 } 2976 }
2977 #endif 2977 #endif
OLDNEW
« no previous file with comments | « Source/core/paint/DeprecatedPaintLayer.h ('k') | Source/core/paint/DeprecatedPaintLayerPainter.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698