зеркало из https://github.com/mozilla/gecko-dev.git
Merge autoland to central, a=merge
This commit is contained in:
Коммит
44a1966767
|
@ -85,7 +85,7 @@ tasks:
|
|||
|
||||
# Note: This task is built server side without the context or tooling that
|
||||
# exist in tree so we must hard code the version
|
||||
image: 'taskcluster/decision:0.1.4'
|
||||
image: 'taskcluster/decision:0.1.5'
|
||||
|
||||
maxRunTime: 1800
|
||||
|
||||
|
|
|
@ -428,7 +428,7 @@ Accessible::NativeState()
|
|||
const nsStyleXUL* xulStyle = frame->StyleXUL();
|
||||
if (xulStyle && frame->IsXULBoxFrame()) {
|
||||
// In XUL all boxes are either vertical or horizontal
|
||||
if (xulStyle->mBoxOrient == NS_STYLE_BOX_ORIENT_VERTICAL)
|
||||
if (xulStyle->mBoxOrient == StyleBoxOrient::Vertical)
|
||||
state |= states::VERTICAL;
|
||||
else
|
||||
state |= states::HORIZONTAL;
|
||||
|
|
|
@ -235,3 +235,18 @@ richlistitem.download button {
|
|||
isn't wider than the panel. */
|
||||
-moz-margin-start: 38px !important;
|
||||
}
|
||||
|
||||
/* Prevent keyboard interaction in the main view by preventing all elements in
|
||||
the main view from being focused... */
|
||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview #downloadsListBox,
|
||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview richlistitem,
|
||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview .downloadButton,
|
||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview .downloadsPanelFooterButton,
|
||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] > .panel-mainview #downloadsSummary {
|
||||
-moz-user-focus: ignore;
|
||||
}
|
||||
/* ... except for the downloadShowBlockedInfo button in the blocked download.
|
||||
Selecting it with the keyboard should show the main view again. */
|
||||
#downloadsPanel-multiView > .panel-viewcontainer > .panel-viewstack[viewtype="subview"] .download-state[showingsubview] .downloadShowBlockedInfo {
|
||||
-moz-user-focus: normal;
|
||||
}
|
||||
|
|
|
@ -1174,8 +1174,8 @@ DownloadsViewItem.prototype = {
|
|||
},
|
||||
|
||||
downloadsCmd_showBlockedInfo() {
|
||||
DownloadsBlockedSubview.show(this.element,
|
||||
...this.rawBlockedTitleAndDetails);
|
||||
DownloadsBlockedSubview.toggle(this.element,
|
||||
...this.rawBlockedTitleAndDetails);
|
||||
},
|
||||
|
||||
downloadsCmd_openReferrer() {
|
||||
|
@ -1604,8 +1604,9 @@ const DownloadsBlockedSubview = {
|
|||
* @param details
|
||||
* An array of strings with information about the block.
|
||||
*/
|
||||
show(element, title, details) {
|
||||
toggle(element, title, details) {
|
||||
if (this.view.showingSubView) {
|
||||
this.hide();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ option(env='MOZ_JEMALLOC4', help='Enable jemalloc 4')
|
|||
imply_option('--enable-jemalloc', depends_if('MOZ_JEMALLOC4')(lambda x: '4'))
|
||||
|
||||
|
||||
option('--enable-jemalloc', nargs='?', choices=('4',), env='MOZ_MEMORY',
|
||||
option('--enable-jemalloc', nargs='?', choices=('4', 'moz'), env='MOZ_MEMORY',
|
||||
help='Replace memory allocator with jemalloc')
|
||||
|
||||
@depends('--enable-jemalloc', target, build_project, c_compiler)
|
||||
|
|
|
@ -221,8 +221,6 @@ def old_configure_options(*options):
|
|||
'--enable-sandbox',
|
||||
'--enable-signmar',
|
||||
'--enable-simulator',
|
||||
'--enable-skia',
|
||||
'--enable-skia-gpu',
|
||||
'--enable-small-chunk-size',
|
||||
'--enable-startup-notification',
|
||||
'--enable-startupcache',
|
||||
|
|
|
@ -396,8 +396,11 @@ ImageEncoder::ExtractDataInternal(const nsAString& aType,
|
|||
nsTArray<uint8_t> data;
|
||||
layers::PlanarYCbCrImage* ycbcrImage = static_cast<layers::PlanarYCbCrImage*> (aImage);
|
||||
gfxImageFormat format = SurfaceFormat::A8R8G8B8_UINT32;
|
||||
uint32_t stride = GetAlignedStride<16>(aSize.width * 4);
|
||||
uint32_t stride = GetAlignedStride<16>(aSize.width, 4);
|
||||
size_t length = BufferSizeFromStrideAndHeight(stride, aSize.height);
|
||||
if (length == 0) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
data.SetCapacity(length);
|
||||
|
||||
ConvertYCbCrToRGB(*ycbcrImage->GetData(),
|
||||
|
|
|
@ -532,7 +532,10 @@ AlphaBoxBlur::Blur(uint8_t* aData)
|
|||
}
|
||||
delete [] tmpData;
|
||||
} else {
|
||||
size_t integralImageStride = GetAlignedStride<16>(integralImageSize.width * 4);
|
||||
size_t integralImageStride = GetAlignedStride<16>(integralImageSize.width, 4);
|
||||
if (integralImageStride == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to leave room for an additional 12 bytes for a maximum overrun
|
||||
// of 3 pixels in the blurring code.
|
||||
|
|
|
@ -1841,7 +1841,7 @@ DrawTargetCG::Init(CGContextRef cgContext, const IntSize &aSize)
|
|||
bool
|
||||
DrawTargetCG::Init(BackendType aType, const IntSize &aSize, SurfaceFormat &aFormat)
|
||||
{
|
||||
int32_t stride = GetAlignedStride<16>(aSize.width * BytesPerPixel(aFormat));
|
||||
int32_t stride = GetAlignedStride<16>(aSize.width, BytesPerPixel(aFormat));
|
||||
|
||||
// Calling Init with aData == nullptr will allocate.
|
||||
return Init(aType, nullptr, aSize, stride, aFormat);
|
||||
|
|
|
@ -277,12 +277,8 @@ Factory::CheckSurfaceSize(const IntSize &sz,
|
|||
|
||||
// assuming 4 bytes per pixel, make sure the allocation size
|
||||
// doesn't overflow a int32_t either
|
||||
CheckedInt<int32_t> stride = sz.width;
|
||||
stride *= 4;
|
||||
if (stride.isValid()) {
|
||||
stride = GetAlignedStride<16>(stride.value());
|
||||
}
|
||||
if (!stride.isValid()) {
|
||||
CheckedInt<int32_t> stride = GetAlignedStride<16>(sz.width, 4);
|
||||
if (!stride.isValid() || stride.value() == 0) {
|
||||
gfxDebug() << "Surface size too large (stride overflows int32_t)!";
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -752,7 +752,7 @@ FilterNodeSoftware::GetInputDataSourceSurface(uint32_t aInputEnumIndex,
|
|||
// to use the Map API yet. We can still read the stride/data
|
||||
// values as long as we don't try to dereference them.
|
||||
result->Unmap();
|
||||
if (map.mStride != GetAlignedStride<16>(map.mStride) ||
|
||||
if (map.mStride != GetAlignedStride<16>(map.mStride, 1) ||
|
||||
reinterpret_cast<uintptr_t>(map.mData) % 16 != 0) {
|
||||
// Align unaligned surface.
|
||||
result = CloneAligned(result);
|
||||
|
|
|
@ -54,7 +54,7 @@ SourceSurfaceAlignedRawData::Init(const IntSize &aSize,
|
|||
int32_t aStride)
|
||||
{
|
||||
mFormat = aFormat;
|
||||
mStride = aStride ? aStride : GetAlignedStride<16>(aSize.width * BytesPerPixel(aFormat));
|
||||
mStride = aStride ? aStride : GetAlignedStride<16>(aSize.width, BytesPerPixel(aFormat));
|
||||
|
||||
size_t bufLen = BufferSizeFromStrideAndHeight(mStride, aSize.height);
|
||||
if (bufLen > 0) {
|
||||
|
|
|
@ -220,20 +220,24 @@ private:
|
|||
};
|
||||
|
||||
/**
|
||||
* Returns aStride increased, if necessary, so that it divides exactly into
|
||||
* |alignment|.
|
||||
* Returns aWidth * aBytesPerPixel increased, if necessary, so that it divides
|
||||
* exactly into |alignment|.
|
||||
*
|
||||
* Note that currently |alignment| must be a power-of-2. If for some reason we
|
||||
* want to support NPOT alignment we can revert back to this functions old
|
||||
* implementation.
|
||||
*/
|
||||
template<int alignment>
|
||||
int32_t GetAlignedStride(int32_t aStride)
|
||||
int32_t GetAlignedStride(int32_t aWidth, int32_t aBytesPerPixel)
|
||||
{
|
||||
static_assert(alignment > 0 && (alignment & (alignment-1)) == 0,
|
||||
"This implementation currently require power-of-two alignment");
|
||||
const int32_t mask = alignment - 1;
|
||||
return (aStride + mask) & ~mask;
|
||||
CheckedInt32 stride = CheckedInt32(aWidth) * CheckedInt32(aBytesPerPixel) + CheckedInt32(mask);
|
||||
if (stride.isValid()) {
|
||||
return stride.value() & ~mask;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
} // namespace gfx
|
||||
|
|
|
@ -492,7 +492,7 @@ ReadBackSurface(GLContext* gl, GLuint aTexture, bool aYInvert, SurfaceFormat aFo
|
|||
|
||||
RefPtr<DataSourceSurface> surf =
|
||||
Factory::CreateDataSourceSurfaceWithStride(size, SurfaceFormat::B8G8R8A8,
|
||||
GetAlignedStride<4>(size.width * BytesPerPixel(SurfaceFormat::B8G8R8A8)));
|
||||
GetAlignedStride<4>(size.width, BytesPerPixel(SurfaceFormat::B8G8R8A8)));
|
||||
|
||||
if (NS_WARN_IF(!surf)) {
|
||||
return nullptr;
|
||||
|
|
|
@ -168,7 +168,7 @@ AsyncCanvasRenderer::CopyFromTextureClient(TextureClient* aTextureClient)
|
|||
size != mSurfaceForBasic->GetSize() ||
|
||||
format != mSurfaceForBasic->GetFormat())
|
||||
{
|
||||
uint32_t stride = gfx::GetAlignedStride<8>(size.width * BytesPerPixel(format));
|
||||
uint32_t stride = gfx::GetAlignedStride<8>(size.width, BytesPerPixel(format));
|
||||
mSurfaceForBasic = gfx::Factory::CreateDataSourceSurfaceWithStride(size, format, stride);
|
||||
}
|
||||
|
||||
|
@ -219,7 +219,7 @@ AsyncCanvasRenderer::UpdateTarget()
|
|||
// This buffer would be used later for content rendering. So we choose
|
||||
// B8G8R8A8 format here.
|
||||
const gfx::SurfaceFormat format = gfx::SurfaceFormat::B8G8R8A8;
|
||||
uint32_t stride = gfx::GetAlignedStride<8>(size.width * BytesPerPixel(format));
|
||||
uint32_t stride = gfx::GetAlignedStride<8>(size.width, BytesPerPixel(format));
|
||||
RefPtr<gfx::DataSourceSurface> surface =
|
||||
gfx::Factory::CreateDataSourceSurfaceWithStride(size, format, stride);
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ CopyableCanvasLayer::GetTempSurface(const IntSize& aSize,
|
|||
aFormat != mCachedTempSurface->GetFormat())
|
||||
{
|
||||
// Create a surface aligned to 8 bytes since that's the highest alignment WebGL can handle.
|
||||
uint32_t stride = GetAlignedStride<8>(aSize.width * BytesPerPixel(aFormat));
|
||||
uint32_t stride = GetAlignedStride<8>(aSize.width, BytesPerPixel(aFormat));
|
||||
mCachedTempSurface = Factory::CreateDataSourceSurfaceWithStride(aSize, aFormat, stride);
|
||||
}
|
||||
|
||||
|
|
|
@ -20,19 +20,10 @@ namespace ImageDataSerializer {
|
|||
|
||||
using namespace gfx;
|
||||
|
||||
#define MOZ_ALIGN_WORD(x) (((x) + 3) & ~3)
|
||||
|
||||
int32_t
|
||||
ComputeRGBStride(SurfaceFormat aFormat, int32_t aWidth)
|
||||
{
|
||||
CheckedInt<int32_t> size = BytesPerPixel(aFormat);
|
||||
size *= aWidth;
|
||||
if (!size.isValid() || size.value() <= 0) {
|
||||
gfxDebug() << "ComputeStride overflow " << aWidth;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GetAlignedStride<4>(size.value());
|
||||
return GetAlignedStride<4>(aWidth, BytesPerPixel(aFormat));
|
||||
}
|
||||
|
||||
int32_t
|
||||
|
@ -52,8 +43,11 @@ ComputeRGBBufferSize(IntSize aSize, SurfaceFormat aFormat)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int32_t bufsize = GetAlignedStride<16>(ComputeRGBStride(aFormat, aSize.width)
|
||||
* aSize.height);
|
||||
// Note we're passing height instad of the bpp parameter, but the end
|
||||
// result is the same - and the bpp was already taken care of in the
|
||||
// ComputeRGBStride function.
|
||||
int32_t bufsize = GetAlignedStride<16>(ComputeRGBStride(aFormat, aSize.width),
|
||||
aSize.height);
|
||||
|
||||
if (bufsize < 0) {
|
||||
// This should not be possible thanks to Factory::AllowedSurfaceSize
|
||||
|
@ -78,8 +72,8 @@ ComputeYCbCrBufferSize(const gfx::IntSize& aYSize, int32_t aYStride,
|
|||
return 0;
|
||||
}
|
||||
// Overflow checks are performed in AllowedSurfaceSize
|
||||
return MOZ_ALIGN_WORD(aYSize.height * aYStride)
|
||||
+ 2 * MOZ_ALIGN_WORD(aCbCrSize.height * aCbCrStride);
|
||||
return GetAlignedStride<4>(aYSize.height, aYStride) +
|
||||
2 * GetAlignedStride<4>(aCbCrSize.height, aCbCrStride);
|
||||
}
|
||||
|
||||
// Minimum required shmem size in bytes
|
||||
|
@ -92,16 +86,17 @@ ComputeYCbCrBufferSize(const gfx::IntSize& aYSize, const gfx::IntSize& aCbCrSize
|
|||
uint32_t
|
||||
ComputeYCbCrBufferSize(uint32_t aBufferSize)
|
||||
{
|
||||
return MOZ_ALIGN_WORD(aBufferSize);
|
||||
return GetAlignedStride<4>(aBufferSize, 1);
|
||||
}
|
||||
|
||||
void ComputeYCbCrOffsets(int32_t yStride, int32_t yHeight,
|
||||
int32_t cbCrStride, int32_t cbCrHeight,
|
||||
uint32_t& outYOffset, uint32_t& outCbOffset, uint32_t& outCrOffset)
|
||||
uint32_t& outYOffset, uint32_t& outCbOffset,
|
||||
uint32_t& outCrOffset)
|
||||
{
|
||||
outYOffset = 0;
|
||||
outCbOffset = outYOffset + MOZ_ALIGN_WORD(yStride * yHeight);
|
||||
outCrOffset = outCbOffset + MOZ_ALIGN_WORD(cbCrStride * cbCrHeight);
|
||||
outCbOffset = outYOffset + GetAlignedStride<4>(yStride, yHeight);
|
||||
outCrOffset = outCbOffset + GetAlignedStride<4>(cbCrStride, cbCrHeight);
|
||||
}
|
||||
|
||||
gfx::SurfaceFormat FormatFromBufferDescriptor(const BufferDescriptor& aDescriptor)
|
||||
|
|
|
@ -2885,7 +2885,10 @@ AsyncPanZoomController::RequestContentRepaint(const FrameMetrics& aFrameMetrics,
|
|||
mLastPaintRequestMetrics.GetViewport().width) < EPSILON &&
|
||||
fabsf(aFrameMetrics.GetViewport().height -
|
||||
mLastPaintRequestMetrics.GetViewport().height) < EPSILON &&
|
||||
aFrameMetrics.GetScrollGeneration() == mLastPaintRequestMetrics.GetScrollGeneration()) {
|
||||
aFrameMetrics.GetScrollGeneration() ==
|
||||
mLastPaintRequestMetrics.GetScrollGeneration() &&
|
||||
aFrameMetrics.GetScrollUpdateType() ==
|
||||
mLastPaintRequestMetrics.GetScrollUpdateType()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ class JSObject2WrappedJSMap
|
|||
using Map = js::HashMap<JS::Heap<JSObject*>,
|
||||
nsXPCWrappedJS*,
|
||||
js::MovableCellHasher<JS::Heap<JSObject*>>,
|
||||
js::SystemAllocPolicy>;
|
||||
InfallibleAllocPolicy>;
|
||||
|
||||
public:
|
||||
static JSObject2WrappedJSMap* newMap(int length) {
|
||||
|
@ -413,6 +413,20 @@ public:
|
|||
return set;
|
||||
}
|
||||
|
||||
bool AddNew(const XPCNativeSetKey* key, XPCNativeSet* set)
|
||||
{
|
||||
XPCNativeSet* set2 = Add(key, set);
|
||||
if (!set2) {
|
||||
return false;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
XPCNativeSetKey key2(set);
|
||||
MOZ_ASSERT(key->Hash() == key2.Hash());
|
||||
MOZ_ASSERT(set2 == set, "Should not have found an existing entry");
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
inline void Remove(XPCNativeSet* set)
|
||||
{
|
||||
MOZ_ASSERT(set, "bad param");
|
||||
|
|
|
@ -442,6 +442,14 @@ XPCNativeSetKey::Hash() const
|
|||
for (uint16_t i = 0; i < count; i++) {
|
||||
h ^= HashPointer(*(current++));
|
||||
}
|
||||
} else {
|
||||
// A newly created set will contain nsISupports first...
|
||||
RefPtr<XPCNativeInterface> isupp = XPCNativeInterface::GetISupports();
|
||||
h ^= HashPointer(isupp);
|
||||
|
||||
// ...but no more than once.
|
||||
if (isupp == mAddition)
|
||||
return h;
|
||||
}
|
||||
|
||||
if (mAddition) {
|
||||
|
@ -482,14 +490,10 @@ XPCNativeSet::GetNewOrUsed(const nsIID* iid)
|
|||
if (!set)
|
||||
return nullptr;
|
||||
|
||||
XPCNativeSet* set2 = map->Add(&key, set);
|
||||
if (!set2) {
|
||||
if (!map->AddNew(&key, set)) {
|
||||
NS_ERROR("failed to add our set!");
|
||||
DestroyInstance(set);
|
||||
set = nullptr;
|
||||
} else if (set2 != set) {
|
||||
DestroyInstance(set);
|
||||
set = set2;
|
||||
}
|
||||
|
||||
return set;
|
||||
|
@ -567,6 +571,8 @@ XPCNativeSet::GetNewOrUsed(nsIClassInfo* classInfo)
|
|||
set = nullptr;
|
||||
goto out;
|
||||
}
|
||||
// It is okay to find an existing entry here because
|
||||
// we did not look for one before we called Add().
|
||||
if (set2 != set) {
|
||||
DestroyInstance(set);
|
||||
set = set2;
|
||||
|
@ -627,14 +633,10 @@ XPCNativeSet::GetNewOrUsed(XPCNativeSetKey* key)
|
|||
if (!set)
|
||||
return nullptr;
|
||||
|
||||
XPCNativeSet* set2 = map->Add(key, set);
|
||||
if (!set2) {
|
||||
if (!map->AddNew(key, set)) {
|
||||
NS_ERROR("failed to add our set!");
|
||||
DestroyInstance(set);
|
||||
set = nullptr;
|
||||
} else if (set2 != set) {
|
||||
DestroyInstance(set);
|
||||
set = set2;
|
||||
}
|
||||
|
||||
return set;
|
||||
|
|
|
@ -6059,7 +6059,7 @@ ContainerState::CreateMaskLayer(Layer *aLayer,
|
|||
NS_ASSERTION(maxSize > 0, "Invalid max texture size");
|
||||
#ifdef MOZ_GFX_OPTIMIZE_MOBILE
|
||||
// Make mask image width aligned to 4. See Bug 1245552.
|
||||
gfx::Size surfaceSize(std::min<gfx::Float>(GetAlignedStride<4>(NSToIntCeil(boundingRect.Width())), maxSize),
|
||||
gfx::Size surfaceSize(std::min<gfx::Float>(GetAlignedStride<4>(NSToIntCeil(boundingRect.Width()), 1), maxSize),
|
||||
std::min<gfx::Float>(boundingRect.Height(), maxSize));
|
||||
#else
|
||||
gfx::Size surfaceSize(std::min<gfx::Float>(boundingRect.Width(), maxSize),
|
||||
|
|
|
@ -1553,7 +1553,7 @@ nsBidiPresUtils::RepositionFrame(nsIFrame* aFrame,
|
|||
// We don't need to do that for 'box-decoration-break:clone' because then all
|
||||
// continuations have border/padding/margin applied.
|
||||
if (aFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBoxDecorationBreak::Slice) {
|
||||
// First remove the border/padding that was applied based on logical order.
|
||||
if (!aFrame->GetPrevContinuation()) {
|
||||
frameISize -= borderPadding.IStart(frameWM);
|
||||
|
|
|
@ -584,8 +584,7 @@ JoinBoxesForSlice(nsIFrame* aFrame, const nsRect& aBorderArea,
|
|||
static bool
|
||||
IsBoxDecorationSlice(const nsStyleBorder& aStyleBorder)
|
||||
{
|
||||
return aStyleBorder.mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE;
|
||||
return aStyleBorder.mBoxDecorationBreak == StyleBoxDecorationBreak::Slice;
|
||||
}
|
||||
|
||||
static nsRect
|
||||
|
@ -1697,11 +1696,8 @@ nsCSSRendering::PaintBGParams::ForAllLayers(nsPresContext& aPresCtx,
|
|||
{
|
||||
MOZ_ASSERT(aFrame);
|
||||
|
||||
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea);
|
||||
|
||||
result.frame = aFrame;
|
||||
result.paintFlags = aPaintFlags;
|
||||
result.layer = -1;
|
||||
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea, aFrame,
|
||||
aPaintFlags, -1, CompositionOp::OP_OVER);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
@ -1719,13 +1715,8 @@ nsCSSRendering::PaintBGParams::ForSingleLayer(nsPresContext& aPresCtx,
|
|||
{
|
||||
MOZ_ASSERT(aFrame && (aLayer != -1));
|
||||
|
||||
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea);
|
||||
|
||||
result.frame = aFrame;
|
||||
result.paintFlags = aPaintFlags;
|
||||
|
||||
result.layer = aLayer;
|
||||
result.compositionOp = aCompositionOp;
|
||||
PaintBGParams result(aPresCtx, aRenderingCtx, aDirtyRect, aBorderArea, aFrame,
|
||||
aPaintFlags, aLayer, aCompositionOp);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -609,12 +609,12 @@ struct nsCSSRendering {
|
|||
nsRect dirtyRect;
|
||||
nsRect borderArea;
|
||||
nsIFrame* frame;
|
||||
uint32_t paintFlags = 0;
|
||||
uint32_t paintFlags;
|
||||
nsRect* bgClipRect = nullptr;
|
||||
int32_t layer; // -1 means painting all layers; other
|
||||
// value means painting one specific
|
||||
// layer only.
|
||||
CompositionOp compositionOp = CompositionOp::OP_OVER;
|
||||
CompositionOp compositionOp;
|
||||
|
||||
static PaintBGParams ForAllLayers(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
|
@ -635,11 +635,19 @@ struct nsCSSRendering {
|
|||
PaintBGParams(nsPresContext& aPresCtx,
|
||||
nsRenderingContext& aRenderingCtx,
|
||||
const nsRect& aDirtyRect,
|
||||
const nsRect& aBorderArea)
|
||||
const nsRect& aBorderArea,
|
||||
nsIFrame* aFrame,
|
||||
uint32_t aPaintFlags,
|
||||
int32_t aLayer,
|
||||
CompositionOp aCompositionOp)
|
||||
: presCtx(aPresCtx),
|
||||
renderingCtx(aRenderingCtx),
|
||||
dirtyRect(aDirtyRect),
|
||||
borderArea(aBorderArea) { }
|
||||
borderArea(aBorderArea),
|
||||
frame(aFrame),
|
||||
paintFlags(aPaintFlags),
|
||||
layer(aLayer),
|
||||
compositionOp(aCompositionOp) {}
|
||||
};
|
||||
|
||||
static DrawResult PaintBackground(const PaintBGParams& aParams);
|
||||
|
|
|
@ -2926,13 +2926,13 @@ nsDisplayBackgroundImage::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
|
|||
|
||||
*aSnap = true;
|
||||
|
||||
// For NS_STYLE_BOX_DECORATION_BREAK_SLICE, don't try to optimize here, since
|
||||
// For StyleBoxDecorationBreak::Slice, don't try to optimize here, since
|
||||
// this could easily lead to O(N^2) behavior inside InlineBackgroundData,
|
||||
// which expects frames to be sent to it in content order, not reverse
|
||||
// content order which we'll produce here.
|
||||
// Of course, if there's only one frame in the flow, it doesn't matter.
|
||||
if (mFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
|
||||
StyleBoxDecorationBreak::Clone ||
|
||||
(!mFrame->GetPrevContinuation() && !mFrame->GetNextContinuation())) {
|
||||
const nsStyleImageLayers::Layer& layer = mBackgroundStyle->mImage.mLayers[mLayer];
|
||||
if (layer.mImage.IsOpaque() && layer.mBlendMode == NS_STYLE_BLEND_NORMAL &&
|
||||
|
|
|
@ -207,7 +207,7 @@ GetBEndMarginClone(nsIFrame* aFrame,
|
|||
WritingMode aWritingMode)
|
||||
{
|
||||
if (aFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
|
||||
StyleBoxDecorationBreak::Clone) {
|
||||
SizeComputationInput os(aFrame, aRenderingContext, aWritingMode,
|
||||
aContentArea.ISize(aWritingMode));
|
||||
return os.ComputedLogicalMargin().
|
||||
|
|
|
@ -3083,7 +3083,7 @@ nsBlockFrame::ShouldApplyBStartMargin(BlockReflowInput& aState,
|
|||
|
||||
if (!aState.IsAdjacentWithTop() ||
|
||||
aChildFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
|
||||
StyleBoxDecorationBreak::Clone) {
|
||||
// If we aren't at the start block-coordinate then something of non-zero
|
||||
// height must have been placed. Therefore the childs block-start margin
|
||||
// applies.
|
||||
|
@ -3149,7 +3149,7 @@ nsBlockFrame::ReflowBlockFrame(BlockReflowInput& aState,
|
|||
// apply its block-start margin because it's not significant unless it has
|
||||
// 'box-decoration-break:clone'. Otherwise, dig deeper.
|
||||
bool applyBStartMargin = (frame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE ||
|
||||
StyleBoxDecorationBreak::Clone ||
|
||||
!frame->GetPrevInFlow()) &&
|
||||
ShouldApplyBStartMargin(aState, aLine, frame);
|
||||
if (applyBStartMargin) {
|
||||
|
|
|
@ -852,7 +852,7 @@ nsContainerFrame::DoInlineIntrinsicISize(nsRenderingContext *aRenderingContext,
|
|||
// add that to each line. For box-decoration-break:slice clonePBM is zero.
|
||||
nscoord clonePBM = 0; // PBM = PaddingBorderMargin
|
||||
const bool sliceBreak =
|
||||
styleBorder->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_SLICE;
|
||||
styleBorder->mBoxDecorationBreak == StyleBoxDecorationBreak::Slice;
|
||||
if (!GetPrevContinuation()) {
|
||||
nscoord startPBM =
|
||||
// clamp negative calc() to 0
|
||||
|
|
|
@ -124,15 +124,15 @@ ConvertLegacyStyleToAlignItems(const nsStyleXUL* aStyleXUL)
|
|||
{
|
||||
// -[moz|webkit]-box-align corresponds to modern "align-items"
|
||||
switch (aStyleXUL->mBoxAlign) {
|
||||
case NS_STYLE_BOX_ALIGN_STRETCH:
|
||||
case StyleBoxAlign::Stretch:
|
||||
return NS_STYLE_ALIGN_STRETCH;
|
||||
case NS_STYLE_BOX_ALIGN_START:
|
||||
case StyleBoxAlign::Start:
|
||||
return NS_STYLE_ALIGN_FLEX_START;
|
||||
case NS_STYLE_BOX_ALIGN_CENTER:
|
||||
case StyleBoxAlign::Center:
|
||||
return NS_STYLE_ALIGN_CENTER;
|
||||
case NS_STYLE_BOX_ALIGN_BASELINE:
|
||||
case StyleBoxAlign::Baseline:
|
||||
return NS_STYLE_ALIGN_BASELINE;
|
||||
case NS_STYLE_BOX_ALIGN_END:
|
||||
case StyleBoxAlign::End:
|
||||
return NS_STYLE_ALIGN_FLEX_END;
|
||||
}
|
||||
|
||||
|
@ -148,13 +148,13 @@ ConvertLegacyStyleToJustifyContent(const nsStyleXUL* aStyleXUL)
|
|||
{
|
||||
// -[moz|webkit]-box-pack corresponds to modern "justify-content"
|
||||
switch (aStyleXUL->mBoxPack) {
|
||||
case NS_STYLE_BOX_PACK_START:
|
||||
case StyleBoxPack::Start:
|
||||
return NS_STYLE_ALIGN_FLEX_START;
|
||||
case NS_STYLE_BOX_PACK_CENTER:
|
||||
case StyleBoxPack::Center:
|
||||
return NS_STYLE_ALIGN_CENTER;
|
||||
case NS_STYLE_BOX_PACK_END:
|
||||
case StyleBoxPack::End:
|
||||
return NS_STYLE_ALIGN_FLEX_END;
|
||||
case NS_STYLE_BOX_PACK_JUSTIFY:
|
||||
case StyleBoxPack::Justify:
|
||||
return NS_STYLE_ALIGN_SPACE_BETWEEN;
|
||||
}
|
||||
|
||||
|
@ -3248,7 +3248,7 @@ FlexboxAxisTracker::InitAxesFromLegacyProps(
|
|||
const nsStyleXUL* styleXUL = aFlexContainer->StyleXUL();
|
||||
|
||||
const bool boxOrientIsVertical = (styleXUL->mBoxOrient ==
|
||||
NS_STYLE_BOX_ORIENT_VERTICAL);
|
||||
StyleBoxOrient::Vertical);
|
||||
const bool wmIsVertical = mWM.IsVertical();
|
||||
|
||||
// If box-orient agrees with our writing-mode, then we're "row-oriented"
|
||||
|
@ -3277,7 +3277,7 @@ FlexboxAxisTracker::InitAxesFromLegacyProps(
|
|||
|
||||
// Legacy flexbox can use "-webkit-box-direction: reverse" to reverse the
|
||||
// main axis (so it runs in the reverse direction of the inline axis):
|
||||
if (styleXUL->mBoxDirection == NS_STYLE_BOX_DIRECTION_REVERSE) {
|
||||
if (styleXUL->mBoxDirection == StyleBoxDirection::Reverse) {
|
||||
mMainAxis = GetReverseAxis(mMainAxis);
|
||||
mIsMainAxisReversed = true;
|
||||
} else {
|
||||
|
|
|
@ -1049,7 +1049,7 @@ nsIFrame::Sides
|
|||
nsIFrame::GetSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) &&
|
||||
StyleBoxDecorationBreak::Clone) &&
|
||||
!(GetStateBits() & NS_FRAME_IS_OVERFLOW_CONTAINER)) {
|
||||
return Sides();
|
||||
}
|
||||
|
@ -1950,7 +1950,7 @@ nsIFrame::GetClipPropClipRect(const nsStyleDisplay* aDisp,
|
|||
|
||||
*aRect = aEffects->mClip;
|
||||
if (MOZ_LIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE)) {
|
||||
StyleBoxDecorationBreak::Slice)) {
|
||||
// The clip applies to the joined boxes so it's relative the first
|
||||
// continuation.
|
||||
nscoord y = 0;
|
||||
|
|
|
@ -4809,7 +4809,7 @@ nsGridContainerFrame::ReflowInFragmentainer(GridReflowInput& aState,
|
|||
const uint32_t startRow = aState.mStartRow;
|
||||
const uint32_t numRows = aState.mRows.mSizes.Length();
|
||||
bool isBDBClone = aState.mReflowInput->mStyleBorder->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE;
|
||||
StyleBoxDecorationBreak::Clone;
|
||||
nscoord bpBEnd = aState.mBorderPadding.BEnd(aState.mWM);
|
||||
|
||||
// Set |endRow| to the first row that doesn't fit.
|
||||
|
@ -4999,7 +4999,7 @@ nsGridContainerFrame::ReflowRowsInFragmentainer(
|
|||
FrameHashtable incompleteItems;
|
||||
FrameHashtable overflowIncompleteItems;
|
||||
bool isBDBClone = aState.mReflowInput->mStyleBorder->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE;
|
||||
StyleBoxDecorationBreak::Clone;
|
||||
bool didGrowRow = false;
|
||||
// As we walk across rows, we track whether the current row is at the top
|
||||
// of its grid-fragment, to help decide whether we can break before it. When
|
||||
|
@ -5614,7 +5614,7 @@ nsGridContainerFrame::Reflow(nsPresContext* aPresContext,
|
|||
if (!NS_FRAME_IS_COMPLETE(aStatus) &&
|
||||
!gridReflowInput.mSkipSides.BEnd() &&
|
||||
StyleBorder()->mBoxDecorationBreak !=
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) {
|
||||
StyleBoxDecorationBreak::Clone) {
|
||||
bp.BEnd(wm) = nscoord(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -2155,7 +2155,7 @@ nsIFrame::LogicalSides
|
|||
nsImageFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
LogicalSides skip;
|
||||
|
|
|
@ -137,8 +137,7 @@ nsInlineFrame::IsSelfEmpty()
|
|||
// We skip this block and return false for box-decoration-break:clone since
|
||||
// in that case all the continuations will have the border/padding/margin.
|
||||
if ((GetStateBits() & NS_FRAME_PART_OF_IBSPLIT) &&
|
||||
StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Slice) {
|
||||
// When direction=rtl, we need to consider logical rather than visual
|
||||
// start and end, so swap the flags.
|
||||
if (!wm.IsBidiLTR()) {
|
||||
|
@ -585,7 +584,7 @@ nsInlineFrame::ReflowFrames(nsPresContext* aPresContext,
|
|||
nscoord startEdge = 0;
|
||||
const bool boxDecorationBreakClone =
|
||||
MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE);
|
||||
StyleBoxDecorationBreak::Clone);
|
||||
// Don't offset by our start borderpadding if we have a prev continuation or
|
||||
// if we're in a part of an {ib} split other than the first one. For
|
||||
// box-decoration-break:clone we always offset our start since all
|
||||
|
@ -944,7 +943,7 @@ nsIFrame::LogicalSides
|
|||
nsInlineFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
|
|
@ -1188,7 +1188,7 @@ nsLineLayout::AllowForStartMargin(PerFrameData* pfd,
|
|||
if ((pfd->mFrame->GetPrevContinuation() ||
|
||||
pfd->mFrame->FrameIsNonFirstInIBSplit()) &&
|
||||
aReflowInput.mStyleBorder->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBoxDecorationBreak::Slice) {
|
||||
// Zero this out so that when we compute the max-element-width of
|
||||
// the frame we will properly avoid adding in the starting margin.
|
||||
pfd->mMargin.IStart(lineWM) = 0;
|
||||
|
@ -1302,7 +1302,7 @@ nsLineLayout::CanPlaceFrame(PerFrameData* pfd,
|
|||
pfd->mFrame->FrameIsNonLastInIBSplit()) &&
|
||||
!pfd->mIsLetterFrame &&
|
||||
pfd->mFrame->StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE) {
|
||||
StyleBoxDecorationBreak::Slice) {
|
||||
pfd->mMargin.IEnd(lineWM) = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -118,7 +118,7 @@ nsRubyFrame::Reflow(nsPresContext* aPresContext,
|
|||
LogicalMargin borderPadding = aReflowInput.ComputedLogicalBorderPadding();
|
||||
nscoord startEdge = 0;
|
||||
const bool boxDecorationBreakClone =
|
||||
StyleBorder()->mBoxDecorationBreak == NS_STYLE_BOX_DECORATION_BREAK_CLONE;
|
||||
StyleBorder()->mBoxDecorationBreak == StyleBoxDecorationBreak::Clone;
|
||||
if (boxDecorationBreakClone || !GetPrevContinuation()) {
|
||||
startEdge = borderPadding.IStart(frameWM);
|
||||
}
|
||||
|
|
|
@ -243,7 +243,7 @@ nsSplittableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
|||
}
|
||||
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
@ -284,7 +284,7 @@ nsSplittableFrame::PreReflowBlockLevelLogicalSkipSides() const
|
|||
return LogicalSides(mozilla::eLogicalSideBitsBBoth);
|
||||
}
|
||||
if (MOZ_LIKELY(StyleBorder()->mBoxDecorationBreak !=
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE) &&
|
||||
StyleBoxDecorationBreak::Clone) &&
|
||||
GetPrevInFlow()) {
|
||||
return LogicalSides(mozilla::eLogicalSideBitsBStart);
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "nsINode.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsStyleUtil.h"
|
||||
|
@ -323,6 +324,12 @@ Gecko_GetServoDeclarationBlock(RawGeckoElement* aElement)
|
|||
return attr->GetServoCSSDeclarationValue();
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_FillAllBackgroundLists(nsStyleImageLayers* aLayers, uint32_t aMaxLen)
|
||||
{
|
||||
nsRuleNode::FillAllBackgroundLists(*aLayers, aMaxLen);
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static nsIAtom*
|
||||
AtomAttrValue(Implementor* aElement, nsIAtom* aName)
|
||||
|
|
|
@ -261,6 +261,7 @@ void Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* dst, const mozilla::Sty
|
|||
void Gecko_DestroyClipPath(mozilla::StyleClipPath* clip);
|
||||
mozilla::StyleBasicShape* Gecko_NewBasicShape(mozilla::StyleBasicShapeType type);
|
||||
|
||||
void Gecko_FillAllBackgroundLists(nsStyleImageLayers* layers, uint32_t max_len);
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
|
||||
|
||||
// Style-struct management.
|
||||
|
|
|
@ -1031,8 +1031,8 @@ const KTableEntry nsCSSProps::kBorderWidthKTable[] = {
|
|||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBoxDecorationBreakKTable[] = {
|
||||
{ eCSSKeyword_slice, NS_STYLE_BOX_DECORATION_BREAK_SLICE },
|
||||
{ eCSSKeyword_clone, NS_STYLE_BOX_DECORATION_BREAK_CLONE },
|
||||
{ eCSSKeyword_slice, StyleBoxDecorationBreak::Slice },
|
||||
{ eCSSKeyword_clone, StyleBoxDecorationBreak::Clone },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
|
@ -2242,33 +2242,33 @@ const KTableEntry nsCSSProps::kWritingModeKTable[] = {
|
|||
|
||||
// Specific keyword tables for XUL.properties
|
||||
const KTableEntry nsCSSProps::kBoxAlignKTable[] = {
|
||||
{ eCSSKeyword_stretch, NS_STYLE_BOX_ALIGN_STRETCH },
|
||||
{ eCSSKeyword_start, NS_STYLE_BOX_ALIGN_START },
|
||||
{ eCSSKeyword_center, NS_STYLE_BOX_ALIGN_CENTER },
|
||||
{ eCSSKeyword_baseline, NS_STYLE_BOX_ALIGN_BASELINE },
|
||||
{ eCSSKeyword_end, NS_STYLE_BOX_ALIGN_END },
|
||||
{ eCSSKeyword_stretch, StyleBoxAlign::Stretch },
|
||||
{ eCSSKeyword_start, StyleBoxAlign::Start },
|
||||
{ eCSSKeyword_center, StyleBoxAlign::Center },
|
||||
{ eCSSKeyword_baseline, StyleBoxAlign::Baseline },
|
||||
{ eCSSKeyword_end, StyleBoxAlign::End },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBoxDirectionKTable[] = {
|
||||
{ eCSSKeyword_normal, NS_STYLE_BOX_DIRECTION_NORMAL },
|
||||
{ eCSSKeyword_reverse, NS_STYLE_BOX_DIRECTION_REVERSE },
|
||||
{ eCSSKeyword_normal, StyleBoxDirection::Normal },
|
||||
{ eCSSKeyword_reverse, StyleBoxDirection::Reverse },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBoxOrientKTable[] = {
|
||||
{ eCSSKeyword_horizontal, NS_STYLE_BOX_ORIENT_HORIZONTAL },
|
||||
{ eCSSKeyword_vertical, NS_STYLE_BOX_ORIENT_VERTICAL },
|
||||
{ eCSSKeyword_inline_axis, NS_STYLE_BOX_ORIENT_HORIZONTAL },
|
||||
{ eCSSKeyword_block_axis, NS_STYLE_BOX_ORIENT_VERTICAL },
|
||||
{ eCSSKeyword_horizontal, StyleBoxOrient::Horizontal },
|
||||
{ eCSSKeyword_vertical, StyleBoxOrient::Vertical },
|
||||
{ eCSSKeyword_inline_axis, StyleBoxOrient::Horizontal },
|
||||
{ eCSSKeyword_block_axis, StyleBoxOrient::Vertical },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
const KTableEntry nsCSSProps::kBoxPackKTable[] = {
|
||||
{ eCSSKeyword_start, NS_STYLE_BOX_PACK_START },
|
||||
{ eCSSKeyword_center, NS_STYLE_BOX_PACK_CENTER },
|
||||
{ eCSSKeyword_end, NS_STYLE_BOX_PACK_END },
|
||||
{ eCSSKeyword_justify, NS_STYLE_BOX_PACK_JUSTIFY },
|
||||
{ eCSSKeyword_start, StyleBoxPack::Start },
|
||||
{ eCSSKeyword_center, StyleBoxPack::Center },
|
||||
{ eCSSKeyword_end, StyleBoxPack::End },
|
||||
{ eCSSKeyword_justify, StyleBoxPack::Justify },
|
||||
{ eCSSKeyword_UNKNOWN, -1 }
|
||||
};
|
||||
|
||||
|
|
|
@ -1334,6 +1334,11 @@ struct SetEnumValueHelper
|
|||
aField = static_cast<type_>(value); \
|
||||
}
|
||||
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxAlign, Stretch, End)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxDecorationBreak, Slice, Clone)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxDirection, Normal, Reverse)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxOrient, Horizontal, Vertical)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxPack, Start, Justify)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleBoxSizing, Content, Border)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleFillRule, Nonzero, Evenodd)
|
||||
DEFINE_ENUM_CLASS_SETTER(StyleFloat, None_, InlineEnd)
|
||||
|
@ -7183,6 +7188,45 @@ FillBackgroundPositionCoordList(
|
|||
}
|
||||
}
|
||||
|
||||
/* static */
|
||||
void
|
||||
nsRuleNode::FillAllBackgroundLists(nsStyleImageLayers& aImage,
|
||||
uint32_t aMaxItemCount)
|
||||
{
|
||||
// Delete any extra items. We need to keep layers in which any
|
||||
// property was specified.
|
||||
aImage.mLayers.TruncateLengthNonZero(aMaxItemCount);
|
||||
|
||||
uint32_t fillCount = aImage.mImageCount;
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mImage,
|
||||
aImage.mImageCount, fillCount);
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mRepeat,
|
||||
aImage.mRepeatCount, fillCount);
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mAttachment,
|
||||
aImage.mAttachmentCount, fillCount);
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mClip,
|
||||
aImage.mClipCount, fillCount);
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mBlendMode,
|
||||
aImage.mBlendModeCount, fillCount);
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mOrigin,
|
||||
aImage.mOriginCount, fillCount);
|
||||
FillBackgroundPositionCoordList(aImage.mLayers,
|
||||
&Position::mXPosition,
|
||||
aImage.mPositionXCount, fillCount);
|
||||
FillBackgroundPositionCoordList(aImage.mLayers,
|
||||
&Position::mYPosition,
|
||||
aImage.mPositionYCount, fillCount);
|
||||
FillBackgroundList(aImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mSize,
|
||||
aImage.mSizeCount, fillCount);
|
||||
}
|
||||
|
||||
const void*
|
||||
nsRuleNode::ComputeBackgroundData(void* aStartStruct,
|
||||
const nsRuleData* aRuleData,
|
||||
|
@ -7304,38 +7348,7 @@ nsRuleNode::ComputeBackgroundData(void* aStartStruct,
|
|||
conditions);
|
||||
|
||||
if (rebuild) {
|
||||
// Delete any extra items. We need to keep layers in which any
|
||||
// property was specified.
|
||||
bg->mImage.mLayers.TruncateLengthNonZero(maxItemCount);
|
||||
|
||||
uint32_t fillCount = bg->mImage.mImageCount;
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mImage,
|
||||
bg->mImage.mImageCount, fillCount);
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mRepeat,
|
||||
bg->mImage.mRepeatCount, fillCount);
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mAttachment,
|
||||
bg->mImage.mAttachmentCount, fillCount);
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mClip,
|
||||
bg->mImage.mClipCount, fillCount);
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mBlendMode,
|
||||
bg->mImage.mBlendModeCount, fillCount);
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mOrigin,
|
||||
bg->mImage.mOriginCount, fillCount);
|
||||
FillBackgroundPositionCoordList(bg->mImage.mLayers,
|
||||
&Position::mXPosition,
|
||||
bg->mImage.mPositionXCount, fillCount);
|
||||
FillBackgroundPositionCoordList(bg->mImage.mLayers,
|
||||
&Position::mYPosition,
|
||||
bg->mImage.mPositionYCount, fillCount);
|
||||
FillBackgroundList(bg->mImage.mLayers,
|
||||
&nsStyleImageLayers::Layer::mSize,
|
||||
bg->mImage.mSizeCount, fillCount);
|
||||
FillAllBackgroundLists(bg->mImage, maxItemCount);
|
||||
}
|
||||
|
||||
// Now that the dust has settled, register the images with the document
|
||||
|
@ -7464,7 +7477,7 @@ nsRuleNode::ComputeBorderData(void* aStartStruct,
|
|||
border->mBoxDecorationBreak, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentBorder->mBoxDecorationBreak,
|
||||
NS_STYLE_BOX_DECORATION_BREAK_SLICE);
|
||||
StyleBoxDecorationBreak::Slice);
|
||||
|
||||
// border-width, border-*-width: length, enum, inherit
|
||||
nsStyleCoord coord;
|
||||
|
@ -9090,14 +9103,14 @@ nsRuleNode::ComputeXULData(void* aStartStruct,
|
|||
xul->mBoxAlign, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentXUL->mBoxAlign,
|
||||
NS_STYLE_BOX_ALIGN_STRETCH);
|
||||
StyleBoxAlign::Stretch);
|
||||
|
||||
// box-direction: enum, inherit, initial
|
||||
SetValue(*aRuleData->ValueForBoxDirection(),
|
||||
xul->mBoxDirection, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentXUL->mBoxDirection,
|
||||
NS_STYLE_BOX_DIRECTION_NORMAL);
|
||||
StyleBoxDirection::Normal);
|
||||
|
||||
// box-flex: factor, inherit
|
||||
SetFactor(*aRuleData->ValueForBoxFlex(),
|
||||
|
@ -9110,14 +9123,14 @@ nsRuleNode::ComputeXULData(void* aStartStruct,
|
|||
xul->mBoxOrient, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentXUL->mBoxOrient,
|
||||
NS_STYLE_BOX_ORIENT_HORIZONTAL);
|
||||
StyleBoxOrient::Horizontal);
|
||||
|
||||
// box-pack: enum, inherit, initial
|
||||
SetValue(*aRuleData->ValueForBoxPack(),
|
||||
xul->mBoxPack, conditions,
|
||||
SETVAL_ENUMERATED | SETVAL_UNSET_INITIAL,
|
||||
parentXUL->mBoxPack,
|
||||
NS_STYLE_BOX_PACK_START);
|
||||
StyleBoxPack::Start);
|
||||
|
||||
// box-ordinal-group: integer, inherit, initial
|
||||
SetValue(*aRuleData->ValueForBoxOrdinalGroup(),
|
||||
|
|
|
@ -1053,6 +1053,11 @@ public:
|
|||
static void ComputeTimingFunction(const nsCSSValue& aValue,
|
||||
nsTimingFunction& aResult);
|
||||
|
||||
// Fill unspecified layers by cycling through their values
|
||||
// till they all are of lenght aMaxItemCount
|
||||
static void FillAllBackgroundLists(nsStyleImageLayers& aLayers,
|
||||
uint32_t aMaxItemCount);
|
||||
|
||||
private:
|
||||
#ifdef DEBUG
|
||||
// non-inline helper function to allow assertions without incomplete
|
||||
|
|
|
@ -62,6 +62,41 @@ enum class StyleBasicShapeType : uint8_t {
|
|||
Inset,
|
||||
};
|
||||
|
||||
// box-align
|
||||
enum class StyleBoxAlign : uint8_t {
|
||||
Stretch,
|
||||
Start,
|
||||
Center,
|
||||
Baseline,
|
||||
End,
|
||||
};
|
||||
|
||||
// box-decoration-break
|
||||
enum class StyleBoxDecorationBreak : uint8_t {
|
||||
Slice,
|
||||
Clone,
|
||||
};
|
||||
|
||||
// box-direction
|
||||
enum class StyleBoxDirection : uint8_t {
|
||||
Normal,
|
||||
Reverse,
|
||||
};
|
||||
|
||||
// box-orient
|
||||
enum class StyleBoxOrient : uint8_t {
|
||||
Horizontal,
|
||||
Vertical,
|
||||
};
|
||||
|
||||
// box-pack
|
||||
enum class StyleBoxPack : uint8_t {
|
||||
Start,
|
||||
Center,
|
||||
End,
|
||||
Justify,
|
||||
};
|
||||
|
||||
// box-sizing
|
||||
enum class StyleBoxSizing : uint8_t {
|
||||
Content,
|
||||
|
@ -168,31 +203,6 @@ enum class StyleUserSelect : uint8_t {
|
|||
#define NS_STYLE_WINDOW_DRAGGING_DRAG 1
|
||||
#define NS_STYLE_WINDOW_DRAGGING_NO_DRAG 2
|
||||
|
||||
// box-align
|
||||
#define NS_STYLE_BOX_ALIGN_STRETCH 0
|
||||
#define NS_STYLE_BOX_ALIGN_START 1
|
||||
#define NS_STYLE_BOX_ALIGN_CENTER 2
|
||||
#define NS_STYLE_BOX_ALIGN_BASELINE 3
|
||||
#define NS_STYLE_BOX_ALIGN_END 4
|
||||
|
||||
// box-pack
|
||||
#define NS_STYLE_BOX_PACK_START 0
|
||||
#define NS_STYLE_BOX_PACK_CENTER 1
|
||||
#define NS_STYLE_BOX_PACK_END 2
|
||||
#define NS_STYLE_BOX_PACK_JUSTIFY 3
|
||||
|
||||
// box-decoration-break
|
||||
#define NS_STYLE_BOX_DECORATION_BREAK_SLICE 0
|
||||
#define NS_STYLE_BOX_DECORATION_BREAK_CLONE 1
|
||||
|
||||
// box-direction
|
||||
#define NS_STYLE_BOX_DIRECTION_NORMAL 0
|
||||
#define NS_STYLE_BOX_DIRECTION_REVERSE 1
|
||||
|
||||
// box-orient
|
||||
#define NS_STYLE_BOX_ORIENT_HORIZONTAL 0
|
||||
#define NS_STYLE_BOX_ORIENT_VERTICAL 1
|
||||
|
||||
// orient
|
||||
#define NS_STYLE_ORIENT_INLINE 0
|
||||
#define NS_STYLE_ORIENT_BLOCK 1
|
||||
|
|
|
@ -440,7 +440,7 @@ nsStyleBorder::nsStyleBorder(StyleStructContext aContext)
|
|||
, mBorderImageRepeatH(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
|
||||
, mBorderImageRepeatV(NS_STYLE_BORDER_IMAGE_REPEAT_STRETCH)
|
||||
, mFloatEdge(StyleFloatEdge::ContentBox)
|
||||
, mBoxDecorationBreak(NS_STYLE_BOX_DECORATION_BREAK_SLICE)
|
||||
, mBoxDecorationBreak(StyleBoxDecorationBreak::Slice)
|
||||
, mComputedBorder(0, 0, 0, 0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleBorder);
|
||||
|
@ -828,10 +828,10 @@ nsStyleList::sNoneQuotes;
|
|||
nsStyleXUL::nsStyleXUL(StyleStructContext aContext)
|
||||
: mBoxFlex(0.0f)
|
||||
, mBoxOrdinal(1)
|
||||
, mBoxAlign(NS_STYLE_BOX_ALIGN_STRETCH)
|
||||
, mBoxDirection(NS_STYLE_BOX_DIRECTION_NORMAL)
|
||||
, mBoxOrient(NS_STYLE_BOX_ORIENT_HORIZONTAL)
|
||||
, mBoxPack(NS_STYLE_BOX_PACK_START)
|
||||
, mBoxAlign(StyleBoxAlign::Stretch)
|
||||
, mBoxDirection(StyleBoxDirection::Normal)
|
||||
, mBoxOrient(StyleBoxOrient::Horizontal)
|
||||
, mBoxPack(StyleBoxPack::Start)
|
||||
, mStretchStack(true)
|
||||
{
|
||||
MOZ_COUNT_CTOR(nsStyleXUL);
|
||||
|
|
|
@ -1335,7 +1335,7 @@ public:
|
|||
uint8_t mBorderImageRepeatH; // [reset] see nsStyleConsts.h
|
||||
uint8_t mBorderImageRepeatV; // [reset]
|
||||
mozilla::StyleFloatEdge mFloatEdge; // [reset]
|
||||
uint8_t mBoxDecorationBreak; // [reset] see nsStyleConsts.h
|
||||
mozilla::StyleBoxDecorationBreak mBoxDecorationBreak; // [reset]
|
||||
|
||||
protected:
|
||||
// mComputedBorder holds the CSS2.1 computed border-width values.
|
||||
|
@ -3429,10 +3429,10 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleXUL
|
|||
|
||||
float mBoxFlex; // [reset] see nsStyleConsts.h
|
||||
uint32_t mBoxOrdinal; // [reset] see nsStyleConsts.h
|
||||
uint8_t mBoxAlign; // [reset] see nsStyleConsts.h
|
||||
uint8_t mBoxDirection; // [reset] see nsStyleConsts.h
|
||||
uint8_t mBoxOrient; // [reset] see nsStyleConsts.h
|
||||
uint8_t mBoxPack; // [reset] see nsStyleConsts.h
|
||||
mozilla::StyleBoxAlign mBoxAlign; // [reset]
|
||||
mozilla::StyleBoxDirection mBoxDirection; // [reset]
|
||||
mozilla::StyleBoxOrient mBoxOrient; // [reset]
|
||||
mozilla::StyleBoxPack mBoxPack; // [reset]
|
||||
bool mStretchStack; // [reset] see nsStyleConsts.h
|
||||
};
|
||||
|
||||
|
|
|
@ -564,7 +564,7 @@ nsIFrame::LogicalSides
|
|||
nsTableCellFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
|
|
@ -333,7 +333,7 @@ nsIFrame::LogicalSides
|
|||
nsTableColGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
|
|
@ -1418,7 +1418,7 @@ nsIFrame::LogicalSides
|
|||
nsTableFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
|
|
@ -626,7 +626,7 @@ nsIFrame::LogicalSides
|
|||
nsTableRowFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ nsIFrame::LogicalSides
|
|||
nsTableRowGroupFrame::GetLogicalSkipSides(const ReflowInput* aReflowInput) const
|
||||
{
|
||||
if (MOZ_UNLIKELY(StyleBorder()->mBoxDecorationBreak ==
|
||||
NS_STYLE_BOX_DECORATION_BREAK_CLONE)) {
|
||||
StyleBoxDecorationBreak::Clone)) {
|
||||
return LogicalSides();
|
||||
}
|
||||
|
||||
|
|
|
@ -338,13 +338,13 @@ nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign)
|
|||
const nsStyleXUL* boxInfo = StyleXUL();
|
||||
if (IsXULHorizontal()) {
|
||||
switch (boxInfo->mBoxPack) {
|
||||
case NS_STYLE_BOX_PACK_START:
|
||||
case StyleBoxPack::Start:
|
||||
aHalign = nsBoxFrame::hAlign_Left;
|
||||
return true;
|
||||
case NS_STYLE_BOX_PACK_CENTER:
|
||||
case StyleBoxPack::Center:
|
||||
aHalign = nsBoxFrame::hAlign_Center;
|
||||
return true;
|
||||
case NS_STYLE_BOX_PACK_END:
|
||||
case StyleBoxPack::End:
|
||||
aHalign = nsBoxFrame::hAlign_Right;
|
||||
return true;
|
||||
default: // Nonsensical value. Just bail.
|
||||
|
@ -353,13 +353,13 @@ nsBoxFrame::GetInitialHAlignment(nsBoxFrame::Halignment& aHalign)
|
|||
}
|
||||
else {
|
||||
switch (boxInfo->mBoxAlign) {
|
||||
case NS_STYLE_BOX_ALIGN_START:
|
||||
case StyleBoxAlign::Start:
|
||||
aHalign = nsBoxFrame::hAlign_Left;
|
||||
return true;
|
||||
case NS_STYLE_BOX_ALIGN_CENTER:
|
||||
case StyleBoxAlign::Center:
|
||||
aHalign = nsBoxFrame::hAlign_Center;
|
||||
return true;
|
||||
case NS_STYLE_BOX_ALIGN_END:
|
||||
case StyleBoxAlign::End:
|
||||
aHalign = nsBoxFrame::hAlign_Right;
|
||||
return true;
|
||||
default: // Nonsensical value. Just bail.
|
||||
|
@ -413,16 +413,16 @@ nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign)
|
|||
const nsStyleXUL* boxInfo = StyleXUL();
|
||||
if (IsXULHorizontal()) {
|
||||
switch (boxInfo->mBoxAlign) {
|
||||
case NS_STYLE_BOX_ALIGN_START:
|
||||
case StyleBoxAlign::Start:
|
||||
aValign = nsBoxFrame::vAlign_Top;
|
||||
return true;
|
||||
case NS_STYLE_BOX_ALIGN_CENTER:
|
||||
case StyleBoxAlign::Center:
|
||||
aValign = nsBoxFrame::vAlign_Middle;
|
||||
return true;
|
||||
case NS_STYLE_BOX_ALIGN_BASELINE:
|
||||
case StyleBoxAlign::Baseline:
|
||||
aValign = nsBoxFrame::vAlign_BaseLine;
|
||||
return true;
|
||||
case NS_STYLE_BOX_ALIGN_END:
|
||||
case StyleBoxAlign::End:
|
||||
aValign = nsBoxFrame::vAlign_Bottom;
|
||||
return true;
|
||||
default: // Nonsensical value. Just bail.
|
||||
|
@ -431,13 +431,13 @@ nsBoxFrame::GetInitialVAlignment(nsBoxFrame::Valignment& aValign)
|
|||
}
|
||||
else {
|
||||
switch (boxInfo->mBoxPack) {
|
||||
case NS_STYLE_BOX_PACK_START:
|
||||
case StyleBoxPack::Start:
|
||||
aValign = nsBoxFrame::vAlign_Top;
|
||||
return true;
|
||||
case NS_STYLE_BOX_PACK_CENTER:
|
||||
case StyleBoxPack::Center:
|
||||
aValign = nsBoxFrame::vAlign_Middle;
|
||||
return true;
|
||||
case NS_STYLE_BOX_PACK_END:
|
||||
case StyleBoxPack::End:
|
||||
aValign = nsBoxFrame::vAlign_Bottom;
|
||||
return true;
|
||||
default: // Nonsensical value. Just bail.
|
||||
|
@ -457,10 +457,11 @@ nsBoxFrame::GetInitialOrientation(bool& aIsHorizontal)
|
|||
|
||||
// Check the style system first.
|
||||
const nsStyleXUL* boxInfo = StyleXUL();
|
||||
if (boxInfo->mBoxOrient == NS_STYLE_BOX_ORIENT_HORIZONTAL)
|
||||
if (boxInfo->mBoxOrient == StyleBoxOrient::Horizontal) {
|
||||
aIsHorizontal = true;
|
||||
else
|
||||
} else {
|
||||
aIsHorizontal = false;
|
||||
}
|
||||
|
||||
// Now see if we have an attribute. The attribute overrides
|
||||
// the style system value.
|
||||
|
@ -489,9 +490,10 @@ nsBoxFrame::GetInitialDirection(bool& aIsNormal)
|
|||
|
||||
// Now check the style system to see if we should invert aIsNormal.
|
||||
const nsStyleXUL* boxInfo = StyleXUL();
|
||||
if (boxInfo->mBoxDirection == NS_STYLE_BOX_DIRECTION_REVERSE)
|
||||
if (boxInfo->mBoxDirection == StyleBoxDirection::Reverse) {
|
||||
aIsNormal = !aIsNormal; // Invert our direction.
|
||||
|
||||
}
|
||||
|
||||
// Now see if we have an attribute. The attribute overrides
|
||||
// the style system value.
|
||||
if (IsXULHorizontal()) {
|
||||
|
@ -547,7 +549,7 @@ nsBoxFrame::GetInitialAutoStretch(bool& aStretch)
|
|||
|
||||
// Check the CSS box-align property.
|
||||
const nsStyleXUL* boxInfo = StyleXUL();
|
||||
aStretch = (boxInfo->mBoxAlign == NS_STYLE_BOX_ALIGN_STRETCH);
|
||||
aStretch = (boxInfo->mBoxAlign == StyleBoxAlign::Stretch);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -852,15 +852,23 @@ Saiz::Saiz(Box& aBox, AtomType aDefaultType)
|
|||
uint8_t defaultSampleInfoSize = reader->ReadU8();
|
||||
uint32_t count = reader->ReadU32();
|
||||
if (defaultSampleInfoSize) {
|
||||
if (!mSampleInfoSize.SetCapacity(count, fallible)) {
|
||||
LOG(Saiz, "OOM");
|
||||
reader->DiscardRemaining();
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < count; i++) {
|
||||
mSampleInfoSize.AppendElement(defaultSampleInfoSize);
|
||||
MOZ_ALWAYS_TRUE(mSampleInfoSize.AppendElement(defaultSampleInfoSize,
|
||||
fallible));
|
||||
}
|
||||
} else {
|
||||
if (!reader->ReadArray(mSampleInfoSize, count)) {
|
||||
LOG(Saiz, "Incomplete Box (missing count:%u)", count);
|
||||
LOG(Saiz, "Incomplete Box (OOM or missing count:%u)", count);
|
||||
reader->DiscardRemaining();
|
||||
return;
|
||||
}
|
||||
}
|
||||
reader->DiscardRemaining();
|
||||
mValid = true;
|
||||
}
|
||||
|
||||
|
@ -887,19 +895,23 @@ Saio::Saio(Box& aBox, AtomType aDefaultType)
|
|||
}
|
||||
size_t count = reader->ReadU32();
|
||||
need = (version ? sizeof(uint64_t) : sizeof(uint32_t)) * count;
|
||||
if (reader->Remaining() < count) {
|
||||
if (reader->Remaining() < need) {
|
||||
LOG(Saio, "Incomplete Box (have:%lld need:%lld)",
|
||||
(uint64_t)reader->Remaining(), (uint64_t)need);
|
||||
return;
|
||||
}
|
||||
mOffsets.SetCapacity(count);
|
||||
if (!mOffsets.SetCapacity(count, fallible)) {
|
||||
LOG(Saiz, "OOM");
|
||||
reader->DiscardRemaining();
|
||||
return;
|
||||
}
|
||||
if (version == 0) {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
mOffsets.AppendElement(reader->ReadU32());
|
||||
MOZ_ALWAYS_TRUE(mOffsets.AppendElement(reader->ReadU32(), fallible));
|
||||
}
|
||||
} else {
|
||||
for (size_t i = 0; i < count; i++) {
|
||||
mOffsets.AppendElement(reader->ReadU64());
|
||||
MOZ_ALWAYS_TRUE(mOffsets.AppendElement(reader->ReadU64(), fallible));
|
||||
}
|
||||
}
|
||||
mValid = true;
|
||||
|
|
|
@ -314,7 +314,7 @@ public:
|
|||
}
|
||||
|
||||
template <typename T>
|
||||
bool ReadArray(nsTArray<T>& aDest, size_t aLength)
|
||||
MOZ_MUST_USE bool ReadArray(nsTArray<T>& aDest, size_t aLength)
|
||||
{
|
||||
auto ptr = Read(aLength * sizeof(T));
|
||||
if (!ptr) {
|
||||
|
@ -326,6 +326,24 @@ public:
|
|||
return true;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
MOZ_MUST_USE bool ReadArray(FallibleTArray<T>& aDest, size_t aLength)
|
||||
{
|
||||
auto ptr = Read(aLength * sizeof(T));
|
||||
if (!ptr) {
|
||||
return false;
|
||||
}
|
||||
|
||||
aDest.Clear();
|
||||
if (!aDest.SetCapacity(aLength, mozilla::fallible)) {
|
||||
return false;
|
||||
}
|
||||
MOZ_ALWAYS_TRUE(aDest.AppendElements(reinterpret_cast<const T*>(ptr),
|
||||
aLength,
|
||||
mozilla::fallible));
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
const uint8_t* mPtr;
|
||||
size_t mRemaining;
|
||||
|
|
|
@ -147,7 +147,7 @@ public:
|
|||
|
||||
AtomType mAuxInfoType;
|
||||
uint32_t mAuxInfoTypeParameter;
|
||||
nsTArray<uint8_t> mSampleInfoSize;
|
||||
FallibleTArray<uint8_t> mSampleInfoSize;
|
||||
};
|
||||
|
||||
class Saio final : public Atom
|
||||
|
@ -157,7 +157,7 @@ public:
|
|||
|
||||
AtomType mAuxInfoType;
|
||||
uint32_t mAuxInfoTypeParameter;
|
||||
nsTArray<uint64_t> mOffsets;
|
||||
FallibleTArray<uint64_t> mOffsets;
|
||||
};
|
||||
|
||||
class AuxInfo {
|
||||
|
|
|
@ -160,20 +160,26 @@ struct TestFileData
|
|||
int32_t mWidth;
|
||||
int32_t mHeight;
|
||||
uint32_t mNumberAudioTracks;
|
||||
bool mHasCrypto;
|
||||
uint64_t mMoofReachedOffset; // or 0 for the end.
|
||||
bool mValidMoof;
|
||||
bool mHeader;
|
||||
};
|
||||
static const TestFileData testFiles[] = {
|
||||
{ "test_case_1156505.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1181213.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1181215.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1181220.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1181223.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1181719.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1185230.mp4", 1, 320, 240, 1 },
|
||||
{ "test_case_1187067.mp4", 1, 160, 90, 0 },
|
||||
{ "test_case_1200326.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1204580.mp4", 1, 320, 180, 0 },
|
||||
{ "test_case_1216748.mp4", 0, 0, 0, 0 },
|
||||
{ "test_case_1296473.mp4", 0, 0, 0, 0 }
|
||||
// filename #V w h #A crypt off moof headr
|
||||
{ "test_case_1156505.mp4", 0, 0, 0, 0, false, 152, false, false },
|
||||
{ "test_case_1181213.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1181215.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1181220.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1181223.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1181719.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1185230.mp4", 1, 320, 240, 1, false, 0, false, false },
|
||||
{ "test_case_1187067.mp4", 1, 160, 90, 0, false, 0, false, false },
|
||||
{ "test_case_1200326.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1204580.mp4", 1, 320, 180, 0, false, 0, false, false },
|
||||
{ "test_case_1216748.mp4", 0, 0, 0, 0, false, 152, false, false },
|
||||
{ "test_case_1296473.mp4", 0, 0, 0, 0, false, 0, false, false },
|
||||
{ "test_case_1296532.mp4", 1, 560, 320, 1, true, 0, true, true }
|
||||
};
|
||||
|
||||
TEST(stagefright_MPEG4Metadata, test_case_mp4)
|
||||
|
@ -234,7 +240,7 @@ TEST(stagefright_MPEG4Metadata, test_case_mp4)
|
|||
EXPECT_FALSE(metadata.GetTrackInfo(static_cast<TrackInfo::TrackType>(-1), 0));
|
||||
// We can see anywhere in any MPEG4.
|
||||
EXPECT_TRUE(metadata.CanSeek());
|
||||
EXPECT_FALSE(metadata.Crypto().valid);
|
||||
EXPECT_EQ(testFiles[test].mHasCrypto, metadata.Crypto().valid);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -287,19 +293,30 @@ TEST(stagefright_MoofParser, test_case_mp4)
|
|||
MoofParser parser(stream, 0, false);
|
||||
EXPECT_EQ(0u, parser.mOffset);
|
||||
EXPECT_FALSE(parser.ReachedEnd());
|
||||
|
||||
MediaByteRangeSet byteRanges;
|
||||
EXPECT_FALSE(parser.RebuildFragmentedIndex(byteRanges));
|
||||
|
||||
EXPECT_TRUE(parser.GetCompositionRange(byteRanges).IsNull());
|
||||
EXPECT_TRUE(parser.mInitRange.IsEmpty());
|
||||
EXPECT_EQ(0u, parser.mOffset);
|
||||
EXPECT_FALSE(parser.ReachedEnd());
|
||||
|
||||
EXPECT_TRUE(parser.HasMetadata());
|
||||
RefPtr<MediaByteBuffer> metadataBuffer = parser.Metadata();
|
||||
EXPECT_TRUE(metadataBuffer);
|
||||
|
||||
EXPECT_FALSE(parser.mInitRange.IsEmpty());
|
||||
const MediaByteRangeSet byteRanges(
|
||||
MediaByteRange(0, int64_t(buffer.Length())));
|
||||
EXPECT_EQ(testFiles[test].mValidMoof,
|
||||
parser.RebuildFragmentedIndex(byteRanges));
|
||||
if (testFiles[test].mMoofReachedOffset == 0) {
|
||||
EXPECT_EQ(buffer.Length(), parser.mOffset);
|
||||
EXPECT_TRUE(parser.ReachedEnd());
|
||||
} else {
|
||||
EXPECT_EQ(testFiles[test].mMoofReachedOffset, parser.mOffset);
|
||||
EXPECT_FALSE(parser.ReachedEnd());
|
||||
}
|
||||
|
||||
EXPECT_FALSE(parser.mInitRange.IsEmpty());
|
||||
EXPECT_TRUE(parser.GetCompositionRange(byteRanges).IsNull());
|
||||
EXPECT_TRUE(parser.FirstCompleteMediaSegment().IsEmpty());
|
||||
EXPECT_TRUE(parser.FirstCompleteMediaHeader().IsEmpty());
|
||||
EXPECT_EQ(testFiles[test].mHeader,
|
||||
!parser.FirstCompleteMediaHeader().IsEmpty());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ TEST_HARNESS_FILES.gtest += [
|
|||
'test_case_1204580.mp4',
|
||||
'test_case_1216748.mp4',
|
||||
'test_case_1296473.mp4',
|
||||
'test_case_1296532.mp4',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_RUST']:
|
||||
|
|
Двоичный файл не отображается.
|
@ -646,13 +646,14 @@ WebrtcGmpVideoEncoder::Encoded(GMPVideoEncodedFrame* aEncodedFrame,
|
|||
webrtc::EncodedImage unit(aEncodedFrame->Buffer(), size, size);
|
||||
unit._frameType = ft;
|
||||
unit._timeStamp = timestamp;
|
||||
// Ensure we ignore this when calculating RTCP timestamps
|
||||
unit.capture_time_ms_ = -1;
|
||||
unit._completeFrame = true;
|
||||
|
||||
// TODO: Currently the OpenH264 codec does not preserve any codec
|
||||
// specific info passed into it and just returns default values.
|
||||
// Even if we were to add packetization mode to the codec specific info
|
||||
// the value passed in would not be returned to us. If this changes in
|
||||
// the future, it would be nice to get rid of mCodecSpecificInfo.
|
||||
// If this changes in the future, it would be nice to get rid of
|
||||
// mCodecSpecificInfo.
|
||||
mCallback->Encoded(unit, &mCodecSpecificInfo, &fragmentation);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -143,8 +143,14 @@
|
|||
* Use only one arena by default. Mozilla does not currently make extensive
|
||||
* use of concurrent allocation, so the increased fragmentation associated with
|
||||
* multiple arenas is not warranted.
|
||||
*
|
||||
* When using the Servo style system, we do indeed make use of significant
|
||||
* concurrent allocation, and the overhead matters. Bug 1291355 tracks
|
||||
* investigating the fragmentation overhead of turning this on for users.
|
||||
*/
|
||||
#define MOZ_MEMORY_NARENAS_DEFAULT_ONE
|
||||
#ifndef MOZ_STYLO
|
||||
#define MOZ_MEMORY_NARENAS_DEFAULT_ONE
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Pass this set of options to jemalloc as its default. It does not override
|
||||
|
|
|
@ -5174,46 +5174,6 @@ fi
|
|||
|
||||
AC_SUBST_LIST(GLIB_GMODULE_LIBS)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Graphics checks.
|
||||
dnl ========================================================
|
||||
|
||||
if test "${OS_TARGET}" = "WINNT" -o \
|
||||
"${OS_ARCH}" = "Darwin" -o \
|
||||
"${MOZ_WIDGET_TOOLKIT}" = "android" -o \
|
||||
"${MOZ_WIDGET_TOOLKIT}" = "gonk" -o \
|
||||
"${MOZ_WIDGET_TOOLKIT}" = "gtk2" -o \
|
||||
"${MOZ_WIDGET_TOOLKIT}" = "gtk3"; then
|
||||
case "${CPU_ARCH}" in
|
||||
x86|x86_64|arm)
|
||||
MOZ_ENABLE_SKIA=1
|
||||
;;
|
||||
*)
|
||||
MOZ_ENABLE_SKIA=
|
||||
;;
|
||||
esac
|
||||
else
|
||||
MOZ_ENABLE_SKIA=
|
||||
fi
|
||||
|
||||
MOZ_ARG_ENABLE_BOOL(skia,
|
||||
[ --enable-skia Enable use of Skia],
|
||||
MOZ_ENABLE_SKIA=1,
|
||||
MOZ_ENABLE_SKIA=)
|
||||
|
||||
dnl Skia GPU support may not reliably build on certain *BSDs (see bug 1234494).
|
||||
if test "${OS_TARGET}" = "OpenBSD" -o \
|
||||
"${OS_TARGET}" = "NetBSD"; then \
|
||||
MOZ_DISABLE_SKIA_GPU=1
|
||||
else
|
||||
MOZ_DISABLE_SKIA_GPU=
|
||||
fi
|
||||
|
||||
MOZ_ARG_DISABLE_BOOL(skia-gpu,
|
||||
[ --disable-skia-gpu Disable use of Skia-GPU],
|
||||
MOZ_DISABLE_SKIA_GPU=1,
|
||||
MOZ_DISABLE_SKIA_GPU=)
|
||||
|
||||
if test "$USE_FC_FREETYPE"; then
|
||||
if test "$COMPILE_ENVIRONMENT"; then
|
||||
dnl ========================================================
|
||||
|
@ -5415,27 +5375,6 @@ AC_SUBST_LIST(MOZ_CAIRO_LIBS)
|
|||
AC_SUBST_LIST(MOZ_CAIRO_OSLIBS)
|
||||
AC_SUBST(MOZ_TREE_PIXMAN)
|
||||
|
||||
dnl ========================================================
|
||||
dnl Skia
|
||||
dnl ========================================================
|
||||
if test "$MOZ_ENABLE_SKIA"; then
|
||||
SKIA_INCLUDES="/gfx/skia /gfx/skia/skia/include/config /gfx/skia/skia/include/core"
|
||||
AC_DEFINE(MOZ_ENABLE_SKIA)
|
||||
AC_DEFINE(USE_SKIA)
|
||||
if test "${MOZ_WIDGET_TOOLKIT}" = "android" -o x"$MOZ_WIDGET_TOOLKIT" = x"gonk"; then
|
||||
AC_DEFINE(SK_BUILD_FOR_ANDROID_NDK)
|
||||
fi
|
||||
|
||||
if test "${CPU_ARCH}" != "ppc" -a "${CPU_ARCH}" != "ppc64" -a "${CPU_ARCH}" != "sparc" -a "${CPU_ARCH}" != "sparc64" -a -z "$MOZ_DISABLE_SKIA_GPU" ; then
|
||||
SKIA_INCLUDES="$SKIA_INCLUDES /gfx/skia/skia/include/gpu /gfx/skia/skia/include/utils"
|
||||
MOZ_ENABLE_SKIA_GPU=1
|
||||
AC_DEFINE(USE_SKIA_GPU)
|
||||
AC_SUBST(MOZ_ENABLE_SKIA_GPU)
|
||||
fi
|
||||
fi
|
||||
AC_SUBST(MOZ_ENABLE_SKIA)
|
||||
AC_SUBST_LIST(SKIA_INCLUDES)
|
||||
|
||||
dnl ========================================================
|
||||
dnl disable xul
|
||||
dnl ========================================================
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
---
|
||||
# For complete sample of all build and test jobs,
|
||||
# see <gecko>/testing/taskcluster/tasks/branches/base_job_flags.yml
|
||||
|
||||
$inherits:
|
||||
from: tasks/branches/base_jobs.yml
|
||||
|
||||
flags:
|
||||
post-build:
|
||||
- upload-symbols
|
||||
|
||||
builds:
|
||||
linux:
|
||||
platforms:
|
||||
- Linux
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_linux32.yml
|
||||
debug:
|
||||
task: tasks/builds/dbg_linux32.yml
|
||||
linux64:
|
||||
platforms:
|
||||
- Linux64
|
||||
extra-builds: # see RIDEALONG_BUILDS in `mach taskgraph`
|
||||
- linux64-l10n
|
||||
- sm-plain
|
||||
- sm-nonunified
|
||||
- sm-arm-sim
|
||||
- sm-arm64-sim
|
||||
- sm-compacting
|
||||
- sm-rootanalysis
|
||||
- sm-package
|
||||
- sm-tsan
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_linux64.yml
|
||||
debug:
|
||||
task: tasks/builds/dbg_linux64.yml
|
||||
linux64-st-an:
|
||||
platforms:
|
||||
- Linux64 Static Analysis
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_linux64_st-an.yml
|
||||
linux64-pgo:
|
||||
platforms:
|
||||
- Linux64 PGO
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_linux64_pgo.yml
|
||||
linux64-mulet:
|
||||
platforms:
|
||||
- Mulet Linux
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/mulet_linux.yml
|
||||
debug:
|
||||
task: tasks/builds/mulet_linux_dbg.yml
|
||||
linux64-mulet-haz:
|
||||
platforms:
|
||||
- Mulet Linux
|
||||
types:
|
||||
debug:
|
||||
task: tasks/builds/mulet_haz_linux.yml
|
||||
macosx64:
|
||||
platforms:
|
||||
- MacOSX64
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_macosx64.yml
|
||||
debug:
|
||||
task: tasks/builds/dbg_macosx64.yml
|
||||
linux64-asan:
|
||||
platforms:
|
||||
- Linux64 ASan
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_linux64_asan.yml
|
||||
debug:
|
||||
task: tasks/builds/dbg_linux64_asan.yml
|
||||
macosx64-st-an:
|
||||
platforms:
|
||||
- MacOSX64 Static Analysis
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/opt_macosx64_st-an.yml
|
||||
sm-tsan:
|
||||
platforms:
|
||||
- Linux64
|
||||
types:
|
||||
opt:
|
||||
task: tasks/builds/sm_tsan.yml
|
||||
when:
|
||||
file_patterns:
|
||||
- js/public/**
|
||||
- js/src/**
|
||||
|
||||
post-build:
|
||||
upload-symbols:
|
||||
allowed_build_tasks:
|
||||
- tasks/builds/opt_linux64.yml
|
||||
- tasks/builds/dbg_linux64.yml
|
||||
- tasks/builds/android_api_15.yml
|
||||
task: tasks/post-builds/upload_symbols.yml
|
|
@ -0,0 +1,6 @@
|
|||
---
|
||||
# For complete sample of all build and test jobs,
|
||||
# see <gecko>/testing/taskcluster/tasks/branches/base_job_flags.yml
|
||||
|
||||
$inherits:
|
||||
from: tasks/branches/base_jobs.yml
|
|
@ -41,7 +41,7 @@ payload:
|
|||
|
||||
# Note: This task is built server side without the context or tooling that
|
||||
# exist in tree so we must hard code the version
|
||||
image: 'taskcluster/decision:0.1.4'
|
||||
image: 'taskcluster/decision:0.1.5'
|
||||
|
||||
# Virtually no network or other potentially risky operations happen as part
|
||||
# of the task timeout aside from the initial clone. We intentionally have
|
||||
|
|
|
@ -1 +1 @@
|
|||
0.1.4
|
||||
0.1.5
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
|
||||
|
||||
Cu.import("resource://gre/modules/AddonManager.jsm");
|
||||
Cu.import("resource://gre/modules/FileUtils.jsm");
|
||||
|
||||
Cu.import("chrome://marionette/content/error.js");
|
||||
|
||||
this.EXPORTED_SYMBOLS = ["addon"];
|
||||
|
||||
this.addon = {};
|
||||
|
||||
/**
|
||||
* Installs Firefox addon.
|
||||
*
|
||||
* If the addon is restartless, it can be used right away. Otherwise a
|
||||
* restart is needed.
|
||||
*
|
||||
* Temporary addons will automatically be unisntalled on shutdown and
|
||||
* do not need to be signed, though they must be restartless.
|
||||
*
|
||||
* @param {string} path
|
||||
* Full path to the extension package archive to be installed.
|
||||
* @param {boolean=} temporary
|
||||
* Install the add-on temporarily if true.
|
||||
*
|
||||
* @return {Promise.<string>}
|
||||
* Addon ID string of the newly installed addon.
|
||||
*
|
||||
* @throws {AddonError}
|
||||
* if installation fails
|
||||
*/
|
||||
addon.install = function(path, temporary = false) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let listener = {
|
||||
onInstallEnded: function(install, addon) {
|
||||
resolve(addon.id);
|
||||
},
|
||||
|
||||
onInstallFailed: function(install) {
|
||||
reject(new AddonError(install.error));
|
||||
},
|
||||
|
||||
onInstalled: function(addon) {
|
||||
AddonManager.removeAddonListener(listener);
|
||||
resolve(addon.id);
|
||||
}
|
||||
};
|
||||
|
||||
let file = new FileUtils.File(path);
|
||||
|
||||
// temporary addons
|
||||
if (temp) {
|
||||
AddonManager.addAddonListener(listener);
|
||||
AddonManager.installTemporaryAddon(file);
|
||||
}
|
||||
|
||||
// addons that require restart
|
||||
else {
|
||||
AddonManager.getInstallForFile(file, function(aInstall) {
|
||||
if (aInstall.error != 0) {
|
||||
reject(new AddonError(aInstall.error));
|
||||
}
|
||||
aInstall.addListener(listener);
|
||||
aInstall.install();
|
||||
});
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Uninstall a Firefox addon.
|
||||
*
|
||||
* If the addon is restartless, it will be uninstalled right
|
||||
* away. Otherwise a restart is necessary.
|
||||
*
|
||||
* @param {string} id
|
||||
* Addon ID to uninstall.
|
||||
*
|
||||
* @return {Promise}
|
||||
*/
|
||||
addon.uninstall = function(id) {
|
||||
return new Promise(resolve => {
|
||||
AddonManager.getAddonByID(arguments[0], function(addon) {
|
||||
addon.uninstall();
|
||||
});
|
||||
});
|
||||
};
|
|
@ -794,10 +794,10 @@ class Marionette(object):
|
|||
'type': arguments[0]
|
||||
};
|
||||
return value;"""
|
||||
with self.using_context('content'):
|
||||
value = self.execute_script(script, script_args=[perm], sandbox='system')
|
||||
with self.using_context("content"):
|
||||
value = self.execute_script(script, script_args=(perm,), sandbox="system")
|
||||
|
||||
with self.using_context('chrome'):
|
||||
with self.using_context("chrome"):
|
||||
permission = self.execute_script("""
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
let perm = arguments[0];
|
||||
|
@ -810,7 +810,7 @@ class Marionette(object):
|
|||
let testPerm = Services.perms.testPermissionFromPrincipal(
|
||||
principal, perm.type);
|
||||
return testPerm;
|
||||
""", script_args=[value])
|
||||
""", script_args=(value,))
|
||||
return permission
|
||||
|
||||
def push_permission(self, perm, allow):
|
||||
|
@ -850,20 +850,20 @@ class Marionette(object):
|
|||
};
|
||||
return value;
|
||||
"""
|
||||
with self.using_context('content'):
|
||||
perm = self.execute_script(script, script_args=[allow, perm], sandbox='system')
|
||||
with self.using_context("content"):
|
||||
perm = self.execute_script(script, script_args=(allow, perm,), sandbox="system")
|
||||
|
||||
current_perm = self.get_permission(perm['type'])
|
||||
if current_perm == perm['action']:
|
||||
with self.using_context('content'):
|
||||
current_perm = self.get_permission(perm["type"])
|
||||
if current_perm == perm["action"]:
|
||||
with self.using_context("content"):
|
||||
self.execute_script("""
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
Services.obs.removeObserver(window.wrappedJSObject.permObserver,
|
||||
"perm-changed");
|
||||
""", sandbox='system')
|
||||
""", sandbox="system")
|
||||
return
|
||||
|
||||
with self.using_context('chrome'):
|
||||
with self.using_context("chrome"):
|
||||
self.execute_script("""
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
let perm = arguments[0];
|
||||
|
@ -875,7 +875,7 @@ class Marionette(object):
|
|||
attrs);
|
||||
Services.perms.addFromPrincipal(principal, perm.type, perm.action);
|
||||
return true;
|
||||
""", script_args=[perm])
|
||||
""", script_args=(perm,))
|
||||
|
||||
with self.using_context("content"):
|
||||
self.execute_async_script("""
|
||||
|
@ -928,7 +928,7 @@ class Marionette(object):
|
|||
pref_value = self.execute_script("""
|
||||
Components.utils.import("resource://gre/modules/Preferences.jsm");
|
||||
return Preferences.get(arguments[0], null);
|
||||
""", script_args=[pref], sandbox="system")
|
||||
""", script_args=(pref,), sandbox="system")
|
||||
return pref_value
|
||||
|
||||
def clear_pref(self, pref):
|
||||
|
@ -936,7 +936,7 @@ class Marionette(object):
|
|||
self.execute_script("""
|
||||
Components.utils.import("resource://gre/modules/Preferences.jsm");
|
||||
Preferences.reset(arguments[0]);
|
||||
""", script_args=[pref])
|
||||
""", script_args=(pref,))
|
||||
|
||||
def set_pref(self, pref, value):
|
||||
with self.using_context(self.CONTEXT_CHROME):
|
||||
|
@ -947,29 +947,29 @@ class Marionette(object):
|
|||
self.execute_script("""
|
||||
Components.utils.import("resource://gre/modules/Preferences.jsm");
|
||||
Preferences.set(arguments[0], arguments[1]);
|
||||
""", script_args=[pref, value])
|
||||
""", script_args=(pref, value,))
|
||||
|
||||
def set_prefs(self, prefs):
|
||||
'''Sets preferences.
|
||||
"""Sets preferences.
|
||||
|
||||
If the value of the preference to be set is None, reset the preference
|
||||
to its default value. If no default value exists, the preference will
|
||||
cease to exist.
|
||||
|
||||
:param prefs: A dict containing one or more preferences and their values
|
||||
to be set.
|
||||
:param prefs: A dict containing one or more preferences and
|
||||
their values to be set.
|
||||
|
||||
Usage example::
|
||||
|
||||
marionette.set_prefs({'browser.tabs.warnOnClose': True})
|
||||
marionette.set_prefs({"browser.tabs.warnOnClose": True})
|
||||
|
||||
'''
|
||||
"""
|
||||
for pref, value in prefs.items():
|
||||
self.set_pref(pref, value)
|
||||
|
||||
@contextmanager
|
||||
def using_prefs(self, prefs):
|
||||
'''Sets preferences for code being executed in a `with` block,
|
||||
"""Sets preferences for code being executed in a `with` block,
|
||||
and restores them on exit.
|
||||
|
||||
:param prefs: A dict containing one or more preferences and their values
|
||||
|
@ -977,10 +977,10 @@ class Marionette(object):
|
|||
|
||||
Usage example::
|
||||
|
||||
with marionette.using_prefs({'browser.tabs.warnOnClose': True}):
|
||||
# ... do stuff ...
|
||||
with marionette.using_prefs({"browser.tabs.warnOnClose": True}):
|
||||
# ... do stuff ...
|
||||
|
||||
'''
|
||||
"""
|
||||
original_prefs = {p: self.get_pref(p) for p in prefs}
|
||||
self.set_prefs(prefs)
|
||||
|
||||
|
@ -991,9 +991,9 @@ class Marionette(object):
|
|||
|
||||
@do_process_check
|
||||
def enforce_gecko_prefs(self, prefs):
|
||||
"""
|
||||
Checks if the running instance has the given prefs. If not, it will kill the
|
||||
currently running instance, and spawn a new instance with the requested preferences.
|
||||
"""Checks if the running instance has the given prefs. If not,
|
||||
it will kill the currently running instance, and spawn a new
|
||||
instance with the requested preferences.
|
||||
|
||||
: param prefs: A dictionary whose keys are preference names.
|
||||
"""
|
||||
|
@ -1500,15 +1500,15 @@ class Marionette(object):
|
|||
"""Causes the browser to perform to refresh the current page."""
|
||||
self._send_message("refresh")
|
||||
|
||||
def wrapArguments(self, args):
|
||||
if isinstance(args, list):
|
||||
def _to_json(self, args):
|
||||
if isinstance(args, list) or isinstance(args, tuple):
|
||||
wrapped = []
|
||||
for arg in args:
|
||||
wrapped.append(self.wrapArguments(arg))
|
||||
wrapped.append(self._to_json(arg))
|
||||
elif isinstance(args, dict):
|
||||
wrapped = {}
|
||||
for arg in args:
|
||||
wrapped[arg] = self.wrapArguments(args[arg])
|
||||
wrapped[arg] = self._to_json(args[arg])
|
||||
elif type(args) == HTMLElement:
|
||||
wrapped = {W3C_WEBELEMENT_KEY: args.id,
|
||||
WEBELEMENT_KEY: args.id}
|
||||
|
@ -1517,11 +1517,11 @@ class Marionette(object):
|
|||
wrapped = args
|
||||
return wrapped
|
||||
|
||||
def unwrapValue(self, value):
|
||||
def _from_json(self, value):
|
||||
if isinstance(value, list):
|
||||
unwrapped = []
|
||||
for item in value:
|
||||
unwrapped.append(self.unwrapValue(item))
|
||||
unwrapped.append(self._from_json(item))
|
||||
elif isinstance(value, dict):
|
||||
unwrapped = {}
|
||||
for key in value:
|
||||
|
@ -1532,18 +1532,16 @@ class Marionette(object):
|
|||
unwrapped = HTMLElement(self, value[key])
|
||||
break
|
||||
else:
|
||||
unwrapped[key] = self.unwrapValue(value[key])
|
||||
unwrapped[key] = self._from_json(value[key])
|
||||
else:
|
||||
unwrapped = value
|
||||
return unwrapped
|
||||
|
||||
def execute_js_script(self, script, script_args=None, async=True,
|
||||
def execute_js_script(self, script, script_args=(), async=True,
|
||||
new_sandbox=True, script_timeout=None,
|
||||
inactivity_timeout=None, filename=None,
|
||||
sandbox='default'):
|
||||
if script_args is None:
|
||||
script_args = []
|
||||
args = self.wrapArguments(script_args)
|
||||
args = self._to_json(script_args)
|
||||
body = {"script": script,
|
||||
"args": args,
|
||||
"async": async,
|
||||
|
@ -1553,9 +1551,9 @@ class Marionette(object):
|
|||
"filename": filename,
|
||||
"line": None}
|
||||
rv = self._send_message("executeJSScript", body, key="value")
|
||||
return self.unwrapValue(rv)
|
||||
return self._from_json(rv)
|
||||
|
||||
def execute_script(self, script, script_args=None, new_sandbox=True,
|
||||
def execute_script(self, script, script_args=(), new_sandbox=True,
|
||||
sandbox="default", script_timeout=None):
|
||||
"""Executes a synchronous JavaScript script, and returns the
|
||||
result (or None if the script does return a value).
|
||||
|
@ -1565,7 +1563,7 @@ class Marionette(object):
|
|||
has not been called.
|
||||
|
||||
:param script: A string containing the JavaScript to execute.
|
||||
:param script_args: A list of arguments to pass to the script.
|
||||
:param script_args: An interable of arguments to pass to the script.
|
||||
:param sandbox: A tag referring to the sandbox you wish to use;
|
||||
if you specify a new tag, a new sandbox will be created.
|
||||
If you use the special tag `system`, the sandbox will
|
||||
|
@ -1588,10 +1586,10 @@ class Marionette(object):
|
|||
::
|
||||
|
||||
result = marionette.execute_script("return arguments[0] + arguments[1];",
|
||||
script_args=[2, 3])
|
||||
script_args=(2, 3,))
|
||||
assert result == 5
|
||||
some_element = marionette.find_element(By.ID, "someElement")
|
||||
sid = marionette.execute_script("return arguments[0].id;", script_args=[some_element])
|
||||
sid = marionette.execute_script("return arguments[0].id;", script_args=(some_element,))
|
||||
assert some_element.get_attribute("id") == sid
|
||||
|
||||
Scripts wishing to access non-standard properties of the window
|
||||
|
@ -1618,9 +1616,7 @@ class Marionette(object):
|
|||
assert result == "foo"
|
||||
|
||||
"""
|
||||
if script_args is None:
|
||||
script_args = []
|
||||
args = self.wrapArguments(script_args)
|
||||
args = self._to_json(script_args)
|
||||
stack = traceback.extract_stack()
|
||||
frame = stack[-2:-1][0] # grab the second-to-last frame
|
||||
body = {"script": script,
|
||||
|
@ -1631,9 +1627,9 @@ class Marionette(object):
|
|||
"line": int(frame[1]),
|
||||
"filename": os.path.basename(frame[0])}
|
||||
rv = self._send_message("executeScript", body, key="value")
|
||||
return self.unwrapValue(rv)
|
||||
return self._from_json(rv)
|
||||
|
||||
def execute_async_script(self, script, script_args=None, new_sandbox=True,
|
||||
def execute_async_script(self, script, script_args=(), new_sandbox=True,
|
||||
sandbox="default", script_timeout=None,
|
||||
debug_script=False):
|
||||
"""Executes an asynchronous JavaScript script, and returns the
|
||||
|
@ -1644,7 +1640,7 @@ class Marionette(object):
|
|||
set_context() has not been called.
|
||||
|
||||
:param script: A string containing the JavaScript to execute.
|
||||
:param script_args: A list of arguments to pass to the script.
|
||||
:param script_args: An interable of arguments to pass to the script.
|
||||
:param sandbox: A tag referring to the sandbox you wish to use; if
|
||||
you specify a new tag, a new sandbox will be created. If you
|
||||
use the special tag `system`, the sandbox will be created
|
||||
|
@ -1668,9 +1664,7 @@ class Marionette(object):
|
|||
''')
|
||||
assert result == 1
|
||||
"""
|
||||
if script_args is None:
|
||||
script_args = []
|
||||
args = self.wrapArguments(script_args)
|
||||
args = self._to_json(script_args)
|
||||
stack = traceback.extract_stack()
|
||||
frame = stack[-2:-1][0] # grab the second-to-last frame
|
||||
body = {"script": script,
|
||||
|
@ -1682,7 +1676,7 @@ class Marionette(object):
|
|||
"filename": os.path.basename(frame[0]),
|
||||
"debug_script": debug_script}
|
||||
rv = self._send_message("executeAsyncScript", body, key="value")
|
||||
return self.unwrapValue(rv)
|
||||
return self._from_json(rv)
|
||||
|
||||
def find_element(self, method, target, id=None):
|
||||
"""Returns an HTMLElement instances that matches the specified
|
||||
|
|
|
@ -2022,36 +2022,7 @@ GeckoDriver.prototype.sendKeysToElement = function*(cmd, resp) {
|
|||
break;
|
||||
|
||||
case Context.CONTENT:
|
||||
let err;
|
||||
let listener = function(msg) {
|
||||
this.mm.removeMessageListener("Marionette:setElementValue", listener);
|
||||
|
||||
let val = msg.data.value;
|
||||
let el = msg.objects.element;
|
||||
let win = this.getCurrentWindow();
|
||||
|
||||
if (el.type == "file") {
|
||||
Cu.importGlobalProperties(["File"]);
|
||||
let fs = Array.prototype.slice.call(el.files);
|
||||
let file;
|
||||
try {
|
||||
file = new File(val);
|
||||
} catch (e) {
|
||||
err = new InvalidArgumentError(`File not found: ${val}`);
|
||||
}
|
||||
fs.push(file);
|
||||
el.mozSetFileArray(fs);
|
||||
} else {
|
||||
el.value = val;
|
||||
}
|
||||
}.bind(this);
|
||||
|
||||
this.mm.addMessageListener("Marionette:setElementValue", listener);
|
||||
yield this.listener.sendKeysToElement({id: id, value: value});
|
||||
this.mm.removeMessageListener("Marionette:setElementValue", listener);
|
||||
if (err) {
|
||||
throw err;
|
||||
}
|
||||
break;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1306,29 +1306,29 @@ event.focus = function(el, opts = {}) {
|
|||
};
|
||||
|
||||
event.mouseover = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "mouseover"}, el, modifiers, opts);
|
||||
return event.sendEvent("mouseover", el, modifiers, opts);
|
||||
};
|
||||
|
||||
event.mousemove = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "mousemove"}, el, modifiers, opts);
|
||||
return event.sendEvent("mousemove", el, modifiers, opts);
|
||||
};
|
||||
|
||||
event.mousedown = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "mousedown"}, el, modifiers, opts);
|
||||
return event.sendEvent("mousedown", el, modifiers, opts);
|
||||
};
|
||||
|
||||
event.mouseup = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "mouseup"}, el, modifiers, opts);
|
||||
return event.sendEvent("mouseup", el, modifiers, opts);
|
||||
};
|
||||
|
||||
event.click = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "click"}, el, modifiers, opts);
|
||||
return event.sendEvent("click", el, modifiers, opts);
|
||||
};
|
||||
|
||||
event.change = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "change"}, el, modifiers, opts);
|
||||
return event.sendEvent("change", el, modifiers, opts);
|
||||
};
|
||||
|
||||
event.input = function(el, modifiers = {}, opts = {}) {
|
||||
return event.sendEvent({type: "input"}, el, modifiers, opts);
|
||||
return event.sendEvent("input", el, modifiers, opts);
|
||||
};
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from marionette import MarionetteTestCase
|
||||
from marionette_driver.errors import UnknownException
|
||||
|
||||
|
||||
class TestCertificates(MarionetteTestCase):
|
||||
def test_block_insecure_sites(self):
|
||||
self.marionette.delete_session()
|
||||
self.marionette.start_session()
|
||||
|
||||
self.marionette.navigate(self.fixtures.where_is("test.html", on="http"))
|
||||
self.assertIn("http://", self.marionette.get_url())
|
||||
with self.assertRaises(UnknownException):
|
||||
self.marionette.navigate(self.fixtures.where_is("test.html", on="https"))
|
||||
|
||||
def test_accept_all_insecure(self):
|
||||
self.marionette.delete_session()
|
||||
self.marionette.start_session({"desiredCapability": {"acceptSslCerts": ["*"]}})
|
||||
self.marionette.navigate(self.fixtures.where_is("test.html", on="https"))
|
||||
self.assertIn("https://", self.marionette.url)
|
||||
|
||||
"""
|
||||
def test_accept_some_insecure(self):
|
||||
self.marionette.delete_session()
|
||||
self.marionette.start_session({"requiredCapabilities": {"acceptSslCerts": ["127.0.0.1"]}})
|
||||
self.marionette.navigate(self.fixtures.where_is("test.html", on="https"))
|
||||
self.assertIn("https://", self.marionette.url)
|
||||
"""
|
|
@ -105,6 +105,22 @@ class TestFileUpload(MarionetteTestCase):
|
|||
Wait(self.marionette).until(lambda m: m.get_url() != url)
|
||||
self.assertIn("multipart/form-data", self.body.text)
|
||||
|
||||
def test_change_event(self):
|
||||
self.marionette.navigate(single)
|
||||
self.marionette.execute_script("""
|
||||
window.changeEvs = [];
|
||||
let el = arguments[arguments.length - 1];
|
||||
el.addEventListener("change", ev => window.changeEvs.push(ev));
|
||||
console.log(window.changeEvs.length);
|
||||
""", script_args=(self.input,), sandbox=None)
|
||||
|
||||
with tempfile() as f:
|
||||
self.input.send_keys(f.name)
|
||||
|
||||
nevs = self.marionette.execute_script(
|
||||
"return window.changeEvs.length", sandbox=None)
|
||||
self.assertEqual(1, nevs)
|
||||
|
||||
def find_inputs(self):
|
||||
return self.marionette.find_elements(By.TAG_NAME, "input")
|
||||
|
||||
|
|
|
@ -221,6 +221,33 @@ interaction.selectOption = function(el) {
|
|||
event.click(parent);
|
||||
};
|
||||
|
||||
/**
|
||||
* Appends |path| to an <input type=file>'s file list.
|
||||
*
|
||||
* @param {HTMLInputElement} el
|
||||
* An <input type=file> element.
|
||||
* @param {File} file
|
||||
* File object to assign to |el|.
|
||||
*/
|
||||
interaction.uploadFile = function(el, file) {
|
||||
let fs = Array.prototype.slice.call(el.files);
|
||||
fs.push(file);
|
||||
|
||||
// <input type=file> opens OS widget dialogue
|
||||
// which means the mousedown/focus/mouseup/click events
|
||||
// occur before the change event
|
||||
event.mouseover(el);
|
||||
event.mousemove(el);
|
||||
event.mousedown(el);
|
||||
event.focus(el);
|
||||
event.mouseup(el);
|
||||
event.click(el);
|
||||
|
||||
el.mozSetFileArray(fs);
|
||||
|
||||
event.change(el);
|
||||
};
|
||||
|
||||
/**
|
||||
* Locate the <select> element that encapsulate an <option> element.
|
||||
*
|
||||
|
|
|
@ -595,20 +595,21 @@ function setTestName(msg) {
|
|||
* sendKeysToElement action on a file input element.
|
||||
*/
|
||||
function receiveFiles(msg) {
|
||||
if ('error' in msg.json) {
|
||||
if ("error" in msg.json) {
|
||||
let err = new InvalidArgumentError(msg.json.error);
|
||||
sendError(err, msg.json.command_id);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!fileInputElement) {
|
||||
let err = new InvalidElementStateError("receiveFiles called with no valid fileInputElement");
|
||||
sendError(err, msg.json.command_id);
|
||||
return;
|
||||
}
|
||||
let fs = Array.prototype.slice.call(fileInputElement.files);
|
||||
fs.push(msg.json.file);
|
||||
fileInputElement.mozSetFileArray(fs);
|
||||
|
||||
interaction.uploadFile(fileInputElement, msg.json.file);
|
||||
fileInputElement = null;
|
||||
|
||||
sendOk(msg.json.command_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,6 +30,8 @@ namespace safebrowsing {
|
|||
template <uint32_t S, class Comparator>
|
||||
struct SafebrowsingHash
|
||||
{
|
||||
static_assert(S >= 4, "The SafebrowsingHash should be at least 4 bytes.");
|
||||
|
||||
static const uint32_t sHashSize = S;
|
||||
typedef SafebrowsingHash<S, Comparator> self_type;
|
||||
uint8_t buf[S];
|
||||
|
@ -104,18 +106,24 @@ struct SafebrowsingHash
|
|||
}
|
||||
|
||||
uint32_t ToUint32() const {
|
||||
return *((uint32_t*)buf);
|
||||
uint32_t n;
|
||||
memcpy(&n, buf, sizeof(n));
|
||||
return n;
|
||||
}
|
||||
void FromUint32(uint32_t aHash) {
|
||||
*((uint32_t*)buf) = aHash;
|
||||
memcpy(buf, &aHash, sizeof(aHash));
|
||||
}
|
||||
};
|
||||
|
||||
class PrefixComparator {
|
||||
public:
|
||||
static int Compare(const uint8_t* a, const uint8_t* b) {
|
||||
uint32_t first = *((uint32_t*)a);
|
||||
uint32_t second = *((uint32_t*)b);
|
||||
uint32_t first;
|
||||
memcpy(&first, a, sizeof(uint32_t));
|
||||
|
||||
uint32_t second;
|
||||
memcpy(&second, b, sizeof(uint32_t));
|
||||
|
||||
if (first > second) {
|
||||
return 1;
|
||||
} else if (first == second) {
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
#include "Entries.h"
|
||||
#include "mozilla/EndianUtils.h"
|
||||
|
||||
TEST(SafebrowsingHash, ToFromUint32)
|
||||
{
|
||||
using namespace mozilla::safebrowsing;
|
||||
|
||||
// typedef SafebrowsingHash<PREFIX_SIZE, PrefixComparator> Prefix;
|
||||
// typedef nsTArray<Prefix> PrefixArray;
|
||||
|
||||
const char PREFIX_RAW[4] = { 0x1, 0x2, 0x3, 0x4 };
|
||||
uint32_t PREFIX_UINT32;
|
||||
memcpy(&PREFIX_UINT32, PREFIX_RAW, 4);
|
||||
|
||||
Prefix p;
|
||||
p.Assign(nsCString(PREFIX_RAW, 4));
|
||||
ASSERT_EQ(p.ToUint32(), PREFIX_UINT32);
|
||||
|
||||
p.FromUint32(PREFIX_UINT32);
|
||||
ASSERT_EQ(memcmp(PREFIX_RAW, p.buf, 4), 0);
|
||||
}
|
||||
|
||||
TEST(SafebrowsingHash, Compare)
|
||||
{
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::safebrowsing;
|
||||
|
||||
Prefix p1, p2, p3;
|
||||
|
||||
// The order of p1,p2,p3 is "p1 == p3 < p2"
|
||||
#if MOZ_LITTLE_ENDIAN
|
||||
p1.Assign(nsCString("\x01\x00\x00\x00", 4));
|
||||
p2.Assign(nsCString("\x00\x00\x00\x01", 4));
|
||||
p3.Assign(nsCString("\x01\x00\x00\x00", 4));
|
||||
#else
|
||||
p1.Assign(nsCString("\x00\x00\x00\x01", 4));
|
||||
p2.Assign(nsCString("\x01\x00\x00\x00", 4));
|
||||
p3.Assign(nsCString("\x00\x00\x00\x01", 4));
|
||||
#endif
|
||||
|
||||
// Make sure "p1 == p3 < p2" is true
|
||||
// on both little and big endian machine.
|
||||
|
||||
ASSERT_EQ(p1.Compare(p2), -1);
|
||||
ASSERT_EQ(p1.Compare(p1), 0);
|
||||
ASSERT_EQ(p2.Compare(p1), 1);
|
||||
ASSERT_EQ(p1.Compare(p3), 0);
|
||||
|
||||
ASSERT_TRUE(p1 < p2);
|
||||
ASSERT_TRUE(p1 == p1);
|
||||
ASSERT_TRUE(p1 == p3);
|
||||
}
|
|
@ -10,6 +10,7 @@ LOCAL_INCLUDES += [
|
|||
|
||||
UNIFIED_SOURCES += [
|
||||
'TestChunkSet.cpp',
|
||||
'TestSafebrowsingHash.cpp',
|
||||
'TestSafeBrowsingProtobuf.cpp',
|
||||
'TestUrlClassifierUtils.cpp',
|
||||
]
|
||||
|
|
|
@ -507,6 +507,8 @@ option('--with-servo', env='SERVO_TARGET_DIR', nargs=1,
|
|||
def servo_target_dir(value):
|
||||
return value[0]
|
||||
|
||||
imply_option('--enable-jemalloc', depends_if('--with-servo')(lambda _: 'moz'))
|
||||
|
||||
set_define('MOZ_STYLO', depends_if(servo_target_dir)(lambda x: bool(x)))
|
||||
set_config('SERVO_TARGET_DIR', servo_target_dir)
|
||||
|
||||
|
@ -694,3 +696,63 @@ def necko_protocols(protocols):
|
|||
|
||||
set_config('NECKO_PROTOCOLS', necko_protocols)
|
||||
add_old_configure_assignment('NECKO_PROTOCOLS', necko_protocols)
|
||||
|
||||
# Graphics
|
||||
# ==============================================================
|
||||
option('--disable-skia', help='Disable use of Skia')
|
||||
|
||||
@depends('--disable-skia', target)
|
||||
def skia(value, target):
|
||||
if value.origin == 'default' and target.endianness == 'big':
|
||||
return False
|
||||
if value:
|
||||
return True
|
||||
|
||||
set_config('MOZ_ENABLE_SKIA', skia)
|
||||
set_define('MOZ_ENABLE_SKIA', skia)
|
||||
set_define('USE_SKIA', skia)
|
||||
|
||||
@depends(skia, target)
|
||||
def skia_android(skia, target):
|
||||
if skia and target.os == 'Android':
|
||||
return True
|
||||
|
||||
set_define('SK_BUILD_FOR_ANDROID_NDK', skia_android)
|
||||
|
||||
option('--disable-skia-gpu', help='Disable use of Skia-GPU')
|
||||
|
||||
@depends('--disable-skia-gpu', skia, target)
|
||||
def skia_gpu(value, skia, target):
|
||||
if value.origin == 'default':
|
||||
if not skia:
|
||||
return False
|
||||
# Skia GPU support may not reliably build on certain *BSDs (see bug 1234494)
|
||||
if target.os in ('NetBSD', 'OpenBSD'):
|
||||
return False
|
||||
elif value and not skia:
|
||||
die('Cannot enable Skia-GPU without enabling Skia')
|
||||
if skia and value:
|
||||
return True
|
||||
|
||||
set_config('MOZ_ENABLE_SKIA_GPU', skia_gpu)
|
||||
set_define('USE_SKIA_GPU', skia_gpu)
|
||||
|
||||
@depends(skia, skia_gpu)
|
||||
def skia_includes(skia, skia_gpu):
|
||||
includes = []
|
||||
if skia:
|
||||
includes += [
|
||||
'/gfx/skia',
|
||||
'/gfx/skia/skia/include/config',
|
||||
'/gfx/skia/skia/include/core',
|
||||
]
|
||||
|
||||
if skia_gpu:
|
||||
includes += [
|
||||
'/gfx/skia/skia/include/gpu',
|
||||
'/gfx/skia/skia/include/utils',
|
||||
]
|
||||
|
||||
return includes
|
||||
|
||||
set_config('SKIA_INCLUDES', skia_includes)
|
||||
|
|
|
@ -38,7 +38,10 @@ WindowSurfaceX11Image::Lock(const LayoutDeviceIntRegion& aRegion)
|
|||
if (mImage)
|
||||
XDestroyImage(mImage);
|
||||
|
||||
int stride = gfx::GetAlignedStride<16>(gfx::BytesPerPixel(mFormat) * size.width);
|
||||
int stride = gfx::GetAlignedStride<16>(size.width, gfx::BytesPerPixel(mFormat));
|
||||
if (stride == 0) {
|
||||
return nullptr;
|
||||
}
|
||||
char* data = static_cast<char*>(malloc(stride * size.height));
|
||||
if (!data)
|
||||
return nullptr;
|
||||
|
|
|
@ -2371,8 +2371,11 @@ nsWindow::UpdateAlpha(SourceSurface* aSourceSurface, nsIntRect aBoundsRect)
|
|||
{
|
||||
// We need to create our own buffer to force the stride to match the
|
||||
// expected stride.
|
||||
int32_t stride = GetAlignedStride<4>(BytesPerPixel(SurfaceFormat::A8) *
|
||||
aBoundsRect.width);
|
||||
int32_t stride = GetAlignedStride<4>(aBoundsRect.width,
|
||||
BytesPerPixel(SurfaceFormat::A8));
|
||||
if (stride == 0) {
|
||||
return;
|
||||
}
|
||||
int32_t bufferSize = stride * aBoundsRect.height;
|
||||
auto imageBuffer = MakeUniqueFallible<uint8_t[]>(bufferSize);
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче