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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 parent()->removeChild(this); | 192 parent()->removeChild(this); |
193 deleteLineBoxTree(); | 193 deleteLineBoxTree(); |
194 destroy(); | 194 destroy(); |
195 } | 195 } |
196 } | 196 } |
197 } | 197 } |
198 | 198 |
199 RenderRubyBase* RenderRubyRun::createRubyBase() const | 199 RenderRubyBase* RenderRubyRun::createRubyBase() const |
200 { | 200 { |
201 RenderRubyBase* rb = new (renderArena()) RenderRubyBase(document() /* anonym
ous */); | 201 RenderRubyBase* rb = new (renderArena()) RenderRubyBase(document() /* anonym
ous */); |
202 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(style()); | 202 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
style(), BLOCK); |
203 newStyle->setDisplay(BLOCK); | |
204 newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER? | 203 newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER? |
205 rb->setStyle(newStyle.release()); | 204 rb->setStyle(newStyle.release()); |
206 return rb; | 205 return rb; |
207 } | 206 } |
208 | 207 |
209 RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby
) | 208 RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby
) |
210 { | 209 { |
211 ASSERT(parentRuby && parentRuby->isRuby()); | 210 ASSERT(parentRuby && parentRuby->isRuby()); |
212 RenderRubyRun* rr = new (parentRuby->renderArena()) RenderRubyRun(parentRuby
->document() /* anonymous */); | 211 RenderRubyRun* rr = new (parentRuby->renderArena()) RenderRubyRun(parentRuby
->document() /* anonymous */); |
213 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyle(parentRuby-
>style()); | 212 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay(
parentRuby->style(), INLINE_BLOCK); |
214 newStyle->setDisplay(INLINE_BLOCK); | |
215 rr->setStyle(newStyle.release()); | 213 rr->setStyle(newStyle.release()); |
216 return rr; | 214 return rr; |
217 } | 215 } |
218 | 216 |
219 RenderObject* RenderRubyRun::layoutSpecialExcludedChild(bool relayoutChildren) | 217 RenderObject* RenderRubyRun::layoutSpecialExcludedChild(bool relayoutChildren) |
220 { | 218 { |
221 // Don't bother positioning the RenderRubyRun yet. | 219 // Don't bother positioning the RenderRubyRun yet. |
222 RenderRubyText* rt = rubyText(); | 220 RenderRubyText* rt = rubyText(); |
223 if (!rt) | 221 if (!rt) |
224 return 0; | 222 return 0; |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 // We can overhang the ruby by no more than half the width of the neighborin
g text | 308 // We can overhang the ruby by no more than half the width of the neighborin
g text |
311 // and no more than half the font size. | 309 // and no more than half the font size. |
312 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; | 310 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; |
313 if (startOverhang) | 311 if (startOverhang) |
314 startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRende
rer)->minLogicalWidth(), halfWidthOfFontSize)); | 312 startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRende
rer)->minLogicalWidth(), halfWidthOfFontSize)); |
315 if (endOverhang) | 313 if (endOverhang) |
316 endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)->
minLogicalWidth(), halfWidthOfFontSize)); | 314 endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)->
minLogicalWidth(), halfWidthOfFontSize)); |
317 } | 315 } |
318 | 316 |
319 } // namespace WebCore | 317 } // namespace WebCore |
OLD | NEW |