Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: Source/core/rendering/RenderRubyRun.cpp

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/core/rendering/RenderRuby.cpp ('k') | Source/core/rendering/RenderScrollbar.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 if (isEmpty()) { 190 if (isEmpty()) {
191 parent()->removeChild(this); 191 parent()->removeChild(this);
192 deleteLineBoxTree(); 192 deleteLineBoxTree();
193 destroy(); 193 destroy();
194 } 194 }
195 } 195 }
196 } 196 }
197 197
198 RenderRubyBase* RenderRubyRun::createRubyBase() const 198 RenderRubyBase* RenderRubyRun::createRubyBase() const
199 { 199 {
200 RenderRubyBase* renderer = RenderRubyBase::createAnonymous(document()); 200 RenderRubyBase* renderer = RenderRubyBase::createAnonymous(&document());
201 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( style(), BLOCK); 201 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( style(), BLOCK);
202 newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER? 202 newStyle->setTextAlign(CENTER); // FIXME: use WEBKIT_CENTER?
203 renderer->setStyle(newStyle.release()); 203 renderer->setStyle(newStyle.release());
204 return renderer; 204 return renderer;
205 } 205 }
206 206
207 RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby ) 207 RenderRubyRun* RenderRubyRun::staticCreateRubyRun(const RenderObject* parentRuby )
208 { 208 {
209 ASSERT(parentRuby && parentRuby->isRuby()); 209 ASSERT(parentRuby && parentRuby->isRuby());
210 RenderRubyRun* rr = new RenderRubyRun(); 210 RenderRubyRun* rr = new RenderRubyRun();
211 rr->setDocumentForAnonymous(parentRuby->document()); 211 rr->setDocumentForAnonymous(&parentRuby->document());
212 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parentRuby->style(), INLINE_BLOCK); 212 RefPtr<RenderStyle> newStyle = RenderStyle::createAnonymousStyleWithDisplay( parentRuby->style(), INLINE_BLOCK);
213 rr->setStyle(newStyle.release()); 213 rr->setStyle(newStyle.release());
214 return rr; 214 return rr;
215 } 215 }
216 216
217 RenderObject* RenderRubyRun::layoutSpecialExcludedChild(bool relayoutChildren, S ubtreeLayoutScope& layoutScope) 217 RenderObject* RenderRubyRun::layoutSpecialExcludedChild(bool relayoutChildren, S ubtreeLayoutScope& layoutScope)
218 { 218 {
219 // Don't bother positioning the RenderRubyRun yet. 219 // Don't bother positioning the RenderRubyRun yet.
220 RenderRubyText* rt = rubyText(); 220 RenderRubyText* rt = rubyText();
221 if (!rt) 221 if (!rt)
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // We can overhang the ruby by no more than half the width of the neighborin g text 309 // We can overhang the ruby by no more than half the width of the neighborin g text
310 // and no more than half the font size. 310 // and no more than half the font size.
311 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2; 311 int halfWidthOfFontSize = rubyText->style(firstLine)->fontSize() / 2;
312 if (startOverhang) 312 if (startOverhang)
313 startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRende rer)->minLogicalWidth(), halfWidthOfFontSize)); 313 startOverhang = min<int>(startOverhang, min<int>(toRenderText(startRende rer)->minLogicalWidth(), halfWidthOfFontSize));
314 if (endOverhang) 314 if (endOverhang)
315 endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)-> minLogicalWidth(), halfWidthOfFontSize)); 315 endOverhang = min<int>(endOverhang, min<int>(toRenderText(endRenderer)-> minLogicalWidth(), halfWidthOfFontSize));
316 } 316 }
317 317
318 } // namespace WebCore 318 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderRuby.cpp ('k') | Source/core/rendering/RenderScrollbar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698