Reviewed by Hyatt.
Test for <rdar://problem/
4100616> Doing a "find" in RSS doesn't scroll to result
* fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.checksum: Added.
* fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png: Added.
* fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt: Added.
* fast/overflow/scroll-nested-positioned-layer-in-overflow.html: Added.
WebCore:
Reviewed by Hyatt.
WebCore part of fix for <rdar://problem/
4100616> Doing a "find" in RSS doesn't scroll to result
Test: fast/overflow/scroll-nested-positioned-layer-in-overflow.html
Merged visibleSelectionRect into selectionRect. selectionRect() now takes an argument to determine
whether or not to return a rect that clips to the visible content. This change makes all of the implementations of selectionRect
consistent by having them all consider the repaint rect when clipping to visible content.
* page/Frame.cpp:
(WebCore::Frame::revealSelection): Call selectionRect with clipToVisibleContent = false, so we can get a rect that's not visible to reveal.
(WebCore::Frame::selectionRect): Added clipToVisibleContent argument, and merged visibleSelectionRect into this method.
(WebCore::Frame::setIsActive): Use selectionRect instead of visibleSelectionRect.
* page/Frame.h:
* page/mac/FrameMac.mm: (WebCore::Frame::selectionImage): Update layout before creating the image. Use selectionRect instead of visibleSelectionRect.
* page/DragController.cpp: (WebCore::dragLocForSelectionDrag): Use selectionRect instead of visibleSelectionRect.
* rendering/RenderBR.h: (WebCore::RenderBR::selectionRect): Updated argument.
* rendering/RenderBlock.h: (WebCore::RenderBlock::selectionRect): ditto.
* rendering/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::selectionRect): ditto.
* rendering/RenderSVGInlineText.h: ditto.
* rendering/RenderObject.h:
(WebCore::RenderObject::selectionRect): ditto.
(WebCore::RenderObject::SelectionInfo::SelectionInfo): ditto.
* rendering/RenderView.cpp:
(WebCore::RenderView::selectionRect): ditto.
(WebCore::RenderView::setSelection): ditto.
* rendering/RenderView.h:
* rendering/RenderText.h:
* rendering/RenderText.cpp: (WebCore::RenderText::selectionRect): Only call computeAbsoluteRepaintRect when clipping to visible content.
Otherwise, just adjust the rect to the correct position.
* rendering/RenderListMarker.h:
* rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::selectionRect):
To match what we do in RenderText, if we're trying to clip to visible content, just call computeAbsoluteRepaintRect.
* rendering/RenderReplaced.h:
* rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::selectionRect): ditto.
* 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
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.
This will prevent us from revealing text hidden by the slider in Safari RSS.
* WebCore.exp: Update symbols for WebKit.
WebKit:
Reviewed by Hyatt.
WebKit part of fix for <rdar://problem/
4100616> Doing a "find" in RSS doesn't scroll to result
Updated to use selectionRect instead of visibleSelectionRect. selectionRect() now returns the visible rect by default.
* WebView/WebHTMLView.mm:
(-[WebHTMLView _lookUpInDictionaryFromMenu:]):
(-[WebHTMLView selectionImageRect]):
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@21387
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2007-05-10 Adele Peterson <adele@apple.com>
+
+ Reviewed by Hyatt.
+
+ Test for <rdar://problem/4100616> Doing a "find" in RSS doesn't scroll to result
+
+ * fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.checksum: Added.
+ * fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.png: Added.
+ * fast/overflow/scroll-nested-positioned-layer-in-overflow-expected.txt: Added.
+ * fast/overflow/scroll-nested-positioned-layer-in-overflow.html: Added.
+
2007-05-08 Maciej Stachowiak <mjs@apple.com>
Reviewed by Oliver.
--- /dev/null
+375725727830bd7d3172f7b49a605545
\ No newline at end of file
--- /dev/null
+layer at (0,0) size 800x600
+ RenderView at (0,0) size 800x600
+layer at (0,0) size 800x600
+ RenderBlock {HTML} at (0,0) size 800x600
+ RenderBody {BODY} at (8,8) size 784x584
+layer at (0,42) size 800x558 clip at (0,42) size 785x558 scrollY 282 scrollHeight 840
+ RenderBlock (positioned) {DIV} at (0,42) size 800x558
+layer at (0,-240) size 560x840 backgroundClip at (0,42) size 785x558 clip at (0,42) size 785x558 outlineClip at (0,42) size 785x558
+ RenderBlock (positioned) {DIV} at (0,0) size 560x840
+ RenderBlock (anonymous) at (0,0) size 560x18
+ RenderText {#text} at (0,0) size 560x18
+ text run at (0,0) width 560: "This tests that we can scroll to reveal something in a nested positioned block in overflow."
+ RenderBlock {DIV} at (0,18) size 560x800
+ RenderBlock (anonymous) at (0,818) size 560x22
+ RenderButton {INPUT} at (2,2) size 203x18 [bgcolor=#C0C0C0]
+ RenderBlock (anonymous) at (8,2) size 187x13
+ RenderText at (0,0) size 187x13
+ text run at (0,0) width 187: "If you can see this, test has passed"
+ RenderText {#text} at (0,0) size 0x0
--- /dev/null
+<html>
+<head>
+ <style>
+ #scroller {
+ position: absolute;
+ top: 42px;
+ bottom: 0px;
+ left: 0px;
+ right: 0px;
+ overflow: overlay;
+ }
+
+ #contentarea {
+ position: absolute;
+ }
+ </style>
+</head>
+<body onload="document.getElementById('bt').focus()">
+ <div id="scroller">
+ <div id="contentarea">
+ This tests that we can scroll to reveal something in a nested positioned block in overflow.
+ <div style="height: 800px"></div>
+ <input type="button" id="bt" value="If you can see this, test has passed"></input>
+ </div>
+ </div>
+</body>
+</html>
+2007-05-10 Adele Peterson <adele@apple.com>
+
+ Reviewed by Hyatt.
+
+ WebCore part of fix for <rdar://problem/4100616> Doing a "find" in RSS doesn't scroll to result
+
+ Test: fast/overflow/scroll-nested-positioned-layer-in-overflow.html
+
+ Merged visibleSelectionRect into selectionRect. selectionRect() now takes an argument to determine
+ whether or not to return a rect that clips to the visible content. This change makes all of the implementations of selectionRect
+ consistent by having them all consider the repaint rect when clipping to visible content.
+
+ * page/Frame.cpp:
+ (WebCore::Frame::revealSelection): Call selectionRect with clipToVisibleContent = false, so we can get a rect that's not visible to reveal.
+ (WebCore::Frame::selectionRect): Added clipToVisibleContent argument, and merged visibleSelectionRect into this method.
+ (WebCore::Frame::setIsActive): Use selectionRect instead of visibleSelectionRect.
+ * page/Frame.h:
+ * page/mac/FrameMac.mm: (WebCore::Frame::selectionImage): Update layout before creating the image. Use selectionRect instead of visibleSelectionRect.
+ * page/DragController.cpp: (WebCore::dragLocForSelectionDrag): Use selectionRect instead of visibleSelectionRect.
+
+ * rendering/RenderBR.h: (WebCore::RenderBR::selectionRect): Updated argument.
+ * rendering/RenderBlock.h: (WebCore::RenderBlock::selectionRect): ditto.
+ * rendering/RenderSVGInlineText.cpp: (WebCore::RenderSVGInlineText::selectionRect): ditto.
+ * rendering/RenderSVGInlineText.h: ditto.
+ * rendering/RenderObject.h:
+ (WebCore::RenderObject::selectionRect): ditto.
+ (WebCore::RenderObject::SelectionInfo::SelectionInfo): ditto.
+ * rendering/RenderView.cpp:
+ (WebCore::RenderView::selectionRect): ditto.
+ (WebCore::RenderView::setSelection): ditto.
+ * rendering/RenderView.h:
+
+ * rendering/RenderText.h:
+ * rendering/RenderText.cpp: (WebCore::RenderText::selectionRect): Only call computeAbsoluteRepaintRect when clipping to visible content.
+ Otherwise, just adjust the rect to the correct position.
+ * rendering/RenderListMarker.h:
+ * rendering/RenderListMarker.cpp: (WebCore::RenderListMarker::selectionRect):
+ To match what we do in RenderText, if we're trying to clip to visible content, just call computeAbsoluteRepaintRect.
+ * rendering/RenderReplaced.h:
+ * rendering/RenderReplaced.cpp: (WebCore::RenderReplaced::selectionRect): ditto.
+
+ * 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
+ 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.
+ This will prevent us from revealing text hidden by the slider in Safari RSS.
+
+ * WebCore.exp: Update symbols for WebKit.
+
2007-05-10 David Hyatt <hyatt@apple.com>
Fix for:
__ZNK7WebCore5Frame10isFrameSetEv
__ZNK7WebCore5Frame12eventHandlerEv
__ZNK7WebCore5Frame12ownerElementEv
-__ZNK7WebCore5Frame13selectionRectEv
+__ZNK7WebCore5Frame13selectionRectEb
__ZNK7WebCore5Frame14selectionImageEb
__ZNK7WebCore5Frame15revealSelectionERKNS_11RenderLayer15ScrollAlignmentE
__ZNK7WebCore5Frame16inViewSourceModeEv
__ZNK7WebCore5Frame19selectionControllerEv
__ZNK7WebCore5Frame19setInViewSourceModeEb
-__ZNK7WebCore5Frame20visibleSelectionRectEv
__ZNK7WebCore5Frame30applyEditingStyleToBodyElementEv
__ZNK7WebCore5Frame31fontAttributesForSelectionStartEv
__ZNK7WebCore5Frame33removeEditingStyleFromBodyElementEv
static IntPoint dragLocForSelectionDrag(Frame* src)
{
- IntRect draggingRect = enclosingIntRect(src->visibleSelectionRect());
+ IntRect draggingRect = enclosingIntRect(src->selectionRect());
int xpos = draggingRect.right();
xpos = draggingRect.x() < xpos ? draggingRect.x() : xpos;
int ypos = draggingRect.bottom();
return static_cast<RenderPart*>(ownerElement->renderer());
}
-IntRect Frame::selectionRect() const
+// returns FloatRect because going through IntRect would truncate any floats
+FloatRect Frame::selectionRect(bool clipToVisibleContent) const
{
RenderView *root = static_cast<RenderView*>(renderer());
if (!root)
return IntRect();
-
- return root->selectionRect();
-}
-
-// returns FloatRect because going through IntRect would truncate any floats
-FloatRect Frame::visibleSelectionRect() const
-{
- if (!d->m_view)
- return FloatRect();
- return intersection(selectionRect(), d->m_view->visibleContentRect());
+ IntRect selectionRect = root->selectionRect(clipToVisibleContent);
+ return clipToVisibleContent ? intersection(selectionRect, d->m_view->visibleContentRect()) : selectionRect;
}
bool Frame::isFrameSet() const
break;
case Selection::RANGE:
- rect = selectionRect();
+ rect = enclosingIntRect(selectionRect(false));
break;
}
// RenderObject::selectionForegroundColor() check if the frame is active,
// we have to update places those colors were painted.
if (d->m_view)
- d->m_view->updateContents(enclosingIntRect(visibleSelectionRect()));
+ d->m_view->updateContents(enclosingIntRect(selectionRect()));
// Caret appears in the active frame.
if (flag)
void setTypingStyle(CSSMutableStyleDeclaration*);
void clearTypingStyle();
- IntRect selectionRect() const;
- FloatRect visibleSelectionRect() const;
+ FloatRect selectionRect(bool clipToVisibleContent = true) const;
HTMLFormElement* currentForm() const;
NSImage* Frame::selectionImage(bool forceWhiteText) const
{
d->m_paintRestriction = forceWhiteText ? PaintRestrictionSelectionOnlyWhiteText : PaintRestrictionSelectionOnly;
- NSImage* result = imageFromRect(visibleSelectionRect());
+ d->m_doc->updateLayout();
+ NSImage* result = imageFromRect(selectionRect());
d->m_paintRestriction = PaintRestrictionNone;
return result;
}
virtual const char* renderName() const { return "RenderBR"; }
- virtual IntRect selectionRect() { return IntRect(); }
+ virtual IntRect selectionRect(bool) { return IntRect(); }
virtual unsigned width(unsigned /*from*/, unsigned /*len*/, const Font&, int /*xpos*/) const { return 0; }
virtual unsigned width(unsigned /*from*/, unsigned /*len*/, int /*xpos*/, bool /*firstLine = false*/) const { return 0; }
SelectionState state() const { return m_state; }
};
- virtual IntRect selectionRect() { return selectionGapRects(); }
+ virtual IntRect selectionRect(bool) { return selectionGapRects(); }
GapRects selectionGapRects();
virtual bool shouldPaintSelectionGaps() const;
bool isSelectionRoot() const;
FrameView* frameView = m_object->document()->view();
if (frameView)
frameView->pauseScheduledEvents();
-
- if (m_object->hasOverflowClip()) {
+
+ bool restrictedByLineClamp = false;
+ if (m_object->parent()) {
+ parentLayer = m_object->parent()->enclosingLayer();
+ restrictedByLineClamp = m_object->parent()->style()->lineClamp() >= 0;
+ }
+
+ if (m_object->hasOverflowClip() && !restrictedByLineClamp) {
+ // Don't scroll to reveal an overflow layer that is restricted by the -webkit-line-clamp property.
+ // This will prevent us from revealing text hidden by the slider in Safari RSS.
int x, y;
m_object->absolutePosition(x, y);
IntRect layerBounds = IntRect(x + scrollXOffset(), y + scrollYOffset(),
newRect.setX(rect.x() - diffX);
newRect.setY(rect.y() - diffY);
}
-
- if (m_object->parent())
- parentLayer = m_object->parent()->enclosingLayer();
- } else {
+ } else if (!parentLayer) {
if (frameView) {
if (m_object->document() && m_object->document()->ownerElement() && m_object->document()->ownerElement()->renderer()) {
IntRect viewRect = enclosingIntRect(frameView->visibleContentRect());
containingBlock()->setSelectionState(state);
}
-IntRect RenderListMarker::selectionRect()
+IntRect RenderListMarker::selectionRect(bool clipToVisibleContent)
{
ASSERT(!needsLayout());
if (selectionState() == SelectionNone || !inlineBoxWrapper())
return IntRect();
- int absx, absy;
- RenderBlock* cb = containingBlock();
- cb->absolutePosition(absx, absy);
- if (cb->hasOverflowClip())
- cb->layer()->subtractScrollOffset(absx, absy);
-
RootInlineBox* root = inlineBoxWrapper()->root();
- return IntRect(absx + xPos(), absy + root->selectionTop(), width(), root->selectionHeight());
+ IntRect rect(xPos(), root->selectionTop(), width(), root->selectionHeight());
+
+ if (clipToVisibleContent)
+ computeAbsoluteRepaintRect(rect);
+ else {
+ int absx, absy;
+ RenderBlock* cb = containingBlock();
+ cb->absolutePosition(absx, absy);
+ if (cb->hasOverflowClip())
+ cb->layer()->subtractScrollOffset(absx, absy);
+ rect.move(absx, absy);
+ }
+
+ return rect;
}
} // namespace WebCore
virtual SelectionState selectionState() const { return m_selectionState; }
virtual void setSelectionState(SelectionState);
- virtual IntRect selectionRect();
+ virtual IntRect selectionRect(bool clipToVisibleContent = true);
virtual bool canBeSelectionLeaf() const { return true; }
void updateMargins();
// A single rectangle that encompasses all of the selected objects within this object. Used to determine the tightest
// possible bounding box for the selection.
- virtual IntRect selectionRect() { return IntRect(); }
+ virtual IntRect selectionRect(bool) { return IntRect(); }
// Whether or not an object can be part of the leaf elements of the selection.
virtual bool canBeSelectionLeaf() const { return false; }
{
}
- SelectionInfo(RenderObject* o)
+ SelectionInfo(RenderObject* o, bool clipToVisibleContent)
: m_object(o)
- , m_rect(o->needsLayout() ? IntRect() : o->selectionRect())
+ , m_rect(o->needsLayout() ? IntRect() : o->selectionRect(clipToVisibleContent))
, m_state(o->selectionState())
{
}
return RenderBox::positionForCoordinates(x, y);
}
-IntRect RenderReplaced::selectionRect()
+IntRect RenderReplaced::selectionRect(bool clipToVisibleContent)
{
ASSERT(!needsLayout());
int selectionLeft = xPos();
int selectionRight = xPos() + width();
- int absx, absy;
- cb->absolutePositionForContent(absx, absy);
- if (cb->hasOverflowClip())
- cb->layer()->subtractScrollOffset(absx, absy);
-
- return IntRect(selectionLeft + absx, selectionTop + absy, selectionRight - selectionLeft, selectionHeight);
+ IntRect rect(selectionLeft, selectionTop, selectionRight - selectionLeft, selectionHeight);
+
+ if (clipToVisibleContent)
+ computeAbsoluteRepaintRect(rect);
+ else {
+ int absx, absy;
+ cb->absolutePositionForContent(absx, absy);
+ if (cb->hasOverflowClip())
+ cb->layer()->subtractScrollOffset(absx, absy);
+ rect.move(absx, absy);
+ }
+
+ return rect;
}
void RenderReplaced::setSelectionState(SelectionState s)
virtual bool canBeSelectionLeaf() const { return true; }
virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
virtual void setSelectionState(SelectionState);
- virtual IntRect selectionRect();
+ virtual IntRect selectionRect(bool clipToVisibleContent = true);
bool isSelected() const;
rects.append(enclosingIntRect(absoluteRect));
}
-IntRect RenderSVGInlineText::selectionRect()
+IntRect RenderSVGInlineText::selectionRect(bool clipToVisibleContent)
{
- IntRect rect = RenderText::selectionRect();
+ IntRect rect = RenderText::selectionRect(clipToVisibleContent);
rect = parent()->absoluteTransform().mapRect(rect);
return rect;
}
virtual const char* renderName() const { return "RenderSVGInlineText"; }
virtual void absoluteRects(Vector<IntRect>& rects, int tx, int ty);
virtual bool requiresLayer() { return false; }
- virtual IntRect selectionRect();
+ virtual IntRect selectionRect(bool clipToVisibleContent = true);
virtual bool isSVGText() const { return true; }
virtual InlineTextBox* createInlineTextBox();
};
return cb->absoluteClippedOverflowRect();
}
-IntRect RenderText::selectionRect()
+IntRect RenderText::selectionRect(bool clipToVisibleContent)
{
ASSERT(!needsLayout());
if (cb->hasOverflowClip()) {
int x = rect.x();
int y = rect.y();
- IntRect boxRect(0, 0, cb->layer()->width(), cb->layer()->height());
cb->layer()->subtractScrollOffset(x, y);
- IntRect repaintRect(x, y, rect.width(), rect.height());
- rect = intersection(repaintRect, boxRect);
+ if (clipToVisibleContent) {
+ IntRect boxRect(0, 0, cb->layer()->width(), cb->layer()->height());
+ IntRect repaintRect(x, y, rect.width(), rect.height());
+ rect = intersection(repaintRect, boxRect);
+ }
+ }
+
+ if (clipToVisibleContent)
+ cb->computeAbsoluteRepaintRect(rect);
+ else {
+ int absx, absy;
+ cb->absolutePosition(absx, absy);
+ rect.move(absx, absy);
}
- cb->computeAbsoluteRepaintRect(rect);
return rect;
}
virtual bool canBeSelectionLeaf() const { return true; }
virtual SelectionState selectionState() const { return static_cast<SelectionState>(m_selectionState); }
virtual void setSelectionState(SelectionState s);
- virtual IntRect selectionRect();
+ virtual IntRect selectionRect(bool clipToVisibleContent = true);
virtual IntRect caretRect(int offset, EAffinity, int* extraWidthToEndOfLine = 0);
virtual int marginLeft() const { return style()->marginLeft().calcMinValue(0); }
return child ? child : object->nextInPreOrderAfterChildren();
}
-IntRect RenderView::selectionRect() const
+IntRect RenderView::selectionRect(bool clipToVisibleContent) const
{
document()->updateRendering();
while (os && os != stop) {
if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) {
// Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
- selectedObjects.set(os, new SelectionInfo(os));
+ selectedObjects.set(os, new SelectionInfo(os, clipToVisibleContent));
RenderBlock* cb = os->containingBlock();
while (cb && !cb->isRenderView()) {
SelectionInfo* blockInfo = selectedObjects.get(cb);
if (blockInfo)
break;
- selectedObjects.set(cb, new SelectionInfo(cb));
+ selectedObjects.set(cb, new SelectionInfo(cb, clipToVisibleContent));
cb = cb->containingBlock();
}
}
while (os && os != stop) {
if ((os->canBeSelectionLeaf() || os == m_selectionStart || os == m_selectionEnd) && os->selectionState() != SelectionNone) {
// Blocks are responsible for painting line gaps and margin gaps. They must be examined as well.
- oldSelectedObjects.set(os, new SelectionInfo(os));
+ oldSelectedObjects.set(os, new SelectionInfo(os, false));
RenderBlock* cb = os->containingBlock();
while (cb && !cb->isRenderView()) {
BlockSelectionInfo* blockInfo = oldSelectedBlocks.get(cb);
o = start;
while (o && o != stop) {
if ((o->canBeSelectionLeaf() || o == start || o == end) && o->selectionState() != SelectionNone) {
- newSelectedObjects.set(o, new SelectionInfo(o));
+ newSelectedObjects.set(o, new SelectionInfo(o, false));
RenderBlock* cb = o->containingBlock();
while (cb && !cb->isRenderView()) {
BlockSelectionInfo* blockInfo = newSelectedBlocks.get(cb);
virtual void absoluteRects(Vector<IntRect>&, int tx, int ty);
- IntRect selectionRect() const;
+ IntRect selectionRect(bool clipToVisibleContent = true) const;
void setMaximalOutlineSize(int o) { m_maximalOutlineSize = o; }
int maximalOutlineSize() const { return m_maximalOutlineSize; }
+2007-05-10 Adele Peterson <adele@apple.com>
+
+ Reviewed by Hyatt.
+
+ WebKit part of fix for <rdar://problem/4100616> Doing a "find" in RSS doesn't scroll to result
+
+ Updated to use selectionRect instead of visibleSelectionRect. selectionRect() now returns the visible rect by default.
+
+ * WebView/WebHTMLView.mm:
+ (-[WebHTMLView _lookUpInDictionaryFromMenu:]):
+ (-[WebHTMLView selectionImageRect]):
+
2007-05-10 dethbakin <bdakin@apple.com>
Reviewed by Darin.
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
- compatibilityVersion = "Xcode 2.4";
hasScannedForEncodings = 1;
knownRegions = (
English,
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
projectDirPath = "";
projectRoot = "";
- shouldCheckCompatibility = 1;
targets = (
9398100A0824BF01008DF038 /* WebKit */,
);
// FIXME: the dictionary API expects the rect for the first line of selection. Passing
// the rect for the entire selection, as we do here, positions the pop-up window near
// the bottom of the selection rather than at the selected word.
- NSRect rect = [self convertRect:core([self _frame])->visibleSelectionRect() toView:nil];
+ NSRect rect = [self convertRect:core([self _frame])->selectionRect() toView:nil];
rect.origin = [[self window] convertBaseToScreen:rect.origin];
NSData *data = [attrString RTFFromRange:NSMakeRange(0, [attrString length]) documentAttributes:nil];
dictionaryServiceWindowShow(data, rect, (writingDirection == NSWritingDirectionRightToLeft) ? 1 : 0);
// The DictionaryServices API requires the origin, in CG screen coordinates, of the first character of text in the selection.
// FIXME 4945808: We approximate this in a way that works well when a single word is selected, and less well in some other cases
// (but no worse than we did in Tiger)
- NSRect rect = core([self _frame])->visibleSelectionRect();
+ NSRect rect = core([self _frame])->selectionRect();
NSDictionary *attributes = [attrString fontAttributesInRange:NSMakeRange(0,1)];
NSFont *font = [attributes objectForKey:NSFontAttributeName];
- (NSRect)selectionImageRect
{
if ([self _hasSelection])
- return core([self _frame])->visibleSelectionRect();
+ return core([self _frame])->selectionRect();
return NSZeroRect;
}