mirror of
https://github.com/roytam1/UXP.git
synced 2026-05-26 13:58:49 +00:00
Issue #2112 - Part 10: Remove remaining Stylo/Servo includes and code
Some classes have been marked for removal/merging, macros used for forwarding/casting were moved to DeprecatedUtils.h.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
#include "mozilla/FloatingPoint.h" // For IsFinite
|
||||
#include "mozilla/LookAndFeel.h" // For LookAndFeel::GetInt
|
||||
#include "mozilla/KeyframeUtils.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/StyleAnimationValue.h"
|
||||
#include "Layers.h" // For Layer
|
||||
#include "nsComputedDOMStyle.h" // nsComputedDOMStyle::GetStyleContextForElement
|
||||
@@ -32,17 +31,7 @@ namespace mozilla {
|
||||
bool
|
||||
PropertyValuePair::operator==(const PropertyValuePair& aOther) const
|
||||
{
|
||||
if (mProperty != aOther.mProperty || mValue != aOther.mValue) {
|
||||
return false;
|
||||
}
|
||||
if (mServoDeclarationBlock == aOther.mServoDeclarationBlock) {
|
||||
return true;
|
||||
}
|
||||
if (!mServoDeclarationBlock || !aOther.mServoDeclarationBlock) {
|
||||
return false;
|
||||
}
|
||||
return Servo_DeclarationBlock_Equals(mServoDeclarationBlock,
|
||||
aOther.mServoDeclarationBlock);
|
||||
return mProperty == aOther.mProperty && mValue == aOther.mValue;
|
||||
}
|
||||
|
||||
namespace dom {
|
||||
@@ -933,13 +922,8 @@ KeyframeEffectReadOnly::GetKeyframes(JSContext*& aCx,
|
||||
: propertyValue.mProperty;
|
||||
|
||||
nsAutoString stringValue;
|
||||
if (propertyValue.mServoDeclarationBlock) {
|
||||
Servo_DeclarationBlock_SerializeOneValue(
|
||||
propertyValue.mServoDeclarationBlock, &stringValue);
|
||||
} else {
|
||||
propertyValue.mValue.AppendToString(
|
||||
propertyForSerializing, stringValue, nsCSSValue::eNormalized);
|
||||
}
|
||||
propertyValue.mValue.AppendToString(
|
||||
propertyForSerializing, stringValue, nsCSSValue::eNormalized);
|
||||
|
||||
JS::Rooted<JS::Value> value(aCx);
|
||||
if (!ToJSValue(aCx, stringValue, &value) ||
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include "mozilla/EffectCompositor.h"
|
||||
#include "mozilla/KeyframeEffectParams.h"
|
||||
#include "mozilla/LayerAnimationInfo.h" // LayerAnimations::kRecords
|
||||
#include "mozilla/ServoBindingTypes.h" // RawServoDeclarationBlock and
|
||||
// associated RefPtrTraits
|
||||
#include "mozilla/StyleAnimationValue.h"
|
||||
#include "mozilla/dom/AnimationEffectReadOnly.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
@@ -63,11 +61,6 @@ struct PropertyValuePair
|
||||
// (string).
|
||||
nsCSSValue mValue;
|
||||
|
||||
// The specified value when using the Servo backend. However, even when
|
||||
// using the Servo backend, we still fill in |mValue| in the case where we
|
||||
// fail to parse the value since we use it to store the original string.
|
||||
RefPtr<RawServoDeclarationBlock> mServoDeclarationBlock;
|
||||
|
||||
bool operator==(const PropertyValuePair&) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -474,10 +474,7 @@ IsNativeAnonymousImplementationOfPseudoElement(nsIContent* aContent)
|
||||
// Unlike regular nodes, native anonymous content (NAC) gets created during
|
||||
// frame construction, which happens after the main style traversal. This
|
||||
// means that we have to manually resolve style for those nodes shortly after
|
||||
// they're created, either by (a) invoking ResolvePseudoElementStyle (for PE
|
||||
// NAC), or (b) handing the subtree off to Servo for a mini-traversal (for
|
||||
// non-PE NAC). We have assertions in nsCSSFrameConstructor that we don't do
|
||||
// both.
|
||||
// they're created by invoking ResolvePseudoElementStyle (for PE NAC).
|
||||
//
|
||||
// Once that happens, the NAC has a frame. So if we have no frame here,
|
||||
// we're either not NAC, or in the process of doing (b). Either way, this
|
||||
|
||||
@@ -43,9 +43,7 @@ ShouldExposeChildWindow(nsString& aNameBeingResolved, nsPIDOMWindowOuter* aChild
|
||||
//
|
||||
// This is problematic because it allows possibly-malicious and unrelated
|
||||
// cross-origin subframes to pollute the global namespace of their parent in
|
||||
// unpredictable ways (see bug 860494). This is also problematic for browser
|
||||
// engines like Servo that want to run cross-origin script on different
|
||||
// threads.
|
||||
// unpredictable ways (see bug 860494).
|
||||
//
|
||||
// The naive solution here would be to filter out any cross-origin subframes
|
||||
// obtained when doing named lookup in global scope. But that is unlikely to
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
#include "nsIAtom.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/DeclarationBlockInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsReadableUtils.h"
|
||||
@@ -1984,8 +1983,6 @@ nsAttrValue::SizeOfExcludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
if (Type() == eCSSDeclaration && container->mValue.mCSSDeclaration) {
|
||||
// TODO: mCSSDeclaration might be owned by another object which
|
||||
// would make us count them twice, bug 677493.
|
||||
// Bug 1281964: For ServoDeclarationBlock if we do measure we'll
|
||||
// need a way to call the Servo heap_size_of function.
|
||||
//n += container->mCSSDeclaration->SizeOfIncludingThis(aMallocSizeOf);
|
||||
} else if (Type() == eAtomArray && container->mValue.mAtomArray) {
|
||||
// Don't measure each nsIAtom, they are measured separatly.
|
||||
|
||||
@@ -1152,7 +1152,6 @@ nsDOMStyleSheetSetList::EnsureFresh()
|
||||
for (size_t index = 0; index < count; index++) {
|
||||
StyleSheet* sheet = mDocument->SheetAt(index);
|
||||
NS_ASSERTION(sheet, "Null sheet in sheet list!");
|
||||
// XXXheycam ServoStyleSheets don't expose their title yet.
|
||||
sheet->AsGecko()->GetTitle(title);
|
||||
if (!title.IsEmpty() && !mNames.Contains(title) && !Add(title)) {
|
||||
return;
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/css/StyleRule.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
@@ -1440,11 +1439,6 @@ nsINode::UnoptimizableCCNode() const
|
||||
AsElement()->IsInNamespace(kNameSpaceID_XBL));
|
||||
}
|
||||
|
||||
void
|
||||
nsINode::ClearServoData() {
|
||||
MOZ_CRASH("Accessing servo node data in non-stylo build");
|
||||
}
|
||||
|
||||
/* static */
|
||||
bool
|
||||
nsINode::Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb)
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
#define nsINode_h___
|
||||
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/ServoTypes.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsCOMPtr.h" // for member, local
|
||||
#include "nsGkAtoms.h" // for nsGkAtoms::baseURIProperty
|
||||
@@ -2086,12 +2085,6 @@ public:
|
||||
#undef TOUCH_EVENT
|
||||
#undef EVENT
|
||||
|
||||
bool HasServoData() {
|
||||
MOZ_CRASH("Accessing servo node data in non-stylo build");
|
||||
}
|
||||
|
||||
void ClearServoData();
|
||||
|
||||
protected:
|
||||
static bool Traverse(nsINode *tmp, nsCycleCollectionTraversalCallback &cb);
|
||||
static void Unlink(nsINode *tmp);
|
||||
|
||||
@@ -41,21 +41,6 @@ public:
|
||||
|
||||
virtual nsresult GetNameSpaceURI(int32_t aNameSpaceID, nsAString& aURI);
|
||||
|
||||
// Returns the atom for the namespace URI associated with the given ID. The
|
||||
// ID must be within range and not be kNameSpaceID_None (i.e. zero);
|
||||
nsIAtom* NameSpaceURIAtom(int32_t aNameSpaceID) {
|
||||
MOZ_ASSERT(aNameSpaceID > 0);
|
||||
return NameSpaceURIAtomForServo(aNameSpaceID);
|
||||
}
|
||||
|
||||
// NB: This function should only be called by Servo code (and the above
|
||||
// accessor), which uses the empty atom to represent kNameSpaceID_None.
|
||||
nsIAtom* NameSpaceURIAtomForServo(int32_t aNameSpaceID) {
|
||||
MOZ_ASSERT(aNameSpaceID >= 0);
|
||||
MOZ_ASSERT((int64_t) aNameSpaceID < (int64_t) mURIArray.Length());
|
||||
return mURIArray.ElementAt(aNameSpaceID);
|
||||
}
|
||||
|
||||
int32_t GetNameSpaceID(const nsAString& aURI,
|
||||
bool aInChromeDoc);
|
||||
int32_t GetNameSpaceID(nsIAtom* aURI,
|
||||
|
||||
@@ -2672,9 +2672,6 @@ GetFontParentStyleContext(Element* aElement, nsIPresShell* aPresShell,
|
||||
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// XXXheycam ServoStyleSets do not support resolving style from a list of
|
||||
// rules yet.
|
||||
NS_ERROR("stylo: cannot resolve style for canvas from a ServoStyleSet yet");
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2716,9 +2713,6 @@ GetFontStyleContext(Element* aElement, const nsAString& aFont,
|
||||
{
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// XXXheycam ServoStyleSets do not support resolving style from a list of
|
||||
// rules yet.
|
||||
NS_ERROR("stylo: cannot resolve style for canvas from a ServoStyleSet yet");
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
@@ -2793,9 +2787,6 @@ ResolveStyleForFilter(const nsAString& aFilterString,
|
||||
{
|
||||
nsStyleSet* styleSet = aPresShell->StyleSet()->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// XXXheycam ServoStyleSets do not support resolving style from a list of
|
||||
// rules yet.
|
||||
NS_ERROR("stylo: cannot resolve style for canvas from a ServoStyleSet yet");
|
||||
aError.Throw(NS_ERROR_FAILURE);
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,6 @@
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
@@ -18,15 +18,13 @@ namespace mozilla {
|
||||
|
||||
class EventStates;
|
||||
class RestyleManager;
|
||||
class ServoRestyleManager;
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Class for sharing data and logic common to both RestyleManager and
|
||||
* ServoRestyleManager.
|
||||
* Class for sharing data and logic common to RestyleManager.
|
||||
*/
|
||||
class RestyleManagerBase
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@
|
||||
|
||||
namespace mozilla {
|
||||
class RestyleManager;
|
||||
class ServoRestyleManager;
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
@@ -27,11 +26,8 @@ class nsStyleChangeList;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#define SERVO_BIT 0x1
|
||||
|
||||
/**
|
||||
* Smart pointer class that can hold a pointer to either a RestyleManager
|
||||
* or a ServoRestyleManager.
|
||||
* Smart pointer class that can hold a pointer to a RestyleManager.
|
||||
*/
|
||||
class RestyleManagerHandle
|
||||
{
|
||||
@@ -67,7 +63,7 @@ public:
|
||||
|
||||
// Restyle manager interface. These inline methods are defined in
|
||||
// RestyleManagerHandleInlines.h and just forward to the underlying
|
||||
// RestyleManager or ServoRestyleManager. See corresponding comments in
|
||||
// RestyleManager. See corresponding comments in
|
||||
// RestyleManager.h for descriptions of these methods.
|
||||
|
||||
inline void Disconnect();
|
||||
@@ -113,10 +109,7 @@ public:
|
||||
inline void NotifyDestroyingFrame(nsIFrame* aFrame);
|
||||
|
||||
private:
|
||||
// Stores a pointer to an RestyleManager or a ServoRestyleManager. The least
|
||||
// significant bit is 0 for the former, 1 for the latter. This is
|
||||
// valid as the least significant bit will never be used for a pointer
|
||||
// value on platforms we care about.
|
||||
// Stores a pointer to an RestyleManager.
|
||||
uintptr_t mValue;
|
||||
};
|
||||
|
||||
@@ -132,10 +125,6 @@ public:
|
||||
{
|
||||
*this = aManager;
|
||||
}
|
||||
MOZ_IMPLICIT RestyleManagerHandle(ServoRestyleManager* aManager)
|
||||
{
|
||||
*this = aManager;
|
||||
}
|
||||
|
||||
RestyleManagerHandle& operator=(decltype(nullptr))
|
||||
{
|
||||
@@ -145,18 +134,10 @@ public:
|
||||
|
||||
RestyleManagerHandle& operator=(RestyleManager* aManager)
|
||||
{
|
||||
MOZ_ASSERT(!(reinterpret_cast<uintptr_t>(aManager) & SERVO_BIT),
|
||||
"least significant bit shouldn't be set; we use it for state");
|
||||
mPtr.mValue = reinterpret_cast<uintptr_t>(aManager);
|
||||
return *this;
|
||||
}
|
||||
|
||||
RestyleManagerHandle& operator=(ServoRestyleManager* aManager)
|
||||
{
|
||||
MOZ_CRASH("should not have a ServoRestyleManager object when MOZ_STYLO is "
|
||||
"disabled");
|
||||
}
|
||||
|
||||
// Make RestyleManagerHandle usable in boolean contexts.
|
||||
explicit operator bool() const { return !!mPtr.mValue; }
|
||||
bool operator!() const { return !mPtr.mValue; }
|
||||
@@ -169,8 +150,6 @@ private:
|
||||
Ptr mPtr;
|
||||
};
|
||||
|
||||
#undef SERVO_BIT
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_RestyleManagerHandle_h
|
||||
|
||||
@@ -1,146 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
#include "mozilla/dom/ChildIterator.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsStyleChangeList.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
ServoRestyleManager::ServoRestyleManager(nsPresContext* aPresContext)
|
||||
: RestyleManagerBase(aPresContext)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::PostRestyleEvent(Element* aElement,
|
||||
nsRestyleHint aRestyleHint,
|
||||
nsChangeHint aMinChangeHint)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::PostRestyleEventForLazyConstruction()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
|
||||
nsRestyleHint aRestyleHint)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
|
||||
nsRestyleHint aRestyleHint)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
MarkSelfAndDescendantsAsNotDirtyForServo(nsIContent* aContent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::RecreateStyleContexts(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
ServoStyleSet* aStyleSet,
|
||||
nsStyleChangeList& aChangeListToProcess)
|
||||
{
|
||||
}
|
||||
|
||||
static void
|
||||
MarkChildrenAsDirtyForServo(nsIContent* aContent)
|
||||
{
|
||||
}
|
||||
|
||||
/* static */ nsIFrame*
|
||||
ServoRestyleManager::FrameForPseudoElement(const nsIContent* aContent,
|
||||
nsIAtom* aPseudoTagOrNull)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
ServoRestyleManager::NoteRestyleHint(Element* aElement, nsRestyleHint aHint)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::ProcessPendingRestyles()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::RestyleForInsertOrChange(nsINode* aContainer,
|
||||
nsIContent* aChild)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::ContentInserted(nsINode* aContainer, nsIContent* aChild)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::RestyleForAppend(nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::ContentAppended(nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::ContentRemoved(nsINode* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aFollowingSibling)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::ContentStateChanged(nsIContent* aContent,
|
||||
EventStates aChangedBits)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::AttributeWillChange(Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aNewValue)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoRestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aOldValue)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoRestyleManager::ReparentStyleContext(nsIFrame* aFrame)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ServoElementSnapshot*
|
||||
ServoRestyleManager::SnapshotForElement(Element* aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
@@ -1,127 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoRestyleManager_h
|
||||
#define mozilla_ServoRestyleManager_h
|
||||
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/RestyleManagerBase.h"
|
||||
#include "mozilla/ServoElementSnapshot.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsHashKeys.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsISupportsImpl.h"
|
||||
#include "nsPresContext.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
class nsAttrValue;
|
||||
class nsIAtom;
|
||||
class nsIContent;
|
||||
class nsIFrame;
|
||||
class nsStyleChangeList;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* Restyle manager for a Servo-backed style system.
|
||||
*/
|
||||
class ServoRestyleManager : public RestyleManagerBase
|
||||
{
|
||||
friend class ServoStyleSet;
|
||||
public:
|
||||
typedef RestyleManagerBase base_type;
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServoRestyleManager)
|
||||
|
||||
explicit ServoRestyleManager(nsPresContext* aPresContext);
|
||||
|
||||
void PostRestyleEvent(dom::Element* aElement,
|
||||
nsRestyleHint aRestyleHint,
|
||||
nsChangeHint aMinChangeHint);
|
||||
void PostRestyleEventForLazyConstruction();
|
||||
void RebuildAllStyleData(nsChangeHint aExtraHint,
|
||||
nsRestyleHint aRestyleHint);
|
||||
void PostRebuildAllStyleDataEvent(nsChangeHint aExtraHint,
|
||||
nsRestyleHint aRestyleHint);
|
||||
void ProcessPendingRestyles();
|
||||
|
||||
void ContentInserted(nsINode* aContainer, nsIContent* aChild);
|
||||
void ContentAppended(nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent);
|
||||
void ContentRemoved(nsINode* aContainer,
|
||||
nsIContent* aOldChild,
|
||||
nsIContent* aFollowingSibling);
|
||||
|
||||
void RestyleForInsertOrChange(nsINode* aContainer,
|
||||
nsIContent* aChild);
|
||||
void RestyleForAppend(nsIContent* aContainer,
|
||||
nsIContent* aFirstNewContent);
|
||||
void ContentStateChanged(nsIContent* aContent, EventStates aStateMask);
|
||||
void AttributeWillChange(dom::Element* aElement,
|
||||
int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute,
|
||||
int32_t aModType,
|
||||
const nsAttrValue* aNewValue);
|
||||
|
||||
void AttributeChanged(dom::Element* aElement, int32_t aNameSpaceID,
|
||||
nsIAtom* aAttribute, int32_t aModType,
|
||||
const nsAttrValue* aOldValue);
|
||||
|
||||
nsresult ReparentStyleContext(nsIFrame* aFrame);
|
||||
|
||||
bool HasPendingRestyles()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the appropriate frame given a content and a pseudo-element tag.
|
||||
*
|
||||
* Right now only supports a null tag, before or after. If the pseudo-element
|
||||
* is not null, the content needs to be an element.
|
||||
*/
|
||||
static nsIFrame* FrameForPseudoElement(const nsIContent* aContent,
|
||||
nsIAtom* aPseudoTagOrNull);
|
||||
|
||||
protected:
|
||||
~ServoRestyleManager() {}
|
||||
|
||||
private:
|
||||
ServoElementSnapshot* SnapshotForElement(Element* aElement);
|
||||
|
||||
/**
|
||||
* The element-to-element snapshot table to compute restyle hints.
|
||||
*/
|
||||
nsClassHashtable<nsRefPtrHashKey<Element>, ServoElementSnapshot>
|
||||
mModifiedElements;
|
||||
|
||||
/**
|
||||
* Traverses a tree of content that Servo has just restyled, recreating style
|
||||
* contexts for their frames with the new style data.
|
||||
*/
|
||||
void RecreateStyleContexts(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
ServoStyleSet* aStyleSet,
|
||||
nsStyleChangeList& aChangeList);
|
||||
|
||||
/**
|
||||
* Marks the tree with the appropriate dirty flags for the given restyle hint.
|
||||
*/
|
||||
static void NoteRestyleHint(Element* aElement, nsRestyleHint aRestyleHint);
|
||||
|
||||
inline ServoStyleSet* StyleSet() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoRestyleManager_h
|
||||
@@ -114,7 +114,6 @@ EXPORTS.mozilla += [
|
||||
'RestyleManagerBase.h',
|
||||
'RestyleManagerHandle.h',
|
||||
'RestyleManagerHandleInlines.h',
|
||||
'ServoRestyleManager.h',
|
||||
'StaticPresData.h',
|
||||
]
|
||||
|
||||
@@ -161,7 +160,6 @@ UNIFIED_SOURCES += [
|
||||
'RestyleManagerBase.cpp',
|
||||
'RestyleTracker.cpp',
|
||||
'ScrollStyles.cpp',
|
||||
'ServoRestyleManager.cpp',
|
||||
'StackArena.cpp',
|
||||
'StaticPresData.cpp',
|
||||
'TouchManager.cpp',
|
||||
|
||||
@@ -1884,9 +1884,6 @@ nsCSSFrameConstructor::CreateGeneratedContentItem(nsFrameConstructorState& aStat
|
||||
return;
|
||||
}
|
||||
|
||||
// stylo: ServoRestyleManager does not handle transitions yet, and when it
|
||||
// does it probably won't need to track reframed style contexts to start
|
||||
// transitions correctly.
|
||||
if (mozilla::RestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
|
||||
RestyleManager::ReframingStyleContexts* rsc =
|
||||
geckoRM->GetReframingStyleContexts();
|
||||
@@ -5060,9 +5057,6 @@ nsCSSFrameConstructor::ResolveStyleContext(nsStyleContext* aParentStyleContext,
|
||||
result = styleSet->ResolveStyleForText(aContent, aParentStyleContext);
|
||||
}
|
||||
|
||||
// ServoRestyleManager does not handle transitions yet, and when it does
|
||||
// it probably won't need to track reframed style contexts to start
|
||||
// transitions correctly.
|
||||
if (mozilla::RestyleManager* geckoRM = RestyleManager()->GetAsGecko()) {
|
||||
RestyleManager::ReframingStyleContexts* rsc =
|
||||
geckoRM->GetReframingStyleContexts();
|
||||
|
||||
@@ -56,7 +56,6 @@ public:
|
||||
|
||||
friend class mozilla::RestyleManager;
|
||||
friend class mozilla::RestyleManagerBase;
|
||||
friend class mozilla::ServoRestyleManager;
|
||||
|
||||
nsCSSFrameConstructor(nsIDocument* aDocument, nsIPresShell* aPresShell);
|
||||
~nsCSSFrameConstructor(void) {
|
||||
|
||||
@@ -2137,8 +2137,6 @@ nsPresContext::EnsureSafeToHandOutCSSRules()
|
||||
{
|
||||
nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// ServoStyleSets do not need to handle copy-on-write style sheet
|
||||
// innards like with CSSStyleSheets.
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2479,9 +2477,6 @@ nsPresContext::HasCachedStyleData()
|
||||
|
||||
nsStyleSet* styleSet = mShell->StyleSet()->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// XXXheycam ServoStyleSets do not use the rule tree, so just assume for now
|
||||
// that we need to restyle when e.g. dppx changes assuming we're sufficiently
|
||||
// bootstrapped.
|
||||
return mShell->DidInitialize();
|
||||
}
|
||||
|
||||
|
||||
@@ -1452,10 +1452,8 @@ PresShell::AddAgentSheet(nsISupports* aSheet)
|
||||
{
|
||||
// Make sure this does what nsDocumentViewer::CreateStyleSet does
|
||||
// wrt ordering.
|
||||
// XXXheycam This needs to work with ServoStyleSheets too.
|
||||
RefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
|
||||
if (!sheet) {
|
||||
NS_ERROR("stylo: AddAgentSheet needs to support ServoStyleSheets");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1466,10 +1464,8 @@ PresShell::AddAgentSheet(nsISupports* aSheet)
|
||||
void
|
||||
PresShell::AddAuthorSheet(nsISupports* aSheet)
|
||||
{
|
||||
// XXXheycam This needs to work with ServoStyleSheets too.
|
||||
RefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
|
||||
if (!sheet) {
|
||||
NS_ERROR("stylo: AddAuthorSheet needs to support ServoStyleSheets");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1491,7 +1487,6 @@ PresShell::RemoveSheet(SheetType aType, nsISupports* aSheet)
|
||||
{
|
||||
RefPtr<CSSStyleSheet> sheet = do_QueryObject(aSheet);
|
||||
if (!sheet) {
|
||||
NS_ERROR("stylo: RemoveSheet needs to support ServoStyleSheets");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -2831,8 +2826,7 @@ PresShell::DestroyFramesForAndRestyle(Element* aElement)
|
||||
: nsChangeHint_ReconstructFrame;
|
||||
|
||||
// NOTE(emilio): eRestyle_Subtree is needed to force also a full subtree
|
||||
// restyle for the content (in Stylo, where the existence of frames != the
|
||||
// existence of styles).
|
||||
// restyle for the content.
|
||||
mPresContext->RestyleManager()->PostRestyleEvent(
|
||||
aElement, eRestyle_Subtree, changeHint);
|
||||
|
||||
@@ -4176,11 +4170,6 @@ PresShell::DocumentStatesChanged(nsIDocument* aDocument,
|
||||
|
||||
nsStyleSet* styleSet = mStyleSet->GetAsGecko();
|
||||
if (!styleSet) {
|
||||
// XXXheycam ServoStyleSets don't support document state selectors,
|
||||
// but these are only used in chrome documents, which we are not
|
||||
// aiming to support yet.
|
||||
NS_WARNING("stylo: ServoStyleSets cannot respond to document state "
|
||||
"changes yet (only matters for chrome documents). See bug 1290285.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -10815,8 +10804,6 @@ PresShell::AddSizeOfIncludingThis(MallocSizeOf aMallocSizeOf,
|
||||
|
||||
if (nsStyleSet* styleSet = StyleSet()->GetAsGecko()) {
|
||||
*aStyleSetsSize += styleSet->SizeOfIncludingThis(aMallocSizeOf);
|
||||
} else {
|
||||
NS_WARNING("ServoStyleSets do not support memory measurements yet");
|
||||
}
|
||||
|
||||
*aTextRunsSize += SizeOfTextRuns(aMallocSizeOf);
|
||||
@@ -11024,7 +11011,6 @@ nsIPresShell::HasRuleProcessorUsedByMultipleStyleSets(uint32_t aSheetType,
|
||||
|
||||
*aRetVal = false;
|
||||
if (nsStyleSet* styleSet = mStyleSet->GetAsGecko()) {
|
||||
// ServoStyleSets do not have rule processors.
|
||||
*aRetVal = styleSet->HasRuleProcessorUsedByMultipleStyleSets(type);
|
||||
}
|
||||
return NS_OK;
|
||||
|
||||
@@ -120,7 +120,6 @@
|
||||
#include "MediaDecoder.h"
|
||||
#include "MediaManager.h"
|
||||
#include "MediaPrefs.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/StaticPresData.h"
|
||||
#include "mozilla/dom/WebIDLGlobalNameHash.h"
|
||||
|
||||
@@ -311,10 +310,6 @@ nsLayoutStatics::Initialize()
|
||||
|
||||
mozilla::dom::WebCryptoThreadPool::Initialize();
|
||||
|
||||
// NB: We initialize servo in nsAppRunner.cpp, because we need to do it after
|
||||
// creating the hidden DOM window to support some current stylo hacks. We
|
||||
// should move initialization back here once those go away.
|
||||
|
||||
MediaPrefs::GetSingleton();
|
||||
|
||||
return NS_OK;
|
||||
|
||||
@@ -407,8 +407,6 @@ void
|
||||
nsTextControlFrame::AppendAnonymousContentTo(nsTArray<nsIContent*>& aElements,
|
||||
uint32_t aFilter)
|
||||
{
|
||||
// This can be called off-main-thread during Servo traversal, so we take care
|
||||
// to avoid QI-ing the DOM node.
|
||||
nsITextControlElement* txtCtrl = nullptr;
|
||||
nsIContent* content = GetContent();
|
||||
if (content->IsHTMLElement(nsGkAtoms::input)) {
|
||||
|
||||
@@ -8972,8 +8972,6 @@ GetCorrectedParent(const nsIFrame* aFrame)
|
||||
// It would be nice to put it in CorrectStyleParentFrame and therefore share
|
||||
// it, but that would lose the information of whether the _child_ is NAC,
|
||||
// since CorrectStyleParentFrame only knows about the prospective _parent_.
|
||||
// This duplication and complexity will go away when we fully switch to the
|
||||
// Servo style system, where all this can be handled much more naturally.
|
||||
//
|
||||
// We need to take special care not to disrupt the style inheritance of frames
|
||||
// whose content is NAC but who implement a pseudo (like an anonymous
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "CSS.h"
|
||||
|
||||
#include "mozilla/dom/BindingDeclarations.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "nsCSSParser.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
|
||||
@@ -2028,7 +2028,6 @@ CounterStyleManager::BuildCounterStyle(const nsSubstring& aName)
|
||||
|
||||
// It is intentional that the predefined names are case-insensitive
|
||||
// but the user-defined names case-sensitive.
|
||||
// XXXheycam ServoStyleSets do not support custom counter styles yet.
|
||||
StyleSetHandle styleSet = mPresContext->StyleSet();
|
||||
nsCSSCounterStyleRule* rule =
|
||||
styleSet->AsGecko()->CounterStyleRuleForName(aName);
|
||||
@@ -2071,7 +2070,6 @@ CounterStyleManager::NotifyRuleChanged()
|
||||
RefPtr<CounterStyle>& style = iter.Data();
|
||||
bool toBeUpdated = false;
|
||||
bool toBeRemoved = false;
|
||||
// XXXheycam ServoStyleSets do not support custom counter styles yet.
|
||||
StyleSetHandle styleSet = mPresContext->StyleSet();
|
||||
nsCSSCounterStyleRule* newRule =
|
||||
styleSet->AsGecko()->CounterStyleRuleForName(iter.Key());
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef mozilla_DeclarationBlock_h
|
||||
#define mozilla_DeclarationBlock_h
|
||||
|
||||
#include "mozilla/ServoUtils.h"
|
||||
#include "mozilla/DeprecatedUtils.h"
|
||||
|
||||
#include "nsCSSPropertyID.h"
|
||||
|
||||
@@ -19,8 +19,6 @@ class nsHTMLCSSStyleSheet;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ServoDeclarationBlock;
|
||||
|
||||
namespace css {
|
||||
class Declaration;
|
||||
class Rule;
|
||||
@@ -36,7 +34,7 @@ protected:
|
||||
: DeclarationBlock() {}
|
||||
|
||||
public:
|
||||
MOZ_DECL_STYLO_METHODS(css::Declaration)
|
||||
MOZ_DECL_DEPRECATED_METHODS(css::Declaration)
|
||||
|
||||
inline MozExternalRefCountType AddRef();
|
||||
inline MozExternalRefCountType Release();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
MOZ_DEFINE_STYLO_METHODS(DeclarationBlock, css::Declaration)
|
||||
MOZ_DEFINE_DEPRECATED_METHODS(DeclarationBlock, css::Declaration)
|
||||
|
||||
MozExternalRefCountType
|
||||
DeclarationBlock::AddRef()
|
||||
|
||||
@@ -3,27 +3,26 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* some utilities for stylo */
|
||||
/* some deprecated utilities */
|
||||
|
||||
#ifndef mozilla_ServoUtils_h
|
||||
#define mozilla_ServoUtils_h
|
||||
#ifndef mozilla_DeprecatedUtils_h
|
||||
#define mozilla_DeprecatedUtils_h
|
||||
|
||||
#include "mozilla/TypeTraits.h"
|
||||
|
||||
/**
|
||||
* Macro used in a base class of |geckotype_| and |servotype_|.
|
||||
* The class should define |StyleBackendType mType;| itself.
|
||||
* Macro used in a base class of |geckotype_|.
|
||||
*/
|
||||
#define MOZ_DECL_STYLO_METHODS(geckotype_) \
|
||||
#define MOZ_DECL_DEPRECATED_METHODS(geckotype_) \
|
||||
inline geckotype_* AsGecko(); \
|
||||
inline const geckotype_* AsGecko() const;
|
||||
|
||||
/**
|
||||
* Macro used in inline header of class |type_| with its Gecko and Servo
|
||||
* subclasses named |geckotype_| and |servotype_| correspondingly for
|
||||
* implementing the inline methods defined by MOZ_DECL_STYLO_METHODS.
|
||||
* Macro used in inline header of class |type_| with its Gecko
|
||||
* subclass named |geckotype_| for implementing the inline methods
|
||||
* defined by MOZ_DECL_DEPRECATED_METHODS.
|
||||
*/
|
||||
#define MOZ_DEFINE_STYLO_METHODS(type_, geckotype_) \
|
||||
#define MOZ_DEFINE_DEPRECATED_METHODS(type_, geckotype_) \
|
||||
geckotype_* type_::AsGecko() { \
|
||||
return static_cast<geckotype_*>(this); \
|
||||
} \
|
||||
@@ -31,4 +30,4 @@
|
||||
return static_cast<const geckotype_*>(this); \
|
||||
}
|
||||
|
||||
#endif // mozilla_ServoUtils_h
|
||||
#endif // mozilla_DeprecatedUtils_h
|
||||
@@ -1,40 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "DocumentStyleRootIterator.h"
|
||||
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
DocumentStyleRootIterator::DocumentStyleRootIterator(nsIDocument* aDocument)
|
||||
: mPosition(0)
|
||||
{
|
||||
MOZ_COUNT_CTOR(DocumentStyleRootIterator);
|
||||
if (Element* root = aDocument->GetRootElement()) {
|
||||
mStyleRoots.AppendElement(root);
|
||||
}
|
||||
nsContentUtils::AppendDocumentLevelNativeAnonymousContentTo(
|
||||
aDocument, mStyleRoots);
|
||||
}
|
||||
|
||||
Element*
|
||||
DocumentStyleRootIterator::GetNextStyleRoot()
|
||||
{
|
||||
for (;;) {
|
||||
if (mPosition >= mStyleRoots.Length()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIContent* next = mStyleRoots[mPosition];
|
||||
++mPosition;
|
||||
|
||||
if (next->IsElement()) {
|
||||
return next->AsElement();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
@@ -1,37 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef DocumentStyleRootIterator_h
|
||||
#define DocumentStyleRootIterator_h
|
||||
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
class nsIContent;
|
||||
class nsIDocument;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* DocumentStyleRootIterator traverses the roots of the document from the
|
||||
* perspective of the Servo-backed style system. This will first traverse
|
||||
* the document root, followed by any document level native anonymous content.
|
||||
*/
|
||||
class DocumentStyleRootIterator
|
||||
{
|
||||
public:
|
||||
explicit DocumentStyleRootIterator(nsIDocument* aDocument);
|
||||
~DocumentStyleRootIterator() { MOZ_COUNT_DTOR(DocumentStyleRootIterator); }
|
||||
|
||||
Element* GetNextStyleRoot();
|
||||
|
||||
private:
|
||||
AutoTArray<nsIContent*, 8> mStyleRoots;
|
||||
uint32_t mPosition;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // DocumentStyleRootIterator_h
|
||||
@@ -1,145 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* a list of all Servo binding functions */
|
||||
|
||||
/* This file contains the list of all Servo binding functions. Each
|
||||
* entry is defined as a SERVO_BINDING_FUNC macro with the following
|
||||
* parameters:
|
||||
* - 'name_' the name of the binding function
|
||||
* - 'return_' the return type of the binding function
|
||||
* and the parameter list of the function.
|
||||
*
|
||||
* Users of this list should define a macro
|
||||
* SERVO_BINDING_FUNC(name_, return_, ...)
|
||||
* before including this file.
|
||||
*/
|
||||
|
||||
// Node data
|
||||
SERVO_BINDING_FUNC(Servo_Node_ClearNodeData, void, RawGeckoNodeBorrowed node)
|
||||
|
||||
// Styleset and Stylesheet management
|
||||
SERVO_BINDING_FUNC(Servo_StyleSheet_Empty, RawServoStyleSheetStrong,
|
||||
mozilla::css::SheetParsingMode parsing_mode)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSheet_FromUTF8Bytes, RawServoStyleSheetStrong,
|
||||
const nsACString* data,
|
||||
mozilla::css::SheetParsingMode parsing_mode,
|
||||
const nsACString* base_url,
|
||||
ThreadSafeURIHolder* base,
|
||||
ThreadSafeURIHolder* referrer,
|
||||
ThreadSafePrincipalHolder* principal)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSheet_AddRef, void,
|
||||
RawServoStyleSheetBorrowed sheet)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSheet_Release, void,
|
||||
RawServoStyleSheetBorrowed sheet)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSheet_HasRules, bool,
|
||||
RawServoStyleSheetBorrowed sheet)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_Init, RawServoStyleSetOwned)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_Drop, void, RawServoStyleSetOwned set)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_AppendStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_PrependStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_RemoveStyleSheet, void,
|
||||
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet)
|
||||
SERVO_BINDING_FUNC(Servo_StyleSet_InsertStyleSheetBefore, void,
|
||||
RawServoStyleSetBorrowed set, RawServoStyleSheetBorrowed sheet,
|
||||
RawServoStyleSheetBorrowed reference)
|
||||
|
||||
// Animations API
|
||||
SERVO_BINDING_FUNC(Servo_ParseProperty,
|
||||
RawServoDeclarationBlockStrong,
|
||||
const nsACString* property, const nsACString* value,
|
||||
const nsACString* base_url, ThreadSafeURIHolder* base,
|
||||
ThreadSafeURIHolder* referrer,
|
||||
ThreadSafePrincipalHolder* principal)
|
||||
SERVO_BINDING_FUNC(Servo_RestyleWithAddedDeclaration,
|
||||
ServoComputedValuesStrong,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
ServoComputedValuesBorrowed previous_style)
|
||||
|
||||
// Style attribute
|
||||
SERVO_BINDING_FUNC(Servo_ParseStyleAttribute, RawServoDeclarationBlockStrong,
|
||||
const nsACString* data)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_CreateEmpty,
|
||||
RawServoDeclarationBlockStrong)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Clone, RawServoDeclarationBlockStrong,
|
||||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_AddRef, void,
|
||||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Release, void,
|
||||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Equals, bool,
|
||||
RawServoDeclarationBlockBorrowed a,
|
||||
RawServoDeclarationBlockBorrowed b)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetCssText, void,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
nsAString* result)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SerializeOneValue, void,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
nsString* buffer)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_Count, uint32_t,
|
||||
RawServoDeclarationBlockBorrowed declarations)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetNthProperty, bool,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
uint32_t index, nsAString* result)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyValue, void,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
nsIAtom* property, bool is_custom, nsAString* value)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_GetPropertyIsImportant, bool,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
nsIAtom* property, bool is_custom)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_SetProperty, bool,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
nsIAtom* property, bool is_custom,
|
||||
nsACString* value, bool is_important)
|
||||
SERVO_BINDING_FUNC(Servo_DeclarationBlock_RemoveProperty, void,
|
||||
RawServoDeclarationBlockBorrowed declarations,
|
||||
nsIAtom* property, bool is_custom)
|
||||
|
||||
// CSS supports()
|
||||
SERVO_BINDING_FUNC(Servo_CSSSupports, bool,
|
||||
const nsACString* name, const nsACString* value)
|
||||
|
||||
// Computed style data
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_Get, ServoComputedValuesStrong,
|
||||
RawGeckoNodeBorrowed node)
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_GetForAnonymousBox,
|
||||
ServoComputedValuesStrong,
|
||||
ServoComputedValuesBorrowedOrNull parent_style_or_null,
|
||||
nsIAtom* pseudoTag, RawServoStyleSetBorrowed set)
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_GetForPseudoElement,
|
||||
ServoComputedValuesStrong,
|
||||
ServoComputedValuesBorrowed parent_style,
|
||||
RawGeckoElementBorrowed match_element, nsIAtom* pseudo_tag,
|
||||
RawServoStyleSetBorrowed set, bool is_probe)
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_Inherit, ServoComputedValuesStrong,
|
||||
ServoComputedValuesBorrowedOrNull parent_style)
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_AddRef, void,
|
||||
ServoComputedValuesBorrowed computed_values)
|
||||
SERVO_BINDING_FUNC(Servo_ComputedValues_Release, void,
|
||||
ServoComputedValuesBorrowed computed_values)
|
||||
|
||||
// Initialize Servo components. Should be called exactly once at startup.
|
||||
SERVO_BINDING_FUNC(Servo_Initialize, void)
|
||||
// Shut down Servo components. Should be called exactly once at shutdown.
|
||||
SERVO_BINDING_FUNC(Servo_Shutdown, void)
|
||||
|
||||
// Restyle hints
|
||||
SERVO_BINDING_FUNC(Servo_ComputeRestyleHint, nsRestyleHint,
|
||||
RawGeckoElementBorrowed element, ServoElementSnapshot* snapshot,
|
||||
RawServoStyleSetBorrowed set)
|
||||
|
||||
// Restyle the given subtree.
|
||||
SERVO_BINDING_FUNC(Servo_RestyleSubtree, void,
|
||||
RawGeckoNodeBorrowed node, RawServoStyleSetBorrowed set)
|
||||
|
||||
// Style-struct management.
|
||||
#define STYLE_STRUCT(name, checkdata_cb) \
|
||||
struct nsStyle##name; \
|
||||
SERVO_BINDING_FUNC(Servo_GetStyle##name, const nsStyle##name*, \
|
||||
ServoComputedValuesBorrowedOrNull computed_values)
|
||||
#include "nsStyleStructList.h"
|
||||
#undef STYLE_STRUCT
|
||||
@@ -1,143 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoBindingTypes_h
|
||||
#define mozilla_ServoBindingTypes_h
|
||||
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
|
||||
struct ServoComputedValues;
|
||||
struct RawServoStyleSheet;
|
||||
struct RawServoStyleSet;
|
||||
struct RawServoDeclarationBlock;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
class StyleChildrenIterator;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
class nsCSSValue;
|
||||
class nsIDocument;
|
||||
class nsINode;
|
||||
|
||||
using mozilla::dom::StyleChildrenIterator;
|
||||
|
||||
typedef nsINode RawGeckoNode;
|
||||
typedef mozilla::dom::Element RawGeckoElement;
|
||||
typedef nsIDocument RawGeckoDocument;
|
||||
|
||||
// We have these helper types so that we can directly generate
|
||||
// things like &T or Borrowed<T> on the Rust side in the function, providing
|
||||
// additional safety benefits.
|
||||
//
|
||||
// FFI has a problem with templated types, so we just use raw pointers here.
|
||||
//
|
||||
// The "Borrowed" types generate &T or Borrowed<T> in the nullable case.
|
||||
//
|
||||
// The "Owned" types generate Owned<T> or OwnedOrNull<T>. Some of these
|
||||
// are Servo-managed and can be converted to Box<ServoType> on the
|
||||
// Servo side.
|
||||
//
|
||||
// The "Arc" types are Servo-managed Arc<ServoType>s, which are passed
|
||||
// over FFI as Strong<T> (which is nullable).
|
||||
// Note that T != ServoType, rather T is ArcInner<ServoType>
|
||||
#define DECL_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##Borrowed;
|
||||
#define DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) typedef type_ const* type_##BorrowedOrNull;
|
||||
#define DECL_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMut;
|
||||
#define DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_) typedef type_* type_##BorrowedMutOrNull;
|
||||
|
||||
#define DECL_ARC_REF_TYPE_FOR(type_) \
|
||||
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) \
|
||||
DECL_BORROWED_REF_TYPE_FOR(type_) \
|
||||
struct MOZ_MUST_USE_TYPE type_##Strong \
|
||||
{ \
|
||||
type_* mPtr; \
|
||||
already_AddRefed<type_> Consume(); \
|
||||
};
|
||||
|
||||
#define DECL_OWNED_REF_TYPE_FOR(type_) \
|
||||
typedef type_* type_##Owned; \
|
||||
DECL_BORROWED_REF_TYPE_FOR(type_) \
|
||||
DECL_BORROWED_MUT_REF_TYPE_FOR(type_)
|
||||
|
||||
#define DECL_NULLABLE_OWNED_REF_TYPE_FOR(type_) \
|
||||
typedef type_* type_##OwnedOrNull; \
|
||||
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(type_) \
|
||||
DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR(type_)
|
||||
|
||||
DECL_ARC_REF_TYPE_FOR(ServoComputedValues)
|
||||
DECL_ARC_REF_TYPE_FOR(RawServoStyleSheet)
|
||||
DECL_ARC_REF_TYPE_FOR(RawServoDeclarationBlock)
|
||||
// This is a reference to a reference of RawServoDeclarationBlock, which
|
||||
// corresponds to Option<&Arc<RawServoDeclarationBlock>> in Servo side.
|
||||
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawServoDeclarationBlockStrong)
|
||||
|
||||
DECL_OWNED_REF_TYPE_FOR(RawServoStyleSet)
|
||||
DECL_NULLABLE_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
|
||||
DECL_OWNED_REF_TYPE_FOR(StyleChildrenIterator)
|
||||
|
||||
// We don't use BorrowedMut because the nodes may alias
|
||||
// Servo itself doesn't directly read or mutate these;
|
||||
// it only asks Gecko to do so. In case we wish to in
|
||||
// the future, we should ensure that things being mutated
|
||||
// are protected from noalias violations by a cell type
|
||||
DECL_BORROWED_REF_TYPE_FOR(RawGeckoNode)
|
||||
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoNode)
|
||||
DECL_BORROWED_REF_TYPE_FOR(RawGeckoElement)
|
||||
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoElement)
|
||||
DECL_BORROWED_REF_TYPE_FOR(RawGeckoDocument)
|
||||
DECL_NULLABLE_BORROWED_REF_TYPE_FOR(RawGeckoDocument)
|
||||
DECL_BORROWED_MUT_REF_TYPE_FOR(StyleChildrenIterator)
|
||||
DECL_BORROWED_REF_TYPE_FOR(nsCSSValue)
|
||||
DECL_BORROWED_MUT_REF_TYPE_FOR(nsCSSValue)
|
||||
|
||||
#undef DECL_ARC_REF_TYPE_FOR
|
||||
#undef DECL_OWNED_REF_TYPE_FOR
|
||||
#undef DECL_NULLABLE_OWNED_REF_TYPE_FOR
|
||||
#undef DECL_BORROWED_REF_TYPE_FOR
|
||||
#undef DECL_NULLABLE_BORROWED_REF_TYPE_FOR
|
||||
#undef DECL_BORROWED_MUT_REF_TYPE_FOR
|
||||
#undef DECL_NULLABLE_BORROWED_MUT_REF_TYPE_FOR
|
||||
|
||||
#define DEFINE_REFPTR_TRAITS(name_, type_) \
|
||||
extern "C" { \
|
||||
void Servo_##name_##_AddRef(type_##Borrowed ptr); \
|
||||
void Servo_##name_##_Release(type_##Borrowed ptr); \
|
||||
} \
|
||||
namespace mozilla { \
|
||||
template<> struct RefPtrTraits<type_> { \
|
||||
static void AddRef(type_* aPtr) { \
|
||||
Servo_##name_##_AddRef(aPtr); \
|
||||
} \
|
||||
static void Release(type_* aPtr) { \
|
||||
Servo_##name_##_Release(aPtr); \
|
||||
} \
|
||||
}; \
|
||||
}
|
||||
|
||||
DEFINE_REFPTR_TRAITS(StyleSheet, RawServoStyleSheet)
|
||||
DEFINE_REFPTR_TRAITS(ComputedValues, ServoComputedValues)
|
||||
DEFINE_REFPTR_TRAITS(DeclarationBlock, RawServoDeclarationBlock)
|
||||
|
||||
#undef DEFINE_REFPTR_TRAITS
|
||||
|
||||
extern "C" void Servo_StyleSet_Drop(RawServoStyleSetOwned ptr);
|
||||
|
||||
namespace mozilla {
|
||||
template<>
|
||||
class DefaultDelete<RawServoStyleSet>
|
||||
{
|
||||
public:
|
||||
void operator()(RawServoStyleSet* aPtr) const
|
||||
{
|
||||
Servo_StyleSet_Drop(aPtr);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif // mozilla_ServoBindingTypes_h
|
||||
@@ -1,693 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
#include "ChildIterator.h"
|
||||
#include "StyleStructContext.h"
|
||||
#include "gfxFontFamilyList.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsCSSRuleProcessor.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsDOMTokenList.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsINode.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsRuleNode.h"
|
||||
#include "nsString.h"
|
||||
#include "nsStyleStruct.h"
|
||||
#include "nsStyleUtil.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/ServoElementSnapshot.h"
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/StyleAnimationValue.h"
|
||||
#include "mozilla/DeclarationBlockInlines.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
#define IMPL_STRONG_REF_TYPE_FOR(type_) \
|
||||
already_AddRefed<type_> \
|
||||
type_##Strong::Consume() { \
|
||||
RefPtr<type_> result; \
|
||||
result.swap(mPtr); \
|
||||
return result.forget(); \
|
||||
}
|
||||
|
||||
IMPL_STRONG_REF_TYPE_FOR(ServoComputedValues)
|
||||
IMPL_STRONG_REF_TYPE_FOR(RawServoStyleSheet)
|
||||
IMPL_STRONG_REF_TYPE_FOR(RawServoDeclarationBlock)
|
||||
|
||||
#undef IMPL_STRONG_REF_TYPE_FOR
|
||||
|
||||
uint32_t
|
||||
Gecko_ChildrenCount(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_NodeIsElement(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
RawGeckoNodeBorrowedOrNull
|
||||
Gecko_GetParentNode(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoNodeBorrowedOrNull
|
||||
Gecko_GetFirstChild(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoNodeBorrowedOrNull
|
||||
Gecko_GetLastChild(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoNodeBorrowedOrNull
|
||||
Gecko_GetPrevSibling(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoNodeBorrowedOrNull
|
||||
Gecko_GetNextSibling(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoElementBorrowedOrNull
|
||||
Gecko_GetParentElement(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoElementBorrowedOrNull
|
||||
Gecko_GetFirstChildElement(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetLastChildElement(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoElementBorrowedOrNull
|
||||
Gecko_GetPrevSiblingElement(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoElementBorrowedOrNull
|
||||
Gecko_GetNextSiblingElement(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RawGeckoElementBorrowedOrNull
|
||||
Gecko_GetDocumentElement(RawGeckoDocumentBorrowed aDoc)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
StyleChildrenIteratorOwnedOrNull
|
||||
Gecko_MaybeCreateStyleChildrenIterator(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned aIterator)
|
||||
{
|
||||
}
|
||||
|
||||
RawGeckoNodeBorrowed
|
||||
Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut aIterator)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
EventStates::ServoType
|
||||
Gecko_ElementState(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_IsHTMLElementInHTMLDocument(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_IsLink(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_IsTextNode(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_IsVisitedLink(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_IsUnvisitedLink(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_IsRootElement(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
Gecko_LocalName(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
Gecko_Namespace(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIAtom*
|
||||
Gecko_GetElementId(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// Dirtiness tracking.
|
||||
uint32_t
|
||||
Gecko_GetNodeFlags(RawGeckoNodeBorrowed aNode)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetNodeFlags(RawGeckoNodeBorrowed aNode, uint32_t aFlags)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed aNode, uint32_t aFlags)
|
||||
{
|
||||
}
|
||||
|
||||
nsStyleContext*
|
||||
Gecko_GetStyleContext(RawGeckoNodeBorrowed aNode, nsIAtom* aPseudoTagOrNull)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
Gecko_CalcStyleDifference(nsStyleContext* aOldStyleContext,
|
||||
ServoComputedValuesBorrowed aComputedValues)
|
||||
{
|
||||
return nsChangeHint(0);
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_StoreStyleDifference(RawGeckoNodeBorrowed aNode, nsChangeHint aChangeHintToStore)
|
||||
{
|
||||
}
|
||||
|
||||
RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
Gecko_GetServoDeclarationBlock(RawGeckoElementBorrowed aElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static nsIAtom*
|
||||
AtomAttrValue(Implementor* aElement, nsIAtom* aName)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
template <typename Implementor, typename MatchFn>
|
||||
static bool
|
||||
DoMatch(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName, MatchFn aMatch)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
HasAttr(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
AttrEquals(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName, nsIAtom* aStr,
|
||||
bool aIgnoreCase)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
AttrDashEquals(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName,
|
||||
nsIAtom* aStr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
AttrIncludes(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName,
|
||||
nsIAtom* aStr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
AttrHasSubstring(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName,
|
||||
nsIAtom* aStr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
AttrHasPrefix(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName,
|
||||
nsIAtom* aStr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename Implementor>
|
||||
static bool
|
||||
AttrHasSuffix(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName,
|
||||
nsIAtom* aStr)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the class or class list (if any) of the implementor. The calling
|
||||
* convention here is rather hairy, and is optimized for getting Servo the
|
||||
* information it needs for hot calls.
|
||||
*
|
||||
* The return value indicates the number of classes. If zero, neither outparam
|
||||
* is valid. If one, the class_ outparam is filled with the atom of the class.
|
||||
* If two or more, the classList outparam is set to point to an array of atoms
|
||||
* representing the class list.
|
||||
*
|
||||
* The array is borrowed and the atoms are not addrefed. These values can be
|
||||
* invalidated by any DOM mutation. Use them in a tight scope.
|
||||
*/
|
||||
template <typename Implementor>
|
||||
static uint32_t
|
||||
ClassOrClassList(Implementor* aElement, nsIAtom** aClass, nsIAtom*** aClassList)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#define SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS(prefix_, implementor_) \
|
||||
nsIAtom* prefix_##AtomAttrValue(implementor_ aElement, nsIAtom* aName) \
|
||||
{ \
|
||||
return AtomAttrValue(aElement, aName); \
|
||||
} \
|
||||
bool prefix_##HasAttr(implementor_ aElement, nsIAtom* aNS, nsIAtom* aName) \
|
||||
{ \
|
||||
return HasAttr(aElement, aNS, aName); \
|
||||
} \
|
||||
bool prefix_##AttrEquals(implementor_ aElement, nsIAtom* aNS, \
|
||||
nsIAtom* aName, nsIAtom* aStr, bool aIgnoreCase) \
|
||||
{ \
|
||||
return AttrEquals(aElement, aNS, aName, aStr, aIgnoreCase); \
|
||||
} \
|
||||
bool prefix_##AttrDashEquals(implementor_ aElement, nsIAtom* aNS, \
|
||||
nsIAtom* aName, nsIAtom* aStr) \
|
||||
{ \
|
||||
return AttrDashEquals(aElement, aNS, aName, aStr); \
|
||||
} \
|
||||
bool prefix_##AttrIncludes(implementor_ aElement, nsIAtom* aNS, \
|
||||
nsIAtom* aName, nsIAtom* aStr) \
|
||||
{ \
|
||||
return AttrIncludes(aElement, aNS, aName, aStr); \
|
||||
} \
|
||||
bool prefix_##AttrHasSubstring(implementor_ aElement, nsIAtom* aNS, \
|
||||
nsIAtom* aName, nsIAtom* aStr) \
|
||||
{ \
|
||||
return AttrHasSubstring(aElement, aNS, aName, aStr); \
|
||||
} \
|
||||
bool prefix_##AttrHasPrefix(implementor_ aElement, nsIAtom* aNS, \
|
||||
nsIAtom* aName, nsIAtom* aStr) \
|
||||
{ \
|
||||
return AttrHasPrefix(aElement, aNS, aName, aStr); \
|
||||
} \
|
||||
bool prefix_##AttrHasSuffix(implementor_ aElement, nsIAtom* aNS, \
|
||||
nsIAtom* aName, nsIAtom* aStr) \
|
||||
{ \
|
||||
return AttrHasSuffix(aElement, aNS, aName, aStr); \
|
||||
} \
|
||||
uint32_t prefix_##ClassOrClassList(implementor_ aElement, nsIAtom** aClass, \
|
||||
nsIAtom*** aClassList) \
|
||||
{ \
|
||||
return ClassOrClassList(aElement, aClass, aClassList); \
|
||||
}
|
||||
|
||||
SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, RawGeckoElementBorrowed)
|
||||
SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot, ServoElementSnapshot*)
|
||||
|
||||
#undef SERVO_IMPL_ELEMENT_ATTR_MATCHING_FUNCTIONS
|
||||
|
||||
nsIAtom*
|
||||
Gecko_Atomize(const char* aString, uint32_t aLength)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_AddRefAtom(nsIAtom* aAtom)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_ReleaseAtom(nsIAtom* aAtom)
|
||||
{
|
||||
}
|
||||
|
||||
const uint16_t*
|
||||
Gecko_GetAtomAsUTF16(nsIAtom* aAtom, uint32_t* aLength)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_AtomEqualsUTF8(nsIAtom* aAtom, const char* aString, uint32_t aLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool
|
||||
Gecko_AtomEqualsUTF8IgnoreCase(nsIAtom* aAtom, const char* aString, uint32_t aLength)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_Utf8SliceToString(nsString* aString,
|
||||
const uint8_t* aBuffer,
|
||||
size_t aBufferLen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_FontFamilyList_Clear(FontFamilyList* aList) {
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_FontFamilyList_AppendNamed(FontFamilyList* aList, nsIAtom* aName)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_FontFamilyList_AppendGeneric(FontFamilyList* aList, FontFamilyType aType)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetListStyleType(nsStyleList* style_struct, uint32_t type)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyListStyleTypeFrom(nsStyleList* dst, const nsStyleList* src)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_HOLDER_FFI_REFCOUNTING(nsIPrincipal, Principal)
|
||||
NS_IMPL_HOLDER_FFI_REFCOUNTING(nsIURI, URI)
|
||||
|
||||
void
|
||||
Gecko_SetMozBinding(nsStyleDisplay* aDisplay,
|
||||
const uint8_t* aURLString, uint32_t aURLStringLength,
|
||||
ThreadSafeURIHolder* aBaseURI,
|
||||
ThreadSafeURIHolder* aReferrer,
|
||||
ThreadSafePrincipalHolder* aPrincipal)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyMozBindingFrom(nsStyleDisplay* aDest, const nsStyleDisplay* aSrc)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
Gecko_SetNullImageValue(nsStyleImage* aImage)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetGradientImageValue(nsStyleImage* aImage, nsStyleGradient* aGradient)
|
||||
{
|
||||
}
|
||||
|
||||
static already_AddRefed<nsStyleImageRequest>
|
||||
CreateStyleImageRequest(nsStyleImageRequest::Mode aModeFlags,
|
||||
const uint8_t* aURLString, uint32_t aURLStringLength,
|
||||
ThreadSafeURIHolder* aBaseURI,
|
||||
ThreadSafeURIHolder* aReferrer,
|
||||
ThreadSafePrincipalHolder* aPrincipal)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetUrlImageValue(nsStyleImage* aImage,
|
||||
const uint8_t* aURLString, uint32_t aURLStringLength,
|
||||
ThreadSafeURIHolder* aBaseURI,
|
||||
ThreadSafeURIHolder* aReferrer,
|
||||
ThreadSafePrincipalHolder* aPrincipal)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyImageValueFrom(nsStyleImage* aImage, const nsStyleImage* aOther)
|
||||
{
|
||||
}
|
||||
|
||||
nsStyleGradient*
|
||||
Gecko_CreateGradient(uint8_t aShape,
|
||||
uint8_t aSize,
|
||||
bool aRepeating,
|
||||
bool aLegacySyntax,
|
||||
uint32_t aStopCount)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetListStyleImageNone(nsStyleList* aList)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetListStyleImage(nsStyleList* aList,
|
||||
const uint8_t* aURLString, uint32_t aURLStringLength,
|
||||
ThreadSafeURIHolder* aBaseURI,
|
||||
ThreadSafeURIHolder* aReferrer,
|
||||
ThreadSafePrincipalHolder* aPrincipal)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyListStyleImageFrom(nsStyleList* aList, const nsStyleList* aSource)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_EnsureTArrayCapacity(void* aArray, size_t aCapacity, size_t aElemSize)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_ClearPODTArray(void* aArray, size_t aElementSize, size_t aElementAlign)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_ClearStyleContents(nsStyleContent* aContent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyStyleContentsFrom(nsStyleContent* aContent, const nsStyleContent* aOther)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_EnsureImageLayersLength(nsStyleImageLayers* aLayers, size_t aLen,
|
||||
nsStyleImageLayers::LayerType aLayerType)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_ResetStyleCoord(nsStyleUnit* aUnit, nsStyleUnion* aValue)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_SetStyleCoordCalcValue(nsStyleUnit* aUnit, nsStyleUnion* aValue, nsStyleCoord::CalcValue aCalc)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* aDst, const mozilla::StyleClipPath* aSrc)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_DestroyClipPath(mozilla::StyleClipPath* aClip)
|
||||
{
|
||||
}
|
||||
|
||||
mozilla::StyleBasicShape*
|
||||
Gecko_NewBasicShape(mozilla::StyleBasicShapeType aType)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CopyFiltersFrom(nsStyleEffects* aSrc, nsStyleEffects* aDest)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
|
||||
|
||||
nsCSSShadowArray*
|
||||
Gecko_NewCSSShadowArray(uint32_t aLen)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSSShadowArray, CSSShadowArray);
|
||||
|
||||
nsStyleQuoteValues*
|
||||
Gecko_NewStyleQuoteValues(uint32_t aLen)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsStyleQuoteValues, QuoteValues);
|
||||
|
||||
nsCSSValueSharedList*
|
||||
Gecko_NewCSSValueSharedList(uint32_t aLen)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetAbsoluteLength(nsCSSValueBorrowedMut aCSSValue, nscoord aLen)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut aCSSValue, float aNumber)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut aCSSValue, nsCSSKeyword aKeyword)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut aCSSValue, float aPercent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetAngle(nsCSSValueBorrowedMut aCSSValue, float aRadians)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut aCSSValue, nsStyleCoord::CalcValue aCalc)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut aCSSValue, int32_t aLen)
|
||||
{
|
||||
}
|
||||
|
||||
nsCSSValueBorrowedMut
|
||||
Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut aCSSValue, int32_t aIndex)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
|
||||
|
||||
#define STYLE_STRUCT(name, checkdata_cb) \
|
||||
\
|
||||
void \
|
||||
Gecko_Construct_nsStyle##name(nsStyle##name* ptr) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, \
|
||||
const nsStyle##name* other) \
|
||||
{ \
|
||||
} \
|
||||
\
|
||||
void \
|
||||
Gecko_Destroy_nsStyle##name(nsStyle##name* ptr) \
|
||||
{ \
|
||||
}
|
||||
|
||||
#include "nsStyleStructList.h"
|
||||
|
||||
#undef STYLE_STRUCT
|
||||
|
||||
#define SERVO_BINDING_FUNC(name_, return_, ...) \
|
||||
return_ name_(__VA_ARGS__) { \
|
||||
MOZ_CRASH("stylo: shouldn't be calling " #name_ "in a non-stylo build"); \
|
||||
}
|
||||
#include "ServoBindingList.h"
|
||||
#undef SERVO_BINDING_FUNC
|
||||
@@ -1,284 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoBindings_h
|
||||
#define mozilla_ServoBindings_h
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mozilla/ServoTypes.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/ServoElementSnapshot.h"
|
||||
#include "mozilla/css/SheetParsingMode.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsStyleStruct.h"
|
||||
|
||||
/*
|
||||
* API for Servo to access Gecko data structures. This file must compile as valid
|
||||
* C code in order for the binding generator to parse it.
|
||||
*
|
||||
* Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
|
||||
* Functions beginning with Servo_ are implemented in Servo and invoked from Gecko.
|
||||
*/
|
||||
|
||||
class nsIAtom;
|
||||
class nsIPrincipal;
|
||||
class nsIURI;
|
||||
struct nsFont;
|
||||
namespace mozilla {
|
||||
class FontFamilyList;
|
||||
enum FontFamilyType : uint32_t;
|
||||
}
|
||||
using mozilla::FontFamilyList;
|
||||
using mozilla::FontFamilyType;
|
||||
using mozilla::ServoElementSnapshot;
|
||||
struct nsStyleList;
|
||||
struct nsStyleImage;
|
||||
struct nsStyleGradientStop;
|
||||
class nsStyleGradient;
|
||||
class nsStyleCoord;
|
||||
struct nsStyleDisplay;
|
||||
|
||||
#define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
|
||||
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr); \
|
||||
void Gecko_Release##name_##ArbitraryThread(class_* aPtr);
|
||||
#define NS_IMPL_THREADSAFE_FFI_REFCOUNTING(class_, name_) \
|
||||
static_assert(class_::HasThreadSafeRefCnt::value, \
|
||||
"NS_DECL_THREADSAFE_FFI_REFCOUNTING can only be used with " \
|
||||
"classes that have thread-safe refcounting"); \
|
||||
void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr) \
|
||||
{ NS_ADDREF(aPtr); } \
|
||||
void Gecko_Release##name_##ArbitraryThread(class_* aPtr) \
|
||||
{ NS_RELEASE(aPtr); }
|
||||
|
||||
#define NS_DECL_HOLDER_FFI_REFCOUNTING(class_, name_) \
|
||||
typedef nsMainThreadPtrHolder<class_> ThreadSafe##name_##Holder; \
|
||||
void Gecko_AddRef##name_##ArbitraryThread(ThreadSafe##name_##Holder* aPtr); \
|
||||
void Gecko_Release##name_##ArbitraryThread(ThreadSafe##name_##Holder* aPtr);
|
||||
#define NS_IMPL_HOLDER_FFI_REFCOUNTING(class_, name_) \
|
||||
void Gecko_AddRef##name_##ArbitraryThread(ThreadSafe##name_##Holder* aPtr) \
|
||||
{ NS_ADDREF(aPtr); } \
|
||||
void Gecko_Release##name_##ArbitraryThread(ThreadSafe##name_##Holder* aPtr) \
|
||||
{ NS_RELEASE(aPtr); } \
|
||||
|
||||
extern "C" {
|
||||
|
||||
// Object refcounting.
|
||||
NS_DECL_HOLDER_FFI_REFCOUNTING(nsIPrincipal, Principal)
|
||||
NS_DECL_HOLDER_FFI_REFCOUNTING(nsIURI, URI)
|
||||
|
||||
// DOM Traversal.
|
||||
uint32_t Gecko_ChildrenCount(RawGeckoNodeBorrowed node);
|
||||
bool Gecko_NodeIsElement(RawGeckoNodeBorrowed node);
|
||||
RawGeckoNodeBorrowedOrNull Gecko_GetParentNode(RawGeckoNodeBorrowed node);
|
||||
RawGeckoNodeBorrowedOrNull Gecko_GetFirstChild(RawGeckoNodeBorrowed node);
|
||||
RawGeckoNodeBorrowedOrNull Gecko_GetLastChild(RawGeckoNodeBorrowed node);
|
||||
RawGeckoNodeBorrowedOrNull Gecko_GetPrevSibling(RawGeckoNodeBorrowed node);
|
||||
RawGeckoNodeBorrowedOrNull Gecko_GetNextSibling(RawGeckoNodeBorrowed node);
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetParentElement(RawGeckoElementBorrowed element);
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetFirstChildElement(RawGeckoElementBorrowed element);
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetLastChildElement(RawGeckoElementBorrowed element);
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetPrevSiblingElement(RawGeckoElementBorrowed element);
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetNextSiblingElement(RawGeckoElementBorrowed element);
|
||||
RawGeckoElementBorrowedOrNull Gecko_GetDocumentElement(RawGeckoDocumentBorrowed document);
|
||||
|
||||
// By default, Servo walks the DOM by traversing the siblings of the DOM-view
|
||||
// first child. This generally works, but misses anonymous children, which we
|
||||
// want to traverse during styling. To support these cases, we create an
|
||||
// optional heap-allocated iterator for nodes that need it. If the creation
|
||||
// method returns null, Servo falls back to the aforementioned simpler (and
|
||||
// faster) sibling traversal.
|
||||
StyleChildrenIteratorOwnedOrNull Gecko_MaybeCreateStyleChildrenIterator(RawGeckoNodeBorrowed node);
|
||||
void Gecko_DropStyleChildrenIterator(StyleChildrenIteratorOwned it);
|
||||
RawGeckoNodeBorrowedOrNull Gecko_GetNextStyleChild(StyleChildrenIteratorBorrowedMut it);
|
||||
|
||||
// Selector Matching.
|
||||
uint8_t Gecko_ElementState(RawGeckoElementBorrowed element);
|
||||
bool Gecko_IsHTMLElementInHTMLDocument(RawGeckoElementBorrowed element);
|
||||
bool Gecko_IsLink(RawGeckoElementBorrowed element);
|
||||
bool Gecko_IsTextNode(RawGeckoNodeBorrowed node);
|
||||
bool Gecko_IsVisitedLink(RawGeckoElementBorrowed element);
|
||||
bool Gecko_IsUnvisitedLink(RawGeckoElementBorrowed element);
|
||||
bool Gecko_IsRootElement(RawGeckoElementBorrowed element);
|
||||
nsIAtom* Gecko_LocalName(RawGeckoElementBorrowed element);
|
||||
nsIAtom* Gecko_Namespace(RawGeckoElementBorrowed element);
|
||||
nsIAtom* Gecko_GetElementId(RawGeckoElementBorrowed element);
|
||||
|
||||
// Attributes.
|
||||
#define SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(prefix_, implementor_) \
|
||||
nsIAtom* prefix_##AtomAttrValue(implementor_ element, nsIAtom* attribute); \
|
||||
bool prefix_##HasAttr(implementor_ element, nsIAtom* ns, nsIAtom* name); \
|
||||
bool prefix_##AttrEquals(implementor_ element, nsIAtom* ns, nsIAtom* name, \
|
||||
nsIAtom* str, bool ignoreCase); \
|
||||
bool prefix_##AttrDashEquals(implementor_ element, nsIAtom* ns, \
|
||||
nsIAtom* name, nsIAtom* str); \
|
||||
bool prefix_##AttrIncludes(implementor_ element, nsIAtom* ns, \
|
||||
nsIAtom* name, nsIAtom* str); \
|
||||
bool prefix_##AttrHasSubstring(implementor_ element, nsIAtom* ns, \
|
||||
nsIAtom* name, nsIAtom* str); \
|
||||
bool prefix_##AttrHasPrefix(implementor_ element, nsIAtom* ns, \
|
||||
nsIAtom* name, nsIAtom* str); \
|
||||
bool prefix_##AttrHasSuffix(implementor_ element, nsIAtom* ns, \
|
||||
nsIAtom* name, nsIAtom* str); \
|
||||
uint32_t prefix_##ClassOrClassList(implementor_ element, nsIAtom** class_, \
|
||||
nsIAtom*** classList);
|
||||
|
||||
SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_, RawGeckoElementBorrowed)
|
||||
SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS(Gecko_Snapshot,
|
||||
ServoElementSnapshot*)
|
||||
|
||||
#undef SERVO_DECLARE_ELEMENT_ATTR_MATCHING_FUNCTIONS
|
||||
|
||||
// Style attributes.
|
||||
RawServoDeclarationBlockStrongBorrowedOrNull
|
||||
Gecko_GetServoDeclarationBlock(RawGeckoElementBorrowed element);
|
||||
|
||||
// Atoms.
|
||||
nsIAtom* Gecko_Atomize(const char* aString, uint32_t aLength);
|
||||
void Gecko_AddRefAtom(nsIAtom* aAtom);
|
||||
void Gecko_ReleaseAtom(nsIAtom* aAtom);
|
||||
const uint16_t* Gecko_GetAtomAsUTF16(nsIAtom* aAtom, uint32_t* aLength);
|
||||
bool Gecko_AtomEqualsUTF8(nsIAtom* aAtom, const char* aString, uint32_t aLength);
|
||||
bool Gecko_AtomEqualsUTF8IgnoreCase(nsIAtom* aAtom, const char* aString, uint32_t aLength);
|
||||
|
||||
// Strings (temporary until bug 1294742)
|
||||
void Gecko_Utf8SliceToString(nsString* aString,
|
||||
const uint8_t* aBuffer,
|
||||
size_t aBufferLen);
|
||||
|
||||
// Font style
|
||||
void Gecko_FontFamilyList_Clear(FontFamilyList* aList);
|
||||
void Gecko_FontFamilyList_AppendNamed(FontFamilyList* aList, nsIAtom* aName);
|
||||
void Gecko_FontFamilyList_AppendGeneric(FontFamilyList* list, FontFamilyType familyType);
|
||||
void Gecko_CopyFontFamilyFrom(nsFont* dst, const nsFont* src);
|
||||
|
||||
// Counter style.
|
||||
void Gecko_SetListStyleType(nsStyleList* style_struct, uint32_t type);
|
||||
void Gecko_CopyListStyleTypeFrom(nsStyleList* dst, const nsStyleList* src);
|
||||
|
||||
// background-image style.
|
||||
// TODO: support element() and -moz-image()
|
||||
void Gecko_SetNullImageValue(nsStyleImage* image);
|
||||
void Gecko_SetGradientImageValue(nsStyleImage* image, nsStyleGradient* gradient);
|
||||
void Gecko_SetUrlImageValue(nsStyleImage* image,
|
||||
const uint8_t* url_bytes,
|
||||
uint32_t url_length,
|
||||
ThreadSafeURIHolder* base_uri,
|
||||
ThreadSafeURIHolder* referrer,
|
||||
ThreadSafePrincipalHolder* principal);
|
||||
void Gecko_CopyImageValueFrom(nsStyleImage* image, const nsStyleImage* other);
|
||||
|
||||
nsStyleGradient* Gecko_CreateGradient(uint8_t shape,
|
||||
uint8_t size,
|
||||
bool repeating,
|
||||
bool legacy_syntax,
|
||||
uint32_t stops);
|
||||
|
||||
// list-style-image style.
|
||||
void Gecko_SetListStyleImageNone(nsStyleList* style_struct);
|
||||
void Gecko_SetListStyleImage(nsStyleList* style_struct,
|
||||
const uint8_t* string_bytes, uint32_t string_length,
|
||||
ThreadSafeURIHolder* base_uri,
|
||||
ThreadSafeURIHolder* referrer,
|
||||
ThreadSafePrincipalHolder* principal);
|
||||
void Gecko_CopyListStyleImageFrom(nsStyleList* dest, const nsStyleList* src);
|
||||
|
||||
// Display style.
|
||||
void Gecko_SetMozBinding(nsStyleDisplay* style_struct,
|
||||
const uint8_t* string_bytes, uint32_t string_length,
|
||||
ThreadSafeURIHolder* base_uri,
|
||||
ThreadSafeURIHolder* referrer,
|
||||
ThreadSafePrincipalHolder* principal);
|
||||
void Gecko_CopyMozBindingFrom(nsStyleDisplay* des, const nsStyleDisplay* src);
|
||||
|
||||
// Dirtiness tracking.
|
||||
uint32_t Gecko_GetNodeFlags(RawGeckoNodeBorrowed node);
|
||||
void Gecko_SetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
|
||||
void Gecko_UnsetNodeFlags(RawGeckoNodeBorrowed node, uint32_t flags);
|
||||
|
||||
// Incremental restyle.
|
||||
// TODO: We would avoid a few ffi calls if we decide to make an API like the
|
||||
// former CalcAndStoreStyleDifference, but that would effectively mean breaking
|
||||
// some safety guarantees in the servo side.
|
||||
//
|
||||
// Also, we might want a ComputedValues to ComputedValues API for animations?
|
||||
// Not if we do them in Gecko...
|
||||
nsStyleContext* Gecko_GetStyleContext(RawGeckoNodeBorrowed node,
|
||||
nsIAtom* aPseudoTagOrNull);
|
||||
nsChangeHint Gecko_CalcStyleDifference(nsStyleContext* oldstyle,
|
||||
ServoComputedValuesBorrowed newstyle);
|
||||
void Gecko_StoreStyleDifference(RawGeckoNodeBorrowed node, nsChangeHint change);
|
||||
|
||||
// `array` must be an nsTArray
|
||||
// If changing this signature, please update the
|
||||
// friend function declaration in nsTArray.h
|
||||
void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size);
|
||||
|
||||
// Same here, `array` must be an nsTArray<T>, for some T.
|
||||
//
|
||||
// Important note: Only valid for POD types, since destructors won't be run
|
||||
// otherwise. This is ensured with rust traits for the relevant structs.
|
||||
void Gecko_ClearPODTArray(void* array, size_t elem_size, size_t elem_align);
|
||||
|
||||
// Clear the mContents field in nsStyleContent. This is needed to run the
|
||||
// destructors, otherwise we'd leak the images (though we still don't support
|
||||
// those), strings, and whatnot.
|
||||
void Gecko_ClearStyleContents(nsStyleContent* content);
|
||||
void Gecko_CopyStyleContentsFrom(nsStyleContent* content, const nsStyleContent* other);
|
||||
|
||||
void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len,
|
||||
nsStyleImageLayers::LayerType layer_type);
|
||||
|
||||
// Clean up pointer-based coordinates
|
||||
void Gecko_ResetStyleCoord(nsStyleUnit* unit, nsStyleUnion* value);
|
||||
|
||||
// Set an nsStyleCoord to a computed `calc()` value
|
||||
void Gecko_SetStyleCoordCalcValue(nsStyleUnit* unit, nsStyleUnion* value, nsStyleCoord::CalcValue calc);
|
||||
|
||||
void Gecko_CopyClipPathValueFrom(mozilla::StyleClipPath* dst, const mozilla::StyleClipPath* src);
|
||||
|
||||
void Gecko_DestroyClipPath(mozilla::StyleClipPath* clip);
|
||||
mozilla::StyleBasicShape* Gecko_NewBasicShape(mozilla::StyleBasicShapeType type);
|
||||
|
||||
void Gecko_ResetFilters(nsStyleEffects* effects, size_t new_len);
|
||||
void Gecko_CopyFiltersFrom(nsStyleEffects* aSrc, nsStyleEffects* aDest);
|
||||
|
||||
void Gecko_FillAllBackgroundLists(nsStyleImageLayers* layers, uint32_t max_len);
|
||||
void Gecko_FillAllMaskLists(nsStyleImageLayers* layers, uint32_t max_len);
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleCoord::Calc, Calc);
|
||||
|
||||
nsCSSShadowArray* Gecko_NewCSSShadowArray(uint32_t len);
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSShadowArray, CSSShadowArray);
|
||||
|
||||
nsStyleQuoteValues* Gecko_NewStyleQuoteValues(uint32_t len);
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsStyleQuoteValues, QuoteValues);
|
||||
|
||||
nsCSSValueSharedList* Gecko_NewCSSValueSharedList(uint32_t len);
|
||||
void Gecko_CSSValue_SetAbsoluteLength(nsCSSValueBorrowedMut css_value, nscoord len);
|
||||
void Gecko_CSSValue_SetNumber(nsCSSValueBorrowedMut css_value, float number);
|
||||
void Gecko_CSSValue_SetKeyword(nsCSSValueBorrowedMut css_value, nsCSSKeyword keyword);
|
||||
void Gecko_CSSValue_SetPercentage(nsCSSValueBorrowedMut css_value, float percent);
|
||||
void Gecko_CSSValue_SetAngle(nsCSSValueBorrowedMut css_value, float radians);
|
||||
void Gecko_CSSValue_SetCalc(nsCSSValueBorrowedMut css_value, nsStyleCoord::CalcValue calc);
|
||||
void Gecko_CSSValue_SetFunction(nsCSSValueBorrowedMut css_value, int32_t len);
|
||||
nsCSSValueBorrowedMut Gecko_CSSValue_GetArrayItem(nsCSSValueBorrowedMut css_value, int32_t index);
|
||||
NS_DECL_THREADSAFE_FFI_REFCOUNTING(nsCSSValueSharedList, CSSValueSharedList);
|
||||
|
||||
// Style-struct management.
|
||||
#define STYLE_STRUCT(name, checkdata_cb) \
|
||||
void Gecko_Construct_nsStyle##name(nsStyle##name* ptr); \
|
||||
void Gecko_CopyConstruct_nsStyle##name(nsStyle##name* ptr, \
|
||||
const nsStyle##name* other); \
|
||||
void Gecko_Destroy_nsStyle##name(nsStyle##name* ptr);
|
||||
#include "nsStyleStructList.h"
|
||||
#undef STYLE_STRUCT
|
||||
|
||||
#define SERVO_BINDING_FUNC(name_, return_, ...) return_ name_(__VA_ARGS__);
|
||||
#include "mozilla/ServoBindingList.h"
|
||||
#undef SERVO_BINDING_FUNC
|
||||
|
||||
} // extern "C"
|
||||
|
||||
#endif // mozilla_ServoBindings_h
|
||||
@@ -1,71 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ServoDeclarationBlock.h"
|
||||
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
#include "nsCSSProps.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/* static */ already_AddRefed<ServoDeclarationBlock>
|
||||
ServoDeclarationBlock::FromCssText(const nsAString& aCssText)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* An RAII class holding an atom for the given property.
|
||||
*/
|
||||
class MOZ_STACK_CLASS PropertyAtomHolder
|
||||
{
|
||||
public:
|
||||
explicit PropertyAtomHolder(const nsAString& aProperty)
|
||||
{
|
||||
}
|
||||
|
||||
~PropertyAtomHolder()
|
||||
{
|
||||
}
|
||||
|
||||
explicit operator bool() const { return !!mAtom; }
|
||||
nsIAtom* Atom() const { MOZ_ASSERT(mAtom); return mAtom; }
|
||||
bool IsCustomProperty() const { return mIsCustomProperty; }
|
||||
|
||||
private:
|
||||
nsIAtom* mAtom;
|
||||
bool mIsCustomProperty;
|
||||
};
|
||||
|
||||
void
|
||||
ServoDeclarationBlock::GetPropertyValue(const nsAString& aProperty,
|
||||
nsAString& aValue) const
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoDeclarationBlock::GetPropertyValueByID(nsCSSPropertyID aPropID,
|
||||
nsAString& aValue) const
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ServoDeclarationBlock::GetPropertyIsImportant(const nsAString& aProperty) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ServoDeclarationBlock::RemoveProperty(const nsAString& aProperty)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoDeclarationBlock::RemovePropertyByID(nsCSSPropertyID aPropID)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
@@ -1,72 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoDeclarationBlock_h
|
||||
#define mozilla_ServoDeclarationBlock_h
|
||||
|
||||
#include "mozilla/ServoBindings.h"
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class ServoDeclarationBlock final : public DeclarationBlock
|
||||
{
|
||||
public:
|
||||
ServoDeclarationBlock()
|
||||
: ServoDeclarationBlock(Servo_DeclarationBlock_CreateEmpty().Consume()) {}
|
||||
|
||||
ServoDeclarationBlock(const ServoDeclarationBlock& aCopy)
|
||||
: DeclarationBlock(aCopy)
|
||||
, mRaw(Servo_DeclarationBlock_Clone(aCopy.mRaw).Consume()) {}
|
||||
|
||||
NS_INLINE_DECL_REFCOUNTING(ServoDeclarationBlock)
|
||||
|
||||
static already_AddRefed<ServoDeclarationBlock>
|
||||
FromCssText(const nsAString& aCssText);
|
||||
|
||||
RawServoDeclarationBlock* Raw() const { return mRaw; }
|
||||
RawServoDeclarationBlock* const* RefRaw() const {
|
||||
static_assert(sizeof(RefPtr<RawServoDeclarationBlock>) ==
|
||||
sizeof(RawServoDeclarationBlock*),
|
||||
"RefPtr should just be a pointer");
|
||||
return reinterpret_cast<RawServoDeclarationBlock* const*>(&mRaw);
|
||||
}
|
||||
|
||||
void ToString(nsAString& aResult) const {
|
||||
Servo_DeclarationBlock_GetCssText(mRaw, &aResult);
|
||||
}
|
||||
|
||||
uint32_t Count() const {
|
||||
return Servo_DeclarationBlock_Count(mRaw);
|
||||
}
|
||||
bool GetNthProperty(uint32_t aIndex, nsAString& aReturn) const {
|
||||
aReturn.Truncate();
|
||||
return Servo_DeclarationBlock_GetNthProperty(mRaw, aIndex, &aReturn);
|
||||
}
|
||||
|
||||
void GetPropertyValue(const nsAString& aProperty, nsAString& aValue) const;
|
||||
void GetPropertyValueByID(nsCSSPropertyID aPropID, nsAString& aValue) const;
|
||||
void GetAuthoredPropertyValue(const nsAString& aProperty,
|
||||
nsAString& aValue) const {
|
||||
GetPropertyValue(aProperty, aValue);
|
||||
}
|
||||
bool GetPropertyIsImportant(const nsAString& aProperty) const;
|
||||
void RemoveProperty(const nsAString& aProperty);
|
||||
void RemovePropertyByID(nsCSSPropertyID aPropID);
|
||||
|
||||
protected:
|
||||
explicit ServoDeclarationBlock(
|
||||
already_AddRefed<RawServoDeclarationBlock> aRaw)
|
||||
: DeclarationBlock(), mRaw(aRaw) {}
|
||||
|
||||
private:
|
||||
~ServoDeclarationBlock() {}
|
||||
|
||||
RefPtr<RawServoDeclarationBlock> mRaw;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoDeclarationBlock_h
|
||||
@@ -1,26 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ServoElementSnapshot.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsIContentInlines.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
ServoElementSnapshot::ServoElementSnapshot(Element* aElement)
|
||||
: mContains(Flags(0))
|
||||
, mState(0)
|
||||
, mExplicitRestyleHint(nsRestyleHint(0))
|
||||
, mExplicitChangeHint(nsChangeHint(0))
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoElementSnapshot::AddAttrs(Element* aElement)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
@@ -1,144 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoElementSnapshot_h
|
||||
#define mozilla_ServoElementSnapshot_h
|
||||
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/TypedEnumBits.h"
|
||||
#include "mozilla/dom/BorrowedAttrInfo.h"
|
||||
#include "nsAttrName.h"
|
||||
#include "nsAttrValue.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
|
||||
/**
|
||||
* A structure representing a single attribute name and value.
|
||||
*
|
||||
* This is pretty similar to the private nsAttrAndChildArray::InternalAttr.
|
||||
*/
|
||||
struct ServoAttrSnapshot
|
||||
{
|
||||
nsAttrName mName;
|
||||
nsAttrValue mValue;
|
||||
|
||||
ServoAttrSnapshot(const nsAttrName& aName, const nsAttrValue& aValue)
|
||||
: mName(aName)
|
||||
, mValue(aValue)
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* A bitflags enum class used to determine what data does a ServoElementSnapshot
|
||||
* contains.
|
||||
*/
|
||||
enum class ServoElementSnapshotFlags : uint8_t
|
||||
{
|
||||
State = 1 << 0,
|
||||
Attributes = 1 << 1,
|
||||
All = State | Attributes
|
||||
};
|
||||
|
||||
MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(ServoElementSnapshotFlags)
|
||||
|
||||
/**
|
||||
* This class holds all non-tree-structural state of an element that might be
|
||||
* used for selector matching eventually.
|
||||
*
|
||||
* This means the attributes, and the element state, such as :hover, :active,
|
||||
* etc...
|
||||
*/
|
||||
class ServoElementSnapshot
|
||||
{
|
||||
typedef dom::BorrowedAttrInfo BorrowedAttrInfo;
|
||||
typedef dom::Element Element;
|
||||
typedef EventStates::ServoType ServoStateType;
|
||||
|
||||
public:
|
||||
typedef ServoElementSnapshotFlags Flags;
|
||||
|
||||
explicit ServoElementSnapshot(Element* aElement);
|
||||
|
||||
bool HasAttrs() { return HasAny(Flags::Attributes); }
|
||||
|
||||
bool HasState() { return HasAny(Flags::State); }
|
||||
|
||||
/**
|
||||
* Captures the given state (if not previously captured).
|
||||
*/
|
||||
void AddState(EventStates aState)
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Captures the given element attributes (if not previously captured).
|
||||
*/
|
||||
void AddAttrs(Element* aElement);
|
||||
|
||||
void AddExplicitChangeHint(nsChangeHint aMinChangeHint)
|
||||
{
|
||||
}
|
||||
|
||||
void AddExplicitRestyleHint(nsRestyleHint aRestyleHint)
|
||||
{
|
||||
}
|
||||
|
||||
nsRestyleHint ExplicitRestyleHint() { return mExplicitRestyleHint; }
|
||||
|
||||
nsChangeHint ExplicitChangeHint() { return mExplicitChangeHint; }
|
||||
|
||||
/**
|
||||
* Needed methods for attribute matching.
|
||||
*/
|
||||
BorrowedAttrInfo GetAttrInfoAt(uint32_t aIndex) const
|
||||
{
|
||||
return BorrowedAttrInfo(nullptr, nullptr);
|
||||
}
|
||||
|
||||
const nsAttrValue* GetParsedAttr(nsIAtom* aLocalName) const
|
||||
{
|
||||
return GetParsedAttr(aLocalName, kNameSpaceID_None);
|
||||
}
|
||||
|
||||
const nsAttrValue* GetParsedAttr(nsIAtom* aLocalName,
|
||||
int32_t aNamespaceID) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
bool IsInChromeDocument() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool HasAny(Flags aFlags)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
private:
|
||||
// TODO: Profile, a 1 or 2 element AutoTArray could be worth it, given we know
|
||||
// we're dealing with attribute changes when we take snapshots of attributes,
|
||||
// though it can be wasted space if we deal with a lot of state-only
|
||||
// snapshots.
|
||||
Flags mContains;
|
||||
nsTArray<ServoAttrSnapshot> mAttrs;
|
||||
ServoStateType mState;
|
||||
nsRestyleHint mExplicitRestyleHint;
|
||||
nsChangeHint mExplicitChangeHint;
|
||||
bool mIsHTMLElementInHTMLDocument;
|
||||
bool mIsInChromeDocument;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
@@ -1,254 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/ServoStyleSet.h"
|
||||
|
||||
#include "ServoBindings.h"
|
||||
#include "mozilla/ServoRestyleManager.h"
|
||||
#include "mozilla/dom/ChildIterator.h"
|
||||
#include "nsCSSAnonBoxes.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsIDocumentInlines.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsStyleContext.h"
|
||||
#include "nsStyleSet.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
ServoStyleSet::ServoStyleSet()
|
||||
: mPresContext(nullptr)
|
||||
, mRawSet(Servo_StyleSet_Init())
|
||||
, mBatching(0)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::Init(nsPresContext* aPresContext)
|
||||
{
|
||||
mPresContext = aPresContext;
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::BeginShutdown()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::Shutdown()
|
||||
{
|
||||
mRawSet = nullptr;
|
||||
}
|
||||
|
||||
bool
|
||||
ServoStyleSet::GetAuthorStyleDisabled() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::SetAuthorStyleDisabled(bool aStyleDisabled)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::BeginUpdate()
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::EndUpdate()
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ResolveStyleFor(Element* aElement,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::GetContext(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::GetContext(already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ResolveStyleFor(Element* aElement,
|
||||
nsStyleContext* aParentContext,
|
||||
TreeMatchContext& aTreeMatchContext)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ResolveStyleForText(nsIContent* aTextNode,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ResolveStyleForOtherNonElement(nsStyleContext* aParentContext)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ResolvePseudoElementStyle(Element* aParentElement,
|
||||
CSSPseudoElementType aType,
|
||||
nsStyleContext* aParentContext,
|
||||
Element* aPseudoElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// aFlags is an nsStyleSet flags bitfield
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag,
|
||||
nsStyleContext* aParentContext,
|
||||
uint32_t aFlags)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// manage the set of style sheets in the style set
|
||||
nsresult
|
||||
ServoStyleSet::AppendStyleSheet(SheetType aType,
|
||||
ServoStyleSheet* aSheet)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::PrependStyleSheet(SheetType aType,
|
||||
ServoStyleSheet* aSheet)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::RemoveStyleSheet(SheetType aType,
|
||||
ServoStyleSheet* aSheet)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::ReplaceSheets(SheetType aType,
|
||||
const nsTArray<RefPtr<ServoStyleSheet>>& aNewSheets)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::InsertStyleSheetBefore(SheetType aType,
|
||||
ServoStyleSheet* aNewSheet,
|
||||
ServoStyleSheet* aReferenceSheet)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
int32_t
|
||||
ServoStyleSet::SheetCount(SheetType aType) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
ServoStyleSheet*
|
||||
ServoStyleSet::StyleSheetAt(SheetType aType,
|
||||
int32_t aIndex) const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::RemoveDocStyleSheet(ServoStyleSheet* aSheet)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSet::AddDocStyleSheet(ServoStyleSheet* aSheet,
|
||||
nsIDocument* aDocument)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ProbePseudoElementStyle(Element* aParentElement,
|
||||
CSSPseudoElementType aType,
|
||||
nsStyleContext* aParentContext)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ServoStyleSet::ProbePseudoElementStyle(Element* aParentElement,
|
||||
CSSPseudoElementType aType,
|
||||
nsStyleContext* aParentContext,
|
||||
TreeMatchContext& aTreeMatchContext,
|
||||
Element* aPseudoElement)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
ServoStyleSet::HasStateDependentStyle(dom::Element* aElement,
|
||||
EventStates aStateMask)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
ServoStyleSet::HasStateDependentStyle(dom::Element* aElement,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
dom::Element* aPseudoElement,
|
||||
EventStates aStateMask)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
nsRestyleHint
|
||||
ServoStyleSet::ComputeRestyleHint(dom::Element* aElement,
|
||||
ServoElementSnapshot* aSnapshot)
|
||||
{
|
||||
return nsRestyleHint(0);
|
||||
}
|
||||
|
||||
static void
|
||||
ClearDirtyBits(nsIContent* aContent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::StyleDocument(bool aLeaveDirtyBits)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::StyleNewSubtree(nsIContent* aContent)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSet::StyleNewChildren(nsIContent* aParent)
|
||||
{
|
||||
}
|
||||
@@ -1,174 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoStyleSet_h
|
||||
#define mozilla_ServoStyleSet_h
|
||||
|
||||
#include "mozilla/EnumeratedArray.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/ServoElementSnapshot.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/SheetType.h"
|
||||
#include "mozilla/UniquePtr.h"
|
||||
#include "nsCSSPseudoElements.h"
|
||||
#include "nsChangeHint.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsTArray.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
class Element;
|
||||
} // namespace dom
|
||||
class CSSStyleSheet;
|
||||
class ServoRestyleManager;
|
||||
class ServoStyleSheet;
|
||||
} // namespace mozilla
|
||||
class nsIDocument;
|
||||
class nsStyleContext;
|
||||
class nsPresContext;
|
||||
struct TreeMatchContext;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* The set of style sheets that apply to a document, backed by a Servo
|
||||
* Stylist. A ServoStyleSet contains ServoStyleSheets.
|
||||
*/
|
||||
class ServoStyleSet
|
||||
{
|
||||
friend class ServoRestyleManager;
|
||||
public:
|
||||
ServoStyleSet();
|
||||
|
||||
void Init(nsPresContext* aPresContext);
|
||||
void BeginShutdown();
|
||||
void Shutdown();
|
||||
|
||||
bool GetAuthorStyleDisabled() const;
|
||||
nsresult SetAuthorStyleDisabled(bool aStyleDisabled);
|
||||
|
||||
void BeginUpdate();
|
||||
nsresult EndUpdate();
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleFor(dom::Element* aElement,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleFor(dom::Element* aElement,
|
||||
nsStyleContext* aParentContext,
|
||||
TreeMatchContext& aTreeMatchContext);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForText(nsIContent* aTextNode,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveStyleForOtherNonElement(nsStyleContext* aParentContext);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolvePseudoElementStyle(dom::Element* aParentElement,
|
||||
mozilla::CSSPseudoElementType aType,
|
||||
nsStyleContext* aParentContext,
|
||||
dom::Element* aPseudoElement);
|
||||
|
||||
// aFlags is an nsStyleSet flags bitfield
|
||||
already_AddRefed<nsStyleContext>
|
||||
ResolveAnonymousBoxStyle(nsIAtom* aPseudoTag, nsStyleContext* aParentContext,
|
||||
uint32_t aFlags = 0);
|
||||
|
||||
// manage the set of style sheets in the style set
|
||||
nsresult AppendStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
|
||||
nsresult PrependStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
|
||||
nsresult RemoveStyleSheet(SheetType aType, ServoStyleSheet* aSheet);
|
||||
nsresult ReplaceSheets(SheetType aType,
|
||||
const nsTArray<RefPtr<ServoStyleSheet>>& aNewSheets);
|
||||
nsresult InsertStyleSheetBefore(SheetType aType,
|
||||
ServoStyleSheet* aNewSheet,
|
||||
ServoStyleSheet* aReferenceSheet);
|
||||
|
||||
int32_t SheetCount(SheetType aType) const;
|
||||
ServoStyleSheet* StyleSheetAt(SheetType aType, int32_t aIndex) const;
|
||||
|
||||
nsresult RemoveDocStyleSheet(ServoStyleSheet* aSheet);
|
||||
nsresult AddDocStyleSheet(ServoStyleSheet* aSheet, nsIDocument* aDocument);
|
||||
|
||||
// check whether there is ::before/::after style for an element
|
||||
already_AddRefed<nsStyleContext>
|
||||
ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||
mozilla::CSSPseudoElementType aType,
|
||||
nsStyleContext* aParentContext);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
ProbePseudoElementStyle(dom::Element* aParentElement,
|
||||
mozilla::CSSPseudoElementType aType,
|
||||
nsStyleContext* aParentContext,
|
||||
TreeMatchContext& aTreeMatchContext,
|
||||
dom::Element* aPseudoElement = nullptr);
|
||||
|
||||
// Test if style is dependent on content state
|
||||
nsRestyleHint HasStateDependentStyle(dom::Element* aElement,
|
||||
EventStates aStateMask);
|
||||
nsRestyleHint HasStateDependentStyle(
|
||||
dom::Element* aElement, mozilla::CSSPseudoElementType aPseudoType,
|
||||
dom::Element* aPseudoElement, EventStates aStateMask);
|
||||
|
||||
/**
|
||||
* Computes a restyle hint given a element and a previous element snapshot.
|
||||
*/
|
||||
nsRestyleHint ComputeRestyleHint(dom::Element* aElement,
|
||||
ServoElementSnapshot* aSnapshot);
|
||||
|
||||
/**
|
||||
* Performs a Servo traversal to compute style for all dirty nodes in the
|
||||
* document. The root element must be non-null.
|
||||
*
|
||||
* If aLeaveDirtyBits is true, the dirty/dirty-descendant bits are not
|
||||
* cleared.
|
||||
*/
|
||||
void StyleDocument(bool aLeaveDirtyBits);
|
||||
|
||||
/**
|
||||
* Eagerly styles a subtree of dirty nodes that were just appended to the
|
||||
* tree. This is used in situations where we need the style immediately and
|
||||
* cannot wait for a future batch restyle.
|
||||
*
|
||||
* The subtree must have the root dirty bit set, which currently gets
|
||||
* propagated to all descendants. The dirty bits are cleared before
|
||||
* returning.
|
||||
*/
|
||||
void StyleNewSubtree(nsIContent* aContent);
|
||||
|
||||
/**
|
||||
* Like the above, but does not assume that the root node is dirty. When
|
||||
* appending multiple children to a potentially-non-dirty node, it's
|
||||
* preferable to call StyleNewChildren on the node rather than making multiple
|
||||
* calls to StyleNewSubtree on each child, since it allows for more
|
||||
* parallelism.
|
||||
*/
|
||||
void StyleNewChildren(nsIContent* aParent);
|
||||
|
||||
private:
|
||||
already_AddRefed<nsStyleContext> GetContext(already_AddRefed<ServoComputedValues>,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
|
||||
already_AddRefed<nsStyleContext> GetContext(nsIContent* aContent,
|
||||
nsStyleContext* aParentContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType);
|
||||
|
||||
nsPresContext* mPresContext;
|
||||
UniquePtr<RawServoStyleSet> mRawSet;
|
||||
EnumeratedArray<SheetType, SheetType::Count,
|
||||
nsTArray<RefPtr<ServoStyleSheet>>> mSheets;
|
||||
int32_t mBatching;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoStyleSet_h
|
||||
@@ -1,114 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "ServoBindings.h"
|
||||
#include "mozilla/ServoStyleSheet.h"
|
||||
#include "CSSRuleList.h"
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
ServoStyleSheet::ServoStyleSheet(css::SheetParsingMode aParsingMode,
|
||||
CORSMode aCORSMode,
|
||||
net::ReferrerPolicy aReferrerPolicy,
|
||||
const dom::SRIMetadata& aIntegrity)
|
||||
: StyleSheet(aParsingMode)
|
||||
, mSheetInfo(aCORSMode, aReferrerPolicy, aIntegrity)
|
||||
{
|
||||
}
|
||||
|
||||
ServoStyleSheet::~ServoStyleSheet()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
ServoStyleSheet::HasRules() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSheet::SetAssociatedDocument(nsIDocument* aDocument,
|
||||
DocumentAssociationMode aAssociationMode)
|
||||
{
|
||||
}
|
||||
|
||||
ServoStyleSheet*
|
||||
ServoStyleSheet::GetParentSheet() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSheet::AppendStyleSheet(ServoStyleSheet* aSheet)
|
||||
{
|
||||
}
|
||||
|
||||
nsresult
|
||||
ServoStyleSheet::ParseSheet(const nsAString& aInput,
|
||||
nsIURI* aSheetURI,
|
||||
nsIURI* aBaseURI,
|
||||
nsIPrincipal* aSheetPrincipal,
|
||||
uint32_t aLineNumber)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSheet::LoadFailed()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSheet::DropSheet()
|
||||
{
|
||||
}
|
||||
|
||||
size_t
|
||||
ServoStyleSheet::SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void
|
||||
ServoStyleSheet::List(FILE* aOut, int32_t aIndex) const
|
||||
{
|
||||
MOZ_CRASH("stylo: not implemented");
|
||||
}
|
||||
#endif
|
||||
|
||||
nsMediaList*
|
||||
ServoStyleSheet::Media()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
nsIDOMCSSRule*
|
||||
ServoStyleSheet::GetDOMOwnerRule() const
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CSSRuleList*
|
||||
ServoStyleSheet::GetCssRulesInternal(ErrorResult& aRv)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
ServoStyleSheet::InsertRuleInternal(const nsAString& aRule,
|
||||
uint32_t aIndex, ErrorResult& aRv)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
ServoStyleSheet::DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv)
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
@@ -1,90 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoStyleSheet_h
|
||||
#define mozilla_ServoStyleSheet_h
|
||||
|
||||
#include "mozilla/dom/SRIMetadata.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "mozilla/StyleSheet.h"
|
||||
#include "mozilla/StyleSheetInfo.h"
|
||||
#include "nsStringFwd.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* CSS style sheet object that is a wrapper for a Servo Stylesheet.
|
||||
*/
|
||||
class ServoStyleSheet : public StyleSheet
|
||||
{
|
||||
public:
|
||||
ServoStyleSheet(css::SheetParsingMode aParsingMode,
|
||||
CORSMode aCORSMode,
|
||||
net::ReferrerPolicy aReferrerPolicy,
|
||||
const dom::SRIMetadata& aIntegrity);
|
||||
|
||||
bool HasRules() const;
|
||||
|
||||
void SetAssociatedDocument(nsIDocument* aDocument,
|
||||
DocumentAssociationMode aAssociationMode);
|
||||
|
||||
ServoStyleSheet* GetParentSheet() const;
|
||||
void AppendStyleSheet(ServoStyleSheet* aSheet);
|
||||
|
||||
MOZ_MUST_USE nsresult ParseSheet(const nsAString& aInput,
|
||||
nsIURI* aSheetURI,
|
||||
nsIURI* aBaseURI,
|
||||
nsIPrincipal* aSheetPrincipal,
|
||||
uint32_t aLineNumber);
|
||||
|
||||
/**
|
||||
* Called instead of ParseSheet to initialize the Servo stylesheet object
|
||||
* for a failed load. Either ParseSheet or LoadFailed must be called before
|
||||
* adding a ServoStyleSheet to a ServoStyleSet.
|
||||
*/
|
||||
void LoadFailed();
|
||||
|
||||
size_t SizeOfIncludingThis(MallocSizeOf aMallocSizeOf) const;
|
||||
|
||||
#ifdef DEBUG
|
||||
void List(FILE* aOut = stdout, int32_t aIndex = 0) const;
|
||||
#endif
|
||||
|
||||
RawServoStyleSheet* RawSheet() const { return mSheet; }
|
||||
|
||||
// WebIDL StyleSheet API
|
||||
nsMediaList* Media() final;
|
||||
|
||||
// WebIDL CSSStyleSheet API
|
||||
// Can't be inline because we can't include ImportRule here. And can't be
|
||||
// called GetOwnerRule because that would be ambiguous with the ImportRule
|
||||
// version.
|
||||
nsIDOMCSSRule* GetDOMOwnerRule() const final;
|
||||
|
||||
void WillDirty() {}
|
||||
void DidDirty() {}
|
||||
|
||||
protected:
|
||||
virtual ~ServoStyleSheet();
|
||||
|
||||
// Internal methods which do not have security check and completeness check.
|
||||
dom::CSSRuleList* GetCssRulesInternal(ErrorResult& aRv);
|
||||
uint32_t InsertRuleInternal(const nsAString& aRule,
|
||||
uint32_t aIndex, ErrorResult& aRv);
|
||||
void DeleteRuleInternal(uint32_t aIndex, ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
void DropSheet();
|
||||
|
||||
RefPtr<RawServoStyleSheet> mSheet;
|
||||
StyleSheetInfo mSheetInfo;
|
||||
|
||||
friend class StyleSheet;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoStyleSheet_h
|
||||
@@ -1,39 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_ServoTypes_h
|
||||
#define mozilla_ServoTypes_h
|
||||
|
||||
/*
|
||||
* Type definitions used to interact with Servo. This gets included by nsINode,
|
||||
* so don't add significant include dependencies to this file.
|
||||
*/
|
||||
|
||||
struct ServoNodeData;
|
||||
namespace mozilla {
|
||||
|
||||
/*
|
||||
* Replaced types. These get mapped to associated Servo types in bindgen.
|
||||
*/
|
||||
|
||||
template<typename T>
|
||||
struct ServoUnsafeCell {
|
||||
T value;
|
||||
|
||||
// Ensure that primitive types (i.e. pointers) get zero-initialized.
|
||||
ServoUnsafeCell() : value() {};
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct ServoCell {
|
||||
ServoUnsafeCell<T> value;
|
||||
T Get() const { return value.value; }
|
||||
void Set(T arg) { value.value = arg; }
|
||||
ServoCell() : value() {};
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_ServoTypes_h
|
||||
@@ -6,12 +6,12 @@
|
||||
#ifndef mozilla_StyleContextSource_h
|
||||
#define mozilla_StyleContextSource_h
|
||||
|
||||
#include "mozilla/ServoBindingTypes.h"
|
||||
#include "nsRuleNode.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Tagged union between Gecko Rule Nodes and Servo Computed Values.
|
||||
// Temporary holder of Gecko Rule Nodes.
|
||||
// TODO: This struct is marked for removal.
|
||||
//
|
||||
// The rule node is the node in the lexicographic tree of rule nodes
|
||||
// (the "rule tree") that indicates which style rules are used to
|
||||
@@ -19,21 +19,14 @@ namespace mozilla {
|
||||
// specific rule matched is the one whose rule node is a child of the
|
||||
// root of the rule tree, and the most specific rule matched is the
|
||||
// |mRule| member of the rule node.
|
||||
//
|
||||
// In the Servo case, we hold an atomically-refcounted handle to a
|
||||
// Servo ComputedValues struct, which is more or less the Servo equivalent
|
||||
// of an nsStyleContext.
|
||||
|
||||
// Underlying pointer without any strong ownership semantics.
|
||||
struct NonOwningStyleContextSource
|
||||
{
|
||||
MOZ_IMPLICIT NonOwningStyleContextSource(nsRuleNode* aRuleNode)
|
||||
: mBits(reinterpret_cast<uintptr_t>(aRuleNode)) {}
|
||||
explicit NonOwningStyleContextSource(const ServoComputedValues* aComputedValues)
|
||||
: mBits(reinterpret_cast<uintptr_t>(aComputedValues) | 1) {}
|
||||
|
||||
bool operator==(const NonOwningStyleContextSource& aOther) const {
|
||||
// TODO: remove this servo-specific function.
|
||||
return mBits == aOther.mBits;
|
||||
}
|
||||
bool operator!=(const NonOwningStyleContextSource& aOther) const {
|
||||
@@ -65,13 +58,6 @@ struct OwningStyleContextSource
|
||||
MOZ_ASSERT(!mRaw.IsNull());
|
||||
};
|
||||
|
||||
explicit OwningStyleContextSource(already_AddRefed<ServoComputedValues> aComputedValues)
|
||||
: mRaw(aComputedValues.take())
|
||||
{
|
||||
MOZ_COUNT_CTOR(OwningStyleContextSource);
|
||||
MOZ_ASSERT(!mRaw.IsNull());
|
||||
}
|
||||
|
||||
OwningStyleContextSource(OwningStyleContextSource&& aOther)
|
||||
: mRaw(aOther.mRaw)
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
#include "mozilla/dom/BindingDeclarations.h" // for Optional<>
|
||||
#include "mozilla/dom/CSSRuleList.h"
|
||||
#include "mozilla/dom/ShadowRoot.h"
|
||||
#include "mozilla/ServoStyleSheet.h"
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "mozilla/CSSStyleSheet.h"
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "mozilla/dom/CSSStyleSheetBinding.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
#include "mozilla/CORSMode.h"
|
||||
#include "mozilla/ServoUtils.h"
|
||||
#include "mozilla/DeprecatedUtils.h"
|
||||
|
||||
#include "nsIDOMCSSStyleSheet.h"
|
||||
#include "nsWrapperCache.h"
|
||||
@@ -23,7 +23,6 @@ class nsMediaList;
|
||||
namespace mozilla {
|
||||
|
||||
class CSSStyleSheet;
|
||||
class ServoStyleSheet;
|
||||
struct StyleSheetInfo;
|
||||
|
||||
namespace dom {
|
||||
@@ -32,7 +31,7 @@ class SRIMetadata;
|
||||
} // namespace dom
|
||||
|
||||
/**
|
||||
* Superclass for data common to CSSStyleSheet and ServoStyleSheet.
|
||||
* Superclass for CSSStyleSheet.
|
||||
*/
|
||||
class StyleSheet : public nsIDOMCSSStyleSheet
|
||||
, public nsWrapperCache
|
||||
@@ -65,7 +64,7 @@ public:
|
||||
bool IsComplete() const;
|
||||
void SetComplete();
|
||||
|
||||
MOZ_DECL_STYLO_METHODS(CSSStyleSheet)
|
||||
MOZ_DECL_DEPRECATED_METHODS(CSSStyleSheet)
|
||||
|
||||
// Whether the sheet is for an inline <style> element.
|
||||
inline bool IsInline() const;
|
||||
@@ -189,7 +188,7 @@ public:
|
||||
|
||||
private:
|
||||
// Get a handle to the various stylesheet bits which live on the 'inner' for
|
||||
// gecko stylesheets and live on the StyleSheet for Servo stylesheets.
|
||||
// gecko stylesheets.
|
||||
inline StyleSheetInfo& SheetInfo();
|
||||
inline const StyleSheetInfo& SheetInfo() const;
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class nsIPrincipal;
|
||||
namespace mozilla {
|
||||
|
||||
/**
|
||||
* Struct for data common to CSSStyleSheetInner and ServoStyleSheet.
|
||||
* Struct for data of CSSStyleSheetInner.
|
||||
*/
|
||||
struct StyleSheetInfo
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
MOZ_DEFINE_STYLO_METHODS(StyleSheet, CSSStyleSheet)
|
||||
MOZ_DEFINE_DEPRECATED_METHODS(StyleSheet, CSSStyleSheet)
|
||||
|
||||
StyleSheetInfo&
|
||||
StyleSheet::SheetInfo()
|
||||
|
||||
@@ -14,55 +14,26 @@ class nsDeviceContext;
|
||||
|
||||
/**
|
||||
* Construction context for style structs.
|
||||
*
|
||||
* Certain Gecko style structs have historically taken an nsPresContext
|
||||
* argument in their constructor, which is used to compute various things. This
|
||||
* makes Gecko style structs document-specific (which Servo style structs are
|
||||
* not), and means that the initial values for style-structs cannot be shared
|
||||
* across the entire runtime (as is the case in Servo).
|
||||
*
|
||||
* We'd like to remove this constraint so that Gecko can get the benefits of the
|
||||
* Servo model, and so that Gecko aligns better with the Servo style system when
|
||||
* using it. Unfortunately, this may require a fair amount of work, especially
|
||||
* related to text zoom.
|
||||
*
|
||||
* So as an intermediate step, we define a reduced API set of "things that are
|
||||
* needed when constructing style structs". This just wraps and forwards to an
|
||||
* nsPresContext in the Gecko case, and returns some default not-always-correct
|
||||
* values in the Servo case. We can then focus on reducing this API surface to
|
||||
* zero, at which point this can be removed.
|
||||
*
|
||||
* We don't put the type in namespace mozilla, since we expect it to be
|
||||
* temporary, and the namespacing would clutter up nsStyleStruct.h.
|
||||
* TODO: marked for removal.
|
||||
*/
|
||||
#define SERVO_DEFAULT(default_val) { MOZ_ASSERT(mPresContext); }
|
||||
class StyleStructContext {
|
||||
public:
|
||||
MOZ_IMPLICIT StyleStructContext(nsPresContext* aPresContext)
|
||||
: mPresContext(aPresContext) { MOZ_ASSERT(aPresContext); }
|
||||
static StyleStructContext ServoContext() { return StyleStructContext(); }
|
||||
|
||||
// XXXbholley: Need to make text zoom work with stylo. This probably means
|
||||
// moving the zoom handling out of computed values and into a post-
|
||||
// computation.
|
||||
float TextZoom()
|
||||
{
|
||||
SERVO_DEFAULT(1.0);
|
||||
return mPresContext->TextZoom();
|
||||
}
|
||||
|
||||
const nsFont* GetDefaultFont(uint8_t aFontID)
|
||||
{
|
||||
// NB: The servo case only differ from the default case in terms of which
|
||||
// font pref cache gets used. The distinction is probably unnecessary.
|
||||
SERVO_DEFAULT(mozilla::StaticPresData::Get()->
|
||||
GetDefaultFont(aFontID, GetLanguageFromCharset()));
|
||||
return mPresContext->GetDefaultFont(aFontID, GetLanguageFromCharset());
|
||||
}
|
||||
|
||||
uint32_t GetBidi()
|
||||
{
|
||||
SERVO_DEFAULT(0);
|
||||
return mPresContext->GetBidi();
|
||||
}
|
||||
|
||||
@@ -76,33 +47,27 @@ public:
|
||||
typedef mozilla::LookAndFeel LookAndFeel;
|
||||
nscolor DefaultColor()
|
||||
{
|
||||
SERVO_DEFAULT(LookAndFeel::GetColor(LookAndFeel::eColorID_WindowForeground,
|
||||
NS_RGB(0x00, 0x00, 0x00)));
|
||||
return mPresContext->DefaultColor();
|
||||
}
|
||||
|
||||
mozilla::CounterStyle* BuildCounterStyle(const nsSubstring& aName)
|
||||
{
|
||||
SERVO_DEFAULT(mozilla::CounterStyleManager::GetBuiltinStyle(NS_STYLE_LIST_STYLE_DISC));
|
||||
return mPresContext->CounterStyleManager()->BuildCounterStyle(aName);
|
||||
}
|
||||
|
||||
nsIAtom* GetLanguageFromCharset() const
|
||||
{
|
||||
SERVO_DEFAULT(nsGkAtoms::x_western);
|
||||
return mPresContext->GetLanguageFromCharset();
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAtom> GetContentLanguage() const
|
||||
{
|
||||
SERVO_DEFAULT(do_AddRef(nsGkAtoms::x_western));
|
||||
return mPresContext->GetContentLanguage();
|
||||
}
|
||||
|
||||
private:
|
||||
nsDeviceContext* DeviceContext()
|
||||
{
|
||||
SERVO_DEFAULT(HackilyFindSomeDeviceContext());
|
||||
return mPresContext->DeviceContext();
|
||||
}
|
||||
|
||||
@@ -112,6 +77,4 @@ private:
|
||||
nsPresContext* mPresContext;
|
||||
};
|
||||
|
||||
#undef SERVO_DEFAULT
|
||||
|
||||
#endif // mozilla_StyleStructContext_h
|
||||
|
||||
+1
-16
@@ -81,21 +81,12 @@ EXPORTS.mozilla += [
|
||||
'CSSVariableValues.h',
|
||||
'DeclarationBlock.h',
|
||||
'DeclarationBlockInlines.h',
|
||||
'DocumentStyleRootIterator.h',
|
||||
'DeprecatedUtils.h',
|
||||
'HandleRefPtr.h',
|
||||
'IncrementalClearCOMRuleArray.h',
|
||||
'LayerAnimationInfo.h',
|
||||
'RuleNodeCacheConditions.h',
|
||||
'RuleProcessorCache.h',
|
||||
'ServoBindingList.h',
|
||||
'ServoBindings.h',
|
||||
'ServoBindingTypes.h',
|
||||
'ServoDeclarationBlock.h',
|
||||
'ServoElementSnapshot.h',
|
||||
'ServoStyleSet.h',
|
||||
'ServoStyleSheet.h',
|
||||
'ServoTypes.h',
|
||||
'ServoUtils.h',
|
||||
'SheetType.h',
|
||||
'StyleAnimationValue.h',
|
||||
'StyleComplexColor.h',
|
||||
@@ -144,7 +135,6 @@ UNIFIED_SOURCES += [
|
||||
'CSSVariableResolver.cpp',
|
||||
'CSSVariableValues.cpp',
|
||||
'Declaration.cpp',
|
||||
'DocumentStyleRootIterator.cpp',
|
||||
'ErrorReporter.cpp',
|
||||
'FontFace.cpp',
|
||||
'FontFaceSet.cpp',
|
||||
@@ -189,11 +179,6 @@ UNIFIED_SOURCES += [
|
||||
'nsTransitionManager.cpp',
|
||||
'RuleNodeCacheConditions.cpp',
|
||||
'RuleProcessorCache.cpp',
|
||||
'ServoBindings.cpp',
|
||||
'ServoDeclarationBlock.cpp',
|
||||
'ServoElementSnapshot.cpp',
|
||||
'ServoStyleSet.cpp',
|
||||
'ServoStyleSheet.cpp',
|
||||
'StyleAnimationValue.cpp',
|
||||
'StyleRule.cpp',
|
||||
'StyleSheet.cpp',
|
||||
|
||||
@@ -39,10 +39,6 @@
|
||||
#include "nsCoord.h"
|
||||
#include "nsFontMetrics.h"
|
||||
|
||||
// Ensure the binding function declarations in nsStyleContext.h matches
|
||||
// those in ServoBindings.h.
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -124,18 +120,6 @@ nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
||||
FinishConstruction(aSkipParentDisplayBasedStyleFixup);
|
||||
}
|
||||
|
||||
nsStyleContext::nsStyleContext(nsStyleContext* aParent,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
bool aSkipParentDisplayBasedStyleFixup)
|
||||
: nsStyleContext(aParent, OwningStyleContextSource(Move(aComputedValues)),
|
||||
aPseudoTag, aPseudoType)
|
||||
{
|
||||
FinishConstruction(aSkipParentDisplayBasedStyleFixup);
|
||||
}
|
||||
|
||||
void
|
||||
nsStyleContext::FinishConstruction(bool aSkipParentDisplayBasedStyleFixup)
|
||||
{
|
||||
@@ -644,14 +628,6 @@ ShouldBlockifyChildren(const nsStyleDisplay* aStyleDisp)
|
||||
void
|
||||
nsStyleContext::SetStyleBits()
|
||||
{
|
||||
// XXXbholley: We should get this information directly from the
|
||||
// ServoComputedValues rather than computing it here. This setup for
|
||||
// ServoComputedValues-backed nsStyleContexts is probably not something
|
||||
// we should ship.
|
||||
//
|
||||
// For example, NS_STYLE_IS_TEXT_COMBINED is still set in ApplyStyleFixups,
|
||||
// which isn't called for ServoComputedValues.
|
||||
|
||||
// See if we have any text decorations.
|
||||
// First see if our parent has text decorations. If our parent does, then we inherit the bit.
|
||||
if (mParent && mParent->HasTextDecorationLines()) {
|
||||
@@ -1255,44 +1231,6 @@ nsStyleContext::CalcStyleDifference(nsStyleContext* aNewContext,
|
||||
aEqualStructs, aSamePointerStructs);
|
||||
}
|
||||
|
||||
class MOZ_STACK_CLASS FakeStyleContext
|
||||
{
|
||||
public:
|
||||
explicit FakeStyleContext(const ServoComputedValues* aComputedValues)
|
||||
: mComputedValues(aComputedValues) {}
|
||||
|
||||
mozilla::NonOwningStyleContextSource StyleSource() const {
|
||||
return mozilla::NonOwningStyleContextSource(mComputedValues);
|
||||
}
|
||||
|
||||
nsStyleContext* GetStyleIfVisited() {
|
||||
// XXXbholley: This is wrong. Need to implement to get visited handling
|
||||
// corrrect!
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#define STYLE_STRUCT(name_, checkdata_cb_) \
|
||||
const nsStyle##name_ * Style##name_() { \
|
||||
return Servo_GetStyle##name_(mComputedValues); \
|
||||
}
|
||||
#include "nsStyleStructList.h"
|
||||
#undef STYLE_STRUCT
|
||||
|
||||
private:
|
||||
const ServoComputedValues* MOZ_NON_OWNING_REF mComputedValues;
|
||||
};
|
||||
|
||||
nsChangeHint
|
||||
nsStyleContext::CalcStyleDifference(const ServoComputedValues* aNewComputedValues,
|
||||
nsChangeHint aParentHintsNotHandledForDescendants,
|
||||
uint32_t* aEqualStructs,
|
||||
uint32_t* aSamePointerStructs)
|
||||
{
|
||||
FakeStyleContext newContext(aNewComputedValues);
|
||||
return CalcStyleDifferenceInternal(&newContext, aParentHintsNotHandledForDescendants,
|
||||
aEqualStructs, aSamePointerStructs);
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
void nsStyleContext::List(FILE* out, int32_t aIndent, bool aListDescendants)
|
||||
{
|
||||
@@ -1392,21 +1330,6 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
return context.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
bool aSkipParentDisplayBasedStyleFixup)
|
||||
{
|
||||
RefPtr<nsStyleContext> context =
|
||||
new (aPresContext)
|
||||
nsStyleContext(aParentContext, aPresContext, aPseudoTag, aPseudoType,
|
||||
Move(aComputedValues), aSkipParentDisplayBasedStyleFixup);
|
||||
return context.forget();
|
||||
}
|
||||
|
||||
nsIPresShell*
|
||||
nsStyleContext::Arena()
|
||||
{
|
||||
|
||||
@@ -21,15 +21,6 @@ namespace mozilla {
|
||||
enum class CSSPseudoElementType : uint8_t;
|
||||
} // namespace mozilla
|
||||
|
||||
extern "C" {
|
||||
#define STYLE_STRUCT(name_, checkdata_cb_) \
|
||||
struct nsStyle##name_; \
|
||||
const nsStyle##name_* Servo_GetStyle##name_( \
|
||||
ServoComputedValuesBorrowedOrNull computed_values);
|
||||
#include "nsStyleStructList.h"
|
||||
#undef STYLE_STRUCT
|
||||
}
|
||||
|
||||
/**
|
||||
* An nsStyleContext represents the computed style data for an element.
|
||||
* The computed style data are stored in a set of structs (see
|
||||
@@ -82,15 +73,6 @@ public:
|
||||
already_AddRefed<nsRuleNode> aRuleNode,
|
||||
bool aSkipParentDisplayBasedStyleFixup);
|
||||
|
||||
// Version of the above that takes a ServoComputedValues instead of a Gecko
|
||||
// nsRuleNode.
|
||||
nsStyleContext(nsStyleContext* aParent,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
mozilla::CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
bool aSkipParentDisplayBasedStyleFixup);
|
||||
|
||||
void* operator new(size_t sz, nsPresContext* aPresContext);
|
||||
void Destroy();
|
||||
|
||||
@@ -383,15 +365,6 @@ public:
|
||||
uint32_t* aEqualStructs,
|
||||
uint32_t* aSamePointerStructs);
|
||||
|
||||
/**
|
||||
* Like the above, but allows comparing ServoComputedValues instead of needing
|
||||
* a full-fledged style context.
|
||||
*/
|
||||
nsChangeHint CalcStyleDifference(const ServoComputedValues* aNewComputedValues,
|
||||
nsChangeHint aParentHintsNotHandledForDescendants,
|
||||
uint32_t* aEqualStructs,
|
||||
uint32_t* aSamePointerStructs);
|
||||
|
||||
private:
|
||||
template<class StyleContextLike>
|
||||
nsChangeHint CalcStyleDifferenceInternal(StyleContextLike* aNewContext,
|
||||
@@ -643,8 +616,8 @@ private:
|
||||
// the relevant atom.
|
||||
nsCOMPtr<nsIAtom> mPseudoTag;
|
||||
|
||||
// The source for our style data, either a Gecko nsRuleNode or a Servo
|
||||
// ComputedValues struct. This never changes after construction, except
|
||||
// The source for our style data, a nsRuleNode struct.
|
||||
// This never changes after construction, except
|
||||
// when it's released and nulled out during teardown.
|
||||
const mozilla::OwningStyleContextSource mSource;
|
||||
|
||||
@@ -694,12 +667,4 @@ NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsRuleNode* aRuleNode,
|
||||
bool aSkipParentDisplayBasedStyleFixup);
|
||||
|
||||
already_AddRefed<nsStyleContext>
|
||||
NS_NewStyleContext(nsStyleContext* aParentContext,
|
||||
nsPresContext* aPresContext,
|
||||
nsIAtom* aPseudoTag,
|
||||
mozilla::CSSPseudoElementType aPseudoType,
|
||||
already_AddRefed<ServoComputedValues> aComputedValues,
|
||||
bool aSkipParentDisplayBasedStyleFixup);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -748,9 +748,6 @@ void
|
||||
nsStyleSet::AppendAllXBLStyleSheets(nsTArray<mozilla::CSSStyleSheet*>& aArray) const
|
||||
{
|
||||
if (mBindingManager) {
|
||||
// XXXheycam stylo: AppendAllSheets will need to be able to return either
|
||||
// CSSStyleSheets or ServoStyleSheets, on request (and then here requesting
|
||||
// CSSStyleSheets).
|
||||
AutoTArray<StyleSheet*, 32> sheets;
|
||||
mBindingManager->AppendAllSheets(sheets);
|
||||
for (StyleSheet* handle : sheets) {
|
||||
@@ -2468,9 +2465,6 @@ nsStyleSet::EnsureUniqueInnerOnCSSSheets()
|
||||
|
||||
if (mBindingManager) {
|
||||
AutoTArray<StyleSheet*, 32> sheets;
|
||||
// XXXheycam stylo: AppendAllSheets will need to be able to return either
|
||||
// CSSStyleSheets or ServoStyleSheets, on request (and then here requesting
|
||||
// CSSStyleSheets).
|
||||
mBindingManager->AppendAllSheets(sheets);
|
||||
for (StyleSheet* sheet : sheets) {
|
||||
queue.AppendElement(sheet->AsGecko());
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/ScopeExit.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/ServoBindings.h"
|
||||
|
||||
#include "nsAppRunner.h"
|
||||
#include "mozilla/AppData.h"
|
||||
|
||||
Reference in New Issue
Block a user