2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-17 21:52:36 +00:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2000-05-04 00:07:33 +00:00
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The contents of this file are subject to the Mozilla 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/MPL/
|
2000-05-04 00:07:33 +00:00
|
|
|
*
|
2001-09-25 01:32:19 +00: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 00:07:33 +00:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-17 21:52:36 +00:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 01:32:19 +00:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-05-04 00:07:33 +00: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 16:46:42 +00:00
|
|
|
* Contributor(s):
|
2001-12-20 11:15:32 +00:00
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2002-03-12 21:16:22 +00:00
|
|
|
* Boris Zbarsky <bzbarsky@mit.edu>
|
|
|
|
* Christopher A. Aillon <christopher@aillon.com>
|
2005-03-27 11:36:08 +00:00
|
|
|
* Mats Palmgren <mats.palmgren@bredband.net>
|
2005-09-19 15:47:26 +00:00
|
|
|
* Christian Biesinger <cbiesinger@web.de>
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-17 21:52:36 +00:00
|
|
|
* either of 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"),
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 01:32:19 +00:00
|
|
|
* 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
|
2004-04-17 21:52:36 +00:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 01:32:19 +00:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2006-03-25 05:47:31 +00:00
|
|
|
/* DOM object returned from element.getComputedStyle() */
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsComputedDOMStyle.h"
|
|
|
|
|
|
|
|
#include "nsDOMError.h"
|
2004-04-01 19:44:17 +00:00
|
|
|
#include "nsDOMString.h"
|
2002-10-03 19:41:42 +00:00
|
|
|
#include "nsIDOMCSS2Properties.h"
|
2000-05-04 00:07:33 +00:00
|
|
|
#include "nsIDOMElement.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsIScrollableFrame.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "prprf.h"
|
2000-05-15 01:59:05 +00:00
|
|
|
|
|
|
|
#include "nsCSSProps.h"
|
2001-12-20 11:15:32 +00:00
|
|
|
#include "nsCSSKeywords.h"
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsDOMCSSRect.h"
|
|
|
|
#include "nsLayoutAtoms.h"
|
2004-11-25 02:43:28 +00:00
|
|
|
#include "nsHTMLReflowState.h"
|
2002-04-20 14:30:57 +00:00
|
|
|
#include "nsThemeConstants.h"
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2001-03-11 20:47:06 +00:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
|
2004-01-17 20:04:26 +00:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2004-01-28 00:18:22 +00:00
|
|
|
#include "nsStyleSet.h"
|
2004-03-09 03:57:51 +00:00
|
|
|
#include "imgIRequest.h"
|
2004-03-29 16:00:38 +00:00
|
|
|
#include "nsInspectorCSSUtils.h"
|
2004-01-17 20:04:26 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
#if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
|
|
|
|
#define DEBUG_ComputedDOMStyle
|
|
|
|
#endif
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
/*
|
|
|
|
* This is the implementation of the readonly CSSStyleDeclaration that is
|
|
|
|
* returned by the getComputedStyle() function.
|
|
|
|
*/
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
static nsComputedDOMStyle *sCachedComputedDOMStyle;
|
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
nsresult
|
|
|
|
NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aComputedStyle);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
if (sCachedComputedDOMStyle) {
|
|
|
|
// There's an unused nsComputedDOMStyle cached, use it.
|
|
|
|
// But before we use it, re-initialize the object.
|
|
|
|
|
|
|
|
// Oh yeah baby, placement new!
|
|
|
|
*aComputedStyle = new (sCachedComputedDOMStyle) nsComputedDOMStyle();
|
|
|
|
|
|
|
|
sCachedComputedDOMStyle = nsnull;
|
|
|
|
} else {
|
|
|
|
// No nsComputedDOMStyle cached, create a new one.
|
|
|
|
|
|
|
|
*aComputedStyle = new nsComputedDOMStyle();
|
|
|
|
NS_ENSURE_TRUE(*aComputedStyle, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
}
|
2000-05-04 00:07:33 +00:00
|
|
|
|
|
|
|
NS_ADDREF(*aComputedStyle);
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2005-01-04 20:17:25 +00:00
|
|
|
static nsIFrame*
|
|
|
|
GetContainingBlockFor(nsIFrame* aFrame) {
|
|
|
|
if (!aFrame) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
return nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
|
|
|
}
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
nsComputedDOMStyle::nsComputedDOMStyle()
|
2005-06-03 01:51:15 +00:00
|
|
|
: mInner(this), mDocumentWeak(nsnull), mT2P(0.0f)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::~nsComputedDOMStyle()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::Shutdown()
|
|
|
|
{
|
|
|
|
// We want to de-allocate without calling the dtor since we
|
|
|
|
// already did that manually in doDestroyComputedDOMStyle(),
|
|
|
|
// so cast our cached object to something that doesn't know
|
|
|
|
// about our dtor.
|
|
|
|
delete NS_REINTERPRET_CAST(char*, sCachedComputedDOMStyle);
|
|
|
|
sCachedComputedDOMStyle = nsnull;
|
|
|
|
}
|
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2003-07-11 20:44:25 +00:00
|
|
|
// QueryInterface implementation for nsComputedDOMStyle
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsComputedDOMStyle)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIComputedDOMStyle)
|
2004-06-08 01:32:29 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
|
2003-07-11 20:44:25 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIDOMCSSStyleDeclaration)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties, &mInner)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties, &mInner)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIComputedDOMStyle)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_CONTENT_CLASSINFO(ComputedCSSStyleDeclaration)
|
|
|
|
NS_INTERFACE_MAP_END
|
2000-05-04 00:07:33 +00:00
|
|
|
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
static void doDestroyComputedDOMStyle(nsComputedDOMStyle *aComputedStyle)
|
|
|
|
{
|
|
|
|
if (!sCachedComputedDOMStyle) {
|
|
|
|
// The cache is empty, store aComputedStyle in the cache.
|
|
|
|
|
|
|
|
sCachedComputedDOMStyle = aComputedStyle;
|
|
|
|
sCachedComputedDOMStyle->~nsComputedDOMStyle();
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-07-08 07:11:59 +00:00
|
|
|
// The cache is full, delete aComputedStyle
|
|
|
|
|
|
|
|
delete aComputedStyle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-07 21:50:21 +00:00
|
|
|
NS_IMPL_ADDREF(nsComputedDOMStyle)
|
2002-07-08 07:11:59 +00:00
|
|
|
NS_IMPL_RELEASE_WITH_DESTROY(nsComputedDOMStyle,
|
2003-09-07 21:50:21 +00:00
|
|
|
doDestroyComputedDOMStyle(this))
|
2000-05-04 00:07:33 +00: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 16:46:42 +00:00
|
|
|
nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
2002-03-23 22:56:05 +00:00
|
|
|
const nsAString& aPseudoElt,
|
2000-05-15 01:59:05 +00:00
|
|
|
nsIPresShell *aPresShell)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aElement);
|
|
|
|
NS_ENSURE_ARG_POINTER(aPresShell);
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
mDocumentWeak = do_GetWeakReference(aPresShell->GetDocument());
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
mContent = do_QueryInterface(aElement);
|
|
|
|
if (!mContent) {
|
|
|
|
// This should not happen, all our elements support nsIContent!
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
|
2004-01-17 20:04:26 +00:00
|
|
|
if (!DOMStringIsNull(aPseudoElt) && !aPseudoElt.IsEmpty() &&
|
|
|
|
aPseudoElt.First() == PRUnichar(':')) {
|
|
|
|
// deal with two-colon forms of aPseudoElt
|
|
|
|
nsAString::const_iterator start, end;
|
|
|
|
aPseudoElt.BeginReading(start);
|
|
|
|
aPseudoElt.EndReading(end);
|
|
|
|
NS_ASSERTION(start != end, "aPseudoElt is not empty!");
|
|
|
|
++start;
|
|
|
|
PRBool haveTwoColons = PR_TRUE;
|
|
|
|
if (start == end || *start != PRUnichar(':')) {
|
|
|
|
--start;
|
|
|
|
haveTwoColons = PR_FALSE;
|
|
|
|
}
|
|
|
|
mPseudo = do_GetAtom(Substring(start, end));
|
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 16:46:42 +00:00
|
|
|
NS_ENSURE_TRUE(mPseudo, NS_ERROR_OUT_OF_MEMORY);
|
2004-01-17 20:04:26 +00:00
|
|
|
|
|
|
|
// There aren't any non-CSS2 pseudo-elements with a single ':'
|
|
|
|
if (!haveTwoColons &&
|
|
|
|
!nsCSSPseudoElements::IsCSS2PseudoElement(mPseudo)) {
|
|
|
|
// XXXbz I'd really rather we threw an exception or something, but
|
|
|
|
// the DOM spec sucks.
|
|
|
|
mPseudo = nsnull;
|
|
|
|
}
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2004-08-20 20:34:37 +00:00
|
|
|
nsPresContext *presCtx = aPresShell->GetPresContext();
|
2000-05-15 01:59:05 +00:00
|
|
|
NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2004-02-11 04:57:07 +00:00
|
|
|
mT2P = presCtx->TwipsToPixels();
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2004-06-08 01:32:29 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComputedDOMStyle::GetPropertyValue(const nsCSSProperty aPropID,
|
|
|
|
nsAString& aValue)
|
|
|
|
{
|
|
|
|
// This is mostly to avoid code duplication with GetPropertyCSSValue(); if
|
|
|
|
// perf ever becomes an issue here (doubtful), we can look into changing
|
|
|
|
// this.
|
|
|
|
return GetPropertyValue(
|
|
|
|
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)),
|
|
|
|
aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComputedDOMStyle::SetPropertyValue(const nsCSSProperty aPropID,
|
|
|
|
const nsAString& aValue)
|
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetCssText(nsAString& aCssText)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
aCssText.Truncate();
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::SetCssText(const nsAString& aCssText)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::GetLength(PRUint32* aLength)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2002-10-08 01:53:31 +00:00
|
|
|
NS_PRECONDITION(aLength, "Null aLength! Prepare to die!");
|
|
|
|
|
|
|
|
(void)GetQueryablePropertyMap(aLength);
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aParentRule);
|
|
|
|
*aParentRule = nsnull;
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-06-14 00:06:36 +00: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 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
2000-05-15 01:59:05 +00:00
|
|
|
nsIDOMCSSValue** aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
NS_ENSURE_ARG_POINTER(aReturn);
|
|
|
|
*aReturn = nsnull;
|
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
nsCOMPtr<nsIDocument> document = do_QueryReferent(mDocumentWeak);
|
|
|
|
NS_ENSURE_TRUE(document, NS_ERROR_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 16:46:42 +00:00
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
// Flush _before_ getting the presshell, since that could create a new
|
|
|
|
// presshell. Also note that we want to flush the style on the document
|
|
|
|
// we're computing style in, not on the document mContent is in -- the two
|
|
|
|
// may be different.
|
|
|
|
document->FlushPendingNotifications(Flush_Style);
|
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 16:46:42 +00:00
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
nsIPresShell* presShell = document->GetShellAt(0);
|
|
|
|
NS_ENSURE_TRUE(presShell, NS_ERROR_NOT_AVAILABLE);
|
2004-05-27 22:08:42 +00:00
|
|
|
|
2005-08-22 22:24:29 +00:00
|
|
|
nsIFrame *frame = presShell->GetPrimaryFrameFor(mContent);
|
2000-05-15 01:59:05 +00:00
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
|
|
|
|
2002-10-08 01:53:31 +00:00
|
|
|
PRUint32 i = 0;
|
|
|
|
PRUint32 length = 0;
|
|
|
|
const ComputedStyleMapEntry* propMap = GetQueryablePropertyMap(&length);
|
|
|
|
for (; i < length; ++i) {
|
|
|
|
if (prop == propMap[i].mProperty) {
|
|
|
|
// Call our pointer-to-member-function.
|
|
|
|
rv = (this->*(propMap[i].mGetter))(frame, aReturn);
|
2001-03-30 02:08:48 +00:00
|
|
|
break;
|
2002-10-08 01:53:31 +00:00
|
|
|
}
|
2000-05-15 01:59:05 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 01:53:31 +00:00
|
|
|
#ifdef DEBUG_ComputedDOMStyle
|
|
|
|
if (i == length) {
|
2006-02-03 14:18:39 +00:00
|
|
|
NS_WARNING(PromiseFlatCString(NS_ConvertUTF16toUTF8(aPropertyName) +
|
2002-10-08 01:53:31 +00:00
|
|
|
NS_LITERAL_CSTRING(" is not queryable!")).get());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
*aReturn = nsnull;
|
2000-05-15 01:59:05 +00: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 16:46:42 +00:00
|
|
|
// Release the current style context for it should be re-resolved
|
2001-03-11 20:47:06 +00:00
|
|
|
// whenever a frame is not available.
|
2002-09-07 01:48:39 +00:00
|
|
|
mStyleContextHolder = nsnull;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2000-06-14 00:06:36 +00:00
|
|
|
return rv;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::RemoveProperty(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetPropertyPriority(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
aReturn.Truncate();
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::SetProperty(const nsAString& aPropertyName,
|
|
|
|
const nsAString& aValue,
|
|
|
|
const nsAString& aPriority)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::Item(PRUint32 aIndex, nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
aReturn.Truncate();
|
2002-10-08 01:53:31 +00:00
|
|
|
|
|
|
|
PRUint32 length = 0;
|
|
|
|
const ComputedStyleMapEntry* propMap = GetQueryablePropertyMap(&length);
|
2002-09-04 02:15:35 +00:00
|
|
|
if (aIndex < length) {
|
2006-02-03 14:18:39 +00:00
|
|
|
CopyASCIItoUTF16(nsCSSProps::GetStringValue(propMap[aIndex].mProperty),
|
2002-09-07 01:48:39 +00:00
|
|
|
aReturn);
|
2001-05-14 11:23:53 +00:00
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
// Property getters...
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2000-06-14 00:06:36 +00:00
|
|
|
nsresult
|
2002-03-12 21:16:22 +00:00
|
|
|
nsComputedDOMStyle::GetBinding(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2001-03-11 20:47:06 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2000-06-14 00:06:36 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2001-05-31 22:19:43 +00: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 16:46:42 +00:00
|
|
|
|
2001-05-31 22:19:43 +00:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2000-06-14 00:06:36 +00:00
|
|
|
|
2003-10-01 22:53:56 +00:00
|
|
|
if (display && display->mBinding) {
|
2002-07-08 07:11:59 +00:00
|
|
|
val->SetURI(display->mBinding);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2000-06-14 00:06:36 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetClear(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay *display = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2002-03-16 17:04:35 +00:00
|
|
|
|
|
|
|
if (display && display->mBreakType != NS_STYLE_CLEAR_NONE) {
|
|
|
|
const nsAFlatCString& clear =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(display->mBreakType,
|
|
|
|
nsCSSProps::kClearKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(clear);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2001-09-28 07:39:41 +00:00
|
|
|
nsresult
|
2001-09-28 14:11:05 +00:00
|
|
|
nsComputedDOMStyle::GetCssFloat(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-09-28 07:39:41 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-09-28 07:39:41 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (display && display->mFloats != NS_STYLE_FLOAT_NONE) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& cssFloat =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(display->mFloats,
|
|
|
|
nsCSSProps::kFloatKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(cssFloat);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2001-09-28 07:39:41 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-09-28 07:39:41 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 04:57:50 +00:00
|
|
|
nsresult
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::GetBottom(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2001-11-10 17:29:04 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
nsDOMCSSRGBColor*
|
|
|
|
nsComputedDOMStyle::GetDOMCSSRGBColor(nscolor aColor)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-03-22 20:18:42 +00:00
|
|
|
nsROCSSPrimitiveValue *red = GetROCSSPrimitiveValue();
|
|
|
|
nsROCSSPrimitiveValue *green = GetROCSSPrimitiveValue();
|
|
|
|
nsROCSSPrimitiveValue *blue = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
if (red && green && blue) {
|
|
|
|
nsDOMCSSRGBColor *rgbColor = new nsDOMCSSRGBColor(red, green, blue);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
if (rgbColor) {
|
|
|
|
red->SetNumber(NS_GET_R(aColor));
|
|
|
|
green->SetNumber(NS_GET_G(aColor));
|
|
|
|
blue->SetNumber(NS_GET_B(aColor));
|
|
|
|
|
|
|
|
return rgbColor;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete red;
|
|
|
|
delete green;
|
|
|
|
delete blue;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
return nsnull;
|
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2001-03-03 00:44:19 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-03-22 20:18:42 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)color, aFrame);
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
nsDOMCSSRGBColor *rgb = nsnull;
|
|
|
|
|
|
|
|
if (color) {
|
|
|
|
rgb = GetDOMCSSRGBColor(color->mColor);
|
2002-09-07 01:48:39 +00:00
|
|
|
if (!rgb) {
|
2002-03-22 20:18:42 +00:00
|
|
|
delete val;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
|
|
|
val->SetColor(rgb);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOpacity(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2003-11-01 22:34:59 +00:00
|
|
|
const nsStyleDisplay *display = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2003-11-01 22:34:59 +00:00
|
|
|
if (display) {
|
|
|
|
val->SetNumber(display->mOpacity);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2004-06-17 11:57:37 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColumnCount(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleColumn* column = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Column, (const nsStyleStruct*&)column, aFrame);
|
|
|
|
|
|
|
|
if (column) {
|
|
|
|
if (column->mColumnCount == NS_STYLE_COLUMN_COUNT_AUTO) {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2004-06-17 11:57:37 +00:00
|
|
|
} else {
|
|
|
|
val->SetNumber(column->mColumnCount);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColumnWidth(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleColumn* column = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Column, (const nsStyleStruct*&)column, aFrame);
|
|
|
|
|
|
|
|
if (column) {
|
|
|
|
switch (column->mColumnWidth.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(column->mColumnWidth.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
// XXX fix this. When we actually have a column frame, I think
|
|
|
|
// we should return the computed column width.
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2004-06-17 11:57:37 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected column width unit");
|
2004-06-17 11:57:37 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2004-07-18 12:12:46 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColumnGap(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleColumn* column = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Column, (const nsStyleStruct*&)column, aFrame);
|
|
|
|
|
|
|
|
if (column) {
|
|
|
|
switch (column->mColumnGap.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(column->mColumnGap.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
if (aFrame) {
|
|
|
|
val->SetTwips(column->mColumnGap.GetPercentValue()*aFrame->GetSize().width);
|
|
|
|
} else {
|
|
|
|
val->SetPercent(column->mColumnGap.GetPercentValue());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected column gap unit");
|
2004-07-18 12:12:46 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2005-04-01 23:07:00 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetCounterIncrement(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleContent *content = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame);
|
|
|
|
|
|
|
|
if (content && content->CounterIncrementCount() == 0) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
if (content) {
|
|
|
|
for (PRUint32 i = 0, i_end = content->CounterIncrementCount(); i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue();
|
|
|
|
if (!name) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(name)) {
|
|
|
|
delete valueList;
|
|
|
|
delete name;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue();
|
|
|
|
if (!value) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(value)) {
|
|
|
|
delete valueList;
|
|
|
|
delete value;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleCounterData *data = content->GetCounterIncrementAt(i);
|
|
|
|
name->SetString(data->mCounter);
|
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetCounterReset(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleContent *content = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame);
|
|
|
|
|
|
|
|
if (content && content->CounterResetCount() == 0) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
if (content) {
|
|
|
|
for (PRUint32 i = 0, i_end = content->CounterResetCount(); i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue();
|
|
|
|
if (!name) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(name)) {
|
|
|
|
delete valueList;
|
|
|
|
delete name;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue();
|
|
|
|
if (!value) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(value)) {
|
|
|
|
delete valueList;
|
|
|
|
delete value;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleCounterData *data = content->GetCounterResetAt(i);
|
|
|
|
name->SetString(data->mCounter);
|
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
2001-03-03 00:44:19 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontFamily(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (font) {
|
2005-06-03 01:51:15 +00:00
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocumentWeak);
|
|
|
|
NS_ASSERTION(doc, "document is required");
|
|
|
|
nsIPresShell* presShell = doc->GetShellAt(0);
|
2001-09-07 02:28:10 +00:00
|
|
|
NS_ASSERTION(presShell, "pres shell is required");
|
2004-08-20 20:34:37 +00:00
|
|
|
nsPresContext *presContext = presShell->GetPresContext();
|
2001-09-07 02:28:10 +00:00
|
|
|
NS_ASSERTION(presContext, "pres context is required");
|
|
|
|
|
2001-09-27 18:33:58 +00:00
|
|
|
const nsString& fontName = font->mFont.name;
|
|
|
|
PRUint8 generic = font->mFlags & NS_STYLE_FONT_FACE_MASK;
|
2004-06-03 21:19:08 +00:00
|
|
|
if (generic == kGenericFont_NONE && !font->mFont.systemFont) {
|
2004-01-31 22:41:40 +00:00
|
|
|
const nsFont* defaultFont =
|
|
|
|
presContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID);
|
|
|
|
|
2002-01-10 00:04:35 +00:00
|
|
|
PRInt32 lendiff = fontName.Length() - defaultFont->name.Length();
|
2001-09-07 02:28:10 +00:00
|
|
|
if (lendiff > 0) {
|
|
|
|
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
|
|
|
} else {
|
|
|
|
val->SetString(fontName);
|
|
|
|
}
|
|
|
|
} else {
|
2001-09-27 18:33:58 +00:00
|
|
|
val->SetString(fontName);
|
2001-09-07 02:28:10 +00:00
|
|
|
}
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontSize(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
// Note: font->mSize is the 'computed size'; font->mFont.size is the
|
|
|
|
// 'actual size'
|
2001-09-27 18:33:58 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontSizeAdjust(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleFont *font = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
|
|
|
if (font && font->mFont.sizeAdjust) {
|
|
|
|
val->SetNumber(font->mFont.sizeAdjust);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2001-03-03 00:44:19 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
if (font && font->mFont.style != NS_STYLE_FONT_STYLE_NORMAL) {
|
|
|
|
const nsAFlatCString& style=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(font->mFont.style,
|
|
|
|
nsCSSProps::kFontStyleKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(style);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontWeight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (font) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& str_weight=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(font->mFont.weight,
|
|
|
|
nsCSSProps::kFontWeightKTable);
|
2002-09-07 01:48:39 +00:00
|
|
|
if (!str_weight.IsEmpty()) {
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(str_weight);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-03-08 19:04:15 +00:00
|
|
|
val->SetNumber(font->mFont.weight);
|
2001-03-11 21:03:08 +00:00
|
|
|
}
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontVariant(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
if (font && font->mFont.variant != NS_STYLE_FONT_VARIANT_NORMAL) {
|
|
|
|
const nsAFlatCString& variant=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(font->mFont.variant,
|
|
|
|
nsCSSProps::kFontVariantKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(variant);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundAttachment(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBackground *background = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)background,
|
|
|
|
aFrame);
|
2002-03-16 17:04:35 +00:00
|
|
|
|
|
|
|
if (background) {
|
|
|
|
const nsAFlatCString& backgroundAttachment =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(background->mBackgroundAttachment,
|
|
|
|
nsCSSProps::kBackgroundAttachmentKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(backgroundAttachment);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-10-08 10:24:53 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundClip(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBackground *background = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)background, aFrame);
|
|
|
|
|
|
|
|
PRUint8 clip = NS_STYLE_BG_CLIP_BORDER;
|
|
|
|
if (background) {
|
|
|
|
clip = background->mBackgroundClip;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& backgroundClip =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(clip,
|
|
|
|
nsCSSProps::kBackgroundClipKTable);
|
2002-10-08 10:24:53 +00:00
|
|
|
|
|
|
|
val->SetIdent(backgroundClip);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2001-03-03 00:44:19 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleBackground* color = nsnull;
|
2001-05-31 22:19:43 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (color) {
|
2002-01-07 23:46:07 +00:00
|
|
|
if (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& backgroundColor =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_BG_COLOR_TRANSPARENT,
|
|
|
|
nsCSSProps::kBackgroundColorKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(backgroundColor);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-03-22 20:18:42 +00:00
|
|
|
nsDOMCSSRGBColor *rgb = nsnull;
|
|
|
|
rgb = GetDOMCSSRGBColor(color->mBackgroundColor);
|
2002-09-07 01:48:39 +00:00
|
|
|
if (!rgb) {
|
2002-03-22 20:18:42 +00:00
|
|
|
delete val;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
|
|
|
val->SetColor(rgb);
|
2001-09-06 08:20:50 +00:00
|
|
|
}
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundImage(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleBackground* color = nsnull;
|
2001-05-31 22:19:43 +00:00
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)color, aFrame);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
if (color) {
|
2002-01-11 00:15:55 +00:00
|
|
|
if (color->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-01-11 00:15:55 +00:00
|
|
|
} else {
|
2004-03-09 03:57:51 +00:00
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (color->mBackgroundImage) {
|
|
|
|
color->mBackgroundImage->GetURI(getter_AddRefs(uri));
|
|
|
|
}
|
|
|
|
val->SetURI(uri);
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2003-01-17 09:33:52 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundInlinePolicy(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBackground *background = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)background, aFrame);
|
|
|
|
|
|
|
|
PRUint8 policy = NS_STYLE_BG_INLINE_POLICY_CONTINUOUS;
|
|
|
|
if (background) {
|
|
|
|
policy = background->mBackgroundInlinePolicy;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& backgroundPolicy =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(policy,
|
|
|
|
nsCSSProps::kBackgroundInlinePolicyKTable);
|
2003-01-17 09:33:52 +00:00
|
|
|
|
|
|
|
val->SetIdent(backgroundPolicy);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-10-08 10:24:53 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundOrigin(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBackground *background = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)background, aFrame);
|
|
|
|
|
|
|
|
PRUint8 origin = NS_STYLE_BG_ORIGIN_PADDING;
|
|
|
|
if (background) {
|
|
|
|
origin = background->mBackgroundOrigin;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& backgroundOrigin =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(origin,
|
|
|
|
nsCSSProps::kBackgroundOriginKTable);
|
2002-10-08 10:24:53 +00:00
|
|
|
|
|
|
|
val->SetIdent(backgroundOrigin);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundRepeat(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBackground *background = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Background, (const nsStyleStruct*&)background,
|
|
|
|
aFrame);
|
2002-03-16 17:04:35 +00:00
|
|
|
|
|
|
|
if (background) {
|
|
|
|
const nsAFlatCString& backgroundRepeat =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(background->mBackgroundRepeat,
|
|
|
|
nsCSSProps::kBackgroundRepeatKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(backgroundRepeat);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2001-03-03 00:44:19 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPadding(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
// return null per spec.
|
|
|
|
aValue = 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 16:46:42 +00:00
|
|
|
return NS_OK;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingTop(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingBottom(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingLeft(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPaddingRight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsComputedDOMStyle::GetBorderCollapse(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2001-05-31 22:19:43 +00:00
|
|
|
const nsStyleTableBorder* table = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (table) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& ident=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(table->mBorderCollapse,
|
|
|
|
nsCSSProps::kBorderCollapseKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(ident);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderSpacing(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2004-09-10 03:26:58 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleTableBorder *border = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)border, aFrame);
|
|
|
|
if (border) {
|
|
|
|
nsROCSSPrimitiveValue* xSpacing = GetROCSSPrimitiveValue();
|
|
|
|
if (!xSpacing) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(xSpacing)) {
|
|
|
|
delete valueList;
|
|
|
|
delete xSpacing;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* ySpacing = GetROCSSPrimitiveValue();
|
|
|
|
if (!ySpacing) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(ySpacing)) {
|
|
|
|
delete valueList;
|
|
|
|
delete ySpacing;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
// border-spacing will always be a coord
|
|
|
|
xSpacing->SetTwips(border->mBorderSpacingX.GetCoordValue());
|
|
|
|
ySpacing->SetTwips(border->mBorderSpacingY.GetCoordValue());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetCaptionSide(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleTableBorder *table = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame);
|
|
|
|
|
|
|
|
if (table) {
|
|
|
|
const nsAFlatCString& side =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(table->mCaptionSide,
|
|
|
|
nsCSSProps::kCaptionSideKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(side);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetEmptyCells(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleTableBorder *table = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TableBorder, (const nsStyleStruct*&)table, aFrame);
|
|
|
|
|
|
|
|
if (table) {
|
|
|
|
const nsAFlatCString& emptyCells =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(table->mEmptyCells,
|
|
|
|
nsCSSProps::kEmptyCellsKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(emptyCells);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTableLayout(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleTable *table = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Table, (const nsStyleStruct*&)table, aFrame);
|
|
|
|
|
|
|
|
if (table && table->mLayoutStrategy != NS_STYLE_TABLE_LAYOUT_AUTO) {
|
|
|
|
const nsAFlatCString& tableLayout =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(table->mLayoutStrategy,
|
|
|
|
nsCSSProps::kTableLayoutKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(tableLayout);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 20:47:06 +00:00
|
|
|
return NS_OK;
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderTopStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomColors(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetBorderColorsFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftColors(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetBorderColorsFor(NS_SIDE_LEFT, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightColors(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetBorderColorsFor(NS_SIDE_RIGHT, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderTopColors(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetBorderColorsFor(NS_SIDE_TOP, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-21 06:42:21 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRadiusBottomLeft(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
|
|
|
return GetBorderRadiusFor(NS_SIDE_LEFT, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRadiusBottomRight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
|
|
|
return GetBorderRadiusFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRadiusTopLeft(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
|
|
|
return GetBorderRadiusFor(NS_SIDE_TOP, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRadiusTopRight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
|
|
|
return GetBorderRadiusFor(NS_SIDE_RIGHT, aFrame, 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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** 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 16:46:42 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 20:47:06 +00:00
|
|
|
return NS_OK;
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderTopWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
nsComputedDOMStyle::GetBorderTopColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderBottomColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderLeftColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderRightColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 20:47:06 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginTopWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginBottomWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginLeftWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarginRightWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarkerOffset(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Content, (const nsStyleStruct*&)content, aFrame);
|
|
|
|
|
2002-01-10 02:20:17 +00:00
|
|
|
if (content) {
|
|
|
|
switch (content->mMarkerOffset.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(content->mMarkerOffset.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Auto:
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2002-01-10 02:20:17 +00:00
|
|
|
break;
|
2005-09-19 15:47:26 +00:00
|
|
|
case eStyleUnit_Null: // XXX doesn't seem like a valid unit per CSS2?
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-01-10 02:20:17 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected marker offset unit");
|
2002-01-10 02:20:17 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutline(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 20:47:06 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-01-10 02:20:17 +00:00
|
|
|
if (outline) {
|
2005-03-27 11:36:08 +00:00
|
|
|
nsStyleCoord coord;
|
|
|
|
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
|
|
|
if (outlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
|
|
|
|
coord.SetCoordValue(0);
|
|
|
|
} else {
|
|
|
|
coord = outline->mOutlineWidth;
|
|
|
|
}
|
|
|
|
switch (coord.GetUnit()) {
|
2002-01-10 02:20:17 +00:00
|
|
|
case eStyleUnit_Coord:
|
2005-03-27 11:36:08 +00:00
|
|
|
val->SetTwips(coord.GetCoordValue());
|
2002-01-10 02:20:17 +00:00
|
|
|
break;
|
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
{
|
2005-03-27 11:36:08 +00:00
|
|
|
const nsAFlatCString& width =
|
|
|
|
nsCSSProps::ValueToKeyword(coord.GetIntValue(),
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::kBorderWidthKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(width);
|
2002-01-10 02:20:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2005-03-27 11:36:08 +00:00
|
|
|
case eStyleUnit_Chars:
|
|
|
|
// XXX we need a frame and a rendering context to calculate this, bug 281972, bug 282126.
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
2002-01-10 02:20:17 +00:00
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected outline width unit");
|
2002-01-10 02:20:17 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineStyle(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (outline) {
|
2002-01-10 02:20:17 +00:00
|
|
|
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
2005-03-27 11:36:08 +00:00
|
|
|
switch (outlineStyle) {
|
|
|
|
case NS_STYLE_BORDER_STYLE_NONE:
|
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_BORDER_STYLE_AUTO:
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2005-03-27 11:36:08 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
const nsAFlatCString& style =
|
|
|
|
nsCSSProps::ValueToKeyword(outlineStyle,
|
|
|
|
nsCSSProps::kOutlineStyleKTable);
|
|
|
|
val->SetIdent(style);
|
2002-01-10 02:20:17 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2004-10-26 12:57:15 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineOffset(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleOutline* outline = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
|
|
|
|
|
|
|
if (outline) {
|
|
|
|
switch (outline->mOutlineOffset.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(outline->mOutlineOffset.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Chars:
|
2005-03-27 11:36:08 +00:00
|
|
|
// XXX we need a frame and a rendering context to calculate this, bug 281972, bug 282126.
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
2004-10-26 12:57:15 +00:00
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected outline offset unit");
|
2004-10-26 12:57:15 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2004-10-14 03:32:28 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineRadiusBottomLeft(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetOutlineRadiusFor(NS_SIDE_LEFT, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineRadiusBottomRight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetOutlineRadiusFor(NS_SIDE_BOTTOM, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineRadiusTopLeft(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetOutlineRadiusFor(NS_SIDE_TOP, aFrame, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineRadiusTopRight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetOutlineRadiusFor(NS_SIDE_RIGHT, aFrame, 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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineColor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (outline) {
|
2001-03-30 02:08:48 +00:00
|
|
|
nscolor color;
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
nsDOMCSSRGBColor *rgb = nsnull;
|
|
|
|
rgb = GetDOMCSSRGBColor(color);
|
2002-09-07 01:48:39 +00:00
|
|
|
if (!rgb) {
|
2002-03-22 20:18:42 +00:00
|
|
|
delete val;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
|
|
|
val->SetColor(rgb);
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2004-10-14 03:32:28 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOutlineRadiusFor(PRUint8 aSide, nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleOutline *outline = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline, aFrame);
|
|
|
|
|
|
|
|
if (outline) {
|
|
|
|
nsStyleCoord coord;
|
|
|
|
outline->mOutlineRadius.Get(aSide, coord);
|
|
|
|
|
|
|
|
switch (coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(coord.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
if (aFrame) {
|
|
|
|
val->SetTwips(coord.GetPercentValue() * aFrame->GetSize().width);
|
|
|
|
} else {
|
|
|
|
val->SetPercent(coord.GetPercentValue());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected outline radius unit");
|
2004-10-14 03:32:28 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, 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 16:46:42 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetZIndex(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition* position = nsnull;
|
2001-03-11 21:03:08 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)position, aFrame);
|
2001-12-06 21:15:54 +00:00
|
|
|
if (position) {
|
|
|
|
switch (position->mZIndex.GetUnit()) {
|
|
|
|
case eStyleUnit_Integer:
|
2002-03-08 19:04:15 +00:00
|
|
|
val->SetNumber(position->mZIndex.GetIntValue());
|
2001-12-06 21:15:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected z-index unit");
|
2004-01-18 02:42:27 +00:00
|
|
|
// fall through
|
|
|
|
case eStyleUnit_Auto:
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2001-12-06 21:15:54 +00:00
|
|
|
break;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-06 21:15:54 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2001-03-08 00:55:01 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetListStyleImage(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-08 00:55:01 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 21:03:08 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-03-12 21:16:22 +00:00
|
|
|
const nsStyleList* list = 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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&)list, aFrame);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (list) {
|
2003-10-01 22:53:56 +00:00
|
|
|
if (!list->mListStyleImage) {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-01-24 04:22:59 +00:00
|
|
|
} else {
|
2004-08-04 03:23:37 +00:00
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (list->mListStyleImage) {
|
|
|
|
list->mListStyleImage->GetURI(getter_AddRefs(uri));
|
|
|
|
}
|
|
|
|
val->SetURI(uri);
|
2002-01-24 04:22:59 +00:00
|
|
|
}
|
2001-03-11 21:03:08 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetListStylePosition(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleList *list = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&)list, aFrame);
|
|
|
|
|
|
|
|
if (list) {
|
|
|
|
const nsAFlatCString& style =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(list->mListStylePosition,
|
|
|
|
nsCSSProps::kListStylePositionKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(style);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetListStyleType(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleList *list = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&)list, aFrame);
|
|
|
|
|
2004-01-15 22:06:39 +00:00
|
|
|
if (list) {
|
2002-03-12 21:16:22 +00:00
|
|
|
if (list->mListStyleType == NS_STYLE_LIST_STYLE_NONE) {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-03-12 21:16:22 +00:00
|
|
|
} else {
|
|
|
|
const nsAFlatCString& style =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(list->mListStyleType,
|
|
|
|
nsCSSProps::kListStyleKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(style);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-08 00:55:01 +00:00
|
|
|
}
|
|
|
|
|
2004-01-15 02:25:08 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetImageRegion(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleList* list = nsnull;
|
|
|
|
|
|
|
|
GetStyleData(eStyleStruct_List, (const nsStyleStruct*&)list, aFrame);
|
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsROCSSPrimitiveValue *topVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *rightVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *bottomVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *leftVal = nsnull;
|
|
|
|
if (list) {
|
|
|
|
if (list->mImageRegion.width <= 0 || list->mImageRegion.height <= 0) {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2004-01-15 02:25:08 +00:00
|
|
|
} 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) {
|
|
|
|
topVal->SetTwips(list->mImageRegion.y);
|
|
|
|
rightVal->SetTwips(list->mImageRegion.width + list->mImageRegion.x);
|
|
|
|
bottomVal->SetTwips(list->mImageRegion.height + list->mImageRegion.y);
|
|
|
|
leftVal->SetTwips(list->mImageRegion.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);
|
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetLineHeight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleText *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
|
|
|
|
|
|
|
nscoord lineHeight;
|
|
|
|
nsresult rv = GetLineHeightCoord(aFrame, text, lineHeight);
|
|
|
|
|
|
|
|
if (NS_SUCCEEDED(rv)) {
|
|
|
|
val->SetTwips(lineHeight);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else if (text) {
|
2002-03-16 17:04:35 +00:00
|
|
|
switch (text->mLineHeight.GetUnit()) {
|
|
|
|
case eStyleUnit_Percent:
|
2002-04-26 18:10:14 +00:00
|
|
|
val->SetPercent(text->mLineHeight.GetPercentValue());
|
2002-03-16 17:04:35 +00:00
|
|
|
break;
|
|
|
|
case eStyleUnit_Factor:
|
|
|
|
val->SetNumber(text->mLineHeight.GetFactorValue());
|
|
|
|
break;
|
2005-09-19 15:47:26 +00:00
|
|
|
case eStyleUnit_Normal:
|
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
|
|
|
break;
|
2002-03-16 17:04:35 +00:00
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected line-height unit");
|
2002-03-16 17:04:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetVerticalAlign(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleTextReset *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)text, aFrame);
|
|
|
|
|
|
|
|
if (text) {
|
|
|
|
switch (text->mVerticalAlign.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(text->mVerticalAlign.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
{
|
|
|
|
const nsAFlatCString& align =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(text->mVerticalAlign.GetIntValue(),
|
|
|
|
nsCSSProps::kVerticalAlignKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(align);
|
2002-03-16 17:04:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
{
|
|
|
|
const nsStyleText *textData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)textData,
|
|
|
|
aFrame);
|
2002-03-16 17:04:35 +00:00
|
|
|
|
|
|
|
nscoord lineHeight = 0;
|
|
|
|
nsresult rv = GetLineHeightCoord(aFrame, textData, lineHeight);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (NS_SUCCEEDED(rv)) {
|
2002-03-16 17:04:35 +00:00
|
|
|
val->SetTwips(lineHeight * text->mVerticalAlign.GetPercentValue());
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-03-16 17:04:35 +00:00
|
|
|
val->SetPercent(text->mVerticalAlign.GetPercentValue());
|
2002-09-07 01:48:39 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2004-01-18 02:42:27 +00:00
|
|
|
NS_ERROR("double check the vertical-align");
|
2002-03-16 17:04:35 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2001-05-04 11:30:34 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextAlign(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-05-04 11:30:34 +00: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 16:46:42 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-05-04 11:30:34 +00: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 16:46:42 +00:00
|
|
|
const nsStyleText* text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (text) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& align=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(text->mTextAlign,
|
|
|
|
nsCSSProps::kTextAlignKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(align);
|
2001-05-04 11:30:34 +00:00
|
|
|
}
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-05-09 03:29:09 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextDecoration(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-05-09 03:29:09 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-05-09 03:29:09 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleTextReset* text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)text, aFrame);
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (text) {
|
2001-12-20 11:15:32 +00:00
|
|
|
if (NS_STYLE_TEXT_DECORATION_NONE == text->mTextDecoration) {
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(decoration);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2001-12-20 11:15:32 +00:00
|
|
|
nsAutoString decorationString;
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
|
|
|
const nsAFlatCString& decoration=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
2001-12-20 11:15:32 +00:00
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
|
|
|
}
|
|
|
|
const nsAFlatCString& decoration=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_OVERLINE,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
2001-12-20 11:15:32 +00:00
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
|
|
|
}
|
|
|
|
const nsAFlatCString& decoration=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
2001-12-20 11:15:32 +00:00
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
|
|
|
}
|
|
|
|
const nsAFlatCString& decoration=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_BLINK,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
2001-12-20 11:15:32 +00:00
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
val->SetString(decorationString);
|
|
|
|
}
|
2001-05-09 03:29:09 +00:00
|
|
|
}
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-05-04 11:30:34 +00:00
|
|
|
}
|
|
|
|
|
2002-03-03 19:44:41 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextIndent(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 19:44:41 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleText *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2002-03-03 19:44:41 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2002-03-03 19:44:41 +00:00
|
|
|
|
|
|
|
if (text) {
|
|
|
|
switch (text->mTextIndent.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(text->mTextIndent.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2005-01-04 20:17:25 +00:00
|
|
|
nsIFrame *container = GetContainingBlockFor(aFrame);
|
2002-07-08 07:11:59 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
val->SetTwips(container->GetSize().width *
|
|
|
|
text->mTextIndent.GetPercentValue());
|
2002-07-08 07:11:59 +00:00
|
|
|
} else {
|
|
|
|
// no containing block
|
|
|
|
val->SetPercent(text->mTextIndent.GetPercentValue());
|
|
|
|
}
|
|
|
|
break;
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
default:
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextTransform(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 19:44:41 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleText *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2002-03-03 19:44:41 +00:00
|
|
|
|
|
|
|
if (text && text->mTextTransform != NS_STYLE_TEXT_TRANSFORM_NONE) {
|
|
|
|
const nsAFlatCString& textTransform =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(text->mTextTransform,
|
|
|
|
nsCSSProps::kTextTransformKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(textTransform);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetLetterSpacing(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 19:44:41 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleText *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2002-03-03 19:44:41 +00:00
|
|
|
|
|
|
|
if (text && text->mLetterSpacing.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
val->SetTwips(text->mLetterSpacing.GetCoordValue());
|
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetWordSpacing(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 19:44:41 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleText *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2002-03-03 19:44:41 +00:00
|
|
|
|
|
|
|
if (text && text->mWordSpacing.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
val->SetTwips(text->mWordSpacing.GetCoordValue());
|
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetWhiteSpace(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 19:44:41 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleText *text = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Text, (const nsStyleStruct*&)text, aFrame);
|
2002-03-03 19:44:41 +00:00
|
|
|
|
|
|
|
if (text && text->mWhiteSpace != NS_STYLE_WHITESPACE_NORMAL) {
|
|
|
|
const nsAFlatCString& whiteSpace =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(text->mWhiteSpace,
|
|
|
|
nsCSSProps::kWhitespaceKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(whiteSpace);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2001-08-07 19:05:21 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetVisibility(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-08-07 19:05:21 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-08-07 19:05:21 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleVisibility* visibility = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)visibility,
|
|
|
|
aFrame);
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (visibility) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& value=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(visibility->mVisible,
|
|
|
|
nsCSSProps::kVisibilityKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(value);
|
2001-08-07 19:05:21 +00:00
|
|
|
}
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetDirection(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleVisibility *visibility = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Visibility, (const nsStyleStruct*&)visibility,
|
|
|
|
aFrame);
|
2002-03-12 21:16:22 +00:00
|
|
|
|
|
|
|
if (visibility) {
|
|
|
|
const nsAFlatCString & direction =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(visibility->mDirection,
|
|
|
|
nsCSSProps::kDirectionKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(direction);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
2004-01-18 02:42:27 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetUnicodeBidi(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleTextReset *text = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_TextReset, (const nsStyleStruct*&)text, aFrame);
|
2002-03-12 21:16:22 +00:00
|
|
|
|
|
|
|
if (text && text->mUnicodeBidi != NS_STYLE_UNICODE_BIDI_NORMAL) {
|
|
|
|
const nsAFlatCString& bidi =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(text->mUnicodeBidi,
|
|
|
|
nsCSSProps::kUnicodeBidiKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(bidi);
|
2002-03-12 21:16:22 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::normal);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetCursor(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
2005-03-20 13:35:31 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
2002-03-12 21:16:22 +00:00
|
|
|
|
|
|
|
const nsStyleUserInterface *ui = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)ui, aFrame);
|
2002-03-12 21:16:22 +00:00
|
|
|
|
|
|
|
if (ui) {
|
2005-07-01 04:29:42 +00:00
|
|
|
for (nsCursorImage *item = ui->mCursorArray,
|
|
|
|
*item_end = ui->mCursorArray + ui->mCursorArrayLength;
|
|
|
|
item < item_end; ++item) {
|
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE);
|
|
|
|
if (!itemList || !valueList->AppendCSSValue(itemList)) {
|
|
|
|
delete itemList;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2005-03-20 13:35:31 +00:00
|
|
|
nsCOMPtr<nsIURI> uri;
|
2005-07-01 04:29:42 +00:00
|
|
|
item->mImage->GetURI(getter_AddRefs(uri));
|
2005-03-20 13:35:31 +00:00
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2005-07-01 04:29:42 +00:00
|
|
|
if (!val || !itemList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
2005-03-20 13:35:31 +00:00
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
val->SetURI(uri);
|
2005-07-01 04:29:42 +00:00
|
|
|
|
|
|
|
if (item->mHaveHotspot) {
|
|
|
|
nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue();
|
|
|
|
if (!valX || !itemList->AppendCSSValue(valX)) {
|
|
|
|
delete valX;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue();
|
|
|
|
if (!valY || !itemList->AppendCSSValue(valY)) {
|
|
|
|
delete valY;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
valX->SetNumber(item->mHotspotX);
|
|
|
|
valY->SetNumber(item->mHotspotY);
|
2004-12-30 21:56:11 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-20 13:35:31 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (ui->mCursor == NS_STYLE_CURSOR_AUTO) {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2005-03-20 13:35:31 +00:00
|
|
|
} else {
|
|
|
|
const nsAFlatCString& cursor =
|
|
|
|
nsCSSProps::ValueToKeyword(ui->mCursor,
|
|
|
|
nsCSSProps::kCursorKTable);
|
|
|
|
val->SetIdent(cursor);
|
|
|
|
}
|
|
|
|
if (!valueList->AppendCSSValue(val)) {
|
|
|
|
delete valueList;
|
|
|
|
delete val;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-20 13:35:31 +00:00
|
|
|
return CallQueryInterface(valueList, aValue);
|
2001-08-07 19:05:21 +00:00
|
|
|
}
|
|
|
|
|
2002-04-20 14:30:57 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetAppearance(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay *displayData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData,
|
|
|
|
aFrame);
|
2002-04-20 14:30:57 +00:00
|
|
|
|
|
|
|
PRUint8 appearance = NS_THEME_NONE;
|
|
|
|
if (displayData) {
|
|
|
|
appearance = displayData->mAppearance;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& appearanceIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(appearance,
|
|
|
|
nsCSSProps::kAppearanceKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(appearanceIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxAlign(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleXUL *xul = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)xul, aFrame);
|
|
|
|
|
|
|
|
PRUint8 boxAlign = NS_STYLE_BOX_ALIGN_STRETCH;
|
|
|
|
if (xul) {
|
|
|
|
boxAlign = xul->mBoxAlign;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& boxAlignIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(boxAlign,
|
|
|
|
nsCSSProps::kBoxAlignKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(boxAlignIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxDirection(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleXUL *xul = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)xul, aFrame);
|
|
|
|
|
|
|
|
PRUint8 boxDirection = NS_STYLE_BOX_DIRECTION_NORMAL;
|
|
|
|
if (xul) {
|
|
|
|
boxDirection = xul->mBoxDirection;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& boxDirectionIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(boxDirection,
|
|
|
|
nsCSSProps::kBoxDirectionKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(boxDirectionIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxFlex(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleXUL *xul = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)xul, aFrame);
|
|
|
|
|
|
|
|
float boxFlex = 0.0f;
|
|
|
|
if (xul) {
|
|
|
|
boxFlex = xul->mBoxFlex;
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetNumber(boxFlex);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxOrdinalGroup(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleXUL *xul = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)xul, aFrame);
|
|
|
|
|
|
|
|
PRUint32 boxOrdinalGroup = 1;
|
|
|
|
if (xul) {
|
|
|
|
boxOrdinalGroup = xul->mBoxOrdinal;
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetNumber(boxOrdinalGroup);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxOrient(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleXUL *xul = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)xul, aFrame);
|
|
|
|
|
|
|
|
PRUint8 boxOrient = NS_STYLE_BOX_ORIENT_HORIZONTAL;
|
|
|
|
if (xul) {
|
|
|
|
boxOrient = xul->mBoxOrient;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& boxOrientIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(boxOrient,
|
|
|
|
nsCSSProps::kBoxOrientKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(boxOrientIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxPack(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleXUL *xul = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_XUL, (const nsStyleStruct*&)xul, aFrame);
|
|
|
|
|
|
|
|
PRUint8 boxPack = NS_STYLE_BOX_PACK_START;
|
|
|
|
if (xul) {
|
|
|
|
boxPack = xul->mBoxPack;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& boxPackIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(boxPack,
|
|
|
|
nsCSSProps::kBoxPackKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(boxPackIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxSizing(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition *positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2002-04-20 14:30:57 +00:00
|
|
|
|
|
|
|
PRUint8 boxSizing = NS_STYLE_BOX_SIZING_CONTENT;
|
|
|
|
if (positionData) {
|
|
|
|
boxSizing = positionData->mBoxSizing;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& boxSizingIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(boxSizing,
|
|
|
|
nsCSSProps::kBoxSizingKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(boxSizingIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFloatEdge(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBorder *borderData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData, aFrame);
|
|
|
|
|
|
|
|
PRUint8 floatEdge = NS_STYLE_FLOAT_EDGE_CONTENT;
|
|
|
|
if (borderData) {
|
|
|
|
floatEdge = borderData->mFloatEdge;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& floatEdgeIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(floatEdge,
|
|
|
|
nsCSSProps::kFloatEdgeKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(floatEdgeIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetUserFocus(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleUserInterface *uiData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)uiData,
|
|
|
|
aFrame);
|
2002-04-20 14:30:57 +00:00
|
|
|
|
|
|
|
if (uiData && uiData->mUserFocus != NS_STYLE_USER_FOCUS_NONE) {
|
|
|
|
if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
|
|
|
|
const nsAFlatCString& userFocusIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_normal);
|
|
|
|
val->SetIdent(userFocusIdent);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-04-20 14:30:57 +00:00
|
|
|
const nsAFlatCString& userFocusIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(uiData->mUserFocus,
|
|
|
|
nsCSSProps::kUserFocusKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(userFocusIdent);
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-04-20 14:30:57 +00:00
|
|
|
const nsAFlatCString& userFocusIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(userFocusIdent);
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetUserInput(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleUserInterface *uiData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)uiData,
|
|
|
|
aFrame);
|
2002-04-20 14:30:57 +00:00
|
|
|
|
|
|
|
if (uiData && uiData->mUserInput != NS_STYLE_USER_INPUT_AUTO) {
|
|
|
|
if (uiData->mUserInput == NS_STYLE_USER_INPUT_NONE) {
|
|
|
|
const nsAFlatCString& userInputIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(userInputIdent);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-04-20 14:30:57 +00:00
|
|
|
const nsAFlatCString& userInputIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(uiData->mUserInput,
|
|
|
|
nsCSSProps::kUserInputKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(userInputIdent);
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-04-20 14:30:57 +00:00
|
|
|
const nsAFlatCString& userInputIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_auto);
|
|
|
|
val->SetIdent(userInputIdent);
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetUserModify(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleUserInterface *uiData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_UserInterface, (const nsStyleStruct*&)uiData,
|
|
|
|
aFrame);
|
2002-04-20 14:30:57 +00:00
|
|
|
|
|
|
|
PRUint8 userModify = NS_STYLE_USER_MODIFY_READ_ONLY;
|
|
|
|
if (uiData) {
|
|
|
|
userModify = uiData->mUserModify;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsAFlatCString& userModifyIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(userModify,
|
|
|
|
nsCSSProps::kUserModifyKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(userModifyIdent);
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetUserSelect(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleUIReset *uiData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_UIReset, (const nsStyleStruct*&)uiData, aFrame);
|
|
|
|
|
|
|
|
if (uiData && uiData->mUserSelect != NS_STYLE_USER_SELECT_AUTO) {
|
|
|
|
if (uiData->mUserSelect == NS_STYLE_USER_SELECT_NONE) {
|
|
|
|
const nsAFlatCString& userSelectIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(userSelectIdent);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-04-20 14:30:57 +00:00
|
|
|
const nsAFlatCString& userSelectIdent =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(uiData->mUserSelect,
|
|
|
|
nsCSSProps::kUserSelectKTable);
|
2002-04-20 14:30:57 +00:00
|
|
|
val->SetIdent(userSelectIdent);
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-04-20 14:30:57 +00:00
|
|
|
const nsAFlatCString& userSelectIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_auto);
|
|
|
|
val->SetIdent(userSelectIdent);
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 04:57:50 +00:00
|
|
|
nsresult
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::GetDisplay(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2000-05-15 01:59:05 +00:00
|
|
|
{
|
2001-03-11 20:47:06 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2000-05-15 01:59:05 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-03-12 21:16:22 +00:00
|
|
|
const nsStyleDisplay *displayData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData,
|
|
|
|
aFrame);
|
2000-05-17 06:26:23 +00:00
|
|
|
|
2002-03-12 21:16:22 +00:00
|
|
|
if (displayData) {
|
|
|
|
if (displayData->mDisplay == NS_STYLE_DISPLAY_NONE) {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-03-12 21:16:22 +00:00
|
|
|
const nsAFlatCString& display =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(displayData->mDisplay,
|
|
|
|
nsCSSProps::kDisplayKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(display);
|
2000-05-15 01:59:05 +00:00
|
|
|
}
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2002-01-11 00:15:55 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPosition(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-01-11 00:15:55 +00:00
|
|
|
{
|
|
|
|
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) {
|
2004-01-18 02:42:27 +00:00
|
|
|
const nsAFlatCString& position =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(display->mPosition,
|
|
|
|
nsCSSProps::kPositionKTable);
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(position);
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
2004-01-18 02:42:27 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetClip(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-01-11 00:15:55 +00:00
|
|
|
{
|
|
|
|
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)) {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-01-11 00:15:55 +00:00
|
|
|
// 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) {
|
2006-01-19 00:58:12 +00:00
|
|
|
topVal->SetIdent(nsLayoutAtoms::_auto);
|
2002-01-11 00:15:55 +00:00
|
|
|
} else {
|
|
|
|
topVal->SetTwips(display->mClip.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) {
|
2006-01-19 00:58:12 +00:00
|
|
|
rightVal->SetIdent(nsLayoutAtoms::_auto);
|
2002-01-11 00:15:55 +00:00
|
|
|
} else {
|
|
|
|
rightVal->SetTwips(display->mClip.width + display->mClip.x);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) {
|
2006-01-19 00:58:12 +00:00
|
|
|
bottomVal->SetIdent(nsLayoutAtoms::_auto);
|
2002-01-11 00:15:55 +00:00
|
|
|
} else {
|
|
|
|
bottomVal->SetTwips(display->mClip.height + display->mClip.y);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) {
|
2006-01-19 00:58:12 +00:00
|
|
|
leftVal->SetIdent(nsLayoutAtoms::_auto);
|
2002-01-11 00:15:55 +00:00
|
|
|
} 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;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-01-11 00:15:55 +00:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
|
|
|
|
2002-02-16 13:16:10 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOverflow(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-02-16 13:16:10 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2002-02-16 13:16:10 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2002-02-16 13:16:10 +00:00
|
|
|
|
2004-09-05 00:04:04 +00:00
|
|
|
if (display && display->mOverflowX == display->mOverflowY) {
|
|
|
|
if (display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) {
|
|
|
|
const nsAFlatCString& overflow =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(display->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowKTable);
|
2004-09-05 00:04:04 +00:00
|
|
|
val->SetIdent(overflow);
|
|
|
|
} else {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2004-09-05 00:04:04 +00:00
|
|
|
}
|
|
|
|
} // XXX else what?
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOverflowX(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** 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 && display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) {
|
|
|
|
const nsAFlatCString& overflow =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(display->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowSubKTable);
|
2004-09-05 00:04:04 +00:00
|
|
|
val->SetIdent(overflow);
|
|
|
|
} else {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2004-09-05 00:04:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetOverflowY(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** 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 && display->mOverflowY != NS_STYLE_OVERFLOW_AUTO) {
|
2002-02-16 13:16:10 +00:00
|
|
|
const nsAFlatCString& overflow =
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(display->mOverflowY,
|
|
|
|
nsCSSProps::kOverflowSubKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(overflow);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2002-02-16 13:16:10 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-16 13:16:10 +00:00
|
|
|
}
|
|
|
|
|
2002-09-26 03:46:50 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetHeight(nsIFrame *aFrame,
|
|
|
|
nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2002-09-26 03:46:50 +00:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2002-09-26 03:46:50 +00:00
|
|
|
PRBool calcHeight = PR_FALSE;
|
|
|
|
|
|
|
|
if (aFrame) {
|
|
|
|
calcHeight = PR_TRUE;
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2002-09-26 03:46:50 +00:00
|
|
|
|
|
|
|
const nsStyleDisplay* displayData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData,
|
|
|
|
aFrame);
|
2003-08-06 03:07:12 +00:00
|
|
|
if (displayData && displayData->mDisplay == NS_STYLE_DISPLAY_INLINE
|
|
|
|
&& !(aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)) {
|
|
|
|
calcHeight = PR_FALSE;
|
2002-09-26 03:46:50 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-06 21:15:54 +00:00
|
|
|
|
|
|
|
if (calcHeight) {
|
2001-11-10 17:29:04 +00:00
|
|
|
nsMargin padding;
|
|
|
|
nsMargin border;
|
2003-08-06 03:07:12 +00:00
|
|
|
nsSize size = aFrame->GetSize();
|
2006-01-26 02:29:17 +00:00
|
|
|
const nsStylePadding* paddingData = aFrame->GetStylePadding();
|
|
|
|
paddingData->CalcPaddingFor(aFrame, padding);
|
|
|
|
const nsStyleBorder* borderData = aFrame->GetStyleBorder();
|
|
|
|
borderData->CalcBorderFor(aFrame, border);
|
2001-11-10 17:29:04 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
val->SetTwips(size.height - padding.top - padding.bottom -
|
2001-11-10 17:29:04 +00:00
|
|
|
border.top - border.bottom);
|
|
|
|
} else {
|
2001-12-06 21:15:54 +00:00
|
|
|
// Just return the value in the style context
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2001-12-06 21:15:54 +00:00
|
|
|
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:
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2001-12-06 21:15:54 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected height unit");
|
2001-12-06 21:15:54 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
PRBool calcWidth = PR_FALSE;
|
|
|
|
|
|
|
|
if (aFrame) {
|
|
|
|
calcWidth = PR_TRUE;
|
2002-10-16 03:38:52 +00:00
|
|
|
|
|
|
|
FlushPendingReflows();
|
2002-03-16 17:04:35 +00:00
|
|
|
|
|
|
|
const nsStyleDisplay *displayData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)displayData,
|
|
|
|
aFrame);
|
2003-08-06 03:07:12 +00:00
|
|
|
if (displayData && displayData->mDisplay == NS_STYLE_DISPLAY_INLINE
|
|
|
|
&& !(aFrame->GetStateBits() & NS_FRAME_REPLACED_ELEMENT)) {
|
|
|
|
calcWidth = PR_FALSE;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (calcWidth) {
|
2003-08-06 03:07:12 +00:00
|
|
|
nsSize size = aFrame->GetSize();
|
2002-03-16 17:04:35 +00:00
|
|
|
nsMargin padding;
|
|
|
|
nsMargin border;
|
2006-01-26 02:29:17 +00:00
|
|
|
const nsStylePadding *paddingData = aFrame->GetStylePadding();
|
|
|
|
paddingData->CalcPaddingFor(aFrame, padding);
|
|
|
|
const nsStyleBorder *borderData = aFrame->GetStyleBorder();
|
|
|
|
borderData->CalcBorderFor(aFrame, border);
|
2002-07-08 07:11:59 +00:00
|
|
|
val->SetTwips(size.width - padding.left - padding.right -
|
2002-03-16 17:04:35 +00:00
|
|
|
border.left - border.right);
|
|
|
|
} else {
|
|
|
|
// Just return the value in the style context
|
|
|
|
const nsStylePosition *positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2002-03-16 17:04:35 +00:00
|
|
|
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:
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2002-03-16 17:04:35 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected width unit");
|
2002-03-16 17:04:35 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMaxHeight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition *positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2002-02-18 22:54:15 +00:00
|
|
|
|
|
|
|
if (positionData) {
|
|
|
|
nsIFrame *container = nsnull;
|
2002-07-08 07:11:59 +00:00
|
|
|
nsSize size;
|
2002-02-18 22:54:15 +00:00
|
|
|
nscoord minHeight = 0;
|
|
|
|
|
|
|
|
if (positionData->mMinHeight.GetUnit() == eStyleUnit_Percent) {
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
size = container->GetSize();
|
2002-09-07 01:48:39 +00:00
|
|
|
minHeight = nscoord(size.height *
|
|
|
|
positionData->mMinHeight.GetPercentValue());
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
} else if (positionData->mMinHeight.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
minHeight = positionData->mMinHeight.GetCoordValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (positionData->mMaxHeight.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
2002-09-07 01:48:39 +00:00
|
|
|
val->SetTwips(PR_MAX(minHeight,
|
|
|
|
positionData->mMaxHeight.GetCoordValue()));
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
if (!container) {
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
size = container->GetSize();
|
2002-02-18 22:54:15 +00:00
|
|
|
} else {
|
|
|
|
// no containing block
|
|
|
|
val->SetPercent(positionData->mMaxHeight.GetPercentValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (container) {
|
2002-09-07 01:48:39 +00:00
|
|
|
val->SetTwips(PR_MAX(minHeight, size.height *
|
|
|
|
positionData->mMaxHeight.GetPercentValue()));
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMaxWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition *positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2002-02-18 22:54:15 +00:00
|
|
|
|
|
|
|
if (positionData) {
|
|
|
|
nsIFrame *container = nsnull;
|
2002-07-08 07:11:59 +00:00
|
|
|
nsSize size;
|
2002-02-18 22:54:15 +00:00
|
|
|
nscoord minWidth = 0;
|
|
|
|
|
|
|
|
if (positionData->mMinWidth.GetUnit() == eStyleUnit_Percent) {
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
size = container->GetSize();
|
2002-09-07 01:48:39 +00:00
|
|
|
minWidth = nscoord(size.width *
|
|
|
|
positionData->mMinWidth.GetPercentValue());
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
} else if (positionData->mMinWidth.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
minWidth = positionData->mMinWidth.GetCoordValue();
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (positionData->mMaxWidth.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
2002-09-07 01:48:39 +00:00
|
|
|
val->SetTwips(PR_MAX(minWidth,
|
|
|
|
positionData->mMaxWidth.GetCoordValue()));
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
if (!container) {
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
size = container->GetSize();
|
2002-02-18 22:54:15 +00:00
|
|
|
} else {
|
|
|
|
// no containing block
|
|
|
|
val->SetPercent(positionData->mMaxWidth.GetPercentValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (container) {
|
2002-09-07 01:48:39 +00:00
|
|
|
val->SetTwips(PR_MAX(minWidth, size.width *
|
|
|
|
positionData->mMaxWidth.GetPercentValue()));
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMinHeight(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition *positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2002-02-18 22:54:15 +00:00
|
|
|
|
|
|
|
if (positionData) {
|
|
|
|
nsIFrame *container = nsnull;
|
|
|
|
switch (positionData->mMinHeight.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(positionData->mMinHeight.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
val->SetTwips(container->GetSize().height *
|
2002-09-07 01:48:39 +00:00
|
|
|
positionData->mMinHeight.GetPercentValue());
|
2002-02-18 22:54:15 +00:00
|
|
|
} else {
|
|
|
|
// no containing block
|
|
|
|
val->SetPercent(positionData->mMinHeight.GetPercentValue());
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
val->SetTwips(0);
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-02-18 22:54:15 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMinWidth(nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition *positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2002-02-18 22:54:15 +00:00
|
|
|
|
|
|
|
if (positionData) {
|
|
|
|
nsIFrame *container = nsnull;
|
|
|
|
switch (positionData->mMinWidth.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(positionData->mMinWidth.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2002-02-18 22:54:15 +00:00
|
|
|
if (container) {
|
2003-08-06 03:07:12 +00:00
|
|
|
val->SetTwips(container->GetSize().width *
|
2002-09-07 01:48:39 +00:00
|
|
|
positionData->mMinWidth.GetPercentValue());
|
2002-02-18 22:54:15 +00:00
|
|
|
} else {
|
|
|
|
// no containing block
|
|
|
|
val->SetPercent(positionData->mMinWidth.GetPercentValue());
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 04:57:50 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetLeft(nsIFrame *aFrame, nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2001-11-10 17:29:04 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_LEFT, aFrame, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 04:57:50 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetRight(nsIFrame *aFrame, nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2001-11-10 17:29:04 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_RIGHT, aFrame, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-17 04:57:50 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetTop(nsIFrame *aFrame, nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2001-11-10 17:29:04 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_TOP, aFrame, aValue);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsComputedDOMStyle::GetROCSSPrimitiveValue()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-07-08 07:11:59 +00:00
|
|
|
nsROCSSPrimitiveValue *primitiveValue = new nsROCSSPrimitiveValue(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 16:46:42 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
NS_ASSERTION(primitiveValue != 0, "ran out of memory");
|
2001-03-03 00:44:19 +00:00
|
|
|
|
|
|
|
return primitiveValue;
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
nsDOMCSSValueList*
|
|
|
|
nsComputedDOMStyle::GetROCSSValueList(PRBool aCommaDelimited)
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList *valueList = new nsDOMCSSValueList(aCommaDelimited,
|
|
|
|
PR_TRUE);
|
|
|
|
NS_ASSERTION(valueList != 0, "ran out of memory");
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
nsresult
|
2001-11-10 17:29:04 +00:00
|
|
|
nsComputedDOMStyle::GetOffsetWidthFor(PRUint8 aSide, nsIFrame* aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2001-11-10 17:29:04 +00:00
|
|
|
const nsStyleDisplay* display = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Display, (const nsStyleStruct*&)display, aFrame);
|
2000-05-17 06:26:23 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (display) {
|
|
|
|
switch (display->mPosition) {
|
2002-09-30 14:46:56 +00:00
|
|
|
case NS_STYLE_POSITION_STATIC:
|
2001-11-10 17:29:04 +00:00
|
|
|
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:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Invalid position");
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIFrame* aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-11-10 17:29:04 +00: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 16:46:42 +00:00
|
|
|
|
2005-01-04 20:17:25 +00:00
|
|
|
nsIFrame* container = GetContainingBlockFor(aFrame);
|
2001-11-10 17:29:04 +00:00
|
|
|
if (container) {
|
|
|
|
nscoord margin = GetMarginWidthCoordFor(aSide, aFrame);
|
|
|
|
nscoord border = GetBorderWidthCoordFor(aSide, container);
|
2004-01-09 19:21:20 +00:00
|
|
|
nsMargin scrollbarSizes(0, 0, 0, 0);
|
2003-08-06 03:07:12 +00:00
|
|
|
nsRect rect = aFrame->GetRect();
|
|
|
|
nsRect containerRect = container->GetRect();
|
2001-11-10 17:29:04 +00:00
|
|
|
|
2003-10-31 20:19:18 +00:00
|
|
|
if (container->GetType() == nsLayoutAtoms::viewportFrame) {
|
2001-11-10 17:29:04 +00:00
|
|
|
// 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.
|
|
|
|
// the first child in the default frame list is what we want
|
2004-01-09 14:20:53 +00:00
|
|
|
nsIFrame* scrollingChild = container->GetFirstChild(nsnull);
|
2002-09-07 01:48:39 +00:00
|
|
|
nsCOMPtr<nsIScrollableFrame> scrollFrame =
|
|
|
|
do_QueryInterface(scrollingChild);
|
2001-11-10 17:29:04 +00:00
|
|
|
if (scrollFrame) {
|
2004-01-09 19:21:20 +00:00
|
|
|
scrollbarSizes = scrollFrame->GetActualScrollbarSizes();
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
nscoord offset = 0;
|
|
|
|
switch (aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
2004-01-09 19:21:20 +00:00
|
|
|
offset = rect.y - margin - border - scrollbarSizes.top;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
offset = containerRect.width - rect.width -
|
2004-01-09 19:21:20 +00:00
|
|
|
rect.x - margin - border - scrollbarSizes.right;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
offset = containerRect.height - rect.height -
|
2004-01-09 19:21:20 +00:00
|
|
|
rect.y - margin - border - scrollbarSizes.bottom;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT:
|
2004-01-09 19:21:20 +00:00
|
|
|
offset = rect.x - margin - border - scrollbarSizes.left;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Invalid side");
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
val->SetTwips(offset);
|
|
|
|
} else {
|
|
|
|
// XXX no frame. This property makes no sense
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2004-11-30 05:31:37 +00:00
|
|
|
|
|
|
|
#if (NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3)
|
|
|
|
#define NS_OPPOSITE_SIDE(s_) (((s_) + 2) & 3)
|
|
|
|
#else
|
|
|
|
#error "Somebody changed the side constants."
|
|
|
|
#endif
|
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIFrame* aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-11-10 17:29:04 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2001-11-10 17:29:04 +00:00
|
|
|
if (positionData) {
|
|
|
|
nsStyleCoord coord;
|
|
|
|
PRInt32 sign = 1;
|
2004-11-30 05:31:37 +00:00
|
|
|
positionData->mOffset.Get(aSide, coord);
|
|
|
|
if (coord.GetUnit() != eStyleUnit_Coord &&
|
|
|
|
coord.GetUnit() != eStyleUnit_Percent) {
|
|
|
|
positionData->mOffset.Get(NS_OPPOSITE_SIDE(aSide), coord);
|
|
|
|
sign = -1;
|
2000-05-15 01:59:05 +00:00
|
|
|
}
|
2001-11-10 17:29:04 +00:00
|
|
|
nsIFrame* container = nsnull;
|
|
|
|
switch(coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(sign * coord.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2005-01-04 20:17:25 +00:00
|
|
|
container = GetContainingBlockFor(aFrame);
|
2001-11-10 17:29:04 +00:00
|
|
|
if (container) {
|
2003-05-15 03:42:21 +00:00
|
|
|
nsMargin border;
|
|
|
|
nsMargin padding;
|
|
|
|
container->GetStyleBorder()->CalcBorderFor(container, border);
|
|
|
|
container->GetStylePadding()->CalcPaddingFor(container, padding);
|
2003-08-06 03:07:12 +00:00
|
|
|
nsSize size = container->GetSize();
|
2001-11-10 17:29:04 +00:00
|
|
|
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
|
|
|
val->SetTwips(sign * coord.GetPercentValue() *
|
2002-07-08 07:11:59 +00:00
|
|
|
(size.width - border.left - border.right -
|
2001-11-10 17:29:04 +00:00
|
|
|
padding.left - padding.right));
|
|
|
|
} else {
|
|
|
|
val->SetTwips(sign * coord.GetPercentValue() *
|
2002-07-08 07:11:59 +00:00
|
|
|
(size.height - border.top - border.bottom -
|
2001-11-10 17:29:04 +00:00
|
|
|
padding.top - padding.bottom));
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// XXX no containing block.
|
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected left/right/top/bottom unit");
|
2001-11-10 17:29:04 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
break;
|
2000-05-15 01:59:05 +00:00
|
|
|
}
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStaticOffset(PRUint8 aSide, nsIFrame* aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-11-10 17:29:04 +00:00
|
|
|
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStylePosition* positionData = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Position, (const nsStyleStruct*&)positionData,
|
|
|
|
aFrame);
|
2001-11-10 17:29:04 +00:00
|
|
|
if (positionData) {
|
|
|
|
nsStyleCoord coord;
|
2004-11-30 05:31:37 +00:00
|
|
|
positionData->mOffset.Get(aSide, coord);
|
2001-11-10 17:29:04 +00:00
|
|
|
switch(coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(coord.GetCoordValue());
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2001-12-06 21:15:54 +00:00
|
|
|
val->SetPercent(coord.GetPercentValue());
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
2001-12-06 22:29:53 +00:00
|
|
|
case eStyleUnit_Auto:
|
2006-01-19 00:58:12 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::_auto);
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-12-06 22:29:53 +00:00
|
|
|
break;
|
2001-11-10 17:29:04 +00:00
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected left/right/top/bottom unit");
|
2001-11-10 17:29:04 +00:00
|
|
|
val->SetTwips(0);
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
2000-05-15 01:59:05 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-10 17:29:04 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::FlushPendingReflows()
|
|
|
|
{
|
|
|
|
// Flush all pending notifications so that our frames are up to date
|
2005-06-03 01:51:15 +00:00
|
|
|
nsCOMPtr<nsIDocument> document = mContent->GetDocument();
|
2002-10-16 03:38:52 +00:00
|
|
|
if (document) {
|
2004-05-27 22:08:42 +00:00
|
|
|
document->FlushPendingNotifications(Flush_Layout);
|
2002-10-16 03:38:52 +00:00
|
|
|
}
|
|
|
|
}
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsComputedDOMStyle::GetStyleData(nsStyleStructID aID,
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsIFrame* aFrame)
|
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
if (aFrame && !mPseudo) {
|
2006-01-26 02:29:17 +00:00
|
|
|
nsIAtom* type = aFrame->GetType();
|
|
|
|
if (type == nsLayoutAtoms::tableOuterFrame) {
|
|
|
|
// If the frame is an outer table frame then we should get the style
|
|
|
|
// from the inner table frame.
|
|
|
|
aFrame = aFrame->GetFirstChild(nsnull);
|
|
|
|
NS_ASSERTION(!aFrame->GetNextSibling(),
|
|
|
|
"Outer table frames should have just one child, the inner table");
|
|
|
|
}
|
|
|
|
|
2003-05-15 03:42:21 +00:00
|
|
|
aStyleStruct = aFrame->GetStyleData(aID);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else if (mStyleContextHolder) {
|
2001-11-10 17:29:04 +00:00
|
|
|
aStyleStruct = mStyleContextHolder->GetStyleData(aID);
|
|
|
|
} else {
|
2005-06-03 01:51:15 +00:00
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocumentWeak);
|
|
|
|
NS_ENSURE_TRUE(doc, NS_ERROR_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 16:46:42 +00:00
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
nsIPresShell* presShell = doc->GetShellAt(0);
|
|
|
|
NS_ENSURE_TRUE(presShell, NS_ERROR_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 16:46:42 +00:00
|
|
|
|
2004-03-29 16:00:38 +00:00
|
|
|
mStyleContextHolder =
|
|
|
|
nsInspectorCSSUtils::GetStyleContextForContent(mContent,
|
|
|
|
mPseudo,
|
|
|
|
presShell);
|
|
|
|
if (mStyleContextHolder) {
|
|
|
|
aStyleStruct = mStyleContextHolder->GetStyleData(aID);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
}
|
2001-11-10 17:29:04 +00:00
|
|
|
NS_ASSERTION(aStyleStruct, "Failed to get a style struct");
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2001-03-11 20:47:06 +00:00
|
|
|
return NS_OK;
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetPaddingWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2002-10-16 03:38:52 +00:00
|
|
|
|
|
|
|
FlushPendingReflows();
|
2001-11-10 17:29:04 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
nscoord
|
|
|
|
nsComputedDOMStyle::GetPaddingWidthCoordFor(PRUint8 aSide, nsIFrame* aFrame)
|
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStylePadding* paddingData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Padding, (const nsStyleStruct*&)paddingData,
|
|
|
|
aFrame);
|
2001-11-10 17:29:04 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (paddingData) {
|
2001-11-10 17:29:04 +00:00
|
|
|
nsMargin padding;
|
|
|
|
paddingData->CalcPaddingFor(aFrame, padding);
|
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP :
|
|
|
|
return padding.top;
|
|
|
|
case NS_SIDE_BOTTOM :
|
|
|
|
return padding.bottom;
|
|
|
|
case NS_SIDE_LEFT :
|
|
|
|
return padding.left;
|
|
|
|
case NS_SIDE_RIGHT :
|
|
|
|
return padding.right;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Invalid side");
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
|
|
|
nsComputedDOMStyle::GetBorderWidthCoordFor(PRUint8 aSide, nsIFrame *aFrame)
|
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-11-10 17:29:04 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBorder* borderData = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)borderData, aFrame);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (borderData) {
|
2001-11-10 17:29:04 +00:00
|
|
|
nsMargin border;
|
|
|
|
borderData->CalcBorderFor(aFrame, border);
|
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP :
|
|
|
|
return border.top;
|
|
|
|
case NS_SIDE_BOTTOM :
|
|
|
|
return border.bottom;
|
|
|
|
case NS_SIDE_LEFT :
|
|
|
|
return border.left;
|
|
|
|
case NS_SIDE_RIGHT :
|
|
|
|
return border.right;
|
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Invalid side");
|
2001-11-10 17:29:04 +00:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2002-03-16 17:04:35 +00:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetLineHeightCoord(nsIFrame *aFrame,
|
|
|
|
const nsStyleText *aText,
|
|
|
|
nscoord& aCoord)
|
|
|
|
{
|
|
|
|
nsresult rv = NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
if (aText) {
|
|
|
|
const nsStyleFont *font = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Font, (const nsStyleStruct*&)font, aFrame);
|
|
|
|
switch (aText->mLineHeight.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
aCoord = aText->mLineHeight.GetCoordValue();
|
|
|
|
rv = NS_OK;
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
if (font) {
|
|
|
|
aCoord = nscoord(aText->mLineHeight.GetPercentValue() * font->mSize);
|
|
|
|
rv = NS_OK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Factor:
|
|
|
|
if (font) {
|
|
|
|
aCoord = nscoord(aText->mLineHeight.GetFactorValue() * font->mSize);
|
|
|
|
rv = NS_OK;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_FAILED(rv))
|
|
|
|
aCoord = 0;
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetBorderColorsFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleBorder *border = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
|
|
|
|
|
|
|
if (border && border->mBorderColors) {
|
2004-11-30 05:31:37 +00:00
|
|
|
nsBorderColors* borderColors = border->mBorderColors[aSide];
|
2002-07-08 07:11:59 +00:00
|
|
|
if (borderColors) {
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
do {
|
|
|
|
nsROCSSPrimitiveValue *primitive = GetROCSSPrimitiveValue();
|
|
|
|
if (!primitive) {
|
|
|
|
delete valueList;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2003-01-10 19:49:24 +00:00
|
|
|
if (borderColors->mTransparent) {
|
2004-01-18 02:42:27 +00:00
|
|
|
primitive->SetIdent(nsLayoutAtoms::transparent);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2003-01-10 19:49:24 +00:00
|
|
|
nsDOMCSSRGBColor *rgb = GetDOMCSSRGBColor(borderColors->mColor);
|
|
|
|
if (rgb) {
|
|
|
|
primitive->SetColor(rgb);
|
|
|
|
} else {
|
|
|
|
delete valueList;
|
|
|
|
delete primitive;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2003-01-10 19:49:24 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
2003-01-11 10:28:37 +00:00
|
|
|
PRBool success = valueList->AppendCSSValue(primitive);
|
|
|
|
if (!success) {
|
2002-07-08 07:11:59 +00:00
|
|
|
delete valueList;
|
|
|
|
delete primitive;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
borderColors = borderColors->mNext;
|
|
|
|
} while (borderColors);
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2002-07-08 07:11:59 +00:00
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-06-21 06:42:21 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetBorderRadiusFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBorder *border = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
|
|
|
|
|
|
|
if (border) {
|
|
|
|
nsStyleCoord coord;
|
2004-10-14 03:32:28 +00:00
|
|
|
border->mBorderRadius.Get(aSide, coord);
|
|
|
|
|
2002-06-21 06:42:21 +00:00
|
|
|
switch (coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetTwips(coord.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
2002-07-08 07:11:59 +00:00
|
|
|
if (aFrame) {
|
2003-08-06 03:07:12 +00:00
|
|
|
val->SetTwips(coord.GetPercentValue() * aFrame->GetSize().width);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-07-08 07:11:59 +00:00
|
|
|
val->SetPercent(coord.GetPercentValue());
|
|
|
|
}
|
|
|
|
break;
|
2002-06-21 06:42:21 +00:00
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Unexpected border radius unit");
|
2002-06-21 06:42:21 +00:00
|
|
|
break;
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-06-21 06:42:21 +00:00
|
|
|
val->SetTwips(0);
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-06-21 06:42:21 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (border) {
|
2005-04-29 15:44:38 +00:00
|
|
|
nscoord width;
|
|
|
|
border->CalcBorderFor(aFrame, aSide, width);
|
|
|
|
val->SetTwips(width);
|
2001-03-11 21:03:08 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-30 02:08:48 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetBorderColorFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-30 02:08:48 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleBorder* border = nsnull;
|
2002-09-07 01:48:39 +00:00
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2002-09-07 01:48:39 +00:00
|
|
|
if (border) {
|
2001-05-31 22:19:43 +00:00
|
|
|
nscolor color;
|
|
|
|
PRBool transparent;
|
|
|
|
PRBool foreground;
|
|
|
|
border->GetBorderColor(aSide, color, transparent, foreground);
|
2003-01-10 15:55:27 +00:00
|
|
|
if (transparent) {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::transparent);
|
2003-01-10 15:55:27 +00:00
|
|
|
} else {
|
|
|
|
if (foreground) {
|
|
|
|
const nsStyleColor* colorStruct = nsnull;
|
|
|
|
GetStyleData(eStyleStruct_Color, (const nsStyleStruct*&)colorStruct,
|
|
|
|
aFrame);
|
|
|
|
color = colorStruct->mColor;
|
|
|
|
}
|
2001-05-31 22:19:43 +00:00
|
|
|
|
2003-01-10 19:49:24 +00:00
|
|
|
nsDOMCSSRGBColor *rgb = GetDOMCSSRGBColor(color);
|
2003-01-10 15:55:27 +00:00
|
|
|
if (!rgb) {
|
|
|
|
delete val;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2003-01-10 15:55:27 +00:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2003-01-10 15:55:27 +00:00
|
|
|
val->SetColor(rgb);
|
|
|
|
}
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 21:03:08 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetMarginWidthFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2002-10-16 03:38:52 +00:00
|
|
|
FlushPendingReflows();
|
|
|
|
|
2001-11-10 17:29:04 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetMarginWidthCoordFor(PRUint8 aSide, nsIFrame *aFrame)
|
2001-11-10 17:29:04 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
const nsStyleMargin* marginData = nsnull;
|
2001-11-10 17:29:04 +00:00
|
|
|
GetStyleData(eStyleStruct_Margin, (const nsStyleStruct*&)marginData, aFrame);
|
2002-09-07 01:48:39 +00:00
|
|
|
if (marginData) {
|
2001-11-10 17:29:04 +00:00
|
|
|
nsMargin margin;
|
|
|
|
marginData->CalcMarginFor(aFrame, margin);
|
2001-03-11 20:47:06 +00:00
|
|
|
switch(aSide) {
|
|
|
|
case NS_SIDE_TOP :
|
2001-11-10 17:29:04 +00:00
|
|
|
return margin.top;
|
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 16:46:42 +00:00
|
|
|
case NS_SIDE_BOTTOM :
|
2001-11-10 17:29:04 +00:00
|
|
|
return margin.bottom;
|
2001-03-11 20:47:06 +00:00
|
|
|
case NS_SIDE_LEFT :
|
2001-11-10 17:29:04 +00:00
|
|
|
return margin.left;
|
2001-03-11 20:47:06 +00:00
|
|
|
case NS_SIDE_RIGHT :
|
2001-11-10 17:29:04 +00:00
|
|
|
return margin.right;
|
2001-03-11 20:47:06 +00:00
|
|
|
default:
|
2005-03-27 11:36:08 +00:00
|
|
|
NS_ERROR("Invalid side");
|
2001-03-11 20:47:06 +00:00
|
|
|
break;
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2001-11-10 17:29:04 +00:00
|
|
|
return 0;
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
nsresult
|
2002-09-07 01:48:39 +00:00
|
|
|
nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide, nsIFrame *aFrame,
|
2002-07-08 07:11:59 +00:00
|
|
|
nsIDOMCSSValue** aValue)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2002-09-07 01:48:39 +00:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
|
2001-03-11 20:47:06 +00: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 16:46:42 +00:00
|
|
|
GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2002-01-24 21:19:21 +00:00
|
|
|
PRUint8 borderStyle = NS_STYLE_BORDER_STYLE_NONE;
|
|
|
|
|
|
|
|
if (border) {
|
|
|
|
borderStyle = border->GetBorderStyle(aSide);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (borderStyle != NS_STYLE_BORDER_STYLE_NONE) {
|
2001-11-27 21:13:53 +00:00
|
|
|
const nsAFlatCString& style=
|
2004-10-01 17:15:15 +00:00
|
|
|
nsCSSProps::ValueToKeyword(borderStyle,
|
|
|
|
nsCSSProps::kBorderStyleKTable);
|
2002-03-22 20:18:42 +00:00
|
|
|
val->SetIdent(style);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2004-01-18 02:42:27 +00:00
|
|
|
val->SetIdent(nsLayoutAtoms::none);
|
2001-03-03 00:44:19 +00: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 16:46:42 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
2002-10-08 01:53:31 +00:00
|
|
|
|
|
|
|
|
|
|
|
#define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \
|
|
|
|
{ eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method }
|
|
|
|
|
|
|
|
const nsComputedDOMStyle::ComputedStyleMapEntry*
|
|
|
|
nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
|
|
|
{
|
|
|
|
/* ******************************************************************* *\
|
|
|
|
* Properties below are listed in alphabetical order. *
|
|
|
|
* Please keep them that way. *
|
|
|
|
* *
|
|
|
|
* Properties commented out with // are not yet implemented *
|
|
|
|
* Properties commented out with //// are shorthands and not queryable *
|
|
|
|
\* ******************************************************************* */
|
2002-10-08 03:58:32 +00:00
|
|
|
static
|
|
|
|
#ifndef XP_MACOSX
|
|
|
|
// XXX If this actually fixes the bustage, replace this with an
|
|
|
|
// autoconf test.
|
|
|
|
const
|
|
|
|
#endif
|
|
|
|
ComputedStyleMapEntry map[] = {
|
2002-10-08 01:53:31 +00:00
|
|
|
/* ****************************** *\
|
|
|
|
* Implementations of CSS2 styles *
|
|
|
|
\* ****************************** */
|
|
|
|
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(azimuth, Azimuth),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(background, Background),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_attachment, BackgroundAttachment),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_color, BackgroundColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_image, BackgroundImage),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(background_position, BackgroundPosition),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_repeat, BackgroundRepeat),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border, Border),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_bottom, BorderBottom),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_bottom_color, BorderBottomColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_bottom_style, BorderBottomStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_bottom_width, BorderBottomWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_collapse, BorderCollapse),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_color, BorderColor),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_left, BorderLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_left_color, BorderLeftColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_left_style, BorderLeftStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_left_width, BorderLeftWidth),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_right, BorderRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_color, BorderRightColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_style, BorderRightStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_width, BorderRightWidth),
|
2004-09-10 03:26:58 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_spacing, BorderSpacing),
|
2002-10-08 01:53:31 +00:00
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_style, BorderStyle),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_top, BorderTop),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_top_color, BorderTopColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_top_style, BorderTopStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_top_width, BorderTopWidth),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_width, BorderWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(bottom, Bottom),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(caption_side, CaptionSide),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(clear, Clear),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(clip, Clip),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(color, Color),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(content, Content),
|
2005-04-01 23:07:00 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(counter_increment, CounterIncrement),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(counter_reset, CounterReset),
|
2002-10-08 01:53:31 +00:00
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(cue, Cue),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(cue_after, CueAfter),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(cue_before, CueBefore),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(cursor, Cursor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(direction, Direction),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(display, Display),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(elevation, Elevation),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(empty_cells, EmptyCells),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(float, CssFloat),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(font, Font),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_family, FontFamily),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_size, FontSize),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_size_adjust, FontSizeAdjust),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(font_stretch, FontStretch),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_style, FontStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_variant, FontVariant),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_weight, FontWeight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(height, Height),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(left, Left),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(letter_spacing, LetterSpacing),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(line_height, LineHeight),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(list_style, ListStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(list_style_image, ListStyleImage),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(list_style_position, ListStylePosition),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(list_style_type, ListStyleType),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(margin, Margin),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(margin_bottom, MarginBottomWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(margin_left, MarginLeftWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(margin_right, MarginRightWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(margin_top, MarginTopWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(marker_offset, MarkerOffset),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(marks, Marks),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(max_height, MaxHeight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(max_width, MaxWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(min_height, MinHeight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(min_width, MinWidth),
|
2006-08-08 16:41:03 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(opacity, Opacity),
|
2002-10-08 01:53:31 +00:00
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(orphans, Orphans),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(outline, Outline),
|
2005-03-27 11:36:08 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(outline_color, OutlineColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(outline_style, OutlineStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(outline_width, OutlineWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(outline_offset, OutlineOffset),
|
2002-10-08 01:53:31 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(overflow, Overflow),
|
2004-09-05 00:04:04 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(overflow_x, OverflowX),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(overflow_y, OverflowY),
|
2002-10-08 01:53:31 +00:00
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(padding, Padding),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(padding_bottom, PaddingBottom),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(padding_left, PaddingLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(padding_right, PaddingRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(padding_top, PaddingTop),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(page, Page),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(page_break_after, PageBreakAfter),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(page_break_before, PageBreakBefore),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(page_break_inside, PageBreakInside),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(pause, Pause),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(pause_after, PauseAfter),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(pause_before, PauseBefore),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(pitch, Pitch),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(pitch_range, PitchRange),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(position, Position),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(quotes, Quotes),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(richness, Richness),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(right, Right),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(size, Size),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(speak, Speak),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(speak_header, SpeakHeader),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(speak_numeral, SpeakNumeral),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(speak_punctuation, SpeakPunctuation),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(speech_rate, SpeechRate),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(stress, Stress),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(table_layout, TableLayout),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_align, TextAlign),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_decoration, TextDecoration),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_indent, TextIndent),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(text_shadow, TextShadow),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_transform, TextTransform),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(top, Top),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(unicode_bidi, UnicodeBidi),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(vertical_align, VerticalAlign),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(visibility, Visibility),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(voice_family, VoiceFamily),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(volume, Volume),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(white_space, WhiteSpace),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(widows, Widows),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(width, Width),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(word_spacing, WordSpacing),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(z_index, ZIndex),
|
|
|
|
|
|
|
|
/* ******************************* *\
|
|
|
|
* Implementations of -moz- styles *
|
|
|
|
\* ******************************* */
|
|
|
|
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(appearance, Appearance),
|
2002-10-08 10:24:53 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_clip, BackgroundClip),
|
2003-01-17 09:33:52 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_inline_policy, BackgroundInlinePolicy),
|
2002-10-08 10:24:53 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_origin, BackgroundOrigin),
|
2002-10-08 01:53:31 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(binding, Binding),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_bottom_colors, BorderBottomColors),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_left_colors, BorderLeftColors),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_colors, BorderRightColors),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_top_colors, BorderTopColors),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_border_radius_bottomLeft, BorderRadiusBottomLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_border_radius_bottomRight,BorderRadiusBottomRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_border_radius_topLeft, BorderRadiusTopLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_border_radius_topRight, BorderRadiusTopRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_align, BoxAlign),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_direction, BoxDirection),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_flex, BoxFlex),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_ordinal_group, BoxOrdinalGroup),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_orient, BoxOrient),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_pack, BoxPack),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_sizing, BoxSizing),
|
2004-06-17 11:57:37 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_count, ColumnCount),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_width, ColumnWidth),
|
2004-07-18 12:12:46 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_gap, ColumnGap),
|
2002-10-08 01:53:31 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(float_edge, FloatEdge),
|
2004-01-15 02:25:08 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(image_region, ImageRegion),
|
2004-10-14 03:32:28 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_topLeft, OutlineRadiusTopLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_outline_radius_topRight, OutlineRadiusTopRight),
|
2002-10-08 01:53:31 +00:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(user_focus, UserFocus),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(user_input, UserInput),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(user_modify, UserModify),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(user_select, UserSelect)
|
|
|
|
};
|
|
|
|
|
2004-01-15 02:25:08 +00:00
|
|
|
*aLength = NS_ARRAY_LENGTH(map);
|
2002-10-08 01:53:31 +00:00
|
|
|
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|