Merge mozilla-central and b2g-inbound

This commit is contained in:
Ed Morley 2013-08-15 13:37:27 +01:00
commit 6317bd519a
4 changed files with 70 additions and 23 deletions

View File

@ -1,4 +1,4 @@
{ {
"revision": "4194b54f00c29a3e7fd9bf50391f3f042982d940", "revision": "f4bf404a0aa81269d7ba9393008f4b72c0ef0b18",
"repo_path": "/integration/gaia-central" "repo_path": "/integration/gaia-central"
} }

View File

@ -140,7 +140,10 @@ class ResourceUriFileReader:
@classmethod @classmethod
def get_uri(cls, filename): def get_uri(cls, filename):
"""Convert filename to URI in system.""" """Convert filename to URI in system."""
return cls.URI_PREFIX + cls.URI_PATH[filename] if filename.startswith(cls.URI_PREFIX):
return filename
else:
return cls.URI_PREFIX + cls.URI_PATH[filename]
def __init__(self, marionette): def __init__(self, marionette):
self.runjs = lambda x: marionette.execute_script(x, new_sandbox=False) self.runjs = lambda x: marionette.execute_script(x, new_sandbox=False)
@ -278,13 +281,15 @@ class Linter:
# Maintain a mapping table. # Maintain a mapping table.
# New line number after merge => original file and line number. # New line number after merge => original file and line number.
info.append((dst_line, filepath, 1)) info.append((dst_line, filepath, 1))
try:
code = self.code_reader.read_file(filepath) code = self.code_reader.read_file(filepath)
lines = code.splitlines(True) # Keep '\n'. lines = code.splitlines(True) # Keep '\n'.
src_results = StringUtility.auto_wrap_strict_mode( src_results = StringUtility.auto_wrap_strict_mode(
StringUtility.auto_close(lines)) StringUtility.auto_close(lines))
dst_results.extend(src_results) dst_results.extend(src_results)
dst_line += len(src_results) dst_line += len(src_results)
except:
info.pop()
return dst_results, info return dst_results, info
def _convert_merged_result(self, error_lines, line_info): def _convert_merged_result(self, error_lines, line_info):

View File

