Commit 18c7d0b4 authored by bdakin's avatar bdakin

Reviewed by Maciej.

        Fix for <rdar://problem/4570475> Dashboard regions do not scale for 
        non-1.0 scale factors.

        No test cases added since this only affects non-1.0 resolution 
        scale factors.

        * platform/FloatRect.cpp:
        (WebCore::FloatRect::scale): Added new function that scales a 
        rect's origin and size by a given factor.
        * platform/FloatRect.h:
        * platform/IntRect.cpp:
        (WebCore::IntRect::scale): Same as above.
        * platform/IntRect.h:
        * rendering/RenderObject.cpp:
        (WebCore::RenderObject::addDashboardRegions): After the bounds and 
        clip rects on the Dashboard region have been calculated, get the 
        user space scale factor, and if it is not 1.0, scale the rects.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@14750 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8146a1e9
2006-06-06 Beth Dakin <bdakin@apple.com>
Reviewed by Maciej.
Fix for <rdar://problem/4570475> Dashboard regions do not scale for
non-1.0 scale factors.
No test cases added since this only affects non-1.0 resolution
scale factors.
* platform/FloatRect.cpp:
(WebCore::FloatRect::scale): Added new function that scales a
rect's origin and size by a given factor.
* platform/FloatRect.h:
* platform/IntRect.cpp:
(WebCore::IntRect::scale): Same as above.
* platform/IntRect.h:
* rendering/RenderObject.cpp:
(WebCore::RenderObject::addDashboardRegions): After the bounds and
clip rects on the Dashboard region have been calculated, get the
user space scale factor, and if it is not 1.0, scale the rects.
2006-06-06 John Sullivan <sullivan@apple.com> 2006-06-06 John Sullivan <sullivan@apple.com>
Reviewed by Darin Adler. Reviewed by Darin Adler.
......
...@@ -95,6 +95,14 @@ void FloatRect::unite(const FloatRect& other) ...@@ -95,6 +95,14 @@ void FloatRect::unite(const FloatRect& other)
m_size.setHeight(b - t); m_size.setHeight(b - t);
} }
void FloatRect::scale(float s)
{
m_location.setX(x() * s);
m_location.setY(y() * s);
m_size.setWidth(width() * s);
m_size.setHeight(height() * s);
}
IntRect enclosingIntRect(const FloatRect& rect) IntRect enclosingIntRect(const FloatRect& rect)
{ {
int l = static_cast<int>(rect.x()); int l = static_cast<int>(rect.x());
......
...@@ -93,6 +93,7 @@ public: ...@@ -93,6 +93,7 @@ public:
m_size.setHeight(m_size.height() + dy + dy); m_size.setHeight(m_size.height() + dy + dy);
} }
void inflate(float d) { inflateX(d); inflateY(d); } void inflate(float d) { inflateX(d); inflateY(d); }
void scale(float s);
#if __APPLE__ #if __APPLE__
......
...@@ -89,4 +89,12 @@ void IntRect::unite(const IntRect& other) ...@@ -89,4 +89,12 @@ void IntRect::unite(const IntRect& other)
m_size.setHeight(b - t); m_size.setHeight(b - t);
} }
void IntRect::scale(float s)
{
m_location.setX((int)(x() * s));
m_location.setY((int)(y() * s));
m_size.setWidth((int)(width() * s));
m_size.setHeight((int)(height() * s));
}
} }
...@@ -99,6 +99,7 @@ public: ...@@ -99,6 +99,7 @@ public:
m_size.setHeight(m_size.height() + dy + dy); m_size.setHeight(m_size.height() + dy + dy);
} }
void inflate(int d) { inflateX(d); inflateY(d); } void inflate(int d) { inflateX(d); inflateY(d); }
void scale(float s);
#if WIN32 #if WIN32
IntRect(const RECT&); IntRect(const RECT&);
......
...@@ -2732,6 +2732,12 @@ void RenderObject::addDashboardRegions (DeprecatedValueList<DashboardRegionValue ...@@ -2732,6 +2732,12 @@ void RenderObject::addDashboardRegions (DeprecatedValueList<DashboardRegionValue
region.bounds.setX(x + styleRegion.offset.left.value()); region.bounds.setX(x + styleRegion.offset.left.value());
region.bounds.setY(y + styleRegion.offset.top.value()); region.bounds.setY(y + styleRegion.offset.top.value());
float scaleFactor = document()->view() ? document()->view()->scaleFactor() : 1.0f;
if (scaleFactor != 1.0f) {
region.bounds.scale(scaleFactor);
region.clip.scale(scaleFactor);
}
regions.append(region); regions.append(region);
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment