| 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 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 || isInTopLayer(element, style) | 203 || isInTopLayer(element, style) |
| 204 || hasWillChangeThatCreatesStackingContext(style) | 204 || hasWillChangeThatCreatesStackingContext(style) |
| 205 || style.containsPaint())) | 205 || style.containsPaint())) |
| 206 style.setZIndex(0); | 206 style.setZIndex(0); |
| 207 | 207 |
| 208 if (doesNotInheritTextDecoration(style, element)) | 208 if (doesNotInheritTextDecoration(style, element)) |
| 209 style.clearAppliedTextDecorations(); | 209 style.clearAppliedTextDecorations(); |
| 210 | 210 |
| 211 style.applyTextDecorations(); | 211 style.applyTextDecorations(); |
| 212 | 212 |
| 213 if (style.overflowX() != OVISIBLE || style.overflowY() != OVISIBLE) | 213 if (style.overflowX() != OverflowVisible || style.overflowY() != OverflowVis
ible) |
| 214 adjustOverflow(style); | 214 adjustOverflow(style); |
| 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(FIRST_LETTER) || style.transitions() || style.anima
tions()) |
| 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() != OVISIBLE | 229 if (style.preserves3D() && (style.overflowX() != OverflowVisible |
| 230 || style.overflowY() != OVISIBLE | 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. |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 | 336 |
| 337 if (isHTMLRTElement(element)) { | 337 if (isHTMLRTElement(element)) { |
| 338 // Ruby text does not support float or position. This might change with
evolution of the specification. | 338 // Ruby text does not support float or position. This might change with
evolution of the specification. |
| 339 style.setPosition(StaticPosition); | 339 style.setPosition(StaticPosition); |
| 340 style.setFloating(NoFloat); | 340 style.setFloating(NoFloat); |
| 341 return; | 341 return; |
| 342 } | 342 } |
| 343 | 343 |
| 344 if (isHTMLMarqueeElement(element)) { | 344 if (isHTMLMarqueeElement(element)) { |
| 345 // For now, <marquee> requires an overflow clip to work properly. | 345 // For now, <marquee> requires an overflow clip to work properly. |
| 346 style.setOverflowX(OHIDDEN); | 346 style.setOverflowX(OverflowHidden); |
| 347 style.setOverflowY(OHIDDEN); | 347 style.setOverflowY(OverflowHidden); |
| 348 return; | 348 return; |
| 349 } | 349 } |
| 350 | 350 |
| 351 if (isHTMLTextAreaElement(element)) { | 351 if (isHTMLTextAreaElement(element)) { |
| 352 // Textarea considers overflow visible as auto. | 352 // Textarea considers overflow visible as auto. |
| 353 style.setOverflowX(style.overflowX() == OVISIBLE ? OAUTO : style.overflo
wX()); | 353 style.setOverflowX(style.overflowX() == OverflowVisible ? OverflowAuto :
style.overflowX()); |
| 354 style.setOverflowY(style.overflowY() == OVISIBLE ? OAUTO : style.overflo
wY()); | 354 style.setOverflowY(style.overflowY() == OverflowVisible ? OverflowAuto :
style.overflowY()); |
| 355 return; | 355 return; |
| 356 } | 356 } |
| 357 | 357 |
| 358 if (isHTMLPlugInElement(element)) { | 358 if (isHTMLPlugInElement(element)) { |
| 359 style.setRequiresAcceleratedCompositingForExternalReasons(toHTMLPlugInEl
ement(element).shouldAccelerate()); | 359 style.setRequiresAcceleratedCompositingForExternalReasons(toHTMLPlugInEl
ement(element).shouldAccelerate()); |
| 360 return; | 360 return; |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 | 363 |
| 364 void StyleAdjuster::adjustOverflow(ComputedStyle& style) | 364 void StyleAdjuster::adjustOverflow(ComputedStyle& style) |
| 365 { | 365 { |
| 366 ASSERT(style.overflowX() != OVISIBLE || style.overflowY() != OVISIBLE); | 366 ASSERT(style.overflowX() != OverflowVisible || style.overflowY() != Overflow
Visible); |
| 367 | 367 |
| 368 if (style.display() == TABLE || style.display() == INLINE_TABLE) { | 368 if (style.display() == TABLE || style.display() == INLINE_TABLE) { |
| 369 // Tables only support overflow:hidden and overflow:visible and ignore a
nything else, | 369 // Tables only support overflow:hidden and overflow:visible and ignore a
nything else, |
| 370 // see http://dev.w3.org/csswg/css2/visufx.html#overflow. As a table is
not a block | 370 // see http://dev.w3.org/csswg/css2/visufx.html#overflow. As a table is
not a block |
| 371 // container box the rules for resolving conflicting x and y values in C
SS Overflow Module | 371 // container box the rules for resolving conflicting x and y values in C
SS Overflow Module |
| 372 // Level 3 do not apply. Arguably overflow-x and overflow-y aren't allow
ed on tables but | 372 // Level 3 do not apply. Arguably overflow-x and overflow-y aren't allow
ed on tables but |
| 373 // all UAs allow it. | 373 // all UAs allow it. |
| 374 if (style.overflowX() != OHIDDEN) | 374 if (style.overflowX() != OverflowHidden) |
| 375 style.setOverflowX(OVISIBLE); | 375 style.setOverflowX(OverflowVisible); |
| 376 if (style.overflowY() != OHIDDEN) | 376 if (style.overflowY() != OverflowHidden) |
| 377 style.setOverflowY(OVISIBLE); | 377 style.setOverflowY(OverflowVisible); |
| 378 // If we are left with conflicting overflow values for the x and y axes
on a table then resolve | 378 // If we are left with conflicting overflow values for the x and y axes
on a table then resolve |
| 379 // both to OVISIBLE. This is interoperable behaviour but is not specced
anywhere. | 379 // both to OverflowVisible. This is interoperable behaviour but is not s
pecced anywhere. |
| 380 if (style.overflowX() == OVISIBLE) | 380 if (style.overflowX() == OverflowVisible) |
| 381 style.setOverflowY(OVISIBLE); | 381 style.setOverflowY(OverflowVisible); |
| 382 else if (style.overflowY() == OVISIBLE) | 382 else if (style.overflowY() == OverflowVisible) |
| 383 style.setOverflowX(OVISIBLE); | 383 style.setOverflowX(OverflowVisible); |
| 384 } else if (style.overflowX() == OVISIBLE && style.overflowY() != OVISIBLE) { | 384 } else if (style.overflowX() == OverflowVisible && style.overflowY() != Over
flowVisible) { |
| 385 // If either overflow value is not visible, change to auto. | 385 // If either overflow value is not visible, change to auto. |
| 386 // FIXME: Once we implement pagination controls, overflow-x should defau
lt to hidden | 386 // FIXME: Once we implement pagination controls, overflow-x should defau
lt to hidden |
| 387 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w
e'll let it | 387 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w
e'll let it |
| 388 // default to auto so we can at least scroll through the pages. | 388 // default to auto so we can at least scroll through the pages. |
| 389 style.setOverflowX(OAUTO); | 389 style.setOverflowX(OverflowAuto); |
| 390 } else if (style.overflowY() == OVISIBLE && style.overflowX() != OVISIBLE) { | 390 } else if (style.overflowY() == OverflowVisible && style.overflowX() != Over
flowVisible) { |
| 391 style.setOverflowY(OAUTO); | 391 style.setOverflowY(OverflowAuto); |
| 392 } | 392 } |
| 393 | 393 |
| 394 // Menulists should have visible overflow | 394 // Menulists should have visible overflow |
| 395 if (style.appearance() == MenulistPart) { | 395 if (style.appearance() == MenulistPart) { |
| 396 style.setOverflowX(OVISIBLE); | 396 style.setOverflowX(OverflowVisible); |
| 397 style.setOverflowY(OVISIBLE); | 397 style.setOverflowY(OverflowVisible); |
| 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. |
| (...skipping 28 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 |