| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, const RenderStyle* par
entStyle, Element *e, const CachedUAStyle* cachedUAStyle) |
| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 if (style.alignContent() == ContentPositionAuto && style.alignContentDistrib
ution() == ContentDistributionDefault) { | 329 if (style.alignContent() == ContentPositionAuto && style.alignContentDistrib
ution() == ContentDistributionDefault) { |
| 330 if (style.isDisplayFlexibleOrGridBox()) { | 330 if (style.isDisplayFlexibleOrGridBox()) { |
| 331 if (style.isDisplayFlexibleBox()) | 331 if (style.isDisplayFlexibleBox()) |
| 332 style.setAlignContentDistribution(ContentDistributionStretch); | 332 style.setAlignContentDistribution(ContentDistributionStretch); |
| 333 else | 333 else |
| 334 style.setAlignContent(ContentPositionStart); | 334 style.setAlignContent(ContentPositionStart); |
| 335 } | 335 } |
| 336 } | 336 } |
| 337 } | 337 } |
| 338 | 338 |
| 339 void StyleAdjuster::adjustStyleForHTMLElement(RenderStyle* style, RenderStyle* p
arentStyle, HTMLElement& element) | 339 void StyleAdjuster::adjustStyleForHTMLElement(RenderStyle* style, const RenderSt
yle* parentStyle, HTMLElement& element) |
| 340 { | 340 { |
| 341 // <div> and <span> are the most common elements on the web, we skip all the
work for them. | 341 // <div> and <span> are the most common elements on the web, we skip all the
work for them. |
| 342 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) | 342 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) |
| 343 return; | 343 return; |
| 344 | 344 |
| 345 if (isHTMLTableCellElement(element)) { | 345 if (isHTMLTableCellElement(element)) { |
| 346 // If we have a <td> that specifies a float property, in quirks mode we
just drop the float property. | 346 // If we have a <td> that specifies a float property, in quirks mode we
just drop the float property. |
| 347 // FIXME: Why is this only <td> and not <th>? | 347 // FIXME: Why is this only <td> and not <th>? |
| 348 if (element.hasTagName(tdTag) && m_useQuirksModeStyles) { | 348 if (element.hasTagName(tdTag) && m_useQuirksModeStyles) { |
| 349 style->setDisplay(TABLE_CELL); | 349 style->setDisplay(TABLE_CELL); |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 style->setOverflowY(OVISIBLE); | 450 style->setOverflowY(OVISIBLE); |
| 451 } | 451 } |
| 452 | 452 |
| 453 // Menulists should have visible overflow | 453 // Menulists should have visible overflow |
| 454 if (style->appearance() == MenulistPart) { | 454 if (style->appearance() == MenulistPart) { |
| 455 style->setOverflowX(OVISIBLE); | 455 style->setOverflowX(OVISIBLE); |
| 456 style->setOverflowY(OVISIBLE); | 456 style->setOverflowY(OVISIBLE); |
| 457 } | 457 } |
| 458 } | 458 } |
| 459 | 459 |
| 460 void StyleAdjuster::adjustStyleForDisplay(RenderStyle* style, RenderStyle* paren
tStyle) | 460 void StyleAdjuster::adjustStyleForDisplay(RenderStyle* style, const RenderStyle*
parentStyle) |
| 461 { | 461 { |
| 462 if (style->display() == BLOCK && !style->isFloating()) | 462 if (style->display() == BLOCK && !style->isFloating()) |
| 463 return; | 463 return; |
| 464 | 464 |
| 465 // FIXME: Don't support this mutation for pseudo styles like first-letter or
first-line, since it's not completely | 465 // FIXME: Don't support this mutation for pseudo styles like first-letter or
first-line, since it's not completely |
| 466 // clear how that should work. | 466 // clear how that should work. |
| 467 if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->w
ritingMode() != parentStyle->writingMode()) | 467 if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->w
ritingMode() != parentStyle->writingMode()) |
| 468 style->setDisplay(INLINE_BLOCK); | 468 style->setDisplay(INLINE_BLOCK); |
| 469 | 469 |
| 470 // After performing the display mutation, check table rows. We do not honor
position: relative table rows or cells. | 470 // After performing the display mutation, check table rows. We do not honor
position: relative table rows or cells. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 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 } |
| OLD | NEW |