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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 } | 67 } |
68 | 68 |
69 bool RenderRubyRun::isEmpty() const | 69 bool RenderRubyRun::isEmpty() const |
70 { | 70 { |
71 return !hasRubyText() && !hasRubyBase(); | 71 return !hasRubyText() && !hasRubyBase(); |
72 } | 72 } |
73 | 73 |
74 RenderRubyText* RenderRubyRun::rubyText() const | 74 RenderRubyText* RenderRubyRun::rubyText() const |
75 { | 75 { |
76 RenderObject* child = firstChild(); | 76 RenderObject* child = firstChild(); |
| 77 // If in future it becomes necessary to support floating or positioned ruby
text, |
| 78 // layout will have to be changed to handle them properly. |
| 79 ASSERT(!child || !child->isRubyText() || !child->isFloatingOrPositioned()); |
77 return child && child->isRubyText() ? static_cast<RenderRubyText*>(child) :
0; | 80 return child && child->isRubyText() ? static_cast<RenderRubyText*>(child) :
0; |
78 } | 81 } |
79 | 82 |
80 RenderRubyBase* RenderRubyRun::rubyBase() const | 83 RenderRubyBase* RenderRubyRun::rubyBase() const |
81 { | 84 { |
82 RenderObject* child = lastChild(); | 85 RenderObject* child = lastChild(); |
83 return child && child->isRubyBase() ? static_cast<RenderRubyBase*>(child) :
0; | 86 return child && child->isRubyBase() ? static_cast<RenderRubyBase*>(child) :
0; |
84 } | 87 } |
85 | 88 |
86 RenderRubyBase* RenderRubyRun::rubyBaseSafe() | 89 RenderRubyBase* RenderRubyRun::rubyBaseSafe() |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 // We can overhang the ruby by no more than half the width of the neighborin
g text | 310 // We can overhang the ruby by no more than half the width of the neighborin
g text |
308 // and no more than half the font size. | 311 // and no more than half the font size. |
309 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; | 312 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; |
310 if (startOverhang) | 313 if (startOverhang) |
311 startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRende
rer)->minLogicalWidth(), halfWidthOfFontSize)); | 314 startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRende
rer)->minLogicalWidth(), halfWidthOfFontSize)); |
312 if (endOverhang) | 315 if (endOverhang) |
313 endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)->
minLogicalWidth(), halfWidthOfFontSize)); | 316 endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)->
minLogicalWidth(), halfWidthOfFontSize)); |
314 } | 317 } |
315 | 318 |
316 } // namespace WebCore | 319 } // namespace WebCore |
OLD | NEW |