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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 if ((isSVGForeignObjectElement(*e) || isSVGTextElement(*e)) && style->is
DisplayInlineType()) | 247 if ((isSVGForeignObjectElement(*e) || isSVGTextElement(*e)) && style->is
DisplayInlineType()) |
248 style->setDisplay(BLOCK); | 248 style->setDisplay(BLOCK); |
249 } | 249 } |
250 | 250 |
251 if (e && e->renderStyle() && e->renderStyle()->textAutosizingMultiplier() !=
1) { | 251 if (e && e->renderStyle() && e->renderStyle()->textAutosizingMultiplier() !=
1) { |
252 // Preserve the text autosizing multiplier on style recalc. | 252 // Preserve the text autosizing multiplier on style recalc. |
253 // (The autosizer will update it during layout if it needs to be changed
.) | 253 // (The autosizer will update it during layout if it needs to be changed
.) |
254 style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMulti
plier()); | 254 style->setTextAutosizingMultiplier(e->renderStyle()->textAutosizingMulti
plier()); |
255 style->setUnique(); | 255 style->setUnique(); |
256 } | 256 } |
| 257 |
| 258 adjustStyleForAlignment(*style, *parentStyle); |
| 259 } |
| 260 |
| 261 void StyleAdjuster::adjustStyleForAlignment(RenderStyle& style, const RenderStyl
e& parentStyle) |
| 262 { |
| 263 bool isFlexOrGrid = style.isDisplayFlexibleOrGridBox(); |
| 264 bool absolutePositioned = style.position() == AbsolutePosition; |
| 265 |
| 266 // If the inherited value of justify-items includes the legacy keyword, 'aut
o' |
| 267 // computes to the the inherited value. |
| 268 // Otherwise, auto computes to: |
| 269 // - 'stretch' for flex containers and grid containers. |
| 270 // - 'start' for everything else. |
| 271 if (style.justifyItems() == ItemPositionAuto) { |
| 272 if (parentStyle.justifyItemsPositionType() == LegacyPosition) { |
| 273 style.setJustifyItems(parentStyle.justifyItems()); |
| 274 style.setJustifyItemsPositionType(parentStyle.justifyItemsPositionTy
pe()); |
| 275 } else if (isFlexOrGrid) { |
| 276 style.setJustifyItems(ItemPositionStretch); |
| 277 } |
| 278 } |
| 279 |
| 280 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element
s, |
| 281 // and to the computed value of justify-items on the parent (minus |
| 282 // any legacy keywords) on all other boxes. |
| 283 if (style.justifySelf() == ItemPositionAuto) { |
| 284 if (absolutePositioned) { |
| 285 style.setJustifySelf(ItemPositionStretch); |
| 286 } else { |
| 287 style.setJustifySelf(parentStyle.justifyItems()); |
| 288 style.setJustifySelfOverflowAlignment(parentStyle.justifyItemsOverfl
owAlignment()); |
| 289 } |
| 290 } |
| 291 |
| 292 // The 'auto' keyword computes to: |
| 293 // - 'stretch' for flex containers and grid containers, |
| 294 // - 'start' for everything else. |
| 295 if (style.alignItems() == ItemPositionAuto) { |
| 296 if (isFlexOrGrid) |
| 297 style.setAlignItems(ItemPositionStretch); |
| 298 } |
| 299 |
| 300 // The 'auto' keyword computes to 'stretch' on absolutely-positioned element
s, |
| 301 // and to the computed value of align-items on the parent (minus |
| 302 // any 'legacy' keywords) on all other boxes. |
| 303 if (style.alignSelf() == ItemPositionAuto) { |
| 304 if (absolutePositioned) { |
| 305 style.setAlignSelf(ItemPositionStretch); |
| 306 } else { |
| 307 style.setAlignSelf(parentStyle.alignItems()); |
| 308 style.setAlignSelfOverflowAlignment(parentStyle.alignItemsOverflowAl
ignment()); |
| 309 } |
| 310 } |
257 } | 311 } |
258 | 312 |
259 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren
tStyle, Element& element) | 313 void StyleAdjuster::adjustStyleForTagName(RenderStyle* style, RenderStyle* paren
tStyle, Element& element) |
260 { | 314 { |
261 // <div> and <span> are the most common elements on the web, we skip all the
work for them. | 315 // <div> and <span> are the most common elements on the web, we skip all the
work for them. |
262 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) | 316 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) |
263 return; | 317 return; |
264 | 318 |
265 if (isHTMLTableCellElement(element)) { | 319 if (isHTMLTableCellElement(element)) { |
266 // If we have a <td> that specifies a float property, in quirks mode we
just drop the float property. | 320 // If we have a <td> that specifies a float property, in quirks mode we
just drop the float property. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
398 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B
OX || style->display() == INLINE_BOX)) | 452 if (style->writingMode() != TopToBottomWritingMode && (style->display() == B
OX || style->display() == INLINE_BOX)) |
399 style->setWritingMode(TopToBottomWritingMode); | 453 style->setWritingMode(TopToBottomWritingMode); |
400 | 454 |
401 if (parentStyle->isDisplayFlexibleOrGridBox()) { | 455 if (parentStyle->isDisplayFlexibleOrGridBox()) { |
402 style->setFloating(NoFloat); | 456 style->setFloating(NoFloat); |
403 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa
ting(), !m_useQuirksModeStyles)); | 457 style->setDisplay(equivalentBlockDisplay(style->display(), style->isFloa
ting(), !m_useQuirksModeStyles)); |
404 } | 458 } |
405 } | 459 } |
406 | 460 |
407 } | 461 } |
OLD | NEW |