Bug 35225 - Remove addScrolledContentOffset/subtractScrolledContentOffset
Summary: Remove addScrolledContentOffset/subtractScrolledContentOffset
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC OS X 10.5
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-02-21 19:41 PST by Simon Fraser (smfr)
Modified: 2010-02-22 10:48 PST (History)
0 users

See Also:


Attachments
Patch (13.06 KB, patch)
2010-02-21 20:43 PST, Simon Fraser (smfr)
mitz: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2010-02-21 19:41:01 PST
scrolledContentOffset is already available as an IntPoint. We should just use it.
Comment 1 Simon Fraser (smfr) 2010-02-21 20:43:23 PST
Created attachment 49182 [details]
Patch
Comment 2 Darin Adler 2010-02-21 20:54:29 PST
Comment on attachment 49182 [details]
Patch

An excellent idea.

> +        IntRect clipRect(IntPoint() + m_offset + renderer->view()->layoutDelta(), layer->size());

It's annoying that the way to convert an IntSize to an IntPoint is to do "IntPoint() + size". That might end up doing addition to zero instead of just converting the type. I wish there was a clean idiom for doing that without addition.

>  void RenderBlock::offsetForContents(int& tx, int& ty) const

These arguments are just begging to be turned into an IntPoint&. Some day.

>      FloatPoint offsetFromRepaintContainer = transformState.mappedPoint();
> -    int x = offsetFromRepaintContainer.x();
> -    int y = offsetFromRepaintContainer.y();
>  
>      if (hasOverflowClip())
> -        layer()->subtractScrolledContentOffset(x, y);
> +        offsetFromRepaintContainer -= layer()->scrolledContentOffset();
> +
> +    int x = offsetFromRepaintContainer.x();
> +    int y = offsetFromRepaintContainer.y();

The old code did integer subtraction. This new code does floating point subtraction.

r=me too (I see mitz reviewed)
Comment 3 Simon Fraser (smfr) 2010-02-22 10:48:50 PST
http://trac.webkit.org/changeset/55090