зеркало из https://github.com/mozilla/gecko-dev.git
Bug 824592 part 3. Get rid of nsIDOMElementCSSInlineStyle. r=peterv
This commit is contained in:
Родитель
e427482452
Коммит
e0691abc04
|
@ -28,7 +28,6 @@
|
|||
#include "nsIDOMDocumentFragment.h"
|
||||
#include "nsIDOMHTMLElement.h"
|
||||
#include "nsIDOMHTMLMenuElement.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
@ -167,43 +166,6 @@ private:
|
|||
RefPtr<nsGenericHTMLElement> mElement;
|
||||
};
|
||||
|
||||
class nsGenericHTMLElementTearoff : public nsIDOMElementCSSInlineStyle
|
||||
{
|
||||
virtual ~nsGenericHTMLElementTearoff()
|
||||
{
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
|
||||
explicit nsGenericHTMLElementTearoff(nsGenericHTMLElement* aElement)
|
||||
: mElement(aElement)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) override
|
||||
{
|
||||
NS_ADDREF(*aStyle = mElement->Style());
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsGenericHTMLElementTearoff,
|
||||
nsIDOMElementCSSInlineStyle)
|
||||
|
||||
private:
|
||||
RefPtr<nsGenericHTMLElement> mElement;
|
||||
};
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION(nsGenericHTMLElementTearoff, mElement)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsGenericHTMLElementTearoff)
|
||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsGenericHTMLElementTearoff)
|
||||
|
||||
NS_INTERFACE_TABLE_HEAD(nsGenericHTMLElementTearoff)
|
||||
NS_INTERFACE_TABLE_INHERITED(nsGenericHTMLElementTearoff,
|
||||
nsIDOMElementCSSInlineStyle)
|
||||
NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(nsGenericHTMLElementTearoff)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase)
|
||||
NS_IMPL_RELEASE_INHERITED(nsGenericHTMLElement, nsGenericHTMLElementBase)
|
||||
|
||||
|
@ -211,8 +173,6 @@ NS_INTERFACE_MAP_BEGIN(nsGenericHTMLElement)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMHTMLElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMElement)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNode)
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMElementCSSInlineStyle,
|
||||
new nsGenericHTMLElementTearoff(this))
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLElementBase)
|
||||
|
||||
nsresult
|
||||
|
|
|
@ -30,9 +30,7 @@ function getClassName(tag) {
|
|||
function HTML_TAG(aTagName, aImplClass) {
|
||||
allTags.push(aTagName);
|
||||
classInfos[aTagName] = aImplClass;
|
||||
interfaces[aTagName] =
|
||||
[ "nsIDOMEventTarget",
|
||||
"nsIDOMElementCSSInlineStyle" ];
|
||||
interfaces[aTagName] = [ "nsIDOMEventTarget" ];
|
||||
|
||||
// Some interfaces don't appear in classinfo because other interfaces that
|
||||
// inherit from them do.
|
||||
|
|
|
@ -27,7 +27,6 @@ XPIDL_SOURCES += [
|
|||
'nsIDOMCSSUnknownRule.idl',
|
||||
'nsIDOMCSSValue.idl',
|
||||
'nsIDOMCSSValueList.idl',
|
||||
'nsIDOMElementCSSInlineStyle.idl',
|
||||
'nsIDOMRect.idl',
|
||||
]
|
||||
|
||||
|
|
|
@ -1,20 +0,0 @@
|
|||
/* -*- Mode: IDL; 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 "domstubs.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMElementCSSInlineStyle interface allows access to the inline
|
||||
* style information for elements.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Style
|
||||
*/
|
||||
|
||||
[scriptable, uuid(99715845-95fc-4a56-aa53-214b65c26e22)]
|
||||
interface nsIDOMElementCSSInlineStyle : nsISupports
|
||||
{
|
||||
readonly attribute nsIDOMCSSStyleDeclaration style;
|
||||
};
|
|
@ -30,7 +30,6 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMXULCommandDispatcher.h"
|
||||
#include "nsIDOMXULElement.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMXULSelectCntrlItemEl.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsLayoutStylesheetCache.h"
|
||||
|
@ -125,27 +124,19 @@ uint32_t nsXULPrototypeAttribute::gNumCacheSets;
|
|||
uint32_t nsXULPrototypeAttribute::gNumCacheFills;
|
||||
#endif
|
||||
|
||||
class nsXULElementTearoff final : public nsIDOMElementCSSInlineStyle,
|
||||
public nsIFrameLoaderOwner
|
||||
class nsXULElementTearoff final : public nsIFrameLoaderOwner
|
||||
{
|
||||
~nsXULElementTearoff() {}
|
||||
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXULElementTearoff,
|
||||
nsIDOMElementCSSInlineStyle)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsXULElementTearoff)
|
||||
|
||||
explicit nsXULElementTearoff(nsXULElement* aElement)
|
||||
: mElement(aElement)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMETHOD GetStyle(nsIDOMCSSStyleDeclaration** aStyle) override
|
||||
{
|
||||
nsXULElement* element = static_cast<nsXULElement*>(mElement.get());
|
||||
NS_ADDREF(*aStyle = element->Style());
|
||||
return NS_OK;
|
||||
}
|
||||
NS_FORWARD_NSIFRAMELOADEROWNER(static_cast<nsXULElement*>(mElement.get())->)
|
||||
private:
|
||||
nsCOMPtr<nsIDOMXULElement> mElement;
|
||||
|
@ -158,7 +149,6 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXULElementTearoff)
|
|||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsXULElementTearoff)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIFrameLoaderOwner)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMElementCSSInlineStyle)
|
||||
NS_INTERFACE_MAP_END_AGGREGATED(mElement)
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
@ -354,8 +344,6 @@ NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsXULElement)
|
|||
NS_INTERFACE_TABLE_INHERITED(nsXULElement, nsIDOMNode, nsIDOMElement,
|
||||
nsIDOMXULElement)
|
||||
NS_ELEMENT_INTERFACE_TABLE_TO_MAP_SEGUE
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIDOMElementCSSInlineStyle,
|
||||
new nsXULElementTearoff(this))
|
||||
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIFrameLoaderOwner,
|
||||
new nsXULElementTearoff(this))
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsStyledElement)
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "nsIContent.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDocument.h"
|
||||
|
@ -39,6 +38,7 @@
|
|||
#include "nsString.h"
|
||||
#include "nsStringFwd.h"
|
||||
#include "nsStringIterator.h"
|
||||
#include "nsStyledElement.h"
|
||||
#include "nsSubstringTuple.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
|
||||
|
@ -1347,13 +1347,14 @@ CSSEditUtils::GetInlineStyles(nsISupports* aElement,
|
|||
{
|
||||
NS_ENSURE_TRUE(aElement && aLength, NS_ERROR_NULL_POINTER);
|
||||
*aLength = 0;
|
||||
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyles = do_QueryInterface(aElement);
|
||||
nsCOMPtr<nsStyledElement> inlineStyles = do_QueryInterface(aElement);
|
||||
NS_ENSURE_TRUE(inlineStyles, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsresult res = inlineStyles->GetStyle(aCssDecl);
|
||||
NS_ENSURE_SUCCESS(res, NS_ERROR_NULL_POINTER);
|
||||
MOZ_ASSERT(*aCssDecl);
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl =
|
||||
do_QueryInterface(inlineStyles->Style());
|
||||
MOZ_ASSERT(cssDecl);
|
||||
|
||||
cssDecl.forget(aCssDecl);
|
||||
(*aCssDecl)->GetLength(aLength);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -11,11 +11,11 @@
|
|||
#include "nsDebug.h" // for NS_ENSURE_SUCCESS, etc.
|
||||
#include "nsError.h" // for NS_ERROR_NULL_POINTER, etc.
|
||||
#include "nsGkAtoms.h" // for nsGkAtoms, etc.
|
||||
#include "nsIDOMCSSStyleDeclaration.h" // for nsIDOMCSSStyleDeclaration
|
||||
#include "nsIDOMElementCSSInlineStyle.h" // for nsIDOMElementCSSInlineStyle
|
||||
#include "nsICSSDeclaration.h" // for nsICSSDeclaration.
|
||||
#include "nsLiteralString.h" // for NS_LITERAL_STRING, etc.
|
||||
#include "nsReadableUtils.h" // for ToNewUnicode
|
||||
#include "nsString.h" // for nsAutoString, nsString, etc.
|
||||
#include "nsStyledElement.h" // for nsStyledElement.
|
||||
#include "nsUnicharUtils.h" // for nsCaseInsensitiveStringComparator
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -138,15 +138,11 @@ ChangeStyleTransaction::ChangeStyleTransaction(Element& aElement,
|
|||
NS_IMETHODIMP
|
||||
ChangeStyleTransaction::DoTransaction()
|
||||
{
|
||||
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyles =
|
||||
do_QueryInterface(mElement);
|
||||
nsCOMPtr<nsStyledElement> inlineStyles = do_QueryInterface(mElement);
|
||||
NS_ENSURE_TRUE(inlineStyles, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
nsresult result = inlineStyles->GetStyle(getter_AddRefs(cssDecl));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
NS_ENSURE_TRUE(cssDecl, NS_ERROR_NULL_POINTER);
|
||||
|
||||
nsCOMPtr<nsICSSDeclaration> cssDecl = inlineStyles->Style();
|
||||
|
||||
nsAutoString propertyNameString;
|
||||
mProperty->ToString(propertyNameString);
|
||||
|
||||
|
@ -154,7 +150,7 @@ ChangeStyleTransaction::DoTransaction()
|
|||
nsGkAtoms::style);
|
||||
|
||||
nsAutoString values;
|
||||
result = cssDecl->GetPropertyValue(propertyNameString, values);
|
||||
nsresult result = cssDecl->GetPropertyValue(propertyNameString, values);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
mUndoValue.Assign(values);
|
||||
|
||||
|
@ -176,8 +172,7 @@ ChangeStyleTransaction::DoTransaction()
|
|||
NS_ENSURE_SUCCESS(result, result);
|
||||
} else {
|
||||
nsAutoString priority;
|
||||
result = cssDecl->GetPropertyPriority(propertyNameString, priority);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
cssDecl->GetPropertyPriority(propertyNameString, priority);
|
||||
result = cssDecl->SetProperty(propertyNameString, values,
|
||||
priority);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
|
@ -188,8 +183,7 @@ ChangeStyleTransaction::DoTransaction()
|
|||
}
|
||||
} else {
|
||||
nsAutoString priority;
|
||||
result = cssDecl->GetPropertyPriority(propertyNameString, priority);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
cssDecl->GetPropertyPriority(propertyNameString, priority);
|
||||
if (multiple) {
|
||||
// Let's add the value we have to add to the others
|
||||
|
||||
|
@ -229,13 +223,9 @@ ChangeStyleTransaction::SetStyle(bool aAttributeWasSet,
|
|||
nsAutoString propertyNameString;
|
||||
mProperty->ToString(propertyNameString);
|
||||
|
||||
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyles =
|
||||
do_QueryInterface(mElement);
|
||||
nsCOMPtr<nsStyledElement> inlineStyles = do_QueryInterface(mElement);
|
||||
NS_ENSURE_TRUE(inlineStyles, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
|
||||
result = inlineStyles->GetStyle(getter_AddRefs(cssDecl));
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
NS_ENSURE_TRUE(cssDecl, NS_ERROR_NULL_POINTER);
|
||||
nsCOMPtr<nsICSSDeclaration> cssDecl = inlineStyles->Style();
|
||||
|
||||
if (aValue.IsEmpty()) {
|
||||
// An empty value means we have to remove the property
|
||||
|
@ -244,8 +234,7 @@ ChangeStyleTransaction::SetStyle(bool aAttributeWasSet,
|
|||
} else {
|
||||
// Let's recreate the declaration as it was
|
||||
nsAutoString priority;
|
||||
result = cssDecl->GetPropertyPriority(propertyNameString, priority);
|
||||
NS_ENSURE_SUCCESS(result, result);
|
||||
cssDecl->GetPropertyPriority(propertyNameString, priority);
|
||||
result = cssDecl->SetProperty(propertyNameString, aValue, priority);
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -6,14 +6,15 @@
|
|||
#include "ScrollbarActivity.h"
|
||||
#include "nsIScrollbarMediator.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsAString.h"
|
||||
#include "nsQueryFrame.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsStyledElement.h"
|
||||
#include "mozilla/LookAndFeel.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
|
||||
|
@ -352,16 +353,13 @@ ScrollbarActivity::SetIsActive(bool aNewActive)
|
|||
static void
|
||||
SetOpacityOnElement(nsIContent* aContent, double aOpacity)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyleContent =
|
||||
nsCOMPtr<nsStyledElement> inlineStyleContent =
|
||||
do_QueryInterface(aContent);
|
||||
if (inlineStyleContent) {
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
|
||||
inlineStyleContent->GetStyle(getter_AddRefs(decl));
|
||||
if (decl) {
|
||||
nsAutoString str;
|
||||
str.AppendFloat(aOpacity);
|
||||
decl->SetProperty(NS_LITERAL_STRING("opacity"), str, EmptyString());
|
||||
}
|
||||
nsICSSDeclaration* decl = inlineStyleContent->Style();
|
||||
nsAutoString str;
|
||||
str.AppendFloat(aOpacity);
|
||||
decl->SetProperty(NS_LITERAL_STRING("opacity"), str, EmptyString());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -391,15 +389,12 @@ ScrollbarActivity::UpdateOpacity(TimeStamp aTime)
|
|||
static void
|
||||
UnsetOpacityOnElement(nsIContent* aContent)
|
||||
{
|
||||
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyleContent =
|
||||
nsCOMPtr<nsStyledElement> inlineStyleContent =
|
||||
do_QueryInterface(aContent);
|
||||
if (inlineStyleContent) {
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
|
||||
inlineStyleContent->GetStyle(getter_AddRefs(decl));
|
||||
if (decl) {
|
||||
nsAutoString dummy;
|
||||
decl->RemoveProperty(NS_LITERAL_STRING("opacity"), dummy);
|
||||
}
|
||||
nsICSSDeclaration* decl = inlineStyleContent->Style();
|
||||
nsAutoString dummy;
|
||||
decl->RemoveProperty(NS_LITERAL_STRING("opacity"), dummy);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "nsIDOMNodeList.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsNameSpaceManager.h"
|
||||
#include "nsIDOMElementCSSInlineStyle.h"
|
||||
#include "nsIDOMCSSStyleDeclaration.h"
|
||||
|
||||
#include "nsPresContext.h"
|
||||
|
@ -27,6 +26,8 @@
|
|||
#include "nsIScreenManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsError.h"
|
||||
#include "nsICSSDeclaration.h"
|
||||
#include "nsStyledElement.h"
|
||||
#include <algorithm>
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -421,11 +422,10 @@ nsResizerFrame::ResizeContent(nsIContent* aContent, const Direction& aDirection,
|
|||
}
|
||||
}
|
||||
else {
|
||||
nsCOMPtr<nsIDOMElementCSSInlineStyle> inlineStyleContent =
|
||||
nsCOMPtr<nsStyledElement> inlineStyleContent =
|
||||
do_QueryInterface(aContent);
|
||||
if (inlineStyleContent) {
|
||||
nsCOMPtr<nsIDOMCSSStyleDeclaration> decl;
|
||||
inlineStyleContent->GetStyle(getter_AddRefs(decl));
|
||||
nsICSSDeclaration* decl = inlineStyleContent->Style();
|
||||
|
||||
if (aOriginalSizeInfo) {
|
||||
decl->GetPropertyValue(NS_LITERAL_STRING("width"),
|
||||
|
|
Загрузка…
Ссылка в новой задаче