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

Side by Side Diff: third_party/WebKit/Source/core/css/resolver/StyleAdjuster.cpp

Issue 2065233002: Force flattening for elements with non-initial value of opacity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix assert. (overflow needs to be adjusted prior to querying used transform-style) Created 4 years, 6 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 adjustStyleForFirstLetter(style); 177 adjustStyleForFirstLetter(style);
178 } 178 }
179 179
180 if (element && element->hasCompositorProxy()) 180 if (element && element->hasCompositorProxy())
181 style.setHasCompositorProxy(true); 181 style.setHasCompositorProxy(true);
182 182
183 // Make sure our z-index value is only applied if the object is positioned. 183 // Make sure our z-index value is only applied if the object is positioned.
184 if (style.position() == StaticPosition && !parentStyleForcesZIndexToCreateSt ackingContext(parentStyle)) 184 if (style.position() == StaticPosition && !parentStyleForcesZIndexToCreateSt ackingContext(parentStyle))
185 style.setHasAutoZIndex(); 185 style.setHasAutoZIndex();
186 186
187 if (style.overflowX() != OverflowVisible || style.overflowY() != OverflowVis ible)
188 adjustOverflow(style);
189
187 // Auto z-index becomes 0 for the root element and transparent objects. This prevents 190 // Auto z-index becomes 0 for the root element and transparent objects. This prevents
188 // cases where objects that should be blended as a single unit end up with a non-transparent 191 // cases where objects that should be blended as a single unit end up with a non-transparent
189 // object wedged in between them. Auto z-index also becomes 0 for objects th at specify transforms/masks/reflections. 192 // object wedged in between them. Auto z-index also becomes 0 for objects th at specify transforms/masks/reflections.
190 if (style.hasAutoZIndex() && ((element && element->document().documentElemen t() == element) 193 if (style.hasAutoZIndex() && ((element && element->document().documentElemen t() == element)
191 || style.hasOpacity() 194 || style.hasOpacity()
192 || style.hasTransformRelatedProperty() 195 || style.hasTransformRelatedProperty()
193 || style.hasMask() 196 || style.hasMask()
194 || style.clipPath() 197 || style.clipPath()
195 || style.boxReflect() 198 || style.boxReflect()
196 || style.hasFilterInducingProperty() 199 || style.hasFilterInducingProperty()
197 || style.hasBlendMode() 200 || style.hasBlendMode()
198 || style.hasIsolation() 201 || style.hasIsolation()
199 || style.hasViewportConstrainedPosition() 202 || style.hasViewportConstrainedPosition()
200 || isInTopLayer(element, style) 203 || isInTopLayer(element, style)
201 || hasWillChangeThatCreatesStackingContext(style) 204 || hasWillChangeThatCreatesStackingContext(style)
202 || style.containsPaint())) 205 || style.containsPaint()))
203 style.setZIndex(0); 206 style.setZIndex(0);
204 207
205 if (doesNotInheritTextDecoration(style, element)) 208 if (doesNotInheritTextDecoration(style, element))
206 style.clearAppliedTextDecorations(); 209 style.clearAppliedTextDecorations();
207 210
208 style.applyTextDecorations(); 211 style.applyTextDecorations();
209 212
210 if (style.overflowX() != OverflowVisible || style.overflowY() != OverflowVis ible)
211 adjustOverflow(style);
212
213 // Cull out any useless layers and also repeat patterns into additional laye rs. 213 // Cull out any useless layers and also repeat patterns into additional laye rs.
214 style.adjustBackgroundLayers(); 214 style.adjustBackgroundLayers();
215 style.adjustMaskLayers(); 215 style.adjustMaskLayers();
216 216
217 // Let the theme also have a crack at adjusting the style. 217 // Let the theme also have a crack at adjusting the style.
218 if (style.hasAppearance()) 218 if (style.hasAppearance())
219 LayoutTheme::theme().adjustStyle(style, element); 219 LayoutTheme::theme().adjustStyle(style, element);
220 220
221 // If we have first-letter pseudo style, transitions, or animations, do not share this style. 221 // If we have first-letter pseudo style, transitions, or animations, do not share this style.
222 if (style.hasPseudoStyle(PseudoIdFirstLetter) || style.transitions() || styl e.animations()) 222 if (style.hasPseudoStyle(PseudoIdFirstLetter) || style.transitions() || styl e.animations())
223 style.setUnique(); 223 style.setUnique();
224 224
225 // FIXME: when dropping the -webkit prefix on transform-style, we should als o have opacity < 1 cause flattening.
226 if (style.preserves3D() && (style.overflowX() != OverflowVisible
227 || style.overflowY() != OverflowVisible
228 || style.hasFilterInducingProperty()))
229 style.setTransformStyle3D(TransformStyle3DFlat);
230
231 adjustStyleForEditing(style); 225 adjustStyleForEditing(style);
232 226
233 bool isSVGElement = element && element->isSVGElement(); 227 bool isSVGElement = element && element->isSVGElement();
234 if (isSVGElement) { 228 if (isSVGElement) {
235 // Only the root <svg> element in an SVG document fragment tree honors c ss position 229 // Only the root <svg> element in an SVG document fragment tree honors c ss position
236 if (!(isSVGSVGElement(*element) && element->parentNode() && !element->pa rentNode()->isSVGElement())) 230 if (!(isSVGSVGElement(*element) && element->parentNode() && !element->pa rentNode()->isSVGElement()))
237 style.setPosition(ComputedStyle::initialPosition()); 231 style.setPosition(ComputedStyle::initialPosition());
238 232
239 // SVG text layout code expects us to be a block-level style element. 233 // SVG text layout code expects us to be a block-level style element.
240 if ((isSVGForeignObjectElement(*element) || isSVGTextElement(*element)) && style.isDisplayInlineType()) 234 if ((isSVGForeignObjectElement(*element) || isSVGTextElement(*element)) && style.isDisplayInlineType())
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
458 // We want to count vertical percentage paddings/margins on flex items b ecause our current 452 // We want to count vertical percentage paddings/margins on flex items b ecause our current
459 // behavior is different from the spec and we want to gather compatibili ty data. 453 // behavior is different from the spec and we want to gather compatibili ty data.
460 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen t()) 454 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen t())
461 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert ical); 455 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert ical);
462 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent( )) 456 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent( ))
463 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti cal); 457 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti cal);
464 } 458 }
465 } 459 }
466 460
467 } // namespace blink 461 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698