Skip to content

Commit

Permalink
Merge branch 'embedlite' into embedlite_upgrade
Browse files Browse the repository at this point in the history
  • Loading branch information
tmeshkova committed Feb 4, 2014
2 parents 7c7b359 + 4a809a2 commit 3d0279e
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 32 deletions.
23 changes: 18 additions & 5 deletions embedding/embedlite/embedthread/EmbedContentController.cpp
Expand Up @@ -22,6 +22,7 @@ static FakeListener sFakeListener;
EmbedContentController::EmbedContentController(EmbedLiteViewThreadParent* aRenderFrame, MessageLoop* aUILoop)
: mUILoop(aUILoop)
, mRenderFrame(aRenderFrame)
, mHaveZoomConstraints(false)
{
}

Expand Down Expand Up @@ -139,11 +140,16 @@ void EmbedContentController::ClearRenderFrame()
bool EmbedContentController::GetRootZoomConstraints(ZoomConstraints* aOutConstraints)
{
if (aOutConstraints) {
// Until we support the meta-viewport tag properly allow zooming
// from 1/4 to 4x by default.
aOutConstraints->mAllowZoom = true;
aOutConstraints->mMinZoom = CSSToScreenScale(0.25f);
aOutConstraints->mMaxZoom = CSSToScreenScale(4.0f);
if (mHaveZoomConstraints) {
*aOutConstraints = mZoomConstraints;
} else {
NS_WARNING("Apply default zoom constraints");
// Until we support the meta-viewport tag properly allow zooming
// from 1/4 to 4x by default.
aOutConstraints->mAllowZoom = true;
aOutConstraints->mMinZoom = CSSToScreenScale(0.25f);
aOutConstraints->mMaxZoom = CSSToScreenScale(4.0f);
}
return true;
}
return false;
Expand Down Expand Up @@ -181,3 +187,10 @@ EmbedContentController::ReceiveInputEvent(const InputData& aEvent,

return mAPZC->ReceiveInputEvent(aEvent, aOutTargetGuid);
}

void
EmbedContentController::SaveZoomConstraints(const ZoomConstraints& aConstraints)
{
mHaveZoomConstraints = true;
mZoomConstraints = aConstraints;
}
9 changes: 8 additions & 1 deletion embedding/embedlite/embedthread/EmbedContentController.h
Expand Up @@ -13,7 +13,6 @@
namespace mozilla {
namespace layers {
class APZCTreeManager;
class CompositorParent;
}
namespace embedlite {
class EmbedLiteViewListener;
Expand Down Expand Up @@ -52,13 +51,21 @@ class EmbedContentController : public mozilla::layers::GeckoContentController
ScrollableLayerGuid* aOutTargetGuid);

mozilla::layers::APZCTreeManager* GetManager() { return mAPZC; }

// Methods used by EmbedLiteViewThreadParent to set fields stored here.

void SaveZoomConstraints(const ZoomConstraints& aConstraints);

private:
EmbedLiteViewListener* const GetListener() const;
void DoRequestContentRepaint(const FrameMetrics& aFrameMetrics);

MessageLoop* mUILoop;
EmbedLiteViewThreadParent* mRenderFrame;

bool mHaveZoomConstraints;
ZoomConstraints mZoomConstraints;

// Extra
ScrollableLayerGuid mLastScrollLayerGuid;
CSSIntPoint mLastScrollOffset;
Expand Down
3 changes: 3 additions & 0 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadChild.cpp
Expand Up @@ -499,10 +499,13 @@ EmbedLiteViewThreadChild::RecvSetViewSize(const gfxSize& aSize)
}

mHelper->mInnerSize = ScreenIntSize::FromUnknownSize(gfx::IntSize(aSize.width, aSize.height));
mWidget->Resize(0, 0, aSize.width, aSize.height, true);
nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(mWebBrowser);
baseWindow->SetPositionAndSize(0, 0, mViewSize.width, mViewSize.height, true);
baseWindow->SetVisibility(true);

mHelper->HandlePossibleViewportChange();

return true;
}

