| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
| 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc.
All rights reserved. |
| 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
| 7 * | 7 * |
| 8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
| 9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
| 10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
| (...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 | 697 |
| 698 if (view() && view()->selectionStart()) { | 698 if (view() && view()->selectionStart()) { |
| 699 Node* startElement = view()->selectionStart()->node(); | 699 Node* startElement = view()->selectionStart()->node(); |
| 700 if (startElement && startElement->rootEditableElement() == node()) | 700 if (startElement && startElement->rootEditableElement() == node()) |
| 701 return true; | 701 return true; |
| 702 } | 702 } |
| 703 | 703 |
| 704 return false; | 704 return false; |
| 705 } | 705 } |
| 706 | 706 |
| 707 GapRects RenderBlock::selectionGapRectsForPaintInvalidation(const RenderLayerMod
elObject* paintInvalidationContainer) | 707 LayoutRect RenderBlock::selectionRectForPaintInvalidation(const RenderLayerModel
Object* paintInvalidationContainer, bool) |
| 708 { | 708 { |
| 709 ASSERT(!needsLayout()); | 709 ASSERT(!needsLayout()); |
| 710 | 710 |
| 711 if (!shouldPaintSelectionGaps()) | 711 if (!shouldPaintSelectionGaps()) |
| 712 return GapRects(); | 712 return GapRects(); |
| 713 | 713 |
| 714 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); | 714 TransformState transformState(TransformState::ApplyTransformDirection, Float
Point()); |
| 715 mapLocalToContainer(paintInvalidationContainer, transformState, ApplyContain
erFlip | UseTransforms); | 715 mapLocalToContainer(paintInvalidationContainer, transformState, ApplyContain
erFlip | UseTransforms); |
| 716 LayoutPoint offsetFromPaintInvalidationContainer = roundedLayoutPoint(transf
ormState.mappedPoint()); | 716 LayoutPoint offsetFromPaintInvalidationContainer = roundedLayoutPoint(transf
ormState.mappedPoint()); |
| 717 | 717 |
| 718 if (hasOverflowClip()) | 718 if (hasOverflowClip()) |
| 719 offsetFromPaintInvalidationContainer -= scrolledContentOffset(); | 719 offsetFromPaintInvalidationContainer -= scrolledContentOffset(); |
| 720 | 720 |
| 721 LayoutUnit lastTop = 0; | 721 LayoutUnit lastTop = 0; |
| 722 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); | 722 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); |
| 723 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); | 723 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); |
| 724 | 724 |
| 725 return selectionGaps(this, offsetFromPaintInvalidationContainer, IntSize(),
lastTop, lastLeft, lastRight); | 725 return selectionGaps(this, offsetFromPaintInvalidationContainer, IntSize(),
lastTop, lastLeft, lastRight); |
| 726 } | 726 } |
| 727 | 727 |
| 728 void RenderBlock::paintSelection(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) | 728 void RenderBlock::paintSelection(PaintInfo& paintInfo, const LayoutPoint& paintO
ffset) |
| 729 { | 729 { |
| 730 if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) { | 730 if (shouldPaintSelectionGaps() && paintInfo.phase == PaintPhaseForeground) { |
| 731 LayoutUnit lastTop = 0; | 731 LayoutUnit lastTop = 0; |
| 732 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); | 732 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); |
| 733 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); | 733 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); |
| 734 GraphicsContextStateSaver stateSaver(*paintInfo.context); | 734 GraphicsContextStateSaver stateSaver(*paintInfo.context); |
| 735 | 735 |
| 736 LayoutRect gapRectsBounds = selectionGaps(this, paintOffset, LayoutSize(
), lastTop, lastLeft, lastRight, &paintInfo); | 736 // TODO(ojan): In sky, we don't use the return value, but we |
| 737 if (!gapRectsBounds.isEmpty()) { | 737 // need this in order to actually paint selection gaps. |
| 738 RenderLayer* layer = enclosingLayer(); | 738 // We should rename it appropriately. |
| 739 gapRectsBounds.moveBy(-paintOffset); | 739 selectionGaps(this, paintOffset, LayoutSize(), lastTop, lastLeft, lastRi
ght, &paintInfo); |
| 740 if (!hasLayer()) { | |
| 741 LayoutRect localBounds(gapRectsBounds); | |
| 742 gapRectsBounds = localToContainerQuad(FloatRect(localBounds), la
yer->renderer()).enclosingBoundingBox(); | |
| 743 if (layer->renderer()->hasOverflowClip()) | |
| 744 gapRectsBounds.move(layer->renderBox()->scrolledContentOffse
t()); | |
| 745 } | |
| 746 layer->addBlockSelectionGapsBounds(gapRectsBounds); | |
| 747 } | |
| 748 } | 740 } |
| 749 } | 741 } |
| 750 | 742 |
| 751 static void clipOutPositionedObjects(const PaintInfo* paintInfo, const LayoutPoi
nt& offset, TrackedRendererListHashSet* positionedObjects) | 743 static void clipOutPositionedObjects(const PaintInfo* paintInfo, const LayoutPoi
nt& offset, TrackedRendererListHashSet* positionedObjects) |
| 752 { | 744 { |
| 753 if (!positionedObjects) | 745 if (!positionedObjects) |
| 754 return; | 746 return; |
| 755 | 747 |
| 756 TrackedRendererListHashSet::const_iterator end = positionedObjects->end(); | 748 TrackedRendererListHashSet::const_iterator end = positionedObjects->end(); |
| 757 for (TrackedRendererListHashSet::const_iterator it = positionedObjects->begi
n(); it != end; ++it) { | 749 for (TrackedRendererListHashSet::const_iterator it = positionedObjects->begi
n(); it != end; ++it) { |
| (...skipping 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1984 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const | 1976 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m
arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render
Object* obj) const |
| 1985 { | 1977 { |
| 1986 showRenderObject(); | 1978 showRenderObject(); |
| 1987 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) | 1979 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot
Box()) |
| 1988 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); | 1980 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa
bel2, obj, 1); |
| 1989 } | 1981 } |
| 1990 | 1982 |
| 1991 #endif | 1983 #endif |
| 1992 | 1984 |
| 1993 } // namespace blink | 1985 } // namespace blink |
| OLD | NEW |