Changeset 21387 in webkit
- Timestamp:
- May 10, 2007, 5:26:12 PM (18 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r21367 r21387 1 2007-05-10 Adele Peterson <adele@apple.com> 2 3 Reviewed by Hyatt. 4 5 Test for <rdar://problem/4100616> Doing a "find" in RSS doesn't scroll to result 6 7 * fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.checksum: Added. 8 * fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png: Added. 9 * fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt: Added. 10 * fast/overflow/scroll-nested-positioned-layer-in-overflow.html: Added. 11 1 12 2007-05-08 Maciej Stachowiak <mjs@apple.com> 2 13 -
trunk/WebCore/ChangeLog
r21385 r21387 1 2007-05-10 Adele Peterson <adele@apple.com> 2 3 Reviewed by Hyatt. 4 5 WebCore part of fix for <rdar://problem/4100616> Doing a "find" in RSS doesn't scroll to result 6 7 Test: fast/overflow/scroll-nested-positioned-layer-in-overflow.html 8 9 Merged visibleSelectionRect into selectionRect. selectionRect() now takes an argument to determine 10 whether or not to return a rect that clips to the visible content. This change makes all of the implementations of selectionRect 11 consistent by having them all consider the repaint rect when clipping to visible content. 12 13 * page/Frame.cpp: 14 (WebCore::Frame::revealSelection): Call selectionRect with clipToVisibleContent = false, so we can get a rect that's not visible to reveal. 15 (WebCore::Frame::selectionRect): Added clipToVisibleContent argument, and merged visibleSelectionRect into this method. 16 (WebCore::Frame::setIsActive): Use selectionRect instead of visibleSelectionRect. 17 * page/Frame.h: 18 * page/mac/FrameMac.mm: (WebCore::Frame::selectionImage): Update layout before creating the image. Use selectionRect instead of visibleSelectionRect. 19 * page/DragController.cpp: (WebCore::dragLocForSelectionDrag): Use selectionRect instead of visibleSelectionRect. 20 21 * rendering/RenderBR.h: (WebCore::RenderBR::selectionRect): Updated argument. 22 * rendering/RenderBlock.h: (WebCore::RenderBlock::selectionRect): ditto. 23 * rendering/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::selectionRect): ditto. 24 * rendering/RenderSVGInlineText.h: ditto. 25 * rendering/RenderObject.h: 26 (WebCore::RenderObject::selectionRect): ditto. 27 (WebCore::RenderObject::SelectionInfo::SelectionInfo): ditto. 28 * rendering/RenderView.cpp: 29 (WebCore::RenderView::selectionRect): ditto. 30 (WebCore::RenderView::setSelection): ditto. 31 * rendering/RenderView.h: 32 33 * rendering/RenderText.h: 34 * rendering/RenderText.cpp: (WebCore::RenderText::selectionRect): Only call computeAbsoluteRepaintRect when clipping to visible content. 35 Otherwise, just adjust the rect to the correct position. 36 * rendering/RenderListMarker.h: 37 * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::selectionRect): 38 To match what we do in RenderText, if we're trying to clip to visible content, just call computeAbsoluteRepaintRect. 39 * rendering/RenderReplaced.h: 40 * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::selectionRect): ditto. 41 42 * rendering/RenderLayer.cpp: (WebCore::RenderLayer::scrollRectToVisible): Check for a parent layer at the beginning, so we can try to scroll all of our parent layers 43 first, before trying to scroll the top level view. Also, don't try to scroll overflow layers that have -webkit-line-clamp restricting the height. 44 This will prevent us from revealing text hidden by the slider in Safari RSS. 45 46 * WebCore.exp: Update symbols for WebKit. 47 1 48 2007-05-10 David Hyatt <hyatt@apple.com> 2 49 -
trunk/WebCore/WebCore.exp
r21367 r21387 574 574 __ZNK7WebCore5Frame12eventHandlerEv 575 575 __ZNK7WebCore5Frame12ownerElementEv 576 __ZNK7WebCore5Frame13selectionRectE v576 __ZNK7WebCore5Frame13selectionRectEb 577 577 __ZNK7WebCore5Frame14selectionImageEb 578 578 __ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE … … 580 580 __ZNK7WebCore5Frame19selectionControllerEv 581 581 __ZNK7WebCore5Frame19setInViewSourceModeEb 582 __ZNK7WebCore5Frame20visibleSelectionRectEv583 582 __ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv 584 583 __ZNK7WebCore5Frame31fontAttributesForSelectionStartEv -
trunk/WebCore/page/DragController.cpp
r21185 r21387 530 530 static IntPoint dragLocForSelectionDrag(Frame* src) 531 531 { 532 IntRect draggingRect = enclosingIntRect(src-> visibleSelectionRect());532 IntRect draggingRect = enclosingIntRect(src->selectionRect()); 533 533 int xpos = draggingRect.right(); 534 534 xpos = draggingRect.x() < xpos ? draggingRect.x() : xpos; -
trunk/WebCore/page/Frame.cpp
r21367 r21387 1180 1180 } 1181 1181 1182 IntRect Frame::selectionRect() const 1182 // returns FloatRect because going through IntRect would truncate any floats 1183 FloatRect Frame::selectionRect(bool clipToVisibleContent) const 1183 1184 { 1184 1185 RenderView *root = static_cast<RenderView*>(renderer()); 1185 1186 if (!root) 1186 1187 return IntRect(); 1187 1188 return root->selectionRect(); 1189 } 1190 1191 // returns FloatRect because going through IntRect would truncate any floats 1192 FloatRect Frame::visibleSelectionRect() const 1193 { 1194 if (!d->m_view) 1195 return FloatRect(); 1196 1197 return intersection(selectionRect(), d->m_view->visibleContentRect()); 1188 1189 IntRect selectionRect = root->selectionRect(clipToVisibleContent); 1190 return clipToVisibleContent ? intersection(selectionRect, d->m_view->visibleContentRect()) : selectionRect; 1198 1191 } 1199 1192 … … 1261 1254 1262 1255 case Selection::RANGE: 1263 rect = selectionRect();1256 rect = enclosingIntRect(selectionRect(false)); 1264 1257 break; 1265 1258 } … … 1505 1498 // we have to update places those colors were painted. 1506 1499 if (d->m_view) 1507 d->m_view->updateContents(enclosingIntRect( visibleSelectionRect()));1500 d->m_view->updateContents(enclosingIntRect(selectionRect())); 1508 1501 1509 1502 // Caret appears in the active frame. -
trunk/WebCore/page/Frame.h
r21367 r21387 323 323 void clearTypingStyle(); 324 324 325 IntRect selectionRect() const; 326 FloatRect visibleSelectionRect() const; 325 FloatRect selectionRect(bool clipToVisibleContent = true) const; 327 326 328 327 HTMLFormElement* currentForm() const; -
trunk/WebCore/page/mac/FrameMac.mm
r21354 r21387 373 373 { 374 374 d->m_paintRestriction = forceWhiteText ? PaintRestrictionSelectionOnlyWhiteText : PaintRestrictionSelectionOnly; 375 NSImage* result = imageFromRect(visibleSelectionRect()); 375 d->m_doc->updateLayout(); 376 NSImage* result = imageFromRect(selectionRect()); 376 377 d->m_paintRestriction = PaintRestrictionNone; 377 378 return result; -
trunk/WebCore/rendering/RenderBR.h
r19027 r21387 41 41 virtual const char* renderName() const { return "RenderBR"; } 42 42 43 virtual IntRect selectionRect( ) { return IntRect(); }43 virtual IntRect selectionRect(bool) { return IntRect(); } 44 44 45 45 virtual unsigned width(unsigned /*from*/, unsigned /*len*/, const Font&, int /*xpos*/) const { return 0; } -
trunk/WebCore/rendering/RenderBlock.h
r21183 r21387 250 250 }; 251 251 252 virtual IntRect selectionRect( ) { return selectionGapRects(); }252 virtual IntRect selectionRect(bool) { return selectionGapRects(); } 253 253 GapRects selectionGapRects(); 254 254 virtual bool shouldPaintSelectionGaps() const; -
trunk/WebCore/rendering/RenderLayer.cpp
r21276 r21387 708 708 if (frameView) 709 709 frameView->pauseScheduledEvents(); 710 711 if (m_object->hasOverflowClip()) { 710 711 bool restrictedByLineClamp = false; 712 if (m_object->parent()) { 713 parentLayer = m_object->parent()->enclosingLayer(); 714 restrictedByLineClamp = m_object->parent()->style()->lineClamp() >= 0; 715 } 716 717 if (m_object->hasOverflowClip() && !restrictedByLineClamp) { 718 // Don't scroll to reveal an overflow layer that is restricted by the -webkit-line-clamp property. 719 // This will prevent us from revealing text hidden by the slider in Safari RSS. 712 720 int x, y; 713 721 m_object->absolutePosition(x, y); … … 732 740 newRect.setY(rect.y() - diffY); 733 741 } 734 735 if (m_object->parent()) 736 parentLayer = m_object->parent()->enclosingLayer(); 737 } else { 742 } else if (!parentLayer) { 738 743 if (frameView) { 739 744 if (m_object->document() && m_object->document()->ownerElement() && m_object->document()->ownerElement()->renderer()) { -
trunk/WebCore/rendering/RenderListMarker.cpp
r21166 r21387 879 879 } 880 880 881 IntRect RenderListMarker::selectionRect( )881 IntRect RenderListMarker::selectionRect(bool clipToVisibleContent) 882 882 { 883 883 ASSERT(!needsLayout()); … … 886 886 return IntRect(); 887 887 888 int absx, absy;889 RenderBlock* cb = containingBlock();890 cb->absolutePosition(absx, absy);891 if (cb->hasOverflowClip())892 cb->layer()->subtractScrollOffset(absx, absy);893 894 888 RootInlineBox* root = inlineBoxWrapper()->root(); 895 return IntRect(absx + xPos(), absy + root->selectionTop(), width(), root->selectionHeight()); 889 IntRect rect(xPos(), root->selectionTop(), width(), root->selectionHeight()); 890 891 if (clipToVisibleContent) 892 computeAbsoluteRepaintRect(rect); 893 else { 894 int absx, absy; 895 RenderBlock* cb = containingBlock(); 896 cb->absolutePosition(absx, absy); 897 if (cb->hasOverflowClip()) 898 cb->layer()->subtractScrollOffset(absx, absy); 899 rect.move(absx, absy); 900 } 901 902 return rect; 896 903 } 897 904 -
trunk/WebCore/rendering/RenderListMarker.h
r21094 r21387 65 65 virtual SelectionState selectionState() const { return m_selectionState; } 66 66 virtual void setSelectionState(SelectionState); 67 virtual IntRect selectionRect( );67 virtual IntRect selectionRect(bool clipToVisibleContent = true); 68 68 virtual bool canBeSelectionLeaf() const { return true; } 69 69 -
trunk/WebCore/rendering/RenderObject.h
r21211 r21387 747 747 // A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest 748 748 // possible bounding box for the selection. 749 virtual IntRect selectionRect( ) { return IntRect(); }749 virtual IntRect selectionRect(bool) { return IntRect(); } 750 750 751 751 // Whether or not an object can be part of the leaf elements of the selection. … … 777 777 } 778 778 779 SelectionInfo(RenderObject* o )779 SelectionInfo(RenderObject* o, bool clipToVisibleContent) 780 780 : m_object(o) 781 , m_rect(o->needsLayout() ? IntRect() : o->selectionRect( ))781 , m_rect(o->needsLayout() ? IntRect() : o->selectionRect(clipToVisibleContent)) 782 782 , m_state(o->selectionState()) 783 783 { -
trunk/WebCore/rendering/RenderReplaced.cpp
r21215 r21387 153 153 } 154 154 155 IntRect RenderReplaced::selectionRect( )155 IntRect RenderReplaced::selectionRect(bool clipToVisibleContent) 156 156 { 157 157 ASSERT(!needsLayout()); … … 173 173 int selectionRight = xPos() + width(); 174 174 175 int absx, absy; 176 cb->absolutePositionForContent(absx, absy); 177 if (cb->hasOverflowClip()) 178 cb->layer()->subtractScrollOffset(absx, absy); 179 180 return IntRect(selectionLeft + absx, selectionTop + absy, selectionRight - selectionLeft, selectionHeight); 175 IntRect rect(selectionLeft, selectionTop, selectionRight - selectionLeft, selectionHeight); 176 177 if (clipToVisibleContent) 178 computeAbsoluteRepaintRect(rect); 179 else { 180 int absx, absy; 181 cb->absolutePositionForContent(absx, absy); 182 if (cb->hasOverflowClip()) 183 cb->layer()->subtractScrollOffset(absx, absy); 184 rect.move(absx, absy); 185 } 186 187 return rect; 181 188 } 182 189 -
trunk/WebCore/rendering/RenderReplaced.h
r21211 r21387 51 51 virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); } 52 52 virtual void setSelectionState(SelectionState); 53 virtual IntRect selectionRect( );53 virtual IntRect selectionRect(bool clipToVisibleContent = true); 54 54 55 55 bool isSelected() const; -
trunk/WebCore/rendering/RenderSVGInlineText.cpp
r19855 r21387 46 46 } 47 47 48 IntRect RenderSVGInlineText::selectionRect( )48 IntRect RenderSVGInlineText::selectionRect(bool clipToVisibleContent) 49 49 { 50 IntRect rect = RenderText::selectionRect( );50 IntRect rect = RenderText::selectionRect(clipToVisibleContent); 51 51 rect = parent()->absoluteTransform().mapRect(rect); 52 52 return rect; -
trunk/WebCore/rendering/RenderSVGInlineText.h
r19855 r21387 36 36 virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty); 37 37 virtual bool requiresLayer() { return false; } 38 virtual IntRect selectionRect( );38 virtual IntRect selectionRect(bool clipToVisibleContent = true); 39 39 virtual bool isSVGText() const { return true; } 40 40 virtual InlineTextBox* createInlineTextBox(); -
trunk/WebCore/rendering/RenderText.cpp
r21384 r21387 1027 1027 } 1028 1028 1029 IntRect RenderText::selectionRect( )1029 IntRect RenderText::selectionRect(bool clipToVisibleContent) 1030 1030 { 1031 1031 ASSERT(!needsLayout()); … … 1065 1065 int x = rect.x(); 1066 1066 int y = rect.y(); 1067 IntRect boxRect(0, 0, cb->layer()->width(), cb->layer()->height());1068 1067 cb->layer()->subtractScrollOffset(x, y); 1069 IntRect repaintRect(x, y, rect.width(), rect.height()); 1070 rect = intersection(repaintRect, boxRect); 1071 } 1072 cb->computeAbsoluteRepaintRect(rect); 1068 if (clipToVisibleContent) { 1069 IntRect boxRect(0, 0, cb->layer()->width(), cb->layer()->height()); 1070 IntRect repaintRect(x, y, rect.width(), rect.height()); 1071 rect = intersection(repaintRect, boxRect); 1072 } 1073 } 1074 1075 if (clipToVisibleContent) 1076 cb->computeAbsoluteRepaintRect(rect); 1077 else { 1078 int absx, absy; 1079 cb->absolutePosition(absx, absy); 1080 rect.move(absx, absy); 1081 } 1073 1082 1074 1083 return rect; -
trunk/WebCore/rendering/RenderText.h
r21093 r21387 101 101 virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); } 102 102 virtual void setSelectionState(SelectionState s); 103 virtual IntRect selectionRect( );103 virtual IntRect selectionRect(bool clipToVisibleContent = true); 104 104 virtual IntRect caretRect(int offset, EAffinity, int* extraWidthToEndOfLine = 0); 105 105 -
trunk/WebCore/rendering/RenderView.cpp
r21183 r21387 229 229 } 230 230 231 IntRect RenderView::selectionRect( ) const231 IntRect RenderView::selectionRect(bool clipToVisibleContent) const 232 232 { 233 233 document()->updateRendering(); … … 241 241 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) { 242 242 // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well. 243 selectedObjects.set(os, new SelectionInfo(os ));243 selectedObjects.set(os, new SelectionInfo(os, clipToVisibleContent)); 244 244 RenderBlock* cb = os->containingBlock(); 245 245 while (cb && !cb->isRenderView()) { … … 247 247 if (blockInfo) 248 248 break; 249 selectedObjects.set(cb, new SelectionInfo(cb ));249 selectedObjects.set(cb, new SelectionInfo(cb, clipToVisibleContent)); 250 250 cb = cb->containingBlock(); 251 251 } … … 300 300 if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) { 301 301 // Blocks are responsible for painting line gaps and margin gaps. They must be examined as well. 302 oldSelectedObjects.set(os, new SelectionInfo(os ));302 oldSelectedObjects.set(os, new SelectionInfo(os, false)); 303 303 RenderBlock* cb = os->containingBlock(); 304 304 while (cb && !cb->isRenderView()) { … … 349 349 while (o && o != stop) { 350 350 if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) { 351 newSelectedObjects.set(o, new SelectionInfo(o ));351 newSelectedObjects.set(o, new SelectionInfo(o, false)); 352 352 RenderBlock* cb = o->containingBlock(); 353 353 while (cb && !cb->isRenderView()) { -
trunk/WebCore/rendering/RenderView.h
r21183 r21387 75 75 virtual void absoluteRects(Vector<IntRect>&, int tx, int ty); 76 76 77 IntRect selectionRect( ) const;77 IntRect selectionRect(bool clipToVisibleContent = true) const; 78 78 79 79 void setMaximalOutlineSize(int o) { m_maximalOutlineSize = o; } -
trunk/WebKit/ChangeLog
r21377 r21387 1 2007-05-10 Adele Peterson <adele@apple.com> 2 3 Reviewed by Hyatt. 4 5 WebKit part of fix for <rdar://problem/4100616> Doing a "find" in RSS doesn't scroll to result 6 7 Updated to use selectionRect instead of visibleSelectionRect. selectionRect() now returns the visible rect by default. 8 9 * WebView/WebHTMLView.mm: 10 (-[WebHTMLView _lookUpInDictionaryFromMenu:]): 11 (-[WebHTMLView selectionImageRect]): 12 1 13 2007-05-10 dethbakin <bdakin@apple.com> 2 14 -
trunk/WebKit/WebKit.xcodeproj/project.pbxproj
r21289 r21387 1325 1325 isa = PBXProject; 1326 1326 buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */; 1327 compatibilityVersion = "Xcode 2.4";1328 1327 hasScannedForEncodings = 1; 1329 1328 knownRegions = ( … … 1340 1339 projectDirPath = ""; 1341 1340 projectRoot = ""; 1342 shouldCheckCompatibility = 1;1343 1341 targets = ( 1344 1342 9398100A0824BF01008DF038 /* WebKit */, -
trunk/WebKit/WebView/WebHTMLView.mm
r21349 r21387 5238 5238 // the rect for the entire selection, as we do here, positions the pop-up window near 5239 5239 // the bottom of the selection rather than at the selected word. 5240 NSRect rect = [self convertRect:core([self _frame])-> visibleSelectionRect() toView:nil];5240 NSRect rect = [self convertRect:core([self _frame])->selectionRect() toView:nil]; 5241 5241 rect.origin = [[self window] convertBaseToScreen:rect.origin]; 5242 5242 NSData *data = [attrString RTFFromRange:NSMakeRange(0, [attrString length]) documentAttributes:nil]; … … 5246 5246 // FIXME 4945808: We approximate this in a way that works well when a single word is selected, and less well in some other cases 5247 5247 // (but no worse than we did in Tiger) 5248 NSRect rect = core([self _frame])-> visibleSelectionRect();5248 NSRect rect = core([self _frame])->selectionRect(); 5249 5249 5250 5250 NSDictionary *attributes = [attrString fontAttributesInRange:NSMakeRange(0,1)]; … … 5947 5947 { 5948 5948 if ([self _hasSelection]) 5949 return core([self _frame])-> visibleSelectionRect();5949 return core([self _frame])->selectionRect(); 5950 5950 return NSZeroRect; 5951 5951 }
Note:
See TracChangeset
for help on using the changeset viewer.