| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2003, 2004, 2005, 2006, 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
| 5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
| 6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
| 7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
| 8 * | 8 * |
| 9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
| 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (!m_hasBadParent && m_parent) | 58 if (!m_hasBadParent && m_parent) |
| 59 m_parent->setHasBadChildList(); | 59 m_parent->setHasBadChildList(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 #endif | 62 #endif |
| 63 | 63 |
| 64 void InlineBox::destroy() | 64 void InlineBox::destroy() |
| 65 { | 65 { |
| 66 // We do not need to issue invalidations if the page is being destroyed | 66 // We do not need to issue invalidations if the page is being destroyed |
| 67 // since these objects will never be repainted. | 67 // since these objects will never be repainted. |
| 68 // TODO(crbug.com/619630): Make this fast. | 68 if (!m_lineLayoutItem.documentBeingDestroyed()) { |
| 69 if (!m_lineLayoutItem.documentBeingDestroyed()) | 69 setLineLayoutItemShouldDoFullPaintInvalidationIfNeeded(); |
| 70 m_lineLayoutItem.slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayIte
mClient(*this, PaintInvalidationFull); | 70 |
| 71 #if CHECK_DISPLAY_ITEM_CLIENT_ALIVENESS |
| 72 // This object may have display items in a cached subsequence, but we ar
e |
| 73 // sure that the subsequence will be invalidated because m_lineLayoutIte
m has |
| 74 // been setShouldFullPaintInvalidation(), so deletion of this object is
safe. |
| 75 endShouldKeepAlive(); |
| 76 #endif |
| 77 } |
| 78 |
| 71 delete this; | 79 delete this; |
| 72 } | 80 } |
| 73 | 81 |
| 74 void InlineBox::remove(MarkLineBoxes markLineBoxes) | 82 void InlineBox::remove(MarkLineBoxes markLineBoxes) |
| 75 { | 83 { |
| 76 if (parent()) | 84 if (parent()) |
| 77 parent()->removeChild(this, markLineBoxes); | 85 parent()->removeChild(this, markLineBoxes); |
| 78 } | 86 } |
| 79 | 87 |
| 80 void* InlineBox::operator new(size_t sz) | 88 void* InlineBox::operator new(size_t sz) |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 if (getLineLayoutItem().isBox()) | 215 if (getLineLayoutItem().isBox()) |
| 208 LineLayoutBox(getLineLayoutItem()).setInlineBoxWrapper(this); | 216 LineLayoutBox(getLineLayoutItem()).setInlineBoxWrapper(this); |
| 209 } | 217 } |
| 210 | 218 |
| 211 void InlineBox::move(const LayoutSize& delta) | 219 void InlineBox::move(const LayoutSize& delta) |
| 212 { | 220 { |
| 213 m_topLeft.move(delta); | 221 m_topLeft.move(delta); |
| 214 | 222 |
| 215 if (getLineLayoutItem().isAtomicInlineLevel()) | 223 if (getLineLayoutItem().isAtomicInlineLevel()) |
| 216 LineLayoutBox(getLineLayoutItem()).move(delta.width(), delta.height()); | 224 LineLayoutBox(getLineLayoutItem()).move(delta.width(), delta.height()); |
| 225 |
| 226 setLineLayoutItemShouldDoFullPaintInvalidationIfNeeded(); |
| 217 } | 227 } |
| 218 | 228 |
| 219 void InlineBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset
, LayoutUnit /* lineTop */, LayoutUnit /* lineBottom */) const | 229 void InlineBox::paint(const PaintInfo& paintInfo, const LayoutPoint& paintOffset
, LayoutUnit /* lineTop */, LayoutUnit /* lineBottom */) const |
| 220 { | 230 { |
| 221 BlockPainter::paintInlineBox(*this, paintInfo, paintOffset); | 231 BlockPainter::paintInlineBox(*this, paintInfo, paintOffset); |
| 222 } | 232 } |
| 223 | 233 |
| 224 bool InlineBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locati
onInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, L
ayoutUnit /* lineBottom */) | 234 bool InlineBox::nodeAtPoint(HitTestResult& result, const HitTestLocation& locati
onInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, L
ayoutUnit /* lineBottom */) |
| 225 { | 235 { |
| 226 // Hit test all phases of replaced elements atomically, as though the replac
ed element established its | 236 // Hit test all phases of replaced elements atomically, as though the replac
ed element established its |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 376 root().block().flipForWritingMode(rect); | 386 root().block().flipForWritingMode(rect); |
| 377 } | 387 } |
| 378 | 388 |
| 379 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) const | 389 LayoutPoint InlineBox::flipForWritingMode(const LayoutPoint& point) const |
| 380 { | 390 { |
| 381 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) | 391 if (!UNLIKELY(getLineLayoutItem().hasFlippedBlocksWritingMode())) |
| 382 return point; | 392 return point; |
| 383 return root().block().flipForWritingMode(point); | 393 return root().block().flipForWritingMode(point); |
| 384 } | 394 } |
| 385 | 395 |
| 386 void InlineBox::invalidateDisplayItemClientsRecursively() | 396 void InlineBox::setShouldDoFullPaintInvalidationRecursively() |
| 387 { | 397 { |
| 388 // TODO(crbug.com/619630): Make this fast. | 398 getLineLayoutItem().setShouldDoFullPaintInvalidation(); |
| 389 getLineLayoutItem().slowSetPaintingLayerNeedsRepaintAndInvalidateDisplayItem
Client(*this, PaintInvalidationFull); | |
| 390 if (!isInlineFlowBox()) | 399 if (!isInlineFlowBox()) |
| 391 return; | 400 return; |
| 392 for (InlineBox* child = toInlineFlowBox(this)->firstChild(); child; child =
child->nextOnLine()) | 401 for (InlineBox* child = toInlineFlowBox(this)->firstChild(); child; child =
child->nextOnLine()) |
| 393 child->invalidateDisplayItemClientsRecursively(); | 402 child->setShouldDoFullPaintInvalidationRecursively(); |
| 403 } |
| 404 |
| 405 void InlineBox::setLineLayoutItemShouldDoFullPaintInvalidationIfNeeded() |
| 406 { |
| 407 // For RootInlineBox, we only need to invalidate if it's using the first lin
e style. |
| 408 // otherwise it paints nothing so we don't need to invalidate it. |
| 409 if (!isRootInlineBox() || isFirstLineStyle()) |
| 410 m_lineLayoutItem.setShouldDoFullPaintInvalidation(); |
| 394 } | 411 } |
| 395 | 412 |
| 396 } // namespace blink | 413 } // namespace blink |
| 397 | 414 |
| 398 #ifndef NDEBUG | 415 #ifndef NDEBUG |
| 399 | 416 |
| 400 void showTree(const blink::InlineBox* b) | 417 void showTree(const blink::InlineBox* b) |
| 401 { | 418 { |
| 402 if (b) | 419 if (b) |
| 403 b->showTreeForThis(); | 420 b->showTreeForThis(); |
| 404 else | 421 else |
| 405 fprintf(stderr, "Cannot showTree for (nil) InlineBox.\n"); | 422 fprintf(stderr, "Cannot showTree for (nil) InlineBox.\n"); |
| 406 } | 423 } |
| 407 | 424 |
| 408 void showLineTree(const blink::InlineBox* b) | 425 void showLineTree(const blink::InlineBox* b) |
| 409 { | 426 { |
| 410 if (b) | 427 if (b) |
| 411 b->showLineTreeForThis(); | 428 b->showLineTreeForThis(); |
| 412 else | 429 else |
| 413 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); | 430 fprintf(stderr, "Cannot showLineTree for (nil) InlineBox.\n"); |
| 414 } | 431 } |
| 415 | 432 |
| 416 #endif | 433 #endif |
| OLD | NEW |