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

Side by Side Diff: sky/engine/core/css/resolver/StyleAdjuster.cpp

Issue 1229273004: Remove Animations and Transitions. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 3 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 4 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 5 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 6 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 7 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 9 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
10 * Copyright (C) Research In Motion Limited 2011. All rights reserved. 10 * Copyright (C) Research In Motion Limited 2011. All rights reserved.
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element & e) 89 static bool doesNotInheritTextDecoration(const RenderStyle* style, const Element & e)
90 { 90 {
91 return isAtShadowBoundary(&e) || style->hasOutOfFlowPosition(); 91 return isAtShadowBoundary(&e) || style->hasOutOfFlowPosition();
92 } 92 }
93 93
94 static bool parentStyleForcesZIndexToCreateStackingContext(const RenderStyle* pa rentStyle) 94 static bool parentStyleForcesZIndexToCreateStackingContext(const RenderStyle* pa rentStyle)
95 { 95 {
96 return parentStyle->isDisplayFlexibleBox(); 96 return parentStyle->isDisplayFlexibleBox();
97 } 97 }
98 98
99 static bool hasWillChangeThatCreatesStackingContext(const RenderStyle* style)
100 {
101 for (size_t i = 0; i < style->willChangeProperties().size(); ++i) {
102 switch (style->willChangeProperties()[i]) {
103 case CSSPropertyOpacity:
104 case CSSPropertyTransform:
105 case CSSPropertyWebkitTransform:
106 case CSSPropertyTransformStyle:
107 case CSSPropertyWebkitTransformStyle:
108 case CSSPropertyPerspective:
109 case CSSPropertyWebkitPerspective:
110 case CSSPropertyWebkitClipPath:
111 case CSSPropertyFilter:
112 case CSSPropertyZIndex:
113 case CSSPropertyPosition:
114 return true;
115 default:
116 break;
117 }
118 }
119 return false;
120 }
121
122 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element& element) 99 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element& element)
123 { 100 {
124 ASSERT(parentStyle); 101 ASSERT(parentStyle);
125 102
126 if (style->display() != NONE) { 103 if (style->display() != NONE) {
127 if (style->hasOutOfFlowPosition() || parentStyle->requiresOnlyBlockChild ren()) 104 if (style->hasOutOfFlowPosition() || parentStyle->requiresOnlyBlockChild ren())
128 style->setDisplay(equivalentBlockDisplay(style->display())); 105 style->setDisplay(equivalentBlockDisplay(style->display()));
129 else 106 else
130 style->setDisplay(equivalentInlineDisplay(style->display())); 107 style->setDisplay(equivalentInlineDisplay(style->display()));
131 } 108 }
132 109
133 // Make sure our z-index value is only applied if the object is positioned. 110 // Make sure our z-index value is only applied if the object is positioned.
134 if (style->position() == StaticPosition && !parentStyleForcesZIndexToCreateS tackingContext(parentStyle)) 111 if (style->position() == StaticPosition && !parentStyleForcesZIndexToCreateS tackingContext(parentStyle))
135 style->setHasAutoZIndex(); 112 style->setHasAutoZIndex();
136 113
137 if (style->hasAutoZIndex() 114 if (style->hasAutoZIndex()
138 && (style->hasOpacity() 115 && (style->hasOpacity()
139 || style->hasTransformRelatedProperty() 116 || style->hasTransformRelatedProperty()
140 || style->clipPath() 117 || style->clipPath()
141 || style->hasFilter() 118 || style->hasFilter()))
142 || hasWillChangeThatCreatesStackingContext(style)))
143 style->setZIndex(0); 119 style->setZIndex(0);
144 120
145 // will-change:transform should result in the same rendering behavior as hav ing a transform,
146 // including the creation of a containing block for fixed position descendan ts.
147 if (!style->hasTransform() && (style->willChangeProperties().contains(CSSPro pertyWebkitTransform) || style->willChangeProperties().contains(CSSPropertyTrans form))) {
148 bool makeIdentity = true;
149 style->setTransform(TransformOperations(makeIdentity));
150 }
151
152 if (doesNotInheritTextDecoration(style, element)) 121 if (doesNotInheritTextDecoration(style, element))
153 style->clearAppliedTextDecorations(); 122 style->clearAppliedTextDecorations();
154 123
155 style->applyTextDecorations(); 124 style->applyTextDecorations();
156 125
157 if (style->overflowX() != OVISIBLE || style->overflowY() != OVISIBLE) 126 if (style->overflowX() != OVISIBLE || style->overflowY() != OVISIBLE)
158 adjustOverflow(style); 127 adjustOverflow(style);
159 128
160 // Cull out any useless layers and also repeat patterns into additional laye rs. 129 // Cull out any useless layers and also repeat patterns into additional laye rs.
161 style->adjustBackgroundLayers(); 130 style->adjustBackgroundLayers();
162 131
163 // If we have transitions, or animations, do not share this style.
164 if (style->transitions() || style->animations())
165 style->setUnique();
166
167 // FIXME: when dropping the -webkit prefix on transform-style, we should als o have opacity < 1 cause flattening. 132 // FIXME: when dropping the -webkit prefix on transform-style, we should als o have opacity < 1 cause flattening.
168 if (style->preserves3D() && (style->overflowX() != OVISIBLE 133 if (style->preserves3D() && (style->overflowX() != OVISIBLE
169 || style->overflowY() != OVISIBLE 134 || style->overflowY() != OVISIBLE
170 || style->hasFilter())) 135 || style->hasFilter()))
171 style->setTransformStyle3D(TransformStyle3DFlat); 136 style->setTransformStyle3D(TransformStyle3DFlat);
172 137
173 adjustStyleForAlignment(*style, *parentStyle); 138 adjustStyleForAlignment(*style, *parentStyle);
174 } 139 }
175 140
176 void StyleAdjuster::adjustStyleForAlignment(RenderStyle& style, const RenderStyl e& parentStyle) 141 void StyleAdjuster::adjustStyleForAlignment(RenderStyle& style, const RenderStyl e& parentStyle)
(...skipping 23 matching lines...) Expand all
200 // FIXME: Once we implement pagination controls, overflow-x should defau lt to hidden 165 // FIXME: Once we implement pagination controls, overflow-x should defau lt to hidden
201 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w e'll let it 166 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w e'll let it
202 // default to auto so we can at least scroll through the pages. 167 // default to auto so we can at least scroll through the pages.
203 style->setOverflowX(OAUTO); 168 style->setOverflowX(OAUTO);
204 } else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE) { 169 } else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE) {
205 style->setOverflowY(OAUTO); 170 style->setOverflowY(OAUTO);
206 } 171 }
207 } 172 }
208 173
209 } 174 }
OLDNEW
« no previous file with comments | « sky/engine/core/css/resolver/SharedStyleFinder.cpp ('k') | sky/engine/core/css/resolver/StyleBuilderCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698