Expand Down
8 changes: 6 additions & 2 deletions embedding/embedlite/embedthread/EmbedLiteViewThreadParent.cpp
Expand Up @@ -265,8 +265,12 @@ EmbedLiteViewThreadParent::RecvUpdateZoomConstraints(const uint32_t& aPresShellI
const bool& aIsRoot,
const ZoomConstraints& aConstraints)
{
if (aIsRoot) {
mController->SaveZoomConstraints(aConstraints);
}

if (mController->GetManager()) {
mController->GetManager()->UpdateZoomConstraints(ScrollableLayerGuid(mRootLayerTreeId, 0, 0), aConstraints);
mController->GetManager()->UpdateZoomConstraints(ScrollableLayerGuid(mRootLayerTreeId, aPresShellId, aViewId), aConstraints);
}
return true;
}
Expand All @@ -277,7 +281,7 @@ EmbedLiteViewThreadParent::RecvZoomToRect(const uint32_t& aPresShellId,
const CSSRect& aRect)
{
if (mController->GetManager()) {
mController->GetManager()->ZoomToRect(ScrollableLayerGuid(mRootLayerTreeId, 0, 0), aRect);
mController->GetManager()->ZoomToRect(ScrollableLayerGuid(mRootLayerTreeId, aPresShellId, aViewId), aRect);
}
return true;
}
Expand Down
53 changes: 33 additions & 20 deletions embedding/embedlite/utils/TabChildHelper.cpp
Expand Up @@ -206,17 +206,20 @@ TabChildHelper::Observe(nsISupports* aSubject,
const char16_t* aData)
{
if (!strcmp(aTopic, BROWSER_ZOOM_TO_RECT)) {
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(aSubject));
CSSRect rect;
sscanf(NS_ConvertUTF16toUTF8(aData).get(),
"{\"x\":%f,\"y\":%f,\"w\":%f,\"h\":%f}",
&rect.x, &rect.y, &rect.width, &rect.height);
mView->SendZoomToRect(0, 0, rect);
nsCOMPtr<nsIDocument> doc(GetDocument());
uint32_t presShellId;
ViewID viewId;
if (APZCCallbackHelper::GetScrollIdentifiers(doc->GetDocumentElement(),
&presShellId, &viewId)) {
CSSRect rect;
sscanf(NS_ConvertUTF16toUTF8(aData).get(),
"{\"x\":%f,\"y\":%f,\"w\":%f,\"h\":%f}",
&rect.x, &rect.y, &rect.width, &rect.height);
mView->SendZoomToRect(presShellId, viewId, rect);
}
} else if (!strcmp(aTopic, BEFORE_FIRST_PAINT)) {
nsCOMPtr<nsIDocument> subject(do_QueryInterface(aSubject));
nsCOMPtr<nsIDOMDocument> domDoc;
mView->mWebNavigation->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
nsCOMPtr<nsIDocument> doc(GetDocument());

if (SameCOMIdentity(subject, doc)) {
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());
Expand Down Expand Up @@ -772,24 +775,25 @@ TabChildHelper::HandlePossibleViewportChange()
if (sDisableViewportHandler) {
return false;
}
nsCOMPtr<nsIDOMDocument> domDoc;
mView->mWebNavigation->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> document(do_QueryInterface(domDoc));

nsCOMPtr<nsIDocument> document(GetDocument());
nsCOMPtr<nsIDOMWindowUtils> utils(GetDOMWindowUtils());

nsViewportInfo viewportInfo = nsContentUtils::GetViewportInfo(document, mInnerSize);
uint32_t presShellId = 0;

nsIContent* content = document->GetDocumentElement();
ViewID viewId = 0;
if (APZCCallbackHelper::GetScrollIdentifiers(document->GetDocumentElement(),
&presShellId, &viewId)) {
ZoomConstraints constraints(viewportInfo.IsZoomAllowed(),
viewportInfo.GetMinZoom(),
viewportInfo.GetMaxZoom());
mView->SendUpdateZoomConstraints(0, 0, true, constraints);
if (content) {
uint32_t presShellId = 0;
viewId = nsLayoutUtils::FindOrCreateIDFor(content);
if (utils && (utils->GetPresShellId(&presShellId) == NS_OK)) {
ZoomConstraints constraints(viewportInfo.IsZoomAllowed(),
viewportInfo.GetMinZoom(),
viewportInfo.GetMaxZoom());
mView->SendUpdateZoomConstraints(presShellId, viewId, /* isRoot = */ true, constraints);
}
}


float screenW = mInnerSize.width;
float screenH = mInnerSize.height;
CSSSize viewport(viewportInfo.GetSize());
Expand Down Expand Up @@ -896,3 +900,12 @@ TabChildHelper::HandlePossibleViewportChange()
mFrameMetrics = metrics;
return true;
}

already_AddRefed<nsIDocument>
TabChildHelper::GetDocument()
{
nsCOMPtr<nsIDOMDocument> domDoc;
mView->mWebNavigation->GetDocument(getter_AddRefs(domDoc));
nsCOMPtr<nsIDocument> doc(do_QueryInterface(domDoc));
return doc.forget();
}
3 changes: 3 additions & 0 deletions embedding/embedlite/utils/TabChildHelper.h
Expand Up @@ -14,6 +14,7 @@
#include "InputData.h"
#include "nsDataHashtable.h"
#include "nsIDOMEventListener.h"
#include "nsIDocument.h"

class CancelableTask;
class nsPresContext;
Expand Down Expand Up @@ -85,6 +86,8 @@ class TabChildHelper : public nsIDOMEventListener,

// Get the DOMWindowUtils for the top-level window in this tab.
already_AddRefed<nsIDOMWindowUtils> GetDOMWindowUtils();
// Get the Document for the top-level window in this tab.
already_AddRefed<nsIDocument> GetDocument();

// Wrapper for nsIDOMWindowUtils.setCSSViewport(). This updates some state
// variables local to this class before setting it.
Expand Down
4 changes: 2 additions & 2 deletions gfx/gl/GLContextProviderEGL.cpp
Expand Up @@ -205,9 +205,9 @@ CreateSurfaceForWindow(nsIWidget* widget, const EGLConfig& config) {
}
#else
MOZ_ASSERT(widget != nullptr);
#ifndef MOZ_WIDGET_QT

newSurface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, GET_NATIVE_WINDOW(widget), 0);
#endif

