Bug 1432977 part 3. Remove nsIDOMHTMLElement's offsetWidth/Height attributes. r=mccr8

MozReview-Commit-ID: EoSwBkeGj60
This commit is contained in:
Boris Zbarsky 2018-01-29 23:40:11 -05:00
Родитель 548d16d0b1
Коммит fba82e4ebc
4 изменённых файлов: 11 добавлений и 31 удалений

Просмотреть файл

@ -269,18 +269,6 @@ public:
MOZ_CAN_RUN_SCRIPT
nsSize GetWidthHeightForImage(RefPtr<imgRequestProxy>& aImageRequest);
// XPIDL methods
NS_IMETHOD GetOffsetWidth(int32_t* aOffsetWidth) final override {
*aOffsetWidth = OffsetWidth();
return NS_OK;
}
NS_IMETHOD GetOffsetHeight(int32_t* aOffsetHeight) final override {
*aOffsetHeight = OffsetHeight();
return NS_OK;
}
using nsGenericHTMLElementBase::GetOwnerDocument;
virtual nsIDOMNode* AsDOMNode() override { return this; }
public:

Просмотреть файл

@ -4,9 +4,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsIDOMElement.idl"
#include "nsIVariant.idl"
interface nsIDOMHTMLMenuElement;
/**
* The nsIDOMHTMLElement interface is the primary [X]HTML element
@ -22,7 +19,4 @@ interface nsIDOMHTMLMenuElement;
[uuid(b0c42392-d0e7-4f6a-beb5-a698ce648945)]
interface nsIDOMHTMLElement : nsIDOMElement
{
// CSSOM View
readonly attribute long offsetWidth;
readonly attribute long offsetHeight;
};

Просмотреть файл

@ -13,13 +13,13 @@
#include "nsComputedDOMStyle.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsGenericHTMLElement.h"
#include "nsGkAtoms.h"
#include "nsAtom.h"
#include "nsIContent.h"
#include "nsID.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNode.h"
#include "nsIDOMWindow.h"
#include "nsIDocument.h"
@ -522,16 +522,15 @@ HTMLEditor::GetPositionAndDimensions(Element& aElement,
aH = GetCSSFloatValue(cssDecl, NS_LITERAL_STRING("height"));
} else {
mResizedObjectIsAbsolutelyPositioned = false;
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(&aElement);
RefPtr<nsGenericHTMLElement> htmlElement =
nsGenericHTMLElement::FromContent(&aElement);
if (!htmlElement) {
return NS_ERROR_NULL_POINTER;
}
GetElementOrigin(aElement, aX, aY);
if (NS_WARN_IF(NS_FAILED(htmlElement->GetOffsetWidth(&aW))) ||
NS_WARN_IF(NS_FAILED(htmlElement->GetOffsetHeight(&aH)))) {
return NS_ERROR_FAILURE;
}
aW = htmlElement->OffsetWidth();
aH = htmlElement->OffsetHeight();
aBorderLeft = 0;
aBorderTop = 0;

Просмотреть файл

@ -10,10 +10,10 @@
#include "nsCOMPtr.h"
#include "nsDebug.h"
#include "nsError.h"
#include "nsGenericHTMLElement.h"
#include "nsIContent.h"
#include "nsIDOMElement.h"
#include "nsIDOMEventTarget.h"
#include "nsIDOMHTMLElement.h"
#include "nsIDOMNode.h"
#include "nsIHTMLObjectResizer.h"
#include "nsIPresShell.h"
@ -204,7 +204,8 @@ HTMLEditor::RefreshInlineTableEditingUI()
return NS_OK;
}
nsCOMPtr<nsIDOMHTMLElement> htmlElement = do_QueryInterface(mInlineEditedCell);
RefPtr<nsGenericHTMLElement> htmlElement =
nsGenericHTMLElement::FromContent(mInlineEditedCell);
if (!htmlElement) {
return NS_ERROR_NULL_POINTER;
}
@ -212,17 +213,15 @@ HTMLEditor::RefreshInlineTableEditingUI()
int32_t xCell, yCell, wCell, hCell;
GetElementOrigin(*mInlineEditedCell, xCell, yCell);
nsresult rv = htmlElement->GetOffsetWidth(&wCell);
NS_ENSURE_SUCCESS(rv, rv);
rv = htmlElement->GetOffsetHeight(&hCell);
NS_ENSURE_SUCCESS(rv, rv);
wCell = htmlElement->OffsetWidth();
hCell = htmlElement->OffsetHeight();
int32_t xHoriz = xCell + wCell/2;
int32_t yVert = yCell + hCell/2;
RefPtr<Element> tableElement = GetEnclosingTable(mInlineEditedCell);
int32_t rowCount, colCount;
rv = GetTableSize(tableElement, &rowCount, &colCount);
nsresult rv = GetTableSize(tableElement, &rowCount, &colCount);
NS_ENSURE_SUCCESS(rv, rv);
SetAnonymousElementPosition(xHoriz-10, yCell-7, mAddColumnBeforeButton);