Skip to content
Permalink
Browse files
Use toSize() to convert from Int/FloatPoint to Int/FloatSize
https://bugs.webkit.org/show_bug.cgi?id=105992

Patch by Steve Block <steveblock@chromium.org> on 2013-01-07
Reviewed by Kentaro Hara.

Source/WebCore:

Refactoring only, no change in behavior.

* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::computePath):
* platform/ScrollView.h:
(WebCore::ScrollView::scrollOffset):
* platform/graphics/FloatPoint.h:
(WebCore::toFloatSize):
Add 'inline FloatSize toFloatSize(const FloatPoint&)' to match IntPoint.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

Source/WebKit/chromium:

* src/LinkHighlight.cpp:
(WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::minimumScrollOffset):
(WebKit::WebFrameImpl::maximumScrollOffset):

Canonical link: https://commits.webkit.org/124496@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@139037 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
steveblock authored and webkit-commit-queue committed Jan 8, 2013
1 parent 9213845 commit 5461d3529b43f38d3409d556088ba66fafa02203
Showing 8 changed files with 47 additions and 10 deletions.
@@ -1,3 +1,22 @@
2013-01-07 Steve Block <steveblock@chromium.org>

Use toSize() to convert from Int/FloatPoint to Int/FloatSize
https://bugs.webkit.org/show_bug.cgi?id=105992

Reviewed by Kentaro Hara.

Refactoring only, no change in behavior.

* html/HTMLAreaElement.cpp:
(WebCore::HTMLAreaElement::computePath):
* platform/ScrollView.h:
(WebCore::ScrollView::scrollOffset):
* platform/graphics/FloatPoint.h:
(WebCore::toFloatSize):
Add 'inline FloatSize toFloatSize(const FloatPoint&)' to match IntPoint.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateGraphicsLayerGeometry):

2013-01-07 Kunihiko Sakamoto <ksakamoto@chromium.org>

INPUT_MULTIPLE_FIELDS_UI: Step-up/-down of month/day field should respect min/max attributes
@@ -115,7 +115,7 @@ Path HTMLAreaElement::computePath(RenderObject* obj) const
p.transform(zoomTransform);
}

p.translate(absPos - FloatPoint());
p.translate(toFloatSize(absPos));
return p;
}

@@ -170,7 +170,7 @@ class ScrollView : public Widget, public ScrollableArea {

// Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
virtual IntPoint scrollPosition() const OVERRIDE { return visibleContentRect().location(); }
IntSize scrollOffset() const { return visibleContentRect().location() - IntPoint(); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
IntSize scrollOffset() const { return toSize(visibleContentRect().location()); } // Gets the scrolled position as an IntSize. Convenient for adding to other sizes.
virtual IntPoint maximumScrollPosition() const OVERRIDE; // The maximum position we can be scrolled to.
virtual IntPoint minimumScrollPosition() const OVERRIDE; // The minimum position we can be scrolled to.
// Adjust the passed in scroll position to keep it between the minimum and maximum positions.
@@ -263,6 +263,11 @@ inline IntSize flooredIntSize(const FloatPoint& p)
return IntSize(clampToInteger(floorf(p.x())), clampToInteger(floorf(p.y())));
}

inline FloatSize toFloatSize(const FloatPoint& a)
{
return FloatSize(a.x(), a.y());
}

float findSlope(const FloatPoint& p1, const FloatPoint& p2, float& c);

// Find point where lines through the two pairs of points intersect. Returns false if the lines don't intersect.
@@ -635,7 +635,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
}

m_graphicsLayer->setPosition(FloatPoint(relativeCompositingBounds.location() - graphicsLayerParentLocation));
m_graphicsLayer->setOffsetFromRenderer(localCompositingBounds.location() - IntPoint());
m_graphicsLayer->setOffsetFromRenderer(toSize(localCompositingBounds.location()));

