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 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 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) | 159 if (e && e->isHTMLElement()) |
160 adjustStyleForTagName(style, parentStyle, *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); |
165 | 165 |
166 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. | 166 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. |
167 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc
ument().documentElement() == e)) | 167 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc
ument().documentElement() == e)) |
168 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !m_useQuirksModeStyles)); | 168 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !m_useQuirksModeStyles)); |
169 | 169 |
170 // We don't adjust the first letter style earlier because we may change
the display setting in | 170 // We don't adjust the first letter style earlier because we may change
the display setting in |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 if ((style.justifyContent() == ContentPositionAuto) && (style.justifyContent
Distribution() == ContentDistributionDefault)) { | 316 if ((style.justifyContent() == ContentPositionAuto) && (style.justifyContent
Distribution() == ContentDistributionDefault)) { |
317 if (style.isDisplayFlexibleOrGridBox()) { | 317 if (style.isDisplayFlexibleOrGridBox()) { |
318 if (style.isDisplayFlexibleBox()) | 318 if (style.isDisplayFlexibleBox()) |
319 style.setJustifyContent(ContentPositionFlexStart); | 319 style.setJustifyContent(ContentPositionFlexStart); |
320 else | 320 else |
321 style.setJustifyContent(ContentPositionStart); | 321 style.setJustifyContent(ContentPositionStart); |
322 } | 322 } |
323 } | 323 } |
324 } | 324 } |
325 | 325 |
326 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren
tStyle, Element& element) | 326 void StyleAdjuster::adjustStyleForHTMLElement(RenderStyle* style, RenderStyle* p
arentStyle, HTMLElement& element) |
327 { | 327 { |
328 // <div> and <span> are the most common elements on the web, we skip all the
work for them. | 328 // <div> and <span> are the most common elements on the web, we skip all the
work for them. |
329 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) | 329 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) |
330 return; | 330 return; |
331 | 331 |
332 if (isHTMLTableCellElement(element)) { | 332 if (isHTMLTableCellElement(element)) { |
333 // If we have a <td> that specifies a float property, in quirks mode we
just drop the float property. | 333 // If we have a <td> that specifies a float property, in quirks mode we
just drop the float property. |
334 // FIXME: Why is this only <td> and not <th>? | 334 // FIXME: Why is this only <td> and not <th>? |
335 if (element.hasTagName(tdTag) && m_useQuirksModeStyles) { | 335 if (element.hasTagName(tdTag) && m_useQuirksModeStyles) { |
336 style->setDisplay(TABLE_CELL); | 336 style->setDisplay(TABLE_CELL); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B
OX || style->display() == INLINE_BOX)) | 475 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B
OX || style->display() == INLINE_BOX)) |
476 style->setWritingMode(TopToBottomWritingMode); | 476 style->setWritingMode(TopToBottomWritingMode); |
477 | 477 |
478 if (parentStyle->isDisplayFlexibleOrGridBox()) { | 478 if (parentStyle->isDisplayFlexibleOrGridBox()) { |
479 style->setFloating(NoFloat); | 479 style->setFloating(NoFloat); |
480 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa
ting(), !m_useQuirksModeStyles)); | 480 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa
ting(), !m_useQuirksModeStyles)); |
481 } | 481 } |
482 } | 482 } |
483 | 483 |
484 } | 484 } |
OLD | NEW |