OLD | NEW |
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 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 if (!container->parent() || (container->isRenderBlock() && (container->selfN
eedsLayout() || !container->isBlockFlow()))) | 314 if (!container->parent() || (container->isRenderBlock() && (container->selfN
eedsLayout() || !container->isBlockFlow()))) |
315 return; | 315 return; |
316 | 316 |
317 RenderInline* inlineContainer = container->isRenderInline() ? toRenderInline
(container) : 0; | 317 RenderInline* inlineContainer = container->isRenderInline() ? toRenderInline
(container) : 0; |
318 InlineBox* firstBox = inlineContainer ? inlineContainer->firstLineBoxIncludi
ngCulling() : firstLineBox(); | 318 InlineBox* firstBox = inlineContainer ? inlineContainer->firstLineBoxIncludi
ngCulling() : firstLineBox(); |
319 | 319 |
320 // If we have no first line box, then just bail early. | 320 // If we have no first line box, then just bail early. |
321 if (!firstBox) { | 321 if (!firstBox) { |
322 // For an empty inline, go ahead and propagate the check up to our paren
t, unless the parent | 322 // For an empty inline, go ahead and propagate the check up to our paren
t, unless the parent |
323 // is already dirty. | 323 // is already dirty. |
324 if (container->isInline() && !container->parent()->selfNeedsLayout()) { | 324 if (container->isInline() && !container->parent()->ancestorLineBoxDirty(
)) { |
325 container->parent()->dirtyLinesFromChangedChild(container); | 325 container->parent()->dirtyLinesFromChangedChild(container); |
326 container->setNeedsLayout(true); // Mark the container as needing la
yout to avoid dirtying the same lines again across multiple destroy() calls of t
he same subtree. | 326 container->setAncestorLineBoxDirty(); // Mark the container to avoid
dirtying the same lines again across multiple destroy() calls of the same subtr
ee. |
327 } | 327 } |
328 return; | 328 return; |
329 } | 329 } |
330 | 330 |
331 // Try to figure out which line box we belong in. First try to find a previ
ous | 331 // Try to figure out which line box we belong in. First try to find a previ
ous |
332 // line box by examining our siblings. If we didn't find a line box, then u
se our | 332 // line box by examining our siblings. If we didn't find a line box, then u
se our |
333 // parent's first line box. | 333 // parent's first line box. |
334 RootInlineBox* box = 0; | 334 RootInlineBox* box = 0; |
335 RenderObject* curr = 0; | 335 RenderObject* curr = 0; |
336 for (curr = child->previousSibling(); curr; curr = curr->previousSibling())
{ | 336 for (curr = child->previousSibling(); curr; curr = curr->previousSibling())
{ |
(...skipping 17 matching lines...) Expand all Loading... |
354 if (box) | 354 if (box) |
355 break; | 355 break; |
356 } | 356 } |
357 if (!box) { | 357 if (!box) { |
358 if (inlineContainer && !inlineContainer->alwaysCreateLineBoxes()) { | 358 if (inlineContainer && !inlineContainer->alwaysCreateLineBoxes()) { |
359 // https://bugs.webkit.org/show_bug.cgi?id=60778 | 359 // https://bugs.webkit.org/show_bug.cgi?id=60778 |
360 // We may have just removed a <br> with no line box that was our fir
st child. In this case | 360 // We may have just removed a <br> with no line box that was our fir
st child. In this case |
361 // we won't find a previous sibling, but firstBox can be pointing to
a following sibling. | 361 // we won't find a previous sibling, but firstBox can be pointing to
a following sibling. |
362 // This isn't good enough, since we won't locate the root line box t
hat encloses the removed | 362 // This isn't good enough, since we won't locate the root line box t
hat encloses the removed |
363 // <br>. We have to just over-invalidate a bit and go up to our pare
nt. | 363 // <br>. We have to just over-invalidate a bit and go up to our pare
nt. |
364 if (!inlineContainer->parent()->selfNeedsLayout()) { | 364 if (!inlineContainer->parent()->ancestorLineBoxDirty()) { |
365 inlineContainer->parent()->dirtyLinesFromChangedChild(inlineCont
ainer); | 365 inlineContainer->parent()->dirtyLinesFromChangedChild(inlineCont
ainer); |
366 inlineContainer->setNeedsLayout(true); // Mark the container as
needing layout to avoid dirtying the same lines again across multiple destroy()
calls of the same subtree. | 366 inlineContainer->setAncestorLineBoxDirty(); // Mark the containe
r to avoid dirtying the same lines again across multiple destroy() calls of the
same subtree. |
367 } | 367 } |
368 return; | 368 return; |
369 } | 369 } |
370 box = firstBox->root(); | 370 box = firstBox->root(); |
371 } | 371 } |
372 | 372 |
373 // If we found a line box, then dirty it. | 373 // If we found a line box, then dirty it. |
374 if (box) { | 374 if (box) { |
375 RootInlineBox* adjacentBox; | 375 RootInlineBox* adjacentBox; |
376 box->markDirty(); | 376 box->markDirty(); |
(...skipping 24 matching lines...) Expand all Loading... |
401 ASSERT(child->prevLineBox() == prev); | 401 ASSERT(child->prevLineBox() == prev); |
402 prev = child; | 402 prev = child; |
403 } | 403 } |
404 ASSERT(prev == m_lastLineBox); | 404 ASSERT(prev == m_lastLineBox); |
405 #endif | 405 #endif |
406 } | 406 } |
407 | 407 |
408 #endif | 408 #endif |
409 | 409 |
410 } | 410 } |
OLD | NEW |