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 | |
596 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos)
; | 592 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos)
; |
597 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde
r()) { | 593 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde
r()) { |
598 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio
nEnd) | 594 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio
nEnd) |
599 continue; | 595 continue; |
600 if (o->selectionState() == SelectionNone) | 596 if (o->selectionState() == SelectionNone) |
601 continue; | 597 continue; |
602 | 598 |
603 RenderSelectionInfo(o, true).invalidatePaint(); | 599 RenderSelectionInfo(o, true).invalidatePaint(); |
604 | 600 |
605 // Blocks are responsible for painting line gaps and margin gaps. They m
ust be examined as well. | 601 // 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... |
739 cb = cb->containingBlock(); | 735 cb = cb->containingBlock(); |
740 } | 736 } |
741 } | 737 } |
742 | 738 |
743 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring
, exploringBackwards); | 739 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring
, exploringBackwards); |
744 } | 740 } |
745 | 741 |
746 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing) | 742 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing) |
747 return; | 743 return; |
748 | 744 |
749 // For querying RenderLayer::compositingState() | |
750 // FIXME: this is wrong, selection should not cause eager invalidation. crbu
g.com/407416 | |
751 DisableCompositingQueryAsserts disabler; | |
752 | |
753 // Have any of the old selected objects changed compared to the new selectio
n? | 745 // Have any of the old selected objects changed compared to the new selectio
n? |
754 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj
ectsEnd; ++i) { | 746 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj
ectsEnd; ++i) { |
755 RenderObject* obj = i->key; | 747 RenderObject* obj = i->key; |
756 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); | 748 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); |
757 RenderSelectionInfo* oldInfo = i->value.get(); | 749 RenderSelectionInfo* oldInfo = i->value.get(); |
758 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() !
= newInfo->state() || | 750 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() !
= newInfo->state() || |
759 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || | 751 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || |
760 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { | 752 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { |
761 oldInfo->invalidatePaint(); | 753 oldInfo->invalidatePaint(); |
762 if (newInfo) { | 754 if (newInfo) { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re
nderObject*& endRenderer, int& endOffset) const | 787 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re
nderObject*& endRenderer, int& endOffset) const |
796 { | 788 { |
797 startRenderer = m_selectionStart; | 789 startRenderer = m_selectionStart; |
798 startOffset = m_selectionStartPos; | 790 startOffset = m_selectionStartPos; |
799 endRenderer = m_selectionEnd; | 791 endRenderer = m_selectionEnd; |
800 endOffset = m_selectionEndPos; | 792 endOffset = m_selectionEndPos; |
801 } | 793 } |
802 | 794 |
803 void RenderView::clearSelection() | 795 void RenderView::clearSelection() |
804 { | 796 { |
805 // For querying RenderLayer::compositingState() | |
806 // This is correct, since destroying render objects needs to cause eager pai
nt invalidations. | |
807 DisableCompositingQueryAsserts disabler; | |
808 | |
809 layer()->invalidatePaintForBlockSelectionGaps(); | 797 layer()->invalidatePaintForBlockSelectionGaps(); |
810 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); | 798 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); |
811 } | 799 } |
812 | 800 |
813 void RenderView::selectionStartEnd(int& startPos, int& endPos) const | 801 void RenderView::selectionStartEnd(int& startPos, int& endPos) const |
814 { | 802 { |
815 startPos = m_selectionStartPos; | 803 startPos = m_selectionStartPos; |
816 endPos = m_selectionEndPos; | 804 endPos = m_selectionEndPos; |
817 } | 805 } |
818 | 806 |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1003 return viewWidth(IncludeScrollbars) / scale; | 991 return viewWidth(IncludeScrollbars) / scale; |
1004 } | 992 } |
1005 | 993 |
1006 double RenderView::layoutViewportHeight() const | 994 double RenderView::layoutViewportHeight() const |
1007 { | 995 { |
1008 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 996 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
1009 return viewHeight(IncludeScrollbars) / scale; | 997 return viewHeight(IncludeScrollbars) / scale; |
1010 } | 998 } |
1011 | 999 |
1012 } // namespace blink | 1000 } // namespace blink |
OLD | NEW |