| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 { | 105 { |
| 106 return style.display() == INLINE_TABLE | 106 return style.display() == INLINE_TABLE |
| 107 || style.display() == INLINE_BLOCK || style.display() == INLINE_BOX || i
sAtShadowBoundary(element) | 107 || style.display() == INLINE_BLOCK || style.display() == INLINE_BOX || i
sAtShadowBoundary(element) |
| 108 || style.isFloating() || style.hasOutOfFlowPosition() || isOutermostSVGE
lement(element); | 108 || style.isFloating() || style.hasOutOfFlowPosition() || isOutermostSVGE
lement(element); |
| 109 } | 109 } |
| 110 | 110 |
| 111 // FIXME: This helper is only needed because pseudoStyleForElement passes a null | 111 // FIXME: This helper is only needed because pseudoStyleForElement passes a null |
| 112 // element to adjustComputedStyle, so we can't just use element->isInTopLayer(). | 112 // element to adjustComputedStyle, so we can't just use element->isInTopLayer(). |
| 113 static bool isInTopLayer(const Element* element, const ComputedStyle& style) | 113 static bool isInTopLayer(const Element* element, const ComputedStyle& style) |
| 114 { | 114 { |
| 115 return (element && element->isInTopLayer()) || style.styleType() == BACKDROP
; | 115 return (element && element->isInTopLayer()) || style.styleType() == PseudoId
Backdrop; |
| 116 } | 116 } |
| 117 | 117 |
| 118 static bool parentStyleForcesZIndexToCreateStackingContext(const ComputedStyle&
parentStyle) | 118 static bool parentStyleForcesZIndexToCreateStackingContext(const ComputedStyle&
parentStyle) |
| 119 { | 119 { |
| 120 return parentStyle.isDisplayFlexibleOrGridBox(); | 120 return parentStyle.isDisplayFlexibleOrGridBox(); |
| 121 } | 121 } |
| 122 | 122 |
| 123 static bool hasWillChangeThatCreatesStackingContext(const ComputedStyle& style) | 123 static bool hasWillChangeThatCreatesStackingContext(const ComputedStyle& style) |
| 124 { | 124 { |
| 125 for (size_t i = 0; i < style.willChangeProperties().size(); ++i) { | 125 for (size_t i = 0; i < style.willChangeProperties().size(); ++i) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 215 |
| 216 // Cull out any useless layers and also repeat patterns into additional laye
rs. | 216 // Cull out any useless layers and also repeat patterns into additional laye
rs. |
| 217 style.adjustBackgroundLayers(); | 217 style.adjustBackgroundLayers(); |
| 218 style.adjustMaskLayers(); | 218 style.adjustMaskLayers(); |
| 219 | 219 |
| 220 // Let the theme also have a crack at adjusting the style. | 220 // Let the theme also have a crack at adjusting the style. |
| 221 if (style.hasAppearance()) | 221 if (style.hasAppearance()) |
| 222 LayoutTheme::theme().adjustStyle(style, element); | 222 LayoutTheme::theme().adjustStyle(style, element); |
| 223 | 223 |
| 224 // If we have first-letter pseudo style, transitions, or animations, do not
share this style. | 224 // If we have first-letter pseudo style, transitions, or animations, do not
share this style. |
| 225 if (style.hasPseudoStyle(FIRST_LETTER) || style.transitions() || style.anima
tions()) | 225 if (style.hasPseudoStyle(PseudoIdFirstLetter) || style.transitions() || styl
e.animations()) |
| 226 style.setUnique(); | 226 style.setUnique(); |
| 227 | 227 |
| 228 // FIXME: when dropping the -webkit prefix on transform-style, we should als
o have opacity < 1 cause flattening. | 228 // FIXME: when dropping the -webkit prefix on transform-style, we should als
o have opacity < 1 cause flattening. |
| 229 if (style.preserves3D() && (style.overflowX() != OverflowVisible | 229 if (style.preserves3D() && (style.overflowX() != OverflowVisible |
| 230 || style.overflowY() != OverflowVisible | 230 || style.overflowY() != OverflowVisible |
| 231 || style.hasFilter())) | 231 || style.hasFilter())) |
| 232 style.setTransformStyle3D(TransformStyle3DFlat); | 232 style.setTransformStyle3D(TransformStyle3DFlat); |
| 233 | 233 |
| 234 bool isSVGElement = element && element->isSVGElement(); | 234 bool isSVGElement = element && element->isSVGElement(); |
| 235 if (isSVGElement) { | 235 if (isSVGElement) { |
| 236 // Only the root <svg> element in an SVG document fragment tree honors c
ss position | 236 // Only the root <svg> element in an SVG document fragment tree honors c
ss position |
| 237 if (!(isSVGSVGElement(*element) && element->parentNode() && !element->pa
rentNode()->isSVGElement())) | 237 if (!(isSVGSVGElement(*element) && element->parentNode() && !element->pa
rentNode()->isSVGElement())) |
| 238 style.setPosition(ComputedStyle::initialPosition()); | 238 style.setPosition(ComputedStyle::initialPosition()); |
| 239 | 239 |
| 240 // SVG text layout code expects us to be a block-level style element. | 240 // SVG text layout code expects us to be a block-level style element. |
| 241 if ((isSVGForeignObjectElement(*element) || isSVGTextElement(*element))
&& style.isDisplayInlineType()) | 241 if ((isSVGForeignObjectElement(*element) || isSVGTextElement(*element))
&& style.isDisplayInlineType()) |
| 242 style.setDisplay(BLOCK); | 242 style.setDisplay(BLOCK); |
| 243 | 243 |
| 244 // Columns don't apply to svg text elements. | 244 // Columns don't apply to svg text elements. |
| 245 if (isSVGTextElement(*element)) | 245 if (isSVGTextElement(*element)) |
| 246 style.clearMultiCol(); | 246 style.clearMultiCol(); |
| 247 } | 247 } |
| 248 adjustStyleForAlignment(style, parentStyle); | 248 adjustStyleForAlignment(style, parentStyle); |
| 249 } | 249 } |
| 250 | 250 |
| 251 void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style) | 251 void StyleAdjuster::adjustStyleForFirstLetter(ComputedStyle& style) |
| 252 { | 252 { |
| 253 if (style.styleType() != FIRST_LETTER) | 253 if (style.styleType() != PseudoIdFirstLetter) |
| 254 return; | 254 return; |
| 255 | 255 |
| 256 // Force inline display (except for floating first-letters). | 256 // Force inline display (except for floating first-letters). |
| 257 style.setDisplay(style.isFloating() ? BLOCK : INLINE); | 257 style.setDisplay(style.isFloating() ? BLOCK : INLINE); |
| 258 | 258 |
| 259 // CSS2 says first-letter can't be positioned. | 259 // CSS2 says first-letter can't be positioned. |
| 260 style.setPosition(StaticPosition); | 260 style.setPosition(StaticPosition); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void StyleAdjuster::adjustStyleForAlignment(ComputedStyle& style, const Computed
Style& parentStyle) | 263 void StyleAdjuster::adjustStyleForAlignment(ComputedStyle& style, const Computed
Style& parentStyle) |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 398 } |
| 399 } | 399 } |
| 400 | 400 |
| 401 void StyleAdjuster::adjustStyleForDisplay(ComputedStyle& style, const ComputedSt
yle& parentStyle, Document* document) | 401 void StyleAdjuster::adjustStyleForDisplay(ComputedStyle& style, const ComputedSt
yle& parentStyle, Document* document) |
| 402 { | 402 { |
| 403 if (style.display() == BLOCK && !style.isFloating()) | 403 if (style.display() == BLOCK && !style.isFloating()) |
| 404 return; | 404 return; |
| 405 | 405 |
| 406 // FIXME: Don't support this mutation for pseudo styles like first-letter or
first-line, since it's not completely | 406 // FIXME: Don't support this mutation for pseudo styles like first-letter or
first-line, since it's not completely |
| 407 // clear how that should work. | 407 // clear how that should work. |
| 408 if (style.display() == INLINE && style.styleType() == NOPSEUDO && style.getW
ritingMode() != parentStyle.getWritingMode()) | 408 if (style.display() == INLINE && style.styleType() == PseudoIdNone && style.
getWritingMode() != parentStyle.getWritingMode()) |
| 409 style.setDisplay(INLINE_BLOCK); | 409 style.setDisplay(INLINE_BLOCK); |
| 410 | 410 |
| 411 // After performing the display mutation, check table rows. We do not honor
position: relative table rows or cells. | 411 // After performing the display mutation, check table rows. We do not honor
position: relative table rows or cells. |
| 412 // This has been established for position: relative in CSS2.1 (and caused a
crash in containingBlock() | 412 // This has been established for position: relative in CSS2.1 (and caused a
crash in containingBlock() |
| 413 // on some sites). | 413 // on some sites). |
| 414 if ((style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_ROW_G
ROUP | 414 if ((style.display() == TABLE_HEADER_GROUP || style.display() == TABLE_ROW_G
ROUP |
| 415 || style.display() == TABLE_FOOTER_GROUP || style.display() == TABLE_ROW
) | 415 || style.display() == TABLE_FOOTER_GROUP || style.display() == TABLE_ROW
) |
| 416 && style.position() == RelativePosition) | 416 && style.position() == RelativePosition) |
| 417 style.setPosition(StaticPosition); | 417 style.setPosition(StaticPosition); |
| 418 | 418 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 436 // We want to count vertical percentage paddings/margins on flex items b
ecause our current | 436 // We want to count vertical percentage paddings/margins on flex items b
ecause our current |
| 437 // behavior is different from the spec and we want to gather compatibili
ty data. | 437 // behavior is different from the spec and we want to gather compatibili
ty data. |
| 438 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen
t()) | 438 if (style.paddingBefore().hasPercent() || style.paddingAfter().hasPercen
t()) |
| 439 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert
ical); | 439 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert
ical); |
| 440 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent(
)) | 440 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent(
)) |
| 441 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti
cal); | 441 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti
cal); |
| 442 } | 442 } |
| 443 } | 443 } |
| 444 | 444 |
| 445 } // namespace blink | 445 } // namespace blink |
| OLD | NEW |