| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * Copyright (C) 2011 Apple Inc. All rights reserved. | 3 * Copyright (C) 2011 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions are | 6 * modification, are permitted provided that the following conditions are |
| 7 * met: | 7 * met: |
| 8 * | 8 * |
| 9 * * Redistributions of source code must retain the above copyright | 9 * * Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 // The default behavior is to allow ruby text to expand if it is shorter tha
n the ruby base. | 61 // The default behavior is to allow ruby text to expand if it is shorter tha
n the ruby base. |
| 62 return JUSTIFY; | 62 return JUSTIFY; |
| 63 } | 63 } |
| 64 | 64 |
| 65 void RenderRubyText::adjustInlineDirectionLineBounds(int expansionOpportunityCou
nt, float& logicalLeft, float& logicalWidth) const | 65 void RenderRubyText::adjustInlineDirectionLineBounds(int expansionOpportunityCou
nt, float& logicalLeft, float& logicalWidth) const |
| 66 { | 66 { |
| 67 ETextAlign textAlign = style()->textAlign(); | 67 ETextAlign textAlign = style()->textAlign(); |
| 68 // FIXME: This check is bogus since user can set the initial value. | 68 // FIXME: This check is bogus since user can set the initial value. |
| 69 if (textAlign != RenderStyle::initialTextAlign()) | 69 if (textAlign != RenderStyle::initialTextAlign()) |
| 70 return RenderBlock::adjustInlineDirectionLineBounds(expansionOpportunity
Count, logicalLeft, logicalWidth); | 70 return RenderBlockFlow::adjustInlineDirectionLineBounds(expansionOpportu
nityCount, logicalLeft, logicalWidth); |
| 71 | 71 |
| 72 int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth(); | 72 int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth(); |
| 73 if (maxPreferredLogicalWidth >= logicalWidth) | 73 if (maxPreferredLogicalWidth >= logicalWidth) |
| 74 return; | 74 return; |
| 75 | 75 |
| 76 // Inset the ruby text by half the inter-ideograph expansion amount, but no
more than a full-width | 76 // Inset the ruby text by half the inter-ideograph expansion amount, but no
more than a full-width |
| 77 // ruby character on each side. | 77 // ruby character on each side. |
| 78 float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportun
ityCount + 1); | 78 float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportun
ityCount + 1); |
| 79 if (expansionOpportunityCount) | 79 if (expansionOpportunityCount) |
| 80 inset = min<float>(2 * style()->fontSize(), inset); | 80 inset = min<float>(2 * style()->fontSize(), inset); |
| 81 | 81 |
| 82 logicalLeft += inset / 2; | 82 logicalLeft += inset / 2; |
| 83 logicalWidth -= inset; | 83 logicalWidth -= inset; |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool RenderRubyText::avoidsFloats() const | 86 bool RenderRubyText::avoidsFloats() const |
| 87 { | 87 { |
| 88 return true; | 88 return true; |
| 89 } | 89 } |
| 90 | 90 |
| 91 } // namespace WebCore | 91 } // namespace WebCore |
| OLD | NEW |