OLD | NEW |
---|---|
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 26 matching lines...) Expand all Loading... | |
37 #include "core/html/HTMLIFrameElement.h" | 37 #include "core/html/HTMLIFrameElement.h" |
38 #include "core/html/HTMLInputElement.h" | 38 #include "core/html/HTMLInputElement.h" |
39 #include "core/html/HTMLTextAreaElement.h" | 39 #include "core/html/HTMLTextAreaElement.h" |
40 #include "core/frame/FrameView.h" | 40 #include "core/frame/FrameView.h" |
41 #include "core/frame/Settings.h" | 41 #include "core/frame/Settings.h" |
42 #include "core/rendering/RenderTheme.h" | 42 #include "core/rendering/RenderTheme.h" |
43 #include "core/rendering/style/GridPosition.h" | 43 #include "core/rendering/style/GridPosition.h" |
44 #include "core/rendering/style/RenderStyle.h" | 44 #include "core/rendering/style/RenderStyle.h" |
45 #include "core/rendering/style/RenderStyleConstants.h" | 45 #include "core/rendering/style/RenderStyleConstants.h" |
46 #include "platform/Length.h" | 46 #include "platform/Length.h" |
47 #include "platform/transforms/TransformOperations.h" | |
47 #include "wtf/Assertions.h" | 48 #include "wtf/Assertions.h" |
48 | 49 |
49 namespace WebCore { | 50 namespace WebCore { |
50 | 51 |
51 using namespace HTMLNames; | 52 using namespace HTMLNames; |
52 | 53 |
53 // FIXME: This is duplicated with StyleResolver.cpp | 54 // FIXME: This is duplicated with StyleResolver.cpp |
54 // Perhaps this should move onto ElementResolveContext or even Element? | 55 // Perhaps this should move onto ElementResolveContext or even Element? |
55 static inline bool isAtShadowBoundary(const Element* element) | 56 static inline bool isAtShadowBoundary(const Element* element) |
56 { | 57 { |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 static bool isDisplayGridBox(EDisplay display) | 152 static bool isDisplayGridBox(EDisplay display) |
152 { | 153 { |
153 return display == GRID || display == INLINE_GRID; | 154 return display == GRID || display == INLINE_GRID; |
154 } | 155 } |
155 | 156 |
156 static bool parentStyleForcesZIndexToCreateStackingContext(const RenderStyle* pa rentStyle) | 157 static bool parentStyleForcesZIndexToCreateStackingContext(const RenderStyle* pa rentStyle) |
157 { | 158 { |
158 return isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(pare ntStyle->display()); | 159 return isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(pare ntStyle->display()); |
159 } | 160 } |
160 | 161 |
162 static bool hasWillChangeThatCreatesStackingContext(const RenderStyle* style, El ement* e) | |
163 { | |
164 for (size_t i = 0; i < style->willChangeProperties().size(); ++i) { | |
165 switch (style->willChangeProperties()[i]) { | |
166 case CSSPropertyOpacity: | |
167 case CSSPropertyWebkitTransform: | |
168 case CSSPropertyWebkitTransformStyle: | |
169 case CSSPropertyWebkitPerspective: | |
170 case CSSPropertyWebkitMask: | |
171 case CSSPropertyWebkitMaskBoxImage: | |
172 case CSSPropertyWebkitClipPath: | |
173 case CSSPropertyWebkitBoxReflect: | |
174 case CSSPropertyWebkitFilter: | |
175 case CSSPropertyZIndex: | |
Ian Vollick
2014/02/26 16:21:12
z-index only creates a sc if the element is also p
ajuma
2014/02/26 17:00:30
I took a look at what Mozilla's implementation doe
| |
176 return true; | |
177 case CSSPropertyMixBlendMode: | |
178 case CSSPropertyIsolation: | |
179 if (RuntimeEnabledFeatures::cssCompositingEnabled()) | |
180 return true; | |
181 break; | |
182 case CSSPropertyPosition: | |
183 if (RuntimeEnabledFeatures::cssStickyPositionEnabled() | |
184 || (e && e->document().settings() && e->document().settings()->f ixedPositionCreatesStackingContext())) | |
185 return true; | |
186 break; | |
187 default: | |
188 break; | |
189 } | |
190 } | |
191 return false; | |
192 } | |
193 | |
161 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element *e) | 194 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element *e) |
162 { | 195 { |
163 ASSERT(parentStyle); | 196 ASSERT(parentStyle); |
164 | 197 |
165 // Cache our original display. | 198 // Cache our original display. |
166 style->setOriginalDisplay(style->display()); | 199 style->setOriginalDisplay(style->display()); |
167 | 200 |
168 if (style->display() != NONE) { | 201 if (style->display() != NONE) { |
169 // If we have a <td> that specifies a float property, in quirks mode we just drop the float | 202 // If we have a <td> that specifies a float property, in quirks mode we just drop the float |
170 // property. | 203 // property. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
268 || style->hasTransformRelatedProperty() | 301 || style->hasTransformRelatedProperty() |
269 || style->hasMask() | 302 || style->hasMask() |
270 || style->clipPath() | 303 || style->clipPath() |
271 || style->boxReflect() | 304 || style->boxReflect() |
272 || style->hasFilter() | 305 || style->hasFilter() |
273 || style->hasBlendMode() | 306 || style->hasBlendMode() |
274 || style->hasIsolation() | 307 || style->hasIsolation() |
275 || style->position() == StickyPosition | 308 || style->position() == StickyPosition |
276 || (style->position() == FixedPosition && e && e->document().settings() && e->document().settings()->fixedPositionCreatesStackingContext()) | 309 || (style->position() == FixedPosition && e && e->document().settings() && e->document().settings()->fixedPositionCreatesStackingContext()) |
277 || isInTopLayer(e, style) | 310 || isInTopLayer(e, style) |
311 || hasWillChangeThatCreatesStackingContext(style, e) | |
278 )) | 312 )) |
279 style->setZIndex(0); | 313 style->setZIndex(0); |
280 | 314 |
315 // will-change:transform should result in the same rendering behavior as hav ing a transform, | |
316 // including the creation of a containing block for fixed position descendan ts. | |
317 if (!style->hasTransform() && style->willChangeProperties().contains(CSSProp ertyWebkitTransform)) | |
318 style->setTransform(TransformOperations(true)); | |
319 | |
281 // Textarea considers overflow visible as auto. | 320 // Textarea considers overflow visible as auto. |
282 if (e && e->hasTagName(textareaTag)) { | 321 if (e && e->hasTagName(textareaTag)) { |
283 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over flowX()); | 322 style->setOverflowX(style->overflowX() == OVISIBLE ? OAUTO : style->over flowX()); |
284 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over flowY()); | 323 style->setOverflowY(style->overflowY() == OVISIBLE ? OAUTO : style->over flowY()); |
285 } | 324 } |
286 | 325 |
287 // For now, <marquee> requires an overflow clip to work properly. | 326 // For now, <marquee> requires an overflow clip to work properly. |
288 if (e && e->hasTagName(marqueeTag)) { | 327 if (e && e->hasTagName(marqueeTag)) { |
289 style->setOverflowX(OHIDDEN); | 328 style->setOverflowX(OHIDDEN); |
290 style->setOverflowY(OHIDDEN); | 329 style->setOverflowY(OHIDDEN); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
402 if (prop.isNamedGridArea() && !map.contains(prop.namedGridLine())) \ | 441 if (prop.isNamedGridArea() && !map.contains(prop.namedGridLine())) \ |
403 style->setGrid##Prop(GridPosition()); | 442 style->setGrid##Prop(GridPosition()); |
404 | 443 |
405 CLEAR_UNKNOWN_NAMED_AREA(columnStartPosition, ColumnStart); | 444 CLEAR_UNKNOWN_NAMED_AREA(columnStartPosition, ColumnStart); |
406 CLEAR_UNKNOWN_NAMED_AREA(columnEndPosition, ColumnEnd); | 445 CLEAR_UNKNOWN_NAMED_AREA(columnEndPosition, ColumnEnd); |
407 CLEAR_UNKNOWN_NAMED_AREA(rowStartPosition, RowStart); | 446 CLEAR_UNKNOWN_NAMED_AREA(rowStartPosition, RowStart); |
408 CLEAR_UNKNOWN_NAMED_AREA(rowEndPosition, RowEnd); | 447 CLEAR_UNKNOWN_NAMED_AREA(rowEndPosition, RowEnd); |
409 } | 448 } |
410 | 449 |
411 } | 450 } |
OLD | NEW |