Chromium Code Reviews| 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 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 568 if (root.block().style()->isHorizontalWritingMode()) | 568 if (root.block().style()->isHorizontalWritingMode()) |
| 569 return LayoutRect(0, newLogicalTop, width(), root.selectionHeight()); | 569 return LayoutRect(0, newLogicalTop, width(), root.selectionHeight()); |
| 570 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), height()); | 570 return LayoutRect(newLogicalTop, 0, root.selectionHeight(), height()); |
| 571 } | 571 } |
| 572 | 572 |
| 573 void RenderReplaced::setSelectionState(SelectionState state) | 573 void RenderReplaced::setSelectionState(SelectionState state) |
| 574 { | 574 { |
| 575 // The selection state for our containing block hierarchy is updated by the base class call. | 575 // The selection state for our containing block hierarchy is updated by the base class call. |
| 576 RenderBox::setSelectionState(state); | 576 RenderBox::setSelectionState(state); |
| 577 | 577 |
| 578 if (inlineBoxWrapper() && canUpdateSelectionOnRootLineBoxes()) | 578 if (!inlineBoxWrapper()) |
| 579 return; | |
| 580 | |
| 581 // We only include the space below the baseline in our layer's cached repain t rect if the | |
| 582 // image is selected. Since the selection state has changed update the rect. | |
| 583 if (hasLayer()) | |
| 584 layer()->repainter().computeRepaintRects(containerForRepaint()); | |
|
Julien - ping for review
2014/05/02 00:23:35
I would expect this to fail with repaint-after-lay
rhogan
2014/05/02 15:36:27
If the layer-based repainter goes away then it wil
| |
| 585 | |
| 586 if (canUpdateSelectionOnRootLineBoxes()) | |
| 579 inlineBoxWrapper()->root().setHasSelectedChildren(isSelected()); | 587 inlineBoxWrapper()->root().setHasSelectedChildren(isSelected()); |
| 580 } | 588 } |
| 581 | 589 |
| 582 bool RenderReplaced::isSelected() const | 590 bool RenderReplaced::isSelected() const |
| 583 { | 591 { |
| 584 SelectionState s = selectionState(); | 592 SelectionState s = selectionState(); |
| 585 if (s == SelectionNone) | 593 if (s == SelectionNone) |
| 586 return false; | 594 return false; |
| 587 if (s == SelectionInside) | 595 if (s == SelectionInside) |
| 588 return true; | 596 return true; |
| 589 | 597 |
| 590 int selectionStart, selectionEnd; | 598 int selectionStart, selectionEnd; |
| 591 selectionStartEnd(selectionStart, selectionEnd); | 599 selectionStartEnd(selectionStart, selectionEnd); |
| 592 if (s == SelectionStart) | 600 if (s == SelectionStart) |
| 593 return selectionStart == 0; | 601 return selectionStart == 0; |
| 594 | 602 |
| 595 int end = node()->hasChildren() ? node()->countChildren() : 1; | 603 int end = node()->hasChildren() ? node()->countChildren() : 1; |
| 596 if (s == SelectionEnd) | 604 if (s == SelectionEnd) |
| 597 return selectionEnd == end; | 605 return selectionEnd == end; |
| 598 if (s == SelectionBoth) | 606 if (s == SelectionBoth) |
| 599 return selectionStart == 0 && selectionEnd == end; | 607 return selectionStart == 0 && selectionEnd == end; |
| 600 | 608 |
| 601 ASSERT(0); | 609 ASSERT(0); |
| 602 return false; | 610 return false; |
| 603 } | 611 } |
| 604 | 612 |
| 605 LayoutRect RenderReplaced::clippedOverflowRectForRepaint(const RenderLayerModelO bject* repaintContainer) const | |
| 606 { | |
| 607 if (style()->visibility() != VISIBLE && !enclosingLayer()->hasVisibleContent ()) | |
| 608 return LayoutRect(); | |
| 609 | |
| 610 // The selectionRect can project outside of the overflowRect, so take their union | |
| 611 // for repainting to avoid selection painting glitches. | |
| 612 LayoutRect r = unionRect(localSelectionRect(false), visualOverflowRect()); | |
| 613 | |
| 614 RenderView* v = view(); | |
| 615 if (!RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && v) { | |
| 616 // FIXME: layoutDelta needs to be applied in parts before/after transfor ms and | |
| 617 // repaint containers. https://bugs.webkit.org/show_bug.cgi?id=23308 | |
| 618 r.move(v->layoutDelta()); | |
| 619 } | |
| 620 | |
| 621 computeRectForRepaint(repaintContainer, r); | |
| 622 return r; | |
| 623 } | 613 } |
| 624 | |
| 625 } | |
| OLD | NEW |