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

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

Issue 899163003: Move rendering/RenderObject to layout/LayoutObject. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 10 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/RenderLineBoxList.h ('k') | Source/core/rendering/RenderListBox.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) 2008 Apple Inc. All rights reserved. 2 * Copyright (C) 2008 Apple 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 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 if (inside) { 221 if (inside) {
222 renderer->updateHitTestResult(result, locationInContainer.point( ) - toLayoutSize(accumulatedOffset)); 222 renderer->updateHitTestResult(result, locationInContainer.point( ) - toLayoutSize(accumulatedOffset));
223 return true; 223 return true;
224 } 224 }
225 } 225 }
226 } 226 }
227 227
228 return false; 228 return false;
229 } 229 }
230 230
231 void RenderLineBoxList::dirtyLinesFromChangedChild(RenderObject* container, Rend erObject* child) 231 void RenderLineBoxList::dirtyLinesFromChangedChild(LayoutObject* container, Layo utObject* child)
232 { 232 {
233 if (!container->parent() || (container->isRenderBlock() && (container->selfN eedsLayout() || !container->isRenderBlockFlow()))) 233 if (!container->parent() || (container->isRenderBlock() && (container->selfN eedsLayout() || !container->isRenderBlockFlow())))
234 return; 234 return;
235 235
236 RenderInline* inlineContainer = container->isRenderInline() ? toRenderInline (container) : 0; 236 RenderInline* inlineContainer = container->isRenderInline() ? toRenderInline (container) : 0;
237 InlineBox* firstBox = inlineContainer ? inlineContainer->firstLineBoxIncludi ngCulling() : firstLineBox(); 237 InlineBox* firstBox = inlineContainer ? inlineContainer->firstLineBoxIncludi ngCulling() : firstLineBox();
238 238
239 // If we have no first line box, then just bail early. 239 // If we have no first line box, then just bail early.
240 if (!firstBox) { 240 if (!firstBox) {
241 // For an empty inline, go ahead and propagate the check up to our paren t, unless the parent 241 // For an empty inline, go ahead and propagate the check up to our paren t, unless the parent
242 // is already dirty. 242 // is already dirty.
243 if (container->isInline() && !container->ancestorLineBoxDirty()) { 243 if (container->isInline() && !container->ancestorLineBoxDirty()) {
244 container->parent()->dirtyLinesFromChangedChild(container); 244 container->parent()->dirtyLinesFromChangedChild(container);
245 container->setAncestorLineBoxDirty(); // Mark the container to avoid dirtying the same lines again across multiple destroy() calls of the same subtr ee. 245 container->setAncestorLineBoxDirty(); // Mark the container to avoid dirtying the same lines again across multiple destroy() calls of the same subtr ee.
246 } 246 }
247 return; 247 return;
248 } 248 }
249 249
250 // Try to figure out which line box we belong in. First try to find a previ ous 250 // Try to figure out which line box we belong in. First try to find a previ ous
251 // line box by examining our siblings. If we didn't find a line box, then u se our 251 // line box by examining our siblings. If we didn't find a line box, then u se our
252 // parent's first line box. 252 // parent's first line box.
253 RootInlineBox* box = 0; 253 RootInlineBox* box = 0;
254 RenderObject* curr = 0; 254 LayoutObject* curr = 0;
255 ListHashSet<RenderObject*, 16> potentialLineBreakObjects; 255 ListHashSet<LayoutObject*, 16> potentialLineBreakObjects;
256 potentialLineBreakObjects.add(child); 256 potentialLineBreakObjects.add(child);
257 for (curr = child->previousSibling(); curr; curr = curr->previousSibling()) { 257 for (curr = child->previousSibling(); curr; curr = curr->previousSibling()) {
258 potentialLineBreakObjects.add(curr); 258 potentialLineBreakObjects.add(curr);
259 259
260 if (curr->isFloatingOrOutOfFlowPositioned()) 260 if (curr->isFloatingOrOutOfFlowPositioned())
261 continue; 261 continue;
262 262
263 if (curr->isReplaced()) { 263 if (curr->isReplaced()) {
264 InlineBox* wrapper = toRenderBox(curr)->inlineBoxWrapper(); 264 InlineBox* wrapper = toRenderBox(curr)->inlineBoxWrapper();
265 if (wrapper) 265 if (wrapper)
(...skipping 30 matching lines...) Expand all
296 // If we found a line box, then dirty it. 296 // If we found a line box, then dirty it.
297 if (box) { 297 if (box) {
298 RootInlineBox* adjacentBox; 298 RootInlineBox* adjacentBox;
299 box->markDirty(); 299 box->markDirty();
300 300
301 // dirty the adjacent lines that might be affected 301 // dirty the adjacent lines that might be affected
302 // NOTE: we dirty the previous line because RootInlineBox objects cache 302 // NOTE: we dirty the previous line because RootInlineBox objects cache
303 // the address of the first object on the next line after a BR, which we may be 303 // the address of the first object on the next line after a BR, which we may be
304 // invalidating here. For more info, see how RenderBlock::layoutInlineC hildren 304 // invalidating here. For more info, see how RenderBlock::layoutInlineC hildren
305 // calls setLineBreakInfo with the result of findNextLineBreak. findNex tLineBreak, 305 // calls setLineBreakInfo with the result of findNextLineBreak. findNex tLineBreak,
306 // despite the name, actually returns the first RenderObject after the B R. 306 // despite the name, actually returns the first LayoutObject after the B R.
307 // <rdar://problem/3849947> "Typing after pasting line does not appear u ntil after window resize." 307 // <rdar://problem/3849947> "Typing after pasting line does not appear u ntil after window resize."
308 adjacentBox = box->prevRootBox(); 308 adjacentBox = box->prevRootBox();
309 if (adjacentBox) 309 if (adjacentBox)
310 adjacentBox->markDirty(); 310 adjacentBox->markDirty();
311 adjacentBox = box->nextRootBox(); 311 adjacentBox = box->nextRootBox();
312 // If |child| or any of its immediately previous siblings with culled li neboxes is the object after a line-break in |box| or the linebox after it 312 // If |child| or any of its immediately previous siblings with culled li neboxes is the object after a line-break in |box| or the linebox after it
313 // then that means |child| actually sits on the linebox after |box| (or is its line-break object) and so we need to dirty it as well. 313 // then that means |child| actually sits on the linebox after |box| (or is its line-break object) and so we need to dirty it as well.
314 if (adjacentBox && (potentialLineBreakObjects.contains(box->lineBreakObj ()) || potentialLineBreakObjects.contains(adjacentBox->lineBreakObj()) || child- >isBR() || isIsolated(container->style()->unicodeBidi()))) 314 if (adjacentBox && (potentialLineBreakObjects.contains(box->lineBreakObj ()) || potentialLineBreakObjects.contains(adjacentBox->lineBreakObj()) || child- >isBR() || isIsolated(container->style()->unicodeBidi())))
315 adjacentBox->markDirty(); 315 adjacentBox->markDirty();
316 } 316 }
317 } 317 }
318 318
319 #if ENABLE(ASSERT) 319 #if ENABLE(ASSERT)
320 320
321 void RenderLineBoxList::checkConsistency() const 321 void RenderLineBoxList::checkConsistency() const
322 { 322 {
323 #ifdef CHECK_CONSISTENCY 323 #ifdef CHECK_CONSISTENCY
324 const InlineFlowBox* prev = 0; 324 const InlineFlowBox* prev = 0;
325 for (const InlineFlowBox* child = m_firstLineBox; child != 0; child = child- >nextLineBox()) { 325 for (const InlineFlowBox* child = m_firstLineBox; child != 0; child = child- >nextLineBox()) {
326 ASSERT(child->prevLineBox() == prev); 326 ASSERT(child->prevLineBox() == prev);
327 prev = child; 327 prev = child;
328 } 328 }
329 ASSERT(prev == m_lastLineBox); 329 ASSERT(prev == m_lastLineBox);
330 #endif 330 #endif
331 } 331 }
332 332
333 #endif 333 #endif
334 334
335 } 335 }
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderLineBoxList.h ('k') | Source/core/rendering/RenderListBox.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698