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) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserv
ed. |
4 * | 4 * |
5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
9 * | 9 * |
10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
582 } | 582 } |
583 selRect.unite(currRect); | 583 selRect.unite(currRect); |
584 } | 584 } |
585 return pixelSnappedIntRect(selRect); | 585 return pixelSnappedIntRect(selRect); |
586 } | 586 } |
587 | 587 |
588 void RenderView::invalidatePaintForSelection() const | 588 void RenderView::invalidatePaintForSelection() const |
589 { | 589 { |
590 HashSet<RenderBlock*> processedBlocks; | 590 HashSet<RenderBlock*> processedBlocks; |
591 | 591 |
| 592 // For querying RenderLayer::compositingState() |
| 593 // FIXME: this may be wrong. crbug.com/407416 |
| 594 DisableCompositingQueryAsserts disabler; |
| 595 |
592 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos)
; | 596 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos)
; |
593 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde
r()) { | 597 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde
r()) { |
594 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio
nEnd) | 598 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio
nEnd) |
595 continue; | 599 continue; |
596 if (o->selectionState() == SelectionNone) | 600 if (o->selectionState() == SelectionNone) |
597 continue; | 601 continue; |
598 | 602 |
599 RenderSelectionInfo(o, true).invalidatePaint(); | 603 RenderSelectionInfo(o, true).invalidatePaint(); |
600 | 604 |
601 // Blocks are responsible for painting line gaps and margin gaps. They m
ust be examined as well. | 605 // Blocks are responsible for painting line gaps and margin gaps. They m
ust be examined as well. |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 cb = cb->containingBlock(); | 739 cb = cb->containingBlock(); |
736 } | 740 } |
737 } | 741 } |
738 | 742 |
739 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring
, exploringBackwards); | 743 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring
, exploringBackwards); |
740 } | 744 } |
741 | 745 |
742 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing) | 746 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing) |
743 return; | 747 return; |
744 | 748 |
| 749 // For querying RenderLayer::compositingState() |
| 750 // FIXME: this is wrong, selection should not cause eager invalidation. crbu
g.com/407416 |
| 751 DisableCompositingQueryAsserts disabler; |
| 752 |
745 // Have any of the old selected objects changed compared to the new selectio
n? | 753 // Have any of the old selected objects changed compared to the new selectio
n? |
746 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj
ectsEnd; ++i) { | 754 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj
ectsEnd; ++i) { |
747 RenderObject* obj = i->key; | 755 RenderObject* obj = i->key; |
748 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); | 756 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); |
749 RenderSelectionInfo* oldInfo = i->value.get(); | 757 RenderSelectionInfo* oldInfo = i->value.get(); |
750 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() !
= newInfo->state() || | 758 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() !
= newInfo->state() || |
751 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || | 759 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || |
752 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { | 760 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { |
753 oldInfo->invalidatePaint(); | 761 oldInfo->invalidatePaint(); |
754 if (newInfo) { | 762 if (newInfo) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re
nderObject*& endRenderer, int& endOffset) const | 795 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re
nderObject*& endRenderer, int& endOffset) const |
788 { | 796 { |
789 startRenderer = m_selectionStart; | 797 startRenderer = m_selectionStart; |
790 startOffset = m_selectionStartPos; | 798 startOffset = m_selectionStartPos; |
791 endRenderer = m_selectionEnd; | 799 endRenderer = m_selectionEnd; |
792 endOffset = m_selectionEndPos; | 800 endOffset = m_selectionEndPos; |
793 } | 801 } |
794 | 802 |
795 void RenderView::clearSelection() | 803 void RenderView::clearSelection() |
796 { | 804 { |
| 805 // For querying RenderLayer::compositingState() |
| 806 // This is correct, since destroying render objects needs to cause eager pai
nt invalidations. |
| 807 DisableCompositingQueryAsserts disabler; |
| 808 |
797 layer()->invalidatePaintForBlockSelectionGaps(); | 809 layer()->invalidatePaintForBlockSelectionGaps(); |
798 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); | 810 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); |
799 } | 811 } |
800 | 812 |
801 void RenderView::selectionStartEnd(int& startPos, int& endPos) const | 813 void RenderView::selectionStartEnd(int& startPos, int& endPos) const |
802 { | 814 { |
803 startPos = m_selectionStartPos; | 815 startPos = m_selectionStartPos; |
804 endPos = m_selectionEndPos; | 816 endPos = m_selectionEndPos; |
805 } | 817 } |
806 | 818 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
991 return viewWidth(IncludeScrollbars) / scale; | 1003 return viewWidth(IncludeScrollbars) / scale; |
992 } | 1004 } |
993 | 1005 |
994 double RenderView::layoutViewportHeight() const | 1006 double RenderView::layoutViewportHeight() const |
995 { | 1007 { |
996 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 1008 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
997 return viewHeight(IncludeScrollbars) / scale; | 1009 return viewHeight(IncludeScrollbars) / scale; |
998 } | 1010 } |
999 | 1011 |
1000 } // namespace blink | 1012 } // namespace blink |
OLD | NEW |