| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 return JUSTIFY; | 58 return JUSTIFY; |
| 59 } | 59 } |
| 60 | 60 |
| 61 void LayoutRubyText::adjustInlineDirectionLineBounds(unsigned expansionOpportuni
tyCount, LayoutUnit& logicalLeft, LayoutUnit& logicalWidth) const | 61 void LayoutRubyText::adjustInlineDirectionLineBounds(unsigned expansionOpportuni
tyCount, LayoutUnit& logicalLeft, LayoutUnit& logicalWidth) const |
| 62 { | 62 { |
| 63 ETextAlign textAlign = style()->textAlign(); | 63 ETextAlign textAlign = style()->textAlign(); |
| 64 // FIXME: This check is bogus since user can set the initial value. | 64 // FIXME: This check is bogus since user can set the initial value. |
| 65 if (textAlign != ComputedStyle::initialTextAlign()) | 65 if (textAlign != ComputedStyle::initialTextAlign()) |
| 66 return LayoutBlockFlow::adjustInlineDirectionLineBounds(expansionOpportu
nityCount, logicalLeft, logicalWidth); | 66 return LayoutBlockFlow::adjustInlineDirectionLineBounds(expansionOpportu
nityCount, logicalLeft, logicalWidth); |
| 67 | 67 |
| 68 int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth(); | 68 int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth().toInt(); |
| 69 if (maxPreferredLogicalWidth >= logicalWidth) | 69 if (maxPreferredLogicalWidth >= logicalWidth) |
| 70 return; | 70 return; |
| 71 | 71 |
| 72 // Inset the ruby text by half the inter-ideograph expansion amount, but no
more than a full-width | 72 // Inset the ruby text by half the inter-ideograph expansion amount, but no
more than a full-width |
| 73 // ruby character on each side. | 73 // ruby character on each side. |
| 74 LayoutUnit inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpp
ortunityCount + 1); | 74 LayoutUnit inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpp
ortunityCount + 1); |
| 75 if (expansionOpportunityCount) | 75 if (expansionOpportunityCount) |
| 76 inset = std::min(LayoutUnit(2 * style()->fontSize()), inset); | 76 inset = std::min(LayoutUnit(2 * style()->fontSize()), inset); |
| 77 | 77 |
| 78 logicalLeft += inset / 2; | 78 logicalLeft += inset / 2; |
| 79 logicalWidth -= inset; | 79 logicalWidth -= inset; |
| 80 } | 80 } |
| 81 | 81 |
| 82 bool LayoutRubyText::avoidsFloats() const | 82 bool LayoutRubyText::avoidsFloats() const |
| 83 { | 83 { |
| 84 return true; | 84 return true; |
| 85 } | 85 } |
| 86 | 86 |
| 87 } // namespace blink | 87 } // namespace blink |
| OLD | NEW |