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

Side by Side Diff: Source/core/rendering/RenderLayer.cpp

Issue 889563002: Make RenderObject::style() return a const object (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Blind fix for Mac. 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
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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 { 326 {
327 if (m_transform) { 327 if (m_transform) {
328 RenderBox* box = renderBox(); 328 RenderBox* box = renderBox();
329 ASSERT(box); 329 ASSERT(box);
330 m_transform->makeIdentity(); 330 m_transform->makeIdentity();
331 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS ize()), RenderStyle::IncludeTransformOrigin); 331 box->style()->applyTransform(*m_transform, LayoutSize(box->pixelSnappedS ize()), RenderStyle::IncludeTransformOrigin);
332 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng()); 332 makeMatrixRenderable(*m_transform, compositor()->hasAcceleratedCompositi ng());
333 } 333 }
334 } 334 }
335 335
336 void RenderLayer::updateTransform(const RenderStyle* oldStyle, RenderStyle* newS tyle) 336 void RenderLayer::updateTransform(const RenderStyle* oldStyle, const RenderStyle * newStyle)
337 { 337 {
338 if (oldStyle && newStyle->transformDataEquivalent(*oldStyle)) 338 if (oldStyle && newStyle->transformDataEquivalent(*oldStyle))
339 return; 339 return;
340 340
341 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set, 341 // hasTransform() on the renderer is also true when there is transform-style : preserve-3d or perspective set,
342 // so check style too. 342 // so check style too.
343 bool hasTransform = renderer()->hasTransformRelatedProperty() && newStyle->h asTransform(); 343 bool hasTransform = renderer()->hasTransformRelatedProperty() && newStyle->h asTransform();
344 bool had3DTransform = has3DTransform(); 344 bool had3DTransform = has3DTransform();
345 345
346 bool hadTransform = m_transform; 346 bool hadTransform = m_transform;
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 m_needsPositionUpdate = false; 886 m_needsPositionUpdate = false;
887 #endif 887 #endif
888 return positionOrOffsetChanged; 888 return positionOrOffsetChanged;
889 } 889 }
890 890
891 TransformationMatrix RenderLayer::perspectiveTransform() const 891 TransformationMatrix RenderLayer::perspectiveTransform() const
892 { 892 {
893 if (!renderer()->hasTransformRelatedProperty()) 893 if (!renderer()->hasTransformRelatedProperty())
894 return TransformationMatrix(); 894 return TransformationMatrix();
895 895
896 RenderStyle* style = renderer()->style(); 896 const RenderStyle* style = renderer()->style();
897 if (!style->hasPerspective()) 897 if (!style->hasPerspective())
898 return TransformationMatrix(); 898 return TransformationMatrix();
899 899
900 // Maybe fetch the perspective from the backing? 900 // Maybe fetch the perspective from the backing?
901 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect (); 901 const IntRect borderBox = toRenderBox(renderer())->pixelSnappedBorderBoxRect ();
902 const float boxWidth = borderBox.width(); 902 const float boxWidth = borderBox.width();
903 const float boxHeight = borderBox.height(); 903 const float boxHeight = borderBox.height();
904 904
905 float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(), boxWidth); 905 float perspectiveOriginX = floatValueForLength(style->perspectiveOriginX(), boxWidth);
906 float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(), boxHeight); 906 float perspectiveOriginY = floatValueForLength(style->perspectiveOriginY(), boxHeight);
(...skipping 10 matching lines...) Expand all
917 917
918 return t; 918 return t;
919 } 919 }
920 920
921 FloatPoint RenderLayer::perspectiveOrigin() const 921 FloatPoint RenderLayer::perspectiveOrigin() const
922 { 922 {
923 if (!renderer()->hasTransformRelatedProperty()) 923 if (!renderer()->hasTransformRelatedProperty())
924 return FloatPoint(); 924 return FloatPoint();
925 925
926 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect(); 926 const LayoutRect borderBox = toRenderBox(renderer())->borderBoxRect();
927 RenderStyle* style = renderer()->style(); 927 const RenderStyle* style = renderer()->style();
928 928
929 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox .width().toFloat()), floatValueForLength(style->perspectiveOriginY(), borderBox. height().toFloat())); 929 return FloatPoint(floatValueForLength(style->perspectiveOriginX(), borderBox .width().toFloat()), floatValueForLength(style->perspectiveOriginY(), borderBox. height().toFloat()));
930 } 930 }
931 931
932 static inline bool isFixedPositionedContainer(RenderLayer* layer) 932 static inline bool isFixedPositionedContainer(RenderLayer* layer)
933 { 933 {
934 return layer->isRootLayer() || layer->hasTransformRelatedProperty(); 934 return layer->isRootLayer() || layer->hasTransformRelatedProperty();
935 } 935 }
936 936
937 RenderLayer* RenderLayer::enclosingPositionedAncestor() const 937 RenderLayer* RenderLayer::enclosingPositionedAncestor() const
(...skipping 1988 matching lines...) Expand 10 before | Expand all | Expand 10 after
2926 } 2926 }
2927 } 2927 }
2928 2928
2929 void showLayerTree(const blink::RenderObject* renderer) 2929 void showLayerTree(const blink::RenderObject* renderer)
2930 { 2930 {
2931 if (!renderer) 2931 if (!renderer)
2932 return; 2932 return;
2933 showLayerTree(renderer->enclosingLayer()); 2933 showLayerTree(renderer->enclosingLayer());
2934 } 2934 }
2935 #endif 2935 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698