Bug 1145395 - Introduce an overload of nsHTMLEditor::SelElementPosition that takes an Element; r=ehsan

This commit is contained in:
Ms2ger 2015-05-13 17:58:25 +02:00
parent d457a0c0ab
commit f402d96073
2 changed files with 13 additions and 4 deletions

View File

@ -500,7 +500,7 @@ nsHTMLEditor::AbsolutelyPositionElement(nsIDOMElement* aElement,
AddPositioningOffset(x, y);
SnapToGrid(x, y);
SetElementPosition(aElement, x, y);
SetElementPosition(*element, x, y);
// we may need to create a br if the positioned element is alone in its
// container
@ -579,13 +579,19 @@ nsHTMLEditor::SetElementPosition(nsIDOMElement *aElement, int32_t aX, int32_t aY
{
nsCOMPtr<Element> element = do_QueryInterface(aElement);
NS_ENSURE_STATE(element);
nsAutoEditBatch batchIt(this);
mHTMLCSSUtils->SetCSSPropertyPixels(*element, *nsGkAtoms::left, aX);
mHTMLCSSUtils->SetCSSPropertyPixels(*element, *nsGkAtoms::top, aY);
SetElementPosition(*element, aX, aY);
return NS_OK;
}
void
nsHTMLEditor::SetElementPosition(dom::Element& aElement, int32_t aX, int32_t aY)
{
nsAutoEditBatch batchIt(this);
mHTMLCSSUtils->SetCSSPropertyPixels(aElement, *nsGkAtoms::left, aX);
mHTMLCSSUtils->SetCSSPropertyPixels(aElement, *nsGkAtoms::top, aY);
}
// self-explanatory
NS_IMETHODIMP
nsHTMLEditor::GetPositionedElement(nsIDOMElement ** aReturn)

View File

@ -754,6 +754,9 @@ protected:
nsresult ClearStyle(nsCOMPtr<nsIDOMNode>* aNode, int32_t* aOffset,
nsIAtom* aProperty, const nsAString* aAttribute);
void SetElementPosition(mozilla::dom::Element& aElement,
int32_t aX, int32_t aY);
// Data members
protected: