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 IPC::Principal;
using gfxMatrix; using gfxMatrix;
using gfxRect;
using gfxSize; using gfxSize;
using CSSRect;
using mozilla::layers::FrameMetrics; using mozilla::layers::FrameMetrics;
using mozilla::layout::ScrollingBehavior; using mozilla::layout::ScrollingBehavior;
using mozilla::void_t; using mozilla::void_t;
@ -264,7 +264,7 @@ parent:
* Instructs the TabParent to forward a request to zoom to a rect given in * Instructs the TabParent to forward a request to zoom to a rect given in
* CSS pixels. This rect is relative to the document. * 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 * 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<nsIDocShell> docShell(do_QueryInterface(aSubject));
nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell)); nsCOMPtr<nsITabChild> tabChild(GetTabChildFrom(docShell));
if (tabChild == this) { if (tabChild == this) {
CSSRect rect; gfxRect rect;
sscanf(NS_ConvertUTF16toUTF8(aData).get(), sscanf(NS_ConvertUTF16toUTF8(aData).get(),
"{\"x\":%lf,\"y\":%lf,\"w\":%lf,\"h\":%lf}", "{\"x\":%lf,\"y\":%lf,\"w\":%lf,\"h\":%lf}",
&rect.x, &rect.y, &rect.width, &rect.height); &rect.x, &rect.y, &rect.width, &rect.height);

View File

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

View File

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

View File

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

View File

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

View File

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