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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 | 71 |
72 setPreferredLogicalWidthsDirty(MarkOnlyThis); | 72 setPreferredLogicalWidthsDirty(MarkOnlyThis); |
73 | 73 |
74 setPositionState(AbsolutePosition); // to 0,0 :) | 74 setPositionState(AbsolutePosition); // to 0,0 :) |
75 } | 75 } |
76 | 76 |
77 RenderView::~RenderView() | 77 RenderView::~RenderView() |
78 { | 78 { |
79 } | 79 } |
80 | 80 |
81 void RenderView::trace(Visitor* visitor) | |
82 { | |
83 visitor->trace(m_selectionStart); | |
84 visitor->trace(m_selectionEnd); | |
85 visitor->trace(m_renderQuoteHead); | |
86 visitor->trace(m_pendingSelection); | |
87 RenderBlockFlow::trace(visitor); | |
88 } | |
89 | |
90 bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result) | 81 bool RenderView::hitTest(const HitTestRequest& request, HitTestResult& result) |
91 { | 82 { |
92 return hitTest(request, result.hitTestLocation(), result); | 83 return hitTest(request, result.hitTestLocation(), result); |
93 } | 84 } |
94 | 85 |
95 bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& l
ocation, HitTestResult& result) | 86 bool RenderView::hitTest(const HitTestRequest& request, const HitTestLocation& l
ocation, HitTestResult& result) |
96 { | 87 { |
97 TRACE_EVENT0("blink", "RenderView::hitTest"); | 88 TRACE_EVENT0("blink", "RenderView::hitTest"); |
98 m_hitTestCount++; | 89 m_hitTestCount++; |
99 | 90 |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return LayoutRect(); | 454 return LayoutRect(); |
464 | 455 |
465 return object->selectionRectForPaintInvalidation(object->containerForPaintIn
validation()); | 456 return object->selectionRectForPaintInvalidation(object->containerForPaintIn
validation()); |
466 } | 457 } |
467 | 458 |
468 IntRect RenderView::selectionBounds() | 459 IntRect RenderView::selectionBounds() |
469 { | 460 { |
470 // Now create a single bounding box rect that encloses the whole selection. | 461 // Now create a single bounding box rect that encloses the whole selection. |
471 LayoutRect selRect; | 462 LayoutRect selRect; |
472 | 463 |
473 typedef WillBeHeapHashSet<RawPtrWillBeMember<const RenderBlock> > VisitedCon
tainingBlockSet; | 464 typedef HashSet<const RenderBlock*> VisitedContainingBlockSet; |
474 VisitedContainingBlockSet visitedContainingBlocks; | 465 VisitedContainingBlockSet visitedContainingBlocks; |
475 | 466 |
476 commitPendingSelection(); | 467 commitPendingSelection(); |
477 RenderObject* os = m_selectionStart; | 468 RenderObject* os = m_selectionStart; |
478 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); | 469 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); |
479 while (os && os != stop) { | 470 while (os && os != stop) { |
480 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selec
tionEnd) && os->selectionState() != SelectionNone) { | 471 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selec
tionEnd) && os->selectionState() != SelectionNone) { |
481 // Blocks are responsible for painting line gaps and margin gaps. Th
ey must be examined as well. | 472 // Blocks are responsible for painting line gaps and margin gaps. Th
ey must be examined as well. |
482 selRect.unite(selectionRectForRenderer(os)); | 473 selRect.unite(selectionRectForRenderer(os)); |
483 const RenderBlock* cb = os->containingBlock(); | 474 const RenderBlock* cb = os->containingBlock(); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
555 if (m_selectionStart == start && m_selectionStartPos == startPos && | 546 if (m_selectionStart == start && m_selectionStartPos == startPos && |
556 m_selectionEnd == end && m_selectionEndPos == endPos) | 547 m_selectionEnd == end && m_selectionEndPos == endPos) |
557 return; | 548 return; |
558 | 549 |
559 // Record the old selected objects. These will be used later | 550 // Record the old selected objects. These will be used later |
560 // when we compare against the new selected objects. | 551 // when we compare against the new selected objects. |
561 int oldStartPos = m_selectionStartPos; | 552 int oldStartPos = m_selectionStartPos; |
562 int oldEndPos = m_selectionEndPos; | 553 int oldEndPos = m_selectionEndPos; |
563 | 554 |
564 // Objects each have a single selection rect to examine. | 555 // Objects each have a single selection rect to examine. |
565 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderObject>, SelectionState >
SelectedObjectMap; | 556 typedef HashMap<RenderObject*, SelectionState> SelectedObjectMap; |
566 SelectedObjectMap oldSelectedObjects; | 557 SelectedObjectMap oldSelectedObjects; |
567 // FIXME: |newSelectedObjects| doesn't really need to store the SelectionSta
te, it's just more convenient | 558 // FIXME: |newSelectedObjects| doesn't really need to store the SelectionSta
te, it's just more convenient |
568 // to have it use the same data structure as |oldSelectedObjects|. | 559 // to have it use the same data structure as |oldSelectedObjects|. |
569 SelectedObjectMap newSelectedObjects; | 560 SelectedObjectMap newSelectedObjects; |
570 | 561 |
571 // Blocks contain selected objects and fill gaps between them, either on the
left, right, or in between lines and blocks. | 562 // Blocks contain selected objects and fill gaps between them, either on the
left, right, or in between lines and blocks. |
572 // In order to get the paint invalidation rect right, we have to examine lef
t, middle, and right rects individually, since otherwise | 563 // In order to get the paint invalidation rect right, we have to examine lef
t, middle, and right rects individually, since otherwise |
573 // the union of those rects might remain the same even when changes have occ
urred. | 564 // the union of those rects might remain the same even when changes have occ
urred. |
574 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderBlock>, SelectionState >
SelectedBlockMap; | 565 typedef HashMap<RenderBlock*, SelectionState> SelectedBlockMap; |
575 SelectedBlockMap oldSelectedBlocks; | 566 SelectedBlockMap oldSelectedBlocks; |
576 // FIXME: |newSelectedBlocks| doesn't really need to store the SelectionStat
e, it's just more convenient | 567 // FIXME: |newSelectedBlocks| doesn't really need to store the SelectionStat
e, it's just more convenient |
577 // to have it use the same data structure as |oldSelectedBlocks|. | 568 // to have it use the same data structure as |oldSelectedBlocks|. |
578 SelectedBlockMap newSelectedBlocks; | 569 SelectedBlockMap newSelectedBlocks; |
579 | 570 |
580 RenderObject* os = m_selectionStart; | 571 RenderObject* os = m_selectionStart; |
581 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); | 572 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); |
582 bool exploringBackwards = false; | 573 bool exploringBackwards = false; |
583 bool continueExploring = os && (os != stop); | 574 bool continueExploring = os && (os != stop); |
584 while (continueExploring) { | 575 while (continueExploring) { |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
990 } | 981 } |
991 | 982 |
992 void RenderView::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const | 983 void RenderView::invalidateDisplayItemClients(DisplayItemList* displayItemList)
const |
993 { | 984 { |
994 RenderBlockFlow::invalidateDisplayItemClients(displayItemList); | 985 RenderBlockFlow::invalidateDisplayItemClients(displayItemList); |
995 if (m_frameView) | 986 if (m_frameView) |
996 displayItemList->invalidate(m_frameView->displayItemClient()); | 987 displayItemList->invalidate(m_frameView->displayItemClient()); |
997 } | 988 } |
998 | 989 |
999 } // namespace blink | 990 } // namespace blink |
OLD | NEW |