[Webkit-unassigned] [Bug 105189] Add function to move caret selection towards a point

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Dec 18 17:59:52 PST 2012


https://bugs.webkit.org/show_bug.cgi?id=105189


Simon Fraser (smfr) <simon.fraser at apple.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
 Attachment #180067|review?                     |review-
               Flag|                            |




--- Comment #11 from Simon Fraser (smfr) <simon.fraser at apple.com>  2012-12-18 18:02:06 PST ---
(From update of attachment 180067)
View in context: https://bugs.webkit.org/attachment.cgi?id=180067&action=review

> Source/WebCore/rendering/RenderLayer.cpp:2108
> +        LayoutRect unscaledRect = rect;
> +        Frame* frame = renderer()->frame();
> +        if (frame)
> +            unscaledRect.scale(1 / frame->page()->pageScaleFactor());
> +        LayoutRect exposeRect = LayoutRect(unscaledRect.x() + scrollXOffset(), unscaledRect.y() + scrollYOffset(), unscaledRect.width(), unscaledRect.height());

Please do this in a separate patch with its own testcase.

> Source/WebKit/chromium/src/WebFrameImpl.cpp:1399
> +    Element* editable = frame()->selection()->rootEditableElement();
> +    IntPoint contentsPoint = frame()->view()->windowToContents(IntPoint(point));
> +    float pageScaleFactor = frame()->page()->pageScaleFactor();
> +    contentsPoint.scale(1 / pageScaleFactor, 1 / pageScaleFactor);
> +    LayoutPoint localPoint(editable->renderer()->absoluteToLocal(contentsPoint));
> +    VisiblePosition position = editable->renderer()->positionForPoint(localPoint);
> +    frame()->selection()->moveTo(position, UserTriggered);

YOu should test this in a subframe with page scale applied. I'm not sure whether windowToContents() on a subframe applies the page scale. Also, if you're in a subframe, pageScale doesn't apply. frameScaleFactor() is more useful here.

It also looks like you assume windowToContents() gives you an "absolute" point in that frame (relative to the top left of the document, even when scrolled), since you then call absoluteToLocal() on it.

A good test here would be a zoomed page with both the root and the subframe scrolled. Ideally you'd also have CSS transforms on an ancestor of the frame, and inside the frame.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the webkit-unassigned mailing list