| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) | 3 * Copyright (C) 2000 Dirk Mueller (mueller@kde.org) |
| 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. | 4 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. |
| 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. | 5 * Copyright (C) Research In Motion Limited 2011-2012. All rights reserved. |
| 6 * | 6 * |
| 7 * This library is free software; you can redistribute it and/or | 7 * This library is free software; you can redistribute it and/or |
| 8 * modify it under the terms of the GNU Library General Public | 8 * modify it under the terms of the GNU Library General Public |
| 9 * License as published by the Free Software Foundation; either | 9 * License as published by the Free Software Foundation; either |
| 10 * version 2 of the License, or (at your option) any later version. | 10 * version 2 of the License, or (at your option) any later version. |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 } | 472 } |
| 473 | 473 |
| 474 void RenderReplaced::setSelectionState(SelectionState state) | 474 void RenderReplaced::setSelectionState(SelectionState state) |
| 475 { | 475 { |
| 476 // The selection state for our containing block hierarchy is updated by the
base class call. | 476 // The selection state for our containing block hierarchy is updated by the
base class call. |
| 477 RenderBox::setSelectionState(state); | 477 RenderBox::setSelectionState(state); |
| 478 | 478 |
| 479 if (!inlineBoxWrapper()) | 479 if (!inlineBoxWrapper()) |
| 480 return; | 480 return; |
| 481 | 481 |
| 482 // We only include the space below the baseline in our layer's cached paint
invalidation rect if the | |
| 483 // image is selected. Since the selection state has changed update the rect. | |
| 484 if (hasLayer()) | |
| 485 setPreviousPaintInvalidationRect(boundsRectForPaintInvalidation(containe
rForPaintInvalidation())); | |
| 486 | |
| 487 if (canUpdateSelectionOnRootLineBoxes()) | 482 if (canUpdateSelectionOnRootLineBoxes()) |
| 488 inlineBoxWrapper()->root().setHasSelectedChildren(isSelected()); | 483 inlineBoxWrapper()->root().setHasSelectedChildren(isSelected()); |
| 489 } | 484 } |
| 490 | 485 |
| 491 bool RenderReplaced::isSelected() const | 486 bool RenderReplaced::isSelected() const |
| 492 { | 487 { |
| 493 SelectionState s = selectionState(); | 488 SelectionState s = selectionState(); |
| 494 if (s == SelectionNone) | 489 if (s == SelectionNone) |
| 495 return false; | 490 return false; |
| 496 if (s == SelectionInside) | 491 if (s == SelectionInside) |
| 497 return true; | 492 return true; |
| 498 | 493 |
| 499 int selectionStart, selectionEnd; | 494 int selectionStart, selectionEnd; |
| 500 selectionStartEnd(selectionStart, selectionEnd); | 495 selectionStartEnd(selectionStart, selectionEnd); |
| 501 if (s == SelectionStart) | 496 if (s == SelectionStart) |
| 502 return selectionStart == 0; | 497 return selectionStart == 0; |
| 503 | 498 |
| 504 int end = node()->hasChildren() ? node()->countChildren() : 1; | 499 int end = node()->hasChildren() ? node()->countChildren() : 1; |
| 505 if (s == SelectionEnd) | 500 if (s == SelectionEnd) |
| 506 return selectionEnd == end; | 501 return selectionEnd == end; |
| 507 if (s == SelectionBoth) | 502 if (s == SelectionBoth) |
| 508 return selectionStart == 0 && selectionEnd == end; | 503 return selectionStart == 0 && selectionEnd == end; |
| 509 | 504 |
| 510 ASSERT(0); | 505 ASSERT(0); |
| 511 return false; | 506 return false; |
| 512 } | 507 } |
| 513 | 508 |
| 514 LayoutRect RenderReplaced::clippedOverflowRectForPaintInvalidation(const RenderL
ayerModelObject* paintInvalidationContainer, const PaintInvalidationState* paint
InvalidationState) const | |
| 515 { | |
| 516 // The selectionRect can project outside of the overflowRect, so take their
union | |
| 517 // for paint invalidation to avoid selection painting glitches. | |
| 518 LayoutRect r = isSelected() ? localSelectionRect() : visualOverflowRect(); | |
| 519 mapRectToPaintInvalidationBacking(paintInvalidationContainer, r, paintInvali
dationState); | |
| 520 return r; | |
| 521 } | 509 } |
| 522 | |
| 523 } | |
| OLD | NEW |