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

Side by Side Diff: Source/core/layout/LayoutRuby.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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/layout/LayoutRuby.h ('k') | Source/core/layout/LayoutRubyBase.h » ('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 16 matching lines...) Expand all
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 32
33 #include "core/layout/LayoutRuby.h" 33 #include "core/layout/LayoutRuby.h"
34 34
35 #include "core/frame/UseCounter.h" 35 #include "core/frame/UseCounter.h"
36 #include "core/layout/LayoutRubyRun.h" 36 #include "core/layout/LayoutRubyRun.h"
37 #include "core/layout/style/LayoutStyle.h" 37 #include "core/layout/style/ComputedStyle.h"
38 #include "wtf/RefPtr.h" 38 #include "wtf/RefPtr.h"
39 39
40 namespace blink { 40 namespace blink {
41 41
42 // === generic helper functions to avoid excessive code duplication === 42 // === generic helper functions to avoid excessive code duplication ===
43 43
44 static inline bool isAnonymousRubyInlineBlock(const LayoutObject* object) 44 static inline bool isAnonymousRubyInlineBlock(const LayoutObject* object)
45 { 45 {
46 ASSERT(!object 46 ASSERT(!object
47 || !object->parent()->isRuby() 47 || !object->parent()->isRuby()
(...skipping 30 matching lines...) Expand all
78 } 78 }
79 79
80 static inline LayoutBlock* rubyAfterBlock(const LayoutObject* ruby) 80 static inline LayoutBlock* rubyAfterBlock(const LayoutObject* ruby)
81 { 81 {
82 LayoutObject* child = ruby->slowLastChild(); 82 LayoutObject* child = ruby->slowLastChild();
83 return isRubyAfterBlock(child) ? toLayoutBlock(child) : 0; 83 return isRubyAfterBlock(child) ? toLayoutBlock(child) : 0;
84 } 84 }
85 85
86 static LayoutBlockFlow* createAnonymousRubyInlineBlock(LayoutObject* ruby) 86 static LayoutBlockFlow* createAnonymousRubyInlineBlock(LayoutObject* ruby)
87 { 87 {
88 RefPtr<LayoutStyle> newStyle = LayoutStyle::createAnonymousStyleWithDisplay( ruby->styleRef(), INLINE_BLOCK); 88 RefPtr<ComputedStyle> newStyle = ComputedStyle::createAnonymousStyleWithDisp lay(ruby->styleRef(), INLINE_BLOCK);
89 LayoutBlockFlow* newBlock = LayoutBlockFlow::createAnonymous(&ruby->document ()); 89 LayoutBlockFlow* newBlock = LayoutBlockFlow::createAnonymous(&ruby->document ());
90 newBlock->setStyle(newStyle.release()); 90 newBlock->setStyle(newStyle.release());
91 return newBlock; 91 return newBlock;
92 } 92 }
93 93
94 static LayoutRubyRun* lastRubyRun(const LayoutObject* ruby) 94 static LayoutRubyRun* lastRubyRun(const LayoutObject* ruby)
95 { 95 {
96 LayoutObject* child = ruby->slowLastChild(); 96 LayoutObject* child = ruby->slowLastChild();
97 if (child && !child->isRubyRun()) 97 if (child && !child->isRubyRun())
98 child = child->previousSibling(); 98 child = child->previousSibling();
(...skipping 13 matching lines...) Expand all
112 LayoutRubyAsInline::LayoutRubyAsInline(Element* element) 112 LayoutRubyAsInline::LayoutRubyAsInline(Element* element)
113 : LayoutInline(element) 113 : LayoutInline(element)
114 { 114 {
115 UseCounter::count(document(), UseCounter::RenderRuby); 115 UseCounter::count(document(), UseCounter::RenderRuby);
116 } 116 }
117 117
118 LayoutRubyAsInline::~LayoutRubyAsInline() 118 LayoutRubyAsInline::~LayoutRubyAsInline()
119 { 119 {
120 } 120 }
121 121
122 void LayoutRubyAsInline::styleDidChange(StyleDifference diff, const LayoutStyle* oldStyle) 122 void LayoutRubyAsInline::styleDidChange(StyleDifference diff, const ComputedStyl e* oldStyle)
123 { 123 {
124 LayoutInline::styleDidChange(diff, oldStyle); 124 LayoutInline::styleDidChange(diff, oldStyle);
125 propagateStyleToAnonymousChildren(); 125 propagateStyleToAnonymousChildren();
126 } 126 }
127 127
128 void LayoutRubyAsInline::addChild(LayoutObject* child, LayoutObject* beforeChild ) 128 void LayoutRubyAsInline::addChild(LayoutObject* child, LayoutObject* beforeChild )
129 { 129 {
130 // Insert :before and :after content before/after the LayoutRubyRun(s) 130 // Insert :before and :after content before/after the LayoutRubyRun(s)
131 if (child->isBeforeContent()) { 131 if (child->isBeforeContent()) {
132 if (child->isInline()) { 132 if (child->isInline()) {
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 LayoutRubyAsBlock::LayoutRubyAsBlock(Element* element) 221 LayoutRubyAsBlock::LayoutRubyAsBlock(Element* element)
222 : LayoutBlockFlow(element) 222 : LayoutBlockFlow(element)
223 { 223 {
224 UseCounter::count(document(), UseCounter::RenderRuby); 224 UseCounter::count(document(), UseCounter::RenderRuby);
225 } 225 }
226 226
227 LayoutRubyAsBlock::~LayoutRubyAsBlock() 227 LayoutRubyAsBlock::~LayoutRubyAsBlock()
228 { 228 {
229 } 229 }
230 230
231 void LayoutRubyAsBlock::styleDidChange(StyleDifference diff, const LayoutStyle* oldStyle) 231 void LayoutRubyAsBlock::styleDidChange(StyleDifference diff, const ComputedStyle * oldStyle)
232 { 232 {
233 LayoutBlockFlow::styleDidChange(diff, oldStyle); 233 LayoutBlockFlow::styleDidChange(diff, oldStyle);
234 propagateStyleToAnonymousChildren(); 234 propagateStyleToAnonymousChildren();
235 } 235 }
236 236
237 void LayoutRubyAsBlock::addChild(LayoutObject* child, LayoutObject* beforeChild) 237 void LayoutRubyAsBlock::addChild(LayoutObject* child, LayoutObject* beforeChild)
238 { 238 {
239 // Insert :before and :after content before/after the LayoutRubyRun(s) 239 // Insert :before and :after content before/after the LayoutRubyRun(s)
240 if (child->isBeforeContent()) { 240 if (child->isBeforeContent()) {
241 if (child->isInline()) { 241 if (child->isInline()) {
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 return; 319 return;
320 } 320 }
321 321
322 // Otherwise find the containing run and remove it from there. 322 // Otherwise find the containing run and remove it from there.
323 LayoutRubyRun* run = findRubyRunParent(child); 323 LayoutRubyRun* run = findRubyRunParent(child);
324 ASSERT(run); 324 ASSERT(run);
325 run->removeChild(child); 325 run->removeChild(child);
326 } 326 }
327 327
328 } // namespace blink 328 } // namespace blink
OLDNEW
« no previous file with comments | « Source/core/layout/LayoutRuby.h ('k') | Source/core/layout/LayoutRubyBase.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698