本文整理汇总了C++中nsIntRect::X方法的典型用法代码示例。如果您正苦于以下问题:C++ nsIntRect::X方法的具体用法?C++ nsIntRect::X怎么用?C++ nsIntRect::X使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsIntRect
的用法示例。
在下文中一共展示了nsIntRect::X方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cx
bool
TabChild::RecvUpdateFrame(const nsIntRect& aDisplayPort,
const nsIntPoint& aScrollOffset,
const gfxSize& aResolution,
const nsIntRect& aScreenSize)
{
if (!mCx || !mTabChildGlobal) {
return true;
}
nsCString data;
data += nsPrintfCString("{ \"x\" : %d", aScrollOffset.x);
data += nsPrintfCString(", \"y\" : %d", aScrollOffset.y);
// We don't treat the x and y scales any differently for this
// semi-platform-specific code.
data += nsPrintfCString(", \"zoom\" : %f", aResolution.width);
data += nsPrintfCString(", \"displayPort\" : ");
data += nsPrintfCString("{ \"left\" : %d", aDisplayPort.X());
data += nsPrintfCString(", \"top\" : %d", aDisplayPort.Y());
data += nsPrintfCString(", \"width\" : %d", aDisplayPort.Width());
data += nsPrintfCString(", \"height\" : %d", aDisplayPort.Height());
data += nsPrintfCString(", \"resolution\" : %f", aResolution.width);
data += nsPrintfCString(" }");
data += nsPrintfCString(", \"screenSize\" : ");
data += nsPrintfCString("{ \"width\" : %d", aScreenSize.width);
data += nsPrintfCString(", \"height\" : %d", aScreenSize.height);
data += nsPrintfCString(" }");
data += nsPrintfCString(" }");
jsval json = JSVAL_NULL;
StructuredCloneData cloneData;
JSAutoStructuredCloneBuffer buffer;
if (JS_ParseJSON(mCx,
static_cast<const jschar*>(NS_ConvertUTF8toUTF16(data).get()),
data.Length(),
&json)) {
WriteStructuredClone(mCx, json, buffer, cloneData.mClosure);
}
nsFrameScriptCx cx(static_cast<nsIWebBrowserChrome*>(this), this);
// Let the BrowserElementScrolling helper (if it exists) for this
// content manipulate the frame state.
nsRefPtr<nsFrameMessageManager> mm =
static_cast<nsFrameMessageManager*>(mTabChildGlobal->mMessageManager.get());
mm->ReceiveMessage(static_cast<nsIDOMEventTarget*>(mTabChildGlobal),
NS_LITERAL_STRING("Viewport:Change"), false,
&cloneData, nullptr, nullptr);
return true;
}
示例2: RotateRect
nsIntRect RotateRect(nsIntRect aRect,
const nsIntRect& aBounds,
ScreenRotation aRotation)
{
switch (aRotation) {
case ROTATION_0:
return aRect;
case ROTATION_90:
return nsIntRect(aRect.Y(),
aBounds.Width() - aRect.XMost(),
aRect.Height(), aRect.Width());
case ROTATION_180:
return nsIntRect(aBounds.Width() - aRect.XMost(),
aBounds.Height() - aRect.YMost(),
aRect.Width(), aRect.Height());
case ROTATION_270:
return nsIntRect(aBounds.Height() - aRect.YMost(),
aRect.X(),
aRect.Height(), aRect.Width());
default:
MOZ_CRASH("Unknown rotation");
}
}