@ -6,6 +6,8 @@
#include "gtest/gtest.h" #include "gtest/gtest.h"
#include "gmock/gmock.h" #include "gmock/gmock.h"
#include "mozilla/Attributes.h"
#include "mozilla/gfx/Tools.h" // For NudgeToInteger
#include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform #include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform
#include "mozilla/layers/AsyncPanZoomController.h" #include "mozilla/layers/AsyncPanZoomController.h"
#include "mozilla/layers/LayerManagerComposite.h" #include "mozilla/layers/LayerManagerComposite.h"
@ -365,6 +367,20 @@ SetScrollableFrameMetrics(Layer* aLayer, FrameMetrics::ViewID aScrollId, MockCon
EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1); EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(1);
} }
static gfxPoint
NudgeToIntegers(const gfxPoint& aPoint)
{
// gfxPoint has doubles but NudgeToInteger takes
// floats so use local vars. The loss in precision
// shouldn't affect this because these are supposed
// to be integers anyway.
float x = aPoint.x;
float y = aPoint.y;
NudgeToInteger(&x);
NudgeToInteger(&y);
return gfxPoint(x, y);
}
TEST(APZCTreeManager, GetAPZCAtPoint) { TEST(APZCTreeManager, GetAPZCAtPoint) {
nsTArray<nsRefPtr<Layer> > layers; nsTArray<nsRefPtr<Layer> > layers;
nsRefPtr<LayerManager> lm; nsRefPtr<LayerManager> lm;
@ -376,70 +392,91 @@ TEST(APZCTreeManager, GetAPZCAtPoint) {
ScopedLayerTreeRegistration controller(0, root, mcc); ScopedLayerTreeRegistration controller(0, root, mcc);
nsRefPtr<APZCTreeManager> manager = new TestAPZCTreeManager(); nsRefPtr<APZCTreeManager> manager = new TestAPZCTreeManager();
gfx3DMatrix matrix; gfx3DMatrix transformToApzc;
gfx3DMatrix transformToScreen;
// No APZC attached so hit testing will return no APZC at (20,20) // No APZC attached so hit testing will return no APZC at (20,20)
nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(ScreenPoint(20, 20), matrix, matrix); nsRefPtr<AsyncPanZoomController> hit = manager->GetTargetAPZC(ScreenPoint(20, 20), transformToApzc, transformToScreen);
AsyncPanZoomController* nullAPZC = nullptr; AsyncPanZoomController* nullAPZC = nullptr;
EXPECT_EQ(nullAPZC, hit.get()); EXPECT_EQ(nullAPZC, hit.get());
EXPECT_EQ(gfx3DMatrix(), transformToApzc);
EXPECT_EQ(gfx3DMatrix(), transformToScreen);
// Now we have a root APZC that will match the page // Now we have a root APZC that will match the page
SetScrollableFrameMetrics(root, FrameMetrics::ROOT_SCROLL_ID, mcc); SetScrollableFrameMetrics(root, FrameMetrics::ROOT_SCROLL_ID, mcc);
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false); manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
hit = manager->GetTargetAPZC(ScreenPoint(15, 15), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(15, 15), transformToApzc, transformToScreen);
EXPECT_EQ(root->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(root->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerIntPoint(15, 15) // expect hit point at LayerIntPoint(15, 15)
EXPECT_EQ(gfxPoint(15, 15), transformToApzc.Transform(gfxPoint(15, 15)));
EXPECT_EQ(gfxPoint(15, 15), transformToScreen.Transform(gfxPoint(15, 15)));
// Now we have a sub APZC with a better fit // Now we have a sub APZC with a better fit
SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID, mcc); SetScrollableFrameMetrics(layers[3], FrameMetrics::START_SCROLL_ID, mcc);
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false); manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
EXPECT_NE(root->AsContainerLayer()->GetAsyncPanZoomController(), layers[3]->AsContainerLayer()->GetAsyncPanZoomController()); EXPECT_NE(root->AsContainerLayer()->GetAsyncPanZoomController(), layers[3]->AsContainerLayer()->GetAsyncPanZoomController());
hit = manager->GetTargetAPZC(ScreenPoint(15, 15), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(15, 15), transformToApzc, transformToScreen);
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerIntPoint(15, 15) // expect hit point at LayerIntPoint(15, 15)
EXPECT_EQ(gfxPoint(15, 15), transformToApzc.Transform(gfxPoint(15, 15)));
EXPECT_EQ(gfxPoint(15, 15), transformToScreen.Transform(gfxPoint(15, 15)));
// Now test hit testing when we have two scrollable layers // Now test hit testing when we have two scrollable layers
hit = manager->GetTargetAPZC(ScreenPoint(15, 15), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(15, 15), transformToApzc, transformToScreen);
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 1, mcc); SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 1, mcc);
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false); manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
hit = manager->GetTargetAPZC(ScreenPoint(15, 15), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(15, 15), transformToApzc, transformToScreen);
EXPECT_EQ(layers[4]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(layers[4]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerIntPoint(15, 15) // expect hit point at LayerIntPoint(15, 15)
EXPECT_EQ(gfxPoint(15, 15), transformToApzc.Transform(gfxPoint(15, 15)));
EXPECT_EQ(gfxPoint(15, 15), transformToScreen.Transform(gfxPoint(15, 15)));
// Hit test ouside the reach of layer[3,4] but inside root // Hit test ouside the reach of layer[3,4] but inside root
hit = manager->GetTargetAPZC(ScreenPoint(90, 90), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(90, 90), transformToApzc, transformToScreen);
EXPECT_EQ(root->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(root->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerIntPoint(90, 90) // expect hit point at LayerIntPoint(90, 90)
EXPECT_EQ(gfxPoint(90, 90), transformToApzc.Transform(gfxPoint(90, 90)));
EXPECT_EQ(gfxPoint(90, 90), transformToScreen.Transform(gfxPoint(90, 90)));
// Hit test ouside the reach of any layer // Hit test ouside the reach of any layer
hit = manager->GetTargetAPZC(ScreenPoint(1000, 10), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(1000, 10), transformToApzc, transformToScreen);
EXPECT_EQ(nullAPZC, hit.get()); EXPECT_EQ(nullAPZC, hit.get());
hit = manager->GetTargetAPZC(ScreenPoint(-1000, 10), matrix, matrix); EXPECT_EQ(gfx3DMatrix(), transformToApzc);
EXPECT_EQ(gfx3DMatrix(), transformToScreen);
hit = manager->GetTargetAPZC(ScreenPoint(-1000, 10), transformToApzc, transformToScreen);
EXPECT_EQ(nullAPZC, hit.get()); EXPECT_EQ(nullAPZC, hit.get());
EXPECT_EQ(gfx3DMatrix(), transformToApzc);
EXPECT_EQ(gfx3DMatrix(), transformToScreen);
// Test layer transform // Test layer transform
gfx3DMatrix transform; gfx3DMatrix transform;
transform.ScalePost(0.1, 0.1, 1); transform.ScalePost(0.1, 0.1, 1);
root->SetBaseTransform(transform); root->SetBaseTransform(transform);
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false); manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
hit = manager->GetTargetAPZC(ScreenPoint(50, 50), matrix, matrix); // This point is now outside the root layer hit = manager->GetTargetAPZC(ScreenPoint(50, 50), transformToApzc, transformToScreen); // This point is now outside the root layer
EXPECT_EQ(nullAPZC, hit.get()); EXPECT_EQ(nullAPZC, hit.get());
EXPECT_EQ(gfx3DMatrix(), transformToApzc);
EXPECT_EQ(gfx3DMatrix(), transformToScreen);
// This hit test will hit both layers[3] and layers[4]; layers[4] is later in the tree so // This hit test will hit both layers[3] and layers[4]; layers[4] is later in the tree so
// it is a better match // it is a better match
hit = manager->GetTargetAPZC(ScreenPoint(2, 2), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(2, 2), transformToApzc, transformToScreen);
EXPECT_EQ(layers[4]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(layers[4]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerPoint(20, 20) // expect hit point at LayerPoint(20, 20)
EXPECT_EQ(gfxPoint(20, 20), NudgeToIntegers(transformToApzc.Transform(gfxPoint(2, 2))));
EXPECT_EQ(gfxPoint(2, 2), NudgeToIntegers(transformToScreen.Transform(gfxPoint(20, 20))));
// Scale layer[4] outside the range // Scale layer[4] outside the range
layers[4]->SetBaseTransform(transform); layers[4]->SetBaseTransform(transform);
// layer 4 effective visible screenrect: (0.05, 0.05, 0.2, 0.2) // layer 4 effective visible screenrect: (0.05, 0.05, 0.2, 0.2)
// Does not contain (2, 2) // Does not contain (2, 2)
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false); manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
hit = manager->GetTargetAPZC(ScreenPoint(2, 2), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(2, 2), transformToApzc, transformToScreen);
EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(layers[3]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerPoint(20, 20) // expect hit point at LayerPoint(20, 20)
EXPECT_EQ(gfxPoint(20, 20), NudgeToIntegers(transformToApzc.Transform(gfxPoint(2, 2))));
EXPECT_EQ(gfxPoint(2, 2), NudgeToIntegers(transformToScreen.Transform(gfxPoint(20, 20))));
// Transformation chain to layer 7 // Transformation chain to layer 7
SetScrollableFrameMetrics(layers[7], FrameMetrics::START_SCROLL_ID + 2, mcc); SetScrollableFrameMetrics(layers[7], FrameMetrics::START_SCROLL_ID + 2, mcc);
@ -458,9 +495,11 @@ TEST(APZCTreeManager, GetAPZCAtPoint) {
manager->UpdatePanZoomControllerTree(nullptr, root, 0, false); manager->UpdatePanZoomControllerTree(nullptr, root, 0, false);
// layer 7 effective visible screenrect (0,16,4,60) but clipped by parent layers // layer 7 effective visible screenrect (0,16,4,60) but clipped by parent layers
hit = manager->GetTargetAPZC(ScreenPoint(1, 45), matrix, matrix); hit = manager->GetTargetAPZC(ScreenPoint(1, 45), transformToApzc, transformToScreen);
EXPECT_EQ(layers[7]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get()); EXPECT_EQ(layers[7]->AsContainerLayer()->GetAsyncPanZoomController(), hit.get());
// expect hit point at LayerPoint(20, 29) // expect hit point at LayerPoint(20, 440), which is CSSPoint(20, 29)
EXPECT_EQ(gfxPoint(20, 440), NudgeToIntegers(transformToApzc.Transform(gfxPoint(1, 45))));
EXPECT_EQ(gfxPoint(1, 45), NudgeToIntegers(transformToScreen.Transform(gfxPoint(20, 440))));
manager->ClearTree(); manager->ClearTree();
} }

View File

@ -540,6 +540,9 @@ def main(args=sys.argv[1:]):
auto.setRemoteLog(options.remoteLogFile) auto.setRemoteLog(options.remoteLogFile)
auto.setServerInfo(options.webServer, options.httpPort, options.sslPort) auto.setServerInfo(options.webServer, options.httpPort, options.sslPort)
# Hack in a symbolic link for jsreftest
os.system("ln -s %s %s" % (os.path.join('..', 'jsreftest'), os.path.join(SCRIPT_DIRECTORY, 'jsreftest')))
# Dynamically build the reftest URL if possible, beware that args[0] should exist 'inside' the webroot # Dynamically build the reftest URL if possible, beware that args[0] should exist 'inside' the webroot
manifest = args[0] manifest = args[0]
if os.path.exists(os.path.join(SCRIPT_DIRECTORY, args[0])): if os.path.exists(os.path.join(SCRIPT_DIRECTORY, args[0])):