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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 LayoutRubyBase* LayoutRubyRun::rubyBaseSafe() | 81 LayoutRubyBase* LayoutRubyRun::rubyBaseSafe() |
82 { | 82 { |
83 LayoutRubyBase* base = rubyBase(); | 83 LayoutRubyBase* base = rubyBase(); |
84 if (!base) { | 84 if (!base) { |
85 base = createRubyBase(); | 85 base = createRubyBase(); |
86 LayoutBlockFlow::addChild(base); | 86 LayoutBlockFlow::addChild(base); |
87 } | 87 } |
88 return base; | 88 return base; |
89 } | 89 } |
90 | 90 |
91 bool LayoutRubyRun::isChildAllowed(LayoutObject* child, const LayoutStyle&) cons
t | 91 bool LayoutRubyRun::isChildAllowed(LayoutObject* child, const ComputedStyle&) co
nst |
92 { | 92 { |
93 return child->isRubyText() || child->isInline(); | 93 return child->isRubyText() || child->isInline(); |
94 } | 94 } |
95 | 95 |
96 void LayoutRubyRun::addChild(LayoutObject* child, LayoutObject* beforeChild) | 96 void LayoutRubyRun::addChild(LayoutObject* child, LayoutObject* beforeChild) |
97 { | 97 { |
98 ASSERT(child); | 98 ASSERT(child); |
99 | 99 |
100 if (child->isRubyText()) { | 100 if (child->isRubyText()) { |
101 if (!beforeChild) { | 101 if (!beforeChild) { |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 if (!hasRubyText() && !hasRubyBase()) { | 178 if (!hasRubyText() && !hasRubyBase()) { |
179 deleteLineBoxTree(); | 179 deleteLineBoxTree(); |
180 destroy(); | 180 destroy(); |
181 } | 181 } |
182 } | 182 } |
183 } | 183 } |
184 | 184 |
185 LayoutRubyBase* LayoutRubyRun::createRubyBase() const | 185 LayoutRubyBase* LayoutRubyRun::createRubyBase() const |
186 { | 186 { |
187 LayoutRubyBase* layoutObject = LayoutRubyBase::createAnonymous(&document()); | 187 LayoutRubyBase* layoutObject = LayoutRubyBase::createAnonymous(&document()); |
188 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay(
styleRef(), BLOCK); | 188 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(styleRef(), BLOCK); |
189 newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER? | 189 newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER? |
190 layoutObject->setStyle(newStyle.release()); | 190 layoutObject->setStyle(newStyle.release()); |
191 return layoutObject; | 191 return layoutObject; |
192 } | 192 } |
193 | 193 |
194 LayoutRubyRun* LayoutRubyRun::staticCreateRubyRun(const LayoutObject* parentRuby
) | 194 LayoutRubyRun* LayoutRubyRun::staticCreateRubyRun(const LayoutObject* parentRuby
) |
195 { | 195 { |
196 ASSERT(parentRuby && parentRuby->isRuby()); | 196 ASSERT(parentRuby && parentRuby->isRuby()); |
197 LayoutRubyRun* rr = new LayoutRubyRun(); | 197 LayoutRubyRun* rr = new LayoutRubyRun(); |
198 rr->setDocumentForAnonymous(&parentRuby->document()); | 198 rr->setDocumentForAnonymous(&parentRuby->document()); |
199 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay(
parentRuby->styleRef(), INLINE_BLOCK); | 199 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp
lay(parentRuby->styleRef(), INLINE_BLOCK); |
200 rr->setStyle(newStyle.release()); | 200 rr->setStyle(newStyle.release()); |
201 return rr; | 201 return rr; |
202 } | 202 } |
203 | 203 |
204 LayoutObject* LayoutRubyRun::layoutSpecialExcludedChild(bool relayoutChildren, S
ubtreeLayoutScope& layoutScope) | 204 LayoutObject* LayoutRubyRun::layoutSpecialExcludedChild(bool relayoutChildren, S
ubtreeLayoutScope& layoutScope) |
205 { | 205 { |
206 // Don't bother positioning the LayoutRubyRun yet. | 206 // Don't bother positioning the LayoutRubyRun yet. |
207 LayoutRubyText* rt = rubyText(); | 207 LayoutRubyText* rt = rubyText(); |
208 if (!rt) | 208 if (!rt) |
209 return 0; | 209 return 0; |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // We can overhang the ruby by no more than half the width of the neighborin
g text | 296 // We can overhang the ruby by no more than half the width of the neighborin
g text |
297 // and no more than half the font size. | 297 // and no more than half the font size. |
298 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; | 298 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; |
299 if (startOverhang) | 299 if (startOverhang) |
300 startOverhang = std::min<int>(startOverhang, std::min<int>(toLayoutText(
startRenderer)->minLogicalWidth(), halfWidthOfFontSize)); | 300 startOverhang = std::min<int>(startOverhang, std::min<int>(toLayoutText(
startRenderer)->minLogicalWidth(), halfWidthOfFontSize)); |
301 if (endOverhang) | 301 if (endOverhang) |
302 endOverhang = std::min<int>(endOverhang, std::min<int>(toLayoutText(endR
enderer)->minLogicalWidth(), halfWidthOfFontSize)); | 302 endOverhang = std::min<int>(endOverhang, std::min<int>(toLayoutText(endR
enderer)->minLogicalWidth(), halfWidthOfFontSize)); |
303 } | 303 } |
304 | 304 |
305 } // namespace blink | 305 } // namespace blink |
OLD | NEW |