2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: NPL 1.1/GPL 2.0/LGPL 2.1
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* The contents of this file are subject to the Netscape Public License
|
|
|
|
* Version 1.1 (the "License"); you may not use this file except in
|
|
|
|
* compliance with the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/NPL/
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
* Contributor(s):
|
2001-12-20 14:15:32 +03:00
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2001-09-25 05:32:19 +04:00
|
|
|
*
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the NPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the NPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-05-04 04:07:33 +04:00
|
|
|
|
|
|
|
#include "nsIComputedDOMStyle.h"
|
|
|
|
#include "nsIPresShell.h"
|
2000-05-15 05:59:05 +04:00
|
|
|
#include "nsIPresContext.h"
|
2000-05-04 04:07:33 +04:00
|
|
|
#include "nsIContent.h"
|
|
|
|
#include "nsIFrame.h"
|
2001-11-10 20:29:04 +03:00
|
|
|
#include "nsIScrollableFrame.h"
|
|
|
|
#include "nsLayoutAtoms.h"
|
2000-05-04 04:07:33 +04:00
|
|
|
#include "nsIDOMElement.h"
|
|
|
|
#include "nsIStyleContext.h"
|
2000-05-15 05:59:05 +04:00
|
|
|
#include "nsROCSSPrimitiveValue.h"
|
2002-01-11 03:15:55 +03:00
|
|
|
#include "nsDOMCSSRect.h"
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
#include "nsCSSProps.h"
|
2001-12-20 14:15:32 +03:00
|
|
|
#include "nsCSSKeywords.h"
|
2000-05-04 04:07:33 +04:00
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsDOMError.h"
|
2001-03-03 03:44:19 +03:00
|
|
|
#include "nsWeakReference.h"
|
2001-03-11 23:47:06 +03:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
|
|
|
|
#include "prprf.h"
|
|
|
|
#include "nsReadableUtils.h"
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
#include "nsContentUtils.h"
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
/*
|
|
|
|
* This is the implementation of the readonly CSSStyleDeclaration that is
|
|
|
|
* returned by the getComputedStyle() function.
|
|
|
|
*
|
|
|
|
* This file is very much work in progress, there's a lot of code in this
|
|
|
|
* file that is #ifdef'd out placeholders.
|
|
|
|
*/
|
2000-05-04 04:07:33 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
class nsComputedDOMStyle : public nsIComputedDOMStyle
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
|
|
|
|
// nsIComputedDOMStyle
|
2000-08-23 21:27:06 +04:00
|
|
|
NS_IMETHOD Init(nsIDOMElement *aElement, const nsAReadableString& aPseudoElt,
|
2000-05-04 04:07:33 +04:00
|
|
|
nsIPresShell *aPresShell);
|
|
|
|
|
|
|
|
// nsIDOMCSSStyleDeclaration
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_DECL_NSIDOMCSSSTYLEDECLARATION
|
2000-05-04 04:07:33 +04:00
|
|
|
|
|
|
|
// nsComputedDOMStyle
|
|
|
|
nsComputedDOMStyle();
|
|
|
|
virtual ~nsComputedDOMStyle();
|
|
|
|
|
|
|
|
private:
|
2001-03-03 03:44:19 +03:00
|
|
|
//Helpers
|
2001-11-10 20:29:04 +03:00
|
|
|
nsresult GetOffsetWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetAbsoluteOffset(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetRelativeOffset(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetStaticOffset(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsIFrame* GetContainingBlock(nsIFrame *aFrame);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetStyleData(nsStyleStructID aID,
|
|
|
|
const nsStyleStruct*& aStyleStruct,
|
|
|
|
nsIFrame* aFrame=0);
|
|
|
|
nsresult GetPaddingWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord GetPaddingWidthCoordFor(PRUint8 aSide, nsIFrame *aFrame);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetBorderStyleFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord GetBorderWidthCoordFor(PRUint8 aSide, nsIFrame *aFrame);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetBorderColorFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetMarginWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord GetMarginWidthCoordFor(PRUint8 aSide, nsIFrame *aFrame);
|
2001-03-03 03:44:19 +03:00
|
|
|
|
|
|
|
// Properties
|
2000-05-15 05:59:05 +04:00
|
|
|
nsresult GetWidth(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetHeight(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetLeft(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetTop(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetRight(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBottom(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
//Font properties
|
|
|
|
nsresult GetColor(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetFontFamily(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetFontStyle(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetFontSize(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetFontWeight(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetFontVariant(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
|
|
|
// Background properties
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetBackgroundColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBackgroundImage(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
// Padding properties
|
|
|
|
nsresult GetPadding(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetPaddingTop(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetPaddingBottom(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult GetPaddingLeft(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetPaddingRight(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
|
|
|
// BorderProperties
|
|
|
|
nsresult GetBorderStyle(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderWidth(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetBorderCollapse(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderSpacing(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderTopStyle(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderBottomStyle(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderLeftStyle(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderRightStyle(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderTopWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderBottomWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderLeftWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderRightWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderTopColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderBottomColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderLeftColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetBorderRightColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
// Margin Properties
|
|
|
|
nsresult GetMarginWidth(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetMarginTopWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetMarginBottomWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetMarginLeftWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetMarginRightWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
// Outline Properties
|
|
|
|
nsresult GetOutline(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetOutlineWidth(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetOutlineStyle(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetOutlineColor(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
//Marker Properties
|
|
|
|
nsresult GetMarkerOffset(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
// z-index
|
|
|
|
nsresult GetZIndex(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
2001-03-08 03:55:01 +03:00
|
|
|
// List properties
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult GetListStyleImage(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue);
|
2001-03-08 03:55:01 +03:00
|
|
|
|
2001-05-04 15:30:34 +04:00
|
|
|
// Text Properties
|
|
|
|
nsresult GetTextAlign(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
2001-05-09 07:29:09 +04:00
|
|
|
nsresult GetTextDecoration(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
2001-09-28 11:39:41 +04:00
|
|
|
// Visibility properties
|
2001-08-07 23:05:21 +04:00
|
|
|
nsresult GetVisibility(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
|
2001-09-28 11:39:41 +04:00
|
|
|
// Display properties
|
2000-06-14 04:06:36 +04:00
|
|
|
nsresult GetBehavior(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
2001-09-28 18:11:05 +04:00
|
|
|
nsresult GetCssFloat(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
2001-09-28 11:39:41 +04:00
|
|
|
nsresult GetDisplay(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
2002-01-11 03:15:55 +03:00
|
|
|
nsresult GetPosition(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
|
|
|
nsresult GetClip(nsIFrame *aFrame, nsIDOMCSSPrimitiveValue*& aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* GetROCSSPrimitiveValue();
|
|
|
|
|
|
|
|
nsWeakPtr mPresShellWeak; // XXX could this be high cost?
|
2000-05-04 04:07:33 +04:00
|
|
|
nsCOMPtr<nsIContent> mContent;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
// When a frame is unavailable strong reference to the
|
2001-03-11 23:47:06 +03:00
|
|
|
// style context while we're accessing the data from in.
|
2001-11-10 20:29:04 +03:00
|
|
|
nsCOMPtr<nsIStyleContext> mStyleContextHolder;
|
2001-03-11 23:47:06 +03:00
|
|
|
nsCOMPtr<nsIAtom> mPseudo;
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
float mT2P; // For unit conversions
|
2000-05-04 04:07:33 +04:00
|
|
|
};
|
|
|
|
|
2001-05-14 15:23:53 +04:00
|
|
|
static const nsCSSProperty queryableProperties[] = {
|
|
|
|
eCSSProperty_width,
|
|
|
|
eCSSProperty_height,
|
|
|
|
eCSSProperty_left,
|
|
|
|
eCSSProperty_top,
|
|
|
|
eCSSProperty_right,
|
|
|
|
eCSSProperty_bottom,
|
2002-01-11 03:15:55 +03:00
|
|
|
eCSSProperty_clip,
|
2001-05-14 15:23:53 +04:00
|
|
|
|
|
|
|
eCSSProperty_color,
|
|
|
|
eCSSProperty_font_family,
|
|
|
|
eCSSProperty_font_style,
|
|
|
|
eCSSProperty_font_size,
|
|
|
|
eCSSProperty_font_weight,
|
|
|
|
eCSSProperty_font_variant,
|
|
|
|
|
|
|
|
eCSSProperty_background_color,
|
|
|
|
eCSSProperty_background_image,
|
|
|
|
|
|
|
|
eCSSProperty_display,
|
2002-01-11 03:15:55 +03:00
|
|
|
eCSSProperty_position,
|
2001-09-28 11:39:41 +04:00
|
|
|
eCSSProperty_binding,
|
|
|
|
eCSSProperty_float,
|
2001-05-14 15:23:53 +04:00
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
// shorthand properties are not really queryable. There is no
|
|
|
|
// decent way to generate them based on computed style
|
|
|
|
// eCSSProperty_padding,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_padding_top,
|
|
|
|
eCSSProperty_padding_bottom,
|
|
|
|
eCSSProperty_padding_left,
|
|
|
|
eCSSProperty_padding_right,
|
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
// shorthand properties are not really queryable. There is no
|
|
|
|
// decent way to generate them based on computed style
|
|
|
|
// eCSSProperty_border_style,
|
|
|
|
// eCSSProperty_border_width,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_border_collapse,
|
|
|
|
eCSSProperty_border_spacing,
|
|
|
|
eCSSProperty_border_top_style,
|
2002-01-11 03:15:55 +03:00
|
|
|
eCSSProperty_border_right_style,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_border_bottom_style,
|
|
|
|
eCSSProperty_border_left_style,
|
|
|
|
eCSSProperty_border_top_width,
|
2002-01-11 03:15:55 +03:00
|
|
|
eCSSProperty_border_right_width,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_border_bottom_width,
|
|
|
|
eCSSProperty_border_left_width,
|
|
|
|
eCSSProperty_border_top_color,
|
2002-01-11 03:15:55 +03:00
|
|
|
eCSSProperty_border_right_color,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_border_bottom_color,
|
|
|
|
eCSSProperty_border_left_color,
|
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
// shorthand properties are not really queryable. There is no
|
|
|
|
// decent way to generate them based on computed style
|
|
|
|
// eCSSProperty_margin,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_margin_top,
|
|
|
|
eCSSProperty_margin_bottom,
|
|
|
|
eCSSProperty_margin_left,
|
|
|
|
eCSSProperty_margin_right,
|
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
// shorthand properties are not really queryable. There is no
|
|
|
|
// decent way to generate them based on computed style
|
|
|
|
// eCSSProperty_outline,
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_outline_width,
|
|
|
|
eCSSProperty_outline_style,
|
|
|
|
eCSSProperty_outline_color,
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_marker_offset,
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_z_index,
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_list_style_image,
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-14 15:23:53 +04:00
|
|
|
eCSSProperty_text_align,
|
|
|
|
eCSSProperty_text_decoration,
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-14 15:23:53 +04:00
|
|
|
};
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
nsresult
|
|
|
|
NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aComputedStyle);
|
|
|
|
|
|
|
|
*aComputedStyle = new nsComputedDOMStyle();
|
|
|
|
NS_ENSURE_TRUE(*aComputedStyle, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
NS_ADDREF(*aComputedStyle);
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsComputedDOMStyle::nsComputedDOMStyle() : mPresShellWeak(nsnull),
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
mT2P(0.0f)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_INIT_REFCNT();
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::~nsComputedDOMStyle()
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
// QueryInterface implementation for nsComputedDOMStyle
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_INTERFACE_MAP_BEGIN(nsComputedDOMStyle)
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIComputedDOMStyle)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIComputedDOMStyle)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ComputedCSSStyleDeclaration)
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_INTERFACE_MAP_END
|
2000-05-04 04:07:33 +04:00
|
|
|
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMPL_ADDREF(nsComputedDOMStyle);
|
|
|
|
NS_IMPL_RELEASE(nsComputedDOMStyle);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
|
|
|
const nsAReadableString& aPseudoElt,
|
2000-05-15 05:59:05 +04:00
|
|
|
nsIPresShell *aPresShell)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aElement);
|
|
|
|
NS_ENSURE_ARG_POINTER(aPresShell);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
mPresShellWeak = getter_AddRefs(NS_GetWeakReference(aPresShell));
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
mContent = do_QueryInterface(aElement);
|
|
|
|
if (!mContent) {
|
|
|
|
// This should not happen, all our elements support nsIContent!
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
if(!DOMStringIsNull(aPseudoElt) && !aPseudoElt.IsEmpty()) {
|
2001-03-11 23:47:06 +03:00
|
|
|
mPseudo = dont_AddRef(NS_NewAtom(aPseudoElt));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_ENSURE_TRUE(mPseudo, NS_ERROR_OUT_OF_MEMORY);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
nsCOMPtr<nsIPresContext> presCtx;
|
2001-03-03 03:44:19 +03:00
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
aPresShell->GetPresContext(getter_AddRefs(presCtx));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
presCtx->GetTwipsToPixels(&mT2P);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCssText(nsAWritableString& aCssText)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
aCssText.Truncate();
|
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::SetCssText(const nsAReadableString& aCssText)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetLength(PRUint32* aLength)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aLength);
|
2001-05-14 15:23:53 +04:00
|
|
|
*aLength = sizeof(queryableProperties) / sizeof(nsCSSProperty);
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aParentRule);
|
|
|
|
*aParentRule = nsnull;
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPropertyValue(const nsAReadableString& aPropertyName,
|
|
|
|
nsAWritableString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-06-14 04:06:36 +04:00
|
|
|
nsCOMPtr<nsIDOMCSSValue> val;
|
|
|
|
|
|
|
|
aReturn.Truncate();
|
|
|
|
|
|
|
|
nsresult rv = GetPropertyCSSValue(aPropertyName, getter_AddRefs(val));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (val) {
|
|
|
|
rv = val->GetCssText(aReturn);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPropertyCSSValue(const nsAReadableString& aPropertyName,
|
2000-05-15 05:59:05 +04:00
|
|
|
nsIDOMCSSValue** aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aReturn);
|
|
|
|
*aReturn = nsnull;
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsCOMPtr<nsIPresShell> presShell=do_QueryReferent(mPresShellWeak);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
nsIFrame *frame = nsnull;
|
2001-03-03 03:44:19 +03:00
|
|
|
presShell->GetPrimaryFrameFor(mContent, &frame);
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
nsCOMPtr<nsIDOMCSSPrimitiveValue> val;
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
2000-08-23 21:27:06 +04:00
|
|
|
// XXX FIX THIS!!!
|
2000-05-15 05:59:05 +04:00
|
|
|
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
|
|
|
|
|
|
|
switch (prop) {
|
2001-06-01 02:19:43 +04:00
|
|
|
case eCSSProperty_binding :
|
2001-03-30 06:08:48 +04:00
|
|
|
rv = GetBehavior(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_display :
|
|
|
|
rv = GetDisplay(frame, *getter_AddRefs(val)); break;
|
2002-01-11 03:15:55 +03:00
|
|
|
case eCSSProperty_position :
|
|
|
|
rv = GetPosition(frame, *getter_AddRefs(val)); break;
|
2001-09-28 11:39:41 +04:00
|
|
|
case eCSSProperty_float :
|
2001-09-28 18:11:05 +04:00
|
|
|
rv = GetCssFloat(frame, *getter_AddRefs(val)); break;
|
2001-03-30 06:08:48 +04:00
|
|
|
case eCSSProperty_width :
|
|
|
|
rv = GetWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_height :
|
|
|
|
rv = GetHeight(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_left :
|
|
|
|
rv = GetLeft(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_top :
|
|
|
|
rv = GetTop(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_right :
|
|
|
|
rv = GetRight(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_bottom :
|
|
|
|
rv = GetBottom(frame, *getter_AddRefs(val)); break;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
// Font properties
|
|
|
|
case eCSSProperty_color :
|
|
|
|
rv = GetColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_font_family :
|
|
|
|
rv = GetFontFamily(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_font_size :
|
|
|
|
rv = GetFontSize(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_font_style :
|
|
|
|
rv = GetFontStyle(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_font_weight :
|
|
|
|
rv = GetFontWeight(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_font_variant :
|
|
|
|
rv = GetFontVariant(frame, *getter_AddRefs(val)); break;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
// Background properties
|
|
|
|
case eCSSProperty_background_color :
|
|
|
|
rv = GetBackgroundColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_background_image :
|
|
|
|
rv = GetBackgroundImage(frame, *getter_AddRefs(val)); break;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
// Padding properties
|
|
|
|
case eCSSProperty_padding :
|
|
|
|
rv = GetPadding(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_padding_top :
|
|
|
|
rv = GetPaddingTop(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_padding_bottom :
|
|
|
|
rv = GetPaddingBottom(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_padding_left :
|
|
|
|
rv = GetPaddingLeft(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_padding_right :
|
|
|
|
rv = GetPaddingRight(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
|
|
|
// Border properties
|
|
|
|
case eCSSProperty_border_collapse :
|
|
|
|
rv = GetBorderCollapse(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_top_style :
|
|
|
|
rv = GetBorderTopStyle(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_bottom_style :
|
|
|
|
rv = GetBorderBottomStyle(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_left_style :
|
|
|
|
rv = GetBorderLeftStyle(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_right_style :
|
|
|
|
rv = GetBorderRightStyle(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_top_width :
|
|
|
|
rv = GetBorderTopWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_bottom_width :
|
|
|
|
rv = GetBorderBottomWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_left_width :
|
|
|
|
rv = GetBorderLeftWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_right_width :
|
|
|
|
rv = GetBorderRightWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_top_color :
|
|
|
|
rv = GetBorderTopColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_bottom_color :
|
|
|
|
rv = GetBorderBottomColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_left_color :
|
|
|
|
rv = GetBorderLeftColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_border_right_color :
|
|
|
|
rv = GetBorderRightColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
|
|
|
// Margin properties
|
|
|
|
case eCSSProperty_margin_top :
|
|
|
|
rv = GetMarginTopWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_margin_bottom :
|
|
|
|
rv = GetMarginBottomWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_margin_left :
|
|
|
|
rv = GetMarginLeftWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_margin_right :
|
|
|
|
rv = GetMarginRightWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
|
|
|
// Marker property
|
|
|
|
case eCSSProperty_marker_offset :
|
|
|
|
rv = GetMarkerOffset(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
|
|
|
// Outline properties
|
|
|
|
case eCSSProperty_outline_width :
|
|
|
|
rv = GetOutlineWidth(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_outline_style :
|
|
|
|
rv = GetOutlineStyle(frame, *getter_AddRefs(val)); break;
|
|
|
|
case eCSSProperty_outline_color:
|
|
|
|
rv = GetOutlineColor(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
// Text properties
|
2001-05-04 15:30:34 +04:00
|
|
|
case eCSSProperty_text_align:
|
|
|
|
rv = GetTextAlign(frame, *getter_AddRefs(val)); break;
|
2001-05-09 07:29:09 +04:00
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
case eCSSProperty_text_decoration:
|
|
|
|
rv = GetTextDecoration(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
|
|
|
// List properties
|
|
|
|
case eCSSProperty_list_style_image:
|
2001-05-09 07:29:09 +04:00
|
|
|
rv = GetListStyleImage(frame, *getter_AddRefs(val)); break;
|
2001-05-04 15:30:34 +04:00
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
// Display properties
|
|
|
|
case eCSSProperty_visibility:
|
|
|
|
rv = GetVisibility(frame, *getter_AddRefs(val)); break;
|
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
// Z-Index property
|
|
|
|
case eCSSProperty_z_index:
|
|
|
|
rv = GetZIndex(frame, *getter_AddRefs(val)); break;
|
2002-01-11 03:15:55 +03:00
|
|
|
|
|
|
|
// Clip
|
|
|
|
case eCSSProperty_clip:
|
|
|
|
rv = GetClip(frame, *getter_AddRefs(val)); break;
|
2001-03-30 06:08:48 +04:00
|
|
|
default :
|
|
|
|
break;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
if (val) {
|
2000-06-14 04:06:36 +04:00
|
|
|
rv = val->QueryInterface(NS_GET_IID(nsIDOMCSSValue), (void **)aReturn);
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
// Release the current style context for it should be re-resolved
|
2001-03-11 23:47:06 +03:00
|
|
|
// whenever a frame is not available.
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
mStyleContextHolder=nsnull;
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2000-06-14 04:06:36 +04:00
|
|
|
return rv;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::RemoveProperty(const nsAReadableString& aPropertyName,
|
|
|
|
nsAWritableString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPropertyPriority(const nsAReadableString& aPropertyName,
|
|
|
|
nsAWritableString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
aReturn.Truncate();
|
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::SetProperty(const nsAReadableString& aPropertyName,
|
|
|
|
const nsAReadableString& aValue,
|
|
|
|
const nsAReadableString& aPriority)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::Item(PRUint32 aIndex, nsAWritableString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-05-14 15:23:53 +04:00
|
|
|
PRUint32 length;
|
|
|
|
GetLength(&length);
|
2000-05-15 05:59:05 +04:00
|
|
|
aReturn.Truncate();
|
2001-05-14 15:23:53 +04:00
|
|
|
if (aIndex >= 0 && aIndex < length) {
|
2001-05-19 15:27:30 +04:00
|
|
|
CopyASCIItoUCS2(nsCSSProps::GetStringValue(queryableProperties[aIndex]), aReturn);
|
2001-05-14 15:23:53 +04:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
// Property getters...
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
2000-05-04 04:07:33 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetAzimuth(nsAWritableString& aAzimuth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBackground(nsAWritableString& aBackground)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBackgroundAttachment(nsAWritableString& aBackgroundAttachment)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBackgroundColor(nsAWritableString& aBackgroundColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBackgroundImage(nsAWritableString& aBackgroundImage)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBackgroundPosition(nsAWritableString& aBackgroundPosition)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBackgroundRepeat(nsAWritableString& aBackgroundRepeat)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-06-14 04:06:36 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBehavior(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2000-06-14 04:06:36 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleDisplay* display = nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2000-06-14 04:06:36 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
if (display) {
|
|
|
|
val->SetString(display->mBinding);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2000-06-14 04:06:36 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2001-09-28 11:39:41 +04:00
|
|
|
nsresult
|
2001-09-28 18:11:05 +04:00
|
|
|
nsComputedDOMStyle::GetCssFloat(nsIFrame *aFrame,
|
2001-09-28 11:39:41 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay* display=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame);
|
|
|
|
|
2002-01-25 00:19:21 +03:00
|
|
|
if(display && display->mFloats != NS_STYLE_FLOAT_NONE) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& cssFloat =
|
2001-09-28 11:39:41 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(display->mFloats,
|
2002-01-25 00:19:21 +03:00
|
|
|
nsCSSProps::kFloatKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(cssFloat);
|
2001-09-28 11:39:41 +04:00
|
|
|
}
|
|
|
|
else {
|
2002-01-25 00:19:21 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
2001-09-28 11:39:41 +04:00
|
|
|
}
|
|
|
|
|
2002-01-25 00:19:21 +03:00
|
|
|
return CallQueryInterface(val, &aValue);
|
2001-09-28 11:39:41 +04:00
|
|
|
}
|
|
|
|
|
2000-06-14 04:06:36 +04:00
|
|
|
#if 0
|
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorder(nsAWritableString& aBorder)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderCollapse(nsAWritableString& aBorderCollapse)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderColor(nsAWritableString& aBorderColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderSpacing(nsAWritableString& aBorderSpacing)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderStyle(nsAWritableString& aBorderStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderTop(nsAWritableString& aBorderTop)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderRight(nsAWritableString& aBorderRight)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderBottom(nsAWritableString& aBorderBottom)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderLeft(nsAWritableString& aBorderLeft)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderTopColor(nsAWritableString& aBorderTopColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderRightColor(nsAWritableString& aBorderRightColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderBottomColor(nsAWritableString& aBorderBottomColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderLeftColor(nsAWritableString& aBorderLeftColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderTopStyle(nsAWritableString& aBorderTopStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderRightStyle(nsAWritableString& aBorderRightStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderBottomStyle(nsAWritableString& aBorderBottomStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderLeftStyle(nsAWritableString& aBorderLeftStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderTopWidth(nsAWritableString& aBorderTopWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderRightWidth(nsAWritableString& aBorderRightWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderBottomWidth(nsAWritableString& aBorderBottomWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderLeftWidth(nsAWritableString& aBorderLeftWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetBorderWidth(nsAWritableString& aBorderWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetBottom(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-11-10 20:29:04 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
|
|
|
|
static void ColorToHex(nscolor aColor, nsAWritableString& aHexString)
|
|
|
|
{
|
|
|
|
char buf[32];
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
PRUint32 len = PR_snprintf(buf, 32, "#%02x%02x%02x",
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_GET_R(aColor),
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
NS_GET_G(aColor),
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_GET_B(aColor));
|
|
|
|
|
2001-05-19 15:27:30 +04:00
|
|
|
CopyASCIItoUCS2(nsDependentCString(buf, len), aHexString);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleColor* color=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)color, aFrame);
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
if(color) {
|
|
|
|
nsAutoString hex;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
ColorToHex(color->mColor, hex);
|
2001-03-11 23:47:06 +03:00
|
|
|
val->SetString(hex);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontFamily(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
const nsStyleFont* font=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(font) {
|
2001-09-07 06:28:10 +04:00
|
|
|
nsCOMPtr<nsIPresShell> presShell=do_QueryReferent(mPresShellWeak);
|
|
|
|
NS_ASSERTION(presShell, "pres shell is required");
|
|
|
|
nsCOMPtr<nsIPresContext> presContext;
|
|
|
|
presShell->GetPresContext(getter_AddRefs(presContext));
|
|
|
|
NS_ASSERTION(presContext, "pres context is required");
|
|
|
|
|
2001-09-27 22:33:58 +04:00
|
|
|
const nsString& fontName = font->mFont.name;
|
|
|
|
PRUint8 generic = font->mFlags & NS_STYLE_FONT_FACE_MASK;
|
|
|
|
if (generic == kGenericFont_NONE) {
|
2002-01-10 03:04:35 +03:00
|
|
|
const nsFont* defaultFont;
|
|
|
|
presContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID, &defaultFont);
|
|
|
|
PRInt32 lendiff = fontName.Length() - defaultFont->name.Length();
|
2001-09-07 06:28:10 +04:00
|
|
|
if (lendiff > 0) {
|
|
|
|
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
|
|
|
} else {
|
|
|
|
val->SetString(fontName);
|
|
|
|
}
|
|
|
|
} else {
|
2001-09-27 22:33:58 +04:00
|
|
|
val->SetString(fontName);
|
2001-09-07 06:28:10 +04:00
|
|
|
}
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontSize(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
const nsStyleFont* font=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
2001-09-27 22:33:58 +04:00
|
|
|
// Note: font->mSize is the 'computed size'; font->mFont.size is the 'actual size'
|
|
|
|
val->SetTwips(font? font->mSize:0);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontStyle(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
const nsStyleFont* font=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(font) {
|
2002-01-11 03:15:55 +03:00
|
|
|
if (font->mFont.style == NS_STYLE_FONT_STYLE_NORMAL) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("normal"));
|
|
|
|
} else {
|
|
|
|
const nsAFlatCString& style=
|
|
|
|
nsCSSProps::SearchKeywordTable(font->mFont.style,
|
|
|
|
nsCSSProps::kFontStyleKTable);
|
|
|
|
val->SetString(style);
|
|
|
|
}
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontWeight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
const nsStyleFont* font=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(font) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& str_weight=
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(font->mFont.weight,
|
|
|
|
nsCSSProps::kFontWeightKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
if(!str_weight.IsEmpty()) {
|
|
|
|
val->SetString(str_weight);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsAutoString num_weight;
|
|
|
|
num_weight.AppendInt(font->mFont.weight, 10);
|
|
|
|
val->SetString(num_weight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontVariant(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
const nsStyleFont* font=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(font) {
|
2002-01-11 03:15:55 +03:00
|
|
|
if (font->mFont.variant == NS_STYLE_FONT_VARIANT_NORMAL) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("normal"));
|
|
|
|
} else {
|
|
|
|
const nsAFlatCString& variant=
|
|
|
|
nsCSSProps::SearchKeywordTable(font->mFont.variant,
|
|
|
|
nsCSSProps::kFontVariantKTable);
|
|
|
|
val->SetString(variant);
|
|
|
|
}
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundColor(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleBackground* color=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)color, aFrame);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(color) {
|
2002-01-08 02:46:07 +03:00
|
|
|
if (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& backgroundColor =
|
2001-09-06 12:20:50 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(NS_STYLE_BG_COLOR_TRANSPARENT,
|
|
|
|
nsCSSProps::kBackgroundColorKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(backgroundColor);
|
2001-09-06 12:20:50 +04:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsAutoString hex;
|
|
|
|
ColorToHex(color->mBackgroundColor, hex);
|
|
|
|
val->SetString(hex);
|
|
|
|
}
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundImage(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleBackground* color=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)color, aFrame);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(color) {
|
2002-01-11 03:15:55 +03:00
|
|
|
if (color->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
|
|
|
} else {
|
2001-03-12 00:03:08 +03:00
|
|
|
val->SetString(color->mBackgroundImage);
|
2002-01-11 03:15:55 +03:00
|
|
|
}
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPadding(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
aValue=nsnull; // return null per spec.
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingTop(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingBottom(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingLeft(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingRight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::GetBorderCollapse(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleTableBorder* table = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(table) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& ident=
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(table->mBorderCollapse,
|
|
|
|
nsCSSProps::kBorderCollapseKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(ident);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderSpacing(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderStyle(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
aValue=nsnull; // return null per spec.
|
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderTopStyle(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderStyleFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomStyle(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderStyleFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftStyle(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderStyleFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightStyle(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderStyleFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderWidth(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
aValue=nsnull; // return null per spec.
|
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderTopWidth(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomWidth(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftWidth(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightWidth(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
nsresult
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::GetBorderTopColor(nsIFrame *aFrame,
|
2001-03-30 06:08:48 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderColorFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomColor(nsIFrame *aFrame,
|
2001-03-30 06:08:48 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderColorFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftColor(nsIFrame *aFrame,
|
2001-03-30 06:08:48 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderColorFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightColor(nsIFrame *aFrame,
|
2001-03-30 06:08:48 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetBorderColorFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginWidth(nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
aValue=nsnull; // return null per spec.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginTopWidth(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetMarginWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginBottomWidth(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetMarginWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginLeftWidth(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetMarginWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginRightWidth(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return GetMarginWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarkerOffset(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-12 00:03:08 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleContent* content=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame);
|
|
|
|
|
2002-01-10 05:20:17 +03:00
|
|
|
if (content) {
|
|
|
|
switch (content->mMarkerOffset.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(content->mMarkerOffset.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Null:
|
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Double check the unit");
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutline(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
aValue=nsnull; // return null per spec.
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineWidth(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleOutline* outline=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2002-01-10 05:20:17 +03:00
|
|
|
if (outline) {
|
|
|
|
switch (outline->mOutlineWidth.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(outline->mOutlineWidth.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Integer:
|
|
|
|
case eStyleUnit_Proportional:
|
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
case eStyleUnit_Chars:
|
|
|
|
{
|
|
|
|
const nsAFlatCString& width =
|
|
|
|
nsCSSProps::LookupPropertyValue(eCSSProperty_outline_width,
|
|
|
|
outline->mOutlineWidth.GetIntValue());
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(width);
|
2002-01-10 05:20:17 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
|
|
|
NS_WARNING("Double check the unit");
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleOutline* outline=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
if(outline) {
|
2002-01-10 05:20:17 +03:00
|
|
|
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
|
|
|
if (outlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
|
|
|
} else {
|
|
|
|
const nsAFlatCString& style=
|
|
|
|
nsCSSProps::SearchKeywordTable(outline->GetOutlineStyle(),
|
|
|
|
nsCSSProps::kBorderStyleKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(style);
|
2002-01-10 05:20:17 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineColor(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleOutline* outline=nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
if(outline) {
|
2001-03-30 06:08:48 +04:00
|
|
|
nscolor color;
|
2001-03-11 23:47:06 +03:00
|
|
|
outline->GetOutlineColor(color);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
nsAutoString hex;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
ColorToHex(color, hex);
|
2001-03-30 06:08:48 +04:00
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
val->SetString(hex);
|
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetZIndex(nsIFrame *aFrame,
|
2001-03-11 23:47:06 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition* position = nsnull;
|
2001-03-12 00:03:08 +03:00
|
|
|
nsAutoString zindex;
|
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position, aFrame);
|
2001-12-07 00:15:54 +03:00
|
|
|
if (position) {
|
|
|
|
switch (position->mZIndex.GetUnit()) {
|
|
|
|
case eStyleUnit_Integer:
|
|
|
|
zindex.AppendInt(position->mZIndex.GetIntValue(), 10);
|
|
|
|
val->SetString(zindex);
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Inherit:
|
|
|
|
val->SetString(NS_LITERAL_STRING("inherit"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Double Check the Unit!");
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
break;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
2001-12-07 00:15:54 +03:00
|
|
|
} else {
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
2001-12-07 00:15:54 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2001-03-08 03:55:01 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetListStyleImage(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-12 00:03:08 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleList* list;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&)list, aFrame);
|
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(list) {
|
2002-01-24 07:22:59 +03:00
|
|
|
if (list->mListStyleImage.IsEmpty()) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
|
|
|
} else {
|
|
|
|
val->SetString(list->mListStyleImage);
|
|
|
|
}
|
2001-03-08 03:55:01 +03:00
|
|
|
}
|
2001-03-12 00:03:08 +03:00
|
|
|
else {
|
2002-01-24 07:22:59 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void**)&aValue);
|
2001-03-08 03:55:01 +03:00
|
|
|
}
|
|
|
|
|
2001-05-04 15:30:34 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextAlign(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-05-04 15:30:34 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
const nsStyleText* text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-04 15:30:34 +04:00
|
|
|
if(text) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& align=
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(text->mTextAlign,
|
|
|
|
nsCSSProps::kTextAlignKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(align);
|
2001-05-04 15:30:34 +04:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("start"));
|
2001-05-04 15:30:34 +04:00
|
|
|
}
|
2001-09-28 11:39:41 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-05-09 07:29:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextDecoration(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2001-06-01 02:19:43 +04:00
|
|
|
const nsStyleTextReset* text=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TextReset,(const nsStyleStruct*&)text,aFrame);
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-09 07:29:09 +04:00
|
|
|
if(text) {
|
2001-12-20 14:15:32 +03:00
|
|
|
if (NS_STYLE_TEXT_DECORATION_NONE == text->mTextDecoration) {
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(decoration);
|
2001-12-20 14:15:32 +03:00
|
|
|
}
|
|
|
|
else {
|
|
|
|
nsAutoString decorationString;
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::SearchKeywordTable(NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
|
|
|
}
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::SearchKeywordTable(NS_STYLE_TEXT_DECORATION_OVERLINE,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
|
|
|
}
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::SearchKeywordTable(NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
|
|
|
}
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::SearchKeywordTable(NS_STYLE_TEXT_DECORATION_BLINK,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
val->SetString(decorationString);
|
|
|
|
}
|
2001-05-09 07:29:09 +04:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-05-09 07:29:09 +04:00
|
|
|
}
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-05-09 07:29:09 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-05-04 15:30:34 +04:00
|
|
|
}
|
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetVisibility(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleVisibility* visibility=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Visibility,(const nsStyleStruct*&)visibility,aFrame);
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
if(visibility) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& value=
|
2001-08-07 23:05:21 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(visibility->mVisible,
|
|
|
|
nsCSSProps::kVisibilityKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(value);
|
2001-08-07 23:05:21 +04:00
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-08-07 23:05:21 +04:00
|
|
|
}
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCaptionSide(nsAWritableString& aCaptionSide)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetClear(nsAWritableString& aClear)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetClip(nsAWritableString& aClip)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetColor(nsAWritableString& aColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetContent(nsAWritableString& aContent)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCounterIncrement(nsAWritableString& aCounterIncrement)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCounterReset(nsAWritableString& aCounterReset)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2001-09-28 18:11:05 +04:00
|
|
|
nsComputedDOMStyle::GetCssFloat(nsAWritableString& aFloat)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCue(nsAWritableString& aCue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCueAfter(nsAWritableString& aCueAfter)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCueBefore(nsAWritableString& aCueBefore)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetCursor(nsAWritableString& aCursor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetDirection(nsAWritableString& aDirection)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetDisplay(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2000-05-17 10:26:23 +04:00
|
|
|
|
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
if (display) {
|
|
|
|
switch (display->mDisplay) {
|
|
|
|
case NS_STYLE_DISPLAY_NONE :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("none")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_BLOCK :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("block")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_INLINE :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("inline")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_INLINE_BLOCK :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("inline-block")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_LIST_ITEM :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("list-item")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_MARKER :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("marker")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_RUN_IN :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("run-in")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_COMPACT :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("compact")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_INLINE_TABLE :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("inline-table")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_ROW_GROUP :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-row-group")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_COLUMN :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-column")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_COLUMN_GROUP :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-column-group")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_HEADER_GROUP :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-header-group")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_FOOTER_GROUP :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-footer-group")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_ROW :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-row")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_CELL :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-cell")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_TABLE_CAPTION :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("table-caption")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
case NS_STYLE_DISPLAY_MENU :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("menu")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
default :
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("")); break;
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPosition(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
|
|
|
|
|
|
|
if (display) {
|
|
|
|
switch (display->mPosition) {
|
|
|
|
case NS_STYLE_POSITION_NORMAL:
|
|
|
|
val->SetString(NS_LITERAL_STRING("static"));
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_RELATIVE:
|
|
|
|
val->SetString(NS_LITERAL_STRING("relative"));
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_ABSOLUTE:
|
|
|
|
val->SetString(NS_LITERAL_STRING("absolute"));
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_FIXED:
|
|
|
|
val->SetString(NS_LITERAL_STRING("fixed"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Double check the position!");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, &aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetClip(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsROCSSPrimitiveValue *topVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *rightVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *bottomVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *leftVal = nsnull;
|
|
|
|
if (display) {
|
|
|
|
if (display->mClipFlags == NS_STYLE_CLIP_AUTO ||
|
|
|
|
display->mClipFlags == (NS_STYLE_CLIP_TOP_AUTO |
|
|
|
|
NS_STYLE_CLIP_RIGHT_AUTO |
|
|
|
|
NS_STYLE_CLIP_BOTTOM_AUTO |
|
|
|
|
NS_STYLE_CLIP_LEFT_AUTO)) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
}
|
|
|
|
else if (display->mClipFlags == NS_STYLE_CLIP_INHERIT) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("inherit"));
|
|
|
|
} else {
|
|
|
|
// create the cssvalues for the sides, stick them in the rect object
|
|
|
|
topVal = GetROCSSPrimitiveValue();
|
|
|
|
rightVal = GetROCSSPrimitiveValue();
|
|
|
|
bottomVal = GetROCSSPrimitiveValue();
|
|
|
|
leftVal = GetROCSSPrimitiveValue();
|
|
|
|
if (topVal && rightVal && bottomVal && leftVal) {
|
|
|
|
nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal,
|
|
|
|
bottomVal, leftVal);
|
|
|
|
if (domRect) {
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) {
|
|
|
|
topVal->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
} else {
|
|
|
|
topVal->SetTwips(display->mClip.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) {
|
|
|
|
rightVal->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
} else {
|
|
|
|
rightVal->SetTwips(display->mClip.width + display->mClip.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) {
|
|
|
|
bottomVal->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
} else {
|
|
|
|
bottomVal->SetTwips(display->mClip.height + display->mClip.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) {
|
|
|
|
leftVal->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
} else {
|
|
|
|
leftVal->SetTwips(display->mClip.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetRect(domRect);
|
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete topVal;
|
|
|
|
delete rightVal;
|
|
|
|
delete bottomVal;
|
|
|
|
delete leftVal;
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, &aValue);
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetElevation(nsAWritableString& aElevation)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetEmptyCells(nsAWritableString& aEmptyCells)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFont(nsAWritableString& aFont)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontFamily(nsAWritableString& aFontFamily)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontSize(nsAWritableString& aFontSize)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontSizeAdjust(nsAWritableString& aFontSizeAdjust)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontStretch(nsAWritableString& aFontStretch)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontStyle(nsAWritableString& aFontStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontVariant(nsAWritableString& aFontVariant)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetFontWeight(nsAWritableString& aFontWeight)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetHeight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2001-12-07 00:15:54 +03:00
|
|
|
PRBool calcHeight = PR_FALSE;
|
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
if (aFrame) {
|
2001-12-07 00:15:54 +03:00
|
|
|
calcHeight = PR_TRUE;
|
2001-11-10 20:29:04 +03:00
|
|
|
// Flush all pending notifications so that our frames are up to date
|
|
|
|
nsCOMPtr<nsIDocument> document;
|
|
|
|
mContent->GetDocument(*getter_AddRefs(document));
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
if (document) {
|
|
|
|
document->FlushPendingNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleDisplay* displayData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData, aFrame);
|
|
|
|
if (displayData && displayData->mDisplay == NS_STYLE_DISPLAY_INLINE) {
|
|
|
|
nsFrameState frameState;
|
|
|
|
aFrame->GetFrameState(&frameState);
|
|
|
|
if (! (frameState & NS_FRAME_REPLACED_ELEMENT)) {
|
2001-12-07 00:15:54 +03:00
|
|
|
calcHeight = PR_FALSE;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
}
|
2001-12-07 00:15:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (calcHeight) {
|
2001-11-10 20:29:04 +03:00
|
|
|
nsRect rect;
|
|
|
|
nsMargin padding;
|
|
|
|
nsMargin border;
|
|
|
|
aFrame->GetRect(rect);
|
|
|
|
const nsStylePadding* paddingData=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingData, aFrame);
|
|
|
|
if (paddingData) {
|
|
|
|
paddingData->CalcPaddingFor(aFrame, padding);
|
|
|
|
}
|
|
|
|
const nsStyleBorder* borderData=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData, aFrame);
|
|
|
|
if (borderData) {
|
|
|
|
borderData->CalcBorderFor(aFrame, border);
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetTwips(rect.height - padding.top - padding.bottom -
|
|
|
|
border.top - border.bottom);
|
|
|
|
} else {
|
2001-12-07 00:15:54 +03:00
|
|
|
// Just return the value in the style context
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData, aFrame);
|
|
|
|
if (positionData) {
|
|
|
|
switch (positionData->mHeight.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(positionData->mHeight.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
val->SetPercent(positionData->mHeight.GetPercentValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Inherit:
|
|
|
|
val->SetString(NS_LITERAL_STRING("inherit"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Double check the unit");
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetLeft(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-11-10 20:29:04 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetLetterSpacing(nsAWritableString& aLetterSpacing)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetLineHeight(nsAWritableString& aLineHeight)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetListStyle(nsAWritableString& aListStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetListStyleImage(nsAWritableString& aListStyleImage)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetListStylePosition(nsAWritableString& aListStylePosition)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetListStyleType(nsAWritableString& aListStyleType)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMargin(nsAWritableString& aMargin)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetMarginTop(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetMarginRight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetMarginBottom(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetMarginLeft(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMarkerOffset(nsAWritableString& aMarkerOffset)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMarks(nsAWritableString& aMarks)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMaxHeight(nsAWritableString& aMaxHeight)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMaxWidth(nsAWritableString& aMaxWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMinHeight(nsAWritableString& aMinHeight)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetMinWidth(nsAWritableString& aMinWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOrphans(nsAWritableString& aOrphans)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOutline(nsAWritableString& aOutline)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOutlineColor(nsAWritableString& aOutlineColor)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOutlineStyle(nsAWritableString& aOutlineStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOutlineWidth(nsAWritableString& aOutlineWidth)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOverflow(nsAWritableString& aOverflow)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPadding(nsAWritableString& aPadding)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPaddingTop(nsAWritableString& aPaddingTop)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPaddingRight(nsAWritableString& aPaddingRight)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPaddingBottom(nsAWritableString& aPaddingBottom)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPaddingLeft(nsAWritableString& aPaddingLeft)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPage(nsAWritableString& aPage)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPageBreakAfter(nsAWritableString& aPageBreakAfter)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPageBreakBefore(nsAWritableString& aPageBreakBefore)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPageBreakInside(nsAWritableString& aPageBreakInside)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPause(nsAWritableString& aPause)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPauseAfter(nsAWritableString& aPauseAfter)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPauseBefore(nsAWritableString& aPauseBefore)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPitch(nsAWritableString& aPitch)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPitchRange(nsAWritableString& aPitchRange)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPlayDuring(nsAWritableString& aPlayDuring)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetPosition(nsAWritableString& aPosition)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetQuotes(nsAWritableString& aQuotes)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetRichness(nsAWritableString& aRichness)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetRight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-11-10 20:29:04 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetSize(nsAWritableString& aSize)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetSpeak(nsAWritableString& aSpeak)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetSpeakHeader(nsAWritableString& aSpeakHeader)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetSpeakNumeral(nsAWritableString& aSpeakNumeral)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetSpeakPunctuation(nsAWritableString& aSpeakPunctuation)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetSpeechRate(nsAWritableString& aSpeechRate)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetStress(nsAWritableString& aStress)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetTableLayout(nsAWritableString& aTableLayout)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetTextAlign(nsAWritableString& aTextAlign)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetTextDecoration(nsAWritableString& aTextDecoration)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetTextIndent(nsAWritableString& aTextIndent)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetTextShadow(nsAWritableString& aTextShadow)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetTextTransform(nsAWritableString& aTextTransform)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetTop(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-11-10 20:29:04 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetUnicodeBidi(nsAWritableString& aUnicodeBidi)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetVerticalAlign(nsAWritableString& aVerticalAlign)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetVisibility(nsAWritableString& aVisibility)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetVoiceFamily(nsAWritableString& aVoiceFamily)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetVolume(nsAWritableString& aVolume)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetWhiteSpace(nsAWritableString& aWhiteSpace)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetWidows(nsAWritableString& aWidows)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsROCSSPrimitiveValue*
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::GetROCSSPrimitiveValue()
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2001-03-03 03:44:19 +03:00
|
|
|
nsISupports *tmp = NS_STATIC_CAST(nsIComputedDOMStyle *, this);
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *primitiveValue = new nsROCSSPrimitiveValue(tmp, mT2P);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
NS_ASSERTION(primitiveValue!=0, "ran out of memory");
|
|
|
|
|
|
|
|
return primitiveValue;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
nsresult
|
2001-11-10 20:29:04 +03:00
|
|
|
nsComputedDOMStyle::GetOffsetWidthFor(PRUint8 aSide, nsIFrame* aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-11-10 20:29:04 +03:00
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2000-05-17 10:26:23 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
// Flush all pending notifications so that our frames are up to date
|
2001-03-11 23:47:06 +03:00
|
|
|
nsCOMPtr<nsIDocument> document;
|
|
|
|
mContent->GetDocument(*getter_AddRefs(document));
|
|
|
|
if (document) {
|
|
|
|
document->FlushPendingNotifications();
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (display) {
|
|
|
|
switch (display->mPosition) {
|
|
|
|
case NS_STYLE_POSITION_NORMAL:
|
|
|
|
rv = GetStaticOffset(aSide, aFrame, aValue);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_RELATIVE:
|
|
|
|
rv = GetRelativeOffset(aSide, aFrame, aValue);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_ABSOLUTE:
|
|
|
|
case NS_STYLE_POSITION_FIXED:
|
|
|
|
rv = GetAbsoluteOffset(aSide, aFrame, aValue);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the position");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nsIFrame* container = GetContainingBlock(aFrame);
|
|
|
|
if (container) {
|
|
|
|
nsRect rect;
|
|
|
|
nsRect containerRect;
|
|
|
|
nscoord margin = GetMarginWidthCoordFor(aSide, aFrame);
|
|
|
|
nscoord border = GetBorderWidthCoordFor(aSide, container);
|
|
|
|
nscoord horScrollBarHeight = 0;
|
|
|
|
nscoord verScrollBarWidth = 0;
|
|
|
|
aFrame->GetRect(rect);
|
|
|
|
container->GetRect(containerRect);
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAtom> typeAtom;
|
|
|
|
container->GetFrameType(getter_AddRefs(typeAtom));
|
|
|
|
if (typeAtom == nsLayoutAtoms::viewportFrame) {
|
|
|
|
// For absolutely positioned frames scrollbars are taken into
|
|
|
|
// account by virtue of getting a containing block that does
|
|
|
|
// _not_ include the scrollbars. For fixed positioned frames,
|
|
|
|
// the containing block is the viewport, which _does_ include
|
|
|
|
// scrollbars. We have to do some extra work.
|
|
|
|
nsIFrame* scrollingChild;
|
|
|
|
nsCOMPtr<nsIPresShell> presShell = do_QueryReferent(mPresShellWeak);
|
|
|
|
NS_ASSERTION(presShell, "Must have a presshell!");
|
|
|
|
nsCOMPtr<nsIPresContext> presContext;
|
|
|
|
presShell->GetPresContext(getter_AddRefs(presContext));
|
|
|
|
// the first child in the default frame list is what we want
|
|
|
|
container->FirstChild(presContext, nsnull, &scrollingChild);
|
|
|
|
nsCOMPtr<nsIScrollableFrame> scrollFrame(do_QueryInterface(scrollingChild));
|
|
|
|
if (scrollFrame) {
|
|
|
|
scrollFrame->GetScrollbarSizes(presContext, &verScrollBarWidth,
|
|
|
|
&horScrollBarHeight);
|
|
|
|
PRBool verScrollBarVisible;
|
|
|
|
PRBool horScrollBarVisible;
|
|
|
|
scrollFrame->GetScrollbarVisibility(presContext, &verScrollBarVisible,
|
|
|
|
&horScrollBarVisible);
|
|
|
|
if (!verScrollBarVisible) {
|
|
|
|
verScrollBarWidth = 0;
|
|
|
|
}
|
|
|
|
if (!horScrollBarVisible) {
|
|
|
|
horScrollBarHeight = 0;
|
|
|
|
}
|
|
|
|
}
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord offset = 0;
|
|
|
|
switch (aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
offset = rect.y - margin - border;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
offset = containerRect.width - rect.width -
|
|
|
|
rect.x - margin - border - verScrollBarWidth;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
offset = containerRect.height - rect.height -
|
|
|
|
rect.y - margin - border - horScrollBarHeight;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
offset = rect.x - margin - border;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the side");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
val->SetTwips(offset);
|
|
|
|
} else {
|
|
|
|
// XXX no frame. This property makes no sense
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIFrame* aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData, aFrame);
|
|
|
|
if (positionData) {
|
|
|
|
nsStyleCoord coord;
|
|
|
|
PRInt32 sign = 1;
|
|
|
|
switch (aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
positionData->mOffset.GetTop(coord);
|
|
|
|
if (coord.GetUnit() != eStyleUnit_Coord &&
|
|
|
|
coord.GetUnit() != eStyleUnit_Percent) {
|
|
|
|
positionData->mOffset.GetBottom(coord);
|
|
|
|
sign = -1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
positionData->mOffset.GetRight(coord);
|
|
|
|
if (coord.GetUnit() != eStyleUnit_Coord &&
|
|
|
|
coord.GetUnit() != eStyleUnit_Percent) {
|
|
|
|
positionData->mOffset.GetLeft(coord);
|
|
|
|
sign = -1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
positionData->mOffset.GetBottom(coord);
|
|
|
|
if (coord.GetUnit() != eStyleUnit_Coord &&
|
|
|
|
coord.GetUnit() != eStyleUnit_Percent) {
|
|
|
|
positionData->mOffset.GetTop(coord);
|
|
|
|
sign = -1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
positionData->mOffset.GetLeft(coord);
|
|
|
|
if (coord.GetUnit() != eStyleUnit_Coord &&
|
|
|
|
coord.GetUnit() != eStyleUnit_Percent) {
|
|
|
|
positionData->mOffset.GetRight(coord);
|
|
|
|
sign = -1;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the side");
|
|
|
|
break;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
|
|
|
|
nsIFrame* container = nsnull;
|
|
|
|
const nsStyleBorder* borderData = nsnull;
|
|
|
|
const nsStylePadding* paddingData = nsnull;
|
|
|
|
nsMargin border;
|
|
|
|
nsMargin padding;
|
|
|
|
nsRect rect;
|
|
|
|
switch(coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(sign * coord.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
container = GetContainingBlock(aFrame);
|
|
|
|
if (container) {
|
|
|
|
container->GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData);
|
|
|
|
if (borderData) {
|
|
|
|
borderData->CalcBorderFor(container, border);
|
|
|
|
}
|
|
|
|
container->GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingData);
|
|
|
|
if (paddingData) {
|
|
|
|
paddingData->CalcPaddingFor(container, padding);
|
|
|
|
}
|
|
|
|
container->GetRect(rect);
|
|
|
|
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
|
|
|
val->SetTwips(sign * coord.GetPercentValue() *
|
|
|
|
(rect.width - border.left - border.right -
|
|
|
|
padding.left - padding.right));
|
|
|
|
} else {
|
|
|
|
val->SetTwips(sign * coord.GetPercentValue() *
|
|
|
|
(rect.height - border.top - border.bottom -
|
|
|
|
padding.top - padding.bottom));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// XXX no containing block.
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the unit");
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStaticOffset(PRUint8 aSide, nsIFrame* aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData, aFrame);
|
|
|
|
if (positionData) {
|
|
|
|
nsStyleCoord coord;
|
|
|
|
switch (aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
positionData->mOffset.GetTop(coord);
|
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
positionData->mOffset.GetRight(coord);
|
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
positionData->mOffset.GetBottom(coord);
|
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
positionData->mOffset.GetLeft(coord);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the side");
|
|
|
|
break;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
|
|
|
|
switch(coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(coord.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2001-12-07 00:15:54 +03:00
|
|
|
val->SetPercent(coord.GetPercentValue());
|
2001-11-10 20:29:04 +03:00
|
|
|
break;
|
2001-12-07 01:29:53 +03:00
|
|
|
case eStyleUnit_Auto:
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
break;
|
2001-11-10 20:29:04 +03:00
|
|
|
default:
|
|
|
|
NS_WARNING("double check the unit");
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nsIFrame*
|
|
|
|
nsComputedDOMStyle::GetContainingBlock(nsIFrame *aFrame)
|
|
|
|
{
|
|
|
|
if (!aFrame) {
|
|
|
|
// Tell caller that they have no containing block, seeing as they
|
|
|
|
// are not being displayed
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
nsIFrame* container = aFrame;
|
|
|
|
PRBool done = PR_FALSE;
|
|
|
|
do {
|
|
|
|
container->GetParent(&container);
|
|
|
|
if (container) {
|
|
|
|
(container)->IsPercentageBase(done);
|
|
|
|
}
|
|
|
|
} while (!done && container);
|
|
|
|
|
|
|
|
NS_POSTCONDITION(container, "Frame has no containing block");
|
|
|
|
|
|
|
|
return container;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
}
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::GetStyleData(nsStyleStructID aID,
|
2001-03-11 23:47:06 +03:00
|
|
|
const nsStyleStruct*& aStyleStruct,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIFrame* aFrame)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
if(aFrame && !mPseudo) {
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
aFrame->GetStyleData(aID, aStyleStruct);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
else if (mStyleContextHolder) {
|
|
|
|
aStyleStruct = mStyleContextHolder->GetStyleData(aID);
|
|
|
|
} else {
|
2001-03-03 03:44:19 +03:00
|
|
|
nsCOMPtr<nsIPresShell> presShell=do_QueryReferent(mPresShellWeak);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
NS_ENSURE_TRUE(presShell, NS_ERROR_FAILURE);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsCOMPtr<nsIPresContext> pctx;
|
|
|
|
presShell->GetPresContext(getter_AddRefs(pctx));
|
|
|
|
if(pctx) {
|
|
|
|
nsCOMPtr<nsIStyleContext> sctx;
|
2001-03-11 23:47:06 +03:00
|
|
|
if(!mPseudo) {
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
pctx->ResolveStyleContextFor(mContent, nsnull, PR_FALSE,
|
|
|
|
getter_AddRefs(sctx));
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
else {
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
pctx->ResolvePseudoStyleContextFor(mContent, mPseudo, nsnull, PR_FALSE,
|
|
|
|
getter_AddRefs(sctx));
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
2001-03-03 03:44:19 +03:00
|
|
|
if(sctx) {
|
|
|
|
aStyleStruct=sctx->GetStyleData(aID);
|
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
mStyleContextHolder=sctx;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
NS_ASSERTION(aStyleStruct, "Failed to get a style struct");
|
2001-03-11 23:47:06 +03:00
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2001-03-03 03:44:19 +03:00
|
|
|
nsComputedDOMStyle::GetPaddingWidthFor(PRUint8 aSide,
|
|
|
|
nsIFrame *aFrame,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2001-11-10 20:29:04 +03:00
|
|
|
|
|
|
|
nscoord width = GetPaddingWidthCoordFor(aSide, aFrame);
|
|
|
|
val->SetTwips(width);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord
|
|
|
|
nsComputedDOMStyle::GetPaddingWidthCoordFor(PRUint8 aSide, nsIFrame* aFrame)
|
|
|
|
{
|
|
|
|
const nsStylePadding* paddingData=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingData, aFrame);
|
|
|
|
|
|
|
|
if(paddingData) {
|
|
|
|
nsMargin padding;
|
|
|
|
paddingData->CalcPaddingFor(aFrame, padding);
|
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP :
|
|
|
|
return padding.top;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM :
|
|
|
|
return padding.bottom;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT :
|
|
|
|
return padding.left;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT :
|
|
|
|
return padding.right;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the side");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
nsComputedDOMStyle::GetBorderWidthCoordFor(PRUint8 aSide, nsIFrame *aFrame)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBorder* borderData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData, aFrame);
|
|
|
|
|
|
|
|
if(borderData) {
|
|
|
|
nsMargin border;
|
|
|
|
borderData->CalcBorderFor(aFrame, border);
|
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP :
|
|
|
|
return border.top;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM :
|
|
|
|
return border.bottom;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT :
|
|
|
|
return border.left;
|
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT :
|
|
|
|
return border.right;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the side");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2001-03-03 03:44:19 +03:00
|
|
|
nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
const nsStyleBorder* border = nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
|
|
|
|
2001-03-12 00:03:08 +03:00
|
|
|
if(border) {
|
|
|
|
nsStyleCoord coord;
|
2002-01-25 00:19:21 +03:00
|
|
|
PRUint8 borderStyle = border->GetBorderStyle(aSide);
|
|
|
|
if (borderStyle == NS_STYLE_BORDER_STYLE_NONE) {
|
|
|
|
coord.SetCoordValue(0);
|
|
|
|
}
|
|
|
|
else {
|
2001-10-17 04:05:05 +04:00
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
border->mBorder.GetTop(coord); break;
|
|
|
|
case NS_SIDE_BOTTOM :
|
|
|
|
border->mBorder.GetBottom(coord); break;
|
|
|
|
case NS_SIDE_LEFT :
|
|
|
|
border->mBorder.GetLeft(coord); break;
|
|
|
|
case NS_SIDE_RIGHT :
|
|
|
|
border->mBorder.GetRight(coord); break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("double check the side");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-03-03 03:44:19 +03:00
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
switch(coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(coord.GetCoordValue()); break;
|
|
|
|
case eStyleUnit_Integer:
|
|
|
|
case eStyleUnit_Proportional:
|
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
case eStyleUnit_Chars:
|
|
|
|
{
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& width=
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsCSSProps::SearchKeywordTable(coord.GetIntValue(),
|
|
|
|
nsCSSProps::kBorderWidthKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(width); break;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
default:
|
|
|
|
NS_WARNING("double check the unit");
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
break;
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2001-03-30 06:08:48 +04:00
|
|
|
nsComputedDOMStyle::GetBorderColorFor(PRUint8 aSide,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIFrame *aFrame,
|
2001-03-30 06:08:48 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBorder* border = nsnull;
|
2001-06-01 02:19:43 +04:00
|
|
|
GetStyleData(eStyleStruct_Border,(const nsStyleStruct*&)border,aFrame);
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
if(border) {
|
2001-06-01 02:19:43 +04:00
|
|
|
nscolor color;
|
|
|
|
PRBool transparent;
|
|
|
|
PRBool foreground;
|
|
|
|
border->GetBorderColor(aSide, color, transparent, foreground);
|
|
|
|
if (foreground) {
|
|
|
|
const nsStyleColor* colorStruct = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Color,(const nsStyleStruct*&)colorStruct,
|
|
|
|
aFrame);
|
|
|
|
color = colorStruct->mColor;
|
|
|
|
}
|
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
nsAutoString hex;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
ColorToHex(color, hex);
|
2001-03-30 06:08:48 +04:00
|
|
|
val->SetString(hex);
|
|
|
|
}
|
|
|
|
else {
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING(""));
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2001-03-11 23:47:06 +03:00
|
|
|
nsComputedDOMStyle::GetMarginWidthFor(PRUint8 aSide,
|
|
|
|
nsIFrame *aFrame,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord width = GetMarginWidthCoordFor(aSide, aFrame);
|
|
|
|
val->SetTwips(width);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
nsComputedDOMStyle::GetMarginWidthCoordFor(PRUint8 aSide,
|
|
|
|
nsIFrame *aFrame)
|
|
|
|
{
|
|
|
|
const nsStyleMargin* marginData=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Margin, (const nsStyleStruct*&)marginData, aFrame);
|
|
|
|
if(marginData) {
|
|
|
|
nsMargin margin;
|
|
|
|
marginData->CalcMarginFor(aFrame, margin);
|
2001-03-11 23:47:06 +03:00
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP :
|
2001-11-10 20:29:04 +03:00
|
|
|
return margin.top;
|
|
|
|
break;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
case NS_SIDE_BOTTOM :
|
2001-11-10 20:29:04 +03:00
|
|
|
return margin.bottom;
|
|
|
|
break;
|
2001-03-11 23:47:06 +03:00
|
|
|
case NS_SIDE_LEFT :
|
2001-11-10 20:29:04 +03:00
|
|
|
return margin.left;
|
|
|
|
break;
|
2001-03-11 23:47:06 +03:00
|
|
|
case NS_SIDE_RIGHT :
|
2001-11-10 20:29:04 +03:00
|
|
|
return margin.right;
|
2001-03-12 00:03:08 +03:00
|
|
|
break;
|
2001-03-11 23:47:06 +03:00
|
|
|
default:
|
2001-11-10 20:29:04 +03:00
|
|
|
NS_WARNING("double check the side");
|
2001-03-11 23:47:06 +03:00
|
|
|
break;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
return 0;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2001-03-03 03:44:19 +03:00
|
|
|
nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsIFrame *aFrame,
|
2001-03-03 03:44:19 +03:00
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
const nsStyleBorder* border = nsnull;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2002-01-25 00:19:21 +03:00
|
|
|
PRUint8 borderStyle = NS_STYLE_BORDER_STYLE_NONE;
|
|
|
|
|
|
|
|
if (border) {
|
|
|
|
borderStyle = border->GetBorderStyle(aSide);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (borderStyle != NS_STYLE_BORDER_STYLE_NONE) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& style=
|
2002-01-25 00:19:21 +03:00
|
|
|
nsCSSProps::SearchKeywordTable(borderStyle,
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsCSSProps::kBorderStyleKTable);
|
2002-01-11 03:15:55 +03:00
|
|
|
val->SetString(style);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
else {
|
2002-01-25 00:19:21 +03:00
|
|
|
val->SetString(NS_LITERAL_STRING("none"));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-01-25 00:19:21 +03:00
|
|
|
return CallQueryInterface(val, &aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSPrimitiveValue*& aValue)
|
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue* val=GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2001-12-07 00:15:54 +03:00
|
|
|
PRBool calcWidth = PR_FALSE;
|
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
if (aFrame) {
|
2001-12-07 00:15:54 +03:00
|
|
|
calcWidth = PR_TRUE;
|
2001-11-10 20:29:04 +03:00
|
|
|
// Flush all pending notifications so that our frames are up to date
|
|
|
|
nsCOMPtr<nsIDocument> document;
|
|
|
|
mContent->GetDocument(*getter_AddRefs(document));
|
|
|
|
|
|
|
|
if (document) {
|
|
|
|
document->FlushPendingNotifications();
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleDisplay* displayData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData, aFrame);
|
|
|
|
if (displayData && displayData->mDisplay == NS_STYLE_DISPLAY_INLINE) {
|
|
|
|
nsFrameState frameState;
|
|
|
|
aFrame->GetFrameState(&frameState);
|
|
|
|
if (! (frameState & NS_FRAME_REPLACED_ELEMENT)) {
|
2001-12-07 00:15:54 +03:00
|
|
|
calcWidth = PR_FALSE;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
}
|
2001-12-07 00:15:54 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (calcWidth) {
|
2001-11-10 20:29:04 +03:00
|
|
|
nsRect rect;
|
|
|
|
nsMargin padding;
|
|
|
|
nsMargin border;
|
|
|
|
aFrame->GetRect(rect);
|
|
|
|
const nsStylePadding* paddingData=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingData, aFrame);
|
|
|
|
if (paddingData) {
|
|
|
|
paddingData->CalcPaddingFor(aFrame, padding);
|
|
|
|
}
|
|
|
|
const nsStyleBorder* borderData=nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData, aFrame);
|
|
|
|
if (borderData) {
|
|
|
|
borderData->CalcBorderFor(aFrame, border);
|
|
|
|
}
|
|
|
|
val->SetTwips(rect.width - padding.left - padding.right -
|
|
|
|
border.left - border.right);
|
|
|
|
} else {
|
2001-12-07 00:15:54 +03:00
|
|
|
// Just return the value in the style context
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData, aFrame);
|
|
|
|
if (positionData) {
|
|
|
|
switch (positionData->mWidth.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(positionData->mWidth.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
val->SetPercent(positionData->mWidth.GetPercentValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
val->SetString(NS_LITERAL_STRING("auto"));
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Inherit:
|
|
|
|
val->SetString(NS_LITERAL_STRING("inherit"));
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_WARNING("Double check the unit");
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue),
|
|
|
|
(void **)&aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#if 0
|
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetWordSpacing(nsAWritableString& aWordSpacing)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetZIndex(nsAWritableString& aZIndex)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-08-23 21:27:06 +04:00
|
|
|
nsComputedDOMStyle::GetOpacity(nsAWritableString& aOpacity)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
#endif
|