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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 else if (parentStyle.justifyItemsPosition() != ItemPositionAuto) | 166 else if (parentStyle.justifyItemsPosition() != ItemPositionAuto) |
167 style.setJustifySelf(parentStyle.justifyItems()); | 167 style.setJustifySelf(parentStyle.justifyItems()); |
168 } | 168 } |
169 | 169 |
170 // The 'auto' keyword computes the computed value of align-items on the pare
nt | 170 // The 'auto' keyword computes the computed value of align-items on the pare
nt |
171 // or 'normal' if the box has no parent. | 171 // or 'normal' if the box has no parent. |
172 if (style.alignSelfPosition() == ItemPositionAuto && parentStyle.alignItemsP
osition() != ItemPositionNormal) | 172 if (style.alignSelfPosition() == ItemPositionAuto && parentStyle.alignItemsP
osition() != ItemPositionNormal) |
173 style.setAlignSelf(parentStyle.alignItems()); | 173 style.setAlignSelf(parentStyle.alignItems()); |
174 } | 174 } |
175 | 175 |
176 static void adjustStyleForHTMLElement(ComputedStyle& style, const ComputedStyle&
parentStyle, HTMLElement& element) | 176 static void adjustStyleForHTMLElement(ComputedStyle& style, HTMLElement& element
) |
177 { | 177 { |
178 // <div> and <span> are the most common elements on the web, we skip all the
work for them. | 178 // <div> and <span> are the most common elements on the web, we skip all the
work for them. |
179 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) | 179 if (isHTMLDivElement(element) || isHTMLSpanElement(element)) |
180 return; | 180 return; |
181 | 181 |
182 if (isHTMLTableCellElement(element)) { | 182 if (isHTMLTableCellElement(element)) { |
183 if (style.whiteSpace() == KHTML_NOWRAP) { | 183 if (style.whiteSpace() == KHTML_NOWRAP) { |
184 // Figure out if we are really nowrapping or if we should just | 184 // Figure out if we are really nowrapping or if we should just |
185 // use normal instead. If the width of the cell is fixed, then | 185 // use normal instead. If the width of the cell is fixed, then |
186 // we don't actually use NOWRAP. | 186 // we don't actually use NOWRAP. |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert
ical); | 326 UseCounter::count(document, UseCounter::FlexboxPercentagePaddingVert
ical); |
327 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent(
)) | 327 if (style.marginBefore().hasPercent() || style.marginAfter().hasPercent(
)) |
328 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti
cal); | 328 UseCounter::count(document, UseCounter::FlexboxPercentageMarginVerti
cal); |
329 } | 329 } |
330 } | 330 } |
331 | 331 |
332 void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl
e& parentStyle, Element* element) | 332 void StyleAdjuster::adjustComputedStyle(ComputedStyle& style, const ComputedStyl
e& parentStyle, Element* element) |
333 { | 333 { |
334 if (style.display() != NONE) { | 334 if (style.display() != NONE) { |
335 if (element && element->isHTMLElement()) | 335 if (element && element->isHTMLElement()) |
336 adjustStyleForHTMLElement(style, parentStyle, toHTMLElement(*element
)); | 336 adjustStyleForHTMLElement(style, toHTMLElement(*element)); |
337 | 337 |
338 // Per the spec, position 'static' and 'relative' in the top layer compu
te to 'absolute'. | 338 // Per the spec, position 'static' and 'relative' in the top layer compu
te to 'absolute'. |
339 if (isInTopLayer(element, style) && (style.position() == StaticPosition
|| style.position() == RelativePosition)) | 339 if (isInTopLayer(element, style) && (style.position() == StaticPosition
|| style.position() == RelativePosition)) |
340 style.setPosition(AbsolutePosition); | 340 style.setPosition(AbsolutePosition); |
341 | 341 |
342 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. | 342 // Absolute/fixed positioned elements, floating elements and the documen
t element need block-like outside display. |
343 if (style.hasOutOfFlowPosition() || style.isFloating() || (element && el
ement->document().documentElement() == element)) | 343 if (style.hasOutOfFlowPosition() || style.isFloating() || (element && el
ement->document().documentElement() == element)) |
344 style.setDisplay(equivalentBlockDisplay(style.display())); | 344 style.setDisplay(equivalentBlockDisplay(style.display())); |
345 | 345 |
346 // We don't adjust the first letter style earlier because we may change
the display setting in | 346 // We don't adjust the first letter style earlier because we may change
the display setting in |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 style.setDisplay(BLOCK); | 404 style.setDisplay(BLOCK); |
405 | 405 |
406 // Columns don't apply to svg text elements. | 406 // Columns don't apply to svg text elements. |
407 if (isSVGTextElement(*element)) | 407 if (isSVGTextElement(*element)) |
408 style.clearMultiCol(); | 408 style.clearMultiCol(); |
409 } | 409 } |
410 adjustStyleForAlignment(style, parentStyle); | 410 adjustStyleForAlignment(style, parentStyle); |
411 } | 411 } |
412 | 412 |
413 } // namespace blink | 413 } // namespace blink |
OLD | NEW |