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 23 matching lines...) Expand all Loading... | |
34 #include "sky/engine/core/dom/Element.h" | 34 #include "sky/engine/core/dom/Element.h" |
35 #include "sky/engine/core/dom/NodeRenderStyle.h" | 35 #include "sky/engine/core/dom/NodeRenderStyle.h" |
36 #include "sky/engine/core/rendering/style/RenderStyle.h" | 36 #include "sky/engine/core/rendering/style/RenderStyle.h" |
37 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" | 37 #include "sky/engine/core/rendering/style/RenderStyleConstants.h" |
38 #include "sky/engine/platform/Length.h" | 38 #include "sky/engine/platform/Length.h" |
39 #include "sky/engine/platform/transforms/TransformOperations.h" | 39 #include "sky/engine/platform/transforms/TransformOperations.h" |
40 #include "sky/engine/wtf/Assertions.h" | 40 #include "sky/engine/wtf/Assertions.h" |
41 | 41 |
42 namespace blink { | 42 namespace blink { |
43 | 43 |
44 static bool requiresOnlyBlockChildren(RenderStyle* parentStyle) | |
45 { | |
46 switch (parentStyle->display()) { | |
47 case PARAGRAPH: | |
48 case INLINE: | |
49 return false; | |
50 | |
51 case BLOCK: | |
52 case FLEX: | |
53 case INLINE_FLEX: | |
54 case INLINE_BLOCK: | |
55 return true; | |
56 | |
57 case NONE: | |
58 ASSERT_NOT_REACHED(); | |
59 return false; | |
60 } | |
61 | |
62 ASSERT_NOT_REACHED(); | |
63 return false; | |
64 } | |
65 | |
66 static EDisplay equivalentInlineDisplay(EDisplay display) | 44 static EDisplay equivalentInlineDisplay(EDisplay display) |
67 { | 45 { |
68 switch (display) { | 46 switch (display) { |
69 // TODO(ojan): Do we need an INLINE_PARAGRAPH display? | 47 // TODO(ojan): Do we need an INLINE_PARAGRAPH display? |
70 case PARAGRAPH: | 48 case PARAGRAPH: |
71 return INLINE; | 49 return INLINE; |
72 | 50 |
73 case BLOCK: | 51 case BLOCK: |
74 return INLINE_BLOCK; | 52 return INLINE_BLOCK; |
75 | 53 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
154 | 132 |
155 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element& element) | 133 void StyleAdjuster::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty le, Element& element) |
156 { | 134 { |
157 ASSERT(parentStyle); | 135 ASSERT(parentStyle); |
158 | 136 |
159 if (style->display() != NONE) { | 137 if (style->display() != NONE) { |
160 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display. | 138 // Absolute/fixed positioned elements, floating elements and the documen t element need block-like outside display. |
161 if (style->hasOutOfFlowPosition() || element.document().documentElement( ) == element) | 139 if (style->hasOutOfFlowPosition() || element.document().documentElement( ) == element) |
162 style->setDisplay(equivalentBlockDisplay(style->display())); | 140 style->setDisplay(equivalentBlockDisplay(style->display())); |
163 | 141 |
164 if (requiresOnlyBlockChildren(parentStyle)) | 142 if (RenderStyle::requiresOnlyBlockChildren(parentStyle)) |
esprehn
2015/01/09 00:56:57
parentStyle->requiresOnlyBlockChildren()
| |
165 style->setDisplay(equivalentBlockDisplay(style->display())); | 143 style->setDisplay(equivalentBlockDisplay(style->display())); |
166 else | 144 else |
167 style->setDisplay(equivalentInlineDisplay(style->display())); | 145 style->setDisplay(equivalentInlineDisplay(style->display())); |
168 } | 146 } |
169 | 147 |
170 // Make sure our z-index value is only applied if the object is positioned. | 148 // Make sure our z-index value is only applied if the object is positioned. |
171 if (style->position() == StaticPosition && !parentStyleForcesZIndexToCreateS tackingContext(parentStyle)) | 149 if (style->position() == StaticPosition && !parentStyleForcesZIndexToCreateS tackingContext(parentStyle)) |
172 style->setHasAutoZIndex(); | 150 style->setHasAutoZIndex(); |
173 | 151 |
174 // Auto z-index becomes 0 for the root element and transparent objects. This prevents | 152 // Auto z-index becomes 0 for the root element and transparent objects. This prevents |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
276 // FIXME: Once we implement pagination controls, overflow-x should defau lt to hidden | 254 // FIXME: Once we implement pagination controls, overflow-x should defau lt to hidden |
277 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w e'll let it | 255 // if overflow-y is set to -webkit-paged-x or -webkit-page-y. For now, w e'll let it |
278 // default to auto so we can at least scroll through the pages. | 256 // default to auto so we can at least scroll through the pages. |
279 style->setOverflowX(OAUTO); | 257 style->setOverflowX(OAUTO); |
280 } else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE) { | 258 } else if (style->overflowY() == OVISIBLE && style->overflowX() != OVISIBLE) { |
281 style->setOverflowY(OAUTO); | 259 style->setOverflowY(OAUTO); |
282 } | 260 } |
283 } | 261 } |
284 | 262 |
285 } | 263 } |
OLD | NEW |