OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2011 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
12 * Library General Public License for more details. | 12 * Library General Public License for more details. |
13 * | 13 * |
14 * You should have received a copy of the GNU Library General Public License | 14 * You should have received a copy of the GNU Library General Public License |
15 * along with this library; see the file COPYING.LIB. If not, write to | 15 * along with this library; see the file COPYING.LIB. If not, write to |
16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 16 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
17 * Boston, MA 02110-1301, USA. | 17 * Boston, MA 02110-1301, USA. |
18 * | 18 * |
19 */ | 19 */ |
20 | 20 |
21 #ifndef LayoutTextCombine_h | 21 #ifndef LayoutTextCombine_h |
22 #define LayoutTextCombine_h | 22 #define LayoutTextCombine_h |
23 | 23 |
24 #include "core/layout/LayoutText.h" | 24 #include "core/layout/LayoutText.h" |
25 #include "platform/fonts/Font.h" | 25 #include "platform/fonts/Font.h" |
26 | 26 |
27 namespace blink { | 27 namespace blink { |
28 | 28 |
29 // LayoutTextCombine uses different coordinate systems for layout and inlineText
Box, | 29 // LayoutTextCombine uses different coordinate systems for layout and |
30 // because it is treated as 1em-box character in vertical flow for the layout, | 30 // inlineTextBox, because it is treated as 1em-box character in vertical flow |
31 // while its inline box is in horizontal flow. | 31 // for the layout, while its inline box is in horizontal flow. |
32 class LayoutTextCombine final : public LayoutText { | 32 class LayoutTextCombine final : public LayoutText { |
33 public: | 33 public: |
34 LayoutTextCombine(Node*, PassRefPtr<StringImpl>); | 34 LayoutTextCombine(Node*, PassRefPtr<StringImpl>); |
35 | 35 |
36 void updateFont(); | 36 void updateFont(); |
37 bool isCombined() const { return m_isCombined; } | 37 bool isCombined() const { return m_isCombined; } |
38 float combinedTextWidth(const Font& font) const { | 38 float combinedTextWidth(const Font& font) const { |
39 return font.getFontDescription().computedSize(); | 39 return font.getFontDescription().computedSize(); |
40 } | 40 } |
41 const Font& originalFont() const { return parent()->style()->font(); } | 41 const Font& originalFont() const { return parent()->style()->font(); } |
(...skipping 26 matching lines...) Expand all Loading... |
68 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTextCombine, isCombineText()); | 68 DEFINE_LAYOUT_OBJECT_TYPE_CASTS(LayoutTextCombine, isCombineText()); |
69 | 69 |
70 inline LayoutUnit LayoutTextCombine::inlineWidthForLayout() const { | 70 inline LayoutUnit LayoutTextCombine::inlineWidthForLayout() const { |
71 ASSERT(!m_needsFontUpdate); | 71 ASSERT(!m_needsFontUpdate); |
72 return LayoutUnit::fromFloatCeil(m_combinedTextWidth); | 72 return LayoutUnit::fromFloatCeil(m_combinedTextWidth); |
73 } | 73 } |
74 | 74 |
75 } // namespace blink | 75 } // namespace blink |
76 | 76 |
77 #endif // LayoutTextCombine_h | 77 #endif // LayoutTextCombine_h |
OLD | NEW |