FloatSize oldSize = m_graphicsLayer->size();
FloatSize newSize = relativeCompositingBounds.size();
@@ -654,7 +654,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
clippingBox = clipBox(toRenderBox(renderer()));
clipLayer->setPosition(FloatPoint(clippingBox.location() - localCompositingBounds.location()));
clipLayer->setSize(clippingBox.size());
clipLayer->setOffsetFromRenderer(clippingBox.location() - IntPoint());
clipLayer->setOffsetFromRenderer(toSize(clippingBox.location()));
}

if (m_maskLayer) {
@@ -709,7 +709,7 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
// If we have a clipping layer (which clips descendants), then the foreground layer is a child of it,
// so that it gets correctly sorted with children. In that case, position relative to the clipping layer.
foregroundSize = FloatSize(clippingBox.size());
foregroundOffset = clippingBox.location() - IntPoint();
foregroundOffset = toSize(clippingBox.location());
}

m_foregroundLayer->setPosition(foregroundPosition);
@@ -743,15 +743,15 @@ void RenderLayerBacking::updateGraphicsLayerGeometry()
m_scrollingContentsLayer->setPosition(FloatPoint(-scrollOffset.width(), -scrollOffset.height()));

IntSize oldScrollingLayerOffset = m_scrollingLayer->offsetFromRenderer();
m_scrollingLayer->setOffsetFromRenderer(IntPoint() - paddingBox.location());
m_scrollingLayer->setOffsetFromRenderer(-toSize(paddingBox.location()));

bool paddingBoxOffsetChanged = oldScrollingLayerOffset != m_scrollingLayer->offsetFromRenderer();

IntSize scrollSize(m_owningLayer->scrollWidth(), m_owningLayer->scrollHeight());
if (scrollSize != m_scrollingContentsLayer->size() || paddingBoxOffsetChanged)
m_scrollingContentsLayer->setNeedsDisplay();

IntSize scrollingContentsOffset = paddingBox.location() - IntPoint() - scrollOffset;
IntSize scrollingContentsOffset = toSize(paddingBox.location() - scrollOffset);
if (scrollingContentsOffset != m_scrollingContentsLayer->offsetFromRenderer() || scrollSize != m_scrollingContentsLayer->size())
compositor()->scrollingLayerDidChange(m_owningLayer);

@@ -1,3 +1,16 @@
2013-01-07 Steve Block <steveblock@chromium.org>

Use toSize() to convert from Int/FloatPoint to Int/FloatSize
https://bugs.webkit.org/show_bug.cgi?id=105992

Reviewed by Kentaro Hara.

* src/LinkHighlight.cpp:
(WebKit::LinkHighlight::computeHighlightLayerPathAndPosition):
* src/WebFrameImpl.cpp:
(WebKit::WebFrameImpl::minimumScrollOffset):
(WebKit::WebFrameImpl::maximumScrollOffset):

2013-01-07 Xianzhu Wang <wangxianzhu@chromium.org>

[Chromium] Expose compositedScrollingForFramesEnabled setting in WebKit API
@@ -214,7 +214,7 @@ bool LinkHighlight::computeHighlightLayerPathAndPosition(RenderLayer* compositin
}

FloatRect boundingRect = newPath.boundingRect();
newPath.translate(FloatPoint() - boundingRect.location());
newPath.translate(-toFloatSize(boundingRect.location()));

bool pathHasChanged = !m_path.platformPath() || !(*newPath.platformPath() == *m_path.platformPath());
if (pathHasChanged) {
@@ -602,15 +602,15 @@ WebSize WebFrameImpl::minimumScrollOffset() const
FrameView* view = frameView();
if (!view)
return WebSize();
return view->minimumScrollPosition() - IntPoint();
return toSize(view->minimumScrollPosition());
}

WebSize WebFrameImpl::maximumScrollOffset() const
{
FrameView* view = frameView();
if (!view)
return WebSize();
return view->maximumScrollPosition() - IntPoint();
return toSize(view->maximumScrollPosition());
}

void WebFrameImpl::setScrollOffset(const WebSize& offset)

0 comments on commit 5461d35

Please sign in to comment.