Changeset 90596 in webkit
- Timestamp:
- Jul 7, 2011 3:37:55 PM (13 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r90595 r90596 1 2011-07-07 Emil A Eklund <eae@chromium.org> 2 3 Switch rendering tree selection code to to new layout types 4 https://bugs.webkit.org/show_bug.cgi?id=63762 5 6 Reviewed by Eric Seidel. 7 8 Switch selection getters and selection gap calculation methods over to 9 new layout abstraction. 10 11 No new tests, no functionality changes. 12 13 * rendering/InlineTextBox.cpp: 14 (WebCore::InlineTextBox::selectionTop): 15 (WebCore::InlineTextBox::selectionBottom): 16 (WebCore::InlineTextBox::selectionHeight): 17 (WebCore::InlineTextBox::isSelected): 18 * rendering/InlineTextBox.h: 19 * rendering/RenderBR.h: 20 (WebCore::RenderBR::selectionRectForRepaint): 21 * rendering/RenderBlock.cpp: 22 (WebCore::RenderBlock::selectionGapRectsForRepaint): 23 (WebCore::RenderBlock::selectionGaps): 24 (WebCore::RenderBlock::inlineSelectionGaps): 25 (WebCore::RenderBlock::blockSelectionGaps): 26 (WebCore::RenderBlock::blockSelectionGap): 27 (WebCore::RenderBlock::logicalLeftSelectionGap): 28 (WebCore::RenderBlock::logicalRightSelectionGap): 29 (WebCore::RenderBlock::logicalLeftSelectionOffset): 30 (WebCore::RenderBlock::logicalRightSelectionOffset): 31 (WebCore::RenderBlock::positionForPointWithInlineChildren): 32 (WebCore::RenderBlock::desiredColumnWidth): 33 * rendering/RenderBlock.h: 34 (WebCore::RenderBlock::selectionRectForRepaint): 35 * rendering/RenderListMarker.cpp: 36 (WebCore::RenderListMarker::selectionRectForRepaint): 37 * rendering/RenderListMarker.h: 38 * rendering/RenderObject.h: 39 (WebCore::RenderObject::selectionRect): 40 (WebCore::RenderObject::selectionRectForRepaint): 41 * rendering/RenderReplaced.cpp: 42 (WebCore::RenderReplaced::selectionRectForRepaint): 43 * rendering/RenderReplaced.h: 44 * rendering/RenderSelectionInfo.h: 45 (WebCore::RenderSelectionInfo::RenderSelectionInfo): 46 * rendering/RenderText.cpp: 47 (WebCore::RenderText::selectionRectForRepaint): 48 * rendering/RenderText.h: 49 * rendering/RootInlineBox.cpp: 50 (WebCore::RootInlineBox::selectionTop): 51 (WebCore::RootInlineBox::selectionBottom): 52 * rendering/RootInlineBox.h: 53 (WebCore::RootInlineBox::selectionHeight): 54 1 55 2011-07-07 Gavin Peters <gavinp@chromium.org> 2 56 -
trunk/Source/WebCore/rendering/InlineTextBox.cpp
r90515 r90596 99 99 } 100 100 101 int InlineTextBox::selectionTop()101 LayoutUnit InlineTextBox::selectionTop() 102 102 { 103 103 return root()->selectionTop(); 104 104 } 105 105 106 int InlineTextBox::selectionBottom()106 LayoutUnit InlineTextBox::selectionBottom() 107 107 { 108 108 return root()->selectionBottom(); 109 109 } 110 110 111 int InlineTextBox::selectionHeight()111 LayoutUnit InlineTextBox::selectionHeight() 112 112 { 113 113 return root()->selectionHeight(); … … 116 116 bool InlineTextBox::isSelected(int startPos, int endPos) const 117 117 { 118 int sPos = max(startPos - m_start, 0);119 int ePos = min(endPos - m_start, (int)m_len);118 LayoutUnit sPos = max<LayoutUnit>(startPos - m_start, 0); 119 LayoutUnit ePos = min<LayoutUnit>(endPos - m_start, m_len); 120 120 return (sPos < ePos); 121 121 } -
trunk/Source/WebCore/rendering/InlineTextBox.h
r90515 r90596 96 96 #endif 97 97 private: 98 int selectionTop();99 int selectionBottom();100 int selectionHeight();98 LayoutUnit selectionTop(); 99 LayoutUnit selectionBottom(); 100 LayoutUnit selectionHeight(); 101 101 102 102 TextRun constructTextRun(RenderStyle*, const Font&, BufferForAppendingHyphen* = 0) const; -
trunk/Source/WebCore/rendering/RenderBR.h
r90250 r90596 39 39 virtual const char* renderName() const { return "RenderBR"; } 40 40 41 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/) { return IntRect(); }41 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/) { return LayoutRect(); } 42 42 43 43 virtual float width(unsigned /*from*/, unsigned /*len*/, const Font&, float /*xPos*/, HashSet<const SimpleFontData*>* = 0 /*fallbackFonts*/ , GlyphOverflow* = 0) const { return 0; } -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r90590 r90596 2755 2755 offsetFromRepaintContainer -= layer()->scrolledContentOffset(); 2756 2756 2757 int lastTop = 0;2758 int lastLeft = logicalLeftSelectionOffset(this, lastTop);2759 int lastRight = logicalRightSelectionOffset(this, lastTop);2757 LayoutUnit lastTop = 0; 2758 LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); 2759 LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); 2760 2760 2761 2761 return selectionGaps(this, offsetFromRepaintContainer, IntSize(), lastTop, lastLeft, lastRight); … … 2820 2820 } 2821 2821 2822 GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,2823 int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo)2822 GapRects RenderBlock::selectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 2823 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo) 2824 2824 { 2825 2825 // IMPORTANT: Callers of this method that intend for painting to happen need to do a save/restore. … … 2827 2827 if (paintInfo) { 2828 2828 // Note that we don't clip out overflow for positioned objects. We just stick to the border box. 2829 IntRect flippedBlockRect = IntRect(offsetFromRootBlock.width(), offsetFromRootBlock.height(), width(), height());2829 LayoutRect flippedBlockRect(offsetFromRootBlock.width(), offsetFromRootBlock.height(), width(), height()); 2830 2830 rootBlock->flipForWritingMode(flippedBlockRect); 2831 2831 flippedBlockRect.moveBy(rootBlockPhysicalPosition); … … 2839 2839 for (FloatingObjectSetIterator it = floatingObjectSet.begin(); it != end; ++it) { 2840 2840 FloatingObject* r = *it; 2841 IntRect floatBox = IntRect(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(r),2842 2843 2841 LayoutRect floatBox(offsetFromRootBlock.width() + xPositionForFloatIncludingMargin(r), 2842 offsetFromRootBlock.height() + yPositionForFloatIncludingMargin(r), 2843 r->m_renderer->width(), r->m_renderer->height()); 2844 2844 rootBlock->flipForWritingMode(floatBox); 2845 2845 floatBox.move(rootBlockPhysicalPosition.x(), rootBlockPhysicalPosition.y()); … … 2875 2875 } 2876 2876 2877 GapRects RenderBlock::inlineSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,2878 int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo)2877 GapRects RenderBlock::inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 2878 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo) 2879 2879 { 2880 2880 GapRects result; … … 2899 2899 // Now paint the gaps for the lines. 2900 2900 for (; curr && curr->hasSelectedChildren(); curr = curr->nextRootBox()) { 2901 int selTop = curr->selectionTop();2902 int selHeight = curr->selectionHeight();2901 LayoutUnit selTop = curr->selectionTop(); 2902 LayoutUnit selHeight = curr->selectionHeight(); 2903 2903 2904 2904 if (!containsStart && !lastSelectedLine && … … 2907 2907 selTop, paintInfo)); 2908 2908 2909 IntRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth(), selTop + selHeight);2910 logicalRect.move(isHorizontalWritingMode() ? offsetFromRootBlock : IntSize(offsetFromRootBlock.height(), offsetFromRootBlock.width()));2909 LayoutRect logicalRect(curr->logicalLeft(), selTop, curr->logicalWidth(), selTop + selHeight); 2910 logicalRect.move(isHorizontalWritingMode() ? offsetFromRootBlock : offsetFromRootBlock.transposedSize()); 2911 2911 IntRect physicalRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, logicalRect); 2912 2912 if (!paintInfo || (isHorizontalWritingMode() && physicalRect.y() < paintInfo->rect.maxY() && physicalRect.maxY() > paintInfo->rect.y()) … … 2930 2930 } 2931 2931 2932 GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,2933 int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* paintInfo)2932 GapRects RenderBlock::blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 2933 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* paintInfo) 2934 2934 { 2935 2935 GapRects result; … … 2950 2950 // If the relposition offset is anything other than 0, then treat this just like an absolute positioned element. 2951 2951 // Just disregard it completely. 2952 IntSize relOffset = curr->layer()->relativePositionOffset();2952 LayoutSize relOffset = curr->layer()->relativePositionOffset(); 2953 2953 if (relOffset.width() || relOffset.height()) 2954 2954 continue; … … 2986 2986 } else if (childState != SelectionNone) 2987 2987 // We must be a block that has some selected object inside it. Go ahead and recur. 2988 result.unite(toRenderBlock(curr)->selectionGaps(rootBlock, rootBlockPhysicalPosition, IntSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()),2988 result.unite(toRenderBlock(curr)->selectionGaps(rootBlock, rootBlockPhysicalPosition, LayoutSize(offsetFromRootBlock.width() + curr->x(), offsetFromRootBlock.height() + curr->y()), 2989 2989 lastLogicalTop, lastLogicalLeft, lastLogicalRight, paintInfo)); 2990 2990 } … … 2992 2992 } 2993 2993 2994 IntRect RenderBlock::blockSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,2995 int lastLogicalTop, int lastLogicalLeft, int lastLogicalRight, int logicalBottom, const PaintInfo* paintInfo)2996 { 2997 int logicalTop = lastLogicalTop;2998 int logicalHeight = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalBottom - logicalTop;2999 if (logicalHeight <= 0)3000 return IntRect();2994 LayoutRect RenderBlock::blockSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 2995 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo* paintInfo) 2996 { 2997 LayoutUnit logicalTop = lastLogicalTop; 2998 LayoutUnit logicalHeight = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalBottom - logicalTop; 2999 if (logicalHeight <= static_cast<LayoutUnit>(0)) 3000 return LayoutRect(); 3001 3001 3002 3002 // Get the selection offsets for the bottom of the gap 3003 int logicalLeft = max(lastLogicalLeft, logicalLeftSelectionOffset(rootBlock, logicalBottom));3004 int logicalRight = min(lastLogicalRight, logicalRightSelectionOffset(rootBlock, logicalBottom));3005 int logicalWidth = logicalRight - logicalLeft;3006 if (logicalWidth <= 0)3007 return IntRect();3008 3009 IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, IntRect(logicalLeft, logicalTop, logicalWidth, logicalHeight));3003 LayoutUnit logicalLeft = max(lastLogicalLeft, logicalLeftSelectionOffset(rootBlock, logicalBottom)); 3004 LayoutUnit logicalRight = min(lastLogicalRight, logicalRightSelectionOffset(rootBlock, logicalBottom)); 3005 LayoutUnit logicalWidth = logicalRight - logicalLeft; 3006 if (logicalWidth <= static_cast<LayoutUnit>(0)) 3007 return LayoutRect(); 3008 3009 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(logicalLeft, logicalTop, logicalWidth, logicalHeight)); 3010 3010 if (paintInfo) 3011 3011 paintInfo->context->fillRect(gapRect, selectionBackgroundColor(), style()->colorSpace()); … … 3013 3013 } 3014 3014 3015 IntRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,3016 RenderObject* selObj, int logicalLeft, int logicalTop, int logicalHeight, const PaintInfo* paintInfo)3017 { 3018 int rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop;3019 int rootBlockLogicalLeft = max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight));3020 int rootBlockLogicalRight = min(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalLeft, min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)));3021 int rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;3022 if (rootBlockLogicalWidth <= 0)3023 return IntRect();3024 3025 IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, IntRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));3015 LayoutRect RenderBlock::logicalLeftSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 3016 RenderObject* selObj, LayoutUnit logicalLeft, LayoutUnit logicalTop, LayoutUnit logicalHeight, const PaintInfo* paintInfo) 3017 { 3018 LayoutUnit rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop; 3019 LayoutUnit rootBlockLogicalLeft = max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight)); 3020 LayoutUnit rootBlockLogicalRight = min(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalLeft, min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight))); 3021 LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft; 3022 if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0)) 3023 return LayoutRect(); 3024 3025 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight)); 3026 3026 if (paintInfo) 3027 3027 paintInfo->context->fillRect(gapRect, selObj->selectionBackgroundColor(), selObj->style()->colorSpace()); … … 3029 3029 } 3030 3030 3031 IntRect RenderBlock::logicalRightSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,3032 RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo* paintInfo)3033 { 3034 int rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop;3035 int rootBlockLogicalLeft = max(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight)));3036 int rootBlockLogicalRight = min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight));3037 int rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft;3038 if (rootBlockLogicalWidth <= 0)3039 return IntRect();3040 3041 IntRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, IntRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight));3031 LayoutRect RenderBlock::logicalRightSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 3032 RenderObject* selObj, int logicalRight, int logicalTop, int logicalHeight, const PaintInfo* paintInfo) 3033 { 3034 LayoutUnit rootBlockLogicalTop = blockDirectionOffset(rootBlock, offsetFromRootBlock) + logicalTop; 3035 LayoutUnit rootBlockLogicalLeft = max(inlineDirectionOffset(rootBlock, offsetFromRootBlock) + logicalRight, max(logicalLeftSelectionOffset(rootBlock, logicalTop), logicalLeftSelectionOffset(rootBlock, logicalTop + logicalHeight))); 3036 LayoutUnit rootBlockLogicalRight = min(logicalRightSelectionOffset(rootBlock, logicalTop), logicalRightSelectionOffset(rootBlock, logicalTop + logicalHeight)); 3037 LayoutUnit rootBlockLogicalWidth = rootBlockLogicalRight - rootBlockLogicalLeft; 3038 if (rootBlockLogicalWidth <= static_cast<LayoutUnit>(0)) 3039 return LayoutRect(); 3040 3041 LayoutRect gapRect = rootBlock->logicalRectToPhysicalRect(rootBlockPhysicalPosition, LayoutRect(rootBlockLogicalLeft, rootBlockLogicalTop, rootBlockLogicalWidth, logicalHeight)); 3042 3042 if (paintInfo) 3043 3043 paintInfo->context->fillRect(gapRect, selObj->selectionBackgroundColor(), selObj->style()->colorSpace()); … … 3056 3056 } 3057 3057 3058 int RenderBlock::logicalLeftSelectionOffset(RenderBlock* rootBlock, int position)3059 { 3060 int logicalLeft = logicalLeftOffsetForLine(position, false);3058 LayoutUnit RenderBlock::logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position) 3059 { 3060 LayoutUnit logicalLeft = logicalLeftOffsetForLine(position, false); 3061 3061 if (logicalLeft == logicalLeftOffsetForContent()) { 3062 3062 if (rootBlock != this) … … 3074 3074 } 3075 3075 3076 int RenderBlock::logicalRightSelectionOffset(RenderBlock* rootBlock, int position)3077 { 3078 int logicalRight = logicalRightOffsetForLine(position, false);3076 LayoutUnit RenderBlock::logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position) 3077 { 3078 LayoutUnit logicalRight = logicalRightOffsetForLine(position, false); 3079 3079 if (logicalRight == logicalRightOffsetForContent()) { 3080 3080 if (rootBlock != this) … … 4146 4146 } 4147 4147 4148 VisiblePosition RenderBlock::positionForPointWithInlineChildren(const IntPoint& pointInLogicalContents)4148 VisiblePosition RenderBlock::positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents) 4149 4149 { 4150 4150 ASSERT(childrenInline()); … … 4337 4337 } 4338 4338 4339 int RenderBlock::desiredColumnWidth() const4339 LayoutUnit RenderBlock::desiredColumnWidth() const 4340 4340 { 4341 4341 if (!hasColumns()) -
trunk/Source/WebCore/rendering/RenderBlock.h
r90590 r90596 299 299 virtual void paintObject(PaintInfo&, const LayoutPoint&); 300 300 301 int logicalRightOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;302 int logicalLeftOffsetForLine(int position, int fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const;301 LayoutUnit logicalRightOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const; 302 LayoutUnit logicalLeftOffsetForLine(LayoutUnit position, LayoutUnit fixedOffset, bool applyTextIndent = true, int* logicalHeightRemaining = 0) const; 303 303 304 304 virtual ETextAlign textAlignmentForLine(bool endsWithSoftBreak) const; … … 613 613 virtual void childBecameNonInline(RenderObject* child); 614 614 615 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool /*clipToVisibleContent*/)615 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool /*clipToVisibleContent*/) 616 616 { 617 617 return selectionGapRectsForRepaint(repaintContainer); … … 619 619 virtual bool shouldPaintSelectionGaps() const; 620 620 bool isSelectionRoot() const; 621 GapRects selectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,622 int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo* = 0);623 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,624 int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo*);625 GapRects blockSelectionGaps(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,626 int& lastLogicalTop, int& lastLogicalLeft, int& lastLogicalRight, const PaintInfo*);627 IntRect blockSelectionGap(RenderBlock* rootBlock, const IntPoint& rootBlockPhysicalPosition, const IntSize& offsetFromRootBlock,628 int lastLogicalTop, int lastLogicalLeft, int lastLogicalRight, int logicalBottom, const PaintInfo*);629 int logicalLeftSelectionOffset(RenderBlock* rootBlock, int position);630 int logicalRightSelectionOffset(RenderBlock* rootBlock, int position);621 GapRects selectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 622 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo* = 0); 623 GapRects inlineSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 624 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo*); 625 GapRects blockSelectionGaps(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 626 LayoutUnit& lastLogicalTop, LayoutUnit& lastLogicalLeft, LayoutUnit& lastLogicalRight, const PaintInfo*); 627 IntRect blockSelectionGap(RenderBlock* rootBlock, const LayoutPoint& rootBlockPhysicalPosition, const LayoutSize& offsetFromRootBlock, 628 LayoutUnit lastLogicalTop, LayoutUnit lastLogicalLeft, LayoutUnit lastLogicalRight, LayoutUnit logicalBottom, const PaintInfo*); 629 LayoutUnit logicalLeftSelectionOffset(RenderBlock* rootBlock, LayoutUnit position); 630 LayoutUnit logicalRightSelectionOffset(RenderBlock* rootBlock, LayoutUnit position); 631 631 632 632 virtual void absoluteRects(Vector<LayoutRect>&, const LayoutPoint& accumulatedOffset); 633 633 virtual void absoluteQuads(Vector<FloatQuad>&); 634 634 635 int desiredColumnWidth() const;635 LayoutUnit desiredColumnWidth() const; 636 636 unsigned desiredColumnCount() const; 637 637 void setDesiredColumnCountAndWidth(int count, int width); -
trunk/Source/WebCore/rendering/RenderListMarker.cpp
r90069 r90596 1699 1699 } 1700 1700 1701 IntRect RenderListMarker::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)1701 LayoutRect RenderListMarker::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent) 1702 1702 { 1703 1703 ASSERT(!needsLayout()); 1704 1704 1705 1705 if (selectionState() == SelectionNone || !inlineBoxWrapper()) 1706 return IntRect();1706 return LayoutRect(); 1707 1707 1708 1708 RootInlineBox* root = inlineBoxWrapper()->root(); 1709 IntRect rect(0, root->selectionTop() - y(), width(), root->selectionHeight());1709 LayoutRect rect(0, root->selectionTop() - y(), width(), root->selectionHeight()); 1710 1710 1711 1711 if (clipToVisibleContent) -
trunk/Source/WebCore/rendering/RenderListMarker.h
r90048 r90596 66 66 67 67 virtual void setSelectionState(SelectionState); 68 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);68 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); 69 69 virtual bool canBeSelectionLeaf() const { return true; } 70 70 -
trunk/Source/WebCore/rendering/RenderObject.h
r90590 r90596 704 704 // A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest 705 705 // possible bounding box for the selection. 706 IntRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); }707 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return IntRect(); }706 LayoutRect selectionRect(bool clipToVisibleContent = true) { return selectionRectForRepaint(0, clipToVisibleContent); } 707 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* /*repaintContainer*/, bool /*clipToVisibleContent*/ = true) { return LayoutRect(); } 708 708 709 709 // Whether or not an object can be part of the leaf elements of the selection. -
trunk/Source/WebCore/rendering/RenderReplaced.cpp
r90250 r90596 432 432 } 433 433 434 IntRect RenderReplaced::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)434 LayoutRect RenderReplaced::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent) 435 435 { 436 436 ASSERT(!needsLayout()); 437 437 438 438 if (!isSelected()) 439 return IntRect();440 441 IntRect rect = localSelectionRect();439 return LayoutRect(); 440 441 LayoutRect rect = localSelectionRect(); 442 442 if (clipToVisibleContent) 443 443 computeRectForRepaint(repaintContainer, rect); -
trunk/Source/WebCore/rendering/RenderReplaced.h
r90250 r90596 82 82 virtual bool canBeSelectionLeaf() const { return true; } 83 83 84 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);84 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); 85 85 86 86 IntSize m_intrinsicSize; -
trunk/Source/WebCore/rendering/RenderSelectionInfo.h
r76248 r90596 63 63 RenderSelectionInfo(RenderObject* o, bool clipToVisibleContent) 64 64 : RenderSelectionInfoBase(o) 65 , m_rect(o->needsLayout() ? IntRect() : o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent))65 , m_rect(o->needsLayout() ? LayoutRect() : o->selectionRectForRepaint(m_repaintContainer, clipToVisibleContent)) 66 66 { 67 67 } -
trunk/Source/WebCore/rendering/RenderText.cpp
r90530 r90596 1382 1382 } 1383 1383 1384 IntRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent)1384 LayoutRect RenderText::selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent) 1385 1385 { 1386 1386 ASSERT(!needsLayout()); 1387 1387 1388 1388 if (selectionState() == SelectionNone) 1389 return IntRect();1389 return LayoutRect(); 1390 1390 RenderBlock* cb = containingBlock(); 1391 1391 if (!cb) 1392 return IntRect();1392 return LayoutRect(); 1393 1393 1394 1394 // Now calculate startPos and endPos for painting selection. 1395 1395 // We include a selection while endPos > 0 1396 int startPos, endPos;1396 LayoutUnit startPos, endPos; 1397 1397 if (selectionState() == SelectionInside) { 1398 1398 // We are fully selected. … … 1410 1410 return IntRect(); 1411 1411 1412 IntRect rect;1412 LayoutRect rect; 1413 1413 for (InlineTextBox* box = firstTextBox(); box; box = box->nextTextBox()) { 1414 1414 rect.unite(box->selectionRect(startPos, endPos)); -
trunk/Source/WebCore/rendering/RenderText.h
r90530 r90596 97 97 virtual bool canBeSelectionLeaf() const { return true; } 98 98 virtual void setSelectionState(SelectionState s); 99 virtual IntRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true);99 virtual LayoutRect selectionRectForRepaint(RenderBoxModelObject* repaintContainer, bool clipToVisibleContent = true); 100 100 virtual IntRect localCaretRect(InlineBox*, int caretOffset, int* extraWidthToEndOfLine = 0); 101 101 -
trunk/Source/WebCore/rendering/RootInlineBox.cpp
r90515 r90596 397 397 } 398 398 399 int RootInlineBox::selectionTop() const400 { 401 int selectionTop = m_lineTop;399 LayoutUnit RootInlineBox::selectionTop() const 400 { 401 LayoutUnit selectionTop = m_lineTop; 402 402 403 403 if (m_hasAnnotationsBefore) … … 407 407 return selectionTop; 408 408 409 int prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block()->borderBefore() + block()->paddingBefore();409 LayoutUnit prevBottom = prevRootBox() ? prevRootBox()->selectionBottom() : block()->borderBefore() + block()->paddingBefore(); 410 410 if (prevBottom < selectionTop && block()->containsFloats()) { 411 411 // This line has actually been moved further down, probably from a large line-height, but possibly because the 412 412 // line was forced to clear floats. If so, let's check the offsets, and only be willing to use the previous 413 413 // line's bottom if the offsets are greater on both sides. 414 int prevLeft = block()->logicalLeftOffsetForLine(prevBottom, false);415 int prevRight = block()->logicalRightOffsetForLine(prevBottom, false);416 int newLeft = block()->logicalLeftOffsetForLine(selectionTop, false);417 int newRight = block()->logicalRightOffsetForLine(selectionTop, false);414 LayoutUnit prevLeft = block()->logicalLeftOffsetForLine(prevBottom, false); 415 LayoutUnit prevRight = block()->logicalRightOffsetForLine(prevBottom, false); 416 LayoutUnit newLeft = block()->logicalLeftOffsetForLine(selectionTop, false); 417 LayoutUnit newRight = block()->logicalRightOffsetForLine(selectionTop, false); 418 418 if (prevLeft > newLeft || prevRight < newRight) 419 419 return selectionTop; … … 423 423 } 424 424 425 int RootInlineBox::selectionBottom() const426 { 427 int selectionBottom = m_lineBottom;425 LayoutUnit RootInlineBox::selectionBottom() const 426 { 427 LayoutUnit selectionBottom = m_lineBottom; 428 428 429 429 if (m_hasAnnotationsAfter) … … 433 433 return selectionBottom; 434 434 435 int nextTop = nextRootBox()->selectionTop();435 LayoutUnit nextTop = nextRootBox()->selectionTop(); 436 436 if (nextTop > selectionBottom && block()->containsFloats()) { 437 437 // The next line has actually been moved further over, probably from a large line-height, but possibly because the 438 438 // line was forced to clear floats. If so, let's check the offsets, and only be willing to use the next 439 439 // line's top if the offsets are greater on both sides. 440 int nextLeft = block()->logicalLeftOffsetForLine(nextTop, false);441 int nextRight = block()->logicalRightOffsetForLine(nextTop, false);442 int newLeft = block()->logicalLeftOffsetForLine(selectionBottom, false);443 int newRight = block()->logicalRightOffsetForLine(selectionBottom, false);440 LayoutUnit nextLeft = block()->logicalLeftOffsetForLine(nextTop, false); 441 LayoutUnit nextRight = block()->logicalRightOffsetForLine(nextTop, false); 442 LayoutUnit newLeft = block()->logicalLeftOffsetForLine(selectionBottom, false); 443 LayoutUnit newRight = block()->logicalRightOffsetForLine(selectionBottom, false); 444 444 if (nextLeft > newLeft || nextRight < newRight) 445 445 return selectionBottom; -
trunk/Source/WebCore/rendering/RootInlineBox.h
r90515 r90596 54 54 void setPaginationStrut(int s) { m_paginationStrut = s; } 55 55 56 int selectionTop() const;57 int selectionBottom() const;58 int selectionHeight() const { return max(0, selectionBottom() - selectionTop()); }56 LayoutUnit selectionTop() const; 57 LayoutUnit selectionBottom() const; 58 LayoutUnit selectionHeight() const { return max<LayoutUnit>(0, selectionBottom() - selectionTop()); } 59 59 60 60 int blockDirectionPointInLine() const { return max(lineTop(), selectionTop()); }
Note: See TracChangeset
for help on using the changeset viewer.