OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 bool RenderRubyBase::isChildAllowed(RenderObject* child, RenderStyle*) const | 51 bool RenderRubyBase::isChildAllowed(RenderObject* child, RenderStyle*) const |
52 { | 52 { |
53 return child->isInline(); | 53 return child->isInline(); |
54 } | 54 } |
55 | 55 |
56 void RenderRubyBase::moveChildren(RenderRubyBase* toBase, RenderObject* beforeCh
ild) | 56 void RenderRubyBase::moveChildren(RenderRubyBase* toBase, RenderObject* beforeCh
ild) |
57 { | 57 { |
58 // This function removes all children that are before (!) beforeChild | 58 // This function removes all children that are before (!) beforeChild |
59 // and appends them to toBase. | 59 // and appends them to toBase. |
60 ASSERT_ARG(toBase, toBase); | 60 ASSERT_ARG(toBase, toBase); |
61 | 61 |
62 // First make sure that beforeChild (if set) is indeed a direct child of thi
s. | 62 if (beforeChild && beforeChild->parent() != this) |
63 // Inline children might be wrapped in an anonymous block if there's a conti
nuation. | 63 beforeChild = splitAnonymousBlocksAroundChild(beforeChild); |
64 // Theoretically, in ruby bases, this can happen with only the first such a
child, | |
65 // so it should be OK to just climb the tree. | |
66 while (beforeChild && beforeChild->parent() != this) | |
67 beforeChild = beforeChild->parent(); | |
68 | 64 |
69 if (childrenInline()) | 65 if (childrenInline()) |
70 moveInlineChildren(toBase, beforeChild); | 66 moveInlineChildren(toBase, beforeChild); |
71 else | 67 else |
72 moveBlockChildren(toBase, beforeChild); | 68 moveBlockChildren(toBase, beforeChild); |
73 | 69 |
74 setNeedsLayoutAndPrefWidthsRecalc(); | 70 setNeedsLayoutAndPrefWidthsRecalc(); |
75 toBase->setNeedsLayoutAndPrefWidthsRecalc(); | 71 toBase->setNeedsLayoutAndPrefWidthsRecalc(); |
76 } | 72 } |
77 | 73 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 return; | 144 return; |
149 | 145 |
150 // Inset the ruby base by half the inter-ideograph expansion amount. | 146 // Inset the ruby base by half the inter-ideograph expansion amount. |
151 float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportun
ityCount + 1); | 147 float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportun
ityCount + 1); |
152 | 148 |
153 logicalLeft += inset / 2; | 149 logicalLeft += inset / 2; |
154 logicalWidth -= inset; | 150 logicalWidth -= inset; |
155 } | 151 } |
156 | 152 |
157 } // namespace WebCore | 153 } // namespace WebCore |
OLD | NEW |