зеркало из https://github.com/mozilla/gecko-dev.git
Bug 815671 part 6. Fixes to widget code to not copy arrays implicitly. r=jlebar
This commit is contained in:
Родитель
22f1c17e89
Коммит
06fae28e55
|
@ -655,11 +655,11 @@ public:
|
|||
int Action() { return mAction; }
|
||||
int Type() { return mType; }
|
||||
int64_t Time() { return mTime; }
|
||||
nsTArray<nsIntPoint> Points() { return mPoints; }
|
||||
nsTArray<int> PointIndicies() { return mPointIndicies; }
|
||||
nsTArray<float> Pressures() { return mPressures; }
|
||||
nsTArray<float> Orientations() { return mOrientations; }
|
||||
nsTArray<nsIntPoint> PointRadii() { return mPointRadii; }
|
||||
const nsTArray<nsIntPoint>& Points() { return mPoints; }
|
||||
const nsTArray<int>& PointIndicies() { return mPointIndicies; }
|
||||
const nsTArray<float>& Pressures() { return mPressures; }
|
||||
const nsTArray<float>& Orientations() { return mOrientations; }
|
||||
const nsTArray<nsIntPoint>& PointRadii() { return mPointRadii; }
|
||||
double X() { return mX; }
|
||||
double Y() { return mY; }
|
||||
double Z() { return mZ; }
|
||||
|
|
|
@ -71,7 +71,9 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsAppShell, nsBaseAppShell, nsIObserver)
|
|||
|
||||
class ScreenshotRunnable : public nsRunnable {
|
||||
public:
|
||||
ScreenshotRunnable(nsIAndroidBrowserApp* aBrowserApp, int aTabId, nsTArray<nsIntPoint>& aPoints, int aToken, RefCountedJavaObject* aBuffer):
|
||||
ScreenshotRunnable(nsIAndroidBrowserApp* aBrowserApp, int aTabId,
|
||||
const nsTArray<nsIntPoint>& aPoints, int aToken,
|
||||
RefCountedJavaObject* aBuffer):
|
||||
mBrowserApp(aBrowserApp), mPoints(aPoints), mTabId(aTabId), mToken(aToken), mBuffer(aBuffer) {}
|
||||
|
||||
virtual nsresult Run() {
|
||||
|
@ -506,7 +508,7 @@ nsAppShell::ProcessNextNativeEvent(bool mayWait)
|
|||
|
||||
int32_t token = curEvent->Flags();
|
||||
int32_t tabId = curEvent->MetaState();
|
||||
nsTArray<nsIntPoint> points = curEvent->Points();
|
||||
const nsTArray<nsIntPoint>& points = curEvent->Points();
|
||||
RefCountedJavaObject* buffer = curEvent->ByteBuffer();
|
||||
nsCOMPtr<ScreenshotRunnable> sr =
|
||||
new ScreenshotRunnable(mBrowserApp, tabId, points, token, buffer);
|
||||
|
|
|
@ -757,7 +757,7 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||
win->mChildren[i]->mBounds.height = 0;
|
||||
}
|
||||
case AndroidGeckoEvent::SIZE_CHANGED: {
|
||||
nsTArray<nsIntPoint> points = ae->Points();
|
||||
const nsTArray<nsIntPoint>& points = ae->Points();
|
||||
NS_ASSERTION(points.Length() == 2, "Size changed does not have enough coordinates");
|
||||
|
||||
int nw = points[0].x;
|
||||
|
@ -827,7 +827,7 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||
win->UserActivity();
|
||||
if (!gTopLevelWindows.IsEmpty()) {
|
||||
nsIntPoint pt(0,0);
|
||||
nsTArray<nsIntPoint> points = ae->Points();
|
||||
const nsTArray<nsIntPoint>& points = ae->Points();
|
||||
if (points.Length() > 0) {
|
||||
pt = points[0];
|
||||
}
|
||||
|
@ -852,7 +852,7 @@ nsWindow::OnGlobalAndroidEvent(AndroidGeckoEvent *ae)
|
|||
|
||||
case AndroidGeckoEvent::NATIVE_GESTURE_EVENT: {
|
||||
nsIntPoint pt(0,0);
|
||||
nsTArray<nsIntPoint> points = ae->Points();
|
||||
const nsTArray<nsIntPoint>& points = ae->Points();
|
||||
if (points.Length() > 0) {
|
||||
pt = points[0];
|
||||
}
|
||||
|
|
|
@ -6982,15 +6982,13 @@ CreateHRGNFromArray(const nsTArray<nsIntRect>& aRects)
|
|||
return ::ExtCreateRegion(NULL, buf.Length(), data);
|
||||
}
|
||||
|
||||
static const nsTArray<nsIntRect>
|
||||
ArrayFromRegion(const nsIntRegion& aRegion)
|
||||
static void
|
||||
ArrayFromRegion(const nsIntRegion& aRegion, nsTArray<nsIntRect>& aRects)
|
||||
{
|
||||
nsTArray<nsIntRect> rects;
|
||||
const nsIntRect* r;
|
||||
for (nsIntRegionRectIterator iter(aRegion); (r = iter.Next());) {
|
||||
rects.AppendElement(*r);
|
||||
aRects.AppendElement(*r);
|
||||
}
|
||||
return rects;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -7020,7 +7018,8 @@ nsWindow::SetWindowClipRegion(const nsTArray<nsIntRect>& aRects,
|
|||
nsIntRegion intersection;
|
||||
intersection.And(currentRegion, newRegion);
|
||||
// create int rect array from intersection
|
||||
nsTArray<nsIntRect> rects = ArrayFromRegion(intersection);
|
||||
nsTArray<nsIntRect> rects;
|
||||
ArrayFromRegion(intersection, rects);
|
||||
// store
|
||||
if (!StoreWindowClipRegion(rects))
|
||||
return NS_OK;
|
||||
|
|
Загрузка…
Ссылка в новой задаче