#ifdef MOZ_WIDGET_GONK
gScreenBounds.x = 0;
gScreenBounds.y = 0;
Expand Down
17 changes: 15 additions & 2 deletions js/src/jit/arm/MacroAssembler-arm.cpp
Expand Up @@ -3529,14 +3529,24 @@ MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
FloatRegister fr;
if (GetFloatArgReg(usedIntSlots_, usedFloatSlots_, &fr)) {
if (from.isFloatReg() && from.floatReg() == fr) {
usedFloatSlots_++;
if (type == MoveOp::FLOAT32)
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_Float32;
else
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_Double;
break;
// Nothing to do; the value is in the right register already
return;
}
to = MoveOperand(fr);
} else {
// If (and only if) the integer registers have started spilling, do we
// need to take the register's alignment into account
uint32_t disp = GetDoubleArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
uint32_t disp;
if (type == MoveOp::FLOAT32)
disp = GetFloat32ArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
else
disp = GetDoubleArgStackDisp(usedIntSlots_, usedFloatSlots_, &padding_);
to = MoveOperand(sp, disp);
}
usedFloatSlots_++;
Expand All @@ -3550,7 +3560,10 @@ MacroAssemblerARMCompat::passABIArg(const MoveOperand &from, MoveOp::Type type)
Register r;
if (GetIntArgReg(usedIntSlots_, usedFloatSlots_, &r)) {
if (from.isGeneralReg() && from.reg() == r) {
// Nothing to do; the value is in the right register already
// Almost nothing to do; the value is in the right register already
usedIntSlots_++;
passedArgTypes_ = (passedArgTypes_ << ArgType_Shift) | ArgType_General;

return;
}
to = MoveOperand(r);
Expand Down

0 comments on commit 3d0279e

Please sign in to comment.