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 15 matching lines...) Expand all Loading... |
26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 26 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 27 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
30 */ | 30 */ |
31 | 31 |
32 #include "config.h" | 32 #include "config.h" |
33 | 33 |
34 #include "core/rendering/RenderRubyText.h" | 34 #include "core/rendering/RenderRubyText.h" |
35 | 35 |
36 using namespace std; | |
37 | |
38 namespace WebCore { | 36 namespace WebCore { |
39 | 37 |
40 RenderRubyText::RenderRubyText(Element* element) | 38 RenderRubyText::RenderRubyText(Element* element) |
41 : RenderBlockFlow(element) | 39 : RenderBlockFlow(element) |
42 { | 40 { |
43 } | 41 } |
44 | 42 |
45 RenderRubyText::~RenderRubyText() | 43 RenderRubyText::~RenderRubyText() |
46 { | 44 { |
47 } | 45 } |
(...skipping 22 matching lines...) Expand all Loading... |
70 return RenderBlockFlow::adjustInlineDirectionLineBounds(expansionOpportu
nityCount, logicalLeft, logicalWidth); | 68 return RenderBlockFlow::adjustInlineDirectionLineBounds(expansionOpportu
nityCount, logicalLeft, logicalWidth); |
71 | 69 |
72 int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth(); | 70 int maxPreferredLogicalWidth = this->maxPreferredLogicalWidth(); |
73 if (maxPreferredLogicalWidth >= logicalWidth) | 71 if (maxPreferredLogicalWidth >= logicalWidth) |
74 return; | 72 return; |
75 | 73 |
76 // Inset the ruby text by half the inter-ideograph expansion amount, but no
more than a full-width | 74 // Inset the ruby text by half the inter-ideograph expansion amount, but no
more than a full-width |
77 // ruby character on each side. | 75 // ruby character on each side. |
78 float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportun
ityCount + 1); | 76 float inset = (logicalWidth - maxPreferredLogicalWidth) / (expansionOpportun
ityCount + 1); |
79 if (expansionOpportunityCount) | 77 if (expansionOpportunityCount) |
80 inset = min<float>(2 * style()->fontSize(), inset); | 78 inset = std::min<float>(2 * style()->fontSize(), inset); |
81 | 79 |
82 logicalLeft += inset / 2; | 80 logicalLeft += inset / 2; |
83 logicalWidth -= inset; | 81 logicalWidth -= inset; |
84 } | 82 } |
85 | 83 |
86 bool RenderRubyText::avoidsFloats() const | 84 bool RenderRubyText::avoidsFloats() const |
87 { | 85 { |
88 return true; | 86 return true; |
89 } | 87 } |
90 | 88 |
91 } // namespace WebCore | 89 } // namespace WebCore |
OLD | NEW |