Merge inbound to m-c

This commit is contained in:
Wes Kocher 2014-02-18 21:02:55 -08:00
commit c780152324
7 changed files with 124 additions and 55 deletions

View File

@ -13,6 +13,7 @@
#include "MacIOSurface.h"
#include "FilterNodeSoftware.h"
#include "mozilla/Assertions.h"
#include "mozilla/FloatingPoint.h"
using namespace std;
@ -413,6 +414,8 @@ UpdateLinearParametersToIncludePoint(double *min_t, double *max_t,
double dx, double dy,
double x, double y)
{
MOZ_ASSERT(IsFinite(x) && IsFinite(y));
/**
* Compute a parameter t such that a line perpendicular to the (dx,dy)
* vector, passing through (start->x + dx*t, start->y + dy*t), also
@ -609,6 +612,10 @@ DrawRadialRepeatingGradient(CGContextRef cg, const RadialGradientPattern &aPatte
static void
DrawGradient(CGContextRef cg, const Pattern &aPattern, const CGRect &aExtents)
{
if (CGRectIsEmpty(aExtents)) {
return;
}
if (aPattern.GetType() == PatternType::LINEAR_GRADIENT) {
const LinearGradientPattern& pat = static_cast<const LinearGradientPattern&>(aPattern);
GradientStopsCG *stops = static_cast<GradientStopsCG*>(pat.mStops.get());

View File

@ -813,9 +813,13 @@ ContainerLayer::RepositionChild(Layer* aChild, Layer* aAfter)
}
if (prev) {
prev->SetNextSibling(next);
} else {
mFirstChild = next;
}
if (next) {
next->SetPrevSibling(prev);
} else {
mLastChild = prev;
}
if (!aAfter) {
aChild->SetPrevSibling(nullptr);

View File

@ -51,33 +51,6 @@ public:
virtual void ComputeEffectiveTransforms(const Matrix4x4& aTransformToSurface) {
DefaultComputeEffectiveTransforms(aTransformToSurface);
}
virtual void RepositionChild(Layer* aChild, Layer* aAfter) {
MOZ_CRASH();
}
virtual void InsertAfter(Layer* aChild, Layer* aAfter) {
// Bad implementation but it should be fine for testing
if (this == aChild) {
MOZ_CRASH();
}
if (aAfter != nullptr && aAfter != mLastChild) {
// Fix the implementation to support this if you need it
MOZ_CRASH();
}
if (!mFirstChild) {
mFirstChild = aChild;
}
if (mLastChild) {
mLastChild->SetNextSibling(aChild);
}
aChild->SetPrevSibling(mLastChild);
mLastChild = aChild;
}
virtual void RemoveChild(Layer* aChild) {
MOZ_CRASH();
}
};
class TestThebesLayer: public ThebesLayer {
@ -217,10 +190,14 @@ already_AddRefed<Layer> CreateLayerTree(
lastLayer = nullptr;
} else {
nsRefPtr<Layer> layer = CreateLayer(aLayerTreeDescription[i], manager.get());
layer->SetVisibleRegion(aVisibleRegions[layerNumber]);
Matrix4x4 transform;
ToMatrix4x4(aTransforms[layerNumber], transform);
layer->SetBaseTransform(transform);
if (aVisibleRegions) {
layer->SetVisibleRegion(aVisibleRegions[layerNumber]);
}
if (aTransforms) {
Matrix4x4 transform;
ToMatrix4x4(aTransforms[layerNumber], transform);
layer->SetBaseTransform(transform);
}
aLayersOut.AppendElement(layer);
layerNumber++;
if (rootLayer && !parentContainerLayer) {
@ -230,7 +207,7 @@ already_AddRefed<Layer> CreateLayerTree(
rootLayer = layer;
}
if (parentContainerLayer) {
parentContainerLayer->InsertAfter(layer, nullptr);
parentContainerLayer->InsertAfter(layer, parentContainerLayer->GetLastChild());
layer->SetParent(parentContainerLayer);
}
lastLayer = layer;
@ -270,3 +247,80 @@ TEST(Layers, LayerTree) {
ASSERT_NE(nullLayer, layers[3]->AsThebesLayer());
}
static void ValidateTreePointers(Layer* aLayer) {
if (aLayer->GetNextSibling()) {
ASSERT_EQ(aLayer, aLayer->GetNextSibling()->GetPrevSibling());
} else if (aLayer->GetParent()) {
ASSERT_EQ(aLayer, aLayer->GetParent()->GetLastChild());
}
if (aLayer->GetPrevSibling()) {
ASSERT_EQ(aLayer, aLayer->GetPrevSibling()->GetNextSibling());
} else if (aLayer->GetParent()) {
ASSERT_EQ(aLayer, aLayer->GetParent()->GetFirstChild());
}
if (aLayer->GetFirstChild()) {
ASSERT_EQ(aLayer, aLayer->GetFirstChild()->GetParent());
}
if (aLayer->GetLastChild()) {
ASSERT_EQ(aLayer, aLayer->GetLastChild()->GetParent());
}
}
static void ValidateTreePointers(nsTArray<nsRefPtr<Layer> >& aLayers) {
for (uint32_t i = 0; i < aLayers.Length(); i++) {
ValidateTreePointers(aLayers[i]);
}
}
TEST(Layers, RepositionChild) {
const char* layerTreeSyntax = "c(ttt)";
nsTArray<nsRefPtr<Layer> > layers;
nsRefPtr<LayerManager> lm;
nsRefPtr<Layer> root = CreateLayerTree(layerTreeSyntax, nullptr, nullptr, lm, layers);
ContainerLayer* parent = root->AsContainerLayer();
ValidateTreePointers(layers);
// tree is currently like this (using indexes into layers):
// 0
// 1 2 3
ASSERT_EQ(layers[2], layers[1]->GetNextSibling());
ASSERT_EQ(layers[3], layers[2]->GetNextSibling());
ASSERT_EQ(nullptr, layers[3]->GetNextSibling());
parent->RepositionChild(layers[1], layers[3]);
ValidateTreePointers(layers);
// now the tree is like this:
// 0
// 2 3 1
ASSERT_EQ(layers[3], layers[2]->GetNextSibling());
ASSERT_EQ(layers[1], layers[3]->GetNextSibling());
ASSERT_EQ(nullptr, layers[1]->GetNextSibling());
parent->RepositionChild(layers[3], layers[2]);
ValidateTreePointers(layers);
// no change
ASSERT_EQ(layers[3], layers[2]->GetNextSibling());
ASSERT_EQ(layers[1], layers[3]->GetNextSibling());
ASSERT_EQ(nullptr, layers[1]->GetNextSibling());
parent->RepositionChild(layers[3], layers[1]);
ValidateTreePointers(layers);
// 0
// 2 1 3
ASSERT_EQ(layers[1], layers[2]->GetNextSibling());
ASSERT_EQ(layers[3], layers[1]->GetNextSibling());
ASSERT_EQ(nullptr, layers[3]->GetNextSibling());
parent->RepositionChild(layers[3], nullptr);
ValidateTreePointers(layers);
// 0
// 3 2 1
ASSERT_EQ(layers[2], layers[3]->GetNextSibling());
ASSERT_EQ(layers[1], layers[2]->GetNextSibling());
ASSERT_EQ(nullptr, layers[1]->GetNextSibling());
}

View File

@ -891,7 +891,6 @@ input[type="number"] {
width: 149px; /* to match type=text */
}
input[type=number] > div, /* work around bug 946184 */
input[type=number]::-moz-number-wrapper {
/* Prevent styling that would change the type of frame we construct. */
display: flex;
@ -900,7 +899,6 @@ input[type=number]::-moz-number-wrapper {
height: 100%;
}
input[type=number] > div > input, /* work around bug 946184 */
input[type=number]::-moz-number-text {
-moz-appearance: none;
/* work around autofocus bug 939248 on initial load */
@ -918,7 +916,6 @@ input[type=number]::-moz-number-text {
margin: 0;
}
input[type=number] > div > div, /* work around bug 946184 */
input[type=number]::-moz-number-spin-box {
display: flex;
flex-direction: column;
@ -933,7 +930,6 @@ input[type=number]::-moz-number-spin-box {
justify-content: center;
}
input[type=number] > div > div > div:first-child, /* work around bug 946184 */
input[type=number]::-moz-number-spin-up {
-moz-appearance: spinner-upbutton;
display: block; /* bug 926670 */
@ -949,7 +945,6 @@ input[type=number]::-moz-number-spin-up {
border-top-right-radius: 4px;
}
input[type=number] > div > div > div:not(:first-child), /* work around bug 946184 */
input[type=number]::-moz-number-spin-down {
-moz-appearance: spinner-downbutton;
display: block; /* bug 926670 */

View File

@ -23,16 +23,22 @@ from emulator_geo import EmulatorGeo
from emulator_screen import EmulatorScreen
class LogcatProc(ProcessHandlerMixin):
"""Process handler for logcat which saves all output to a logfile.
class LogOutputProc(ProcessHandlerMixin):
"""
Process handler for processes which save all output to a logfile.
If no logfile is specified, output will still be consumed to prevent
the output pipe's from overflowing.
"""
def __init__(self, logfile, cmd, **kwargs):
def __init__(self, cmd, logfile=None, **kwargs):
self.logfile = logfile
kwargs.setdefault('processOutputLine', []).append(self.log_output)
ProcessHandlerMixin.__init__(self, cmd, **kwargs)
def log_output(self, line):
if not self.logfile:
return
f = open(self.logfile, 'a')
f.write(line + "\n")
f.flush()
@ -317,9 +323,14 @@ waitFor(
original_online, original_offline = self._get_adb_devices()
self.proc = subprocess.Popen(qemu_args,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
filename = None
if self.logcat_dir:
filename = os.path.join(self.logcat_dir, 'qemu.log')
if os.path.isfile(filename):
self.rotate_log(filename)
self.proc = LogOutputProc(qemu_args, filename)
self.proc.run()
online, offline = self._get_adb_devices()
now = datetime.datetime.now()
@ -463,8 +474,14 @@ window.addEventListener('mozbrowserloadend', function loaded(aEvent) {
""" Rotate a logfile, by recursively rotating logs further in the sequence,
deleting the last file if necessary.
"""
destlog = os.path.join(self.logcat_dir, 'emulator-%d.%d.log' % (self.port, index))
if os.access(destlog, os.F_OK):
basename = os.path.basename(srclog)
basename = basename[:-len('.log')]
if index > 1:
basename = basename[:-len('.1')]
basename = '%s.%d.log' % (basename, index)
destlog = os.path.join(self.logcat_dir, basename)
if os.path.isfile(destlog):
if index == 3:
os.remove(destlog)
else:
@ -475,11 +492,11 @@ window.addEventListener('mozbrowserloadend', function loaded(aEvent) {
""" Save the output of logcat to a file.
"""
filename = os.path.join(self.logcat_dir, "emulator-%d.log" % self.port)
if os.access(filename, os.F_OK):
if os.path.isfile(filename):
self.rotate_log(filename)
cmd = [self.adb, '-s', 'emulator-%d' % self.port, 'logcat', '-v', 'threadtime']
self.logcat_proc = LogcatProc(filename, cmd)
self.logcat_proc = LogOutputProc(cmd, filename)
self.logcat_proc.run()
def setup_port_forwarding(self, remote_port):

View File

@ -15,9 +15,6 @@ CXXFLAGS += -O2
endif
endif
ifeq ($(OS_TEST),aarch64)
ASFILES := xptcinvoke_asm_aarch64.s xptcstubs_asm_aarch64.s
endif
######################################################################
# HPPA
######################################################################

View File

@ -149,11 +149,6 @@ if CONFIG['OS_ARCH'] == 'NetBSD':
]
if CONFIG['OS_ARCH'] == 'Linux':
if CONFIG['OS_TEST'] == 'aarch64':
SOURCES += [
'xptcinvoke_aarch64.cpp',
'xptcstubs_aarch64.cpp',
]
if CONFIG['OS_TEST'] == 'm68k':
SOURCES += [
'xptcinvoke_linux_m68k.cpp',