Backed out changeset 3265d1e6ed10 (bug 890938) for Werror bustage.

This commit is contained in:
Ryan VanderMeulen 2013-07-10 10:46:31 -04:00
parent 72d3039342
commit 010ce14023
8 changed files with 28 additions and 26 deletions

View File

@ -27,8 +27,8 @@ include "mozilla/layers/CompositorTypes.h";
using IPC::Principal;
using gfxMatrix;
using gfxRect;
using gfxSize;
using CSSRect;
using mozilla::layers::FrameMetrics;
using mozilla::layout::ScrollingBehavior;
using mozilla::void_t;
@ -264,7 +264,7 @@ parent:
* Instructs the TabParent to forward a request to zoom to a rect given in
* CSS pixels. This rect is relative to the document.
*/
ZoomToRect(CSSRect aRect);
ZoomToRect(gfxRect aRect);
/**
* We know for sure that content has either preventDefaulted or not

View File

@ -322,7 +322,7 @@ TabChild::Observe(nsISupports *aSubject,
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell));
if (tabChild == this) {
CSSRect rect;
gfxRect rect;
sscanf(NS_ConvertUTF16toUTF8(aData).get(),
"{\"x\":%lf,\"y\":%lf,\"w\":%lf,\"h\":%lf}",
&rect.x, &rect.y, &rect.width, &rect.height);

View File

@ -1466,7 +1466,7 @@ TabParent::RecvPRenderFrameConstructor(PRenderFrameParent* actor,
}
bool
TabParent::RecvZoomToRect(const CSSRect& aRect)
TabParent::RecvZoomToRect(const gfxRect& aRect)
{
if (RenderFrameParent* rfp = GetRenderFrame()) {
rfp->ZoomToRect(aRect);

View File

@ -151,7 +151,7 @@ public:
virtual bool RecvGetDPI(float* aValue);
virtual bool RecvGetDefaultScale(double* aValue);
virtual bool RecvGetWidgetNativeData(WindowsHandle* aValue);
virtual bool RecvZoomToRect(const CSSRect& aRect);
virtual bool RecvZoomToRect(const gfxRect& aRect);
virtual bool RecvUpdateZoomConstraints(const bool& aAllowZoom,
const float& aMinZoom,
const float& aMaxZoom);

View File

@ -1252,7 +1252,9 @@ void AsyncPanZoomController::DetectScrollableSubframe() {
mDelayPanning = true;
}
void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
void AsyncPanZoomController::ZoomToRect(const gfxRect& aRect) {
CSSRect zoomToRect(aRect.x, aRect.y, aRect.width, aRect.height);
SetState(ANIMATING_ZOOM);
{
@ -1276,19 +1278,19 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
/ intrinsicScale;
float localMaxZoom = mMaxZoom / intrinsicScale;
if (!aRect.IsEmpty()) {
if (!zoomToRect.IsEmpty()) {
// Intersect the zoom-to-rect to the CSS rect to make sure it fits.
aRect = aRect.Intersect(cssPageRect);
zoomToRect = zoomToRect.Intersect(cssPageRect);
float targetResolution =
std::min(compositionBounds.width / aRect.width,
compositionBounds.height / aRect.height);
std::min(compositionBounds.width / zoomToRect.width,
compositionBounds.height / zoomToRect.height);
targetZoom = targetResolution / intrinsicScale;
}
// 1. If the rect is empty, request received from browserElementScrolling.js
// 2. currentZoom is equal to mMaxZoom and user still double-tapping it
// 3. currentZoom is equal to localMinZoom and user still double-tapping it
// Treat these three cases as a request to zoom out as much as possible.
if (aRect.IsEmpty() ||
if (zoomToRect.IsEmpty() ||
(currentZoom == localMaxZoom && targetZoom >= localMaxZoom) ||
(currentZoom == localMinZoom && targetZoom <= localMinZoom)) {
CSSRect compositedRect = mFrameMetrics.CalculateCompositedRectInCssPixels();
@ -1297,14 +1299,14 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
cssPageRect.width * (compositedRect.height / compositedRect.width);
float dh = compositedRect.height - newHeight;
aRect = CSSRect(0.0f,
zoomToRect = CSSRect(0.0f,
y + dh/2,
cssPageRect.width,
newHeight);
aRect = aRect.Intersect(cssPageRect);
zoomToRect = zoomToRect.Intersect(cssPageRect);
float targetResolution =
std::min(compositionBounds.width / aRect.width,
compositionBounds.height / aRect.height);
std::min(compositionBounds.width / zoomToRect.width,
compositionBounds.height / zoomToRect.height);
targetZoom = targetResolution / intrinsicScale;
}
@ -1318,17 +1320,17 @@ void AsyncPanZoomController::ZoomToRect(CSSRect aRect) {
// If either of these conditions are met, the page will be
// overscrolled after zoomed
if (aRect.y + rectAfterZoom.height > cssPageRect.height) {
aRect.y = cssPageRect.height - rectAfterZoom.height;
aRect.y = aRect.y > 0 ? aRect.y : 0;
if (zoomToRect.y + rectAfterZoom.height > cssPageRect.height) {
zoomToRect.y = cssPageRect.height - rectAfterZoom.height;
zoomToRect.y = zoomToRect.y > 0 ? zoomToRect.y : 0;
}
if (aRect.x + rectAfterZoom.width > cssPageRect.width) {
aRect.x = cssPageRect.width - rectAfterZoom.width;
aRect.x = aRect.x > 0 ? aRect.x : 0;
if (zoomToRect.x + rectAfterZoom.width > cssPageRect.width) {
zoomToRect.x = cssPageRect.width - rectAfterZoom.width;
zoomToRect.x = zoomToRect.x > 0 ? zoomToRect.x : 0;
}
mStartZoomToMetrics = mFrameMetrics;
mEndZoomToMetrics.mScrollOffset = aRect.TopLeft();
mEndZoomToMetrics.mScrollOffset = zoomToRect.TopLeft();
mAnimationStartTime = GetFrameTime();

View File

@ -131,9 +131,9 @@ public:
/**
* Kicks an animation to zoom to a rect. This may be either a zoom out or zoom
* in. The actual animation is done on the compositor thread after being set
* up.
* up. |aRect| must be given in CSS pixels, relative to the document.
*/
void ZoomToRect(CSSRect aRect);
void ZoomToRect(const gfxRect& aRect);
/**
* If we have touch listeners, this should always be called when we know

View File

@ -964,7 +964,7 @@ RenderFrameParent::BuildDisplayList(nsDisplayListBuilder* aBuilder,
}
void
RenderFrameParent::ZoomToRect(const CSSRect& aRect)
RenderFrameParent::ZoomToRect(const gfxRect& aRect)
{
if (mPanZoomController) {
mPanZoomController->ZoomToRect(aRect);

View File

@ -98,7 +98,7 @@ public:
void NotifyDimensionsChanged(ScreenIntSize size);
void ZoomToRect(const CSSRect& aRect);
void ZoomToRect(const gfxRect& aRect);
void ContentReceivedTouch(bool aPreventDefault);