| 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 m_pageLogicalHeightChanged = false; | 262 m_pageLogicalHeightChanged = false; |
| 263 | 263 |
| 264 layoutContent(); | 264 layoutContent(); |
| 265 | 265 |
| 266 #if ENABLE(ASSERT) | 266 #if ENABLE(ASSERT) |
| 267 checkLayoutState(); | 267 checkLayoutState(); |
| 268 #endif | 268 #endif |
| 269 clearNeedsLayout(); | 269 clearNeedsLayout(); |
| 270 } | 270 } |
| 271 | 271 |
| 272 void RenderView::mapLocalToContainer(const RenderLayerModelObject* repaintContai
ner, TransformState& transformState, MapCoordinatesFlags mode, bool* wasFixed, c
onst PaintInvalidationState* paintInvalidationState) const | 272 void RenderView::mapLocalToContainer(const RenderLayerModelObject* paintInvalida
tionContainer, TransformState& transformState, MapCoordinatesFlags mode, bool* w
asFixed, const PaintInvalidationState* paintInvalidationState) const |
| 273 { | 273 { |
| 274 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); | 274 ASSERT_UNUSED(wasFixed, !wasFixed || *wasFixed == static_cast<bool>(mode & I
sFixed)); |
| 275 | 275 |
| 276 if (!repaintContainer && mode & UseTransforms && shouldUseTransformFromConta
iner(0)) { | 276 if (!paintInvalidationContainer && mode & UseTransforms && shouldUseTransfor
mFromContainer(0)) { |
| 277 TransformationMatrix t; | 277 TransformationMatrix t; |
| 278 getTransformFromContainer(0, LayoutSize(), t); | 278 getTransformFromContainer(0, LayoutSize(), t); |
| 279 transformState.applyTransform(t); | 279 transformState.applyTransform(t); |
| 280 } | 280 } |
| 281 | 281 |
| 282 if (mode & IsFixed && m_frameView) | 282 if (mode & IsFixed && m_frameView) |
| 283 transformState.move(m_frameView->scrollOffsetForFixedPosition()); | 283 transformState.move(m_frameView->scrollOffsetForFixedPosition()); |
| 284 | 284 |
| 285 if (repaintContainer == this) | 285 if (paintInvalidationContainer == this) |
| 286 return; | 286 return; |
| 287 | 287 |
| 288 if (mode & TraverseDocumentBoundaries) { | 288 if (mode & TraverseDocumentBoundaries) { |
| 289 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { | 289 if (RenderObject* parentDocRenderer = frame()->ownerRenderer()) { |
| 290 transformState.move(-frame()->view()->scrollOffset()); | 290 transformState.move(-frame()->view()->scrollOffset()); |
| 291 if (parentDocRenderer->isBox()) | 291 if (parentDocRenderer->isBox()) |
| 292 transformState.move(toLayoutSize(toRenderBox(parentDocRenderer)-
>contentBoxRect().location())); | 292 transformState.move(toLayoutSize(toRenderBox(parentDocRenderer)-
>contentBoxRect().location())); |
| 293 parentDocRenderer->mapLocalToContainer(repaintContainer, transformSt
ate, mode, wasFixed, paintInvalidationState); | 293 parentDocRenderer->mapLocalToContainer(paintInvalidationContainer, t
ransformState, mode, wasFixed, paintInvalidationState); |
| 294 return; | 294 return; |
| 295 } | 295 } |
| 296 } | 296 } |
| 297 | 297 |
| 298 // If a container was specified, and was not 0 or the RenderView, | 298 // If a container was specified, and was not 0 or the RenderView, |
| 299 // then we should have found it by now. | 299 // then we should have found it by now. |
| 300 ASSERT_ARG(repaintContainer, !repaintContainer); | 300 ASSERT_ARG(paintInvalidationContainer, !paintInvalidationContainer); |
| 301 } | 301 } |
| 302 | 302 |
| 303 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const | 303 const RenderObject* RenderView::pushMappingToContainer(const RenderLayerModelObj
ect* ancestorToStopAt, RenderGeometryMap& geometryMap) const |
| 304 { | 304 { |
| 305 LayoutSize offsetForFixedPosition; | 305 LayoutSize offsetForFixedPosition; |
| 306 LayoutSize offset; | 306 LayoutSize offset; |
| 307 RenderObject* container = 0; | 307 RenderObject* container = 0; |
| 308 | 308 |
| 309 if (m_frameView) | 309 if (m_frameView) |
| 310 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); | 310 offsetForFixedPosition = m_frameView->scrollOffsetForFixedPosition(); |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 } else { | 429 } else { |
| 430 paintInfo.context->clearRect(paintInfo.rect); | 430 paintInfo.context->clearRect(paintInfo.rect); |
| 431 } | 431 } |
| 432 } | 432 } |
| 433 } | 433 } |
| 434 | 434 |
| 435 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) | 435 void RenderView::invalidateTreeIfNeeded(const PaintInvalidationState& paintInval
idationState) |
| 436 { | 436 { |
| 437 ASSERT(!needsLayout()); | 437 ASSERT(!needsLayout()); |
| 438 | 438 |
| 439 // We specifically need to repaint the viewRect since other renderers | 439 // We specifically need to issue paint invalidations for the viewRect since
other renderers |
| 440 // short-circuit on full-repaint. | 440 // short-circuit on full-paint invalidation. |
| 441 if (doingFullPaintInvalidation() && !viewRect().isEmpty()) | 441 if (doingFullPaintInvalidation() && !viewRect().isEmpty()) |
| 442 invalidatePaintForRectangle(viewRect()); | 442 invalidatePaintForRectangle(viewRect()); |
| 443 | 443 |
| 444 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); | 444 RenderBlock::invalidateTreeIfNeeded(paintInvalidationState); |
| 445 } | 445 } |
| 446 | 446 |
| 447 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation
Rect) const | 447 void RenderView::invalidatePaintForRectangle(const LayoutRect& paintInvalidation
Rect) const |
| 448 { | 448 { |
| 449 ASSERT(!paintInvalidationRect.isEmpty()); | 449 ASSERT(!paintInvalidationRect.isEmpty()); |
| 450 | 450 |
| 451 if (document().printing() || !m_frameView) | 451 if (document().printing() || !m_frameView) |
| 452 return; | 452 return; |
| 453 | 453 |
| 454 // We always just invalidate the root view, since we could be an iframe that
is clipped out | 454 // We always just invalidate the root view, since we could be an iframe that
is clipped out |
| 455 // or even invisible. | 455 // or even invisible. |
| 456 Element* owner = document().ownerElement(); | 456 Element* owner = document().ownerElement(); |
| 457 if (layer()->compositingState() == PaintsIntoOwnBacking) { | 457 if (layer()->compositingState() == PaintsIntoOwnBacking) { |
| 458 layer()->paintInvalidator().setBackingNeedsRepaintInRect(paintInvalidati
onRect); | 458 layer()->paintInvalidator().setBackingNeedsPaintInvalidationInRect(paint
InvalidationRect); |
| 459 } else if (!owner) { | 459 } else if (!owner) { |
| 460 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa
intInvalidationRect)); | 460 m_frameView->contentRectangleForPaintInvalidation(pixelSnappedIntRect(pa
intInvalidationRect)); |
| 461 } else if (RenderBox* obj = owner->renderBox()) { | 461 } else if (RenderBox* obj = owner->renderBox()) { |
| 462 // Intersect the viewport with the paint invalidation rect. | 462 // Intersect the viewport with the paint invalidation rect. |
| 463 LayoutRect viewRectangle = viewRect(); | 463 LayoutRect viewRectangle = viewRect(); |
| 464 LayoutRect rectToInvalidate = intersection(paintInvalidationRect, viewRe
ctangle); | 464 LayoutRect rectToInvalidate = intersection(paintInvalidationRect, viewRe
ctangle); |
| 465 | 465 |
| 466 // Adjust for scroll offset of the view. | 466 // Adjust for scroll offset of the view. |
| 467 rectToInvalidate.moveBy(-viewRectangle.location()); | 467 rectToInvalidate.moveBy(-viewRectangle.location()); |
| 468 | 468 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 559 os = os->nextInPreOrder(); | 559 os = os->nextInPreOrder(); |
| 560 } | 560 } |
| 561 | 561 |
| 562 // Now create a single bounding box rect that encloses the whole selection. | 562 // Now create a single bounding box rect that encloses the whole selection. |
| 563 LayoutRect selRect; | 563 LayoutRect selRect; |
| 564 SelectionMap::iterator end = selectedObjects.end(); | 564 SelectionMap::iterator end = selectedObjects.end(); |
| 565 for (SelectionMap::iterator i = selectedObjects.begin(); i != end; ++i) { | 565 for (SelectionMap::iterator i = selectedObjects.begin(); i != end; ++i) { |
| 566 RenderSelectionInfo* info = i->value.get(); | 566 RenderSelectionInfo* info = i->value.get(); |
| 567 // RenderSelectionInfo::rect() is in the coordinates of the paintInvalid
ationContainer, so map to page coordinates. | 567 // RenderSelectionInfo::rect() is in the coordinates of the paintInvalid
ationContainer, so map to page coordinates. |
| 568 LayoutRect currRect = info->rect(); | 568 LayoutRect currRect = info->rect(); |
| 569 if (const RenderLayerModelObject* paintInvalidationContainer = info->rep
aintContainer()) { | 569 if (const RenderLayerModelObject* paintInvalidationContainer = info->pai
ntInvalidationContainer()) { |
| 570 FloatQuad absQuad = paintInvalidationContainer->localToAbsoluteQuad(
FloatRect(currRect)); | 570 FloatQuad absQuad = paintInvalidationContainer->localToAbsoluteQuad(
FloatRect(currRect)); |
| 571 currRect = absQuad.enclosingBoundingBox(); | 571 currRect = absQuad.enclosingBoundingBox(); |
| 572 } | 572 } |
| 573 selRect.unite(currRect); | 573 selRect.unite(currRect); |
| 574 } | 574 } |
| 575 return pixelSnappedIntRect(selRect); | 575 return pixelSnappedIntRect(selRect); |
| 576 } | 576 } |
| 577 | 577 |
| 578 void RenderView::invalidatePaintForSelection() const | 578 void RenderView::invalidatePaintForSelection() const |
| 579 { | 579 { |
| 580 HashSet<RenderBlock*> processedBlocks; | 580 HashSet<RenderBlock*> processedBlocks; |
| 581 | 581 |
| 582 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos)
; | 582 RenderObject* end = rendererAfterPosition(m_selectionEnd, m_selectionEndPos)
; |
| 583 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde
r()) { | 583 for (RenderObject* o = m_selectionStart; o && o != end; o = o->nextInPreOrde
r()) { |
| 584 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio
nEnd) | 584 if (!o->canBeSelectionLeaf() && o != m_selectionStart && o != m_selectio
nEnd) |
| 585 continue; | 585 continue; |
| 586 if (o->selectionState() == SelectionNone) | 586 if (o->selectionState() == SelectionNone) |
| 587 continue; | 587 continue; |
| 588 | 588 |
| 589 RenderSelectionInfo(o, true).repaint(); | 589 RenderSelectionInfo(o, true).invalidatePaint(); |
| 590 | 590 |
| 591 // Blocks are responsible for painting line gaps and margin gaps. They m
ust be examined as well. | 591 // Blocks are responsible for painting line gaps and margin gaps. They m
ust be examined as well. |
| 592 for (RenderBlock* block = o->containingBlock(); block && !block->isRende
rView(); block = block->containingBlock()) { | 592 for (RenderBlock* block = o->containingBlock(); block && !block->isRende
rView(); block = block->containingBlock()) { |
| 593 if (!processedBlocks.add(block).isNewEntry) | 593 if (!processedBlocks.add(block).isNewEntry) |
| 594 break; | 594 break; |
| 595 RenderSelectionInfo(block, true).repaint(); | 595 RenderSelectionInfo(block, true).invalidatePaint(); |
| 596 } | 596 } |
| 597 } | 597 } |
| 598 } | 598 } |
| 599 | 599 |
| 600 // When exploring the RenderTree looking for the nodes involved in the Selection
, sometimes it's | 600 // When exploring the RenderTree looking for the nodes involved in the Selection
, sometimes it's |
| 601 // required to change the traversing direction because the "start" position is b
elow the "end" one. | 601 // required to change the traversing direction because the "start" position is b
elow the "end" one. |
| 602 static inline RenderObject* getNextOrPrevRenderObjectBasedOnDirection(const Rend
erObject* o, const RenderObject* stop, bool& continueExploring, bool& exploringB
ackwards) | 602 static inline RenderObject* getNextOrPrevRenderObjectBasedOnDirection(const Rend
erObject* o, const RenderObject* stop, bool& continueExploring, bool& exploringB
ackwards) |
| 603 { | 603 { |
| 604 RenderObject* next; | 604 RenderObject* next; |
| 605 if (exploringBackwards) { | 605 if (exploringBackwards) { |
| 606 next = o->previousInPreOrder(); | 606 next = o->previousInPreOrder(); |
| 607 continueExploring = next && !(next)->isRenderView(); | 607 continueExploring = next && !(next)->isRenderView(); |
| 608 } else { | 608 } else { |
| 609 next = o->nextInPreOrder(); | 609 next = o->nextInPreOrder(); |
| 610 continueExploring = next && next != stop; | 610 continueExploring = next && next != stop; |
| 611 exploringBackwards = !next && (next != stop); | 611 exploringBackwards = !next && (next != stop); |
| 612 if (exploringBackwards) { | 612 if (exploringBackwards) { |
| 613 next = stop->previousInPreOrder(); | 613 next = stop->previousInPreOrder(); |
| 614 continueExploring = next && !next->isRenderView(); | 614 continueExploring = next && !next->isRenderView(); |
| 615 } | 615 } |
| 616 } | 616 } |
| 617 | 617 |
| 618 return next; | 618 return next; |
| 619 } | 619 } |
| 620 | 620 |
| 621 void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* e
nd, int endPos, SelectionRepaintMode blockRepaintMode) | 621 void RenderView::setSelection(RenderObject* start, int startPos, RenderObject* e
nd, int endPos, SelectionPaintInvalidationMode blockPaintInvalidationMode) |
| 622 { | 622 { |
| 623 // This code makes no assumptions as to if the rendering tree is up to date
or not | 623 // This code makes no assumptions as to if the rendering tree is up to date
or not |
| 624 // and will not try to update it. Currently clearSelection calls this | 624 // and will not try to update it. Currently clearSelection calls this |
| 625 // (intentionally) without updating the rendering tree as it doesn't care. | 625 // (intentionally) without updating the rendering tree as it doesn't care. |
| 626 // Other callers may want to force recalc style before calling this. | 626 // Other callers may want to force recalc style before calling this. |
| 627 | 627 |
| 628 // Make sure both our start and end objects are defined. | 628 // Make sure both our start and end objects are defined. |
| 629 // Check www.msnbc.com and try clicking around to find the case where this h
appened. | 629 // Check www.msnbc.com and try clicking around to find the case where this h
appened. |
| 630 if ((start && !end) || (end && !start)) | 630 if ((start && !end) || (end && !start)) |
| 631 return; | 631 return; |
| 632 | 632 |
| 633 // Just return if the selection hasn't changed. | 633 // Just return if the selection hasn't changed. |
| 634 if (m_selectionStart == start && m_selectionStartPos == startPos && | 634 if (m_selectionStart == start && m_selectionStartPos == startPos && |
| 635 m_selectionEnd == end && m_selectionEndPos == endPos) | 635 m_selectionEnd == end && m_selectionEndPos == endPos) |
| 636 return; | 636 return; |
| 637 | 637 |
| 638 // Record the old selected objects. These will be used later | 638 // Record the old selected objects. These will be used later |
| 639 // when we compare against the new selected objects. | 639 // when we compare against the new selected objects. |
| 640 int oldStartPos = m_selectionStartPos; | 640 int oldStartPos = m_selectionStartPos; |
| 641 int oldEndPos = m_selectionEndPos; | 641 int oldEndPos = m_selectionEndPos; |
| 642 | 642 |
| 643 // Objects each have a single selection rect to examine. | 643 // Objects each have a single selection rect to examine. |
| 644 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderObject>, OwnPtrWillBeMemb
er<RenderSelectionInfo> > SelectedObjectMap; | 644 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderObject>, OwnPtrWillBeMemb
er<RenderSelectionInfo> > SelectedObjectMap; |
| 645 SelectedObjectMap oldSelectedObjects; | 645 SelectedObjectMap oldSelectedObjects; |
| 646 SelectedObjectMap newSelectedObjects; | 646 SelectedObjectMap newSelectedObjects; |
| 647 | 647 |
| 648 // Blocks contain selected objects and fill gaps between them, either on the
left, right, or in between lines and blocks. | 648 // Blocks contain selected objects and fill gaps between them, either on the
left, right, or in between lines and blocks. |
| 649 // In order to get the repaint rect right, we have to examine left, middle,
and right rects individually, since otherwise | 649 // In order to get the paint invalidation rect right, we have to examine lef
t, middle, and right rects individually, since otherwise |
| 650 // the union of those rects might remain the same even when changes have occ
urred. | 650 // the union of those rects might remain the same even when changes have occ
urred. |
| 651 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderBlock>, OwnPtrWillBeMembe
r<RenderBlockSelectionInfo> > SelectedBlockMap; | 651 typedef WillBeHeapHashMap<RawPtrWillBeMember<RenderBlock>, OwnPtrWillBeMembe
r<RenderBlockSelectionInfo> > SelectedBlockMap; |
| 652 SelectedBlockMap oldSelectedBlocks; | 652 SelectedBlockMap oldSelectedBlocks; |
| 653 SelectedBlockMap newSelectedBlocks; | 653 SelectedBlockMap newSelectedBlocks; |
| 654 | 654 |
| 655 RenderObject* os = m_selectionStart; | 655 RenderObject* os = m_selectionStart; |
| 656 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); | 656 RenderObject* stop = rendererAfterPosition(m_selectionEnd, m_selectionEndPos
); |
| 657 bool exploringBackwards = false; | 657 bool exploringBackwards = false; |
| 658 bool continueExploring = os && (os != stop); | 658 bool continueExploring = os && (os != stop); |
| 659 while (continueExploring) { | 659 while (continueExploring) { |
| 660 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selec
tionEnd) && os->selectionState() != SelectionNone) { | 660 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selec
tionEnd) && os->selectionState() != SelectionNone) { |
| 661 // Blocks are responsible for painting line gaps and margin gaps. T
hey must be examined as well. | 661 // Blocks are responsible for painting line gaps and margin gaps. T
hey must be examined as well. |
| 662 oldSelectedObjects.set(os, adoptPtrWillBeNoop(new RenderSelectionInf
o(os, true))); | 662 oldSelectedObjects.set(os, adoptPtrWillBeNoop(new RenderSelectionInf
o(os, true))); |
| 663 if (blockRepaintMode == RepaintNewXOROld) { | 663 if (blockPaintInvalidationMode == PaintInvalidationNewXOROld) { |
| 664 RenderBlock* cb = os->containingBlock(); | 664 RenderBlock* cb = os->containingBlock(); |
| 665 while (cb && !cb->isRenderView()) { | 665 while (cb && !cb->isRenderView()) { |
| 666 OwnPtrWillBeMember<RenderBlockSelectionInfo>& blockInfo = ol
dSelectedBlocks.add(cb, nullptr).storedValue->value; | 666 OwnPtrWillBeMember<RenderBlockSelectionInfo>& blockInfo = ol
dSelectedBlocks.add(cb, nullptr).storedValue->value; |
| 667 if (blockInfo) | 667 if (blockInfo) |
| 668 break; | 668 break; |
| 669 blockInfo = adoptPtrWillBeNoop(new RenderBlockSelectionInfo(
cb)); | 669 blockInfo = adoptPtrWillBeNoop(new RenderBlockSelectionInfo(
cb)); |
| 670 cb = cb->containingBlock(); | 670 cb = cb->containingBlock(); |
| 671 } | 671 } |
| 672 } | 672 } |
| 673 } | 673 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 698 | 698 |
| 699 RenderObject* o = start; | 699 RenderObject* o = start; |
| 700 stop = rendererAfterPosition(end, endPos); | 700 stop = rendererAfterPosition(end, endPos); |
| 701 | 701 |
| 702 while (o && o != stop) { | 702 while (o && o != stop) { |
| 703 if (o != start && o != end && o->canBeSelectionLeaf()) | 703 if (o != start && o != end && o->canBeSelectionLeaf()) |
| 704 o->setSelectionStateIfNeeded(SelectionInside); | 704 o->setSelectionStateIfNeeded(SelectionInside); |
| 705 o = o->nextInPreOrder(); | 705 o = o->nextInPreOrder(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 if (blockRepaintMode != RepaintNothing) | 708 if (blockPaintInvalidationMode != PaintInvalidationNothing) |
| 709 layer()->clearBlockSelectionGapsBounds(); | 709 layer()->clearBlockSelectionGapsBounds(); |
| 710 | 710 |
| 711 // Now that the selection state has been updated for the new objects, walk t
hem again and | 711 // Now that the selection state has been updated for the new objects, walk t
hem again and |
| 712 // put them in the new objects list. | 712 // put them in the new objects list. |
| 713 o = start; | 713 o = start; |
| 714 exploringBackwards = false; | 714 exploringBackwards = false; |
| 715 continueExploring = o && (o != stop); | 715 continueExploring = o && (o != stop); |
| 716 while (continueExploring) { | 716 while (continueExploring) { |
| 717 if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionS
tate() != SelectionNone) { | 717 if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionS
tate() != SelectionNone) { |
| 718 newSelectedObjects.set(o, adoptPtrWillBeNoop(new RenderSelectionInfo
(o, true))); | 718 newSelectedObjects.set(o, adoptPtrWillBeNoop(new RenderSelectionInfo
(o, true))); |
| 719 RenderBlock* cb = o->containingBlock(); | 719 RenderBlock* cb = o->containingBlock(); |
| 720 while (cb && !cb->isRenderView()) { | 720 while (cb && !cb->isRenderView()) { |
| 721 OwnPtrWillBeMember<RenderBlockSelectionInfo>& blockInfo = newSel
ectedBlocks.add(cb, nullptr).storedValue->value; | 721 OwnPtrWillBeMember<RenderBlockSelectionInfo>& blockInfo = newSel
ectedBlocks.add(cb, nullptr).storedValue->value; |
| 722 if (blockInfo) | 722 if (blockInfo) |
| 723 break; | 723 break; |
| 724 blockInfo = adoptPtrWillBeNoop(new RenderBlockSelectionInfo(cb))
; | 724 blockInfo = adoptPtrWillBeNoop(new RenderBlockSelectionInfo(cb))
; |
| 725 cb = cb->containingBlock(); | 725 cb = cb->containingBlock(); |
| 726 } | 726 } |
| 727 } | 727 } |
| 728 | 728 |
| 729 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring
, exploringBackwards); | 729 o = getNextOrPrevRenderObjectBasedOnDirection(o, stop, continueExploring
, exploringBackwards); |
| 730 } | 730 } |
| 731 | 731 |
| 732 if (!m_frameView || blockRepaintMode == RepaintNothing) | 732 if (!m_frameView || blockPaintInvalidationMode == PaintInvalidationNothing) |
| 733 return; | 733 return; |
| 734 | 734 |
| 735 // Have any of the old selected objects changed compared to the new selectio
n? | 735 // Have any of the old selected objects changed compared to the new selectio
n? |
| 736 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj
ectsEnd; ++i) { | 736 for (SelectedObjectMap::iterator i = oldSelectedObjects.begin(); i != oldObj
ectsEnd; ++i) { |
| 737 RenderObject* obj = i->key; | 737 RenderObject* obj = i->key; |
| 738 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); | 738 RenderSelectionInfo* newInfo = newSelectedObjects.get(obj); |
| 739 RenderSelectionInfo* oldInfo = i->value.get(); | 739 RenderSelectionInfo* oldInfo = i->value.get(); |
| 740 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() !
= newInfo->state() || | 740 if (!newInfo || oldInfo->rect() != newInfo->rect() || oldInfo->state() !
= newInfo->state() || |
| 741 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || | 741 (m_selectionStart == obj && oldStartPos != m_selectionStartPos) || |
| 742 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { | 742 (m_selectionEnd == obj && oldEndPos != m_selectionEndPos)) { |
| 743 oldInfo->repaint(); | 743 oldInfo->invalidatePaint(); |
| 744 if (newInfo) { | 744 if (newInfo) { |
| 745 newInfo->repaint(); | 745 newInfo->invalidatePaint(); |
| 746 newSelectedObjects.remove(obj); | 746 newSelectedObjects.remove(obj); |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 } | 749 } |
| 750 | 750 |
| 751 // Any new objects that remain were not found in the old objects dict, and s
o they need to be updated. | 751 // Any new objects that remain were not found in the old objects dict, and s
o they need to be updated. |
| 752 SelectedObjectMap::iterator newObjectsEnd = newSelectedObjects.end(); | 752 SelectedObjectMap::iterator newObjectsEnd = newSelectedObjects.end(); |
| 753 for (SelectedObjectMap::iterator i = newSelectedObjects.begin(); i != newObj
ectsEnd; ++i) | 753 for (SelectedObjectMap::iterator i = newSelectedObjects.begin(); i != newObj
ectsEnd; ++i) |
| 754 i->value->repaint(); | 754 i->value->invalidatePaint(); |
| 755 | 755 |
| 756 // Have any of the old blocks changed? | 756 // Have any of the old blocks changed? |
| 757 SelectedBlockMap::iterator oldBlocksEnd = oldSelectedBlocks.end(); | 757 SelectedBlockMap::iterator oldBlocksEnd = oldSelectedBlocks.end(); |
| 758 for (SelectedBlockMap::iterator i = oldSelectedBlocks.begin(); i != oldBlock
sEnd; ++i) { | 758 for (SelectedBlockMap::iterator i = oldSelectedBlocks.begin(); i != oldBlock
sEnd; ++i) { |
| 759 RenderBlock* block = i->key; | 759 RenderBlock* block = i->key; |
| 760 RenderBlockSelectionInfo* newInfo = newSelectedBlocks.get(block); | 760 RenderBlockSelectionInfo* newInfo = newSelectedBlocks.get(block); |
| 761 RenderBlockSelectionInfo* oldInfo = i->value.get(); | 761 RenderBlockSelectionInfo* oldInfo = i->value.get(); |
| 762 if (!newInfo || oldInfo->rects() != newInfo->rects() || oldInfo->state()
!= newInfo->state()) { | 762 if (!newInfo || oldInfo->rects() != newInfo->rects() || oldInfo->state()
!= newInfo->state()) { |
| 763 oldInfo->repaint(); | 763 oldInfo->invalidatePaint(); |
| 764 if (newInfo) { | 764 if (newInfo) { |
| 765 newInfo->repaint(); | 765 newInfo->invalidatePaint(); |
| 766 newSelectedBlocks.remove(block); | 766 newSelectedBlocks.remove(block); |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 } | 769 } |
| 770 | 770 |
| 771 // Any new blocks that remain were not found in the old blocks dict, and so
they need to be updated. | 771 // Any new blocks that remain were not found in the old blocks dict, and so
they need to be updated. |
| 772 SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end(); | 772 SelectedBlockMap::iterator newBlocksEnd = newSelectedBlocks.end(); |
| 773 for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlock
sEnd; ++i) | 773 for (SelectedBlockMap::iterator i = newSelectedBlocks.begin(); i != newBlock
sEnd; ++i) |
| 774 i->value->repaint(); | 774 i->value->invalidatePaint(); |
| 775 } | 775 } |
| 776 | 776 |
| 777 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re
nderObject*& endRenderer, int& endOffset) const | 777 void RenderView::getSelection(RenderObject*& startRenderer, int& startOffset, Re
nderObject*& endRenderer, int& endOffset) const |
| 778 { | 778 { |
| 779 startRenderer = m_selectionStart; | 779 startRenderer = m_selectionStart; |
| 780 startOffset = m_selectionStartPos; | 780 startOffset = m_selectionStartPos; |
| 781 endRenderer = m_selectionEnd; | 781 endRenderer = m_selectionEnd; |
| 782 endOffset = m_selectionEndPos; | 782 endOffset = m_selectionEndPos; |
| 783 } | 783 } |
| 784 | 784 |
| 785 void RenderView::clearSelection() | 785 void RenderView::clearSelection() |
| 786 { | 786 { |
| 787 layer()->invalidatePaintForBlockSelectionGaps(); | 787 layer()->invalidatePaintForBlockSelectionGaps(); |
| 788 setSelection(0, -1, 0, -1, RepaintNewMinusOld); | 788 setSelection(0, -1, 0, -1, PaintInvalidationNewMinusOld); |
| 789 } | 789 } |
| 790 | 790 |
| 791 void RenderView::selectionStartEnd(int& startPos, int& endPos) const | 791 void RenderView::selectionStartEnd(int& startPos, int& endPos) const |
| 792 { | 792 { |
| 793 startPos = m_selectionStartPos; | 793 startPos = m_selectionStartPos; |
| 794 endPos = m_selectionEndPos; | 794 endPos = m_selectionEndPos; |
| 795 } | 795 } |
| 796 | 796 |
| 797 bool RenderView::shouldUsePrintingLayout() const | 797 bool RenderView::shouldUsePrintingLayout() const |
| 798 { | 798 { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 981 return viewWidth(IncludeScrollbars) / scale; | 981 return viewWidth(IncludeScrollbars) / scale; |
| 982 } | 982 } |
| 983 | 983 |
| 984 double RenderView::layoutViewportHeight() const | 984 double RenderView::layoutViewportHeight() const |
| 985 { | 985 { |
| 986 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; | 986 float scale = m_frameView ? m_frameView->frame().pageZoomFactor() : 1; |
| 987 return viewHeight(IncludeScrollbars) / scale; | 987 return viewHeight(IncludeScrollbars) / scale; |
| 988 } | 988 } |
| 989 | 989 |
| 990 } // namespace blink | 990 } // namespace blink |
| OLD | NEW |