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 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 adjustStyleForTagName(style, parentStyle, *e); | 201 adjustStyleForTagName(style, parentStyle, *e); |
202 | 202 |
203 // Per the spec, position 'static' and 'relative' in the top layer compu
te to 'absolute'. | 203 // Per the spec, position 'static' and 'relative' in the top layer compu
te to 'absolute'. |
204 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st
yle->position() == RelativePosition)) | 204 if (isInTopLayer(e, style) && (style->position() == StaticPosition || st
yle->position() == RelativePosition)) |
205 style->setPosition(AbsolutePosition); | 205 style->setPosition(AbsolutePosition); |
206 | 206 |
207 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. | 207 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. |
208 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc
ument().documentElement() == e)) | 208 if (style->hasOutOfFlowPosition() || style->isFloating() || (e && e->doc
ument().documentElement() == e)) |
209 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !m_useQuirksModeStyles)); | 209 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !m_useQuirksModeStyles)); |
210 | 210 |
211 // FIXME: Don't support this mutation for pseudo styles like first-lette
r or first-line, since it's not completely | 211 adjustStyleForDisplay(style, parentStyle); |
212 // clear how that should work. | |
213 if (style->display() == INLINE && style->styleType() == NOPSEUDO && styl
e->writingMode() != parentStyle->writingMode()) | |
214 style->setDisplay(INLINE_BLOCK); | |
215 | |
216 // After performing the display mutation, check table rows. We do not ho
nor position: relative table rows or cells. | |
217 // This has been established for position: relative in CSS2.1 (and cause
d a crash in containingBlock() | |
218 // on some sites). | |
219 if ((style->display() == TABLE_HEADER_GROUP || style->display() == TABLE
_ROW_GROUP | |
220 || style->display() == TABLE_FOOTER_GROUP || style->display() == TAB
LE_ROW) | |
221 && style->position() == RelativePosition) | |
222 style->setPosition(StaticPosition); | |
223 | |
224 // Cannot support position: sticky for table columns and column groups b
ecause current code is only doing | |
225 // background painting through columns / column groups | |
226 if ((style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE
_COLUMN) | |
227 && style->position() == StickyPosition) | |
228 style->setPosition(StaticPosition); | |
229 | |
230 // writing-mode does not apply to table row groups, table column groups,
table rows, and table columns. | |
231 // FIXME: Table cells should be allowed to be perpendicular or flipped w
ith respect to the table, though. | |
232 if (style->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN
_GROUP || style->display() == TABLE_FOOTER_GROUP | |
233 || style->display() == TABLE_HEADER_GROUP || style->display() == TAB
LE_ROW || style->display() == TABLE_ROW_GROUP | |
234 || style->display() == TABLE_CELL) | |
235 style->setWritingMode(parentStyle->writingMode()); | |
236 | |
237 // FIXME: Since we don't support block-flow on flexible boxes yet, disal
low setting | |
238 // of block-flow to anything other than TopToBottomWritingMode. | |
239 // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support. | |
240 if (style->writingMode() != TopToBottomWritingMode && (style->display()
== BOX || style->display() == INLINE_BOX)) | |
241 style->setWritingMode(TopToBottomWritingMode); | |
242 | |
243 if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(par
entStyle->display())) { | |
244 style->setFloating(NoFloat); | |
245 style->setDisplay(equivalentBlockDisplay(style->display(), style->is
Floating(), !m_useQuirksModeStyles)); | |
246 } | |
247 } | 212 } |
248 | 213 |
249 // Make sure our z-index value is only applied if the object is positioned. | 214 // Make sure our z-index value is only applied if the object is positioned. |
250 if (style->position() == StaticPosition && !parentStyleForcesZIndexToCreateS
tackingContext(parentStyle)) | 215 if (style->position() == StaticPosition && !parentStyleForcesZIndexToCreateS
tackingContext(parentStyle)) |
251 style->setHasAutoZIndex(); | 216 style->setHasAutoZIndex(); |
252 | 217 |
253 // Auto z-index becomes 0 for the root element and transparent objects. This
prevents | 218 // Auto z-index becomes 0 for the root element and transparent objects. This
prevents |
254 // cases where objects that should be blended as a single unit end up with a
non-transparent | 219 // cases where objects that should be blended as a single unit end up with a
non-transparent |
255 // object wedged in between them. Auto z-index also becomes 0 for objects th
at specify transforms/masks/reflections. | 220 // object wedged in between them. Auto z-index also becomes 0 for objects th
at specify transforms/masks/reflections. |
256 if (style->hasAutoZIndex() && ((e && e->document().documentElement() == e) | 221 if (style->hasAutoZIndex() && ((e && e->document().documentElement() == e) |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 // since the theme will alter fonts and heights/widths. | 395 // since the theme will alter fonts and heights/widths. |
431 // | 396 // |
432 // Don't apply intrinsic margins to image buttons. The designer knows ho
w big the images are, | 397 // Don't apply intrinsic margins to image buttons. The designer knows ho
w big the images are, |
433 // so we have to treat all image buttons as though they were explicitly
sized. | 398 // so we have to treat all image buttons as though they were explicitly
sized. |
434 if (style->fontSize() >= 11 && (!isHTMLInputElement(element) || !toHTMLI
nputElement(element).isImageButton())) | 399 if (style->fontSize() >= 11 && (!isHTMLInputElement(element) || !toHTMLI
nputElement(element).isImageButton())) |
435 addIntrinsicMargins(style); | 400 addIntrinsicMargins(style); |
436 return; | 401 return; |
437 } | 402 } |
438 } | 403 } |
439 | 404 |
| 405 void StyleAdjuster::adjustStyleForDisplay(RenderStyle* style, RenderStyle* paren
tStyle) |
| 406 { |
| 407 if (style->display() == BLOCK && !style->isFloating()) |
| 408 return; |
| 409 |
| 410 // FIXME: Don't support this mutation for pseudo styles like first-letter or
first-line, since it's not completely |
| 411 // clear how that should work. |
| 412 if (style->display() == INLINE && style->styleType() == NOPSEUDO && style->w
ritingMode() != parentStyle->writingMode()) |
| 413 style->setDisplay(INLINE_BLOCK); |
| 414 |
| 415 // After performing the display mutation, check table rows. We do not honor
position: relative table rows or cells. |
| 416 // This has been established for position: relative in CSS2.1 (and caused a
crash in containingBlock() |
| 417 // on some sites). |
| 418 if ((style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_ROW
_GROUP |
| 419 || style->display() == TABLE_FOOTER_GROUP || style->display() == TABLE_R
OW) |
| 420 && style->position() == RelativePosition) |
| 421 style->setPosition(StaticPosition); |
| 422 |
| 423 // Cannot support position: sticky for table columns and column groups becau
se current code is only doing |
| 424 // background painting through columns / column groups |
| 425 if ((style->display() == TABLE_COLUMN_GROUP || style->display() == TABLE_COL
UMN) |
| 426 && style->position() == StickyPosition) |
| 427 style->setPosition(StaticPosition); |
| 428 |
| 429 // writing-mode does not apply to table row groups, table column groups, tab
le rows, and table columns. |
| 430 // FIXME: Table cells should be allowed to be perpendicular or flipped with
respect to the table, though. |
| 431 if (style->display() == TABLE_COLUMN || style->display() == TABLE_COLUMN_GRO
UP || style->display() == TABLE_FOOTER_GROUP |
| 432 || style->display() == TABLE_HEADER_GROUP || style->display() == TABLE_R
OW || style->display() == TABLE_ROW_GROUP |
| 433 || style->display() == TABLE_CELL) |
| 434 style->setWritingMode(parentStyle->writingMode()); |
| 435 |
| 436 // FIXME: Since we don't support block-flow on flexible boxes yet, disallow
setting |
| 437 // of block-flow to anything other than TopToBottomWritingMode. |
| 438 // https://bugs.webkit.org/show_bug.cgi?id=46418 - Flexible box support. |
| 439 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B
OX || style->display() == INLINE_BOX)) |
| 440 style->setWritingMode(TopToBottomWritingMode); |
| 441 |
| 442 if (isDisplayFlexibleBox(parentStyle->display()) || isDisplayGridBox(parentS
tyle->display())) { |
| 443 style->setFloating(NoFloat); |
| 444 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa
ting(), !m_useQuirksModeStyles)); |
| 445 } |
| 446 } |
| 447 |
440 } | 448 } |
OLD | NEW |