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

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

Issue 895383002: Let StyleResolver figure out differences between UA style and resolved style. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: 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
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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (RuntimeEnabledFeatures::cssCompositingEnabled()) 144 if (RuntimeEnabledFeatures::cssCompositingEnabled())
145 return true; 145 return true;
146 break; 146 break;
147 default: 147 default:
148 break; 148 break;
149 } 149 }
150 } 150 }
151 return false; 151 return false;
152 } 152 }
153 153
154 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element *e, const CachedUAStyle* cachedUAStyle) 154 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element *e, const UAStyleChange& uaStyle)
155 { 155 {
156 ASSERT(parentStyle); 156 ASSERT(parentStyle);
157 157
158 if (style->display() != NONE) { 158 if (style->display() != NONE) {
159 if (e && e->isHTMLElement()) 159 if (e && e->isHTMLElement())
160 adjustStyleForHTMLElement(style, parentStyle, toHTMLElement(*e)); 160 adjustStyleForHTMLElement(style, parentStyle, toHTMLElement(*e));
161 161
162 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'. 162 // Per the spec, position 'static' and 'relative' in the top layer compu te to 'absolute'.
163 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st yle->position() == RelativePosition)) 163 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st yle->position() == RelativePosition))
164 style->setPosition(AbsolutePosition); 164 style->setPosition(AbsolutePosition);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 211
212 if (style->overflowX() != OVISIBLE || style->overflowY() != OVISIBLE) 212 if (style->overflowX() != OVISIBLE || style->overflowY() != OVISIBLE)
213 adjustOverflow(style); 213 adjustOverflow(style);
214 214
215 // Cull out any useless layers and also repeat patterns into additional laye rs. 215 // Cull out any useless layers and also repeat patterns into additional laye rs.
216 style->adjustBackgroundLayers(); 216 style->adjustBackgroundLayers();
217 style->adjustMaskLayers(); 217 style->adjustMaskLayers();
218 218
219 // Let the theme also have a crack at adjusting the style. 219 // Let the theme also have a crack at adjusting the style.
220 if (style->hasAppearance()) 220 if (style->hasAppearance())
221 LayoutTheme::theme().adjustStyle(style, e, cachedUAStyle); 221 LayoutTheme::theme().adjustStyle(style, e, uaStyle);
222 222
223 // If we have first-letter pseudo style, transitions, or animations, do not share this style. 223 // If we have first-letter pseudo style, transitions, or animations, do not share this style.
224 if (style->hasPseudoStyle(FIRST_LETTER) || style->transitions() || style->an imations()) 224 if (style->hasPseudoStyle(FIRST_LETTER) || style->transitions() || style->an imations())
225 style->setUnique(); 225 style->setUnique();
226 226
227 // FIXME: when dropping the -webkit prefix on transform-style, we should als o have opacity < 1 cause flattening. 227 // FIXME: when dropping the -webkit prefix on transform-style, we should als o have opacity < 1 cause flattening.
228 if (style->preserves3D() && (style->overflowX() != OVISIBLE 228 if (style->preserves3D() && (style->overflowX() != OVISIBLE
229 || style->overflowY() != OVISIBLE 229 || style->overflowY() != OVISIBLE
230 || style->hasFilter())) 230 || style->hasFilter()))
231 style->setTransformStyle3D(TransformStyle3DFlat); 231 style->setTransformStyle3D(TransformStyle3DFlat);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX)) 488 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B OX || style->display() == INLINE_BOX))
489 style->setWritingMode(TopToBottomWritingMode); 489 style->setWritingMode(TopToBottomWritingMode);
490 490
491 if (parentStyle->isDisplayFlexibleOrGridBox()) { 491 if (parentStyle->isDisplayFlexibleOrGridBox()) {
492 style->setFloating(NoFloat); 492 style->setFloating(NoFloat);
493 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles)); 493 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa ting(), !m_useQuirksModeStyles));
494 } 494 }
495 } 495 }
496 496
497 } 497 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698