mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Merge mozilla-central to autoland
This commit is contained in:
commit
afbed9588f
@ -62,13 +62,20 @@ ReplayDebugger.prototype = {
|
||||
replayResumeBackward() { RecordReplayControl.resume(/* forward = */ false); },
|
||||
replayResumeForward() { RecordReplayControl.resume(/* forward = */ true); },
|
||||
replayTimeWarp: RecordReplayControl.timeWarp,
|
||||
replayRecordingPosition: RecordReplayControl.recordingPosition,
|
||||
|
||||
replayPause() {
|
||||
RecordReplayControl.pause();
|
||||
this._repaint();
|
||||
},
|
||||
|
||||
replayCurrentExecutionPoint() {
|
||||
return this._sendRequest({ type: "currentExecutionPoint" });
|
||||
},
|
||||
|
||||
replayRecordingEndpoint() {
|
||||
return this._sendRequest({ type: "recordingEndpoint" });
|
||||
},
|
||||
|
||||
addDebuggee() {},
|
||||
removeAllDebuggees() {},
|
||||
|
||||
|
@ -717,6 +717,14 @@ const gRequestHandlers = {
|
||||
getNewConsoleMessage(request) {
|
||||
return convertConsoleMessage(gConsoleMessages[gConsoleMessages.length - 1]);
|
||||
},
|
||||
|
||||
currentExecutionPoint(request) {
|
||||
return RecordReplayControl.currentExecutionPoint();
|
||||
},
|
||||
|
||||
recordingEndpoint(request) {
|
||||
return RecordReplayControl.recordingEndpoint();
|
||||
},
|
||||
};
|
||||
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
|
@ -1484,11 +1484,8 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
|
||||
}
|
||||
|
||||
if (this.dbg.replaying) {
|
||||
const message = this.dbg.getNewConsoleMessage();
|
||||
packet.recordingProgress = this.dbg.replayRecordingPosition();
|
||||
if (message) {
|
||||
packet.executionPoint = message.executionPoint;
|
||||
}
|
||||
packet.executionPoint = this.dbg.replayCurrentExecutionPoint();
|
||||
packet.recordingEndpoint = this.dbg.replayRecordingEndpoint();
|
||||
}
|
||||
|
||||
if (poppedFrames) {
|
||||
|
@ -44,6 +44,7 @@ Bug 1201597 - Sanity test that we can take a heap snapshot in an e10s child proc
|
||||
["dom.ipc.browser_frames.oop_by_default", true],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["browser.pagethumbnails.capturing_disabled", true],
|
||||
["network.disable.ipc.security", true],
|
||||
],
|
||||
}, function() {
|
||||
const iframe = document.createElement("iframe");
|
||||
|
@ -35,11 +35,14 @@ DocOrShadowFromContent(nsIContent& aContent)
|
||||
}
|
||||
|
||||
void
|
||||
IDTracker::Reset(nsIContent* aFromContent, nsIURI* aURI,nsIURI* aReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
bool aWatch, bool aReferenceImage)
|
||||
IDTracker::ResetToURIFragmentID(nsIContent* aFromContent,
|
||||
nsIURI* aURI,
|
||||
nsIURI* aReferrer,
|
||||
uint32_t aReferrerPolicy,
|
||||
bool aWatch,
|
||||
bool aReferenceImage)
|
||||
{
|
||||
MOZ_ASSERT(aFromContent, "Reset() expects non-null content pointer");
|
||||
MOZ_ASSERT(aFromContent, "ResetToURIFragmentID() expects non-null content pointer");
|
||||
|
||||
Unlink();
|
||||
|
||||
@ -243,8 +246,8 @@ IDTracker::DocumentLoadNotification::Observe(nsISupports* aSubject,
|
||||
nsCOMPtr<nsIDocument> doc = do_QueryInterface(aSubject);
|
||||
mTarget->mPendingNotification = nullptr;
|
||||
NS_ASSERTION(!mTarget->mElement, "Why do we have content here?");
|
||||
// If we got here, that means we had Reset() called with aWatch ==
|
||||
// true. So keep watching if IsPersistent().
|
||||
// If we got here, that means we had Reset*() called with
|
||||
// aWatch == true. So keep watching if IsPersistent().
|
||||
mTarget->HaveNewDocumentOrShadowRoot(doc, mTarget->IsPersistent(), mRef);
|
||||
mTarget->ElementChanged(nullptr, mTarget->mElement);
|
||||
}
|
||||
|
@ -22,8 +22,8 @@ namespace dom {
|
||||
/**
|
||||
* Class to track what element is referenced by a given ID.
|
||||
*
|
||||
* To use it, call Reset() to set it up to watch a given URI. Call get()
|
||||
* anytime to determine the referenced element (which may be null if
|
||||
* To use it, call one of the Reset methods to set it up to watch a given ID.
|
||||
* Call get() anytime to determine the referenced element (which may be null if
|
||||
* the element isn't found). When the element changes, ElementChanged
|
||||
* will be called, so subclass this class if you want to receive that
|
||||
* notification. ElementChanged runs at safe-for-script time, i.e. outside
|
||||
@ -66,13 +66,13 @@ public:
|
||||
* @param aReferenceImage whether the ID references image elements which are
|
||||
* subject to the document's mozSetImageElement overriding mechanism.
|
||||
*/
|
||||
void Reset(nsIContent* aFrom, nsIURI* aURI, nsIURI* aReferrer,
|
||||
uint32_t aReferrerPolicy, bool aWatch = true,
|
||||
bool aReferenceImage = false);
|
||||
void ResetToURIFragmentID(nsIContent* aFrom, nsIURI* aURI, nsIURI* aReferrer,
|
||||
uint32_t aReferrerPolicy, bool aWatch = true,
|
||||
bool aReferenceImage = false);
|
||||
|
||||
/**
|
||||
* A variation on Reset() to set up a reference that consists of the ID of
|
||||
* an element in the same document as aFrom.
|
||||
* A variation on ResetToURIFragmentID() to set up a reference that consists
|
||||
* of the ID of an element in the same document as aFrom.
|
||||
* @param aFrom the source element for context
|
||||
* @param aID the ID of the element
|
||||
* @param aWatch if false, then we do not set up the notifications to track
|
||||
|
@ -684,16 +684,48 @@ DefineConstants(JSContext* cx, JS::Handle<JSObject*> obj,
|
||||
}
|
||||
|
||||
static inline bool
|
||||
Define(JSContext* cx, JS::Handle<JSObject*> obj, const JSFunctionSpec* spec) {
|
||||
return JS_DefineFunctions(cx, obj, spec);
|
||||
Define(JSContext* cx, JS::Handle<JSObject*> obj, const JSFunctionSpec* spec)
|
||||
{
|
||||
bool ok = JS_DefineFunctions(cx, obj, spec);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(js::GetObjectClass(obj)->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: JS_DefineFunctions failed for Document.prototype");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
static inline bool
|
||||
Define(JSContext* cx, JS::Handle<JSObject*> obj, const JSPropertySpec* spec) {
|
||||
return JS_DefineProperties(cx, obj, spec);
|
||||
Define(JSContext* cx, JS::Handle<JSObject*> obj, const JSPropertySpec* spec)
|
||||
{
|
||||
bool ok = JS_DefineProperties(cx, obj, spec);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!strcmp(js::GetObjectClass(obj)->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: JS_DefineProperties failed for Document.prototype");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool
|
||||
Define(JSContext* cx, JS::Handle<JSObject*> obj, const ConstantSpec* spec) {
|
||||
return DefineConstants(cx, obj, spec);
|
||||
Define(JSContext* cx, JS::Handle<JSObject*> obj, const ConstantSpec* spec)
|
||||
{
|
||||
bool ok = DefineConstants(cx, obj, spec);
|
||||
if (ok) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
if (!strcmp(js::GetObjectClass(obj)->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: DefineConstants failed for Document.prototype");
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
@ -929,6 +961,13 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
// properties go on the global itself.
|
||||
(!isGlobal &&
|
||||
!DefineProperties(cx, ourProto, properties, chromeOnlyProperties))) {
|
||||
if (!strcmp(protoClass->name, "DocumentPrototype")) {
|
||||
if (!ourProto) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: JS_NewObjectWithUniqueType failed for Document.prototype");
|
||||
} else {
|
||||
MOZ_CRASH("Bug 1405521/1488480: DefineProperties failed for Document.prototype");
|
||||
}
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -936,12 +975,18 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Rooted<JSObject*> unscopableObj(cx,
|
||||
JS_NewObjectWithGivenProto(cx, nullptr, nullptr));
|
||||
if (!unscopableObj) {
|
||||
if (!strcmp(protoClass->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: Unscopable object creation failed for Document.prototype");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (; *unscopableNames; ++unscopableNames) {
|
||||
if (!JS_DefineProperty(cx, unscopableObj, *unscopableNames,
|
||||
JS::TrueHandleValue, JSPROP_ENUMERATE)) {
|
||||
if (!strcmp(protoClass->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: Defining property on unscopable object failed for Document.prototype");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -951,6 +996,9 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
// Readonly and non-enumerable to match Array.prototype.
|
||||
if (!JS_DefinePropertyById(cx, ourProto, unscopableId, unscopableObj,
|
||||
JSPROP_READONLY)) {
|
||||
if (!strcmp(protoClass->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: Defining @@unscopables failed for Document.prototype");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
@ -959,6 +1007,9 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
JS::Rooted<JSString*> toStringTagStr(cx,
|
||||
JS_NewStringCopyZ(cx, toStringTag));
|
||||
if (!toStringTagStr) {
|
||||
if (!strcmp(protoClass->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: Copying string tag failed for Document.prototype");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -966,6 +1017,9 @@ CreateInterfacePrototypeObject(JSContext* cx, JS::Handle<JSObject*> global,
|
||||
SYMBOL_TO_JSID(JS::GetWellKnownSymbol(cx, JS::SymbolCode::toStringTag)));
|
||||
if (!JS_DefinePropertyById(cx, ourProto, toStringTagId, toStringTagStr,
|
||||
JSPROP_READONLY)) {
|
||||
if (!strcmp(protoClass->name, "DocumentPrototype")) {
|
||||
MOZ_CRASH("Bug 1405521/1488480: Defining @@toStringTag failed for Document.prototype");
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -248,8 +248,14 @@ class IDLScope(IDLObject):
|
||||
return self.QName()
|
||||
|
||||
def QName(self):
|
||||
if self._name:
|
||||
return self._name.QName() + "::"
|
||||
# It's possible for us to be called before __init__ has been called, for
|
||||
# the IDLObjectWithScope case. In that case, self._name won't be set yet.
|
||||
if hasattr(self, "_name"):
|
||||
name = self._name
|
||||
else:
|
||||
name = None
|
||||
if name:
|
||||
return name.QName() + "::"
|
||||
return "::"
|
||||
|
||||
def ensureUnique(self, identifier, object):
|
||||
|
@ -588,6 +588,14 @@ MediaFormatReader::DecoderFactory::DoCreateDecoder(Data& aData)
|
||||
}
|
||||
}
|
||||
|
||||
// Media playback is not supported when recording or replaying. See bug 1304146.
|
||||
if (recordreplay::IsRecordingOrReplaying()) {
|
||||
return MediaResult(NS_ERROR_DOM_MEDIA_FATAL_ERR,
|
||||
nsPrintfCString("error creating %s decoder: "
|
||||
"media playback is disabled while recording/replaying",
|
||||
TrackTypeToStr(aData.mTrack)));
|
||||
}
|
||||
|
||||
// result may not be updated by PDMFactory::CreateDecoder, as such it must be
|
||||
// initialized to a fatal error by default.
|
||||
MediaResult result = MediaResult(
|
||||
|
@ -415,10 +415,10 @@ SVGAnimationElement::UpdateHrefTarget(const nsAString& aHrefStr)
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI),
|
||||
aHrefStr, OwnerDoc(), baseURI);
|
||||
// Bug 1415044 to investigate which referrer we should use
|
||||
mHrefTarget.Reset(this,
|
||||
targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
OwnerDoc()->GetReferrerPolicy());
|
||||
mHrefTarget.ResetToURIFragmentID(this,
|
||||
targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
OwnerDoc()->GetReferrerPolicy());
|
||||
AnimationTargetChanged();
|
||||
}
|
||||
|
||||
|
@ -240,9 +240,9 @@ SVGMPathElement::UpdateHrefTarget(nsIContent* aParent,
|
||||
// for a call to GetComposedDoc(), and |this| might not have a current
|
||||
// document yet (if our caller is BindToTree).
|
||||
// Bug 1415044 to investigate which referrer we should use
|
||||
mPathTracker.Reset(aParent, targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
OwnerDoc()->GetReferrerPolicy());
|
||||
mPathTracker.ResetToURIFragmentID(aParent, targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
OwnerDoc()->GetReferrerPolicy());
|
||||
} else {
|
||||
// if we don't have a parent, then there's no animateMotion element
|
||||
// depending on our target, so there's no point tracking it right now.
|
||||
|
@ -474,9 +474,9 @@ SVGUseElement::LookupHref()
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(targetURI), href,
|
||||
GetComposedDoc(), baseURI);
|
||||
// Bug 1415044 to investigate which referrer we should use
|
||||
mReferencedElementTracker.Reset(this, targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
OwnerDoc()->GetReferrerPolicy());
|
||||
mReferencedElementTracker.ResetToURIFragmentID(this, targetURI,
|
||||
OwnerDoc()->GetDocumentURI(),
|
||||
OwnerDoc()->GetReferrerPolicy());
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -19,6 +19,8 @@
|
||||
|
||||
#include "frontend/Parser.h"
|
||||
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/Range.h"
|
||||
#include "mozilla/Sprintf.h"
|
||||
#include "mozilla/TypeTraits.h"
|
||||
@ -53,10 +55,12 @@
|
||||
|
||||
using namespace js;
|
||||
|
||||
using mozilla::AssertedCast;
|
||||
using mozilla::Maybe;
|
||||
using mozilla::Nothing;
|
||||
using mozilla::PodCopy;
|
||||
using mozilla::PodZero;
|
||||
using mozilla::PointerRangeSize;
|
||||
using mozilla::Some;
|
||||
using mozilla::Unused;
|
||||
using mozilla::Utf8Unit;
|
||||
@ -1139,14 +1143,57 @@ NewEmptyBindingData(JSContext* cx, LifoAlloc& alloc, uint32_t numBindings)
|
||||
return bindings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy-construct |BindingName|s from |bindings| into |cursor|, then return
|
||||
* the location one past the newly-constructed |BindingName|s.
|
||||
*/
|
||||
static MOZ_MUST_USE BindingName*
|
||||
FreshlyInitializeBindings(BindingName* cursor, const BindingNameVector& bindings)
|
||||
namespace detail {
|
||||
|
||||
template<class Data>
|
||||
static MOZ_ALWAYS_INLINE BindingName*
|
||||
InitializeIndexedBindings(Data* data, BindingName* start, BindingName* cursor)
|
||||
{
|
||||
return std::uninitialized_copy(bindings.begin(), bindings.end(), cursor);
|
||||
return cursor;
|
||||
}
|
||||
|
||||
template<class Data, typename UnsignedInteger, typename... Step>
|
||||
static MOZ_ALWAYS_INLINE BindingName*
|
||||
InitializeIndexedBindings(Data* data, BindingName* start, BindingName* cursor,
|
||||
UnsignedInteger Data::* field, const BindingNameVector& bindings,
|
||||
Step&&... step)
|
||||
{
|
||||
data->*field = AssertedCast<UnsignedInteger>(PointerRangeSize(start, cursor));
|
||||
|
||||
BindingName* newCursor = std::uninitialized_copy(bindings.begin(), bindings.end(), cursor);
|
||||
|
||||
return InitializeIndexedBindings(data, start, newCursor, std::forward<Step>(step)...);
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
// Initialize |data->trailingNames| bindings, then set |data->length| to the
|
||||
// count of bindings added (which must equal |count|).
|
||||
//
|
||||
// First, |firstBindings| are added to |data->trailingNames|. Then any "steps"
|
||||
// present are performed first to last. Each step is 1) a pointer to a member
|
||||
// of |data| to be set to the current number of bindings added, and 2) a vector
|
||||
// of |BindingName|s to then copy into |data->trailingNames|. (Thus each
|
||||
// |data| member field indicates where the corresponding vector's names start.)
|
||||
template<class Data, typename... Step>
|
||||
static MOZ_ALWAYS_INLINE void
|
||||
InitializeBindingData(Data* data, uint32_t count,
|
||||
const BindingNameVector& firstBindings,
|
||||
Step&&... step)
|
||||
{
|
||||
MOZ_ASSERT(data->length == 0, "data shouldn't be filled yet");
|
||||
|
||||
BindingName* start = data->trailingNames.start();
|
||||
BindingName* cursor =
|
||||
std::uninitialized_copy(firstBindings.begin(), firstBindings.end(), start);
|
||||
|
||||
#ifdef DEBUG
|
||||
BindingName* end =
|
||||
#endif
|
||||
detail::InitializeIndexedBindings(data, start, cursor, std::forward<Step>(step)...);
|
||||
|
||||
MOZ_ASSERT(PointerRangeSize(start, end) == count);
|
||||
data->length = count;
|
||||
}
|
||||
|
||||
Maybe<GlobalScope::Data*>
|
||||
@ -1198,18 +1245,10 @@ NewGlobalScopeData(JSContext* context, ParseContext::Scope& scope, LifoAlloc& al
|
||||
}
|
||||
|
||||
// The ordering here is important. See comments in GlobalScope.
|
||||
BindingName* start = bindings->trailingNames.start();
|
||||
BindingName* cursor = start;
|
||||
|
||||
cursor = FreshlyInitializeBindings(cursor, vars);
|
||||
|
||||
bindings->letStart = cursor - start;
|
||||
cursor = FreshlyInitializeBindings(cursor, lets);
|
||||
|
||||
bindings->constStart = cursor - start;
|
||||
Unused << FreshlyInitializeBindings(cursor, consts);
|
||||
|
||||
bindings->length = numBindings;
|
||||
InitializeBindingData(bindings, numBindings,
|
||||
vars,
|
||||
&GlobalScope::Data::letStart, lets,
|
||||
&GlobalScope::Data::constStart, consts);
|
||||
}
|
||||
|
||||
return Some(bindings);
|
||||
@ -1270,21 +1309,11 @@ NewModuleScopeData(JSContext* context, ParseContext::Scope& scope, LifoAlloc& al
|
||||
}
|
||||
|
||||
// The ordering here is important. See comments in ModuleScope.
|
||||
BindingName* start = bindings->trailingNames.start();
|
||||
BindingName* cursor = start;
|
||||
|
||||
cursor = FreshlyInitializeBindings(cursor, imports);
|
||||
|
||||
bindings->varStart = cursor - start;
|
||||
cursor = FreshlyInitializeBindings(cursor, vars);
|
||||
|
||||
bindings->letStart = cursor - start;
|
||||
cursor = FreshlyInitializeBindings(cursor, lets);
|
||||
|
||||
bindings->constStart = cursor - start;
|
||||
Unused << FreshlyInitializeBindings(cursor, consts);
|
||||
|
||||
bindings->length = numBindings;
|
||||
InitializeBindingData(bindings, numBindings,
|
||||
imports,
|
||||
&ModuleScope::Data::varStart, vars,
|
||||
&ModuleScope::Data::letStart, lets,
|
||||
&ModuleScope::Data::constStart, consts);
|
||||
}
|
||||
|
||||
return Some(bindings);
|
||||
@ -1321,12 +1350,7 @@ NewEvalScopeData(JSContext* context, ParseContext::Scope& scope, LifoAlloc& allo
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
BindingName* start = bindings->trailingNames.start();
|
||||
BindingName* cursor = start;
|
||||
|
||||
Unused << FreshlyInitializeBindings(cursor, vars);
|
||||
|
||||
bindings->length = numBindings;
|
||||
InitializeBindingData(bindings, numBindings, vars);
|
||||
}
|
||||
|
||||
return Some(bindings);
|
||||
@ -1418,18 +1442,10 @@ NewFunctionScopeData(JSContext* context, ParseContext::Scope& scope, bool hasPar
|
||||
}
|
||||
|
||||
// The ordering here is important. See comments in FunctionScope.
|
||||
BindingName* start = bindings->trailingNames.start();
|
||||
BindingName* cursor = start;
|
||||
|
||||
cursor = FreshlyInitializeBindings(cursor, positionalFormals);
|
||||
|
||||
bindings->nonPositionalFormalStart = cursor - start;
|
||||
cursor = FreshlyInitializeBindings(cursor, formals);
|
||||
|
||||
bindings->varStart = cursor - start;
|
||||
Unused << FreshlyInitializeBindings(cursor, vars);
|
||||
|
||||
bindings->length = numBindings;
|
||||
InitializeBindingData(bindings, numBindings,
|
||||
positionalFormals,
|
||||
&FunctionScope::Data::nonPositionalFormalStart, formals,
|
||||
&FunctionScope::Data::varStart, vars);
|
||||
}
|
||||
|
||||
return Some(bindings);
|
||||
@ -1466,13 +1482,7 @@ NewVarScopeData(JSContext* context, ParseContext::Scope& scope, LifoAlloc& alloc
|
||||
return Nothing();
|
||||
}
|
||||
|
||||
// The ordering here is important. See comments in FunctionScope.
|
||||
BindingName* start = bindings->trailingNames.start();
|
||||
BindingName* cursor = start;
|
||||
|
||||
Unused << FreshlyInitializeBindings(cursor, vars);
|
||||
|
||||
bindings->length = numBindings;
|
||||
InitializeBindingData(bindings, numBindings, vars);
|
||||
}
|
||||
|
||||
return Some(bindings);
|
||||
@ -1524,15 +1534,9 @@ NewLexicalScopeData(JSContext* context, ParseContext::Scope& scope, LifoAlloc& a
|
||||
}
|
||||
|
||||
// The ordering here is important. See comments in LexicalScope.
|
||||
BindingName* cursor = bindings->trailingNames.start();
|
||||
BindingName* start = cursor;
|
||||
|
||||
cursor = FreshlyInitializeBindings(cursor, lets);
|
||||
|
||||
bindings->constStart = cursor - start;
|
||||
Unused << FreshlyInitializeBindings(cursor, consts);
|
||||
|
||||
bindings->length = numBindings;
|
||||
InitializeBindingData(bindings, numBindings,
|
||||
lets,
|
||||
&LexicalScope::Data::constStart, consts);
|
||||
}
|
||||
|
||||
return Some(bindings);
|
||||
|
@ -37,7 +37,8 @@ Compressor::Compressor(const unsigned char* inp, size_t inplen)
|
||||
currentChunkSize(0),
|
||||
chunkOffsets()
|
||||
{
|
||||
MOZ_ASSERT(inplen > 0);
|
||||
MOZ_ASSERT(inplen > 0, "data to compress can't be empty");
|
||||
|
||||
zs.opaque = nullptr;
|
||||
zs.next_in = (Bytef*)inp;
|
||||
zs.avail_in = 0;
|
||||
|
@ -26,11 +26,11 @@ class Compressor
|
||||
public:
|
||||
// After compressing CHUNK_SIZE bytes, we will do a full flush so we can
|
||||
// start decompression at that point.
|
||||
static const size_t CHUNK_SIZE = 64 * 1024;
|
||||
static constexpr size_t CHUNK_SIZE = 64 * 1024;
|
||||
|
||||
private:
|
||||
// Number of bytes we should hand to zlib each compressMore() call.
|
||||
static const size_t MAX_INPUT_SIZE = 2 * 1024;
|
||||
static constexpr size_t MAX_INPUT_SIZE = 2 * 1024;
|
||||
|
||||
z_stream zs;
|
||||
const unsigned char* inp;
|
||||
@ -74,14 +74,18 @@ class Compressor
|
||||
*chunk = uncompressedOffset / CHUNK_SIZE;
|
||||
*chunkOffset = uncompressedOffset % CHUNK_SIZE;
|
||||
}
|
||||
|
||||
static size_t chunkSize(size_t uncompressedBytes, size_t chunk) {
|
||||
MOZ_ASSERT(uncompressedBytes > 0);
|
||||
size_t lastChunk = (uncompressedBytes - 1) / CHUNK_SIZE;
|
||||
MOZ_ASSERT(chunk <= lastChunk);
|
||||
if (chunk < lastChunk || uncompressedBytes % CHUNK_SIZE == 0) {
|
||||
return CHUNK_SIZE;
|
||||
}
|
||||
return uncompressedBytes % CHUNK_SIZE;
|
||||
MOZ_ASSERT(uncompressedBytes > 0,
|
||||
"must have uncompressed data to chunk");
|
||||
|
||||
size_t startOfChunkBytes = chunk * CHUNK_SIZE;
|
||||
MOZ_ASSERT(startOfChunkBytes < uncompressedBytes,
|
||||
"chunk must refer to bytes not exceeding "
|
||||
"|uncompressedBytes|");
|
||||
|
||||
size_t remaining = uncompressedBytes - startOfChunkBytes;
|
||||
return remaining < CHUNK_SIZE ? remaining : CHUNK_SIZE;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -1726,8 +1726,8 @@ ScriptSource::chunkUnits(JSContext* cx, UncompressedSourceCache::AutoHoldEntry&
|
||||
size_t chunkBytes = Compressor::chunkSize(totalLengthInBytes, chunk);
|
||||
|
||||
MOZ_ASSERT((chunkBytes % sizeof(Unit)) == 0);
|
||||
const size_t lengthWithNull = (chunkBytes / sizeof(Unit)) + 1;
|
||||
EntryUnits<Unit> decompressed(js_pod_malloc<Unit>(lengthWithNull));
|
||||
const size_t chunkLength = chunkBytes / sizeof(Unit);
|
||||
EntryUnits<Unit> decompressed(js_pod_malloc<Unit>(chunkLength));
|
||||
if (!decompressed) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
@ -1744,8 +1744,6 @@ ScriptSource::chunkUnits(JSContext* cx, UncompressedSourceCache::AutoHoldEntry&
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
decompressed[lengthWithNull - 1] = Unit('\0');
|
||||
|
||||
const Unit* ret = decompressed.get();
|
||||
if (!cx->caches().uncompressedSourceCache.put(ssc, ToSourceData(std::move(decompressed)),
|
||||
holder))
|
||||
@ -1814,7 +1812,7 @@ ScriptSource::units(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& holde
|
||||
size_t firstChunkOffset, lastChunkOffset;
|
||||
MOZ_ASSERT(len > 0);
|
||||
Compressor::toChunkOffset(begin * sizeof(Unit), &firstChunk, &firstChunkOffset);
|
||||
Compressor::toChunkOffset((begin + len - 1) * sizeof(Unit), &lastChunk, &lastChunkOffset);
|
||||
Compressor::toChunkOffset((begin + len) * sizeof(Unit), &lastChunk, &lastChunkOffset);
|
||||
|
||||
MOZ_ASSERT(firstChunkOffset % sizeof(Unit) == 0);
|
||||
size_t firstUnit = firstChunkOffset / sizeof(Unit);
|
||||
@ -1828,14 +1826,13 @@ ScriptSource::units(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& holde
|
||||
return units + firstUnit;
|
||||
}
|
||||
|
||||
// We need multiple chunks. Allocate a (null-terminated) buffer to hold
|
||||
// |len| units and copy uncompressed units from the chunks into it. We use
|
||||
// chunkUnits() so we benefit from chunk caching by UncompressedSourceCache.
|
||||
// We need multiple chunks. Allocate a buffer to hold |len| units and copy
|
||||
// uncompressed units from the chunks into it. We use chunkUnits() so we
|
||||
// benefit from chunk caching by UncompressedSourceCache.
|
||||
|
||||
MOZ_ASSERT(firstChunk < lastChunk);
|
||||
|
||||
size_t lengthWithNull = len + 1;
|
||||
EntryUnits<Unit> decompressed(js_pod_malloc<Unit>(lengthWithNull));
|
||||
EntryUnits<Unit> decompressed(js_pod_malloc<Unit>(len));
|
||||
if (!decompressed) {
|
||||
JS_ReportOutOfMemory(cx);
|
||||
return nullptr;
|
||||
@ -1857,7 +1854,7 @@ ScriptSource::units(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& holde
|
||||
units += firstUnit;
|
||||
numUnits -= firstUnit;
|
||||
} else if (i == lastChunk) {
|
||||
size_t numUnitsNew = lastChunkOffset / sizeof(Unit) + 1;
|
||||
size_t numUnitsNew = lastChunkOffset / sizeof(Unit);
|
||||
MOZ_ASSERT(numUnitsNew <= numUnits);
|
||||
numUnits = numUnitsNew;
|
||||
}
|
||||
@ -1865,11 +1862,7 @@ ScriptSource::units(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& holde
|
||||
cursor += numUnits;
|
||||
}
|
||||
|
||||
// XXX Bug 1499192: can we remove the null-termination? It's unclear if
|
||||
// anyone uses chunk implicit null-termination, chunks can contain
|
||||
// nulls anyway, and the extra character risks size-class goofs.
|
||||
*cursor++ = Unit('\0');
|
||||
MOZ_ASSERT(PointerRangeSize(decompressed.get(), cursor) == lengthWithNull);
|
||||
MOZ_ASSERT(PointerRangeSize(decompressed.get(), cursor) == len);
|
||||
|
||||
// Transfer ownership to |holder|.
|
||||
const Unit* ret = decompressed.get();
|
||||
|
@ -218,7 +218,7 @@ static constexpr size_t HasAtomMask = 1;
|
||||
static constexpr size_t HasAtomShift = 1;
|
||||
|
||||
static XDRResult
|
||||
XDRBindingName(XDRState<XDR_ENCODE>* xdr, BindingName* bindingName)
|
||||
XDRTrailingName(XDRState<XDR_ENCODE>* xdr, BindingName* bindingName, const uint32_t* length)
|
||||
{
|
||||
JSContext* cx = xdr->cx();
|
||||
|
||||
@ -238,7 +238,7 @@ XDRBindingName(XDRState<XDR_ENCODE>* xdr, BindingName* bindingName)
|
||||
}
|
||||
|
||||
static XDRResult
|
||||
XDRBindingName(XDRState<XDR_DECODE>* xdr, BindingName* bindingName)
|
||||
XDRTrailingName(XDRState<XDR_DECODE>* xdr, void* bindingName, uint32_t* length)
|
||||
{
|
||||
JSContext* cx = xdr->cx();
|
||||
|
||||
@ -252,7 +252,8 @@ XDRBindingName(XDRState<XDR_DECODE>* xdr, BindingName* bindingName)
|
||||
}
|
||||
|
||||
uint8_t flags = u8 >> HasAtomShift;
|
||||
*bindingName = BindingName::fromXDR(atom, flags);
|
||||
new (bindingName) BindingName(BindingName::fromXDR(atom, flags));
|
||||
++*length;
|
||||
|
||||
return Ok();
|
||||
}
|
||||
@ -288,7 +289,6 @@ Scope::XDRSizedBindingNames(XDRState<mode>* xdr, Handle<ConcreteScope*> scope,
|
||||
if (!data) {
|
||||
return xdr->fail(JS::TranscodeResult_Throw);
|
||||
}
|
||||
data->length = length;
|
||||
}
|
||||
|
||||
auto dataGuard = mozilla::MakeScopeExit([&] () {
|
||||
@ -299,8 +299,12 @@ Scope::XDRSizedBindingNames(XDRState<mode>* xdr, Handle<ConcreteScope*> scope,
|
||||
});
|
||||
|
||||
for (uint32_t i = 0; i < length; i++) {
|
||||
MOZ_TRY(XDRBindingName(xdr, &data->trailingNames[i]));
|
||||
if (mode == XDR_DECODE) {
|
||||
MOZ_ASSERT(i == data->length, "must be decoding at the end");
|
||||
}
|
||||
MOZ_TRY(XDRTrailingName(xdr, &data->trailingNames[i], &data->length));
|
||||
}
|
||||
MOZ_ASSERT(data->length == length);
|
||||
|
||||
dataGuard.release();
|
||||
return Ok();
|
||||
@ -1242,6 +1246,21 @@ GenerateWasmName(JSContext* cx, const char (&prefix)[ArrayLength], uint32_t inde
|
||||
return sb.finishAtom();
|
||||
}
|
||||
|
||||
static void
|
||||
InitializeTrailingName(TrailingNamesArray& trailingNames, size_t i, JSAtom* name)
|
||||
{
|
||||
void* trailingName = &trailingNames[i];
|
||||
new (trailingName) BindingName(name, false);
|
||||
}
|
||||
|
||||
template<class Data>
|
||||
static void
|
||||
InitializeNextTrailingName(const Rooted<UniquePtr<Data>>& data, JSAtom* name)
|
||||
{
|
||||
InitializeTrailingName(data->trailingNames, data->length, name);
|
||||
data->length++;
|
||||
}
|
||||
|
||||
/* static */ WasmInstanceScope*
|
||||
WasmInstanceScope::create(JSContext* cx, WasmInstanceObject* instance)
|
||||
{
|
||||
@ -1261,30 +1280,29 @@ WasmInstanceScope::create(JSContext* cx, WasmInstanceObject* instance)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
size_t nameIndex = 0;
|
||||
RootedAtom name(cx);
|
||||
if (instance->instance().memory()) {
|
||||
name = GenerateWasmName(cx, "memory", /* index = */ 0);
|
||||
if (!name) {
|
||||
JSAtom* wasmName = GenerateWasmName(cx, "memory", /* index = */ 0);
|
||||
if (!wasmName) {
|
||||
return nullptr;
|
||||
}
|
||||
new (&data->trailingNames[nameIndex]) BindingName(name, false);
|
||||
nameIndex++;
|
||||
|
||||
InitializeNextTrailingName(data, wasmName);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < globalsCount; i++) {
|
||||
name = GenerateWasmName(cx, "global", i);
|
||||
if (!name) {
|
||||
JSAtom* wasmName = GenerateWasmName(cx, "global", i);
|
||||
if (!wasmName) {
|
||||
return nullptr;
|
||||
}
|
||||
new (&data->trailingNames[nameIndex]) BindingName(name, false);
|
||||
nameIndex++;
|
||||
|
||||
InitializeNextTrailingName(data, wasmName);
|
||||
}
|
||||
MOZ_ASSERT(nameIndex == namesCount);
|
||||
|
||||
MOZ_ASSERT(data->length == namesCount);
|
||||
|
||||
data->instance.init(instance);
|
||||
data->memoriesStart = 0;
|
||||
data->globalsStart = globalsStart;
|
||||
data->length = namesCount;
|
||||
|
||||
Rooted<Scope*> enclosingScope(cx, &cx->global()->emptyGlobalScope());
|
||||
|
||||
@ -1326,16 +1344,17 @@ WasmFunctionScope::create(JSContext* cx, HandleScope enclosing, uint32_t funcInd
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
data->funcIndex = funcIndex;
|
||||
data->length = namesCount;
|
||||
RootedAtom name(cx);
|
||||
for (size_t i = 0; i < namesCount; i++) {
|
||||
name = GenerateWasmName(cx, "var", i);
|
||||
if (!name) {
|
||||
JSAtom* wasmName = GenerateWasmName(cx, "var", i);
|
||||
if (!wasmName) {
|
||||
return nullptr;
|
||||
}
|
||||
new (&data->trailingNames[i]) BindingName(name, false);
|
||||
|
||||
InitializeNextTrailingName(data, wasmName);
|
||||
}
|
||||
MOZ_ASSERT(data->length == namesCount);
|
||||
|
||||
data->funcIndex = funcIndex;
|
||||
|
||||
return Scope::create<WasmFunctionScope>(cx, ScopeKind::WasmFunction, enclosing,
|
||||
/* envShape = */ nullptr, &data);
|
||||
|
@ -305,8 +305,9 @@ SVGIDRenderingObserver::SVGIDRenderingObserver(URLAndReferrerInfo* aURI,
|
||||
referrerPolicy = aURI->GetReferrerPolicy();
|
||||
}
|
||||
|
||||
mObservedElementTracker.Reset(aObservingContent, uri, referrer,
|
||||
referrerPolicy, true, aReferenceImage);
|
||||
mObservedElementTracker.ResetToURIFragmentID(aObservingContent, uri, referrer,
|
||||
referrerPolicy, true,
|
||||
aReferenceImage);
|
||||
StartObserving();
|
||||
}
|
||||
|
||||
|
@ -144,13 +144,13 @@ nsSVGFilterInstance::GetFilterFrame(nsIFrame* aTargetFrame)
|
||||
}
|
||||
|
||||
// Look up the filter element by URL.
|
||||
IDTracker filterElement;
|
||||
IDTracker idTracker;
|
||||
bool watch = false;
|
||||
filterElement.Reset(mTargetContent, url,
|
||||
mFilter.GetURL()->ExtraData()->GetReferrer(),
|
||||
mFilter.GetURL()->ExtraData()->GetReferrerPolicy(),
|
||||
watch);
|
||||
Element* element = filterElement.get();
|
||||
idTracker.ResetToURIFragmentID(mTargetContent, url,
|
||||
mFilter.GetURL()->ExtraData()->GetReferrer(),
|
||||
mFilter.GetURL()->ExtraData()->GetReferrerPolicy(),
|
||||
watch);
|
||||
Element* element = idTracker.get();
|
||||
if (!element) {
|
||||
// The URL points to no element.
|
||||
return nullptr;
|
||||
|
@ -487,7 +487,7 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
}
|
||||
else if (this == menuParent->GetCurrentMenuItem()
|
||||
#ifdef XP_WIN
|
||||
&& GetParentMenuListType() == eNotMenuList
|
||||
&& !IsParentMenuList()
|
||||
#endif
|
||||
) {
|
||||
menuParent->ChangeMenuItem(nullptr, false, false);
|
||||
@ -502,7 +502,7 @@ nsMenuFrame::HandleEvent(nsPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (IsDisabled() && GetParentMenuListType() != eNotMenuList) {
|
||||
if (IsDisabled() && IsParentMenuList()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -821,21 +821,15 @@ nsMenuFrame::IsMenu()
|
||||
return mIsMenu;
|
||||
}
|
||||
|
||||
nsMenuListType
|
||||
nsMenuFrame::GetParentMenuListType()
|
||||
bool
|
||||
nsMenuFrame::IsParentMenuList()
|
||||
{
|
||||
nsMenuParent* menuParent = GetMenuParent();
|
||||
if (menuParent && menuParent->IsMenu()) {
|
||||
nsMenuPopupFrame* popupFrame = static_cast<nsMenuPopupFrame*>(menuParent);
|
||||
nsIFrame* parentMenu = popupFrame->GetParent();
|
||||
if (parentMenu) {
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(parentMenu->GetContent());
|
||||
if (menulist) {
|
||||
return eReadonlyMenuList;
|
||||
}
|
||||
}
|
||||
return popupFrame->IsMenuList();
|
||||
}
|
||||
return eNotMenuList;
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult
|
||||
|
@ -48,11 +48,6 @@ enum nsMenuType {
|
||||
eMenuType_Radio = 2
|
||||
};
|
||||
|
||||
enum nsMenuListType {
|
||||
eNotMenuList, // not a menulist
|
||||
eReadonlyMenuList // <menulist/>
|
||||
};
|
||||
|
||||
class nsMenuFrame;
|
||||
|
||||
/**
|
||||
@ -182,7 +177,7 @@ public:
|
||||
}
|
||||
virtual bool IsOpen();
|
||||
virtual bool IsMenu();
|
||||
nsMenuListType GetParentMenuListType();
|
||||
bool IsParentMenuList();
|
||||
bool IsDisabled();
|
||||
void ToggleMenuState();
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "nsMenuBarFrame.h"
|
||||
#include "nsPopupSetFrame.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "nsIDOMXULMenuListElement.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsFrameManager.h"
|
||||
#include "nsIDocument.h"
|
||||
@ -619,12 +618,8 @@ bool
|
||||
nsMenuPopupFrame::IsMenuList()
|
||||
{
|
||||
nsIFrame* parentMenu = GetParent();
|
||||
if (!parentMenu) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(parentMenu->GetContent());
|
||||
return menulist != nullptr;
|
||||
return (parentMenu && parentMenu->GetContent() &&
|
||||
parentMenu->GetContent()->IsXULElement(nsGkAtoms::menulist));
|
||||
}
|
||||
|
||||
nsIContent*
|
||||
|
@ -728,8 +728,7 @@ nsXULPopupManager::ShowMenu(nsIContent *aMenu,
|
||||
nsAutoString position;
|
||||
|
||||
#ifdef XP_MACOSX
|
||||
nsCOMPtr<nsIDOMXULMenuListElement> menulist = do_QueryInterface(aMenu);
|
||||
if (menulist) {
|
||||
if (aMenu->IsXULElement(nsGkAtoms::menulist)) {
|
||||
position.AssignLiteral("selection");
|
||||
}
|
||||
else
|
||||
@ -2559,7 +2558,7 @@ nsXULPopupManager::IsValidMenuItem(nsIContent* aContent, bool aOnPopup)
|
||||
nsMenuFrame* menuFrame = do_QueryFrame(aContent->GetPrimaryFrame());
|
||||
|
||||
bool skipNavigatingDisabledMenuItem = true;
|
||||
if (aOnPopup && (!menuFrame || menuFrame->GetParentMenuListType() == eNotMenuList)) {
|
||||
if (aOnPopup && (!menuFrame || !menuFrame->IsParentMenuList())) {
|
||||
skipNavigatingDisabledMenuItem =
|
||||
LookAndFeel::GetInt(LookAndFeel::eIntID_SkipNavigatingDisabledMenuItem,
|
||||
0) != 0;
|
||||
|
@ -16,7 +16,7 @@
|
||||
// bug 1338260, directv.com
|
||||
"directv.com": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36",
|
||||
// bug 1385206, rakuten.co.jp
|
||||
"rakuten.co.jp": "Firefox.+$#",
|
||||
"rakuten.co.jp": "Firefox.+$# ",
|
||||
// bug 1483233, ebay.com, m.ebay.com, and localized versions
|
||||
"ebay.at": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36",
|
||||
"m.ebay.at": "Mozilla/5.0 (Linux; Android 6.0.1; SM-G920F Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.91 Mobile Safari/537.36",
|
||||
|
@ -2,6 +2,6 @@
|
||||
<head><title>Hello, world!</title></head>
|
||||
<body>
|
||||
<a id="targetBlankLink" target="_blank" href="newSession_child.html">target="_blank"</a>
|
||||
<a id="noOpenerLink" target="_blank" rel="noopener" href="newSession_child.html">rel="noopener"</a>
|
||||
<a id="noOpenerLink" target="_blank" rel="noopener" href="http://example.com">rel="noopener"</a>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -83,9 +83,25 @@ class GeckoViewNavigation extends GeckoViewModule {
|
||||
this.moduleManager.updateRemoteType(remoteType);
|
||||
}
|
||||
|
||||
this.browser.loadURI(uri, {
|
||||
let parsedUri;
|
||||
let triggeringPrincipal;
|
||||
try {
|
||||
parsedUri = Services.io.newURI(uri);
|
||||
if (parsedUri.schemeIs("about") || parsedUri.schemeIs("data") ||
|
||||
parsedUri.schemeIs("file") || parsedUri.schemeIs("resource")) {
|
||||
// Only allow privileged loading for certain URIs.
|
||||
triggeringPrincipal = Services.scriptSecurityManager.getSystemPrincipal();
|
||||
}
|
||||
} catch (ignored) {
|
||||
}
|
||||
if (!triggeringPrincipal) {
|
||||
triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
|
||||
}
|
||||
|
||||
this.browser.loadURI(parsedUri ? parsedUri.spec : uri, {
|
||||
flags: navFlags,
|
||||
referrerURI: referrer,
|
||||
triggeringPrincipal,
|
||||
});
|
||||
break;
|
||||
case "GeckoView:Reload":
|
||||
|
@ -521,42 +521,6 @@ GECKO_LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalon
|
||||
</launchConfiguration>
|
||||
"""
|
||||
|
||||
B2GFLASH_LAUNCH_CONFIG_TEMPLATE = """<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.cdt.launch.applicationLaunchType">
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB" value="true"/>
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.AUTO_SOLIB_LIST"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_NAME" value="lldb"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.DEBUG_ON_FORK" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.GDB_INIT" value=""/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.NON_STOP" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.REVERSE" value="false"/>
|
||||
<listAttribute key="org.eclipse.cdt.dsf.gdb.SOLIB_PATH"/>
|
||||
<stringAttribute key="org.eclipse.cdt.dsf.gdb.TRACEPOINT_MODE" value="TP_NORMAL_ONLY"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.UPDATE_THREADLIST_ON_SUSPEND" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.dsf.gdb.internal.ui.launching.LocalApplicationCDebuggerTab.DEFAULTS_SET" value="true"/>
|
||||
<intAttribute key="org.eclipse.cdt.launch.ATTR_BUILD_BEFORE_LAUNCH_ATTR" value="2"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.COREFILE_PATH" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_ID" value="gdb"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_START_MODE" value="run"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN" value="false"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.DEBUGGER_STOP_AT_MAIN_SYMBOL" value="main"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROGRAM_NAME" value="@LAUNCH_PROGRAM@"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_ATTR" value="Gecko"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_AUTO_ATTR" value="true"/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.PROJECT_BUILD_CONFIG_ID_ATTR" value=""/>
|
||||
<stringAttribute key="org.eclipse.cdt.launch.WORKING_DIRECTORY" value="@OBJDIR@"/>
|
||||
<booleanAttribute key="org.eclipse.cdt.launch.use_terminal" value="true"/>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/gecko"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="4"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.debug.ui.ATTR_LAUNCH_IN_BACKGROUND" value="false"/>
|
||||
<stringAttribute key="process_factory_id" value="org.eclipse.cdt.dsf.gdb.GdbProcessFactory"/>
|
||||
</launchConfiguration>
|
||||
"""
|
||||
|
||||
|
||||
EDITOR_SETTINGS = """eclipse.preferences.version=1
|
||||
lineNumberRuler=true
|
||||
|
@ -5,9 +5,9 @@
|
||||
extern crate hashglobe;
|
||||
extern crate smallvec;
|
||||
|
||||
use hashglobe::FailedAllocationError;
|
||||
#[cfg(feature = "known_system_malloc")]
|
||||
use hashglobe::alloc;
|
||||
use hashglobe::FailedAllocationError;
|
||||
use smallvec::Array;
|
||||
use smallvec::SmallVec;
|
||||
use std::vec::Vec;
|
||||
|
@ -20,8 +20,8 @@ use std::fmt;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
|
||||
pub use std::collections::hash_map::{Entry, RandomState, Iter as MapIter, IterMut as MapIterMut};
|
||||
pub use std::collections::hash_set::{Iter as SetIter, IntoIter as SetIntoIter};
|
||||
pub use std::collections::hash_map::{Entry, Iter as MapIter, IterMut as MapIterMut, RandomState};
|
||||
pub use std::collections::hash_set::{IntoIter as SetIntoIter, Iter as SetIter};
|
||||
|
||||
#[derive(Clone)]
|
||||
pub struct HashMap<K, V, S = RandomState>(StdMap<K, V, S>);
|
||||
|
@ -15,13 +15,13 @@ use std::borrow::Borrow;
|
||||
use std::cmp::max;
|
||||
use std::fmt::{self, Debug};
|
||||
#[allow(deprecated)]
|
||||
use std::hash::{Hash, BuildHasher};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::iter::FromIterator;
|
||||
use std::mem::{self, replace};
|
||||
use std::ops::{Deref, Index};
|
||||
|
||||
use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash};
|
||||
use super::table::BucketState::{Empty, Full};
|
||||
use super::table::{self, Bucket, EmptyBucket, FullBucket, FullBucketMut, RawTable, SafeHash};
|
||||
|
||||
use FailedAllocationError;
|
||||
|
||||
@ -2214,11 +2214,11 @@ fn assert_covariance() {
|
||||
#[cfg(test)]
|
||||
mod test_map {
|
||||
extern crate rand;
|
||||
use super::HashMap;
|
||||
use self::rand::{thread_rng, Rng};
|
||||
use super::Entry::{Occupied, Vacant};
|
||||
use super::HashMap;
|
||||
use super::RandomState;
|
||||
use cell::RefCell;
|
||||
use self::rand::{thread_rng, Rng};
|
||||
|
||||
#[test]
|
||||
fn test_zero_capacities() {
|
||||
|
@ -10,12 +10,12 @@
|
||||
|
||||
use std::borrow::Borrow;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, BuildHasher};
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::iter::{Chain, FromIterator};
|
||||
use std::ops::{BitOr, BitAnd, BitXor, Sub};
|
||||
use std::ops::{BitAnd, BitOr, BitXor, Sub};
|
||||
|
||||
use super::Recover;
|
||||
use super::hash_map::{self, HashMap, Keys, RandomState};
|
||||
use super::Recover;
|
||||
|
||||
// Future Optimization (FIXME!)
|
||||
// =============================
|
||||
@ -1258,8 +1258,8 @@ fn assert_covariance() {
|
||||
|
||||
#[cfg(test)]
|
||||
mod test_set {
|
||||
use super::HashSet;
|
||||
use super::hash_map::RandomState;
|
||||
use super::HashSet;
|
||||
|
||||
#[test]
|
||||
fn test_zero_capacities() {
|
||||
|
@ -9,13 +9,13 @@
|
||||
// except according to those terms.
|
||||
|
||||
use alloc::{alloc, dealloc};
|
||||
use shim::{Shared, Unique};
|
||||
use std::cmp;
|
||||
use std::hash::{BuildHasher, Hash, Hasher};
|
||||
use std::marker;
|
||||
use std::mem::{self, align_of, size_of};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::ptr;
|
||||
use shim::{Unique, Shared};
|
||||
|
||||
use self::BucketState::*;
|
||||
use FailedAllocationError;
|
||||
|
@ -82,8 +82,8 @@ extern crate xml5ever;
|
||||
use serde_bytes::ByteBuf;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::mem::size_of;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::ops::Range;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::os::raw::c_void;
|
||||
use void::Void;
|
||||
|
||||
@ -557,6 +557,36 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> MallocShallowSizeOf for std::collections::BTreeMap<K, V>
|
||||
where
|
||||
K: Eq + Hash,
|
||||
{
|
||||
fn shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
if ops.has_malloc_enclosing_size_of() {
|
||||
self.values()
|
||||
.next()
|
||||
.map_or(0, |v| unsafe { ops.malloc_enclosing_size_of(v) })
|
||||
} else {
|
||||
self.len() * (size_of::<V>() + size_of::<K>() + size_of::<usize>())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V> MallocSizeOf for std::collections::BTreeMap<K, V>
|
||||
where
|
||||
K: Eq + Hash + MallocSizeOf,
|
||||
V: MallocSizeOf,
|
||||
{
|
||||
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
let mut n = self.shallow_size_of(ops);
|
||||
for (k, v) in self.iter() {
|
||||
n += k.size_of(ops);
|
||||
n += v.size_of(ops);
|
||||
}
|
||||
n
|
||||
}
|
||||
}
|
||||
|
||||
impl<K, V, S> MallocShallowSizeOf for hashglobe::hash_map::HashMap<K, V, S>
|
||||
where
|
||||
K: Eq + Hash,
|
||||
|
@ -88,7 +88,8 @@ fn malloc_size_of_derive(s: synstructure::Structure) -> quote::Tokens {
|
||||
fn test_struct() {
|
||||
let source = syn::parse_str(
|
||||
"struct Foo<T> { bar: Bar, baz: T, #[ignore_malloc_size_of = \"\"] z: Arc<T> }",
|
||||
).unwrap();
|
||||
)
|
||||
.unwrap();
|
||||
let source = synstructure::Structure::new(&source);
|
||||
|
||||
let expanded = malloc_size_of_derive(source).to_string();
|
||||
|
@ -23,7 +23,7 @@ use sink::Push;
|
||||
use smallvec::{self, SmallVec};
|
||||
use std::cmp;
|
||||
use std::iter;
|
||||
use std::ops::{AddAssign, Add};
|
||||
use std::ops::{Add, AddAssign};
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
|
||||
|
@ -588,7 +588,8 @@ where
|
||||
element.is_html_element_in_html_document(),
|
||||
&local_name.name,
|
||||
&local_name.lower_name,
|
||||
).borrow();
|
||||
)
|
||||
.borrow();
|
||||
element.local_name() == name
|
||||
}
|
||||
|
||||
|
@ -8,10 +8,10 @@ use attr::{ParsedCaseSensitivity, SELECTOR_WHITESPACE};
|
||||
use bloom::BLOOM_HASH_MASK;
|
||||
use builder::{SelectorBuilder, SpecificityAndFlags};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{parse_nth, serialize_identifier};
|
||||
use cssparser::{BasicParseError, BasicParseErrorKind, ParseError, ParseErrorKind};
|
||||
use cssparser::{CowRcStr, Delimiter, SourceLocation};
|
||||
use cssparser::{CssStringWriter, Parser as CssParser, ToCss, Token};
|
||||
use cssparser::{parse_nth, serialize_identifier};
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use servo_arc::ThinArc;
|
||||
use sink::Push;
|
||||
@ -270,7 +270,9 @@ where
|
||||
|
||||
// Ensure they're actually all compound selectors without pseudo-elements.
|
||||
if selector.has_pseudo_element() {
|
||||
return Err(location.new_custom_error(SelectorParseErrorKind::PseudoElementInComplexSelector));
|
||||
return Err(
|
||||
location.new_custom_error(SelectorParseErrorKind::PseudoElementInComplexSelector)
|
||||
);
|
||||
}
|
||||
|
||||
if selector.iter_raw_match_order().any(|s| s.is_combinator()) {
|
||||
@ -457,7 +459,7 @@ where
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
},
|
||||
}
|
||||
AttributeOther(ref attr_selector) if !attr_selector.never_matches => {
|
||||
let empty_string;
|
||||
let namespace = match attr_selector.namespace() {
|
||||
@ -1720,7 +1722,8 @@ where
|
||||
if namespace.is_none() && include!(concat!(
|
||||
env!("OUT_DIR"),
|
||||
"/ascii_case_insensitive_html_attributes.rs"
|
||||
)).contains(&*local_name_lower_cow)
|
||||
))
|
||||
.contains(&*local_name_lower_cow)
|
||||
{
|
||||
case_sensitivity =
|
||||
ParsedCaseSensitivity::AsciiCaseInsensitiveIfInHtmlElementInHtmlDocument
|
||||
@ -1872,33 +1875,30 @@ where
|
||||
SimpleSelectorParseResult::PseudoElement(p) => {
|
||||
slotted_selector = None;
|
||||
pseudo_element = Some(p);
|
||||
}
|
||||
},
|
||||
SimpleSelectorParseResult::SlottedPseudo(selector) => {
|
||||
slotted_selector = Some(selector);
|
||||
let maybe_pseudo = parse_one_simple_selector(
|
||||
parser,
|
||||
input,
|
||||
/* inside_negation = */ false,
|
||||
)?;
|
||||
let maybe_pseudo =
|
||||
parse_one_simple_selector(parser, input, /* inside_negation = */ false)?;
|
||||
|
||||
pseudo_element = match maybe_pseudo {
|
||||
None => None,
|
||||
Some(SimpleSelectorParseResult::PseudoElement(pseudo)) => {
|
||||
if !pseudo.valid_after_slotted() {
|
||||
return Err(input.new_custom_error(
|
||||
SelectorParseErrorKind::InvalidPseudoElementAfterSlotted
|
||||
SelectorParseErrorKind::InvalidPseudoElementAfterSlotted,
|
||||
));
|
||||
}
|
||||
Some(pseudo)
|
||||
}
|
||||
},
|
||||
Some(SimpleSelectorParseResult::SimpleSelector(..)) |
|
||||
Some(SimpleSelectorParseResult::SlottedPseudo(..)) => {
|
||||
return Err(input.new_custom_error(
|
||||
SelectorParseErrorKind::NonPseudoElementAfterSlotted
|
||||
SelectorParseErrorKind::NonPseudoElementAfterSlotted,
|
||||
));
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
debug_assert!(slotted_selector.is_some() || pseudo_element.is_some());
|
||||
@ -1925,14 +1925,12 @@ where
|
||||
let name = match input.next_including_whitespace()? {
|
||||
&Token::Ident(ref name) => name.clone(),
|
||||
t => {
|
||||
return Err(location.new_custom_error(
|
||||
SelectorParseErrorKind::NoIdentForPseudo(t.clone()),
|
||||
))
|
||||
return Err(location
|
||||
.new_custom_error(SelectorParseErrorKind::NoIdentForPseudo(t.clone())))
|
||||
},
|
||||
};
|
||||
|
||||
let pseudo_class =
|
||||
P::parse_non_ts_pseudo_class(parser, location, name.clone())?;
|
||||
let pseudo_class = P::parse_non_ts_pseudo_class(parser, location, name.clone())?;
|
||||
if !p.supports_pseudo_class(&pseudo_class) {
|
||||
return Err(input.new_custom_error(
|
||||
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name),
|
||||
@ -2139,7 +2137,8 @@ where
|
||||
"last-of-type" => Ok(Component::LastOfType),
|
||||
"only-of-type" => Ok(Component::OnlyOfType),
|
||||
_ => Err(())
|
||||
}).or_else(|()| {
|
||||
})
|
||||
.or_else(|()| {
|
||||
P::parse_non_ts_pseudo_class(parser, location, name).map(Component::NonTSPseudoClass)
|
||||
})
|
||||
}
|
||||
@ -2147,12 +2146,12 @@ where
|
||||
// NB: pub module in order to access the DummyParser
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
use super::*;
|
||||
use builder::HAS_PSEUDO_BIT;
|
||||
use cssparser::{serialize_identifier, Parser as CssParser, ParserInput, ToCss};
|
||||
use parser;
|
||||
use std::collections::HashMap;
|
||||
use std::fmt;
|
||||
use super::*;
|
||||
|
||||
#[derive(Clone, Debug, Eq, PartialEq)]
|
||||
pub enum PseudoClass {
|
||||
@ -2422,9 +2421,9 @@ pub mod tests {
|
||||
vec![Component::LocalName(LocalName {
|
||||
name: DummyAtom::from("EeÉ"),
|
||||
lower_name: DummyAtom::from("eeÉ"),
|
||||
}), ],
|
||||
})],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("|e"),
|
||||
@ -2437,7 +2436,7 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// When the default namespace is not set, *| should be elided.
|
||||
// https://github.com/servo/servo/pull/17537
|
||||
@ -2447,9 +2446,9 @@ pub mod tests {
|
||||
vec![Component::LocalName(LocalName {
|
||||
name: DummyAtom::from("e"),
|
||||
lower_name: DummyAtom::from("e"),
|
||||
}), ],
|
||||
})],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// When the default namespace is set, *| should _not_ be elided (as foo
|
||||
// is no longer equivalent to *|foo--the former is only for foo in the
|
||||
@ -2469,14 +2468,14 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("*"),
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::ExplicitUniversalType],
|
||||
specificity(0, 0, 0)
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("|*"),
|
||||
@ -2486,14 +2485,14 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_expected("*|*", Some("*")),
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::ExplicitUniversalType],
|
||||
specificity(0, 0, 0)
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(
|
||||
@ -2506,7 +2505,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse(".foo:lang(en-US)"),
|
||||
@ -2516,14 +2515,14 @@ pub mod tests {
|
||||
Component::NonTSPseudoClass(PseudoClass::Lang("en-US".to_owned())),
|
||||
],
|
||||
specificity(0, 2, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("#bar"),
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::ID(DummyAtom::from("bar"))],
|
||||
specificity(1, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("e.foo#bar"),
|
||||
@ -2537,7 +2536,7 @@ pub mod tests {
|
||||
Component::ID(DummyAtom::from("bar")),
|
||||
],
|
||||
specificity(1, 1, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("e.foo #bar"),
|
||||
@ -2552,7 +2551,7 @@ pub mod tests {
|
||||
Component::ID(DummyAtom::from("bar")),
|
||||
],
|
||||
specificity(1, 1, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace does not apply to attribute selectors
|
||||
// https://github.com/mozilla/servo/pull/1652
|
||||
@ -2563,9 +2562,9 @@ pub mod tests {
|
||||
vec![Component::AttributeInNoNamespaceExists {
|
||||
local_name: DummyAtom::from("Foo"),
|
||||
local_name_lower: DummyAtom::from("foo"),
|
||||
}, ],
|
||||
}],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert!(parse_ns("svg|circle", &parser).is_err());
|
||||
parser
|
||||
@ -2582,7 +2581,7 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns("svg|*", &parser),
|
||||
@ -2592,7 +2591,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace does not apply to attribute selectors
|
||||
// https://github.com/mozilla/servo/pull/1652
|
||||
@ -2610,7 +2609,7 @@ pub mod tests {
|
||||
},
|
||||
],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace does apply to type selectors
|
||||
assert_eq!(
|
||||
@ -2624,7 +2623,7 @@ pub mod tests {
|
||||
}),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns("*", &parser),
|
||||
@ -2634,7 +2633,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns("*|*", &parser),
|
||||
@ -2644,7 +2643,7 @@ pub mod tests {
|
||||
Component::ExplicitUniversalType,
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// Default namespace applies to universal and type selectors inside :not and :matches,
|
||||
// but not otherwise.
|
||||
@ -2660,7 +2659,7 @@ pub mod tests {
|
||||
),
|
||||
],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(*)", &parser),
|
||||
@ -2671,12 +2670,13 @@ pub mod tests {
|
||||
vec![
|
||||
Component::DefaultNamespace(MATHML.into()),
|
||||
Component::ExplicitUniversalType,
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
),
|
||||
],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(e)", &parser),
|
||||
@ -2690,12 +2690,13 @@ pub mod tests {
|
||||
name: DummyAtom::from("e"),
|
||||
lower_name: DummyAtom::from("e"),
|
||||
}),
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
),
|
||||
],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("[attr|=\"foo\"]"),
|
||||
@ -2706,9 +2707,9 @@ pub mod tests {
|
||||
value: DummyAtom::from("foo"),
|
||||
never_matches: false,
|
||||
case_sensitivity: ParsedCaseSensitivity::CaseSensitive,
|
||||
}, ],
|
||||
}],
|
||||
specificity(0, 1, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// https://github.com/mozilla/servo/issues/1723
|
||||
assert_eq!(
|
||||
@ -2716,7 +2717,7 @@ pub mod tests {
|
||||
Ok(SelectorList::from_vec(vec![Selector::from_vec(
|
||||
vec![Component::PseudoElement(PseudoElement::Before)],
|
||||
specificity(0, 0, 1) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("::before:hover"),
|
||||
@ -2726,7 +2727,7 @@ pub mod tests {
|
||||
Component::NonTSPseudoClass(PseudoClass::Hover),
|
||||
],
|
||||
specificity(0, 1, 1) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("::before:hover:hover"),
|
||||
@ -2737,7 +2738,7 @@ pub mod tests {
|
||||
Component::NonTSPseudoClass(PseudoClass::Hover),
|
||||
],
|
||||
specificity(0, 2, 1) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert!(parse("::before:hover:active").is_err());
|
||||
assert!(parse("::before:hover .foo").is_err());
|
||||
@ -2760,7 +2761,7 @@ pub mod tests {
|
||||
Component::PseudoElement(PseudoElement::After),
|
||||
],
|
||||
specificity(0, 0, 2) | HAS_PSEUDO_BIT,
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse("#d1 > .ok"),
|
||||
@ -2771,7 +2772,7 @@ pub mod tests {
|
||||
Component::Class(DummyAtom::from("ok")),
|
||||
],
|
||||
(1 << 20) + (1 << 10) + (0 << 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
parser.default_ns = None;
|
||||
assert!(parse(":not(#provel.old)").is_err());
|
||||
@ -2784,9 +2785,9 @@ pub mod tests {
|
||||
vec![Component::ID(DummyAtom::from("provel"))]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(1, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(svg|circle)", &parser),
|
||||
@ -2798,11 +2799,12 @@ pub mod tests {
|
||||
name: DummyAtom::from("circle"),
|
||||
lower_name: DummyAtom::from("circle"),
|
||||
}),
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 1),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// https://github.com/servo/servo/issues/16017
|
||||
assert_eq!(
|
||||
@ -2812,9 +2814,9 @@ pub mod tests {
|
||||
vec![Component::ExplicitUniversalType]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(|*)", &parser),
|
||||
@ -2823,11 +2825,12 @@ pub mod tests {
|
||||
vec![
|
||||
Component::ExplicitNoNamespace,
|
||||
Component::ExplicitUniversalType,
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
// *| should be elided if there is no default namespace.
|
||||
// https://github.com/servo/servo/pull/17537
|
||||
@ -2838,9 +2841,9 @@ pub mod tests {
|
||||
vec![Component::ExplicitUniversalType]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
assert_eq!(
|
||||
parse_ns(":not(svg|*)", &parser),
|
||||
@ -2849,11 +2852,12 @@ pub mod tests {
|
||||
vec![
|
||||
Component::Namespace(DummyAtom("svg".into()), SVG.into()),
|
||||
Component::ExplicitUniversalType,
|
||||
].into_boxed_slice()
|
||||
]
|
||||
.into_boxed_slice()
|
||||
.into(),
|
||||
), ],
|
||||
)],
|
||||
specificity(0, 0, 0),
|
||||
), ]))
|
||||
)]))
|
||||
);
|
||||
|
||||
assert!(parse("::slotted()").is_err());
|
||||
@ -2891,7 +2895,8 @@ pub mod tests {
|
||||
let selector = &parse_ns(
|
||||
"*|*::before",
|
||||
&DummyParser::default_with_namespace(DummyAtom::from("https://mozilla.org")),
|
||||
).unwrap()
|
||||
)
|
||||
.unwrap()
|
||||
.0[0];
|
||||
assert!(selector.is_universal());
|
||||
}
|
||||
|
@ -22,7 +22,9 @@ impl OpaqueElement {
|
||||
/// Creates a new OpaqueElement from an arbitrarily-typed pointer.
|
||||
pub fn new<T>(ptr: &T) -> Self {
|
||||
unsafe {
|
||||
OpaqueElement(NonNull::new_unchecked(ptr as *const T as *const () as *mut ()))
|
||||
OpaqueElement(NonNull::new_unchecked(
|
||||
ptr as *const T as *const () as *mut (),
|
||||
))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,7 +32,6 @@ use nodrop::NoDrop;
|
||||
#[cfg(feature = "servo")]
|
||||
use serde::{Deserialize, Serialize};
|
||||
use stable_deref_trait::{CloneStableDeref, StableDeref};
|
||||
use std::{isize, usize};
|
||||
use std::borrow;
|
||||
use std::cmp::Ordering;
|
||||
use std::convert::From;
|
||||
@ -48,6 +47,7 @@ use std::ptr;
|
||||
use std::slice;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::Ordering::{Acquire, Relaxed, Release};
|
||||
use std::{isize, usize};
|
||||
|
||||
// Private macro to get the offset of a struct field in bytes from the address of the struct.
|
||||
macro_rules! offset_of {
|
||||
@ -1170,11 +1170,11 @@ impl<A: fmt::Debug, B: fmt::Debug> fmt::Debug for ArcUnion<A, B> {
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::{Arc, HeaderWithLength, ThinArc};
|
||||
use std::clone::Clone;
|
||||
use std::ops::Drop;
|
||||
use std::sync::atomic;
|
||||
use std::sync::atomic::Ordering::{Acquire, SeqCst};
|
||||
use super::{Arc, HeaderWithLength, ThinArc};
|
||||
|
||||
#[derive(PartialEq)]
|
||||
struct Canary(*mut atomic::AtomicUsize);
|
||||
|
@ -8,15 +8,14 @@
|
||||
// compile it out so that people remember it exists, thus the cfg'd Sender
|
||||
// import.
|
||||
|
||||
use Atom;
|
||||
use bezier::Bezier;
|
||||
use context::SharedStyleContext;
|
||||
use dom::{OpaqueNode, TElement};
|
||||
use font_metrics::FontMetricsProvider;
|
||||
use properties::{self, CascadeMode, ComputedValues, LonghandId};
|
||||
use properties::animated_properties::AnimatedProperty;
|
||||
use properties::longhands::animation_direction::computed_value::single_value::T as AnimationDirection;
|
||||
use properties::longhands::animation_play_state::computed_value::single_value::T as AnimationPlayState;
|
||||
use properties::{self, CascadeMode, ComputedValues, LonghandId};
|
||||
use rule_tree::CascadeLevel;
|
||||
use servo_arc::Arc;
|
||||
#[cfg(feature = "servo")]
|
||||
@ -26,12 +25,12 @@ use std::fmt;
|
||||
use std::sync::mpsc::Sender;
|
||||
use stylesheets::keyframes_rule::{KeyframesAnimation, KeyframesStep, KeyframesStepValue};
|
||||
use timer::Timer;
|
||||
use values::computed::box_::TransitionProperty;
|
||||
use values::computed::Time;
|
||||
use values::computed::TimingFunction;
|
||||
use values::computed::box_::TransitionProperty;
|
||||
use values::generics::box_::AnimationIterationCount;
|
||||
use values::generics::easing::{StepPosition, TimingFunction as GenericTimingFunction};
|
||||
|
||||
use Atom;
|
||||
|
||||
/// This structure represents a keyframes animation current iteration state.
|
||||
///
|
||||
@ -316,7 +315,8 @@ impl PropertyAnimation {
|
||||
old_style,
|
||||
new_style,
|
||||
)
|
||||
}).collect(),
|
||||
})
|
||||
.collect(),
|
||||
TransitionProperty::Longhand(longhand_id) => {
|
||||
let animation = PropertyAnimation::from_longhand(
|
||||
longhand_id,
|
||||
@ -367,8 +367,9 @@ impl PropertyAnimation {
|
||||
let mut current_step = (time * (steps as f64)).floor() as i32;
|
||||
|
||||
if pos == StepPosition::Start ||
|
||||
pos == StepPosition::JumpStart ||
|
||||
pos == StepPosition::JumpBoth {
|
||||
pos == StepPosition::JumpStart ||
|
||||
pos == StepPosition::JumpBoth
|
||||
{
|
||||
current_step = current_step + 1;
|
||||
}
|
||||
|
||||
@ -472,7 +473,8 @@ pub fn start_transitions_if_applicable(
|
||||
duration: box_style.transition_duration_mod(i).seconds() as f64,
|
||||
property_animation,
|
||||
},
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
|
||||
had_animations = true;
|
||||
}
|
||||
@ -759,7 +761,8 @@ where
|
||||
} else {
|
||||
None
|
||||
}
|
||||
}).unwrap_or(animation.steps.len() - 1);
|
||||
})
|
||||
.unwrap_or(animation.steps.len() - 1);
|
||||
},
|
||||
_ => unreachable!(),
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [attr]: https://dom.spec.whatwg.org/#interface-attr
|
||||
|
||||
use {Atom, LocalName, Namespace, Prefix};
|
||||
use app_units::Au;
|
||||
use cssparser::{self, Color, RGBA};
|
||||
use euclid::num::Zero;
|
||||
@ -17,10 +16,11 @@ use servo_arc::Arc;
|
||||
use servo_url::ServoUrl;
|
||||
use shared_lock::Locked;
|
||||
use std::str::FromStr;
|
||||
use str::str_join;
|
||||
use str::{read_exponent, read_fraction, HTML_SPACE_CHARACTERS};
|
||||
use str::{read_numbers, split_commas, split_html_space_chars};
|
||||
use str::str_join;
|
||||
use values::specified::Length;
|
||||
use {Atom, LocalName, Namespace, Prefix};
|
||||
|
||||
// Duplicated from script::dom::values.
|
||||
const UNSIGNED_LONG_MAX: u32 = 2147483647;
|
||||
|
@ -67,7 +67,8 @@ fn find_python() -> String {
|
||||
"python2.7"
|
||||
} else {
|
||||
"python"
|
||||
}.to_owned()
|
||||
}
|
||||
.to_owned()
|
||||
}
|
||||
|
||||
lazy_static! {
|
||||
|
@ -14,6 +14,8 @@ mod common {
|
||||
|
||||
#[cfg(feature = "bindgen")]
|
||||
mod bindings {
|
||||
use super::super::PYTHON;
|
||||
use super::common::*;
|
||||
use bindgen::{Builder, CodegenConfig};
|
||||
use regex::Regex;
|
||||
use std::cmp;
|
||||
@ -26,8 +28,6 @@ mod bindings {
|
||||
use std::slice;
|
||||
use std::sync::Mutex;
|
||||
use std::time::SystemTime;
|
||||
use super::common::*;
|
||||
use super::super::PYTHON;
|
||||
use toml;
|
||||
use toml::value::Table;
|
||||
|
||||
@ -284,7 +284,8 @@ mod bindings {
|
||||
let macro_name = captures.get(1).unwrap().as_str().to_string();
|
||||
let type_name = captures.get(2).unwrap().as_str().to_string();
|
||||
(macro_name, type_name)
|
||||
}).collect()
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
fn get_borrowed_types() -> Vec<(bool, String)> {
|
||||
@ -419,7 +420,8 @@ mod bindings {
|
||||
servo,
|
||||
if generic { "<T>" } else { "" }
|
||||
))
|
||||
}).get_builder();
|
||||
})
|
||||
.get_builder();
|
||||
write_binding_file(builder, STRUCTS_FILE, &fixups);
|
||||
}
|
||||
|
||||
@ -467,7 +469,8 @@ mod bindings {
|
||||
filter: env::var("STYLO_BUILD_FILTER")
|
||||
.ok()
|
||||
.unwrap_or_else(|| "bindgen".to_owned()),
|
||||
})).expect("Failed to set logger.");
|
||||
}))
|
||||
.expect("Failed to set logger.");
|
||||
|
||||
true
|
||||
} else {
|
||||
@ -486,7 +489,8 @@ mod bindings {
|
||||
.handle_common(&mut fixups)
|
||||
.handle_str_items("whitelist-functions", |b, item| b.whitelist_function(item))
|
||||
.handle_str_items("structs-types", |mut builder, ty| {
|
||||
builder = builder.blacklist_type(ty)
|
||||
builder = builder
|
||||
.blacklist_type(ty)
|
||||
.raw_line(format!("use gecko_bindings::structs::{};", ty));
|
||||
structs_types.insert(ty);
|
||||
// TODO this is hacky, figure out a better way to do it without
|
||||
@ -504,10 +508,14 @@ mod bindings {
|
||||
.handle_table_items("array-types", |builder, item| {
|
||||
let cpp_type = item["cpp-type"].as_str().unwrap();
|
||||
let rust_type = item["rust-type"].as_str().unwrap();
|
||||
builder
|
||||
.raw_line(format!(concat!("pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"),
|
||||
cpp_type, rust_type))
|
||||
builder.raw_line(format!(
|
||||
concat!(
|
||||
"pub type nsTArrayBorrowed_{}<'a> = ",
|
||||
"&'a mut ::gecko_bindings::structs::nsTArray<{}>;"
|
||||
),
|
||||
cpp_type,
|
||||
rust_type
|
||||
))
|
||||
})
|
||||
.handle_str_items("servo-immutable-borrow-types", |b, ty| b.borrowed_type(ty))
|
||||
// Right now the only immutable borrow types are ones which we import
|
||||
@ -529,7 +537,8 @@ mod bindings {
|
||||
.raw_line(format!(
|
||||
"pub type {0}Strong = ::gecko_bindings::sugar::ownership::Strong<{0}>;",
|
||||
ty
|
||||
)).borrowed_type(ty)
|
||||
))
|
||||
.borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
}
|
||||
for ty in get_boxed_types().iter() {
|
||||
@ -538,14 +547,16 @@ mod bindings {
|
||||
.raw_line(format!(
|
||||
"pub type {0}Owned = ::gecko_bindings::sugar::ownership::Owned<{0}>;",
|
||||
ty
|
||||
)).blacklist_type(format!("{}OwnedOrNull", ty))
|
||||
))
|
||||
.blacklist_type(format!("{}OwnedOrNull", ty))
|
||||
.raw_line(format!(
|
||||
concat!(
|
||||
"pub type {0}OwnedOrNull = ",
|
||||
"::gecko_bindings::sugar::ownership::OwnedOrNull<{0}>;"
|
||||
),
|
||||
ty
|
||||
)).mutable_borrowed_type(ty)
|
||||
))
|
||||
.mutable_borrowed_type(ty)
|
||||
.zero_size_type(ty, &structs_types);
|
||||
}
|
||||
write_binding_file(builder, BINDINGS_FILE, &fixups);
|
||||
@ -595,9 +606,9 @@ mod bindings {
|
||||
|
||||
#[cfg(not(feature = "bindgen"))]
|
||||
mod bindings {
|
||||
use std::{env, fs, io};
|
||||
use std::path::{Path, PathBuf};
|
||||
use super::common::*;
|
||||
use std::path::{Path, PathBuf};
|
||||
use std::{env, fs, io};
|
||||
|
||||
/// Copy contents of one directory into another.
|
||||
/// It currently only does a shallow copy.
|
||||
@ -622,7 +633,8 @@ mod bindings {
|
||||
println!("cargo:rerun-if-changed={}", dir.display());
|
||||
copy_dir(&dir, &*OUTDIR_PATH, |path| {
|
||||
println!("cargo:rerun-if-changed={}", path.display());
|
||||
}).expect("Fail to copy generated files to out dir");
|
||||
})
|
||||
.expect("Fail to copy generated files to out dir");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,9 +9,9 @@ use animation::Animation;
|
||||
use app_units::Au;
|
||||
use bloom::StyleBloom;
|
||||
use data::{EagerPseudoStyles, ElementData};
|
||||
use dom::{SendElement, TElement};
|
||||
#[cfg(feature = "servo")]
|
||||
use dom::OpaqueNode;
|
||||
use dom::{SendElement, TElement};
|
||||
use euclid::Size2D;
|
||||
use euclid::TypedScale;
|
||||
use font_metrics::FontMetricsProvider;
|
||||
@ -27,8 +27,8 @@ use properties::PropertyId;
|
||||
use rule_cache::RuleCache;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{SnapshotMap, EAGER_PSEUDO_COUNT};
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
#[cfg(feature = "servo")]
|
||||
use servo_atoms::Atom;
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [counter-style]: https://drafts.csswg.org/css-counter-styles/
|
||||
|
||||
use Atom;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser};
|
||||
use cssparser::{CowRcStr, Parser, SourceLocation, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
@ -20,8 +19,9 @@ use std::ops::Range;
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use values::CustomIdent;
|
||||
use values::specified::Integer;
|
||||
use values::CustomIdent;
|
||||
use Atom;
|
||||
|
||||
/// Parse a counter style name reference.
|
||||
///
|
||||
@ -502,7 +502,8 @@ impl Parse for Ranges {
|
||||
}
|
||||
}
|
||||
Ok(opt_start..opt_end)
|
||||
}).map(Ranges)
|
||||
})
|
||||
.map(Ranges)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [custom]: https://drafts.csswg.org/css-variables/
|
||||
|
||||
use Atom;
|
||||
use cssparser::{Delimiter, Parser, ParserInput, SourcePosition, Token, TokenSerializationType};
|
||||
use hash::map::Entry;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
@ -20,6 +19,7 @@ use std::cmp;
|
||||
use std::fmt::{self, Write};
|
||||
use std::hash::Hash;
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use Atom;
|
||||
|
||||
/// The environment from which to get `env` function values.
|
||||
///
|
||||
@ -631,11 +631,8 @@ impl<'a> CustomPropertiesBuilder<'a> {
|
||||
// environment variable here, perform substitution here instead
|
||||
// of forcing a full traversal in `substitute_all` afterwards.
|
||||
let value = if !has_references && unparsed_value.references_environment {
|
||||
let result = substitute_references_in_value(
|
||||
unparsed_value,
|
||||
&map,
|
||||
&self.environment,
|
||||
);
|
||||
let result =
|
||||
substitute_references_in_value(unparsed_value, &map, &self.environment);
|
||||
match result {
|
||||
Ok(new_value) => Arc::new(new_value),
|
||||
Err(..) => {
|
||||
@ -886,11 +883,7 @@ fn substitute_all(custom_properties_map: &mut CustomPropertiesMap, environment:
|
||||
// Now we have shown that this variable is not in a loop, and
|
||||
// all of its dependencies should have been resolved. We can
|
||||
// start substitution now.
|
||||
let result = substitute_references_in_value(
|
||||
&value,
|
||||
&context.map,
|
||||
&context.environment,
|
||||
);
|
||||
let result = substitute_references_in_value(&value, &context.map, &context.environment);
|
||||
|
||||
match result {
|
||||
Ok(computed_value) => {
|
||||
|
@ -7,7 +7,6 @@
|
||||
#![allow(unsafe_code)]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
#[cfg(feature = "gecko")]
|
||||
@ -20,9 +19,9 @@ use font_metrics::FontMetricsProvider;
|
||||
use media_queries::Device;
|
||||
use properties::{AnimationRules, ComputedValues, PropertyDeclarationBlock};
|
||||
use selector_parser::{AttrValue, Lang, PseudoElement, SelectorImpl};
|
||||
use selectors::Element as SelectorsElement;
|
||||
use selectors::matching::{ElementSelectorFlags, QuirksMode, VisitedHandlingMode};
|
||||
use selectors::sink::Push;
|
||||
use selectors::Element as SelectorsElement;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::Locked;
|
||||
use std::fmt;
|
||||
@ -31,6 +30,7 @@ use std::hash::Hash;
|
||||
use std::ops::Deref;
|
||||
use stylist::CascadeData;
|
||||
use traversal_flags::TraversalFlags;
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// An opaque handle to a node, which, unlike UnsafeNode, cannot be transformed
|
||||
/// back into a non-opaque representation. The only safe operation that can be
|
||||
|
@ -5,17 +5,17 @@
|
||||
//! Generic implementations of some DOM APIs so they can be shared between Servo
|
||||
//! and Gecko.
|
||||
|
||||
use Atom;
|
||||
use context::QuirksMode;
|
||||
use dom::{TDocument, TElement, TNode, TShadowRoot};
|
||||
use invalidation::element::invalidator::{DescendantInvalidationLists, Invalidation};
|
||||
use invalidation::element::invalidator::{InvalidationProcessor, InvalidationVector};
|
||||
use selectors::{Element, NthIndexCache, SelectorList};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::{self, MatchingContext, MatchingMode};
|
||||
use selectors::parser::{Combinator, Component, LocalName, SelectorImpl};
|
||||
use selectors::{Element, NthIndexCache, SelectorList};
|
||||
use smallvec::SmallVec;
|
||||
use std::borrow::Borrow;
|
||||
use Atom;
|
||||
|
||||
/// <https://dom.spec.whatwg.org/#dom-element-matches>
|
||||
pub fn element_matches<E>(
|
||||
@ -338,7 +338,10 @@ fn local_name_matches<E>(element: E, local_name: &LocalName<E::Impl>) -> bool
|
||||
where
|
||||
E: TElement,
|
||||
{
|
||||
let LocalName { ref name, ref lower_name } = *local_name;
|
||||
let LocalName {
|
||||
ref name,
|
||||
ref lower_name,
|
||||
} = *local_name;
|
||||
if element.is_html_element_in_html_document() {
|
||||
element.local_name() == lower_name.borrow()
|
||||
} else {
|
||||
@ -543,23 +546,15 @@ where
|
||||
let case_sensitivity = quirks_mode.classes_and_ids_case_sensitivity();
|
||||
collect_all_elements::<E, Q, _>(root, results, |element| {
|
||||
element.has_class(class, case_sensitivity) &&
|
||||
matching::matches_selector_list(
|
||||
selector_list,
|
||||
&element,
|
||||
matching_context,
|
||||
)
|
||||
matching::matches_selector_list(selector_list, &element, matching_context)
|
||||
});
|
||||
}
|
||||
},
|
||||
SimpleFilter::LocalName(ref local_name) => {
|
||||
collect_all_elements::<E, Q, _>(root, results, |element| {
|
||||
local_name_matches(element, local_name) &&
|
||||
matching::matches_selector_list(
|
||||
selector_list,
|
||||
&element,
|
||||
matching_context,
|
||||
)
|
||||
matching::matches_selector_list(selector_list, &element, matching_context)
|
||||
});
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
@ -6,10 +6,10 @@
|
||||
//!
|
||||
//! [ff]: https://drafts.csswg.org/css-fonts/#at-font-face-rule
|
||||
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{CowRcStr, SourceLocation};
|
||||
#[cfg(feature = "gecko")]
|
||||
use cssparser::UnicodeRange;
|
||||
use cssparser::{AtRuleParser, DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{CowRcStr, SourceLocation};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::{Parse, ParserContext};
|
||||
#[cfg(feature = "gecko")]
|
||||
@ -18,17 +18,17 @@ use selectors::parser::SelectorParseErrorKind;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::values::SequenceWriter;
|
||||
use style_traits::{Comma, CssWriter, OneOrMoreSeparated, ParseError};
|
||||
use style_traits::{StyleParseErrorKind, ToCss};
|
||||
use style_traits::values::SequenceWriter;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::generics::font::FontStyle as GenericFontStyle;
|
||||
use values::specified::Angle;
|
||||
use values::specified::font::SpecifiedFontStyle;
|
||||
use values::specified::font::{AbsoluteFontWeight, FontStretch};
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
use values::specified::font::SpecifiedFontStyle;
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
use values::specified::Angle;
|
||||
|
||||
/// A source for a font-face rule.
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||
@ -55,7 +55,10 @@ impl OneOrMoreSeparated for Source {
|
||||
pub enum FontFaceSourceListComponent {
|
||||
Url(*const ::gecko_bindings::structs::mozilla::css::URLValue),
|
||||
Local(*mut ::gecko_bindings::structs::nsAtom),
|
||||
FormatHint { length: usize, utf8_bytes: *const u8 },
|
||||
FormatHint {
|
||||
length: usize,
|
||||
utf8_bytes: *const u8,
|
||||
},
|
||||
}
|
||||
|
||||
/// A `UrlSource` represents a font-face source that has been specified with a
|
||||
@ -133,7 +136,7 @@ macro_rules! impl_range {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/// The font-weight descriptor:
|
||||
@ -192,10 +195,7 @@ impl FontStretchRange {
|
||||
}
|
||||
}
|
||||
|
||||
let (min, max) = sort_range(
|
||||
compute_stretch(&self.0),
|
||||
compute_stretch(&self.1),
|
||||
);
|
||||
let (min, max) = sort_range(compute_stretch(&self.0), compute_stretch(&self.1));
|
||||
ComputedFontStretchRange(min, max)
|
||||
}
|
||||
}
|
||||
@ -277,7 +277,7 @@ impl FontStyle {
|
||||
SpecifiedFontStyle::compute_angle_degrees(second),
|
||||
);
|
||||
ComputedFontStyleDescriptor::Oblique(min, max)
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -340,7 +340,8 @@ impl<'a> FontFace<'a> {
|
||||
} else {
|
||||
true
|
||||
}
|
||||
}).cloned()
|
||||
})
|
||||
.cloned()
|
||||
.collect(),
|
||||
)
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use context::SharedStyleContext;
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use properties::style_structs::Font;
|
||||
use Atom;
|
||||
|
||||
/// Represents the font metrics that style needs from a font to compute the
|
||||
/// value of certain CSS units like `ex`.
|
||||
|
@ -32,16 +32,16 @@ use gecko_bindings::structs::RawServoStyleRule;
|
||||
use gecko_bindings::structs::RawServoStyleSheetContents;
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasFFI, Strong};
|
||||
use media_queries::MediaList;
|
||||
use properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
use properties::animated_properties::AnimationValue;
|
||||
use properties::{ComputedValues, PropertyDeclarationBlock};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use servo_arc::{Arc, ArcBorrow};
|
||||
use shared_lock::Locked;
|
||||
use std::{mem, ptr};
|
||||
use stylesheets::keyframes_rule::Keyframe;
|
||||
use stylesheets::{CounterStyleRule, CssRules, FontFaceRule, FontFeatureValuesRule};
|
||||
use stylesheets::{DocumentRule, ImportRule, KeyframesRule, MediaRule, NamespaceRule, PageRule};
|
||||
use stylesheets::{StyleRule, StylesheetContents, SupportsRule};
|
||||
use stylesheets::keyframes_rule::Keyframe;
|
||||
use values::computed::QuotePair;
|
||||
|
||||
macro_rules! impl_arc_ffi {
|
||||
|
@ -12,15 +12,17 @@ use app_units::Au;
|
||||
use gecko::values::GeckoStyleCoordConvertible;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::{self, nsStyleCoord_CalcValue};
|
||||
use gecko_bindings::structs::{nsresult, SheetType, nsStyleImage};
|
||||
use gecko_bindings::structs::{nsStyleImage, nsresult, SheetType};
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||
use std::f32::consts::PI;
|
||||
use stylesheets::{Origin, RulesMutateError};
|
||||
use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image};
|
||||
use values::computed::{Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto};
|
||||
use values::computed::{Percentage, TextAlign};
|
||||
use values::computed::image::LineDirection;
|
||||
use values::computed::url::ComputedImageUrl;
|
||||
use values::computed::{Angle, CalcLengthOrPercentage, Gradient, Image};
|
||||
use values::computed::{
|
||||
Integer, LengthOrPercentage, LengthOrPercentageOrAuto, NonNegativeLengthOrPercentageOrAuto,
|
||||
};
|
||||
use values::computed::{Percentage, TextAlign};
|
||||
use values::generics::box_::VerticalAlign;
|
||||
use values::generics::grid::{TrackListValue, TrackSize};
|
||||
use values::generics::image::{CompatMode, GradientItem, Image as GenericImage};
|
||||
@ -113,13 +115,15 @@ impl From<nsStyleCoord_CalcValue> for NonNegativeLengthOrPercentageOrAuto {
|
||||
use style_traits::values::specified::AllowedNumericType;
|
||||
use values::generics::NonNegative;
|
||||
NonNegative(if other.mLength < 0 || other.mPercent < 0. {
|
||||
LengthOrPercentageOrAuto::Calc(
|
||||
CalcLengthOrPercentage::with_clamping_mode(
|
||||
Au(other.mLength).into(),
|
||||
if other.mHasPercent { Some(Percentage(other.mPercent)) } else { None },
|
||||
AllowedNumericType::NonNegative,
|
||||
)
|
||||
)
|
||||
LengthOrPercentageOrAuto::Calc(CalcLengthOrPercentage::with_clamping_mode(
|
||||
Au(other.mLength).into(),
|
||||
if other.mHasPercent {
|
||||
Some(Percentage(other.mPercent))
|
||||
} else {
|
||||
None
|
||||
},
|
||||
AllowedNumericType::NonNegative,
|
||||
))
|
||||
} else {
|
||||
other.into()
|
||||
})
|
||||
@ -231,11 +235,11 @@ impl nsStyleImage {
|
||||
|
||||
// FIXME(emilio): This is really complex, we should use cbindgen for this.
|
||||
fn set_gradient(&mut self, gradient: Gradient) {
|
||||
use self::structs::nsStyleCoord;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_CORNER as CLOSEST_CORNER;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE;
|
||||
use self::structs::nsStyleCoord;
|
||||
use values::generics::image::{Circle, Ellipse, EndingShape, GradientKind, ShapeExtent};
|
||||
use values::specified::position::{X, Y};
|
||||
|
||||
@ -493,9 +497,9 @@ impl nsStyleImage {
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_CLOSEST_SIDE as CLOSEST_SIDE;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER as FARTHEST_CORNER;
|
||||
use self::structs::NS_STYLE_GRADIENT_SIZE_FARTHEST_SIDE as FARTHEST_SIDE;
|
||||
use values::computed::Length;
|
||||
use values::computed::image::LineDirection;
|
||||
use values::computed::position::Position;
|
||||
use values::computed::Length;
|
||||
use values::generics::image::{Circle, ColorStop, CompatMode, Ellipse};
|
||||
use values::generics::image::{EndingShape, GradientKind, ShapeExtent};
|
||||
|
||||
@ -625,7 +629,8 @@ impl nsStyleImage {
|
||||
position: LengthOrPercentage::from_gecko_style_coord(&stop.mLocation),
|
||||
})
|
||||
}
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
|
||||
let compat_mode = if gecko_gradient.mMozLegacySyntax {
|
||||
CompatMode::Moz
|
||||
@ -649,9 +654,9 @@ pub mod basic_shape {
|
||||
|
||||
use gecko::values::GeckoStyleCoordConvertible;
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
|
||||
use gecko_bindings::structs::{StyleBasicShape, StyleBasicShapeType};
|
||||
use gecko_bindings::structs::{StyleGeometryBox, StyleShapeSource, StyleShapeSourceType};
|
||||
use gecko_bindings::structs::{nsStyleCoord, nsStyleCorners};
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordDataMut, CoordDataValue};
|
||||
use gecko_bindings::sugar::refptr::RefPtr;
|
||||
use std::borrow::Borrow;
|
||||
@ -718,7 +723,8 @@ pub mod basic_shape {
|
||||
match other.mType {
|
||||
StyleShapeSourceType::URL => unsafe {
|
||||
let shape_image = &*other.__bindgen_anon_1.mShapeImage.as_ref().mPtr;
|
||||
let other_url = RefPtr::new(*shape_image.__bindgen_anon_1.mURLValue.as_ref() as *mut _);
|
||||
let other_url =
|
||||
RefPtr::new(*shape_image.__bindgen_anon_1.mURLValue.as_ref() as *mut _);
|
||||
let url = ComputedUrl::from_url_value(other_url);
|
||||
ShapeSource::ImageOrUrl(url)
|
||||
},
|
||||
|
@ -8,8 +8,9 @@ use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
|
||||
use context::QuirksMode;
|
||||
use dom::TElement;
|
||||
use gecko_bindings::bindings::{self, RawServoStyleSet};
|
||||
use gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes, StyleSheet as DomStyleSheet};
|
||||
use gecko_bindings::structs::{StyleSheetInfo, nsIDocument};
|
||||
use gecko_bindings::structs::StyleSheet as DomStyleSheet;
|
||||
use gecko_bindings::structs::{nsIDocument, StyleSheetInfo};
|
||||
use gecko_bindings::structs::{RawGeckoPresContextBorrowed, ServoStyleSetSizes};
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use invalidation::media_queries::{MediaListKey, ToMediaListKey};
|
||||
use malloc_size_of::MallocSizeOfOps;
|
||||
|
@ -5,8 +5,8 @@
|
||||
//! Global style data
|
||||
|
||||
use context::StyleSystemOptions;
|
||||
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
|
||||
use gecko_bindings::bindings::Gecko_SetJemallocThreadLocalArena;
|
||||
use gecko_bindings::bindings::{Gecko_RegisterProfilerThread, Gecko_UnregisterProfilerThread};
|
||||
use num_cpus;
|
||||
use parallel::STYLE_THREAD_STACK_SIZE_KB;
|
||||
use rayon;
|
||||
|
@ -4,17 +4,17 @@
|
||||
|
||||
//! Gecko's media feature list and evaluator.
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use euclid::Size2D;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs;
|
||||
use media_queries::Device;
|
||||
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
||||
use media_queries::media_feature::{MediaFeatureDescription, Evaluator};
|
||||
use media_queries::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use media_queries::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use media_queries::Device;
|
||||
use values::computed::CSSPixelLength;
|
||||
use values::computed::Resolution;
|
||||
use Atom;
|
||||
|
||||
fn viewport_size(device: &Device) -> Size2D<Au> {
|
||||
let pc = device.pres_context();
|
||||
@ -305,15 +305,15 @@ bitflags! {
|
||||
}
|
||||
|
||||
fn primary_pointer_capabilities(device: &Device) -> PointerCapabilities {
|
||||
PointerCapabilities::from_bits_truncate(
|
||||
unsafe { bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(device.document()) }
|
||||
)
|
||||
PointerCapabilities::from_bits_truncate(unsafe {
|
||||
bindings::Gecko_MediaFeatures_PrimaryPointerCapabilities(device.document())
|
||||
})
|
||||
}
|
||||
|
||||
fn all_pointer_capabilities(device: &Device) -> PointerCapabilities {
|
||||
PointerCapabilities::from_bits_truncate(
|
||||
unsafe { bindings::Gecko_MediaFeatures_AllPointerCapabilities(device.document()) }
|
||||
)
|
||||
PointerCapabilities::from_bits_truncate(unsafe {
|
||||
bindings::Gecko_MediaFeatures_AllPointerCapabilities(device.document())
|
||||
})
|
||||
}
|
||||
|
||||
#[derive(Clone, Copy, Debug, FromPrimitive, Parse, ToCss)]
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
//! Gecko's media-query device and expression representation.
|
||||
|
||||
use app_units::AU_PER_PX;
|
||||
use app_units::Au;
|
||||
use app_units::AU_PER_PX;
|
||||
use cssparser::RGBA;
|
||||
use custom_properties::CssEnvironment;
|
||||
use euclid::Size2D;
|
||||
@ -20,10 +20,10 @@ use servo_arc::Arc;
|
||||
use std::fmt;
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering};
|
||||
use string_cache::Atom;
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use values::{CustomIdent, KeyframesName};
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use values::computed::font::FontSize;
|
||||
use values::{CustomIdent, KeyframesName};
|
||||
|
||||
/// The `Device` in Gecko wraps a pres context, has a default values computed,
|
||||
/// and contains all the viewport rule state.
|
||||
|
@ -6,7 +6,6 @@
|
||||
* This file contains a helper macro includes all supported non-tree-structural
|
||||
* pseudo-classes.
|
||||
*
|
||||
|
||||
* FIXME: Find a way to autogenerate this file.
|
||||
*
|
||||
* Expected usage is as follows:
|
||||
|
@ -10,8 +10,8 @@
|
||||
|
||||
use cssparser::ToCss;
|
||||
use gecko_bindings::structs::{self, CSSPseudoElementType};
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use selector_parser::{NonTSPseudoClass, PseudoElementCascadeType, SelectorImpl};
|
||||
use std::fmt;
|
||||
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
|
||||
|
@ -12,10 +12,10 @@ use gecko_bindings::structs::RawServoSelectorList;
|
||||
use gecko_bindings::sugar::ownership::{HasBoxFFI, HasFFI, HasSimpleFFI};
|
||||
use invalidation::element::document_state::InvalidationMatchingData;
|
||||
use selector_parser::{Direction, SelectorParser};
|
||||
use selectors::SelectorList;
|
||||
use selectors::parser::{SelectorParseErrorKind, Visit};
|
||||
use selectors::parser::{self as selector_parser, Selector};
|
||||
use selectors::parser::{SelectorParseErrorKind, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use selectors::SelectorList;
|
||||
use std::fmt;
|
||||
use str::starts_with_ignore_ascii_case;
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
|
@ -5,7 +5,6 @@
|
||||
//! A gecko snapshot, that stores the element attributes and state before they
|
||||
//! change in order to properly calculate restyle hints.
|
||||
|
||||
use WeakAtom;
|
||||
use dom::TElement;
|
||||
use element_state::ElementState;
|
||||
use gecko::snapshot_helpers;
|
||||
@ -18,6 +17,7 @@ use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use string_cache::{Atom, Namespace};
|
||||
use WeakAtom;
|
||||
|
||||
/// A snapshot of a Gecko element.
|
||||
pub type GeckoElementSnapshot = ServoElementSnapshot;
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
//! Element an snapshot common logic.
|
||||
|
||||
use CaseSensitivityExt;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::{self, nsAtom};
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use string_cache::{Atom, WeakAtom};
|
||||
use CaseSensitivityExt;
|
||||
|
||||
/// A function that, given an element of type `T`, allows you to get a single
|
||||
/// class or a class list.
|
||||
|
@ -6,10 +6,10 @@
|
||||
|
||||
use cssparser::Parser;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::root::mozilla::CORSMode;
|
||||
use gecko_bindings::structs::root::mozilla::css::URLValue;
|
||||
use gecko_bindings::structs::root::mozilla::CORSMode;
|
||||
use gecko_bindings::structs::root::nsStyleImageRequest;
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, FFIArcHelpers};
|
||||
use gecko_bindings::sugar::ownership::{FFIArcHelpers, HasArcFFI};
|
||||
use gecko_bindings::sugar::refptr::RefPtr;
|
||||
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
|
||||
use nsstring::nsCString;
|
||||
@ -123,10 +123,7 @@ impl SpecifiedUrl {
|
||||
|
||||
fn from_css_url_with_cors(url: CssUrl, cors: CORSMode) -> Self {
|
||||
let url_value = unsafe {
|
||||
let ptr = bindings::Gecko_URLValue_Create(
|
||||
url.0.clone().into_strong(),
|
||||
cors,
|
||||
);
|
||||
let ptr = bindings::Gecko_URLValue_Create(url.0.clone().into_strong(), cors);
|
||||
// We do not expect Gecko_URLValue_Create returns null.
|
||||
debug_assert!(!ptr.is_null());
|
||||
RefPtr::from_addrefed(ptr)
|
||||
@ -261,11 +258,7 @@ impl ToCss for ComputedUrl {
|
||||
where
|
||||
W: Write,
|
||||
{
|
||||
serialize_computed_url(
|
||||
&self.0.url_value,
|
||||
dest,
|
||||
bindings::Gecko_GetComputedURLSpec,
|
||||
)
|
||||
serialize_computed_url(&self.0.url_value, dest, bindings::Gecko_GetComputedURLSpec)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,30 +6,31 @@
|
||||
|
||||
//! Different kind of helpers to interact with Gecko values.
|
||||
|
||||
use Atom;
|
||||
use app_units::Au;
|
||||
use counter_style::{Symbol, Symbols};
|
||||
use cssparser::RGBA;
|
||||
use gecko_bindings::structs::{self, CounterStylePtr, nsStyleCoord};
|
||||
use gecko_bindings::structs::{self, nsStyleCoord, CounterStylePtr};
|
||||
use gecko_bindings::structs::{StyleGridTrackBreadth, StyleShapeRadius};
|
||||
use gecko_bindings::sugar::ns_style_coord::{CoordData, CoordDataMut, CoordDataValue};
|
||||
use media_queries::Device;
|
||||
use nsstring::{nsACString, nsCStr};
|
||||
use std::cmp::max;
|
||||
use values::{Auto, Either, None_, Normal};
|
||||
use values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage, LengthOrPercentageOrAuto};
|
||||
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
|
||||
use values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength, Percentage};
|
||||
use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
||||
use values::computed::FlexBasis as ComputedFlexBasis;
|
||||
use values::computed::basic_shape::ShapeRadius as ComputedShapeRadius;
|
||||
use values::generics::{CounterStyleOrNone, NonNegative};
|
||||
use values::computed::FlexBasis as ComputedFlexBasis;
|
||||
use values::computed::{Angle, ExtremumLength, Length, LengthOrPercentage};
|
||||
use values::computed::{LengthOrPercentageOrAuto, Percentage};
|
||||
use values::computed::{LengthOrPercentageOrNone, Number, NumberOrPercentage};
|
||||
use values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength};
|
||||
use values::computed::{NonNegativeLength, NonNegativeLengthOrPercentage, NonNegativeNumber};
|
||||
use values::generics::basic_shape::ShapeRadius;
|
||||
use values::generics::box_::Perspective;
|
||||
use values::generics::flex::FlexBasis;
|
||||
use values::generics::gecko::ScrollSnapPoint;
|
||||
use values::generics::grid::{TrackBreadth, TrackKeyword};
|
||||
use values::generics::length::{MaxLength, MozLength};
|
||||
use values::generics::{CounterStyleOrNone, NonNegative};
|
||||
use values::{Auto, Either, None_, Normal};
|
||||
use Atom;
|
||||
|
||||
/// A trait that defines an interface to convert from and to `nsStyleCoord`s.
|
||||
pub trait GeckoStyleCoordConvertible: Sized {
|
||||
@ -537,7 +538,8 @@ impl CounterStyleOrNone {
|
||||
.map(|symbol| match *symbol {
|
||||
Symbol::String(ref s) => nsCStr::from(s),
|
||||
Symbol::Ident(_) => unreachable!("Should not have identifier in symbols()"),
|
||||
}).collect();
|
||||
})
|
||||
.collect();
|
||||
let symbols: Vec<_> = symbols
|
||||
.iter()
|
||||
.map(|symbol| symbol as &nsACString as *const _)
|
||||
@ -557,8 +559,8 @@ impl CounterStyleOrNone {
|
||||
/// Convert Gecko CounterStylePtr to CounterStyleOrNone or String.
|
||||
pub fn from_gecko_value(gecko_value: &CounterStylePtr) -> Either<Self, String> {
|
||||
use gecko_bindings::bindings;
|
||||
use values::CustomIdent;
|
||||
use values::generics::SymbolsType;
|
||||
use values::CustomIdent;
|
||||
|
||||
let name = unsafe { bindings::Gecko_CounterStyle_GetName(gecko_value) };
|
||||
if !name.is_null() {
|
||||
|
@ -14,7 +14,6 @@
|
||||
//! style system it's kind of pointless in the Stylo case, and only Servo forces
|
||||
//! the separation between the style system implementation and everything else.
|
||||
|
||||
use CaseSensitivityExt;
|
||||
use app_units::Au;
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
@ -29,9 +28,6 @@ use gecko::global_style_data::GLOBAL_STYLE_DATA;
|
||||
use gecko::selector_parser::{NonTSPseudoClass, PseudoElement, SelectorImpl};
|
||||
use gecko::snapshot_helpers;
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
|
||||
use gecko_bindings::bindings::{Gecko_GetLastChild, Gecko_GetPreviousSibling, Gecko_GetNextStyleChild};
|
||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||
use gecko_bindings::bindings::Gecko_ElementHasAnimations;
|
||||
use gecko_bindings::bindings::Gecko_ElementHasCSSAnimations;
|
||||
use gecko_bindings::bindings::Gecko_ElementHasCSSTransitions;
|
||||
@ -47,35 +43,37 @@ use gecko_bindings::bindings::Gecko_IsSignificantChild;
|
||||
use gecko_bindings::bindings::Gecko_MatchLang;
|
||||
use gecko_bindings::bindings::Gecko_UnsetDirtyStyleAttr;
|
||||
use gecko_bindings::bindings::Gecko_UpdateAnimations;
|
||||
use gecko_bindings::bindings::{Gecko_ElementState, Gecko_GetDocumentLWTheme};
|
||||
use gecko_bindings::bindings::{Gecko_SetNodeFlags, Gecko_UnsetNodeFlags};
|
||||
use gecko_bindings::structs;
|
||||
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
|
||||
use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
|
||||
use gecko_bindings::structs::nsChangeHint;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
||||
use gecko_bindings::structs::ELEMENT_HANDLED_SNAPSHOT;
|
||||
use gecko_bindings::structs::ELEMENT_HAS_ANIMATION_ONLY_DIRTY_DESCENDANTS_FOR_SERVO;
|
||||
use gecko_bindings::structs::ELEMENT_HAS_DIRTY_DESCENDANTS_FOR_SERVO;
|
||||
use gecko_bindings::structs::ELEMENT_HAS_SNAPSHOT;
|
||||
use gecko_bindings::structs::EffectCompositor_CascadeLevel as CascadeLevel;
|
||||
use gecko_bindings::structs::NODE_DESCENDANTS_NEED_FRAMES;
|
||||
use gecko_bindings::structs::NODE_NEEDS_FRAME;
|
||||
use gecko_bindings::structs::nsChangeHint;
|
||||
use gecko_bindings::structs::nsIDocument_DocumentTheme as DocumentTheme;
|
||||
use gecko_bindings::structs::nsRestyleHint;
|
||||
use gecko_bindings::structs::{nsAtom, nsIContent, nsINode_BooleanFlag};
|
||||
use gecko_bindings::structs::{RawGeckoElement, RawGeckoNode, RawGeckoXBLBinding};
|
||||
use gecko_bindings::sugar::ownership::{HasArcFFI, HasSimpleFFI};
|
||||
use hash::FxHashMap;
|
||||
use logical_geometry::WritingMode;
|
||||
use media_queries::Device;
|
||||
use properties::{ComputedValues, LonghandId};
|
||||
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use properties::animated_properties::{AnimationValue, AnimationValueMap};
|
||||
use properties::style_structs::Font;
|
||||
use properties::{ComputedValues, LonghandId};
|
||||
use properties::{Importance, PropertyDeclaration, PropertyDeclarationBlock};
|
||||
use rule_tree::CascadeLevel as ServoCascadeLevel;
|
||||
use selector_parser::{AttrValue, HorizontalDirection, Lang};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use selectors::attr::{AttrSelectorOperation, AttrSelectorOperator};
|
||||
use selectors::attr::{CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::matching::VisitedHandlingMode;
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::sink::Push;
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use servo_arc::{Arc, ArcBorrow, RawOffsetArc};
|
||||
use shared_lock::Locked;
|
||||
use std::cell::RefCell;
|
||||
@ -85,6 +83,7 @@ use std::mem;
|
||||
use std::ptr;
|
||||
use string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||
use stylist::CascadeData;
|
||||
use CaseSensitivityExt;
|
||||
|
||||
#[inline]
|
||||
fn elements_with_id<'a, 'le>(
|
||||
@ -382,12 +381,12 @@ impl<'ln> TNode for GeckoNode<'ln> {
|
||||
|
||||
#[inline]
|
||||
fn last_child(&self) -> Option<Self> {
|
||||
unsafe { Gecko_GetLastChild(self.0).map(GeckoNode) }
|
||||
unsafe { bindings::Gecko_GetLastChild(self.0).map(GeckoNode) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn prev_sibling(&self) -> Option<Self> {
|
||||
unsafe { Gecko_GetPreviousSibling(self.0).map(GeckoNode) }
|
||||
unsafe { bindings::Gecko_GetPreviousSibling(self.0).map(GeckoNode) }
|
||||
}
|
||||
|
||||
#[inline]
|
||||
@ -504,7 +503,7 @@ impl<'a> Iterator for GeckoChildrenIterator<'a> {
|
||||
// however we can't express this easily with bindgen, and it would
|
||||
// introduce functions with two input lifetimes into bindgen,
|
||||
// which would be out of scope for elision.
|
||||
Gecko_GetNextStyleChild(&mut *(it as *mut _)).map(GeckoNode)
|
||||
bindings::Gecko_GetNextStyleChild(&mut *(it as *mut _)).map(GeckoNode)
|
||||
},
|
||||
}
|
||||
}
|
||||
@ -937,7 +936,8 @@ impl<'le> GeckoElement<'le> {
|
||||
.animate(
|
||||
to.as_ref().unwrap(),
|
||||
Procedure::Interpolate { progress: 0.5 },
|
||||
).is_ok()
|
||||
)
|
||||
.is_ok()
|
||||
}
|
||||
}
|
||||
|
||||
@ -1278,7 +1278,8 @@ impl<'le> TElement for GeckoElement<'le> {
|
||||
Some(
|
||||
Locked::<PropertyDeclarationBlock>::as_arc(
|
||||
&*(&raw as *const &structs::RawServoDeclarationBlock),
|
||||
).borrow_arc(),
|
||||
)
|
||||
.borrow_arc(),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -7,9 +7,9 @@
|
||||
use gecko_bindings::bindings::Gecko_AddRefCSSShadowArrayArbitraryThread;
|
||||
use gecko_bindings::bindings::Gecko_NewCSSShadowArray;
|
||||
use gecko_bindings::bindings::Gecko_ReleaseCSSShadowArrayArbitraryThread;
|
||||
use gecko_bindings::structs::{RefPtr, nsCSSShadowArray, nsCSSShadowItem};
|
||||
use std::{ptr, slice};
|
||||
use gecko_bindings::structs::{nsCSSShadowArray, nsCSSShadowItem, RefPtr};
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::{ptr, slice};
|
||||
|
||||
impl RefPtr<nsCSSShadowArray> {
|
||||
/// Replaces the current `nsCSSShadowArray` with a new one of len `len`.
|
||||
|
@ -234,9 +234,13 @@ impl nsCSSValue {
|
||||
}
|
||||
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_List);
|
||||
let list: &mut structs::nsCSSValueList = &mut unsafe {
|
||||
self.mValue.mList.as_ref() // &*nsCSSValueList_heap
|
||||
.as_mut().expect("List pointer should be non-null")
|
||||
}._base;
|
||||
self.mValue
|
||||
.mList
|
||||
.as_ref() // &*nsCSSValueList_heap
|
||||
.as_mut()
|
||||
.expect("List pointer should be non-null")
|
||||
}
|
||||
._base;
|
||||
for (item, new_value) in list.into_iter().zip(values) {
|
||||
*item = new_value;
|
||||
}
|
||||
@ -255,9 +259,13 @@ impl nsCSSValue {
|
||||
}
|
||||
debug_assert_eq!(self.mUnit, nsCSSUnit::eCSSUnit_PairList);
|
||||
let mut item_ptr = &mut unsafe {
|
||||
self.mValue.mPairList.as_ref() // &*nsCSSValuePairList_heap
|
||||
.as_mut().expect("List pointer should be non-null")
|
||||
}._base as *mut structs::nsCSSValuePairList;
|
||||
self.mValue
|
||||
.mPairList
|
||||
.as_ref() // &*nsCSSValuePairList_heap
|
||||
.as_mut()
|
||||
.expect("List pointer should be non-null")
|
||||
}
|
||||
._base as *mut structs::nsCSSValuePairList;
|
||||
while let Some(item) = unsafe { item_ptr.as_mut() } {
|
||||
let value = values.next().expect("Values shouldn't have been exhausted");
|
||||
item.mXValue = value.0;
|
||||
|
@ -6,8 +6,8 @@
|
||||
|
||||
use gecko_bindings::bindings::Gecko_EnsureStyleAnimationArrayLength;
|
||||
use gecko_bindings::bindings::Gecko_EnsureStyleTransitionArrayLength;
|
||||
use gecko_bindings::structs::{StyleAnimation, StyleTransition};
|
||||
use gecko_bindings::structs::nsStyleAutoArray;
|
||||
use gecko_bindings::structs::{StyleAnimation, StyleTransition};
|
||||
use std::iter::{once, Chain, IntoIterator, Once};
|
||||
use std::ops::{Index, IndexMut};
|
||||
use std::slice::{Iter, IterMut};
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
use gecko_bindings::bindings;
|
||||
use gecko_bindings::structs::{nsStyleCoord, nsStyleCoord_Calc, nsStyleCoord_CalcValue};
|
||||
use gecko_bindings::structs::{nscoord, nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit};
|
||||
use gecko_bindings::structs::{nsStyleCorners, nsStyleSides, nsStyleUnion, nsStyleUnit, nscoord};
|
||||
use std::mem;
|
||||
|
||||
impl nsStyleCoord {
|
||||
@ -277,8 +277,8 @@ pub unsafe trait CoordDataMut: CoordData {
|
||||
#[inline(always)]
|
||||
/// Sets the inner value.
|
||||
fn set_value(&mut self, value: CoordDataValue) {
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
use self::CoordDataValue::*;
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
self.reset();
|
||||
unsafe {
|
||||
let (unit, union) = self.values_mut();
|
||||
@ -364,8 +364,8 @@ pub unsafe trait CoordData {
|
||||
#[inline(always)]
|
||||
/// Get the appropriate value for this object.
|
||||
fn as_value(&self) -> CoordDataValue {
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
use self::CoordDataValue::*;
|
||||
use gecko_bindings::structs::nsStyleUnit::*;
|
||||
unsafe {
|
||||
match self.unit() {
|
||||
eStyleUnit_Null => Null,
|
||||
|
@ -117,7 +117,9 @@ impl<T> nsTArray<T> {
|
||||
I: ExactSizeIterator + Iterator<Item = T>,
|
||||
{
|
||||
debug_assert!(iter.len() <= 0xFFFFFFFF);
|
||||
unsafe { self.set_len_pod(iter.len() as u32); }
|
||||
unsafe {
|
||||
self.set_len_pod(iter.len() as u32);
|
||||
}
|
||||
self.iter_mut().zip(iter).for_each(|(r, v)| *r = v);
|
||||
}
|
||||
}
|
||||
|
@ -4,13 +4,13 @@
|
||||
|
||||
//! A rust helper to ease the use of Gecko's refcounted types.
|
||||
|
||||
use Atom;
|
||||
use gecko_bindings::{structs, bindings};
|
||||
use gecko_bindings::sugar::ownership::HasArcFFI;
|
||||
use gecko_bindings::{bindings, structs};
|
||||
use servo_arc::Arc;
|
||||
use std::{fmt, mem, ptr};
|
||||
use std::marker::PhantomData;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::{fmt, mem, ptr};
|
||||
use Atom;
|
||||
|
||||
/// Trait for all objects that have Addref() and Release
|
||||
/// methods and can be placed inside RefPtr<T>
|
||||
@ -217,7 +217,9 @@ impl<T> structs::RefPtr<T> {
|
||||
where
|
||||
U: HasArcFFI<FFIType = T>,
|
||||
{
|
||||
unsafe { U::release_opt(self.mRawPtr.as_ref()); }
|
||||
unsafe {
|
||||
U::release_opt(self.mRawPtr.as_ref());
|
||||
}
|
||||
self.set_arc_leaky(other);
|
||||
}
|
||||
|
||||
|
@ -7,10 +7,10 @@
|
||||
use gecko::values::{convert_nscolor_to_rgba, convert_rgba_to_nscolor};
|
||||
use gecko_bindings::structs::StyleComplexColor;
|
||||
use gecko_bindings::structs::StyleComplexColor_Tag as Tag;
|
||||
use values::{Auto, Either};
|
||||
use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA};
|
||||
use values::computed::ui::ColorOrAuto;
|
||||
use values::computed::{Color as ComputedColor, RGBAColor as ComputedRGBA};
|
||||
use values::generics::color::{Color as GenericColor, ComplexColorRatios};
|
||||
use values::{Auto, Either};
|
||||
|
||||
impl StyleComplexColor {
|
||||
/// Create a `StyleComplexColor` value that represents `currentColor`.
|
||||
|
@ -17,13 +17,13 @@ use gecko_bindings::bindings::Gecko_ReleaseAtom;
|
||||
use gecko_bindings::structs::{nsAtom, nsAtom_AtomKind, nsDynamicAtom, nsStaticAtom};
|
||||
use nsstring::{nsAString, nsStr};
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use std::{mem, slice, str};
|
||||
use std::borrow::{Borrow, Cow};
|
||||
use std::char::{self, DecodeUtf16};
|
||||
use std::fmt::{self, Write};
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::iter::Cloned;
|
||||
use std::ops::Deref;
|
||||
use std::{mem, slice, str};
|
||||
use style_traits::SpecifiedValueInfo;
|
||||
|
||||
#[macro_use]
|
||||
|
@ -5,16 +5,16 @@
|
||||
//! A wrapper over an element and a snapshot, that allows us to selector-match
|
||||
//! against a past state of the element.
|
||||
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
|
||||
use dom::TElement;
|
||||
use element_state::ElementState;
|
||||
use selector_parser::{AttrValue, NonTSPseudoClass, PseudoElement, SelectorImpl};
|
||||
use selector_parser::{Snapshot, SnapshotMap};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext};
|
||||
use selectors::{Element, OpaqueElement};
|
||||
use std::cell::Cell;
|
||||
use std::fmt;
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// In order to compute restyle hints, we perform a selector match against a
|
||||
/// list of partial selectors whose rightmost simple selector may be sensitive
|
||||
|
@ -4,7 +4,6 @@
|
||||
|
||||
//! Code for invalidations due to state or attribute changes.
|
||||
|
||||
use {Atom, LocalName, Namespace};
|
||||
use context::QuirksMode;
|
||||
use element_state::{DocumentState, ElementState};
|
||||
use fallible::FallibleVec;
|
||||
@ -16,6 +15,7 @@ use selectors::parser::{Combinator, Component};
|
||||
use selectors::parser::{Selector, SelectorIter, Visit};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
use smallvec::SmallVec;
|
||||
use {Atom, LocalName, Namespace};
|
||||
|
||||
/// Mapping between (partial) CompoundSelectors (and the combinator to their
|
||||
/// right) and the states and attributes they depend on.
|
||||
|
@ -8,8 +8,8 @@
|
||||
use context::StackLimitChecker;
|
||||
use dom::{TElement, TNode, TShadowRoot};
|
||||
use selector_parser::SelectorImpl;
|
||||
use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext};
|
||||
use selectors::matching::matches_compound_selector_from;
|
||||
use selectors::matching::{CompoundSelectorMatchingResult, MatchingContext};
|
||||
use selectors::parser::{Combinator, Component, Selector};
|
||||
use smallvec::SmallVec;
|
||||
use std::fmt;
|
||||
|
@ -5,7 +5,6 @@
|
||||
//! An invalidation processor for style changes due to state and attribute
|
||||
//! changes.
|
||||
|
||||
use {Atom, WeakAtom};
|
||||
use context::SharedStyleContext;
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
@ -17,12 +16,13 @@ use invalidation::element::invalidator::{Invalidation, InvalidationProcessor};
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use selector_map::SelectorMap;
|
||||
use selector_parser::Snapshot;
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::attr::CaseSensitivity;
|
||||
use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::matching::matches_selector;
|
||||
use selectors::matching::{MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::NthIndexCache;
|
||||
use smallvec::SmallVec;
|
||||
use stylesheets::origin::{Origin, OriginSet};
|
||||
use {Atom, WeakAtom};
|
||||
|
||||
/// The collector implementation.
|
||||
struct Collector<'a, 'b: 'a, 'selectors: 'a, E>
|
||||
|
@ -7,9 +7,6 @@
|
||||
|
||||
#![deny(unsafe_code)]
|
||||
|
||||
use Atom;
|
||||
use CaseSensitivityExt;
|
||||
use LocalName as SelectorLocalName;
|
||||
use dom::{TDocument, TElement, TNode};
|
||||
use fxhash::FxHashSet;
|
||||
use invalidation::element::element_wrapper::{ElementSnapshot, ElementWrapper};
|
||||
@ -20,6 +17,9 @@ use selectors::attr::CaseSensitivity;
|
||||
use selectors::parser::{Component, LocalName, Selector};
|
||||
use shared_lock::SharedRwLockReadGuard;
|
||||
use stylesheets::{CssRule, StylesheetInDocument};
|
||||
use Atom;
|
||||
use CaseSensitivityExt;
|
||||
use LocalName as SelectorLocalName;
|
||||
|
||||
/// A style sheet invalidation represents a kind of element or subtree that may
|
||||
/// need to be restyled. Whether it represents a whole subtree or just a single
|
||||
|
@ -84,7 +84,8 @@ pub extern crate servo_arc;
|
||||
#[cfg(feature = "servo")]
|
||||
#[macro_use]
|
||||
extern crate servo_atoms;
|
||||
#[cfg(feature = "servo")] extern crate servo_channel;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate servo_channel;
|
||||
#[cfg(feature = "servo")]
|
||||
extern crate servo_config;
|
||||
#[cfg(feature = "servo")]
|
||||
@ -168,20 +169,20 @@ pub use gecko_string_cache as string_cache;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Atom;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Namespace;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Atom as Prefix;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Atom as LocalName;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko_string_cache::Namespace;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo_atoms::Atom;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::Prefix;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::LocalName;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::Namespace;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use html5ever::Prefix;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo_atoms::Atom;
|
||||
|
||||
/// The CSS properties supported by the style system.
|
||||
/// Generated from the properties.mako.rs template by build.rs
|
||||
|
@ -4,8 +4,8 @@
|
||||
|
||||
//! Geometry in flow-relative space.
|
||||
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use euclid::num::Zero;
|
||||
use euclid::{Point2D, Rect, SideOffsets2D, Size2D};
|
||||
use properties::style_structs;
|
||||
use std::cmp::{max, min};
|
||||
use std::fmt::{self, Debug, Error, Formatter};
|
||||
|
@ -12,8 +12,8 @@ use context::{SharedStyleContext, StyleContext};
|
||||
use data::ElementData;
|
||||
use dom::TElement;
|
||||
use invalidation::element::restyle_hints::RestyleHint;
|
||||
use properties::ComputedValues;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::{CascadeLevel, StrongRuleNode};
|
||||
use selector_parser::{PseudoElement, RestyleDamage};
|
||||
use selectors::matching::ElementSelectorFlags;
|
||||
@ -224,7 +224,8 @@ trait PrivateMatchMethods: TElement {
|
||||
context,
|
||||
RuleInclusion::All,
|
||||
PseudoElementResolution::IfApplicable,
|
||||
).cascade_style_and_visited_with_default_parents(inputs);
|
||||
)
|
||||
.cascade_style_and_visited_with_default_parents(inputs);
|
||||
|
||||
Some(style.0)
|
||||
}
|
||||
@ -618,14 +619,12 @@ trait PrivateMatchMethods: TElement {
|
||||
|
||||
match *running_animation {
|
||||
Animation::Transition(..) => unreachable!(),
|
||||
Animation::Keyframes(_, _, _, ref mut state) => {
|
||||
match update {
|
||||
AnimationUpdate::Regular => {},
|
||||
AnimationUpdate::AnimationCanceled => {
|
||||
state.expired = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Animation::Keyframes(_, _, _, ref mut state) => match update {
|
||||
AnimationUpdate::Regular => {},
|
||||
AnimationUpdate::AnimationCanceled => {
|
||||
state.expired = true;
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,12 +6,12 @@
|
||||
//!
|
||||
//! https://drafts.csswg.org/mediaqueries-4/#typedef-media-condition
|
||||
|
||||
use super::{Device, MediaFeatureExpression};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, Token};
|
||||
use parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use super::{Device, MediaFeatureExpression};
|
||||
|
||||
/// A binary `and` or `or` operator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
//! Media features.
|
||||
|
||||
use Atom;
|
||||
use super::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use super::Device;
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
use std::fmt;
|
||||
use style_traits::ParseError;
|
||||
use super::Device;
|
||||
use super::media_feature_expression::{AspectRatio, RangeOrOperator};
|
||||
use values::computed::{CSSPixelLength, Resolution};
|
||||
use Atom;
|
||||
|
||||
/// A generic discriminant for an enum value.
|
||||
pub type KeywordDiscriminant = u8;
|
||||
|
@ -5,24 +5,24 @@
|
||||
//! Parsing for media feature expressions, like `(foo: bar)` or
|
||||
//! `(width >= 400px)`.
|
||||
|
||||
use Atom;
|
||||
use super::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use super::media_feature::{KeywordDiscriminant, ParsingRequirements};
|
||||
use super::Device;
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Parser, Token};
|
||||
#[cfg(feature = "gecko")]
|
||||
use gecko_bindings::structs;
|
||||
use num_traits::Zero;
|
||||
use parser::{Parse, ParserContext};
|
||||
use std::cmp::{PartialOrd, Ordering};
|
||||
use std::cmp::{Ordering, PartialOrd};
|
||||
use std::fmt::{self, Write};
|
||||
use str::{starts_with_ignore_ascii_case, string_as_ascii_lowercase};
|
||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::Origin;
|
||||
use super::Device;
|
||||
use super::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use super::media_feature::{ParsingRequirements, KeywordDiscriminant};
|
||||
use values::{serialize_atom_identifier, CSSFloat};
|
||||
use values::computed::{self, ToComputedValue};
|
||||
use values::specified::{Integer, Length, Number, Resolution};
|
||||
use values::{serialize_atom_identifier, CSSFloat};
|
||||
use Atom;
|
||||
|
||||
/// An aspect ratio, with a numerator and denominator.
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq)]
|
||||
|
@ -6,12 +6,12 @@
|
||||
//!
|
||||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query-list
|
||||
|
||||
use super::{Device, MediaQuery, Qualifier};
|
||||
use context::QuirksMode;
|
||||
use cssparser::{Delimiter, Parser};
|
||||
use cssparser::{ParserInput, Token};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::ParserContext;
|
||||
use super::{Device, MediaQuery, Qualifier};
|
||||
|
||||
/// A type that encapsulates a media query list.
|
||||
#[css(comma, derive_debug)]
|
||||
|
@ -6,14 +6,14 @@
|
||||
//!
|
||||
//! https://drafts.csswg.org/mediaqueries/#typedef-media-query
|
||||
|
||||
use Atom;
|
||||
use super::media_condition::MediaCondition;
|
||||
use cssparser::Parser;
|
||||
use parser::ParserContext;
|
||||
use std::fmt::{self, Write};
|
||||
use str::string_as_ascii_lowercase;
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use super::media_condition::MediaCondition;
|
||||
use values::CustomIdent;
|
||||
use Atom;
|
||||
|
||||
/// <https://drafts.csswg.org/mediaqueries/#mq-prefix>
|
||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
|
||||
@ -130,7 +130,8 @@ impl MediaQuery {
|
||||
let ident = input.expect_ident().map_err(|_| ())?;
|
||||
let media_type = MediaQueryType::parse(&ident)?;
|
||||
Ok((qualifier, Some(media_type)))
|
||||
}).unwrap_or_default();
|
||||
})
|
||||
.unwrap_or_default();
|
||||
|
||||
let condition = if explicit_media_type.is_none() {
|
||||
Some(MediaCondition::parse(context, input)?)
|
||||
|
@ -14,11 +14,11 @@ pub mod media_feature;
|
||||
pub mod media_feature_expression;
|
||||
|
||||
pub use self::media_condition::MediaCondition;
|
||||
pub use self::media_feature_expression::MediaFeatureExpression;
|
||||
pub use self::media_list::MediaList;
|
||||
pub use self::media_query::{MediaQuery, MediaQueryType, MediaType, Qualifier};
|
||||
pub use self::media_feature_expression::MediaFeatureExpression;
|
||||
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::media_queries::Device;
|
||||
#[cfg(feature = "gecko")]
|
||||
pub use gecko::media_queries::Device;
|
||||
#[cfg(feature = "servo")]
|
||||
pub use servo::media_queries::Device;
|
||||
|
@ -526,7 +526,8 @@ impl RuleTree {
|
||||
path,
|
||||
guards,
|
||||
&mut dummy,
|
||||
).expect("Should return a valid rule node")
|
||||
)
|
||||
.expect("Should return a valid rule node")
|
||||
}
|
||||
}
|
||||
|
||||
@ -730,9 +731,9 @@ unsafe impl Send for RuleTree {}
|
||||
#[cfg(feature = "gecko")]
|
||||
#[cfg(debug_assertions)]
|
||||
mod gecko_leak_checking {
|
||||
use super::RuleNode;
|
||||
use std::mem::size_of;
|
||||
use std::os::raw::{c_char, c_void};
|
||||
use super::RuleNode;
|
||||
|
||||
extern "C" {
|
||||
pub fn NS_LogCtor(aPtr: *const c_void, aTypeName: *const c_char, aSize: u32);
|
||||
|
@ -5,13 +5,12 @@
|
||||
//! A data structure to efficiently index structs containing selectors by local
|
||||
//! name, ids and hash.
|
||||
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
use applicable_declarations::ApplicableDeclarationList;
|
||||
use context::QuirksMode;
|
||||
use dom::TElement;
|
||||
use fallible::FallibleVec;
|
||||
use hash::{HashMap, HashSet};
|
||||
use hash::map as hash_map;
|
||||
use hash::{HashMap, HashSet};
|
||||
use hashglobe::FailedAllocationError;
|
||||
use precomputed_hash::PrecomputedHash;
|
||||
use rule_tree::{CascadeLevel, ShadowCascadeOrder};
|
||||
@ -21,6 +20,7 @@ use selectors::parser::{Combinator, Component, SelectorIter};
|
||||
use smallvec::SmallVec;
|
||||
use std::hash::{BuildHasherDefault, Hash, Hasher};
|
||||
use stylist::Rule;
|
||||
use {Atom, LocalName, Namespace, WeakAtom};
|
||||
|
||||
/// A hasher implementation that doesn't hash anything, because it expects its
|
||||
/// input to be a suitable u32 hash.
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#![deny(missing_docs)]
|
||||
|
||||
use Atom;
|
||||
use cssparser::{Parser as CssParser, ParserInput};
|
||||
use element_state::ElementState;
|
||||
use selectors::parser::SelectorList;
|
||||
@ -14,6 +13,7 @@ use std::fmt::{self, Debug, Write};
|
||||
use style_traits::{CssWriter, ParseError, ToCss};
|
||||
use stylesheets::{Namespaces, Origin, UrlExtraData};
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A convenient alias for the type that represents an attribute value used for
|
||||
/// selector parser implementation.
|
||||
|
@ -8,17 +8,17 @@ use app_units::Au;
|
||||
use cssparser::RGBA;
|
||||
use custom_properties::CssEnvironment;
|
||||
use euclid::{Size2D, TypedScale, TypedSize2D};
|
||||
use media_queries::MediaType;
|
||||
use media_queries::media_feature::{AllowsRanges, ParsingRequirements};
|
||||
use media_queries::media_feature::{MediaFeatureDescription, Evaluator};
|
||||
use media_queries::media_feature::{Evaluator, MediaFeatureDescription};
|
||||
use media_queries::media_feature_expression::RangeOrOperator;
|
||||
use media_queries::MediaType;
|
||||
use properties::ComputedValues;
|
||||
use std::sync::atomic::{AtomicBool, AtomicIsize, Ordering};
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use style_traits::viewport::ViewportConstraints;
|
||||
use values::KeyframesName;
|
||||
use values::computed::CSSPixelLength;
|
||||
use style_traits::{CSSPixel, DevicePixel};
|
||||
use values::computed::font::FontSize;
|
||||
use values::computed::CSSPixelLength;
|
||||
use values::KeyframesName;
|
||||
|
||||
/// A device is a structure that represents the current media a given document
|
||||
/// is displayed in.
|
||||
|
@ -195,7 +195,7 @@ fn compute_damage(old: &ComputedValues, new: &ComputedValues) -> ServoRestyleDam
|
||||
let mut damage = ServoRestyleDamage::empty();
|
||||
|
||||
// This should check every CSS property, as enumerated in the fields of
|
||||
// http://doc.servo.org/style/properties/struct.ComputedValues.html
|
||||
// https://doc.servo.org/style/properties/struct.ComputedValues.html
|
||||
|
||||
// This uses short-circuiting boolean OR for its side effects and ignores the result.
|
||||
let _ = restyle_damage_rebuild_and_reflow!(
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
//! Servo's selector parser.
|
||||
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
|
||||
use attr::{AttrIdentifier, AttrValue};
|
||||
use cssparser::{serialize_identifier, CowRcStr, Parser as CssParser, SourceLocation, ToCss};
|
||||
use dom::{OpaqueNode, TElement, TNode};
|
||||
@ -14,8 +13,8 @@ use element_state::{DocumentState, ElementState};
|
||||
use fxhash::FxHashMap;
|
||||
use invalidation::element::document_state::InvalidationMatchingData;
|
||||
use invalidation::element::element_wrapper::ElementSnapshot;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::{ComputedValues, PropertyFlags};
|
||||
use selector_parser::{AttrValue as SelectorAttrValue, PseudoElementCascadeType, SelectorParser};
|
||||
use selectors::attr::{AttrSelectorOperation, CaseSensitivity, NamespaceConstraint};
|
||||
use selectors::parser::{SelectorParseErrorKind, Visit};
|
||||
@ -24,6 +23,7 @@ use std::fmt;
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use style_traits::{ParseError, StyleParseErrorKind};
|
||||
use {Atom, CaseSensitivityExt, LocalName, Namespace, Prefix};
|
||||
|
||||
/// A pseudo-element, both public and private.
|
||||
///
|
||||
@ -348,8 +348,8 @@ impl NonTSPseudoClass {
|
||||
/// Gets a given state flag for this pseudo-class. This is used to do
|
||||
/// selector matching, and it's set from the DOM.
|
||||
pub fn state_flag(&self) -> ElementState {
|
||||
use element_state::ElementState;
|
||||
use self::NonTSPseudoClass::*;
|
||||
use element_state::ElementState;
|
||||
match *self {
|
||||
Active => ElementState::IN_ACTIVE_STATE,
|
||||
Focus => ElementState::IN_FOCUS_STATE,
|
||||
|
@ -64,7 +64,6 @@
|
||||
//! selectors are effectively stripped off, so that matching them all against
|
||||
//! elements makes sense.
|
||||
|
||||
use Atom;
|
||||
use applicable_declarations::ApplicableDeclarationBlock;
|
||||
use atomic_refcell::{AtomicRefCell, AtomicRefMut};
|
||||
use bloom::StyleBloom;
|
||||
@ -74,8 +73,8 @@ use matching::MatchMethods;
|
||||
use owning_ref::OwningHandle;
|
||||
use properties::ComputedValues;
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selectors::NthIndexCache;
|
||||
use selectors::matching::{ElementSelectorFlags, VisitedHandlingMode};
|
||||
use selectors::NthIndexCache;
|
||||
use servo_arc::Arc;
|
||||
use smallbitvec::SmallBitVec;
|
||||
use smallvec::SmallVec;
|
||||
@ -86,6 +85,7 @@ use std::ptr::NonNull;
|
||||
use style_resolver::{PrimaryStyle, ResolvedElementStyles};
|
||||
use stylist::Stylist;
|
||||
use uluru::{Entry, LRUCache};
|
||||
use Atom;
|
||||
|
||||
mod checks;
|
||||
|
||||
@ -120,9 +120,8 @@ unsafe impl Sync for OpaqueComputedValues {}
|
||||
|
||||
impl OpaqueComputedValues {
|
||||
fn from(cv: &ComputedValues) -> Self {
|
||||
let p = unsafe {
|
||||
NonNull::new_unchecked(cv as *const ComputedValues as *const () as *mut ())
|
||||
};
|
||||
let p =
|
||||
unsafe { NonNull::new_unchecked(cv as *const ComputedValues as *const () as *mut ()) };
|
||||
OpaqueComputedValues(p)
|
||||
}
|
||||
|
||||
@ -204,7 +203,8 @@ impl ValidationData {
|
||||
let values =
|
||||
OpaqueComputedValues::from(parent.borrow_data().unwrap().styles.primary());
|
||||
values
|
||||
}).clone()
|
||||
})
|
||||
.clone()
|
||||
}
|
||||
|
||||
/// Computes the revalidation results if needed, and returns it.
|
||||
|
@ -7,12 +7,12 @@
|
||||
|
||||
use app_units::Au;
|
||||
use dom::TElement;
|
||||
use properties::{self, ComputedValues, StyleBuilder};
|
||||
use properties::computed_value_flags::ComputedValueFlags;
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::longhands::float::computed_value::T as Float;
|
||||
use properties::longhands::overflow_x::computed_value::T as Overflow;
|
||||
use properties::longhands::position::computed_value::T as Position;
|
||||
use properties::{self, ComputedValues, StyleBuilder};
|
||||
|
||||
/// A struct that implements all the adjustment methods.
|
||||
///
|
||||
@ -713,12 +713,15 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
|
||||
if self.style.pseudo.is_some() {
|
||||
return;
|
||||
}
|
||||
let is_html_select_element =
|
||||
element.map_or(false, |e| e.is_html_element() && e.local_name() == &*local_name!("select"));
|
||||
let is_html_select_element = element.map_or(false, |e| {
|
||||
e.is_html_element() && e.local_name() == &*local_name!("select")
|
||||
});
|
||||
if !is_html_select_element {
|
||||
return;
|
||||
}
|
||||
self.style.mutate_inherited_text().set_line_height(LineHeight::normal());
|
||||
self.style
|
||||
.mutate_inherited_text()
|
||||
.set_line_height(LineHeight::normal());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,13 @@ use data::{EagerPseudoStyles, ElementStyles};
|
||||
use dom::TElement;
|
||||
use log::Level::Trace;
|
||||
use matching::MatchMethods;
|
||||
use properties::{AnimationRules, ComputedValues};
|
||||
use properties::longhands::display::computed_value::T as Display;
|
||||
use properties::{AnimationRules, ComputedValues};
|
||||
use rule_tree::StrongRuleNode;
|
||||
use selector_parser::{PseudoElement, SelectorImpl};
|
||||
use selectors::matching::{ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode};
|
||||
use selectors::matching::{
|
||||
ElementSelectorFlags, MatchingContext, MatchingMode, VisitedHandlingMode,
|
||||
};
|
||||
use servo_arc::Arc;
|
||||
use stylist::RuleInclusion;
|
||||
|
||||
|
@ -120,7 +120,8 @@ macro_rules! parse_quoted_or_unquoted_string {
|
||||
.parse_entirely(|input| {
|
||||
let string = input.expect_string()?;
|
||||
Ok($url_matching_function(string.as_ref().to_owned()))
|
||||
}).or_else(|_: ParseError| {
|
||||
})
|
||||
.or_else(|_: ParseError| {
|
||||
while let Ok(_) = input.next() {}
|
||||
Ok($url_matching_function(input.slice_from(start).to_string()))
|
||||
})
|
||||
|
@ -6,7 +6,6 @@
|
||||
//!
|
||||
//! [font-feature-values]: https://drafts.csswg.org/css-fonts-3/#at-font-feature-values-rule
|
||||
|
||||
use Atom;
|
||||
use cssparser::{AtRuleParser, AtRuleType, BasicParseErrorKind, CowRcStr};
|
||||
use cssparser::{DeclarationListParser, DeclarationParser, Parser};
|
||||
use cssparser::{QualifiedRuleParser, RuleListParser, SourceLocation, Token};
|
||||
@ -23,6 +22,7 @@ use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::CssRuleType;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::serialize_atom_identifier;
|
||||
use Atom;
|
||||
|
||||
/// A @font-feature-values block declaration.
|
||||
/// It is `<ident>: <integer>+`.
|
||||
|
@ -4,23 +4,23 @@
|
||||
|
||||
//! Keyframes: https://drafts.csswg.org/css-animations/#keyframes
|
||||
|
||||
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser};
|
||||
use cssparser::{parse_one_rule, DeclarationListParser, DeclarationParser, SourceLocation, Token};
|
||||
use cssparser::{AtRuleParser, CowRcStr, Parser, ParserInput, QualifiedRuleParser, RuleListParser};
|
||||
use error_reporting::ContextualParseError;
|
||||
use parser::ParserContext;
|
||||
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||
use properties::LonghandIdSet;
|
||||
use properties::{Importance, PropertyDeclaration};
|
||||
use properties::{LonghandId, PropertyDeclarationBlock, PropertyId};
|
||||
use properties::{PropertyDeclarationId, SourcePropertyDeclaration};
|
||||
use properties::LonghandIdSet;
|
||||
use properties::longhands::transition_timing_function::single_value::SpecifiedValue as SpecifiedTimingFunction;
|
||||
use servo_arc::Arc;
|
||||
use shared_lock::{DeepCloneParams, DeepCloneWithLock, SharedRwLock, SharedRwLockReadGuard};
|
||||
use shared_lock::{Locked, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use style_traits::{CssWriter, ParseError, ParsingMode, StyleParseErrorKind, ToCss};
|
||||
use stylesheets::{CssRuleType, StylesheetContents};
|
||||
use stylesheets::rule_parser::VendorPrefix;
|
||||
use stylesheets::{CssRuleType, StylesheetContents};
|
||||
use values::{serialize_percentage, KeyframesName};
|
||||
|
||||
/// A [`@keyframes`][keyframes] rule.
|
||||
@ -89,7 +89,8 @@ impl DeepCloneWithLock for KeyframesRule {
|
||||
Arc::new(
|
||||
lock.wrap(x.read_with(guard).deep_clone_with_lock(lock, guard, params)),
|
||||
)
|
||||
}).collect(),
|
||||
})
|
||||
.collect(),
|
||||
vendor_prefix: self.vendor_prefix.clone(),
|
||||
source_location: self.source_location.clone(),
|
||||
}
|
||||
@ -327,7 +328,8 @@ impl KeyframesStep {
|
||||
let (declaration, _) = guard
|
||||
.get(PropertyDeclarationId::Longhand(
|
||||
LonghandId::AnimationTimingFunction,
|
||||
)).unwrap();
|
||||
))
|
||||
.unwrap();
|
||||
match *declaration {
|
||||
PropertyDeclaration::AnimationTimingFunction(ref value) => {
|
||||
// Use the first value.
|
||||
@ -499,7 +501,8 @@ pub fn parse_keyframe_list(
|
||||
shared_lock: shared_lock,
|
||||
declarations: &mut declarations,
|
||||
},
|
||||
).filter_map(Result::ok)
|
||||
)
|
||||
.filter_map(Result::ok)
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -45,13 +45,13 @@ pub use self::media_rule::MediaRule;
|
||||
pub use self::namespace_rule::NamespaceRule;
|
||||
pub use self::origin::{Origin, OriginSet, OriginSetIterator, PerOrigin, PerOriginIter};
|
||||
pub use self::page_rule::PageRule;
|
||||
pub use self::rule_parser::{State, TopLevelRuleParser, InsertRuleContext};
|
||||
pub use self::rule_list::{CssRules, CssRulesHelpers};
|
||||
pub use self::rule_parser::{InsertRuleContext, State, TopLevelRuleParser};
|
||||
pub use self::rules_iterator::{AllRules, EffectiveRules};
|
||||
pub use self::rules_iterator::{NestedRuleIterationCondition, RulesIterator};
|
||||
pub use self::style_rule::StyleRule;
|
||||
pub use self::stylesheet::{DocumentStyleSheet, Namespaces, Stylesheet};
|
||||
pub use self::stylesheet::{StylesheetContents, StylesheetInDocument, UserAgentStylesheets};
|
||||
pub use self::style_rule::StyleRule;
|
||||
pub use self::supports_rule::SupportsRule;
|
||||
pub use self::viewport_rule::ViewportRule;
|
||||
|
||||
@ -88,7 +88,7 @@ impl UrlExtraData {
|
||||
#[cfg(feature = "gecko")]
|
||||
impl fmt::Debug for UrlExtraData {
|
||||
fn fmt(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
|
||||
use gecko_bindings::{structs, bindings};
|
||||
use gecko_bindings::{bindings, structs};
|
||||
|
||||
struct DebugURI(*mut structs::nsIURI);
|
||||
impl fmt::Debug for DebugURI {
|
||||
@ -109,7 +109,8 @@ impl fmt::Debug for UrlExtraData {
|
||||
.field(
|
||||
"referrer",
|
||||
&DebugURI(self.0.mReferrer.raw::<structs::nsIURI>()),
|
||||
).finish()
|
||||
)
|
||||
.finish()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4,11 +4,11 @@
|
||||
|
||||
//! The `@namespace` at-rule.
|
||||
|
||||
use {Namespace, Prefix};
|
||||
use cssparser::SourceLocation;
|
||||
use shared_lock::{SharedRwLockReadGuard, ToCssWithGuard};
|
||||
use std::fmt::{self, Write};
|
||||
use str::CssStringWriter;
|
||||
use {Namespace, Prefix};
|
||||
|
||||
/// A `@namespace` rule.
|
||||
#[derive(Clone, Debug, PartialEq)]
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user