mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 15:52:07 +00:00
Bug 1571650: Add an API to change the style of AnonymousContent from devtools. r=smaug
DevTools is using AnonymousContent to highlight the element inspecting. And now, the z-order of highlighting became to be importance. In case of normal element, we can change the z-order by z-index or order of DOM. However, AnonymousContent does not have the such the way to change the z-order from DevTools side. This patch introduces an API to change the style, and makes the z-order changeable by the z-index. Differential Revision: https://phabricator.services.mozilla.com/D41927 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
fbd2729e3f
commit
c6a47f400c
@ -207,5 +207,17 @@ void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult) {
|
||||
aResult.SetNull();
|
||||
}
|
||||
|
||||
void AnonymousContent::SetStyle(const nsAString& aProperty,
|
||||
const nsAString& aValue, ErrorResult& aRv) {
|
||||
if (!mContentNode->IsHTMLElement()) {
|
||||
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
||||
return;
|
||||
}
|
||||
|
||||
nsGenericHTMLElement* element = nsGenericHTMLElement::FromNode(mContentNode);
|
||||
nsCOMPtr<nsICSSDeclaration> declaration = element->Style();
|
||||
declaration->SetProperty(aProperty, aValue, EmptyString());
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
@ -71,6 +71,9 @@ class AnonymousContent final {
|
||||
|
||||
void GetTargetIdForEvent(Event& aEvent, DOMString& aResult);
|
||||
|
||||
void SetStyle(const nsAString& aProperty, const nsAString& aValue,
|
||||
ErrorResult& aRv);
|
||||
|
||||
private:
|
||||
~AnonymousContent();
|
||||
RefPtr<Element> mContentNode;
|
||||
|
@ -91,4 +91,10 @@ interface AnonymousContent {
|
||||
* attribute value of the target.
|
||||
*/
|
||||
DOMString? getTargetIdForEvent(Event event);
|
||||
|
||||
/**
|
||||
* Set given style to this AnonymousContent.
|
||||
*/
|
||||
[Throws]
|
||||
void setStyle(DOMString property, DOMString value);
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user