Bug 41163 - Need ability to get rendered rectangle.
Summary: Need ability to get rendered rectangle.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac OS X 10.6
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-24 09:21 PDT by Damian Kaleta
Modified: 2010-06-25 09:15 PDT (History)
1 user (show)

See Also:


Attachments
propose patch (4.11 KB, patch)
2010-06-24 10:00 PDT, Damian Kaleta
sam: review-
Details | Formatted Diff | Diff
propose patch (4.18 KB, patch)
2010-06-24 10:51 PDT, Damian Kaleta
sam: review+
eric: commit-queue+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Damian Kaleta 2010-06-24 09:21:34 PDT
Need ability to get rendered rectangle.
Comment 1 Damian Kaleta 2010-06-24 10:00:15 PDT
Created attachment 59666 [details]
propose patch
Comment 2 Sam Weinig 2010-06-24 10:20:56 PDT
Comment on attachment 59666 [details]
propose patch

>  
>  @interface DOMNode (WebDOMNodeOperationsPendingPublic)
> -- (NSString *)markupString;
> +- (CGRect)_renderRect:(bool *)isReplaced;

We should not remove markupString in this patch. If we want to do it it should be done in a subsequent patch.

> +@implementation DOMNode (WebDOMNodeOperationsPendingPublic)
> +
> +- (CGRect)_renderRect:(bool *)isReplaced
> +{
> +    return CGRect(core(self)->renderRect(isReplaced));

This should return a NSRect instead of a CGRect since this is an Objective-C API.

> +IntRect Node::renderRect(bool* isReplaced)
> +{
> +    IntRect rect(0, 0, 0, 0);
> +    
> +    RenderObject* hitRenderer = this->renderer();
> +    ASSERT(hitRenderer);
> +    RenderObject* renderer = hitRenderer;
> +    while (renderer && !renderer->isBody() && !renderer->isRoot()) {
> +        if (renderer->isRenderBlock() || renderer->isInlineBlockOrInlineTable() || renderer->isReplaced()) {
> +            *isReplaced = renderer->isReplaced();
> +            return renderer->absoluteBoundingBoxRect(true);
> +        }
> +        renderer = renderer->parent();
> +    }
> +    return rect;

This should just be return IntRect(). You can remove the rect declaration at the top.

r-. Lets iterate on this.
Comment 3 Damian Kaleta 2010-06-24 10:51:30 PDT
Created attachment 59677 [details]
propose patch