зеркало из https://github.com/mozilla/gecko-dev.git
Bug 733305, add a way to hide XBL, r=bz, a=bbajaj
This commit is contained in:
Родитель
7a8006dc39
Коммит
b1edbf02d0
|
@ -35,8 +35,8 @@ enum nsLinkState {
|
|||
|
||||
// IID for the nsIContent interface
|
||||
#define NS_ICONTENT_IID \
|
||||
{ 0x98fb308d, 0xc6dd, 0x4c6d, \
|
||||
{ 0xb7, 0x7c, 0x91, 0x18, 0x0c, 0xf0, 0x6f, 0x23 } }
|
||||
{ 0xe2985850, 0x81ca, 0x4b5d, \
|
||||
{ 0xb0, 0xf3, 0xe3, 0x95, 0xd5, 0x0d, 0x85, 0x64 } }
|
||||
|
||||
/**
|
||||
* A node of content in a document's content model. This interface
|
||||
|
@ -177,6 +177,12 @@ public:
|
|||
return HasFlag(NODE_IS_NATIVE_ANONYMOUS_ROOT);
|
||||
}
|
||||
|
||||
bool IsRootOfChromeAccessOnlySubtree() const
|
||||
{
|
||||
return HasFlag(NODE_IS_NATIVE_ANONYMOUS_ROOT |
|
||||
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Makes this content anonymous
|
||||
* @see nsIAnonymousContentCreator
|
||||
|
@ -188,10 +194,10 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns |this| if it is not native anonymous, otherwise
|
||||
* first non native anonymous ancestor.
|
||||
* Returns |this| if it is not chrome-only/native anonymous, otherwise
|
||||
* first non chrome-only/native anonymous ancestor.
|
||||
*/
|
||||
virtual nsIContent* FindFirstNonNativeAnonymous() const;
|
||||
virtual nsIContent* FindFirstNonChromeOnlyAccessContent() const;
|
||||
|
||||
/**
|
||||
* Returns true if and only if this node has a parent, but is not in
|
||||
|
|
|
@ -155,8 +155,12 @@ enum {
|
|||
NODE_ALL_DIRECTION_FLAGS = NODE_HAS_DIRECTION_LTR |
|
||||
NODE_HAS_DIRECTION_RTL,
|
||||
|
||||
NODE_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(22),
|
||||
|
||||
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS = NODE_FLAG_BIT(23),
|
||||
|
||||
// Remaining bits are node type specific.
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 22
|
||||
NODE_TYPE_SPECIFIC_BITS_OFFSET = 24
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -239,8 +243,8 @@ private:
|
|||
|
||||
// IID for the nsINode interface
|
||||
#define NS_INODE_IID \
|
||||
{ 0xf73e3890, 0xe4ab, 0x453e, \
|
||||
{ 0x8c, 0x78, 0x2d, 0x1f, 0xa4, 0x0b, 0x48, 0x00 } }
|
||||
{ 0x9aede57e, 0xe39e, 0x42e8, \
|
||||
{ 0x8d, 0x33, 0x7a, 0xc3, 0xd0, 0xbb, 0x5b, 0xf9 } }
|
||||
|
||||
/**
|
||||
* An internal interface that abstracts some DOMNode-related parts that both
|
||||
|
@ -911,7 +915,8 @@ public:
|
|||
NODE_IS_IN_ANONYMOUS_SUBTREE |
|
||||
NODE_ATTACH_BINDING_ON_POSTCREATE |
|
||||
NODE_DESCENDANTS_NEED_FRAMES |
|
||||
NODE_NEEDS_FRAME)) ||
|
||||
NODE_NEEDS_FRAME |
|
||||
NODE_CHROME_ONLY_ACCESS)) ||
|
||||
IsNodeOfType(eCONTENT),
|
||||
"Flag only permitted on nsIContent nodes");
|
||||
mFlags |= aFlagsToSet;
|
||||
|
@ -962,6 +967,13 @@ public:
|
|||
#endif
|
||||
}
|
||||
|
||||
// True for native anonymous content and for XBL content if the binging
|
||||
// has chromeOnlyContent="true".
|
||||
bool ChromeOnlyAccess() const
|
||||
{
|
||||
return HasFlag(NODE_IS_IN_ANONYMOUS_SUBTREE | NODE_CHROME_ONLY_ACCESS);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if |this| node is the common ancestor of the start/end
|
||||
* nodes of a Range in a Selection or a descendant of such a common ancestor.
|
||||
|
|
|
@ -135,12 +135,12 @@ bool nsIContent::sTabFocusModelAppliesToXUL = false;
|
|||
uint32_t nsMutationGuard::sMutationCount = 0;
|
||||
|
||||
nsIContent*
|
||||
nsIContent::FindFirstNonNativeAnonymous() const
|
||||
nsIContent::FindFirstNonChromeOnlyAccessContent() const
|
||||
{
|
||||
// This handles also nested native anonymous content.
|
||||
for (const nsIContent *content = this; content;
|
||||
content = content->GetBindingParent()) {
|
||||
if (!content->IsInNativeAnonymousSubtree()) {
|
||||
if (!content->ChromeOnlyAccess()) {
|
||||
// Oops, this function signature allows casting const to
|
||||
// non-const. (Then again, so does GetChildAt(0)->GetParent().)
|
||||
return const_cast<nsIContent*>(content);
|
||||
|
@ -851,12 +851,12 @@ FragmentOrElement::GetChildren(uint32_t aFilter)
|
|||
}
|
||||
|
||||
static nsIContent*
|
||||
FindNativeAnonymousSubtreeOwner(nsIContent* aContent)
|
||||
FindChromeAccessOnlySubtreeOwner(nsIContent* aContent)
|
||||
{
|
||||
if (aContent->IsInNativeAnonymousSubtree()) {
|
||||
bool isNativeAnon = false;
|
||||
while (aContent && !isNativeAnon) {
|
||||
isNativeAnon = aContent->IsRootOfNativeAnonymousSubtree();
|
||||
if (aContent->ChromeOnlyAccess()) {
|
||||
bool chromeAccessOnly = false;
|
||||
while (aContent && !chromeAccessOnly) {
|
||||
chromeAccessOnly = aContent->IsRootOfChromeAccessOnlySubtree();
|
||||
aContent = aContent->GetParent();
|
||||
}
|
||||
}
|
||||
|
@ -871,15 +871,15 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|||
aVisitor.mMayHaveListenerManager = HasListenerManager();
|
||||
|
||||
// Don't propagate mouseover and mouseout events when mouse is moving
|
||||
// inside native anonymous content.
|
||||
bool isAnonForEvents = IsRootOfNativeAnonymousSubtree();
|
||||
// inside chrome access only content.
|
||||
bool isAnonForEvents = IsRootOfChromeAccessOnlySubtree();
|
||||
if ((aVisitor.mEvent->message == NS_MOUSE_ENTER_SYNTH ||
|
||||
aVisitor.mEvent->message == NS_MOUSE_EXIT_SYNTH) &&
|
||||
// Check if we should stop event propagation when event has just been
|
||||
// dispatched or when we're about to propagate from
|
||||
// native anonymous subtree.
|
||||
// chrome access only subtree.
|
||||
((this == aVisitor.mEvent->originalTarget &&
|
||||
!IsInNativeAnonymousSubtree()) || isAnonForEvents)) {
|
||||
!ChromeOnlyAccess()) || isAnonForEvents)) {
|
||||
nsCOMPtr<nsIContent> relatedTarget =
|
||||
do_QueryInterface(static_cast<nsMouseEvent*>
|
||||
(aVisitor.mEvent)->relatedTarget);
|
||||
|
@ -894,19 +894,19 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|||
if (isAnonForEvents || aVisitor.mRelatedTargetIsInAnon ||
|
||||
(aVisitor.mEvent->originalTarget == this &&
|
||||
(aVisitor.mRelatedTargetIsInAnon =
|
||||
relatedTarget->IsInNativeAnonymousSubtree()))) {
|
||||
nsIContent* anonOwner = FindNativeAnonymousSubtreeOwner(this);
|
||||
relatedTarget->ChromeOnlyAccess()))) {
|
||||
nsIContent* anonOwner = FindChromeAccessOnlySubtreeOwner(this);
|
||||
if (anonOwner) {
|
||||
nsIContent* anonOwnerRelated =
|
||||
FindNativeAnonymousSubtreeOwner(relatedTarget);
|
||||
FindChromeAccessOnlySubtreeOwner(relatedTarget);
|
||||
if (anonOwnerRelated) {
|
||||
// Note, anonOwnerRelated may still be inside some other
|
||||
// native anonymous subtree. The case where anonOwner is still
|
||||
// inside native anonymous subtree will be handled when event
|
||||
// propagates up in the DOM tree.
|
||||
while (anonOwner != anonOwnerRelated &&
|
||||
anonOwnerRelated->IsInNativeAnonymousSubtree()) {
|
||||
anonOwnerRelated = FindNativeAnonymousSubtreeOwner(anonOwnerRelated);
|
||||
anonOwnerRelated->ChromeOnlyAccess()) {
|
||||
anonOwnerRelated = FindChromeAccessOnlySubtreeOwner(anonOwnerRelated);
|
||||
}
|
||||
if (anonOwner == anonOwnerRelated) {
|
||||
#ifdef DEBUG_smaug
|
||||
|
@ -927,13 +927,14 @@ nsIContent::PreHandleEvent(nsEventChainPreVisitor& aVisitor)
|
|||
NS_ConvertUTF16toUTF8(ct).get(),
|
||||
isAnonForEvents
|
||||
? "(is native anonymous)"
|
||||
: (IsInNativeAnonymousSubtree()
|
||||
: (ChromeOnlyAccess()
|
||||
? "(is in native anonymous subtree)" : ""),
|
||||
NS_ConvertUTF16toUTF8(rt).get(),
|
||||
relatedTarget->IsInNativeAnonymousSubtree()
|
||||
relatedTarget->ChromeOnlyAccess()
|
||||
? "(is in native anonymous subtree)" : "",
|
||||
(originalTarget && relatedTarget->FindFirstNonNativeAnonymous() ==
|
||||
originalTarget->FindFirstNonNativeAnonymous())
|
||||
(originalTarget &&
|
||||
relatedTarget->FindFirstNonChromeOnlyAccessContent() ==
|
||||
originalTarget->FindFirstNonChromeOnlyAccessContent())
|
||||
? "" : "Wrong event propagation!?!\n");
|
||||
#endif
|
||||
aVisitor.mParentTarget = nullptr;
|
||||
|
|
|
@ -3840,7 +3840,7 @@ nsContentUtils::HasMutationListeners(nsINode* aNode,
|
|||
}
|
||||
|
||||
if (aNode->IsNodeOfType(nsINode::eCONTENT) &&
|
||||
static_cast<nsIContent*>(aNode)->IsInNativeAnonymousSubtree()) {
|
||||
static_cast<nsIContent*>(aNode)->ChromeOnlyAccess()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -176,7 +176,7 @@ nsMutationReceiver::AttributeWillChange(nsIDocument* aDocument,
|
|||
{
|
||||
if (nsAutoMutationBatch::IsBatching() ||
|
||||
!ObservesAttr(aElement, aNameSpaceID, aAttribute) ||
|
||||
aElement->IsInNativeAnonymousSubtree()) {
|
||||
aElement->ChromeOnlyAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ nsMutationReceiver::CharacterDataWillChange(nsIDocument *aDocument,
|
|||
{
|
||||
if (nsAutoMutationBatch::IsBatching() ||
|
||||
!CharacterData() || !(Subtree() || aContent == Target()) ||
|
||||
aContent->IsInNativeAnonymousSubtree()) {
|
||||
aContent->ChromeOnlyAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -239,7 +239,7 @@ nsMutationReceiver::ContentAppended(nsIDocument* aDocument,
|
|||
{
|
||||
nsINode* parent = NODE_FROM(aContainer, aDocument);
|
||||
bool wantsChildList = ChildList() && (Subtree() || parent == Target());
|
||||
if (!wantsChildList || aFirstNewContent->IsInNativeAnonymousSubtree()) {
|
||||
if (!wantsChildList || aFirstNewContent->ChromeOnlyAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -277,7 +277,7 @@ nsMutationReceiver::ContentInserted(nsIDocument* aDocument,
|
|||
{
|
||||
nsINode* parent = NODE_FROM(aContainer, aDocument);
|
||||
bool wantsChildList = ChildList() && (Subtree() || parent == Target());
|
||||
if (!wantsChildList || aChild->IsInNativeAnonymousSubtree()) {
|
||||
if (!wantsChildList || aChild->ChromeOnlyAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -308,7 +308,7 @@ nsMutationReceiver::ContentRemoved(nsIDocument* aDocument,
|
|||
int32_t aIndexInContainer,
|
||||
nsIContent* aPreviousSibling)
|
||||
{
|
||||
if (aChild->IsInNativeAnonymousSubtree()) {
|
||||
if (aChild->ChromeOnlyAccess()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -2859,8 +2859,8 @@ nsDocument::GetActiveElement(nsIDOMElement **aElement)
|
|||
getter_AddRefs(focusedWindow));
|
||||
// be safe and make sure the element is from this document
|
||||
if (focusedContent && focusedContent->OwnerDoc() == this) {
|
||||
if (focusedContent->IsInNativeAnonymousSubtree()) {
|
||||
focusedContent = focusedContent->FindFirstNonNativeAnonymous();
|
||||
if (focusedContent->ChromeOnlyAccess()) {
|
||||
focusedContent = focusedContent->FindFirstNonChromeOnlyAccessContent();
|
||||
}
|
||||
if (focusedContent) {
|
||||
CallQueryInterface(focusedContent, aElement);
|
||||
|
@ -7583,7 +7583,7 @@ nsDocument::MutationEventDispatched(nsINode* aTarget)
|
|||
for (int32_t i = 0; i < count; ++i) {
|
||||
nsINode* possibleTarget = mSubtreeModifiedTargets[i];
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(possibleTarget);
|
||||
if (content && content->IsInNativeAnonymousSubtree()) {
|
||||
if (content && content->ChromeOnlyAccess()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
|
@ -467,6 +467,9 @@ nsGenericDOMDataNode::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
if (aParent->IsInNativeAnonymousSubtree()) {
|
||||
SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
|
||||
}
|
||||
if (aParent->HasFlag(NODE_CHROME_ONLY_ACCESS)) {
|
||||
SetFlags(NODE_CHROME_ONLY_ACCESS);
|
||||
}
|
||||
}
|
||||
|
||||
// Set parent
|
||||
|
|
|
@ -1300,8 +1300,13 @@ nsGenericElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
(aParent && aParent->IsInNativeAnonymousSubtree()),
|
||||
"Trying to re-bind content from native anonymous subtree to "
|
||||
"non-native anonymous parent!");
|
||||
if (aParent && aParent->IsInNativeAnonymousSubtree()) {
|
||||
SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
|
||||
if (aParent) {
|
||||
if (aParent->IsInNativeAnonymousSubtree()) {
|
||||
SetFlags(NODE_IS_IN_ANONYMOUS_SUBTREE);
|
||||
}
|
||||
if (aParent->HasFlag(NODE_CHROME_ONLY_ACCESS)) {
|
||||
SetFlags(NODE_CHROME_ONLY_ACCESS);
|
||||
}
|
||||
}
|
||||
|
||||
bool hadForceXBL = HasFlag(NODE_FORCE_XBL_BINDINGS);
|
||||
|
|
|
@ -172,6 +172,7 @@ GK_ATOM(child, "child")
|
|||
GK_ATOM(children, "children")
|
||||
GK_ATOM(choose, "choose")
|
||||
GK_ATOM(chromemargin, "chromemargin")
|
||||
GK_ATOM(chromeOnlyContent, "chromeOnlyContent")
|
||||
GK_ATOM(circ, "circ")
|
||||
GK_ATOM(circle, "circle")
|
||||
GK_ATOM(cite, "cite")
|
||||
|
|
|
@ -261,9 +261,9 @@ nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
|
|||
|
||||
if (relatedTarget) {
|
||||
nsCOMPtr<nsIContent> content = do_QueryInterface(relatedTarget);
|
||||
if (content && content->IsInNativeAnonymousSubtree() &&
|
||||
if (content && content->ChromeOnlyAccess() &&
|
||||
!nsContentUtils::CanAccessNativeAnon()) {
|
||||
relatedTarget = content->FindFirstNonNativeAnonymous();
|
||||
relatedTarget = content->FindFirstNonChromeOnlyAccessContent();
|
||||
if (!relatedTarget) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -254,7 +254,7 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
|||
targetFrame);
|
||||
nsCOMPtr<nsIContent> parent = targetFrame->GetContentOffsetsFromPoint(pt).content;
|
||||
if (parent) {
|
||||
if (parent->IsInNativeAnonymousSubtree() &&
|
||||
if (parent->ChromeOnlyAccess() &&
|
||||
!nsContentUtils::CanAccessNativeAnon()) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -468,7 +468,7 @@ nsEventDispatcher::Dispatch(nsISupports* aTarget,
|
|||
nsCOMPtr<nsIContent> content = do_QueryInterface(target);
|
||||
if (content && content->IsInNativeAnonymousSubtree()) {
|
||||
nsCOMPtr<nsPIDOMEventTarget> newTarget =
|
||||
do_QueryInterface(content->FindFirstNonNativeAnonymous());
|
||||
do_QueryInterface(content->FindFirstNonChromeOnlyAccessContent());
|
||||
NS_ENSURE_STATE(newTarget);
|
||||
|
||||
aEvent->originalTarget = target;
|
||||
|
|
|
@ -3945,7 +3945,7 @@ public:
|
|||
aTarget ? aTarget->OwnerDoc()->GetInnerWindow() : nullptr;
|
||||
if (win && win->HasMouseEnterLeaveEventListeners()) {
|
||||
mRelatedTarget = aRelatedTarget ?
|
||||
aRelatedTarget->FindFirstNonNativeAnonymous() : nullptr;
|
||||
aRelatedTarget->FindFirstNonChromeOnlyAccessContent() : nullptr;
|
||||
nsINode* commonParent = nullptr;
|
||||
if (aTarget && aRelatedTarget) {
|
||||
commonParent =
|
||||
|
@ -3954,7 +3954,7 @@ public:
|
|||
nsIContent* current = aTarget;
|
||||
// Note, it is ok if commonParent is null!
|
||||
while (current && current != commonParent) {
|
||||
if (!current->IsInNativeAnonymousSubtree()) {
|
||||
if (!current->ChromeOnlyAccess()) {
|
||||
mTargets.AppendObject(current);
|
||||
}
|
||||
// mouseenter/leave is fired only on elements.
|
||||
|
|
|
@ -465,7 +465,8 @@ nsXBLBinding::SetBaseBinding(nsXBLBinding* aBinding)
|
|||
}
|
||||
|
||||
void
|
||||
nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElement)
|
||||
nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElement,
|
||||
bool aChromeOnlyContent)
|
||||
{
|
||||
// We need to ensure two things.
|
||||
// (1) The anonymous content should be fooled into thinking it's in the bound
|
||||
|
@ -484,6 +485,10 @@ nsXBLBinding::InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElem
|
|||
child;
|
||||
child = child->GetNextSibling()) {
|
||||
child->UnbindFromTree();
|
||||
if (aChromeOnlyContent) {
|
||||
child->SetFlags(NODE_CHROME_ONLY_ACCESS |
|
||||
NODE_IS_ROOT_OF_CHROME_ONLY_ACCESS);
|
||||
}
|
||||
nsresult rv =
|
||||
child->BindToTree(doc, aElement, mBoundElement, allowScripts);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
@ -693,7 +698,9 @@ RealizeDefaultContent(nsISupports* aKey,
|
|||
// Now that we have the cloned content, install the default content as
|
||||
// if it were additional anonymous content.
|
||||
nsCOMPtr<nsIContent> clonedContent(do_QueryInterface(clonedNode));
|
||||
binding->InstallAnonymousContent(clonedContent, insParent);
|
||||
binding->InstallAnonymousContent(clonedContent, insParent,
|
||||
binding->PrototypeBinding()->
|
||||
ChromeOnlyContent());
|
||||
|
||||
// Cache the clone so that it can be properly destroyed if/when our
|
||||
// other anonymous content is destroyed.
|
||||
|
@ -805,7 +812,8 @@ nsXBLBinding::GenerateAnonymousContent()
|
|||
nodesWithProperties, getter_AddRefs(clonedNode));
|
||||
|
||||
mContent = do_QueryInterface(clonedNode);
|
||||
InstallAnonymousContent(mContent, mBoundElement);
|
||||
InstallAnonymousContent(mContent, mBoundElement,
|
||||
mPrototypeBinding->ChromeOnlyContent());
|
||||
|
||||
if (hasInsertionPoints) {
|
||||
// Now check and see if we have a single insertion point
|
||||
|
|
|
@ -69,7 +69,8 @@ public:
|
|||
bool ImplementsInterface(REFNSIID aIID) const;
|
||||
|
||||
void GenerateAnonymousContent();
|
||||
void InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElement);
|
||||
void InstallAnonymousContent(nsIContent* aAnonParent, nsIContent* aElement,
|
||||
bool aNativeAnon);
|
||||
static void UninstallAnonymousContent(nsIDocument* aDocument,
|
||||
nsIContent* aAnonParent);
|
||||
void InstallEventHandlers();
|
||||
|
|
|
@ -274,6 +274,7 @@ nsXBLPrototypeBinding::nsXBLPrototypeBinding()
|
|||
mInheritStyle(true),
|
||||
mCheckedBaseProto(false),
|
||||
mKeyHandlersRegistered(false),
|
||||
mChromeOnlyContent(false),
|
||||
mResources(nullptr),
|
||||
mAttributeTable(nullptr),
|
||||
mInsertionPointTable(nullptr),
|
||||
|
@ -442,6 +443,11 @@ nsXBLPrototypeBinding::SetBindingElement(nsIContent* aElement)
|
|||
if (mBinding->AttrValueIs(kNameSpaceID_None, nsGkAtoms::inheritstyle,
|
||||
nsGkAtoms::_false, eCaseMatters))
|
||||
mInheritStyle = false;
|
||||
|
||||
mChromeOnlyContent = IsChrome() &&
|
||||
mBinding->AttrValueIs(kNameSpaceID_None,
|
||||
nsGkAtoms::chromeOnlyContent,
|
||||
nsGkAtoms::_true, eCaseMatters);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -1466,6 +1472,8 @@ nsXBLPrototypeBinding::Read(nsIObjectInputStream* aStream,
|
|||
uint8_t aFlags)
|
||||
{
|
||||
mInheritStyle = (aFlags & XBLBinding_Serialize_InheritStyle) ? true : false;
|
||||
mChromeOnlyContent =
|
||||
(aFlags & XBLBinding_Serialize_ChromeOnlyContent) ? true : false;
|
||||
|
||||
// nsXBLContentSink::ConstructBinding doesn't create a binding with an empty
|
||||
// id, so we don't here either.
|
||||
|
@ -1676,6 +1684,10 @@ nsXBLPrototypeBinding::Write(nsIObjectOutputStream* aStream)
|
|||
flags |= XBLBinding_Serialize_IsFirstBinding;
|
||||
}
|
||||
|
||||
if (mChromeOnlyContent) {
|
||||
flags |= XBLBinding_Serialize_ChromeOnlyContent;
|
||||
}
|
||||
|
||||
nsresult rv = aStream->Write8(flags);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
|
|
|
@ -192,6 +192,8 @@ public:
|
|||
* aFlags can contain XBLBinding_Serialize_InheritStyle to indicate that
|
||||
* mInheritStyle flag should be set, and XBLBinding_Serialize_IsFirstBinding
|
||||
* to indicate the first binding in a document.
|
||||
* XBLBinding_Serialize_ChromeOnlyContent indicates that
|
||||
* nsXBLPrototypeBinding::mChromeOnlyContent should be true.
|
||||
*/
|
||||
nsresult Read(nsIObjectInputStream* aStream,
|
||||
nsXBLDocumentInfo* aDocInfo,
|
||||
|
@ -301,6 +303,7 @@ public:
|
|||
nsIContent* aCopyRoot,
|
||||
nsIContent* aTemplChild);
|
||||
|
||||
bool ChromeOnlyContent() { return mChromeOnlyContent; }
|
||||
protected:
|
||||
// Ensure that mAttributeTable has been created.
|
||||
void EnsureAttributeTable();
|
||||
|
@ -332,6 +335,7 @@ protected:
|
|||
bool mInheritStyle;
|
||||
bool mCheckedBaseProto;
|
||||
bool mKeyHandlersRegistered;
|
||||
bool mChromeOnlyContent;
|
||||
|
||||
nsXBLPrototypeResources* mResources; // If we have any resources, this will be non-null.
|
||||
|
||||
|
|
|
@ -25,6 +25,9 @@ typedef uint8_t XBLBindingSerializeDetails;
|
|||
// Set to indicate that nsXBLPrototypeBinding::mInheritStyle should be true
|
||||
#define XBLBinding_Serialize_InheritStyle 2
|
||||
|
||||
// Set to indicate that nsXBLPrototypeBinding::mChromeOnlyContent should be true
|
||||
#define XBLBinding_Serialize_ChromeOnlyContent 4
|
||||
|
||||
// Appears at the end of the serialized data to indicate that no more bindings
|
||||
// are present for this document.
|
||||
#define XBLBinding_Serialize_NoMoreBindings 0x80
|
||||
|
|
|
@ -7856,7 +7856,7 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
|||
}
|
||||
|
||||
// No slim wrappers for a document's scope object.
|
||||
return node->IsInNativeAnonymousSubtree() ?
|
||||
return node->ChromeOnlyAccess() ?
|
||||
NS_SUCCESS_CHROME_ACCESS_ONLY : NS_OK;
|
||||
}
|
||||
|
||||
|
@ -7868,7 +7868,7 @@ nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
|||
nsresult rv = WrapNativeParent(cx, globalObj, native_parent, parentObj);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return node->IsInNativeAnonymousSubtree() ?
|
||||
return node->ChromeOnlyAccess() ?
|
||||
NS_SUCCESS_CHROME_ACCESS_ONLY : NS_SUCCESS_ALLOW_SLIM_WRAPPERS;
|
||||
}
|
||||
|
||||
|
|
|
@ -979,8 +979,8 @@ bool
|
|||
nsEditorEventListener::IsFileControlTextBox()
|
||||
{
|
||||
dom::Element* root = mEditor->GetRoot();
|
||||
if (root && root->IsInNativeAnonymousSubtree()) {
|
||||
nsIContent* parent = root->FindFirstNonNativeAnonymous();
|
||||
if (root && root->ChromeOnlyAccess()) {
|
||||
nsIContent* parent = root->FindFirstNonChromeOnlyAccessContent();
|
||||
if (parent && parent->IsHTML(nsGkAtoms::input)) {
|
||||
nsCOMPtr<nsIFormControl> formControl = do_QueryInterface(parent);
|
||||
MOZ_ASSERT(formControl);
|
||||
|
|
|
@ -248,13 +248,13 @@ nsFindContentIterator::Reset()
|
|||
// see if the start node is an anonymous text node inside a text control
|
||||
nsCOMPtr<nsIContent> startContent(do_QueryInterface(mStartNode));
|
||||
if (startContent) {
|
||||
mStartOuterContent = startContent->FindFirstNonNativeAnonymous();
|
||||
mStartOuterContent = startContent->FindFirstNonChromeOnlyAccessContent();
|
||||
}
|
||||
|
||||
// see if the end node is an anonymous text node inside a text control
|
||||
nsCOMPtr<nsIContent> endContent(do_QueryInterface(mEndNode));
|
||||
if (endContent) {
|
||||
mEndOuterContent = endContent->FindFirstNonNativeAnonymous();
|
||||
mEndOuterContent = endContent->FindFirstNonChromeOnlyAccessContent();
|
||||
}
|
||||
|
||||
// Note: OK to just set up the outer iterator here; if our range has a native
|
||||
|
|
|
@ -6749,7 +6749,7 @@ PresShell::PrepareToUseCaretPosition(nsIWidget* aEventWidget, nsIntPoint& aTarge
|
|||
NS_ENSURE_TRUE(node, false);
|
||||
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
|
||||
if (content) {
|
||||
nsIContent* nonNative = content->FindFirstNonNativeAnonymous();
|
||||
nsIContent* nonNative = content->FindFirstNonChromeOnlyAccessContent();
|
||||
content = nonNative;
|
||||
}
|
||||
|
||||
|
|
|
@ -349,7 +349,7 @@ nsResizerFrame::GetContentToResize(nsIPresShell* aPresShell, nsIBaseWindow** aWi
|
|||
if (!isChromeShell) {
|
||||
// don't allow resizers in content shells, except for the viewport
|
||||
// scrollbar which doesn't have a parent
|
||||
nsIContent* nonNativeAnon = mContent->FindFirstNonNativeAnonymous();
|
||||
nsIContent* nonNativeAnon = mContent->FindFirstNonChromeOnlyAccessContent();
|
||||
if (!nonNativeAnon || nonNativeAnon->GetParent()) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -375,7 +375,7 @@ nsResizerFrame::GetContentToResize(nsIPresShell* aPresShell, nsIBaseWindow** aWi
|
|||
if (elementid.EqualsLiteral("_parent")) {
|
||||
// return the parent, but skip over native anonymous content
|
||||
nsIContent* parent = mContent->GetParent();
|
||||
return parent ? parent->FindFirstNonNativeAnonymous() : nullptr;
|
||||
return parent ? parent->FindFirstNonChromeOnlyAccessContent() : nullptr;
|
||||
}
|
||||
|
||||
return aPresShell->GetDocument()->GetElementById(elementid);
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
xmlns="http://www.mozilla.org/xbl"
|
||||
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
<binding id="pluginProblem" inheritstyle="false">
|
||||
<binding id="pluginProblem" inheritstyle="false" chromeOnlyContent="true">
|
||||
<resources>
|
||||
<stylesheet src="chrome://mozapps/content/plugins/pluginProblemContent.css"/>
|
||||
<stylesheet src="chrome://mozapps/skin/plugins/pluginProblem.css"/>
|
||||
|
|
Загрузка…
Ссылка в новой задаче