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

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

Issue 2758683002: Replace ASSERT_NOT_REACHED with NOTREACHED in core/layout/ (Closed)
Patch Set: Rebase with latest Created 3 years, 9 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
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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 LayoutObject* run = beforeChild; 77 LayoutObject* run = beforeChild;
78 while (run && !run->isRubyRun()) 78 while (run && !run->isRubyRun())
79 run = run->parent(); 79 run = run->parent();
80 if (run) { 80 if (run) {
81 if (beforeChild == run) 81 if (beforeChild == run)
82 beforeChild = toLayoutRubyRun(beforeChild)->firstChild(); 82 beforeChild = toLayoutRubyRun(beforeChild)->firstChild();
83 ASSERT(!beforeChild || beforeChild->isDescendantOf(run)); 83 ASSERT(!beforeChild || beforeChild->isDescendantOf(run));
84 run->addChild(child, beforeChild); 84 run->addChild(child, beforeChild);
85 return; 85 return;
86 } 86 }
87 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! 87 NOTREACHED(); // beforeChild should always have a run as parent!
88 // Emergency fallback: fall through and just append. 88 // Emergency fallback: fall through and just append.
89 } 89 }
90 90
91 // If the new child would be appended, try to add the child to the previous 91 // If the new child would be appended, try to add the child to the previous
92 // run if possible, or create a new run otherwise. 92 // run if possible, or create a new run otherwise.
93 // (The LayoutRubyRun object will handle the details) 93 // (The LayoutRubyRun object will handle the details)
94 LayoutRubyRun* lastRun = lastRubyRun(this); 94 LayoutRubyRun* lastRun = lastRubyRun(this);
95 if (!lastRun || lastRun->hasRubyText()) { 95 if (!lastRun || lastRun->hasRubyText()) {
96 lastRun = LayoutRubyRun::staticCreateRubyRun(this); 96 lastRun = LayoutRubyRun::staticCreateRubyRun(this);
97 LayoutInline::addChild(lastRun, beforeChild); 97 LayoutInline::addChild(lastRun, beforeChild);
98 } 98 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 LayoutObject* run = beforeChild; 142 LayoutObject* run = beforeChild;
143 while (run && !run->isRubyRun()) 143 while (run && !run->isRubyRun())
144 run = run->parent(); 144 run = run->parent();
145 if (run) { 145 if (run) {
146 if (beforeChild == run) 146 if (beforeChild == run)
147 beforeChild = toLayoutRubyRun(beforeChild)->firstChild(); 147 beforeChild = toLayoutRubyRun(beforeChild)->firstChild();
148 ASSERT(!beforeChild || beforeChild->isDescendantOf(run)); 148 ASSERT(!beforeChild || beforeChild->isDescendantOf(run));
149 run->addChild(child, beforeChild); 149 run->addChild(child, beforeChild);
150 return; 150 return;
151 } 151 }
152 ASSERT_NOT_REACHED(); // beforeChild should always have a run as parent! 152 NOTREACHED(); // beforeChild should always have a run as parent!
153 // Emergency fallback: fall through and just append. 153 // Emergency fallback: fall through and just append.
154 } 154 }
155 155
156 // If the new child would be appended, try to add the child to the previous 156 // If the new child would be appended, try to add the child to the previous
157 // run if possible, or create a new run otherwise. 157 // run if possible, or create a new run otherwise.
158 // (The LayoutRubyRun object will handle the details) 158 // (The LayoutRubyRun object will handle the details)
159 LayoutRubyRun* lastRun = lastRubyRun(this); 159 LayoutRubyRun* lastRun = lastRubyRun(this);
160 if (!lastRun || lastRun->hasRubyText()) { 160 if (!lastRun || lastRun->hasRubyText()) {
161 lastRun = LayoutRubyRun::staticCreateRubyRun(this); 161 lastRun = LayoutRubyRun::staticCreateRubyRun(this);
162 LayoutBlockFlow::addChild(lastRun, beforeChild); 162 LayoutBlockFlow::addChild(lastRun, beforeChild);
163 } 163 }
164 lastRun->addChild(child); 164 lastRun->addChild(child);
165 } 165 }
166 166
167 void LayoutRubyAsBlock::removeChild(LayoutObject* child) { 167 void LayoutRubyAsBlock::removeChild(LayoutObject* child) {
168 // If the child's parent is *this (must be a ruby run), just use the normal 168 // If the child's parent is *this (must be a ruby run), just use the normal
169 // remove method. 169 // remove method.
170 if (child->parent() == this) { 170 if (child->parent() == this) {
171 ASSERT(child->isRubyRun()); 171 ASSERT(child->isRubyRun());
172 LayoutBlockFlow::removeChild(child); 172 LayoutBlockFlow::removeChild(child);
173 return; 173 return;
174 } 174 }
175 175
176 // Otherwise find the containing run and remove it from there. 176 // Otherwise find the containing run and remove it from there.
177 LayoutRubyRun* run = findRubyRunParent(child); 177 LayoutRubyRun* run = findRubyRunParent(child);
178 ASSERT(run); 178 ASSERT(run);
179 run->removeChild(child); 179 run->removeChild(child);
180 } 180 }
181 181
182 } // namespace blink 182 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutRuby.h ('k') | third_party/WebKit/Source/core/layout/LayoutScrollbar.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698