Merge inbound to mozilla-central. a=merge

This commit is contained in:
shindli 2018-05-22 00:29:52 +03:00
commit 4ff26c26f4
50 changed files with 553 additions and 1077 deletions

View File

@ -31,10 +31,10 @@ const TooltipsOverlay = require("devtools/client/inspector/shared/tooltips-overl
const {createChild, promiseWarn} = require("devtools/client/inspector/shared/utils");
const {debounce} = require("devtools/shared/debounce");
const EventEmitter = require("devtools/shared/event-emitter");
const AutocompletePopup = require("devtools/client/shared/autocomplete-popup");
loader.lazyRequireGetter(this, "ClassListPreviewer", "devtools/client/inspector/rules/views/class-list-previewer");
loader.lazyRequireGetter(this, "StyleInspectorMenu", "devtools/client/inspector/shared/style-inspector-menu");
loader.lazyRequireGetter(this, "AutocompletePopup", "devtools/client/shared/autocomplete-popup");
loader.lazyRequireGetter(this, "KeyShortcuts", "devtools/client/shared/key-shortcuts");
loader.lazyRequireGetter(this, "clipboardHelper", "devtools/shared/platform/clipboard");
@ -176,12 +176,6 @@ function CssRuleView(inspector, document, store, pageStyle) {
this.showUserAgentStyles = Services.prefs.getBoolPref(PREF_UA_STYLES);
this.showFontEditor = Services.prefs.getBoolPref(PREF_FONT_EDITOR);
// The popup will be attached to the toolbox document.
this.popup = new AutocompletePopup(inspector._toolbox.doc, {
autoSelect: true,
theme: "auto"
});
this._showEmpty();
// Add the tooltips and highlighters to the view
@ -201,6 +195,18 @@ CssRuleView.prototype = {
// to figure out how shorthand properties will be parsed.
_dummyElement: null,
get popup() {
if (!this._popup) {
// The popup will be attached to the toolbox document.
this._popup = new AutocompletePopup(this.inspector.toolbox.doc, {
autoSelect: true,
theme: "auto",
});
}
return this._popup;
},
get classListPreviewer() {
if (!this._classListPreviewer) {
this._classListPreviewer = new ClassListPreviewer(this.inspector, this.classPanel);
@ -784,7 +790,10 @@ CssRuleView.prototype = {
this._elementStyle.destroy();
}
this.popup.destroy();
if (this._popup) {
this._popup.destroy();
this._popup = null;
}
},
/**

View File

@ -5,14 +5,15 @@
"use strict";
const HTML_NS = "http://www.w3.org/1999/xhtml";
const Services = require("Services");
const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip");
const EventEmitter = require("devtools/shared/event-emitter");
const {HTMLTooltip} = require("devtools/client/shared/widgets/tooltip/HTMLTooltip");
const {PrefObserver} = require("devtools/client/shared/prefs");
const {colorUtils} = require("devtools/shared/css/color");
const HTML_NS = "http://www.w3.org/1999/xhtml";
let itemIdCounter = 0;
/**
* Autocomplete popup UI implementation.
*

View File

@ -35,12 +35,6 @@ enum UseCounter : int16_t {
eUseCounter_Count
};
enum IncCounter : int16_t {
eIncCounter_UNKNOWN = -1,
eIncCounter_ScriptTag,
eIncCounter_Count
};
}
#endif

View File

@ -1492,7 +1492,6 @@ nsIDocument::nsIDocument()
mUseCounters(0),
mChildDocumentUseCounters(0),
mNotifiedPageForUseCounter(0),
mIncCounters(),
mUserHasInteracted(false),
mUserHasActivatedInteraction(false),
mStackRefCnt(0),
@ -1509,9 +1508,6 @@ nsIDocument::nsIDocument()
mIgnoreOpensDuringUnloadCounter(0)
{
SetIsInDocument();
for (auto& cnt : mIncCounters) {
cnt = 0;
}
}
nsDocument::nsDocument(const char* aContentType)
@ -12159,11 +12155,6 @@ nsIDocument::ReportUseCounters(UseCounterReportKind aKind)
}
}
}
if (IsContentDocument() || IsResourceDoc()) {
uint16_t num = mIncCounters[eIncCounter_ScriptTag];
Telemetry::Accumulate(Telemetry::DOM_SCRIPT_EVAL_PER_DOCUMENT, num);
}
}
void

View File

@ -3381,11 +3381,6 @@ public:
void PropagateUseCounters(nsIDocument* aParentDocument);
void SetDocumentIncCounter(mozilla::IncCounter aIncCounter, uint32_t inc = 1)
{
mIncCounters[aIncCounter] += inc;
}
void SetUserHasInteracted(bool aUserHasInteracted);
bool UserHasInteracted()
{
@ -4241,9 +4236,6 @@ protected:
// for this child document.
std::bitset<mozilla::eUseCounter_Count> mNotifiedPageForUseCounter;
// Count the number of times something is seen in a document.
mozilla::Array<uint16_t, mozilla::eIncCounter_Count> mIncCounters;
// Whether the user has interacted with the document or not:
bool mUserHasInteracted;

View File

@ -23,5 +23,5 @@ support-files =
[browser_perwindow_privateBrowsing.js]
skip-if = os == 'linux' && debug # bug 1394671
[browser_private_idb.js]
skip-if = (os == 'osx' && debug) || (os == 'win' && debug) # Bug 1456325
skip-if = (os == 'mac' && debug) || (os == 'win' && debug) # Bug 1456325
[browser_bug839193.js]

View File

@ -175,3 +175,6 @@ CXXFLAGS += CONFIG['TK_CFLAGS']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ASYNC_CONTENTPROC_LAUNCH'] = True

View File

@ -134,11 +134,10 @@ PerformanceObserver::QueueEntry(PerformanceEntry* aEntry)
mQueuedEntries.AppendElement(aEntry);
}
static const char16_t *const sValidTypeNames[4] = {
static const char16_t *const sValidTypeNames[3] = {
u"mark",
u"measure",
u"resource",
u"server"
};
void

View File

@ -163,11 +163,6 @@ ScriptLoadHandler::EnsureDecoder(nsIIncrementalStreamLoader* aLoader,
if (!EnsureDecoder(aLoader, aData, aDataLength, aEndOfStream, charset)) {
return false;
}
if (charset.Length() == 0) {
charset = "?";
}
mozilla::Telemetry::Accumulate(mozilla::Telemetry::DOM_SCRIPT_SRC_ENCODING,
charset);
return true;
}

View File

@ -193,8 +193,7 @@ ScriptLoader::~ScriptLoader()
// Collect telemtry data about the cache information, and the kind of source
// which are being loaded, and where it is being loaded from.
static void
CollectScriptTelemetry(nsIIncrementalStreamLoader* aLoader,
ScriptLoadRequest* aRequest)
CollectScriptTelemetry(ScriptLoadRequest* aRequest)
{
using namespace mozilla::Telemetry;
@ -210,45 +209,27 @@ CollectScriptTelemetry(nsIIncrementalStreamLoader* aLoader,
AccumulateCategorical(LABELS_DOM_SCRIPT_KIND::ClassicScript);
}
// Report the type of source, as well as the size of the source.
// Report the type of source. This is used to monitor the status of the
// JavaScript Start-up Bytecode Cache, with the expectation of an almost zero
// source-fallback and alternate-data being roughtly equal to source loads.
if (aRequest->IsLoadingSource()) {
if (aRequest->mIsInline) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::Inline);
nsAutoString inlineData;
aRequest->mElement->GetScriptText(inlineData);
Accumulate(DOM_SCRIPT_INLINE_SIZE, inlineData.Length());
} else if (aRequest->IsTextSource()) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::SourceFallback);
Accumulate(DOM_SCRIPT_SOURCE_SIZE, aRequest->ScriptText().length());
}
// TODO: Add telemetry for BinAST encoded source.
} else {
MOZ_ASSERT(aRequest->IsLoading());
if (aRequest->IsTextSource()) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::Source);
Accumulate(DOM_SCRIPT_SOURCE_SIZE, aRequest->ScriptText().length());
} else if (aRequest->IsBytecode()) {
AccumulateCategorical(LABELS_DOM_SCRIPT_LOADING_SOURCE::AltData);
Accumulate(DOM_SCRIPT_BYTECODE_SIZE, aRequest->mScriptBytecode.length());
}
// TODO: Add telemetry for BinAST encoded source.
}
// Skip if we do not have any cache information for the given script.
if (!aLoader) {
return;
}
nsCOMPtr<nsIRequest> channel;
aLoader->GetRequest(getter_AddRefs(channel));
nsCOMPtr<nsICacheInfoChannel> cic(do_QueryInterface(channel));
if (!cic) {
return;
}
int32_t fetchCount = 0;
if (NS_SUCCEEDED(cic->GetCacheTokenFetchCount(&fetchCount))) {
Accumulate(DOM_SCRIPT_FETCH_COUNT, fetchCount);
}
}
// Helper method for checking if the script element is an event-handler
@ -1519,7 +1500,7 @@ ScriptLoader::ProcessInlineScript(nsIScriptElement* aElement,
request->mProgress = ScriptLoadRequest::Progress::eLoading_Source;
request->SetTextSource();
TRACE_FOR_TEST_BOOL(request->mElement, "scriptloader_load_source");
CollectScriptTelemetry(nullptr, request);
CollectScriptTelemetry(request);
// Only the 'async' attribute is heeded on an inline module script and
// inline classic scripts ignore both these attributes.
@ -2199,20 +2180,6 @@ ScriptLoader::ShouldCacheBytecode(ScriptLoadRequest* aRequest)
return true;
}
static bool
ShouldRecordParseTimeTelemetry(ScriptLoadRequest* aRequest)
{
static const size_t MinScriptChars = 1024;
static const size_t MinBinASTBytes = 700;
if (aRequest->IsTextSource()) {
return aRequest->ScriptText().length() >= MinScriptChars;
} else {
MOZ_ASSERT(aRequest->IsBinASTSource());
return aRequest->ScriptBinASTData().length() >= MinBinASTBytes;
}
}
nsresult
ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
{
@ -2231,9 +2198,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
return NS_ERROR_FAILURE;
}
// Report telemetry results of the number of scripts evaluated.
mDocument->SetDocumentIncCounter(IncCounter::eIncCounter_ScriptTag);
// Get the script-type to be used by this element.
NS_ASSERTION(scriptContent, "no content - what is default script-type?");
@ -2318,11 +2282,9 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
nsJSUtils::ExecutionContext exec(cx, global);
if (aRequest->mOffThreadToken) {
LOG(("ScriptLoadRequest (%p): Decode Bytecode & Join and Execute", aRequest));
AutoTimer<DOM_SCRIPT_OFF_THREAD_DECODE_EXEC_MS> timer;
rv = exec.DecodeJoinAndExec(&aRequest->mOffThreadToken);
} else {
LOG(("ScriptLoadRequest (%p): Decode Bytecode and Execute", aRequest));
AutoTimer<DOM_SCRIPT_MAIN_THREAD_DECODE_EXEC_MS> timer;
rv = exec.DecodeAndExec(options, aRequest->mScriptBytecode,
aRequest->mBytecodeOffset);
}
@ -2334,14 +2296,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
JS::Rooted<JSScript*> script(cx);
bool encodeBytecode = ShouldCacheBytecode(aRequest);
TimeStamp start;
if (Telemetry::CanRecordExtended()) {
// Only record telemetry for scripts which are above a threshold.
if (aRequest->mCacheInfo && ShouldRecordParseTimeTelemetry(aRequest)) {
start = TimeStamp::Now();
}
}
{
nsJSUtils::ExecutionContext exec(cx, global);
exec.SetEncodeBytecode(encodeBytecode);
@ -2356,12 +2310,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
MOZ_ASSERT(aRequest->IsTextSource());
rv = exec.JoinAndExec(&aRequest->mOffThreadToken, &script);
}
if (start) {
AccumulateTimeDelta(encodeBytecode
? DOM_SCRIPT_OFF_THREAD_PARSE_ENCODE_EXEC_MS
: DOM_SCRIPT_OFF_THREAD_PARSE_EXEC_MS,
start);
}
} else {
// Main thread parsing (inline and small scripts)
LOG(("ScriptLoadRequest (%p): Compile And Exec", aRequest));
@ -2376,12 +2324,6 @@ ScriptLoader::EvaluateScript(ScriptLoadRequest* aRequest)
SourceBufferHolder srcBuf = GetScriptSource(aRequest, inlineData);
rv = exec.CompileAndExec(options, srcBuf, &script);
}
if (start) {
AccumulateTimeDelta(encodeBytecode
? DOM_SCRIPT_MAIN_THREAD_PARSE_ENCODE_EXEC_MS
: DOM_SCRIPT_MAIN_THREAD_PARSE_EXEC_MS,
start);
}
}
}
@ -2499,7 +2441,6 @@ ScriptLoader::EncodeBytecode()
return;
}
Telemetry::AutoTimer<Telemetry::DOM_SCRIPT_ENCODING_MS_PER_DOCUMENT> timer;
AutoEntryScript aes(globalObject, "encode bytecode", true);
RefPtr<ScriptLoadRequest> request;
while (!mBytecodeEncodingQueue.isEmpty()) {
@ -2524,14 +2465,12 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
if (!JS::FinishIncrementalEncoding(aCx, script, aRequest->mScriptBytecode)) {
LOG(("ScriptLoadRequest (%p): Cannot serialize bytecode",
aRequest));
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::EncodingFailure);
return;
}
if (aRequest->mScriptBytecode.length() >= UINT32_MAX) {
LOG(("ScriptLoadRequest (%p): Bytecode cache is too large to be decoded correctly.",
aRequest));
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::BufferTooLarge);
return;
}
@ -2545,7 +2484,6 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
if (NS_FAILED(rv)) {
LOG(("ScriptLoadRequest (%p): Cannot open bytecode cache (rv = %X, output = %p)",
aRequest, unsigned(rv), output.get()));
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::OpenFailure);
return;
}
MOZ_ASSERT(output);
@ -2553,9 +2491,6 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
nsresult rv = output->Close();
LOG(("ScriptLoadRequest (%p): Closing (rv = %X)",
aRequest, unsigned(rv)));
if (NS_FAILED(rv)) {
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::CloseFailure);
}
});
uint32_t n;
@ -2564,13 +2499,11 @@ ScriptLoader::EncodeRequestBytecode(JSContext* aCx, ScriptLoadRequest* aRequest)
LOG(("ScriptLoadRequest (%p): Write bytecode cache (rv = %X, length = %u, written = %u)",
aRequest, unsigned(rv), unsigned(aRequest->mScriptBytecode.length()), n));
if (NS_FAILED(rv)) {
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::WriteFailure);
return;
}
bytecodeFailed.release();
TRACE_FOR_TEST_NONE(aRequest->mElement, "scriptloader_bytecode_saved");
AccumulateCategorical(LABELS_DOM_SCRIPT_ENCODING_STATUS::EncodingSuccess);
}
void
@ -2816,10 +2749,6 @@ ScriptLoader::ConvertToUTF16(nsIChannel* aChannel, const uint8_t* aData,
Unused << hadErrors;
aLengthOut = written;
nsAutoCString charset;
unicodeDecoder->Encoding()->Name(charset);
mozilla::Telemetry::Accumulate(mozilla::Telemetry::DOM_SCRIPT_SRC_ENCODING,
charset);
return NS_OK;
}
@ -3135,7 +3064,7 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest,
return NS_BINDING_ABORTED;
}
MOZ_ASSERT(aRequest->IsLoading());
CollectScriptTelemetry(aLoader, aRequest);
CollectScriptTelemetry(aRequest);
// If we don't have a document, then we need to abort further
// evaluation.

View File

@ -312,7 +312,7 @@ RefPtr<GenericPromise>
ServiceWorkerManager::StartControllingClient(const ClientInfo& aClientInfo,
ServiceWorkerRegistrationInfo* aRegistrationInfo)
{
MOZ_DIAGNOSTIC_ASSERT(aRegistrationInfo->GetActive());
MOZ_RELEASE_ASSERT(aRegistrationInfo->GetActive());
RefPtr<GenericPromise> ref;
@ -1882,6 +1882,7 @@ ServiceWorkerManager::StartControlling(const ClientInfo& aClientInfo,
RefPtr<ServiceWorkerRegistrationInfo> registration =
GetServiceWorkerRegistrationInfo(principal, scope);
NS_ENSURE_TRUE(registration, false);
NS_ENSURE_TRUE(registration->GetActive(), false);
StartControllingClient(aClientInfo, registration);
@ -2557,10 +2558,15 @@ ServiceWorkerManager::MaybeClaimClient(nsIDocument* aDocument,
ServiceWorkerRegistrationInfo* aWorkerRegistration)
{
MOZ_DIAGNOSTIC_ASSERT(aWorkerRegistration);
MOZ_DIAGNOSTIC_ASSERT(aWorkerRegistration->GetActive());
RefPtr<GenericPromise> ref;
if (!aWorkerRegistration->GetActive()) {
ref = GenericPromise::CreateAndReject(NS_ERROR_DOM_INVALID_STATE_ERR,
__func__);
return ref.forget();
}
// Same origin check
if (!aWorkerRegistration->Principal()->Equals(aDocument->NodePrincipal())) {
ref = GenericPromise::CreateAndReject(NS_ERROR_DOM_SECURITY_ERR, __func__);

View File

@ -228,3 +228,6 @@ if CONFIG['MOZ_SANDBOX'] and CONFIG['OS_ARCH'] == 'WINNT':
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-shadow']
if CONFIG['NIGHTLY_BUILD']:
DEFINES['ASYNC_CONTENTPROC_LAUNCH'] = True

View File

@ -342,18 +342,6 @@ class JS_FRIEND_API(GCCellPtr)
uintptr_t ptr;
};
inline bool
operator==(const GCCellPtr& ptr1, const GCCellPtr& ptr2)
{
return ptr1.asCell() == ptr2.asCell();
}
inline bool
operator!=(const GCCellPtr& ptr1, const GCCellPtr& ptr2)
{
return !(ptr1 == ptr2);
}
// Unwraps the given GCCellPtr and calls the given functor with a template
// argument of the actual type of the pointer.
template <typename F, typename... Args>
@ -374,6 +362,21 @@ DispatchTyped(F f, GCCellPtr thing, Args&&... args)
} /* namespace JS */
// These are defined in the toplevel namespace instead of within JS so that
// they won't shadow other operator== overloads (see bug 1456512.)
inline bool
operator==(const JS::GCCellPtr& ptr1, const JS::GCCellPtr& ptr2)
{
return ptr1.asCell() == ptr2.asCell();
}
inline bool
operator!=(const JS::GCCellPtr& ptr1, const JS::GCCellPtr& ptr2)
{
return !(ptr1 == ptr2);
}
namespace js {
namespace gc {
namespace detail {

View File

@ -393,7 +393,7 @@ TenuredCell::readBarrier(TenuredCell* thing)
if (thing->isMarkedGray()) {
// There shouldn't be anything marked grey unless we're on the main thread.
MOZ_ASSERT(CurrentThreadCanAccessRuntime(thing->runtimeFromAnyThread()));
if (!RuntimeFromMainThreadIsHeapMajorCollecting(shadowZone))
if (!JS::CurrentThreadIsHeapCollecting())
JS::UnmarkGrayGCThingRecursively(JS::GCCellPtr(thing, thing->getTraceKind()));
}
}

View File

@ -5008,7 +5008,6 @@ GCRuntime::groupZonesForSweeping(JS::gcreason::Reason reason)
#ifdef JS_GC_ZEAL
// Use one component for two-slice zeal modes.
MOZ_ASSERT_IF(useZeal, isIncremental);
if (useZeal && hasIncrementalTwoSliceZealMode())
finder.useOneComponent();
#endif
@ -5761,8 +5760,7 @@ GCRuntime::beginSweepingSweepGroup(FreeOp* fop, SliceBudget& budget)
bool
GCRuntime::shouldYieldForZeal(ZealMode mode)
{
MOZ_ASSERT_IF(useZeal, isIncremental);
return useZeal && hasZealMode(mode);
return useZeal && isIncremental && hasZealMode(mode);
}
IncrementalProgress

View File

@ -0,0 +1,10 @@
if (!('oomTest' in this))
quit();
oomTest(function() {
grayRoot().x = Object.create((obj[name]++));
});
oomTest(function() {
gczeal(9);
gcslice(new.target);
});

View File

@ -3576,6 +3576,7 @@ WorkerMain(void* arg)
auto guard = mozilla::MakeScopeExit([&] {
CancelOffThreadJobsForContext(cx);
sc->markObservers.reset();
JS_DestroyContext(cx);
js_delete(sc);
js_delete(input);
@ -8560,11 +8561,6 @@ SetContextOptions(JSContext* cx, const OptionParser& op)
}
}
if (op.getStringOption("ion-aa")) {
// Removed in bug 1455280, the option is preserved
// to ease transition for fuzzers and other tools
}
if (const char* str = op.getStringOption("ion-licm")) {
if (strcmp(str, "on") == 0)
jit::JitOptions.disableLicm = false;
@ -9070,9 +9066,6 @@ main(int argc, char** argv, char** envp)
" on: enable GVN (default)\n")
|| !op.addStringOption('\0', "ion-licm", "on/off",
"Loop invariant code motion (default: on, off to disable)")
|| !op.addStringOption('\0', "ion-aa", "flow-sensitive/flow-insensitive",
"Specify wheter or not to use flow sensitive Alias Analysis"
"(default: flow-insensitive)")
|| !op.addStringOption('\0', "ion-edgecase-analysis", "on/off",
"Find edge cases where Ion can avoid bailouts (default: on, off to disable)")
|| !op.addStringOption('\0', "ion-pgo", "on/off",

View File

@ -0,0 +1,7 @@
var wm = new WeakMap();
grayRoot().map = wm;
wm = null;
gczeal(13, 7);
var lfOffThreadGlobal = newGlobal();
reportCompare('do not crash', 'do not crash', 'did not crash!');

View File

@ -0,0 +1,7 @@
if (typeof 'evalInWorder' == 'function') {
evalInWorker(`
addMarkObservers([grayRoot(), grayRoot().x, this, Object.create(null)]);
`);
}
reportCompare('do not crash', 'do not crash', 'did not crash!');

View File

@ -307,10 +307,9 @@ bool
JSRope::copyCharsInternal(JSContext* cx, ScopedJSFreePtr<CharT>& out,
bool nullTerminate) const
{
/*
* Perform non-destructive post-order traversal of the rope, splatting
* each node's characters into a contiguous buffer.
*/
// Left-leaning ropes are far more common than right-leaning ropes, so
// perform a non-destructive traversal of the rope, right node first,
// splatting each node's characters into a contiguous buffer.
size_t n = length();
if (cx)
@ -323,22 +322,22 @@ JSRope::copyCharsInternal(JSContext* cx, ScopedJSFreePtr<CharT>& out,
Vector<const JSString*, 8, SystemAllocPolicy> nodeStack;
const JSString* str = this;
CharT* pos = out;
CharT* end = out + str->length();
while (true) {
if (str->isRope()) {
if (!nodeStack.append(str->asRope().rightChild()))
if (!nodeStack.append(str->asRope().leftChild()))
return false;
str = str->asRope().leftChild();
str = str->asRope().rightChild();
} else {
CopyChars(pos, str->asLinear());
pos += str->length();
end -= str->length();
CopyChars(end, str->asLinear());
if (nodeStack.empty())
break;
str = nodeStack.popCopy();
}
}
MOZ_ASSERT(pos == out + n);
MOZ_ASSERT(end == out);
if (nullTerminate)
out[n] = 0;

View File

@ -87,10 +87,7 @@ var supported_properties = {
"background-color": [ test_color_transition,
test_true_currentcolor_transition ],
"background-position": [ test_background_position_transition,
// FIXME: We don't currently test clamping,
// since background-position uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
test_length_percent_pair_unclamped ],
"background-position-x": [ test_background_position_coord_transition,
test_length_transition,
test_percent_transition,
@ -106,10 +103,7 @@ var supported_properties = {
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
"background-size": [ test_background_size_transition,
// FIXME: We don't currently test clamping,
// since background-size uses calc() as an
// intermediate form.
/* test_length_percent_pair_clamped */ ],
test_length_percent_pair_clamped ],
"border-bottom-color": [ test_color_transition,
test_true_currentcolor_transition ],
"border-bottom-width": [ test_length_transition,
@ -195,10 +189,7 @@ var supported_properties = {
test_length_percent_calc_transition,
test_length_unclamped, test_percent_unclamped ],
"mask-position": [ test_background_position_transition,
// FIXME: We don't currently test clamping,
// since mask-position uses calc() as
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
test_length_percent_pair_unclamped ],
"mask-position-x": [ test_background_position_coord_transition,
test_length_transition,
test_percent_transition,
@ -214,10 +205,7 @@ var supported_properties = {
// an intermediate form.
/* test_length_percent_pair_unclamped */ ],
"mask-size": [ test_background_size_transition,
// FIXME: We don't currently test clamping,
// since mask-size uses calc() as an
// intermediate form.
/* test_length_percent_pair_clamped */ ],
test_length_percent_pair_clamped ],
"max-height": [ test_length_transition, test_percent_transition,
test_length_clamped, test_percent_clamped ],
"max-width": [ test_length_transition, test_percent_transition,
@ -2119,11 +2107,18 @@ function test_length_percent_pair_clamped_or_unclamped(prop, is_clamped) {
div.style.setProperty("transition-timing-function", FUNC_NEGATIVE, "");
div.style.setProperty("transition-property", "none", "");
div.style.setProperty(prop, "0px 0%", "");
is(cs.getPropertyValue(prop), "0px 0px",
var is_zero = function(val) {
if (prop == "transform-origin" || prop == "perspective-origin") {
// These two properties resolve percentages to pixels.
return val == "0px 0px";
}
return val == "0px 0%";
}
ok(is_zero(cs.getPropertyValue(prop)),
"length+percent-valued property " + prop + ": flush before clamping test");
div.style.setProperty("transition-property", prop, "");
div.style.setProperty(prop, "30px 25%", "");
(is_clamped ? is : isnot)(cs.getPropertyValue(prop), "0px 0px",
is(is_zero(cs.getPropertyValue(prop)), is_clamped,
"length+percent-valued property " + prop + ": clamping of negatives");
div.style.setProperty("transition-timing-function", "linear", "");
}

View File

@ -315,11 +315,7 @@ public:
bool isNothing() const { return !mIsSome; }
/* Returns the contents of this Maybe<T> by value. Unsafe unless |isSome()|. */
T value() const
{
MOZ_ASSERT(mIsSome);
return ref();
}
T value() const;
/*
* Returns the contents of this Maybe<T> by value. If |isNothing()|, returns
@ -348,17 +344,8 @@ public:
}
/* Returns the contents of this Maybe<T> by pointer. Unsafe unless |isSome()|. */
T* ptr()
{
MOZ_ASSERT(mIsSome);
return &ref();
}
const T* ptr() const
{
MOZ_ASSERT(mIsSome);
return &ref();
}
T* ptr();
const T* ptr() const;
/*
* Returns the contents of this Maybe<T> by pointer. If |isNothing()|,
@ -402,30 +389,12 @@ public:
return aFunc();
}
T* operator->()
{
MOZ_ASSERT(mIsSome);
return ptr();
}
const T* operator->() const
{
MOZ_ASSERT(mIsSome);
return ptr();
}
T* operator->();
const T* operator->() const;
/* Returns the contents of this Maybe<T> by ref. Unsafe unless |isSome()|. */
T& ref()
{
MOZ_ASSERT(mIsSome);
return *static_cast<T*>(data());
}
const T& ref() const
{
MOZ_ASSERT(mIsSome);
return *static_cast<const T*>(data());
}
T& ref();
const T& ref() const;
/*
* Returns the contents of this Maybe<T> by ref. If |isNothing()|, returns
@ -469,17 +438,8 @@ public:
return aFunc();
}
T& operator*()
{
MOZ_ASSERT(mIsSome);
return ref();
}
const T& operator*() const
{
MOZ_ASSERT(mIsSome);
return ref();
}
T& operator*();
const T& operator*() const;
/* If |isSome()|, runs the provided function or functor on the contents of
* this Maybe. */
@ -544,12 +504,7 @@ public:
* arguments to |emplace()| are the parameters to T's constructor.
*/
template<typename... Args>
void emplace(Args&&... aArgs)
{
MOZ_ASSERT(!mIsSome);
::new (KnownNotNull, data()) T(Forward<Args>(aArgs)...);
mIsSome = true;
}
void emplace(Args&&... aArgs);
friend std::ostream&
operator<<(std::ostream& aStream, const Maybe<T>& aMaybe)
@ -563,6 +518,88 @@ public:
}
};
template<typename T>
T
Maybe<T>::value() const
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return ref();
}
template<typename T>
T*
Maybe<T>::ptr()
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return &ref();
}
template<typename T>
const T*
Maybe<T>::ptr() const
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return &ref();
}
template<typename T>
T*
Maybe<T>::operator->()
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return ptr();
}
template<typename T>
const T*
Maybe<T>::operator->() const
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return ptr();
}
template<typename T>
T&
Maybe<T>::ref()
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return *static_cast<T*>(data());
}
template<typename T>
const T&
Maybe<T>::ref() const
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return *static_cast<const T*>(data());
}
template<typename T>
T&
Maybe<T>::operator*()
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return ref();
}
template<typename T>
const T&
Maybe<T>::operator*() const
{
MOZ_DIAGNOSTIC_ASSERT(mIsSome);
return ref();
}
template<typename T>
template<typename... Args>
void
Maybe<T>::emplace(Args&&... aArgs)
{
MOZ_DIAGNOSTIC_ASSERT(!mIsSome);
::new (KnownNotNull, data()) T(Forward<Args>(aArgs)...);
mIsSome = true;
}
/*
* Some() creates a Maybe<T> value containing the provided T value. If T has a
* move constructor, it's used to make this as efficient as possible.

View File

@ -1857,6 +1857,26 @@ HttpChannelParent::StartRedirect(uint32_t registrarId,
MOZ_ASSERT(!oldIntercepted);
#endif
// We need to move across the reserved and initial client information
// to the new channel. Normally this would be handled by the child
// ClientChannelHelper, but that is not notified of this redirect since
// we're not propagating it back to the child process.
nsCOMPtr<nsILoadInfo> oldLoadInfo;
Unused << mChannel->GetLoadInfo(getter_AddRefs(oldLoadInfo));
nsCOMPtr<nsILoadInfo> newLoadInfo;
Unused << newChannel->GetLoadInfo(getter_AddRefs(newLoadInfo));
if (oldLoadInfo && newLoadInfo) {
Maybe<ClientInfo> reservedClientInfo(oldLoadInfo->GetReservedClientInfo());
if (reservedClientInfo.isSome()) {
newLoadInfo->SetReservedClientInfo(reservedClientInfo.ref());
}
Maybe<ClientInfo> initialClientInfo(oldLoadInfo->GetInitialClientInfo());
if (initialClientInfo.isSome()) {
newLoadInfo->SetInitialClientInfo(initialClientInfo.ref());
}
}
// Re-link the HttpChannelParent to the new InterceptedHttpChannel.
nsCOMPtr<nsIChannel> linkedChannel;
rv = NS_LinkRedirectChannels(registrarId, this, getter_AddRefs(linkedChannel));

View File

@ -164,7 +164,7 @@ class Longhand(object):
allowed_in_keyframe_block=True, cast_type='u8',
logical=False, alias=None, extra_prefixes=None, boxed=False,
flags=None, allowed_in_page_rule=False, allow_quirks=False, ignored_when_colors_disabled=False,
vector=False, need_animatable=False, servo_restyle_damage="repaint"):
vector=False, servo_restyle_damage="repaint"):
self.name = name
if not spec:
raise TypeError("Spec should be specified for %s" % name)

View File

@ -2607,10 +2607,16 @@ fn static_assert() {
}
pub fn set_font_stretch(&mut self, v: longhands::font_stretch::computed_value::T) {
unsafe { bindings::Gecko_FontStretch_SetFloat(&mut self.gecko.mFont.stretch, (v.0).0) };
unsafe {
bindings::Gecko_FontStretch_SetFloat(
&mut self.gecko.mFont.stretch,
v.value(),
)
};
}
${impl_simple_copy('font_stretch', 'mFont.stretch')}
pub fn clone_font_stretch(&self) -> longhands::font_stretch::computed_value::T {
use values::computed::font::FontStretch;
use values::computed::Percentage;
use values::generics::NonNegative;
@ -2618,7 +2624,7 @@ fn static_assert() {
unsafe { bindings::Gecko_FontStretch_ToFloat(self.gecko.mFont.stretch) };
debug_assert!(stretch >= 0.);
NonNegative(Percentage(stretch))
FontStretch(NonNegative(Percentage(stretch)))
}
pub fn set_font_style(&mut self, v: longhands::font_style::computed_value::T) {
@ -3242,7 +3248,7 @@ fn static_assert() {
pub fn clone_scroll_snap_coordinate(&self) -> longhands::scroll_snap_coordinate::computed_value::T {
let vec = self.gecko.mScrollSnapCoordinate.iter().map(|f| f.into()).collect();
longhands::scroll_snap_coordinate::computed_value::T(vec)
longhands::scroll_snap_coordinate::computed_value::List(vec)
}
${impl_css_url('_moz_binding', 'mBinding')}
@ -3748,8 +3754,9 @@ fn static_assert() {
<% copy_simple_image_array_property(name, shorthand, layer_field_name, field_name) %>
pub fn set_${ident}<I>(&mut self, v: I)
where I: IntoIterator<Item=longhands::${ident}::computed_value::single_value::T>,
I::IntoIter: ExactSizeIterator
where
I: IntoIterator<Item=longhands::${ident}::computed_value::single_value::T>,
I::IntoIter: ExactSizeIterator,
{
use properties::longhands::${ident}::single_value::computed_value::T as Keyword;
use gecko_bindings::structs::nsStyleImageLayers_LayerType as LayerType;
@ -3784,7 +3791,7 @@ fn static_assert() {
% endfor
% endif
longhands::${ident}::computed_value::T (
longhands::${ident}::computed_value::List(
self.gecko.${layer_field_name}.mLayers.iter()
.take(self.gecko.${layer_field_name}.${field_name}Count as usize)
.map(|ref layer| {
@ -3851,7 +3858,7 @@ fn static_assert() {
}
}
longhands::${shorthand}_repeat::computed_value::T (
longhands::${shorthand}_repeat::computed_value::List(
self.gecko.${image_layers_field}.mLayers.iter()
.take(self.gecko.${image_layers_field}.mRepeatCount as usize)
.map(|ref layer| {
@ -3890,7 +3897,7 @@ fn static_assert() {
pub fn clone_${shorthand}_position_${orientation}(&self)
-> longhands::${shorthand}_position_${orientation}::computed_value::T {
longhands::${shorthand}_position_${orientation}::computed_value::T(
longhands::${shorthand}_position_${orientation}::computed_value::List(
self.gecko.${image_layers_field}.mLayers.iter()
.take(self.gecko.${image_layers_field}.mPosition${orientation.upper()}Count as usize)
.map(|position| position.mPosition.m${orientation.upper()}Position.into())
@ -3934,11 +3941,11 @@ fn static_assert() {
BackgroundSize::Explicit { width: explicit_width, height: explicit_height } => {
let mut w_type = nsStyleImageLayers_Size_DimensionType::eAuto;
let mut h_type = nsStyleImageLayers_Size_DimensionType::eAuto;
if let Some(w) = explicit_width.to_calc_value() {
if let Some(w) = explicit_width.0.to_calc_value() {
width = w;
w_type = nsStyleImageLayers_Size_DimensionType::eLengthPercentage;
}
if let Some(h) = explicit_height.to_calc_value() {
if let Some(h) = explicit_height.0.to_calc_value() {
height = h;
h_type = nsStyleImageLayers_Size_DimensionType::eLengthPercentage;
}
@ -3966,22 +3973,23 @@ fn static_assert() {
}
</%self:simple_image_array_property>
pub fn clone_${shorthand}_size(&self) -> longhands::background_size::computed_value::T {
pub fn clone_${shorthand}_size(&self) -> longhands::${shorthand}_size::computed_value::T {
use gecko_bindings::structs::nsStyleCoord_CalcValue as CalcValue;
use gecko_bindings::structs::nsStyleImageLayers_Size_DimensionType as DimensionType;
use values::computed::LengthOrPercentageOrAuto;
use values::generics::NonNegative;
use values::computed::NonNegativeLengthOrPercentageOrAuto;
use values::generics::background::BackgroundSize;
fn to_servo(value: CalcValue, ty: u8) -> LengthOrPercentageOrAuto {
fn to_servo(value: CalcValue, ty: u8) -> NonNegativeLengthOrPercentageOrAuto {
if ty == DimensionType::eAuto as u8 {
LengthOrPercentageOrAuto::Auto
NonNegativeLengthOrPercentageOrAuto::auto()
} else {
debug_assert_eq!(ty, DimensionType::eLengthPercentage as u8);
value.into()
NonNegative(value.into())
}
}
longhands::background_size::computed_value::T(
longhands::${shorthand}_size::computed_value::List(
self.gecko.${image_layers_field}.mLayers.iter().map(|ref layer| {
if DimensionType::eCover as u8 == layer.mSize.mWidthType {
debug_assert_eq!(layer.mSize.mHeightType, DimensionType::eCover as u8);
@ -4052,7 +4060,7 @@ fn static_assert() {
pub fn clone_${shorthand}_image(&self) -> longhands::${shorthand}_image::computed_value::T {
use values::None_;
longhands::${shorthand}_image::computed_value::T(
longhands::${shorthand}_image::computed_value::List(
self.gecko.${image_layers_field}.mLayers.iter()
.take(self.gecko.${image_layers_field}.mImageCount as usize)
.map(|ref layer| {
@ -4308,7 +4316,7 @@ fn static_assert() {
pub fn clone_box_shadow(&self) -> longhands::box_shadow::computed_value::T {
let buf = self.gecko.mBoxShadow.iter().map(|v| v.to_box_shadow()).collect();
longhands::box_shadow::computed_value::T(buf)
longhands::box_shadow::computed_value::List(buf)
}
pub fn set_clip(&mut self, v: longhands::clip::computed_value::T) {
@ -4553,7 +4561,7 @@ fn static_assert() {
_ => {},
}
}
longhands::filter::computed_value::T(filters)
longhands::filter::computed_value::List(filters)
}
</%self:impl_trait>
@ -4674,7 +4682,7 @@ fn static_assert() {
pub fn clone_text_shadow(&self) -> longhands::text_shadow::computed_value::T {
let buf = self.gecko.mTextShadow.iter().map(|v| v.to_simple_shadow()).collect();
longhands::text_shadow::computed_value::T(buf)
longhands::text_shadow::computed_value::List(buf)
}
pub fn set_line_height(&mut self, v: longhands::line_height::computed_value::T) {

View File

@ -8,7 +8,8 @@
%>
<%def name="predefined_type(name, type, initial_value, parse_method='parse',
needs_context=True, vector=False, computed_type=None, initial_specified_value=None,
needs_context=True, vector=False,
computed_type=None, initial_specified_value=None,
allow_quirks=False, allow_empty=False, **kwargs)">
<%def name="predefined_type_inner(name, type, initial_value, parse_method)">
#[allow(unused_imports)]
@ -77,10 +78,12 @@
We assume that the default/initial value is an empty vector for these.
`initial_value` need not be defined for these.
</%doc>
<%def name="vector_longhand(name, animation_value_type=None, allow_empty=False, separator='Comma',
need_animatable=False, **kwargs)">
<%def name="vector_longhand(name, animation_value_type=None,
vector_animation_type=None, allow_empty=False,
separator='Comma',
**kwargs)">
<%call expr="longhand(name, animation_value_type=animation_value_type, vector=True,
need_animatable=need_animatable, **kwargs)">
**kwargs)">
#[allow(unused_imports)]
use smallvec::SmallVec;
@ -115,36 +118,68 @@
% endif
use values::computed::ComputedVecIter;
/// The computed value, effectively a list of single values.
/// The generic type defining the value for this property.
% if separator == "Comma":
#[css(comma)]
% endif
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
% if need_animatable or animation_value_type == "ComputedValue":
#[derive(Animate, ComputeSquaredDistance)]
% endif
pub struct T(
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToAnimatedValue,
ToCss)]
pub struct List<T>(
% if not allow_empty:
#[css(iterable)]
% else:
#[css(if_empty = "none", iterable)]
% endif
% if allow_empty and allow_empty != "NotInitial":
pub Vec<single_value::T>,
pub Vec<T>,
% else:
pub SmallVec<[single_value::T; 1]>,
pub SmallVec<[T; 1]>,
% endif
);
% if need_animatable or animation_value_type == "ComputedValue":
use values::animated::{ToAnimatedZero};
impl ToAnimatedZero for T {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
}
/// The computed value, effectively a list of single values.
% if vector_animation_type:
% if not animation_value_type:
Sorry, this is stupid but needed for now.
% endif
use properties::animated_properties::ListAnimation;
use values::animated::{Animate, ToAnimatedValue, ToAnimatedZero, Procedure};
use values::distance::{SquaredDistance, ComputeSquaredDistance};
// FIXME(emilio): For some reason rust thinks that this alias is
// unused, even though it's clearly used below?
#[allow(unused)]
type AnimatedList = <List<single_value::T> as ToAnimatedValue>::AnimatedValue;
impl ToAnimatedZero for AnimatedList {
fn to_animated_zero(&self) -> Result<Self, ()> { Err(()) }
}
impl Animate for AnimatedList {
fn animate(
&self,
other: &Self,
procedure: Procedure,
) -> Result<Self, ()> {
Ok(List(
self.0.animate_${vector_animation_type}(&other.0, procedure)?
))
}
}
impl ComputeSquaredDistance for AnimatedList {
fn compute_squared_distance(
&self,
other: &Self,
) -> Result<SquaredDistance, ()> {
self.0.squared_distance_${vector_animation_type}(&other.0)
}
}
% endif
pub type T = List<single_value::T>;
pub type Iter<'a, 'cx, 'cx_a> = ComputedVecIter<'a, 'cx, 'cx_a, super::single_value::SpecifiedValue>;
impl IntoIterator for T {
@ -176,16 +211,18 @@
pub fn get_initial_value() -> computed_value::T {
% if allow_empty and allow_empty != "NotInitial":
computed_value::T(vec![])
computed_value::List(vec![])
% else:
let mut v = SmallVec::new();
v.push(single_value::get_initial_value());
computed_value::T(v)
computed_value::List(v)
% endif
}
pub fn parse<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<SpecifiedValue, ParseError<'i>> {
pub fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<SpecifiedValue, ParseError<'i>> {
use style_traits::Separator;
% if allow_empty:
@ -202,8 +239,10 @@
pub use self::single_value::SpecifiedValue as SingleSpecifiedValue;
impl SpecifiedValue {
pub fn compute_iter<'a, 'cx, 'cx_a>(&'a self, context: &'cx Context<'cx_a>)
-> computed_value::Iter<'a, 'cx, 'cx_a> {
pub fn compute_iter<'a, 'cx, 'cx_a>(
&'a self,
context: &'cx Context<'cx_a>,
) -> computed_value::Iter<'a, 'cx, 'cx_a> {
computed_value::Iter::new(context, &self.0)
}
}
@ -213,7 +252,7 @@
#[inline]
fn to_computed_value(&self, context: &Context) -> computed_value::T {
computed_value::T(self.compute_iter(context).collect())
computed_value::List(self.compute_iter(context).collect())
}
#[inline]

View File

@ -29,11 +29,10 @@ use std::mem::{self, ManuallyDrop};
#[cfg(feature = "gecko")] use hash::FnvHashMap;
use style_traits::{KeywordsCollectFn, ParseError, SpecifiedValueInfo};
use super::ComputedValues;
use values::{CSSFloat, CustomIdent, Either};
use values::{CSSFloat, CustomIdent};
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use values::animated::color::RGBA as AnimatedRGBA;
use values::animated::effects::Filter as AnimatedFilter;
use values::animated::effects::FilterList as AnimatedFilterList;
use values::computed::{Angle, CalcLengthOrPercentage};
use values::computed::{ClipRect, Context};
use values::computed::{Length, LengthOrPercentage, LengthOrPercentageOrAuto};
@ -53,13 +52,10 @@ use values::distance::{ComputeSquaredDistance, SquaredDistance};
use values::generics::font::{FontSettings as GenericFontSettings, FontTag, VariationValue};
use values::computed::font::FontVariationSettings;
use values::generics::effects::Filter;
use values::generics::position as generic_position;
use values::generics::svg::{SVGLength, SvgLengthOrPercentageOrNumber, SVGPaint};
use values::generics::svg::{SVGPaintKind, SVGStrokeDashArray, SVGOpacity};
use void::{self, Void};
/// <https://drafts.csswg.org/css-transitions/#animtype-repeatable-list>
pub trait RepeatableListAnimatable: Animate {}
/// Returns true if this nsCSSPropertyID is one of the animatable properties.
#[cfg(feature = "gecko")]
@ -755,18 +751,45 @@ impl ToAnimatedZero for AnimationValue {
}
}
impl RepeatableListAnimatable for LengthOrPercentage {}
impl RepeatableListAnimatable for Either<f32, LengthOrPercentage> {}
impl RepeatableListAnimatable for Either<NonNegativeNumber, NonNegativeLengthOrPercentage> {}
impl RepeatableListAnimatable for SvgLengthOrPercentageOrNumber<LengthOrPercentage, Number> {}
/// A trait to abstract away the different kind of animations over a list that
/// there may be.
pub trait ListAnimation<T> : Sized {
/// <https://drafts.csswg.org/css-transitions/#animtype-repeatable-list>
fn animate_repeatable_list(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>
where
T: Animate;
macro_rules! repeated_vec_impl {
($($ty:ty),*) => {
$(impl<T> Animate for $ty
where
T: RepeatableListAnimatable,
{
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
/// <https://drafts.csswg.org/css-transitions/#animtype-repeatable-list>
fn squared_distance_repeatable_list(&self, other: &Self) -> Result<SquaredDistance, ()>
where
T: ComputeSquaredDistance;
/// This is the animation used for some of the types like shadows and
/// filters, where the interpolation happens with the zero value if one of
/// the sides is not present.
fn animate_with_zero(&self, other: &Self, procedure: Procedure) -> Result<Self, ()>
where
T: Animate + Clone + ToAnimatedZero;
/// This is the animation used for some of the types like shadows and
/// filters, where the interpolation happens with the zero value if one of
/// the sides is not present.
fn squared_distance_with_zero(&self, other: &Self) -> Result<SquaredDistance, ()>
where
T: ToAnimatedZero + ComputeSquaredDistance;
}
macro_rules! animated_list_impl {
(<$t:ident> for $ty:ty) => {
impl<$t> ListAnimation<$t> for $ty {
fn animate_repeatable_list(
&self,
other: &Self,
procedure: Procedure,
) -> Result<Self, ()>
where
T: Animate,
{
// If the length of either list is zero, the least common multiple is undefined.
if self.is_empty() || other.is_empty() {
return Err(());
@ -777,14 +800,14 @@ macro_rules! repeated_vec_impl {
this.animate(other, procedure)
}).collect()
}
}
impl<T> ComputeSquaredDistance for $ty
where
T: ComputeSquaredDistance + RepeatableListAnimatable,
{
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
fn squared_distance_repeatable_list(
&self,
other: &Self,
) -> Result<SquaredDistance, ()>
where
T: ComputeSquaredDistance,
{
if self.is_empty() || other.is_empty() {
return Err(());
}
@ -794,11 +817,59 @@ macro_rules! repeated_vec_impl {
this.compute_squared_distance(other)
}).sum()
}
})*
};
fn animate_with_zero(
&self,
other: &Self,
procedure: Procedure,
) -> Result<Self, ()>
where
T: Animate + Clone + ToAnimatedZero
{
if procedure == Procedure::Add {
return Ok(
self.iter().chain(other.iter()).cloned().collect()
);
}
self.iter().zip_longest(other.iter()).map(|it| {
match it {
EitherOrBoth::Both(this, other) => {
this.animate(other, procedure)
},
EitherOrBoth::Left(this) => {
this.animate(&this.to_animated_zero()?, procedure)
},
EitherOrBoth::Right(other) => {
other.to_animated_zero()?.animate(other, procedure)
}
}
}).collect()
}
fn squared_distance_with_zero(
&self,
other: &Self,
) -> Result<SquaredDistance, ()>
where
T: ToAnimatedZero + ComputeSquaredDistance
{
self.iter().zip_longest(other.iter()).map(|it| {
match it {
EitherOrBoth::Both(this, other) => {
this.compute_squared_distance(other)
},
EitherOrBoth::Left(list) | EitherOrBoth::Right(list) => {
list.to_animated_zero()?.compute_squared_distance(list)
},
}
}).sum()
}
}
}
}
repeated_vec_impl!(SmallVec<[T; 1]>, Vec<T>);
animated_list_impl!(<T> for SmallVec<[T; 1]>);
animated_list_impl!(<T> for Vec<T>);
/// <https://drafts.csswg.org/css-transitions/#animtype-visibility>
impl Animate for Visibility {
@ -1027,9 +1098,6 @@ impl<'a> Iterator for FontSettingTagIter<'a> {
}
}
impl<H, V> RepeatableListAnimatable for generic_position::Position<H, V>
where H: RepeatableListAnimatable, V: RepeatableListAnimatable {}
/// <https://drafts.csswg.org/css-transitions/#animtype-rect>
impl Animate for ClipRect {
#[inline]
@ -2668,27 +2736,16 @@ impl ComputeSquaredDistance for ComputedTransformOperation {
impl ComputeSquaredDistance for ComputedTransform {
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
let list1 = &self.0;
let list2 = &other.0;
let squared_dist = self.0.squared_distance_with_zero(&other.0);
let squared_dist: Result<SquaredDistance, _> = list1.iter().zip_longest(list2).map(|it| {
match it {
EitherOrBoth::Both(this, other) => {
this.compute_squared_distance(other)
},
EitherOrBoth::Left(list) | EitherOrBoth::Right(list) => {
list.to_animated_zero()?.compute_squared_distance(list)
},
}
}).sum();
// Roll back to matrix interpolation if there is any Err(()) in the transform lists, such
// as mismatched transform functions.
if let Err(_) = squared_dist {
// Roll back to matrix interpolation if there is any Err(()) in the
// transform lists, such as mismatched transform functions.
if squared_dist.is_err() {
let matrix1: Matrix3D = self.to_transform_3d_matrix(None)?.0.into();
let matrix2: Matrix3D = other.to_transform_3d_matrix(None)?.0.into();
return matrix1.compute_squared_distance(&matrix2);
}
squared_dist
}
}
@ -2828,7 +2885,7 @@ where
/// <https://www.w3.org/TR/SVG11/painting.html#StrokeDasharrayProperty>
impl<L> Animate for SVGStrokeDashArray<L>
where
L: Clone + RepeatableListAnimatable,
L: Clone + Animate,
{
#[inline]
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
@ -2838,7 +2895,22 @@ where
}
match (self, other) {
(&SVGStrokeDashArray::Values(ref this), &SVGStrokeDashArray::Values(ref other)) => {
Ok(SVGStrokeDashArray::Values(this.animate(other, procedure)?))
Ok(SVGStrokeDashArray::Values(this.animate_repeatable_list(other, procedure)?))
},
_ => Err(()),
}
}
}
impl<L> ComputeSquaredDistance for SVGStrokeDashArray<L>
where
L: ComputeSquaredDistance,
{
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
match (self, other) {
(&SVGStrokeDashArray::Values(ref this), &SVGStrokeDashArray::Values(ref other)) => {
this.squared_distance_repeatable_list(other)
},
_ => Err(()),
}
@ -2929,50 +3001,6 @@ impl ToAnimatedZero for AnimatedFilter {
}
}
impl Animate for AnimatedFilterList {
#[inline]
fn animate(
&self,
other: &Self,
procedure: Procedure,
) -> Result<Self, ()> {
if procedure == Procedure::Add {
return Ok(AnimatedFilterList(
self.0.iter().chain(other.0.iter()).cloned().collect(),
));
}
Ok(AnimatedFilterList(self.0.iter().zip_longest(other.0.iter()).map(|it| {
match it {
EitherOrBoth::Both(this, other) => {
this.animate(other, procedure)
},
EitherOrBoth::Left(this) => {
this.animate(&this.to_animated_zero()?, procedure)
},
EitherOrBoth::Right(other) => {
other.to_animated_zero()?.animate(other, procedure)
},
}
}).collect::<Result<Vec<_>, _>>()?))
}
}
impl ComputeSquaredDistance for AnimatedFilterList {
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
self.0.iter().zip_longest(other.0.iter()).map(|it| {
match it {
EitherOrBoth::Both(this, other) => {
this.compute_squared_distance(other)
},
EitherOrBoth::Left(list) | EitherOrBoth::Right(list) => {
list.to_animated_zero()?.compute_squared_distance(list)
},
}
}).sum()
}
}
/// A comparator to sort PropertyIds such that longhands are sorted before shorthands,
/// shorthands with fewer components are sorted before shorthands with more components,
/// and otherwise shorthands are sorted by IDL name as defined by [Web Animations][property-order].

View File

@ -36,6 +36,7 @@ ${helpers.predefined_type("background-image", "ImageLayer",
spec="https://drafts.csswg.org/css-backgrounds-4/#propdef-background-position-" + axis,
animation_value_type="ComputedValue",
vector=True,
vector_animation_type="repeatable_list",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
)}
% endfor
@ -76,13 +77,15 @@ ${helpers.single_keyword("background-origin",
animation_value_type="discrete",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER")}
${helpers.predefined_type("background-size", "BackgroundSize",
${helpers.predefined_type(
"background-size",
"BackgroundSize",
initial_value="computed::BackgroundSize::auto()",
initial_specified_value="specified::BackgroundSize::auto()",
spec="https://drafts.csswg.org/css-backgrounds/#the-background-size",
vector=True,
vector_animation_type="repeatable_list",
animation_value_type="BackgroundSizeList",
need_animatable=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
extra_prefixes="webkit")}

View File

@ -24,6 +24,7 @@ ${helpers.predefined_type(
None,
vector=True,
animation_value_type="AnimatedBoxShadowList",
vector_animation_type="with_zero",
extra_prefixes="webkit",
ignored_when_colors_disabled=True,
flags="APPLIES_TO_FIRST_LETTER",
@ -45,6 +46,7 @@ ${helpers.predefined_type(
vector=True,
separator="Space",
animation_value_type="AnimatedFilterList",
vector_animation_type="with_zero",
extra_prefixes="webkit",
flags="CREATES_STACKING_CONTEXT FIXPOS_CB",
spec="https://drafts.fxtf.org/filters/#propdef-filter",

View File

@ -84,7 +84,7 @@ ${helpers.predefined_type("font-synthesis",
${helpers.predefined_type(
"font-stretch",
"FontStretch",
initial_value="computed::NonNegativePercentage::hundred()",
initial_value="computed::FontStretch::hundred()",
initial_specified_value="specified::FontStretch::normal()",
animation_value_type="Percentage",
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",
@ -335,7 +335,7 @@ ${helpers.predefined_type("-x-text-zoom",
use gecko_bindings::structs::{LookAndFeel_FontID, nsFont};
use std::mem;
use values::computed::Percentage;
use values::computed::font::{FontSize, FontStyle, FontFamilyList};
use values::computed::font::{FontSize, FontStretch, FontStyle, FontFamilyList};
use values::generics::NonNegative;
let id = match *self {
@ -356,9 +356,9 @@ ${helpers.predefined_type("-x-text-zoom",
)
}
let font_weight = longhands::font_weight::computed_value::T::from_gecko_weight(system.weight);
let font_stretch = NonNegative(Percentage(unsafe {
let font_stretch = FontStretch(NonNegative(Percentage(unsafe {
bindings::Gecko_FontStretch_ToFloat(system.stretch)
}));
})));
let font_style = FontStyle::from_gecko(system.style);
let ret = ComputedSystemFont {
font_family: longhands::font_family::computed_value::T(

View File

@ -192,6 +192,7 @@ ${helpers.predefined_type(
"SimpleShadow",
None,
vector=True,
vector_animation_type="with_zero",
animation_value_type="AnimatedTextShadowList",
ignored_when_colors_disabled=True,
flags="APPLIES_TO_FIRST_LETTER APPLIES_TO_FIRST_LINE APPLIES_TO_PLACEHOLDER",

View File

@ -103,6 +103,7 @@ ${helpers.predefined_type(
initial_specified_value="specified::PositionComponent::Center",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-position",
animation_value_type="ComputedValue",
vector_animation_type="repeatable_list",
vector=True,
)}
% endfor
@ -126,26 +127,18 @@ ${helpers.single_keyword("mask-origin",
gecko_enum_prefix="StyleGeometryBox",
animation_value_type="discrete",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-origin")}
<%helpers:longhand name="mask-size" products="gecko" animation_value_type="ComputedValue" extra_prefixes="webkit"
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size">
use properties::longhands::background_size;
pub use ::properties::longhands::background_size::SpecifiedValue;
pub use ::properties::longhands::background_size::single_value as single_value;
pub use ::properties::longhands::background_size::computed_value as computed_value;
#[inline]
pub fn get_initial_value() -> computed_value::T {
background_size::get_initial_value()
}
pub fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<SpecifiedValue, ParseError<'i>> {
background_size::parse(context, input)
}
</%helpers:longhand>
${helpers.predefined_type(
"mask-size",
"background::BackgroundSize",
"computed::BackgroundSize::auto()",
initial_specified_value="specified::BackgroundSize::auto()",
products="gecko",
extra_prefixes="webkit",
spec="https://drafts.fxtf.org/css-masking/#propdef-mask-size",
animation_value_type="MaskSizeList",
vector=True,
vector_animation_type="repeatable_list",
)}
${helpers.single_keyword("mask-composite",
"add subtract intersect exclude",

View File

@ -2216,12 +2216,13 @@ pub mod style_structs {
#[allow(non_snake_case)]
#[inline]
pub fn set_${longhand.ident}<I>(&mut self, v: I)
where I: IntoIterator<Item = longhands::${longhand.ident}
::computed_value::single_value::T>,
I::IntoIter: ExactSizeIterator
where
I: IntoIterator<Item = longhands::${longhand.ident}
::computed_value::single_value::T>,
I::IntoIter: ExactSizeIterator
{
self.${longhand.ident} = longhands::${longhand.ident}::computed_value
::T(v.into_iter().collect());
::List(v.into_iter().collect());
}
% elif longhand.ident == "display":
/// Set `display`.
@ -2305,13 +2306,10 @@ pub mod style_structs {
pub fn compute_font_hash(&mut self) {
// Corresponds to the fields in
// `gfx::font_template::FontTemplateDescriptor`.
//
// FIXME(emilio): Where's font-style?
let mut hasher: FnvHasher = Default::default();
// We hash the floating point number with four decimal
// places.
hasher.write_u64((self.font_weight.0 * 10000.).trunc() as u64);
hasher.write_u64(((self.font_stretch.0).0 * 10000.).trunc() as u64);
self.font_weight.hash(&mut hasher);
self.font_stretch.hash(&mut hasher);
self.font_style.hash(&mut hasher);
self.font_family.hash(&mut hasher);
self.hash = hasher.finish()
}
@ -2407,7 +2405,7 @@ pub mod style_structs {
pub fn clone_${longhand.ident}(
&self,
) -> longhands::${longhand.ident}::computed_value::T {
longhands::${longhand.ident}::computed_value::T(
longhands::${longhand.ident}::computed_value::List(
self.${longhand.ident}_iter().collect()
)
}

View File

@ -188,8 +188,10 @@
use values::specified::position::Position;
use parser::Parse;
pub fn parse_value<'i, 't>(context: &ParserContext, input: &mut Parser<'i, 't>)
-> Result<Longhands, ParseError<'i>> {
pub fn parse_value<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Longhands, ParseError<'i>> {
// Vec grows from 0 to 4 by default on first push(). So allocate with
// capacity 1, so in the common case of only one item we don't way
// overallocate. Note that we always push at least one item if parsing
@ -205,7 +207,8 @@
any = true;
Ok(())
})?;
if any == false {
if !any {
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
}

View File

@ -4,13 +4,8 @@
//! Animated types for CSS values related to effects.
use properties::longhands::box_shadow::computed_value::T as ComputedBoxShadowList;
use properties::longhands::filter::computed_value::T as ComputedFilterList;
use properties::longhands::text_shadow::computed_value::T as ComputedTextShadowList;
use std::cmp;
#[cfg(not(feature = "gecko"))]
use values::Impossible;
use values::animated::{Animate, Procedure, ToAnimatedValue, ToAnimatedZero};
use values::animated::color::RGBA;
use values::computed::{Angle, Number};
use values::computed::length::Length;
@ -21,27 +16,9 @@ use values::generics::effects::BoxShadow as GenericBoxShadow;
use values::generics::effects::Filter as GenericFilter;
use values::generics::effects::SimpleShadow as GenericSimpleShadow;
/// An animated value for the `box-shadow` property.
pub type BoxShadowList = ShadowList<BoxShadow>;
/// An animated value for the `text-shadow` property.
pub type TextShadowList = ShadowList<SimpleShadow>;
/// An animated value for shadow lists.
///
/// <https://drafts.csswg.org/css-transitions/#animtype-shadow-list>
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Debug, PartialEq)]
pub struct ShadowList<Shadow>(Vec<Shadow>);
/// An animated value for a single `box-shadow`.
pub type BoxShadow = GenericBoxShadow<Option<RGBA>, Length, Length, Length>;
/// An animated value for the `filter` property.
#[cfg_attr(feature = "servo", derive(MallocSizeOf))]
#[derive(Clone, Debug, PartialEq)]
pub struct FilterList(pub Vec<Filter>);
/// An animated value for a single `filter`.
#[cfg(feature = "gecko")]
pub type Filter = GenericFilter<Angle, Number, Length, SimpleShadow, ComputedUrl>;
@ -53,86 +30,6 @@ pub type Filter = GenericFilter<Angle, Number, Length, Impossible, Impossible>;
/// An animated value for the `drop-shadow()` filter.
pub type SimpleShadow = GenericSimpleShadow<Option<RGBA>, Length, Length>;
impl ToAnimatedValue for ComputedBoxShadowList {
type AnimatedValue = BoxShadowList;
#[inline]
fn to_animated_value(self) -> Self::AnimatedValue {
ShadowList(self.0.to_animated_value())
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
ComputedBoxShadowList(ToAnimatedValue::from_animated_value(animated.0))
}
}
impl<S> Animate for ShadowList<S>
where
S: Animate + Clone + ToAnimatedZero,
{
#[inline]
fn animate(&self, other: &Self, procedure: Procedure) -> Result<Self, ()> {
if procedure == Procedure::Add {
return Ok(ShadowList(self.0.iter().chain(&other.0).cloned().collect()));
}
// FIXME(nox): Use itertools here, to avoid the need for `unreachable!`.
let max_len = cmp::max(self.0.len(), other.0.len());
let mut shadows = Vec::with_capacity(max_len);
for i in 0..max_len {
shadows.push(match (self.0.get(i), other.0.get(i)) {
(Some(shadow), Some(other)) => shadow.animate(other, procedure)?,
(Some(shadow), None) => shadow.animate(&shadow.to_animated_zero()?, procedure)?,
(None, Some(shadow)) => shadow.to_animated_zero()?.animate(shadow, procedure)?,
(None, None) => unreachable!(),
});
}
Ok(ShadowList(shadows))
}
}
impl<S> ComputeSquaredDistance for ShadowList<S>
where
S: ComputeSquaredDistance + ToAnimatedZero,
{
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
use itertools::{EitherOrBoth, Itertools};
self.0
.iter()
.zip_longest(other.0.iter())
.map(|it| match it {
EitherOrBoth::Both(from, to) => from.compute_squared_distance(to),
EitherOrBoth::Left(list) | EitherOrBoth::Right(list) => {
list.compute_squared_distance(&list.to_animated_zero()?)
},
})
.sum()
}
}
impl<S> ToAnimatedZero for ShadowList<S> {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> {
Ok(ShadowList(vec![]))
}
}
impl ToAnimatedValue for ComputedTextShadowList {
type AnimatedValue = TextShadowList;
#[inline]
fn to_animated_value(self) -> Self::AnimatedValue {
ShadowList(self.0.to_animated_value())
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
ComputedTextShadowList(ToAnimatedValue::from_animated_value(animated.0))
}
}
impl ComputeSquaredDistance for BoxShadow {
#[inline]
fn compute_squared_distance(&self, other: &Self) -> Result<SquaredDistance, ()> {
@ -143,24 +40,3 @@ impl ComputeSquaredDistance for BoxShadow {
self.spread.compute_squared_distance(&other.spread)?)
}
}
impl ToAnimatedValue for ComputedFilterList {
type AnimatedValue = FilterList;
#[inline]
fn to_animated_value(self) -> Self::AnimatedValue {
FilterList(self.0.to_animated_value())
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
ComputedFilterList(ToAnimatedValue::from_animated_value(animated.0))
}
}
impl ToAnimatedZero for FilterList {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> {
Ok(FilterList(vec![]))
}
}

View File

@ -11,6 +11,7 @@
use app_units::Au;
use euclid::{Point2D, Size2D};
use smallvec::SmallVec;
use values::computed::length::CalcLengthOrPercentage;
use values::computed::Angle as ComputedAngle;
use values::computed::BorderCornerRadius as ComputedBorderCornerRadius;
use values::computed::MaxLength as ComputedMaxLength;
@ -257,6 +258,7 @@ macro_rules! trivial_to_animated_value {
}
trivial_to_animated_value!(Au);
trivial_to_animated_value!(CalcLengthOrPercentage);
trivial_to_animated_value!(ComputedAngle);
trivial_to_animated_value!(ComputedUrl);
trivial_to_animated_value!(bool);

View File

@ -4,85 +4,27 @@
//! Computed types for CSS values related to backgrounds.
use properties::animated_properties::RepeatableListAnimatable;
use properties::longhands::background_size::computed_value::T as BackgroundSizeList;
use std::fmt::{self, Write};
use style_traits::{CssWriter, ToCss};
use values::animated::{ToAnimatedValue, ToAnimatedZero};
use values::computed::{Context, ToComputedValue};
use values::computed::length::LengthOrPercentageOrAuto;
use values::computed::length::NonNegativeLengthOrPercentageOrAuto;
use values::generics::background::BackgroundSize as GenericBackgroundSize;
use values::specified::background::BackgroundRepeat as SpecifiedBackgroundRepeat;
use values::specified::background::BackgroundRepeatKeyword;
/// A computed value for the `background-size` property.
pub type BackgroundSize = GenericBackgroundSize<LengthOrPercentageOrAuto>;
pub type BackgroundSize = GenericBackgroundSize<NonNegativeLengthOrPercentageOrAuto>;
impl BackgroundSize {
/// Returns `auto auto`.
pub fn auto() -> Self {
GenericBackgroundSize::Explicit {
width: LengthOrPercentageOrAuto::Auto,
height: LengthOrPercentageOrAuto::Auto,
width: NonNegativeLengthOrPercentageOrAuto::auto(),
height: NonNegativeLengthOrPercentageOrAuto::auto(),
}
}
}
impl RepeatableListAnimatable for BackgroundSize {}
impl ToAnimatedZero for BackgroundSize {
#[inline]
fn to_animated_zero(&self) -> Result<Self, ()> {
Err(())
}
}
impl ToAnimatedValue for BackgroundSize {
type AnimatedValue = Self;
#[inline]
fn to_animated_value(self) -> Self {
self
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
use values::computed::{Length, Percentage};
let clamp_animated_value = |value: LengthOrPercentageOrAuto| -> LengthOrPercentageOrAuto {
match value {
LengthOrPercentageOrAuto::Length(len) => {
LengthOrPercentageOrAuto::Length(Length::new(len.px().max(0.)))
},
LengthOrPercentageOrAuto::Percentage(percent) => {
LengthOrPercentageOrAuto::Percentage(Percentage(percent.0.max(0.)))
},
_ => value,
}
};
match animated {
GenericBackgroundSize::Explicit { width, height } => GenericBackgroundSize::Explicit {
width: clamp_animated_value(width),
height: clamp_animated_value(height),
},
_ => animated,
}
}
}
impl ToAnimatedValue for BackgroundSizeList {
type AnimatedValue = Self;
#[inline]
fn to_animated_value(self) -> Self {
self
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
BackgroundSizeList(ToAnimatedValue::from_animated_value(animated.0))
}
}
/// The computed value of the `background-repeat` property:
///
/// https://drafts.csswg.org/css-backgrounds/#the-background-repeat

View File

@ -15,21 +15,20 @@ use gecko_bindings::sugar::refptr::RefPtr;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::fmt::{self, Write};
#[cfg(feature = "gecko")]
use std::hash::{Hash, Hasher};
#[cfg(feature = "servo")]
use std::slice;
use style_traits::{CssWriter, ParseError, ToCss};
use values::CSSFloat;
use values::animated::{ToAnimatedValue, ToAnimatedZero};
use values::computed::{Angle, Context, Integer, NonNegativeLength, Number, ToComputedValue};
use values::computed::{Angle, Context, Integer, NonNegativeLength, NonNegativePercentage};
use values::computed::{Number, Percentage, ToComputedValue};
use values::generics::font::{self as generics, FeatureTagValue, FontSettings, VariationValue};
use values::specified::font::{self as specified, MIN_FONT_WEIGHT, MAX_FONT_WEIGHT};
use values::specified::length::{FontBaseSize, NoCalcLength};
pub use values::computed::Length as MozScriptMinSize;
pub use values::specified::font::{FontSynthesis, MozScriptSizeMultiplier, XLang, XTextZoom};
pub use values::computed::NonNegativePercentage as FontStretch;
/// A value for the font-weight property per:
///
@ -41,6 +40,12 @@ pub use values::computed::NonNegativePercentage as FontStretch;
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct FontWeight(pub Number);
impl Hash for FontWeight {
fn hash<H: Hasher>(&self, hasher: &mut H) {
hasher.write_u64((self.0 * 10000.).trunc() as u64);
}
}
impl ToAnimatedValue for FontWeight {
type AnimatedValue = Number;
@ -853,6 +858,12 @@ impl ToAnimatedValue for FontStyleAngle {
}
}
impl Hash for FontStyleAngle {
fn hash<H: Hasher>(&self, hasher: &mut H) {
hasher.write_u64((self.0.degrees() * 10000.).trunc() as u64);
}
}
/// The computed value of `font-style`.
///
/// FIXME(emilio): Angle should be a custom type to handle clamping during
@ -916,3 +927,43 @@ impl ToCss for FontStyle {
}
}
}
/// A value for the font-stretch property per:
///
/// https://drafts.csswg.org/css-fonts-4/#propdef-font-stretch
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct FontStretch(pub NonNegativePercentage);
impl FontStretch {
/// 100%
pub fn hundred() -> Self {
FontStretch(NonNegativePercentage::hundred())
}
/// The float value of the percentage
#[inline]
pub fn value(&self) -> CSSFloat {
((self.0).0).0
}
}
impl ToAnimatedValue for FontStretch {
type AnimatedValue = Percentage;
#[inline]
fn to_animated_value(self) -> Self::AnimatedValue {
self.0.to_animated_value()
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
FontStretch(NonNegativePercentage::from_animated_value(animated))
}
}
impl Hash for FontStretch {
fn hash<H: Hasher>(&self, hasher: &mut H) {
hasher.write_u64((self.value() * 10000.).trunc() as u64);
}
}

View File

@ -324,8 +324,8 @@ impl ToComputedValue for specified::CalcLengthOrPercentage {
#[allow(missing_docs)]
#[animate(fallback = "Self::animate_fallback")]
#[css(derive_debug)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq, ToAnimatedZero,
ToCss)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, MallocSizeOf, PartialEq,
ToAnimatedValue, ToAnimatedZero, ToCss)]
#[distance(fallback = "Self::compute_squared_distance_fallback")]
pub enum LengthOrPercentage {
Length(Length),

View File

@ -14,7 +14,7 @@ use values::generics::NonNegative;
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Default,
MallocSizeOf, PartialEq, PartialOrd, SpecifiedValueInfo,
ToAnimatedZero, ToComputedValue)]
ToAnimatedValue, ToAnimatedZero, ToComputedValue)]
pub struct Percentage(pub CSSFloat);
impl Percentage {

View File

@ -6,7 +6,8 @@
/// A generic value for the `background-size` property.
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
PartialEq, SpecifiedValueInfo, ToComputedValue, ToCss)]
PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero,
ToComputedValue, ToCss)]
pub enum BackgroundSize<LengthOrPercentageOrAuto> {
/// `<width> <height>`
Explicit {

View File

@ -228,7 +228,7 @@ impl Default for KeywordSize {
/// https://drafts.csswg.org/css-fonts-4/#font-style-prop
#[allow(missing_docs)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Hash, MallocSizeOf,
PartialEq, SpecifiedValueInfo, ToAnimatedValue, ToAnimatedZero)]
pub enum FontStyle<Angle> {
#[animation(error)]

View File

@ -156,7 +156,7 @@ impl SpecifiedValueInfo for CounterStyleOrNone {
/// A wrapper of Non-negative values.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, Hash, MallocSizeOf,
PartialEq, PartialOrd, SpecifiedValueInfo, ToAnimatedZero,
ToComputedValue, ToCss)]
pub struct NonNegative<T>(pub T);

View File

@ -202,14 +202,13 @@ pub enum SVGLength<LengthType> {
}
/// Generic value for stroke-dasharray.
#[derive(Clone, ComputeSquaredDistance, Debug, MallocSizeOf, PartialEq,
#[derive(Clone, Debug, MallocSizeOf, PartialEq,
SpecifiedValueInfo, ToAnimatedValue, ToComputedValue, ToCss)]
pub enum SVGStrokeDashArray<LengthType> {
/// `[ <length> | <percentage> | <number> ]#`
#[css(comma)]
Values(
#[css(if_empty = "none", iterable)]
#[distance(field_bound)]
Vec<LengthType>,
),
/// `context-value`

View File

@ -9,30 +9,25 @@ use parser::{Parse, ParserContext};
use selectors::parser::SelectorParseErrorKind;
use style_traits::ParseError;
use values::generics::background::BackgroundSize as GenericBackgroundSize;
use values::specified::length::LengthOrPercentageOrAuto;
use values::specified::length::NonNegativeLengthOrPercentageOrAuto;
/// A specified value for the `background-size` property.
pub type BackgroundSize = GenericBackgroundSize<LengthOrPercentageOrAuto>;
pub type BackgroundSize = GenericBackgroundSize<NonNegativeLengthOrPercentageOrAuto>;
impl Parse for BackgroundSize {
fn parse<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
if let Ok(width) = input.try(|i| LengthOrPercentageOrAuto::parse_non_negative(context, i)) {
if let Ok(width) = input.try(|i| NonNegativeLengthOrPercentageOrAuto::parse(context, i)) {
let height = input
.try(|i| LengthOrPercentageOrAuto::parse_non_negative(context, i))
.unwrap_or(LengthOrPercentageOrAuto::Auto);
.try(|i| NonNegativeLengthOrPercentageOrAuto::parse(context, i))
.unwrap_or(NonNegativeLengthOrPercentageOrAuto::auto());
return Ok(GenericBackgroundSize::Explicit { width, height });
}
let location = input.current_source_location();
let ident = input.expect_ident()?;
(match_ignore_ascii_case! { &ident,
"cover" => Ok(GenericBackgroundSize::Cover),
"contain" => Ok(GenericBackgroundSize::Contain),
_ => Err(()),
}).map_err(|()| {
location.new_custom_error(SelectorParseErrorKind::UnexpectedIdent(ident.clone()))
Ok(try_match_ident_ignore_ascii_case! { input,
"cover" => GenericBackgroundSize::Cover,
"contain" => GenericBackgroundSize::Contain,
})
}
}
@ -41,8 +36,8 @@ impl BackgroundSize {
/// Returns `auto auto`.
pub fn auto() -> Self {
GenericBackgroundSize::Explicit {
width: LengthOrPercentageOrAuto::Auto,
height: LengthOrPercentageOrAuto::Auto,
width: NonNegativeLengthOrPercentageOrAuto::auto(),
height: NonNegativeLengthOrPercentageOrAuto::auto(),
}
}
}

View File

@ -490,22 +490,22 @@ impl Parse for FontStretch {
}
impl ToComputedValue for FontStretch {
type ComputedValue = NonNegative<ComputedPercentage>;
type ComputedValue = computed::FontStretch;
fn to_computed_value(&self, context: &Context) -> Self::ComputedValue {
match *self {
FontStretch::Stretch(ref percentage) => {
NonNegative(percentage.to_computed_value(context))
computed::FontStretch(NonNegative(percentage.to_computed_value(context)))
},
FontStretch::Keyword(ref kw) => {
NonNegative(kw.compute())
computed::FontStretch(NonNegative(kw.compute()))
},
FontStretch::System(_) => self.compute_system(context),
}
}
fn from_computed_value(computed: &Self::ComputedValue) -> Self {
FontStretch::Stretch(Percentage::from_computed_value(&computed.0))
FontStretch::Stretch(Percentage::from_computed_value(&(computed.0).0))
}
}

View File

@ -219,12 +219,6 @@
[Object with non-configurable property]
expected: TIMEOUT
[Number 0.2]
expected:
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number 0]
expected: TIMEOUT
@ -245,4 +239,3 @@
[Number -9007199254740992]
expected: TIMEOUT

View File

@ -222,310 +222,5 @@
[Object with non-configurable property]
expected: TIMEOUT
[Array primitives]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Object primitives]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Boolean true]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Boolean false]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Array Boolean objects]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Object Boolean objects]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[String empty string]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[String lone high surrogate]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[String lone low surrogate]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[String NUL]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[String astral character]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Array String objects]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Object String objects]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number 0.2]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number 0]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number -0]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number NaN]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number Infinity]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number -Infinity]
expected:
if (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[Number 9007199254740992]
expected: TIMEOUT
[primitive undefined]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive null]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive true]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive false]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive string, empty string]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive string, lone high surrogate]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive string, lone low surrogate]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive string, NUL]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive string, astral character]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, 0.2]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, 0]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, -0]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, NaN]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, Infinity]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, -Infinity]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, 9007199254740992]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, -9007199254740992]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, 9007199254740994]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
[primitive number, -9007199254740994]
expected:
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86") and (bits == 32): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.6.8") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.9") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "linux") and (version == "Ubuntu 12.04") and (processor == "x86_64") and (bits == 64): TIMEOUT
if not debug and (os == "mac") and (version == "OS X 10.8") and (processor == "x86_64") and (bits == 64): TIMEOUT

View File

@ -12391,158 +12391,15 @@
"labels": ["ClassicScript", "ModuleScript"],
"description": "Record the kind of every script loaded in a document."
},
"DOM_SCRIPT_SRC_ENCODING": {
"record_in_processes": ["main", "content"],
"alert_emails": ["dteller@mozilla.com"],
"expires_in_version": "61",
"kind": "count",
"keyed": true,
"bug_numbers": [1344152],
"description": "Note the encoding (e.g. 'UTF-8', 'windows-1252', 'ASCII') of each external <script> element that is successfully loaded and decoded."
},
"DOM_SCRIPT_LOADING_SOURCE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"expires_in_version": "never",
"kind": "categorical",
"bug_numbers": [1362114],
"labels": ["Inline", "SourceFallback", "Source", "AltData"],
"description": "Record the input from which the bytes are coming from, for each script in a document."
},
"DOM_SCRIPT_INLINE_SIZE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"low": 64,
"high": 16000000,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Size (in number of characters) of each script which is inlined in a document."
},
"DOM_SCRIPT_SOURCE_SIZE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"low": 64,
"high": 16000000,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Size (in number of characters) of each script which is streamed in plain-text in a document."
},
"DOM_SCRIPT_BYTECODE_SIZE": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"low": 64,
"high": 16000000,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Size (in number of bytes) of each script which is streamed in encoded-format in a document."
},
"DOM_SCRIPT_FETCH_COUNT": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "linear",
"low": 1,
"high": 100,
"n_buckets": 99,
"bug_numbers": [1362114],
"description": "For each script in a document, record the number of times it was requested since it got saved in the cache."
},
"DOM_SCRIPT_MAIN_THREAD_PARSE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse and execute a script (which might be encoded later) on the main thread."
},
"DOM_SCRIPT_MAIN_THREAD_PARSE_ENCODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse, encode and execute a script on the main thread."
},
"DOM_SCRIPT_MAIN_THREAD_DECODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to decode and execute a script on the main thread."
},
"DOM_SCRIPT_OFF_THREAD_PARSE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse off-main-thread and execute a script (which might be encoded later) on the main thread."
},
"DOM_SCRIPT_OFF_THREAD_PARSE_ENCODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to parse off-main-thread, encode and execute a script on the main thread."
},
"DOM_SCRIPT_OFF_THREAD_DECODE_EXEC_MS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "exponential",
"high": 50000,
"n_buckets": 100,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to decode off-main-thread and execute a script on the main thread."
},
"DOM_SCRIPT_ENCODING_MS_PER_DOCUMENT": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "linear",
"high": 64,
"n_buckets": 32,
"bug_numbers": [1362114],
"description": "Time, in milliseconds, needed to encode all scripts in a document."
},
"DOM_SCRIPT_ENCODING_STATUS": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "categorical",
"bug_numbers": [1362114],
"labels": ["EncodingFailure", "BufferTooLarge", "OpenFailure", "WriteFailure", "CloseFailure", "EncodingSuccess"],
"description": "Record the failure reasons of the JavaScript Start-up Bytecode Cache encoder."
},
"DOM_SCRIPT_EVAL_PER_DOCUMENT": {
"record_in_processes": ["content"],
"alert_emails": ["nicolas.b.pierron@mozilla.com"],
"expires_in_version": "62",
"kind": "linear",
"low": 1,
"high": 200,
"n_buckets": 50,
"bug_numbers": [1362114],
"description": "Number of script tags evaluated per document."
},
"DOM_SCRIPT_PRELOAD_RESULT": {
"record_in_processes": ["main", "content"],
"alert_emails": ["jcoppeard@mozilla.com"],

View File

@ -1551,7 +1551,6 @@
"DEVTOOLS_WEBIDE_IMPORT_PROJECT_COUNT",
"DEVTOOLS_WEBIDE_NEW_PROJECT_COUNT",
"DEVTOOLS_WEBIDE_OPENED_COUNT",
"DOM_SCRIPT_SRC_ENCODING",
"ENABLE_PRIVILEGE_EVER_CALLED",
"FENNEC_DISTRIBUTION_REFERRER_INVALID",
"FENNEC_ORBOT_INSTALLED",