2001-09-25 05:32:19 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
2004-04-18 01:52:36 +04:00
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
2004-04-18 01:52:36 +04: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 04:07:33 +04:00
|
|
|
*
|
2001-09-25 05:32:19 +04:00
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
2004-04-18 01:52:36 +04:00
|
|
|
* The Initial Developer of the Original Code is
|
2001-09-25 05:32:19 +04:00
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
2000-05-04 04:07:33 +04:00
|
|
|
*
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
* Contributor(s):
|
2001-12-20 14:15:32 +03:00
|
|
|
* Daniel Glazman <glazman@netscape.com>
|
2002-03-13 00:16:22 +03:00
|
|
|
* Boris Zbarsky <bzbarsky@mit.edu>
|
|
|
|
* Christopher A. Aillon <christopher@aillon.com>
|
2005-03-27 15:36:08 +04:00
|
|
|
* Mats Palmgren <mats.palmgren@bredband.net>
|
2005-09-19 19:47:26 +04:00
|
|
|
* Christian Biesinger <cbiesinger@web.de>
|
2001-09-25 05:32:19 +04:00
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
2004-04-18 01:52:36 +04: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 05:32:19 +04: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-18 01:52:36 +04:00
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
2001-09-25 05:32:19 +04: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-18 01:52:36 +04:00
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
2001-09-25 05:32:19 +04:00
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2006-03-25 08:47:31 +03:00
|
|
|
/* DOM object returned from element.getComputedStyle() */
|
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
#include "nsComputedDOMStyle.h"
|
|
|
|
|
|
|
|
#include "nsDOMError.h"
|
2004-04-01 23:44:17 +04:00
|
|
|
#include "nsDOMString.h"
|
2002-10-03 23:41:42 +04:00
|
|
|
#include "nsIDOMCSS2Properties.h"
|
2000-05-04 04:07:33 +04:00
|
|
|
#include "nsIDOMElement.h"
|
2003-02-22 03:32:13 +03:00
|
|
|
#include "nsStyleContext.h"
|
2002-03-22 23:18:42 +03:00
|
|
|
#include "nsIScrollableFrame.h"
|
|
|
|
#include "nsContentUtils.h"
|
|
|
|
#include "prprf.h"
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
#include "nsCSSProps.h"
|
2001-12-20 14:15:32 +03:00
|
|
|
#include "nsCSSKeywords.h"
|
2002-03-22 23:18:42 +03:00
|
|
|
#include "nsDOMCSSRect.h"
|
2007-01-30 03:06:41 +03:00
|
|
|
#include "nsGkAtoms.h"
|
2004-11-25 05:43:28 +03:00
|
|
|
#include "nsHTMLReflowState.h"
|
2002-04-20 18:30:57 +04:00
|
|
|
#include "nsThemeConstants.h"
|
2007-03-08 21:44:45 +03:00
|
|
|
#include "nsStyleUtil.h"
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2004-08-01 03:15:21 +04:00
|
|
|
#include "nsPresContext.h"
|
2001-03-11 23:47:06 +03:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
|
2004-01-17 23:04:26 +03:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2004-01-28 03:18:22 +03:00
|
|
|
#include "nsStyleSet.h"
|
2004-03-09 06:57:51 +03:00
|
|
|
#include "imgIRequest.h"
|
2004-03-29 20:00:38 +04:00
|
|
|
#include "nsInspectorCSSUtils.h"
|
2007-05-05 10:09:50 +04:00
|
|
|
#include "nsLayoutUtils.h"
|
|
|
|
#include "nsFrameManager.h"
|
2004-01-17 23:04:26 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
#if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
|
|
|
|
#define DEBUG_ComputedDOMStyle
|
|
|
|
#endif
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
/*
|
|
|
|
* This is the implementation of the readonly CSSStyleDeclaration that is
|
|
|
|
* returned by the getComputedStyle() function.
|
|
|
|
*/
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
static nsComputedDOMStyle *sCachedComputedDOMStyle;
|
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
nsresult
|
|
|
|
NS_NewComputedDOMStyle(nsIComputedDOMStyle** aComputedStyle)
|
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aComputedStyle);
|
|
|
|
|
2002-07-08 11:11:59 +04: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 04:07:33 +04:00
|
|
|
|
|
|
|
NS_ADDREF(*aComputedStyle);
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2005-01-04 23:17:25 +03:00
|
|
|
static nsIFrame*
|
|
|
|
GetContainingBlockFor(nsIFrame* aFrame) {
|
|
|
|
if (!aFrame) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
return nsHTMLReflowState::GetContainingBlockFor(aFrame);
|
|
|
|
}
|
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
nsComputedDOMStyle::nsComputedDOMStyle()
|
2007-05-05 09:30:10 +04:00
|
|
|
: mInner(this), mDocumentWeak(nsnull), mFrame(nsnull), mPresShell(nsnull),
|
|
|
|
mAppUnitsPerInch(0)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::~nsComputedDOMStyle()
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04: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.
|
2007-07-08 11:08:04 +04:00
|
|
|
delete reinterpret_cast<char*>(sCachedComputedDOMStyle);
|
2002-07-08 11:11:59 +04:00
|
|
|
sCachedComputedDOMStyle = nsnull;
|
|
|
|
}
|
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2003-07-12 00:44:25 +04:00
|
|
|
// QueryInterface implementation for nsComputedDOMStyle
|
|
|
|
NS_INTERFACE_MAP_BEGIN(nsComputedDOMStyle)
|
|
|
|
NS_INTERFACE_MAP_ENTRY(nsIComputedDOMStyle)
|
2004-06-08 05:32:29 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY(nsICSSDeclaration)
|
2003-07-12 00:44:25 +04: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 04:07:33 +04:00
|
|
|
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
static void doDestroyComputedDOMStyle(nsComputedDOMStyle *aComputedStyle)
|
|
|
|
{
|
|
|
|
if (!sCachedComputedDOMStyle) {
|
|
|
|
// The cache is empty, store aComputedStyle in the cache.
|
|
|
|
|
|
|
|
sCachedComputedDOMStyle = aComputedStyle;
|
|
|
|
sCachedComputedDOMStyle->~nsComputedDOMStyle();
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-07-08 11:11:59 +04:00
|
|
|
// The cache is full, delete aComputedStyle
|
|
|
|
|
|
|
|
delete aComputedStyle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-09-08 01:50:21 +04:00
|
|
|
NS_IMPL_ADDREF(nsComputedDOMStyle)
|
2002-07-08 11:11:59 +04:00
|
|
|
NS_IMPL_RELEASE_WITH_DESTROY(nsComputedDOMStyle,
|
2003-09-08 01:50:21 +04:00
|
|
|
doDestroyComputedDOMStyle(this))
|
2000-05-04 04:07:33 +04:00
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::Init(nsIDOMElement *aElement,
|
2002-03-24 01:56:05 +03:00
|
|
|
const nsAString& aPseudoElt,
|
2000-05-15 05:59:05 +04:00
|
|
|
nsIPresShell *aPresShell)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aElement);
|
|
|
|
NS_ENSURE_ARG_POINTER(aPresShell);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2005-06-03 05:51:15 +04:00
|
|
|
mDocumentWeak = do_GetWeakReference(aPresShell->GetDocument());
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
mContent = do_QueryInterface(aElement);
|
|
|
|
if (!mContent) {
|
|
|
|
// This should not happen, all our elements support nsIContent!
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2000-05-15 05:59:05 +04: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 20:46:42 +04:00
|
|
|
|
2004-01-17 23:04:26 +03: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 20:46:42 +04:00
|
|
|
NS_ENSURE_TRUE(mPseudo, NS_ERROR_OUT_OF_MEMORY);
|
2004-01-17 23:04:26 +03: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 23:47:06 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2004-08-21 00:34:37 +04:00
|
|
|
nsPresContext *presCtx = aPresShell->GetPresContext();
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_TRUE(presCtx, NS_ERROR_FAILURE);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2007-02-07 10:46:44 +03:00
|
|
|
mAppUnitsPerInch = presCtx->AppUnitsPerInch();
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2004-06-08 05:32:29 +04: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 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::GetCssText(nsAString& aCssText)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
aCssText.Truncate();
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::SetCssText(const nsAString& aCssText)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetLength(PRUint32* aLength)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2002-10-08 05:53:31 +04:00
|
|
|
NS_PRECONDITION(aLength, "Null aLength! Prepare to die!");
|
|
|
|
|
|
|
|
(void)GetQueryablePropertyMap(aLength);
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 05:59:05 +04:00
|
|
|
nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aParentRule);
|
|
|
|
*aParentRule = nsnull;
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-06-14 04:06:36 +04:00
|
|
|
nsCOMPtr<nsIDOMCSSValue> val;
|
|
|
|
|
|
|
|
aReturn.Truncate();
|
|
|
|
|
|
|
|
nsresult rv = GetPropertyCSSValue(aPropertyName, getter_AddRefs(val));
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (val) {
|
|
|
|
rv = val->GetCssText(aReturn);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName,
|
2000-05-15 05:59:05 +04:00
|
|
|
nsIDOMCSSValue** aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_ARG_POINTER(aReturn);
|
|
|
|
*aReturn = nsnull;
|
|
|
|
|
2005-06-03 05:51:15 +04: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 20:46:42 +04:00
|
|
|
|
2005-06-03 05:51:15 +04: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 20:46:42 +04:00
|
|
|
|
2007-05-05 09:30:10 +04:00
|
|
|
mPresShell = document->GetPrimaryShell();
|
|
|
|
NS_ENSURE_TRUE(mPresShell && mPresShell->GetPresContext(),
|
|
|
|
NS_ERROR_NOT_AVAILABLE);
|
2004-05-28 02:08:42 +04:00
|
|
|
|
2007-05-05 09:30:10 +04:00
|
|
|
mFrame = mPresShell->GetPrimaryFrameFor(mContent);
|
2007-03-23 02:01:14 +03:00
|
|
|
if (!mFrame || mPseudo) {
|
2006-12-30 08:17:59 +03:00
|
|
|
// Need to resolve a style context
|
|
|
|
mStyleContextHolder =
|
|
|
|
nsInspectorCSSUtils::GetStyleContextForContent(mContent,
|
|
|
|
mPseudo,
|
2007-05-05 09:30:10 +04:00
|
|
|
mPresShell);
|
2006-12-30 08:17:59 +03:00
|
|
|
NS_ENSURE_TRUE(mStyleContextHolder, NS_ERROR_OUT_OF_MEMORY);
|
2007-05-05 09:30:10 +04:00
|
|
|
} else {
|
|
|
|
nsIAtom* type = mFrame->GetType();
|
|
|
|
nsIFrame* frame = mFrame;
|
|
|
|
if (type == nsGkAtoms::tableOuterFrame) {
|
|
|
|
// If the frame is an outer table frame then we should get the style
|
|
|
|
// from the inner table frame.
|
|
|
|
frame = frame->GetFirstChild(nsnull);
|
|
|
|
NS_ASSERTION(frame, "Outer table must have an inner");
|
|
|
|
NS_ASSERTION(!frame->GetNextSibling(),
|
|
|
|
"Outer table frames should have just one child, the inner "
|
|
|
|
"table");
|
|
|
|
}
|
|
|
|
|
|
|
|
mStyleContextHolder = frame->GetStyleContext();
|
|
|
|
NS_ASSERTION(mStyleContextHolder, "Frame without style context?");
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
|
|
|
|
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
|
|
|
|
2002-10-08 05:53:31 +04: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.
|
2006-12-22 09:10:32 +03:00
|
|
|
rv = (this->*(propMap[i].mGetter))(aReturn);
|
2001-03-30 06:08:48 +04:00
|
|
|
break;
|
2002-10-08 05:53:31 +04:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
|
|
|
|
2002-10-08 05:53:31 +04:00
|
|
|
#ifdef DEBUG_ComputedDOMStyle
|
|
|
|
if (i == length) {
|
2006-02-03 17:18:39 +03:00
|
|
|
NS_WARNING(PromiseFlatCString(NS_ConvertUTF16toUTF8(aPropertyName) +
|
2002-10-08 05:53:31 +04:00
|
|
|
NS_LITERAL_CSTRING(" is not queryable!")).get());
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
*aReturn = nsnull;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
mFrame = nsnull;
|
2007-05-05 09:30:10 +04:00
|
|
|
mPresShell = nsnull;
|
2006-12-22 09:10:32 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
// Release the current style context for it should be re-resolved
|
2001-03-11 23:47:06 +03:00
|
|
|
// whenever a frame is not available.
|
2002-09-07 05:48:39 +04:00
|
|
|
mStyleContextHolder = nsnull;
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2000-06-14 04:06:36 +04:00
|
|
|
return rv;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::RemoveProperty(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::GetPropertyPriority(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
aReturn.Truncate();
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::SetProperty(const nsAString& aPropertyName,
|
|
|
|
const nsAString& aValue,
|
|
|
|
const nsAString& aPriority)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2000-05-04 04:07:33 +04:00
|
|
|
NS_IMETHODIMP
|
2002-03-24 01:56:05 +03:00
|
|
|
nsComputedDOMStyle::Item(PRUint32 aIndex, nsAString& aReturn)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2000-05-15 05:59:05 +04:00
|
|
|
aReturn.Truncate();
|
2002-10-08 05:53:31 +04:00
|
|
|
|
|
|
|
PRUint32 length = 0;
|
|
|
|
const ComputedStyleMapEntry* propMap = GetQueryablePropertyMap(&length);
|
2002-09-04 06:15:35 +04:00
|
|
|
if (aIndex < length) {
|
2006-02-03 17:18:39 +03:00
|
|
|
CopyASCIItoUTF16(nsCSSProps::GetStringValue(propMap[aIndex].mProperty),
|
2002-09-07 05:48:39 +04:00
|
|
|
aReturn);
|
2001-05-14 15:23:53 +04:00
|
|
|
}
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
return NS_OK;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
// Property getters...
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2000-06-14 04:06:36 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBinding(nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2000-06-14 04:06:36 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2000-06-14 04:06:36 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mBinding) {
|
2007-07-19 01:56:57 +04:00
|
|
|
val->SetURI(display->mBinding->mURI);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2000-06-14 04:06:36 +04:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetClear(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsStyleDisplay *display = GetStyleDisplay();
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mBreakType != NS_STYLE_CLEAR_NONE) {
|
2002-03-16 20:04:35 +03:00
|
|
|
const nsAFlatCString& clear =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(display->mBreakType,
|
|
|
|
nsCSSProps::kClearKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(clear);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2001-09-28 11:39:41 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetCssFloat(nsIDOMCSSValue** aValue)
|
2001-09-28 11:39:41 +04:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-09-28 11:39:41 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mFloats != NS_STYLE_FLOAT_NONE) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& cssFloat =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(display->mFloats,
|
|
|
|
nsCSSProps::kFloatKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(cssFloat);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2001-09-28 11:39:41 +04:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-09-28 11:39:41 +04:00
|
|
|
}
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBottom(nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_BOTTOM, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue,
|
|
|
|
nscolor aColor)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2007-01-25 05:03:02 +03:00
|
|
|
if (NS_GET_A(aColor) == 0) {
|
|
|
|
aValue->SetIdent(nsGkAtoms::transparent);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
nsROCSSPrimitiveValue *red = GetROCSSPrimitiveValue();
|
|
|
|
nsROCSSPrimitiveValue *green = GetROCSSPrimitiveValue();
|
|
|
|
nsROCSSPrimitiveValue *blue = GetROCSSPrimitiveValue();
|
2007-01-25 05:03:02 +03:00
|
|
|
nsROCSSPrimitiveValue *alpha = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
if (red && green && blue && alpha) {
|
2007-03-08 21:44:45 +03:00
|
|
|
PRUint8 a = NS_GET_A(aColor);
|
2007-01-25 05:03:02 +03:00
|
|
|
nsDOMCSSRGBColor *rgbColor =
|
2007-03-08 21:44:45 +03:00
|
|
|
new nsDOMCSSRGBColor(red, green, blue, alpha, a < 255);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2002-03-22 23:18:42 +03:00
|
|
|
if (rgbColor) {
|
|
|
|
red->SetNumber(NS_GET_R(aColor));
|
|
|
|
green->SetNumber(NS_GET_G(aColor));
|
|
|
|
blue->SetNumber(NS_GET_B(aColor));
|
2007-03-08 21:44:45 +03:00
|
|
|
alpha->SetNumber(nsStyleUtil::ColorComponentToFloat(a));
|
2002-03-22 23:18:42 +03:00
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
aValue->SetColor(rgbColor);
|
|
|
|
return NS_OK;
|
2002-03-22 23:18:42 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
delete red;
|
|
|
|
delete green;
|
|
|
|
delete blue;
|
2007-01-25 05:03:02 +03:00
|
|
|
delete alpha;
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2002-03-22 23:18:42 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetColor(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-03-22 23:18:42 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleColor* color = GetStyleColor();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
nsresult rv = SetToRGBAColor(val, color->mColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete val;
|
2007-01-25 05:03:02 +03:00
|
|
|
return rv;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOpacity(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetNumber(GetStyleDisplay()->mOpacity);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2004-06-17 15:57:37 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetColumnCount(nsIDOMCSSValue** aValue)
|
2004-06-17 15:57:37 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleColumn* column = GetStyleColumn();
|
2004-06-17 15:57:37 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (column->mColumnCount == NS_STYLE_COLUMN_COUNT_AUTO) {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} else {
|
|
|
|
val->SetNumber(column->mColumnCount);
|
2004-06-17 15:57:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetColumnWidth(nsIDOMCSSValue** aValue)
|
2004-06-17 15:57:37 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
// XXX fix the auto case. When we actually have a column frame, I think
|
|
|
|
// we should return the computed column width.
|
|
|
|
SetValueToCoord(val, GetStyleColumn()->mColumnWidth);
|
2004-06-17 15:57:37 +04:00
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2004-07-18 16:12:46 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetColumnGap(nsIDOMCSSValue** aValue)
|
2004-07-18 16:12:46 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleColumn* column = GetStyleColumn();
|
2007-02-20 21:43:16 +03:00
|
|
|
if (column->mColumnGap.GetUnit() == eStyleUnit_Normal) {
|
|
|
|
val->SetAppUnits(GetStyleFont()->mFont.size);
|
|
|
|
} else {
|
2007-07-20 06:21:43 +04:00
|
|
|
SetValueToCoord(val, GetStyleColumn()->mColumnGap);
|
2004-07-18 16:12:46 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetContent(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleContent *content = GetStyleContent();
|
|
|
|
|
|
|
|
if (content->ContentCount() == 0) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (content->ContentCount() == 1 &&
|
|
|
|
content->ContentAt(0).mType == eStyleContentType_AltContent) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
val->SetIdent(eCSSKeyword__moz_alt_content);
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
for (PRUint32 i = 0, i_end = content->ContentCount(); i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !valueList->AppendCSSValue(val)) {
|
|
|
|
delete valueList;
|
|
|
|
delete val;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleContentData &data = content->ContentAt(i);
|
|
|
|
switch (data.mType) {
|
|
|
|
case eStyleContentType_String:
|
|
|
|
{
|
|
|
|
nsString str;
|
|
|
|
nsStyleUtil::EscapeCSSString(nsDependentString(data.mContent.mString),
|
|
|
|
str);
|
|
|
|
str.Insert(PRUnichar('"'), 0);
|
|
|
|
str.Append(PRUnichar('"'));
|
|
|
|
val->SetString(str);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case eStyleContentType_Image:
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (data.mContent.mImage) {
|
|
|
|
data.mContent.mImage->GetURI(getter_AddRefs(uri));
|
|
|
|
}
|
|
|
|
val->SetURI(uri);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case eStyleContentType_Attr:
|
|
|
|
val->SetString(nsDependentString(data.mContent.mString),
|
|
|
|
nsIDOMCSSPrimitiveValue::CSS_ATTR);
|
|
|
|
break;
|
|
|
|
case eStyleContentType_Counter:
|
|
|
|
case eStyleContentType_Counters:
|
|
|
|
{
|
|
|
|
/* FIXME: counters should really use an object */
|
|
|
|
nsAutoString str;
|
|
|
|
if (data.mType == eStyleContentType_Counter) {
|
|
|
|
str.AppendLiteral("counter(");
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
str.AppendLiteral("counters(");
|
|
|
|
}
|
|
|
|
// WRITE ME
|
|
|
|
nsCSSValue::Array *a = data.mContent.mCounters;
|
|
|
|
|
|
|
|
str.Append(a->Item(0).GetStringBufferValue());
|
|
|
|
PRInt32 typeItem = 1;
|
|
|
|
if (data.mType == eStyleContentType_Counters) {
|
|
|
|
typeItem = 2;
|
|
|
|
str.AppendLiteral(", \"");
|
|
|
|
nsString itemstr;
|
|
|
|
nsStyleUtil::EscapeCSSString(
|
|
|
|
nsDependentString(a->Item(1).GetStringBufferValue()), itemstr);
|
|
|
|
str.Append(itemstr);
|
|
|
|
str.Append(PRUnichar('"'));
|
|
|
|
}
|
|
|
|
PRInt32 type = a->Item(typeItem).GetIntValue();
|
|
|
|
if (type != NS_STYLE_LIST_STYLE_DECIMAL) {
|
|
|
|
str.AppendLiteral(", ");
|
|
|
|
str.AppendInt(type);
|
|
|
|
}
|
|
|
|
|
|
|
|
str.Append(PRUnichar(')'));
|
|
|
|
val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_COUNTER);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
case eStyleContentType_OpenQuote:
|
|
|
|
val->SetIdent(eCSSKeyword_open_quote);
|
|
|
|
break;
|
|
|
|
case eStyleContentType_CloseQuote:
|
|
|
|
val->SetIdent(eCSSKeyword_close_quote);
|
|
|
|
break;
|
|
|
|
case eStyleContentType_NoOpenQuote:
|
|
|
|
val->SetIdent(eCSSKeyword_no_open_quote);
|
|
|
|
break;
|
|
|
|
case eStyleContentType_NoCloseQuote:
|
|
|
|
val->SetIdent(eCSSKeyword_no_close_quote);
|
|
|
|
break;
|
|
|
|
case eStyleContentType_AltContent:
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("unexpected type");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
2005-04-02 03:07:00 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetCounterIncrement(nsIDOMCSSValue** aValue)
|
2005-04-02 03:07:00 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleContent *content = GetStyleContent();
|
2005-04-02 03:07:00 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (content->CounterIncrementCount() == 0) {
|
2005-04-02 03:07:00 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2005-04-02 03:07:00 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
for (PRUint32 i = 0, i_end = content->CounterIncrementCount(); i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue();
|
2007-07-22 21:58:37 +04:00
|
|
|
if (!name || !valueList->AppendCSSValue(name)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete valueList;
|
|
|
|
delete name;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2005-04-02 03:07:00 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue();
|
2007-07-22 21:58:37 +04:00
|
|
|
if (!value || !valueList->AppendCSSValue(value)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete valueList;
|
|
|
|
delete value;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
|
|
|
|
const nsStyleCounterData *data = content->GetCounterIncrementAt(i);
|
|
|
|
name->SetString(data->mCounter);
|
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetCounterReset(nsIDOMCSSValue** aValue)
|
2005-04-02 03:07:00 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleContent *content = GetStyleContent();
|
2005-04-02 03:07:00 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (content->CounterResetCount() == 0) {
|
2005-04-02 03:07:00 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2005-04-02 03:07:00 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
for (PRUint32 i = 0, i_end = content->CounterResetCount(); i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue* name = GetROCSSPrimitiveValue();
|
2007-07-22 21:58:37 +04:00
|
|
|
if (!name || !valueList->AppendCSSValue(name)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete valueList;
|
|
|
|
delete name;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2005-04-02 03:07:00 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nsROCSSPrimitiveValue* value = GetROCSSPrimitiveValue();
|
2007-07-22 21:58:37 +04:00
|
|
|
if (!value || !valueList->AppendCSSValue(value)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete valueList;
|
|
|
|
delete value;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
|
|
|
|
const nsStyleCounterData *data = content->GetCounterResetAt(i);
|
|
|
|
name->SetString(data->mCounter);
|
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetQuotes(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleQuotes *quotes = GetStyleQuotes();
|
|
|
|
|
|
|
|
if (quotes->QuotesCount() == 0) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
for (PRUint32 i = 0, i_end = quotes->QuotesCount(); i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue* openVal = GetROCSSPrimitiveValue();
|
|
|
|
if (!openVal || !valueList->AppendCSSValue(openVal)) {
|
|
|
|
delete valueList;
|
|
|
|
delete openVal;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* closeVal = GetROCSSPrimitiveValue();
|
|
|
|
if (!closeVal || !valueList->AppendCSSValue(closeVal)) {
|
|
|
|
delete valueList;
|
|
|
|
delete closeVal;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsString s;
|
|
|
|
nsStyleUtil::EscapeCSSString(*quotes->OpenQuoteAt(i), s);
|
|
|
|
s.Insert(PRUnichar('"'), 0);
|
|
|
|
s.Append(PRUnichar('"'));
|
|
|
|
openVal->SetString(s);
|
|
|
|
nsStyleUtil::EscapeCSSString(*quotes->CloseQuoteAt(i), s);
|
|
|
|
s.Insert(PRUnichar('"'), 0);
|
|
|
|
s.Append(PRUnichar('"'));
|
|
|
|
closeVal->SetString(s);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFontFamily(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleFont* font = GetStyleFont();
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocumentWeak);
|
|
|
|
NS_ASSERTION(doc, "document is required");
|
2007-05-02 02:24:20 +04:00
|
|
|
nsIPresShell* presShell = doc->GetPrimaryShell();
|
2006-12-30 08:17:59 +03:00
|
|
|
NS_ASSERTION(presShell, "pres shell is required");
|
|
|
|
nsPresContext *presContext = presShell->GetPresContext();
|
|
|
|
NS_ASSERTION(presContext, "pres context is required");
|
|
|
|
|
|
|
|
const nsString& fontName = font->mFont.name;
|
|
|
|
PRUint8 generic = font->mFlags & NS_STYLE_FONT_FACE_MASK;
|
|
|
|
if (generic == kGenericFont_NONE && !font->mFont.systemFont) {
|
|
|
|
const nsFont* defaultFont =
|
|
|
|
presContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID);
|
|
|
|
|
|
|
|
PRInt32 lendiff = fontName.Length() - defaultFont->name.Length();
|
|
|
|
if (lendiff > 0) {
|
|
|
|
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
2001-09-07 06:28:10 +04:00
|
|
|
} else {
|
2001-09-27 22:33:58 +04:00
|
|
|
val->SetString(fontName);
|
2001-09-07 06:28:10 +04:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
val->SetString(fontName);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFontSize(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
// Note: GetStyleFont()->mSize is the 'computed size';
|
|
|
|
// GetStyleFont()->mFont.size is the 'actual size'
|
2007-02-07 10:46:44 +03:00
|
|
|
val->SetAppUnits(GetStyleFont()->mSize);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFontSizeAdjust(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleFont *font = GetStyleFont();
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (font->mFont.sizeAdjust) {
|
2002-03-16 20:04:35 +03:00
|
|
|
val->SetNumber(font->mFont.sizeAdjust);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFontStyle(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleFont* font = GetStyleFont();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (font->mFont.style != NS_STYLE_FONT_STYLE_NORMAL) {
|
2002-03-22 23:18:42 +03:00
|
|
|
const nsAFlatCString& style=
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(font->mFont.style,
|
|
|
|
nsCSSProps::kFontStyleKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(style);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::normal);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFontWeight(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleFont* font = GetStyleFont();
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& str_weight=
|
|
|
|
nsCSSProps::ValueToKeyword(font->mFont.weight,
|
|
|
|
nsCSSProps::kFontWeightKTable);
|
|
|
|
if (!str_weight.IsEmpty()) {
|
|
|
|
val->SetIdent(str_weight);
|
|
|
|
} else {
|
|
|
|
val->SetNumber(font->mFont.weight);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFontVariant(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleFont* font = GetStyleFont();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (font->mFont.variant != NS_STYLE_FONT_VARIANT_NORMAL) {
|
2002-03-22 23:18:42 +03:00
|
|
|
const nsAFlatCString& variant=
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(font->mFont.variant,
|
|
|
|
nsCSSProps::kFontVariantKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(variant);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::normal);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundAttachment(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleBackground *background = GetStyleBackground();
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& backgroundAttachment =
|
|
|
|
nsCSSProps::ValueToKeyword(background->mBackgroundAttachment,
|
|
|
|
nsCSSProps::kBackgroundAttachmentKTable);
|
|
|
|
val->SetIdent(backgroundAttachment);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-10-08 14:24:53 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundClip(nsIDOMCSSValue** aValue)
|
2002-10-08 14:24:53 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& backgroundClip =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleBackground()->mBackgroundClip,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBackgroundClipKTable);
|
2002-10-08 14:24:53 +04:00
|
|
|
|
|
|
|
val->SetIdent(backgroundClip);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundColor(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleBackground* color = GetStyleBackground();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (color->mBackgroundFlags & NS_STYLE_BG_COLOR_TRANSPARENT) {
|
|
|
|
const nsAFlatCString& backgroundColor =
|
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_BG_COLOR_TRANSPARENT,
|
|
|
|
nsCSSProps::kBackgroundColorKTable);
|
|
|
|
val->SetIdent(backgroundColor);
|
|
|
|
} else {
|
2007-01-25 05:03:02 +03:00
|
|
|
nsresult rv = SetToRGBAColor(val, color->mBackgroundColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete val;
|
2007-01-25 05:03:02 +03:00
|
|
|
return rv;
|
2001-09-06 12:20:50 +04:00
|
|
|
}
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundImage(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleBackground* color = GetStyleBackground();
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (color->mBackgroundFlags & NS_STYLE_BG_IMAGE_NONE) {
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (color->mBackgroundImage) {
|
|
|
|
color->mBackgroundImage->GetURI(getter_AddRefs(uri));
|
2002-01-11 03:15:55 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetURI(uri);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2003-01-17 12:33:52 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundInlinePolicy(nsIDOMCSSValue** aValue)
|
2003-01-17 12:33:52 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& backgroundPolicy =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleBackground()->mBackgroundInlinePolicy,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBackgroundInlinePolicyKTable);
|
2003-01-17 12:33:52 +03:00
|
|
|
|
|
|
|
val->SetIdent(backgroundPolicy);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-10-08 14:24:53 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundOrigin(nsIDOMCSSValue** aValue)
|
2002-10-08 14:24:53 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& backgroundOrigin =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleBackground()->mBackgroundOrigin,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBackgroundOriginKTable);
|
2002-10-08 14:24:53 +04:00
|
|
|
|
|
|
|
val->SetIdent(backgroundOrigin);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundPosition(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue();
|
|
|
|
if (!valX || !valueList->AppendCSSValue(valX)) {
|
|
|
|
delete valueList;
|
|
|
|
delete valX;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue();
|
|
|
|
if (!valY || !valueList->AppendCSSValue(valY)) {
|
|
|
|
delete valueList;
|
|
|
|
delete valY;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
const nsStyleBackground *bg = GetStyleBackground();
|
|
|
|
|
|
|
|
if (NS_STYLE_BG_X_POSITION_LENGTH & bg->mBackgroundFlags) {
|
|
|
|
valX->SetAppUnits(bg->mBackgroundXPosition.mCoord);
|
|
|
|
}
|
|
|
|
else if (NS_STYLE_BG_X_POSITION_PERCENT & bg->mBackgroundFlags) {
|
|
|
|
valX->SetPercent(bg->mBackgroundXPosition.mFloat);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
valX->SetPercent(0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_STYLE_BG_Y_POSITION_LENGTH & bg->mBackgroundFlags) {
|
|
|
|
valY->SetAppUnits(bg->mBackgroundYPosition.mCoord);
|
|
|
|
}
|
|
|
|
else if (NS_STYLE_BG_Y_POSITION_PERCENT & bg->mBackgroundFlags) {
|
|
|
|
valY->SetPercent(bg->mBackgroundYPosition.mFloat);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
valY->SetPercent(0.0f);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundRepeat(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& backgroundRepeat =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleBackground()->mBackgroundRepeat,
|
|
|
|
nsCSSProps::kBackgroundRepeatKTable);
|
|
|
|
val->SetIdent(backgroundRepeat);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPadding(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04: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 20:46:42 +04:00
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPaddingTop(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_TOP, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPaddingBottom(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_BOTTOM, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPaddingLeft(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_LEFT, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPaddingRight(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_RIGHT, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderCollapse(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& ident=
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleTableBorder()->mBorderCollapse,
|
|
|
|
nsCSSProps::kBorderCollapseKTable);
|
|
|
|
val->SetIdent(ident);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderSpacing(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2004-09-10 07:26:58 +04:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
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;
|
|
|
|
}
|
2004-09-10 07:26:58 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
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;
|
2004-09-10 07:26:58 +04:00
|
|
|
}
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsStyleTableBorder *border = GetStyleTableBorder();
|
|
|
|
// border-spacing will always be a coord
|
2007-02-07 10:46:44 +03:00
|
|
|
xSpacing->SetAppUnits(border->mBorderSpacingX.GetCoordValue());
|
|
|
|
ySpacing->SetAppUnits(border->mBorderSpacingY.GetCoordValue());
|
2006-12-30 08:17:59 +03:00
|
|
|
|
2004-09-10 07:26:58 +04:00
|
|
|
return CallQueryInterface(valueList, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetCaptionSide(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& side =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleTableBorder()->mCaptionSide,
|
|
|
|
nsCSSProps::kCaptionSideKTable);
|
|
|
|
val->SetIdent(side);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetEmptyCells(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& emptyCells =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleTableBorder()->mEmptyCells,
|
|
|
|
nsCSSProps::kEmptyCellsKTable);
|
|
|
|
val->SetIdent(emptyCells);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetTableLayout(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleTable *table = GetStyleTable();
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (table->mLayoutStrategy != NS_STYLE_TABLE_LAYOUT_AUTO) {
|
2002-03-16 20:04:35 +03:00
|
|
|
const nsAFlatCString& tableLayout =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(table->mLayoutStrategy,
|
|
|
|
nsCSSProps::kTableLayoutKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(tableLayout);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderStyle(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderTopStyle(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderStyleFor(NS_SIDE_TOP, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderBottomStyle(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderStyleFor(NS_SIDE_BOTTOM, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderLeftStyle(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderStyleFor(NS_SIDE_LEFT, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRightStyle(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderStyleFor(NS_SIDE_RIGHT, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderBottomColors(nsIDOMCSSValue** aValue)
|
2002-07-08 11:11:59 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorsFor(NS_SIDE_BOTTOM, aValue);
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderLeftColors(nsIDOMCSSValue** aValue)
|
2002-07-08 11:11:59 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorsFor(NS_SIDE_LEFT, aValue);
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRightColors(nsIDOMCSSValue** aValue)
|
2002-07-08 11:11:59 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorsFor(NS_SIDE_RIGHT, aValue);
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderTopColors(nsIDOMCSSValue** aValue)
|
2002-07-08 11:11:59 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorsFor(NS_SIDE_TOP, aValue);
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2002-06-21 10:42:21 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRadiusBottomLeft(nsIDOMCSSValue** aValue)
|
2002-06-21 10:42:21 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderRadiusFor(NS_SIDE_LEFT, aValue);
|
2002-06-21 10:42:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRadiusBottomRight(nsIDOMCSSValue** aValue)
|
2002-06-21 10:42:21 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderRadiusFor(NS_SIDE_BOTTOM, aValue);
|
2002-06-21 10:42:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRadiusTopLeft(nsIDOMCSSValue** aValue)
|
2002-06-21 10:42:21 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderRadiusFor(NS_SIDE_TOP, aValue);
|
2002-06-21 10:42:21 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRadiusTopRight(nsIDOMCSSValue** aValue)
|
2002-06-21 10:42:21 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderRadiusFor(NS_SIDE_RIGHT, aValue);
|
2002-06-21 10:42:21 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderWidth(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 20:46:42 +04:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 23:47:06 +03:00
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderTopWidth(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderWidthFor(NS_SIDE_TOP, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderBottomWidth(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderWidthFor(NS_SIDE_BOTTOM, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderLeftWidth(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderWidthFor(NS_SIDE_LEFT, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRightWidth(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderWidthFor(NS_SIDE_RIGHT, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2001-03-30 06:08:48 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderTopColor(nsIDOMCSSValue** aValue)
|
2001-03-30 06:08:48 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorFor(NS_SIDE_TOP, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderBottomColor(nsIDOMCSSValue** aValue)
|
2001-03-30 06:08:48 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorFor(NS_SIDE_BOTTOM, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderLeftColor(nsIDOMCSSValue** aValue)
|
2001-03-30 06:08:48 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorFor(NS_SIDE_LEFT, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRightColor(nsIDOMCSSValue** aValue)
|
2001-03-30 06:08:48 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetBorderColorFor(NS_SIDE_RIGHT, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarginWidth(nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 23:47:06 +03: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 20:46:42 +04:00
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarginTopWidth(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetMarginWidthFor(NS_SIDE_TOP, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarginBottomWidth(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetMarginWidthFor(NS_SIDE_BOTTOM, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarginLeftWidth(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetMarginWidthFor(NS_SIDE_LEFT, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarginRightWidth(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetMarginWidthFor(NS_SIDE_RIGHT, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarkerOffset(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStyleContent()->mMarkerOffset);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutline(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
// return null per spec.
|
|
|
|
aValue = nsnull;
|
|
|
|
|
2001-03-11 23:47:06 +03: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 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineWidth(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleOutline* outline = GetStyleOutline();
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nsStyleCoord coord;
|
|
|
|
PRUint8 outlineStyle = outline->GetOutlineStyle();
|
|
|
|
if (outlineStyle == NS_STYLE_BORDER_STYLE_NONE) {
|
|
|
|
coord.SetCoordValue(0);
|
|
|
|
} else {
|
|
|
|
coord = outline->mOutlineWidth;
|
|
|
|
}
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, coord, nsnull, nsCSSProps::kBorderWidthKTable);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineStyle(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
PRUint8 outlineStyle = GetStyleOutline()->GetOutlineStyle();
|
|
|
|
switch (outlineStyle) {
|
|
|
|
case NS_STYLE_BORDER_STYLE_NONE:
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_BORDER_STYLE_AUTO:
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
const nsAFlatCString& style =
|
|
|
|
nsCSSProps::ValueToKeyword(outlineStyle,
|
|
|
|
nsCSSProps::kOutlineStyleKTable);
|
|
|
|
val->SetIdent(style);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
2004-10-26 16:57:15 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineOffset(nsIDOMCSSValue** aValue)
|
2004-10-26 16:57:15 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStyleOutline()->mOutlineOffset);
|
2004-10-26 16:57:15 +04:00
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2004-10-14 07:32:28 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineRadiusBottomLeft(nsIDOMCSSValue** aValue)
|
2004-10-14 07:32:28 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOutlineRadiusFor(NS_SIDE_LEFT, aValue);
|
2004-10-14 07:32:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineRadiusBottomRight(nsIDOMCSSValue** aValue)
|
2004-10-14 07:32:28 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOutlineRadiusFor(NS_SIDE_BOTTOM, aValue);
|
2004-10-14 07:32:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineRadiusTopLeft(nsIDOMCSSValue** aValue)
|
2004-10-14 07:32:28 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOutlineRadiusFor(NS_SIDE_TOP, aValue);
|
2004-10-14 07:32:28 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineRadiusTopRight(nsIDOMCSSValue** aValue)
|
2004-10-14 07:32:28 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOutlineRadiusFor(NS_SIDE_RIGHT, aValue);
|
2004-10-14 07:32:28 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineColor(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nscolor color;
|
2007-03-15 19:16:20 +03:00
|
|
|
#ifdef GFX_HAS_INVERT
|
2006-12-30 08:17:59 +03:00
|
|
|
GetStyleOutline()->GetOutlineColor(color);
|
2007-03-15 19:16:20 +03:00
|
|
|
#else
|
|
|
|
if (!GetStyleOutline()->GetOutlineColor(color))
|
|
|
|
color = GetStyleColor()->mColor;
|
|
|
|
#endif
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
nsresult rv = SetToRGBAColor(val, color);
|
|
|
|
if (NS_FAILED(rv)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete val;
|
2007-01-25 05:03:02 +03:00
|
|
|
return rv;
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
2004-10-14 07:32:28 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOutlineRadiusFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2004-10-14 07:32:28 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsStyleCoord coord;
|
|
|
|
SetValueToCoord(val, GetStyleOutline()->mOutlineRadius.Get(aSide, coord),
|
2007-02-20 21:43:16 +03:00
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectWidth);
|
2004-10-14 07:32:28 +04:00
|
|
|
|
|
|
|
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 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetZIndex(nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStylePosition()->mZIndex);
|
2001-12-07 00:15:54 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2001-03-08 03:55:01 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetListStyleImage(nsIDOMCSSValue** aValue)
|
2001-03-08 03:55:01 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-12 00:03:08 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleList* list = GetStyleList();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (!list->mListStyleImage) {
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
if (list->mListStyleImage) {
|
|
|
|
list->mListStyleImage->GetURI(getter_AddRefs(uri));
|
2002-01-24 07:22:59 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetURI(uri);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetListStylePosition(nsIDOMCSSValue** aValue)
|
2002-03-13 00:16:22 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& style =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleList()->mListStylePosition,
|
|
|
|
nsCSSProps::kListStylePositionKTable);
|
|
|
|
val->SetIdent(style);
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetListStyleType(nsIDOMCSSValue** aValue)
|
2002-03-13 00:16:22 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleList *list = GetStyleList();
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (list->mListStyleType == NS_STYLE_LIST_STYLE_NONE) {
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
} else {
|
|
|
|
const nsAFlatCString& style =
|
|
|
|
nsCSSProps::ValueToKeyword(list->mListStyleType,
|
|
|
|
nsCSSProps::kListStyleKTable);
|
|
|
|
val->SetIdent(style);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-08 03:55:01 +03:00
|
|
|
}
|
|
|
|
|
2004-01-15 05:25:08 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetImageRegion(nsIDOMCSSValue** aValue)
|
2004-01-15 05:25:08 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleList* list = GetStyleList();
|
2004-01-15 05:25:08 +03:00
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsROCSSPrimitiveValue *topVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *rightVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *bottomVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *leftVal = nsnull;
|
2006-12-30 08:17:59 +03:00
|
|
|
if (list->mImageRegion.width <= 0 || list->mImageRegion.height <= 0) {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} 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) {
|
2007-02-07 10:46:44 +03:00
|
|
|
topVal->SetAppUnits(list->mImageRegion.y);
|
|
|
|
rightVal->SetAppUnits(list->mImageRegion.width + list->mImageRegion.x);
|
|
|
|
bottomVal->SetAppUnits(list->mImageRegion.height + list->mImageRegion.y);
|
|
|
|
leftVal->SetAppUnits(list->mImageRegion.x);
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetRect(domRect);
|
2004-01-15 05:25:08 +03:00
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
2004-01-15 05:25:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete topVal;
|
|
|
|
delete rightVal;
|
|
|
|
delete bottomVal;
|
|
|
|
delete leftVal;
|
|
|
|
delete val;
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetLineHeight(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
nscoord lineHeight;
|
2007-05-05 09:30:10 +04:00
|
|
|
GetLineHeightCoord(lineHeight);
|
|
|
|
val->SetAppUnits(lineHeight);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetVerticalAlign(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStyleTextReset()->mVerticalAlign,
|
|
|
|
&nsComputedDOMStyle::GetLineHeightCoord,
|
|
|
|
nsCSSProps::kVerticalAlignKTable);
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2001-05-04 15:30:34 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetTextAlign(nsIDOMCSSValue** aValue)
|
2001-05-04 15:30:34 +04:00
|
|
|
{
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-05-04 15:30:34 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& align=
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleText()->mTextAlign,
|
|
|
|
nsCSSProps::kTextAlignKTable);
|
|
|
|
val->SetIdent(align);
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-05-09 07:29:09 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetTextDecoration(nsIDOMCSSValue** aValue)
|
2001-05-09 07:29:09 +04:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-05-09 07:29:09 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleTextReset* text = GetStyleTextReset();
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (NS_STYLE_TEXT_DECORATION_NONE == text->mTextDecoration) {
|
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(decoration);
|
|
|
|
} else {
|
|
|
|
nsAutoString decorationString;
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_UNDERLINE) {
|
2001-12-20 14:15:32 +03:00
|
|
|
const nsAFlatCString& decoration=
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_OVERLINE) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
2001-12-20 14:15:32 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_OVERLINE,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_LINE_THROUGH) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
2001-12-20 14:15:32 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
|
|
|
}
|
|
|
|
if (text->mTextDecoration & NS_STYLE_TEXT_DECORATION_BLINK) {
|
|
|
|
if (!decorationString.IsEmpty()) {
|
|
|
|
decorationString.Append(PRUnichar(' '));
|
2001-12-20 14:15:32 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& decoration=
|
|
|
|
nsCSSProps::ValueToKeyword(NS_STYLE_TEXT_DECORATION_BLINK,
|
|
|
|
nsCSSProps::kTextDecorationKTable);
|
|
|
|
decorationString.AppendWithConversion(decoration.get());
|
2001-12-20 14:15:32 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetString(decorationString);
|
2001-05-09 07:29:09 +04:00
|
|
|
}
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-05-04 15:30:34 +04:00
|
|
|
}
|
|
|
|
|
2002-03-03 22:44:41 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetTextIndent(nsIDOMCSSValue** aValue)
|
2002-03-03 22:44:41 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 22:44:41 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStyleText()->mTextIndent,
|
|
|
|
&nsComputedDOMStyle::GetCBContentWidth);
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetTextTransform(nsIDOMCSSValue** aValue)
|
2002-03-03 22:44:41 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 22:44:41 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleText *text = GetStyleText();
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (text->mTextTransform != NS_STYLE_TEXT_TRANSFORM_NONE) {
|
2002-03-03 22:44:41 +03:00
|
|
|
const nsAFlatCString& textTransform =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(text->mTextTransform,
|
|
|
|
nsCSSProps::kTextTransformKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(textTransform);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetLetterSpacing(nsIDOMCSSValue** aValue)
|
2002-03-03 22:44:41 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 22:44:41 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStyleText()->mLetterSpacing);
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetWordSpacing(nsIDOMCSSValue** aValue)
|
2002-03-03 22:44:41 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 22:44:41 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStyleText()->mWordSpacing);
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetWhiteSpace(nsIDOMCSSValue** aValue)
|
2002-03-03 22:44:41 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2002-03-03 22:44:41 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleText *text = GetStyleText();
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (text->mWhiteSpace != NS_STYLE_WHITESPACE_NORMAL) {
|
2002-03-03 22:44:41 +03:00
|
|
|
const nsAFlatCString& whiteSpace =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(text->mWhiteSpace,
|
|
|
|
nsCSSProps::kWhitespaceKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(whiteSpace);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::normal);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
2001-08-07 23:05:21 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetVisibility(nsIDOMCSSValue** aValue)
|
2001-08-07 23:05:21 +04:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-08-07 23:05:21 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& value=
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleVisibility()->mVisible,
|
|
|
|
nsCSSProps::kVisibilityKTable);
|
|
|
|
val->SetIdent(value);
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetDirection(nsIDOMCSSValue** aValue)
|
2002-03-13 00:16:22 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString & direction =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleVisibility()->mDirection,
|
|
|
|
nsCSSProps::kDirectionKTable);
|
|
|
|
val->SetIdent(direction);
|
2004-01-18 05:42:27 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetUnicodeBidi(nsIDOMCSSValue** aValue)
|
2002-03-13 00:16:22 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleTextReset *text = GetStyleTextReset();
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (text->mUnicodeBidi != NS_STYLE_UNICODE_BIDI_NORMAL) {
|
2002-03-13 00:16:22 +03:00
|
|
|
const nsAFlatCString& bidi =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(text->mUnicodeBidi,
|
|
|
|
nsCSSProps::kUnicodeBidiKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(bidi);
|
2002-03-13 00:16:22 +03:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::normal);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetCursor(nsIDOMCSSValue** aValue)
|
2002-03-13 00:16:22 +03:00
|
|
|
{
|
2005-03-20 16:35:31 +03:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleUserInterface *ui = GetStyleUserInterface();
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2006-12-30 08:17:59 +03: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;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
item->mImage->GetURI(getter_AddRefs(uri));
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !itemList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
val->SetURI(uri);
|
|
|
|
|
|
|
|
if (item->mHaveHotspot) {
|
|
|
|
nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue();
|
|
|
|
if (!valX || !itemList->AppendCSSValue(valX)) {
|
|
|
|
delete valX;
|
2005-07-01 08:29:42 +04:00
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue();
|
|
|
|
if (!valY || !itemList->AppendCSSValue(valY)) {
|
|
|
|
delete valY;
|
2005-03-20 16:35:31 +03:00
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2005-07-01 08:29:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
valX->SetNumber(item->mHotspotX);
|
|
|
|
valY->SetNumber(item->mHotspotY);
|
2004-12-31 00:56:11 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2004-12-31 00:56:11 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val) {
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2005-03-20 16:35:31 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (ui->mCursor == NS_STYLE_CURSOR_AUTO) {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} 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-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
2005-03-20 16:35:31 +03:00
|
|
|
return CallQueryInterface(valueList, aValue);
|
2001-08-07 23:05:21 +04:00
|
|
|
}
|
|
|
|
|
2002-04-20 18:30:57 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetAppearance(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& appearanceIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleDisplay()->mAppearance,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kAppearanceKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(appearanceIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxAlign(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& boxAlignIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleXUL()->mBoxAlign,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBoxAlignKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(boxAlignIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxDirection(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& boxDirectionIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleXUL()->mBoxDirection,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBoxDirectionKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(boxDirectionIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxFlex(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetNumber(GetStyleXUL()->mBoxFlex);
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxOrdinalGroup(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetNumber(GetStyleXUL()->mBoxOrdinal);
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxOrient(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& boxOrientIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleXUL()->mBoxOrient,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBoxOrientKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(boxOrientIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxPack(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& boxPackIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleXUL()->mBoxPack,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBoxPackKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(boxPackIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBoxSizing(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& boxSizingIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStylePosition()->mBoxSizing,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kBoxSizingKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(boxSizingIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetFloatEdge(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& floatEdgeIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleBorder()->mFloatEdge,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kFloatEdgeKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(floatEdgeIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetForceBrokenImageIcon(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleUIReset()->mForceBrokenImageIcon);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2007-05-16 19:51:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetIMEMode(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleUIReset *uiData = GetStyleUIReset();
|
|
|
|
|
|
|
|
nsCSSKeyword keyword;
|
|
|
|
if (uiData->mIMEMode == NS_STYLE_IME_MODE_AUTO) {
|
|
|
|
keyword = eCSSKeyword_auto;
|
|
|
|
} else if (uiData->mIMEMode == NS_STYLE_IME_MODE_NORMAL) {
|
|
|
|
keyword = eCSSKeyword_normal;
|
|
|
|
} else {
|
|
|
|
keyword = nsCSSProps::ValueToKeywordEnum(uiData->mIMEMode,
|
|
|
|
nsCSSProps::kIMEModeKTable);
|
|
|
|
}
|
|
|
|
val->SetIdent(nsCSSKeywords::GetStringValue(keyword));
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
2002-04-20 18:30:57 +04:00
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetUserFocus(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleUserInterface *uiData = GetStyleUserInterface();
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (uiData->mUserFocus != NS_STYLE_USER_FOCUS_NONE) {
|
2002-04-20 18:30:57 +04:00
|
|
|
if (uiData->mUserFocus == NS_STYLE_USER_FOCUS_NORMAL) {
|
|
|
|
const nsAFlatCString& userFocusIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_normal);
|
|
|
|
val->SetIdent(userFocusIdent);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-04-20 18:30:57 +04:00
|
|
|
const nsAFlatCString& userFocusIdent =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(uiData->mUserFocus,
|
|
|
|
nsCSSProps::kUserFocusKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(userFocusIdent);
|
|
|
|
}
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-04-20 18:30:57 +04:00
|
|
|
const nsAFlatCString& userFocusIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(userFocusIdent);
|
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetUserInput(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleUserInterface *uiData = GetStyleUserInterface();
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (uiData->mUserInput != NS_STYLE_USER_INPUT_AUTO) {
|
2002-04-20 18:30:57 +04:00
|
|
|
if (uiData->mUserInput == NS_STYLE_USER_INPUT_NONE) {
|
|
|
|
const nsAFlatCString& userInputIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(userInputIdent);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-04-20 18:30:57 +04:00
|
|
|
const nsAFlatCString& userInputIdent =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(uiData->mUserInput,
|
|
|
|
nsCSSProps::kUserInputKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(userInputIdent);
|
|
|
|
}
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-04-20 18:30:57 +04:00
|
|
|
const nsAFlatCString& userInputIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_auto);
|
|
|
|
val->SetIdent(userInputIdent);
|
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetUserModify(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& userModifyIdent =
|
2006-12-30 08:17:59 +03:00
|
|
|
nsCSSProps::ValueToKeyword(GetStyleUserInterface()->mUserModify,
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::kUserModifyKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(userModifyIdent);
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetUserSelect(nsIDOMCSSValue** aValue)
|
2002-04-20 18:30:57 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleUIReset *uiData = GetStyleUIReset();
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (uiData->mUserSelect != NS_STYLE_USER_SELECT_AUTO) {
|
2002-04-20 18:30:57 +04:00
|
|
|
if (uiData->mUserSelect == NS_STYLE_USER_SELECT_NONE) {
|
|
|
|
const nsAFlatCString& userSelectIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_none);
|
|
|
|
val->SetIdent(userSelectIdent);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-04-20 18:30:57 +04:00
|
|
|
const nsAFlatCString& userSelectIdent =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(uiData->mUserSelect,
|
|
|
|
nsCSSProps::kUserSelectKTable);
|
2002-04-20 18:30:57 +04:00
|
|
|
val->SetIdent(userSelectIdent);
|
|
|
|
}
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2002-04-20 18:30:57 +04:00
|
|
|
const nsAFlatCString& userSelectIdent =
|
|
|
|
nsCSSKeywords::GetStringValue(eCSSKeyword_auto);
|
|
|
|
val->SetIdent(userSelectIdent);
|
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetDisplay(nsIDOMCSSValue** aValue)
|
2000-05-15 05:59:05 +04:00
|
|
|
{
|
2001-03-11 23:47:06 +03:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2000-05-15 05:59:05 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay *displayData = GetStyleDisplay();
|
2000-05-17 10:26:23 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (displayData->mDisplay == NS_STYLE_DISPLAY_NONE) {
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
} else {
|
|
|
|
const nsAFlatCString& display =
|
|
|
|
nsCSSProps::ValueToKeyword(displayData->mDisplay,
|
|
|
|
nsCSSProps::kDisplayKTable);
|
|
|
|
val->SetIdent(display);
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPosition(nsIDOMCSSValue** aValue)
|
2002-01-11 03:15:55 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
const nsAFlatCString& position =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleDisplay()->mPosition,
|
|
|
|
nsCSSProps::kPositionKTable);
|
|
|
|
val->SetIdent(position);
|
2004-01-18 05:42:27 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-01-11 03:15:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetClip(nsIDOMCSSValue** aValue)
|
2002-01-11 03:15:55 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2002-01-11 03:15:55 +03:00
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsROCSSPrimitiveValue *topVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *rightVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *bottomVal = nsnull;
|
|
|
|
nsROCSSPrimitiveValue *leftVal = nsnull;
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mClipFlags == NS_STYLE_CLIP_AUTO ||
|
|
|
|
display->mClipFlags == (NS_STYLE_CLIP_TOP_AUTO |
|
|
|
|
NS_STYLE_CLIP_RIGHT_AUTO |
|
|
|
|
NS_STYLE_CLIP_BOTTOM_AUTO |
|
|
|
|
NS_STYLE_CLIP_LEFT_AUTO)) {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} else {
|
|
|
|
// create the cssvalues for the sides, stick them in the rect object
|
|
|
|
topVal = GetROCSSPrimitiveValue();
|
|
|
|
rightVal = GetROCSSPrimitiveValue();
|
|
|
|
bottomVal = GetROCSSPrimitiveValue();
|
|
|
|
leftVal = GetROCSSPrimitiveValue();
|
|
|
|
if (topVal && rightVal && bottomVal && leftVal) {
|
|
|
|
nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal,
|
|
|
|
bottomVal, leftVal);
|
|
|
|
if (domRect) {
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) {
|
|
|
|
topVal->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} else {
|
2007-02-07 10:46:44 +03:00
|
|
|
topVal->SetAppUnits(display->mClip.y);
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2002-01-11 03:15:55 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) {
|
|
|
|
rightVal->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} else {
|
2007-02-07 10:46:44 +03:00
|
|
|
rightVal->SetAppUnits(display->mClip.width + display->mClip.x);
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2002-01-11 03:15:55 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) {
|
|
|
|
bottomVal->SetIdent(nsGkAtoms::_auto);
|
|
|
|
} else {
|
2007-02-07 10:46:44 +03:00
|
|
|
bottomVal->SetAppUnits(display->mClip.height + display->mClip.y);
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) {
|
|
|
|
leftVal->SetIdent(nsGkAtoms::_auto);
|
2002-01-11 03:15:55 +03:00
|
|
|
} else {
|
2007-02-07 10:46:44 +03:00
|
|
|
leftVal->SetAppUnits(display->mClip.x);
|
2002-01-11 03:15:55 +03:00
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
|
|
|
|
val->SetRect(domRect);
|
2002-01-11 03:15:55 +03:00
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
2002-01-11 03:15:55 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete topVal;
|
|
|
|
delete rightVal;
|
|
|
|
delete bottomVal;
|
|
|
|
delete leftVal;
|
|
|
|
delete val;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2002-01-11 03:15:55 +03:00
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-01-11 03:15:55 +03:00
|
|
|
}
|
|
|
|
|
2002-02-16 16:16:10 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOverflow(nsIDOMCSSValue** aValue)
|
2002-02-16 16:16:10 +03:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2002-02-16 16:16:10 +03:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mOverflowX != display->mOverflowY) {
|
2006-12-13 00:16:23 +03:00
|
|
|
// No value to return. We can't express this combination of
|
|
|
|
// values as a shorthand.
|
|
|
|
*aValue = nsnull;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
if (display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) {
|
|
|
|
const nsAFlatCString& overflow =
|
|
|
|
nsCSSProps::ValueToKeyword(display->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowKTable);
|
|
|
|
val->SetIdent(overflow);
|
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
2006-12-13 00:16:23 +03:00
|
|
|
}
|
2004-09-05 04:04:04 +04:00
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOverflowX(nsIDOMCSSValue** aValue)
|
2004-09-05 04:04:04 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2004-09-05 04:04:04 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mOverflowX != NS_STYLE_OVERFLOW_AUTO) {
|
2004-09-05 04:04:04 +04:00
|
|
|
const nsAFlatCString& overflow =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(display->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowSubKTable);
|
2004-09-05 04:04:04 +04:00
|
|
|
val->SetIdent(overflow);
|
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
2004-09-05 04:04:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOverflowY(nsIDOMCSSValue** aValue)
|
2004-09-05 04:04:04 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2004-09-05 04:04:04 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mOverflowY != NS_STYLE_OVERFLOW_AUTO) {
|
2002-02-16 16:16:10 +03:00
|
|
|
const nsAFlatCString& overflow =
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(display->mOverflowY,
|
|
|
|
nsCSSProps::kOverflowSubKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(overflow);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
2002-02-16 16:16:10 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-16 16:16:10 +03:00
|
|
|
}
|
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPageBreakAfter(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay *display = GetStyleDisplay();
|
|
|
|
|
|
|
|
if (display->mBreakAfter) {
|
|
|
|
val->SetIdent(nsGkAtoms::always);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPageBreakBefore(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay *display = GetStyleDisplay();
|
|
|
|
|
|
|
|
if (display->mBreakBefore) {
|
|
|
|
val->SetIdent(nsGkAtoms::always);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-09-26 07:46:50 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetHeight(nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2002-09-26 07:46:50 +04:00
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2002-09-26 07:46:50 +04:00
|
|
|
PRBool calcHeight = PR_FALSE;
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
if (mFrame) {
|
2002-09-26 07:46:50 +04:00
|
|
|
calcHeight = PR_TRUE;
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* displayData = GetStyleDisplay();
|
2006-12-30 08:17:59 +03:00
|
|
|
if (displayData->mDisplay == NS_STYLE_DISPLAY_INLINE &&
|
2007-03-23 02:01:14 +03:00
|
|
|
!(mFrame->IsFrameOfType(nsIFrame::eReplaced))) {
|
2003-08-06 07:07:12 +04:00
|
|
|
calcHeight = PR_FALSE;
|
2002-09-26 07:46:50 +04:00
|
|
|
}
|
|
|
|
}
|
2001-12-07 00:15:54 +03:00
|
|
|
|
|
|
|
if (calcHeight) {
|
2007-02-20 21:43:16 +03:00
|
|
|
FlushPendingReflows();
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
val->SetAppUnits(mFrame->GetContentRect().height);
|
2001-11-10 20:29:04 +03:00
|
|
|
} else {
|
2007-04-23 11:04:33 +04:00
|
|
|
const nsStylePosition *positionData = GetStylePosition();
|
|
|
|
|
|
|
|
nscoord minHeight =
|
|
|
|
StyleCoordToNSCoord(positionData->mMinHeight,
|
|
|
|
&nsComputedDOMStyle::GetCBContentHeight, 0);
|
|
|
|
|
|
|
|
nscoord maxHeight =
|
|
|
|
StyleCoordToNSCoord(positionData->mMaxHeight,
|
|
|
|
&nsComputedDOMStyle::GetCBContentHeight,
|
|
|
|
nscoord_MAX);
|
|
|
|
|
|
|
|
SetValueToCoord(val, positionData->mHeight, nsnull, nsnull,
|
|
|
|
minHeight, maxHeight);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetWidth(nsIDOMCSSValue** aValue)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
PRBool calcWidth = PR_FALSE;
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
if (mFrame) {
|
2002-03-16 20:04:35 +03:00
|
|
|
calcWidth = PR_TRUE;
|
2002-10-16 07:38:52 +04:00
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay *displayData = GetStyleDisplay();
|
2006-12-30 08:17:59 +03:00
|
|
|
if (displayData->mDisplay == NS_STYLE_DISPLAY_INLINE &&
|
2007-03-23 02:01:14 +03:00
|
|
|
!(mFrame->IsFrameOfType(nsIFrame::eReplaced))) {
|
2003-08-06 07:07:12 +04:00
|
|
|
calcWidth = PR_FALSE;
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (calcWidth) {
|
2007-02-20 21:43:16 +03:00
|
|
|
FlushPendingReflows();
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
val->SetAppUnits(mFrame->GetContentRect().width);
|
2002-03-16 20:04:35 +03:00
|
|
|
} else {
|
2007-04-23 11:04:33 +04:00
|
|
|
const nsStylePosition *positionData = GetStylePosition();
|
|
|
|
|
|
|
|
nscoord minWidth =
|
|
|
|
StyleCoordToNSCoord(positionData->mMinWidth,
|
|
|
|
&nsComputedDOMStyle::GetCBContentWidth, 0);
|
|
|
|
|
|
|
|
nscoord maxWidth =
|
|
|
|
StyleCoordToNSCoord(positionData->mMaxWidth,
|
|
|
|
&nsComputedDOMStyle::GetCBContentWidth,
|
|
|
|
nscoord_MAX);
|
|
|
|
|
2007-05-04 03:11:00 +04:00
|
|
|
SetValueToCoord(val, positionData->mWidth, nsnull,
|
|
|
|
nsCSSProps::kWidthKTable, minWidth, maxWidth);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-02-19 01:54:15 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMaxHeight(nsIDOMCSSValue** aValue)
|
2002-02-19 01:54:15 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-04-23 11:04:33 +04:00
|
|
|
SetValueToCoord(val, GetStylePosition()->mMaxHeight,
|
|
|
|
&nsComputedDOMStyle::GetCBContentHeight);
|
2002-02-19 01:54:15 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-19 01:54:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMaxWidth(nsIDOMCSSValue** aValue)
|
2002-02-19 01:54:15 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-04-23 11:04:33 +04:00
|
|
|
SetValueToCoord(val, GetStylePosition()->mMaxWidth,
|
2007-05-04 03:11:00 +04:00
|
|
|
&nsComputedDOMStyle::GetCBContentWidth,
|
|
|
|
nsCSSProps::kWidthKTable);
|
2002-02-19 01:54:15 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-19 01:54:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMinHeight(nsIDOMCSSValue** aValue)
|
2002-02-19 01:54:15 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStylePosition()->mMinHeight,
|
|
|
|
&nsComputedDOMStyle::GetCBContentHeight);
|
2002-02-19 01:54:15 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-19 01:54:15 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMinWidth(nsIDOMCSSValue** aValue)
|
2002-02-19 01:54:15 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
SetValueToCoord(val, GetStylePosition()->mMinWidth,
|
2007-05-04 03:11:00 +04:00
|
|
|
&nsComputedDOMStyle::GetCBContentWidth,
|
|
|
|
nsCSSProps::kWidthKTable);
|
2002-02-19 01:54:15 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-02-19 01:54:15 +03:00
|
|
|
}
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetLeft(nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_LEFT, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetRight(nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_RIGHT, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2000-05-17 08:57:50 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetTop(nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_TOP, aValue);
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2001-03-03 03:44:19 +03:00
|
|
|
nsROCSSPrimitiveValue*
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsComputedDOMStyle::GetROCSSPrimitiveValue()
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2007-02-07 10:46:44 +03:00
|
|
|
nsROCSSPrimitiveValue *primitiveValue = new nsROCSSPrimitiveValue(mAppUnitsPerInch);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-09-07 05:48:39 +04:00
|
|
|
NS_ASSERTION(primitiveValue != 0, "ran out of memory");
|
2001-03-03 03:44:19 +03:00
|
|
|
|
|
|
|
return primitiveValue;
|
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04: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 05:59:05 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetOffsetWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2000-05-17 10:26:23 +04:00
|
|
|
|
2002-10-16 07:38:52 +04:00
|
|
|
FlushPendingReflows();
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nsresult rv = NS_OK;
|
2006-12-30 08:17:59 +03:00
|
|
|
switch (display->mPosition) {
|
|
|
|
case NS_STYLE_POSITION_STATIC:
|
|
|
|
rv = GetStaticOffset(aSide, aValue);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_RELATIVE:
|
|
|
|
rv = GetRelativeOffset(aSide, aValue);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_POSITION_ABSOLUTE:
|
|
|
|
case NS_STYLE_POSITION_FIXED:
|
|
|
|
rv = GetAbsoluteOffset(aSide, aValue);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_ERROR("Invalid position");
|
|
|
|
break;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-11-10 20:29:04 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsIFrame* container = GetContainingBlockFor(mFrame);
|
2001-11-10 20:29:04 +03:00
|
|
|
if (container) {
|
2007-03-23 02:01:14 +03:00
|
|
|
nsMargin margin = mFrame->GetUsedMargin();
|
2006-12-16 02:39:43 +03:00
|
|
|
nsMargin border = container->GetUsedBorder();
|
2004-01-09 22:21:20 +03:00
|
|
|
nsMargin scrollbarSizes(0, 0, 0, 0);
|
2007-03-23 02:01:14 +03:00
|
|
|
nsRect rect = mFrame->GetRect();
|
2003-08-06 07:07:12 +04:00
|
|
|
nsRect containerRect = container->GetRect();
|
2001-11-10 20:29:04 +03:00
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
if (container->GetType() == nsGkAtoms::viewportFrame) {
|
2001-11-10 20:29:04 +03: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 17:20:53 +03:00
|
|
|
nsIFrame* scrollingChild = container->GetFirstChild(nsnull);
|
2002-09-07 05:48:39 +04:00
|
|
|
nsCOMPtr<nsIScrollableFrame> scrollFrame =
|
|
|
|
do_QueryInterface(scrollingChild);
|
2001-11-10 20:29:04 +03:00
|
|
|
if (scrollFrame) {
|
2004-01-09 22:21:20 +03:00
|
|
|
scrollbarSizes = scrollFrame->GetActualScrollbarSizes();
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nscoord offset = 0;
|
|
|
|
switch (aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
2006-12-16 02:39:43 +03:00
|
|
|
offset = rect.y - margin.top - border.top - scrollbarSizes.top;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
offset = containerRect.width - rect.width -
|
2006-12-16 02:39:43 +03:00
|
|
|
rect.x - margin.right - border.right - scrollbarSizes.right;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
offset = containerRect.height - rect.height -
|
2006-12-16 02:39:43 +03:00
|
|
|
rect.y - margin.bottom - border.bottom - scrollbarSizes.bottom;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT:
|
2006-12-16 02:39:43 +03:00
|
|
|
offset = rect.x - margin.left - border.left - scrollbarSizes.left;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
break;
|
|
|
|
default:
|
2005-03-27 15:36:08 +04:00
|
|
|
NS_ERROR("Invalid side");
|
2001-11-10 20:29:04 +03:00
|
|
|
break;
|
|
|
|
}
|
2007-02-07 10:46:44 +03:00
|
|
|
val->SetAppUnits(offset);
|
2001-11-10 20:29:04 +03:00
|
|
|
} else {
|
|
|
|
// XXX no frame. This property makes no sense
|
2007-02-07 10:46:44 +03:00
|
|
|
val->SetAppUnits(0);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2004-11-30 08:31:37 +03: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 20:29:04 +03:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-11-10 20:29:04 +03:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStylePosition* positionData = GetStylePosition();
|
2007-03-23 02:01:14 +03:00
|
|
|
nsStyleCoord coord;
|
2006-12-30 08:17:59 +03:00
|
|
|
PRInt32 sign = 1;
|
2007-03-23 02:01:14 +03:00
|
|
|
positionData->mOffset.Get(aSide, coord);
|
|
|
|
if (coord.GetUnit() != eStyleUnit_Coord &&
|
|
|
|
coord.GetUnit() != eStyleUnit_Percent) {
|
|
|
|
positionData->mOffset.Get(NS_OPPOSITE_SIDE(aSide), coord);
|
2006-12-30 08:17:59 +03:00
|
|
|
sign = -1;
|
|
|
|
}
|
2007-03-23 02:01:14 +03:00
|
|
|
nsIFrame* container = nsnull;
|
|
|
|
switch(coord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
val->SetAppUnits(sign * coord.GetCoordValue());
|
|
|
|
break;
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
container = GetContainingBlockFor(mFrame);
|
|
|
|
if (container) {
|
|
|
|
nsSize size = container->GetContentRect().Size();
|
|
|
|
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
|
|
|
val->SetAppUnits(sign * coord.GetPercentValue() * size.width);
|
|
|
|
} else {
|
|
|
|
val->SetAppUnits(sign * coord.GetPercentValue() * size.height);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
// XXX no containing block.
|
|
|
|
val->SetAppUnits(0);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_ERROR("Unexpected left/right/top/bottom unit");
|
2007-05-02 06:25:50 +04:00
|
|
|
// Fall through
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
// In this case, both this side and the opposite side are auto.
|
|
|
|
// The computed offset is 0.
|
2007-03-23 02:01:14 +03:00
|
|
|
val->SetAppUnits(0);
|
|
|
|
break;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetStaticOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-11-10 20:29:04 +03:00
|
|
|
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsStyleCoord coord;
|
|
|
|
SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide, coord));
|
2001-11-10 20:29:04 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2002-10-16 07:38:52 +04:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::FlushPendingReflows()
|
|
|
|
{
|
|
|
|
// Flush all pending notifications so that our frames are up to date
|
2005-06-03 05:51:15 +04:00
|
|
|
nsCOMPtr<nsIDocument> document = mContent->GetDocument();
|
2002-10-16 07:38:52 +04:00
|
|
|
if (document) {
|
2004-05-28 02:08:42 +04:00
|
|
|
document->FlushPendingNotifications(Flush_Layout);
|
2002-10-16 07:38:52 +04:00
|
|
|
}
|
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetPaddingWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2002-10-16 07:38:52 +04:00
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
if (!mFrame) {
|
|
|
|
nsStyleCoord c;
|
|
|
|
SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide, c));
|
2006-12-16 02:39:43 +03:00
|
|
|
} else {
|
2007-02-20 21:43:16 +03:00
|
|
|
FlushPendingReflows();
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
val->SetAppUnits(mFrame->GetUsedPadding().side(aSide));
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2006-12-16 02:39:43 +03:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
2007-05-05 09:30:10 +04:00
|
|
|
aCoord = nsHTMLReflowState::CalcLineHeight(mStyleContextHolder,
|
|
|
|
mPresShell->GetPresContext()->
|
|
|
|
DeviceContext());
|
|
|
|
// CalcLineHeight uses font->mFont.size, but we want to use
|
|
|
|
// font->mSize as the font size. Adjust for that. Also adjust for
|
|
|
|
// the text zoom, if any.
|
|
|
|
const nsStyleFont* font = GetStyleFont();
|
|
|
|
aCoord = NSToCoordRound((float(aCoord) *
|
|
|
|
(float(font->mSize) / float(font->mFont.size))) /
|
|
|
|
mPresShell->GetPresContext()->TextZoom());
|
|
|
|
|
|
|
|
return PR_TRUE;
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderColorsFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2002-07-08 11:11:59 +04:00
|
|
|
{
|
2006-12-22 09:10:32 +03:00
|
|
|
const nsStyleBorder *border = GetStyleBorder();
|
2002-07-08 11:11:59 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (border->mBorderColors) {
|
2004-11-30 08:31:37 +03:00
|
|
|
nsBorderColors* borderColors = border->mBorderColors[aSide];
|
2002-07-08 11:11:59 +04: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 05:48:39 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2003-01-10 22:49:24 +03:00
|
|
|
if (borderColors->mTransparent) {
|
2006-12-26 20:47:52 +03:00
|
|
|
primitive->SetIdent(nsGkAtoms::transparent);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2007-01-25 05:03:02 +03:00
|
|
|
nsresult rv = SetToRGBAColor(primitive, borderColors->mColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
2003-01-10 22:49:24 +03:00
|
|
|
delete valueList;
|
|
|
|
delete primitive;
|
2007-01-25 05:03:02 +03:00
|
|
|
return rv;
|
2003-01-10 22:49:24 +03:00
|
|
|
}
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
|
|
|
|
2003-01-11 13:28:37 +03:00
|
|
|
PRBool success = valueList->AppendCSSValue(primitive);
|
|
|
|
if (!success) {
|
2002-07-08 11:11:59 +04:00
|
|
|
delete valueList;
|
|
|
|
delete primitive;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2002-07-08 11:11:59 +04: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);
|
|
|
|
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2002-07-08 11:11:59 +04:00
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
2002-06-21 10:42:21 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderRadiusFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2002-06-21 10:42:21 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsStyleCoord coord;
|
|
|
|
SetValueToCoord(val, GetStyleBorder()->mBorderRadius.Get(aSide, coord),
|
2007-02-20 21:43:16 +03:00
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectWidth);
|
2002-06-21 10:42:21 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2002-06-21 10:42:21 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2007-01-28 20:20:01 +03:00
|
|
|
nscoord width;
|
2007-03-23 02:01:14 +03:00
|
|
|
const nsStyleDisplay *disp = GetStyleDisplay();
|
|
|
|
if (mFrame && mFrame->IsThemed(disp)) {
|
|
|
|
nsMargin result;
|
2007-03-31 01:11:41 +04:00
|
|
|
nsPresContext *presContext = mFrame->PresContext();
|
2007-03-23 02:01:14 +03:00
|
|
|
presContext->GetTheme()->GetWidgetBorder(presContext->DeviceContext(),
|
|
|
|
mFrame, disp->mAppearance,
|
|
|
|
&result);
|
|
|
|
width = presContext->DevPixelsToAppUnits(result.side(aSide));
|
2007-01-28 20:20:01 +03:00
|
|
|
} else {
|
2007-03-23 02:01:14 +03:00
|
|
|
width = GetStyleBorder()->GetComputedBorderWidth(aSide);
|
2007-01-28 20:20:01 +03:00
|
|
|
}
|
2007-02-07 10:46:44 +03:00
|
|
|
val->SetAppUnits(width);
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderColorFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-03-30 06:08:48 +04:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-30 06:08:48 +04:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
nscolor color;
|
|
|
|
PRBool transparent;
|
|
|
|
PRBool foreground;
|
|
|
|
GetStyleBorder()->GetBorderColor(aSide, color, transparent, foreground);
|
|
|
|
if (transparent) {
|
|
|
|
val->SetIdent(nsGkAtoms::transparent);
|
|
|
|
} else {
|
|
|
|
if (foreground) {
|
|
|
|
const nsStyleColor* colorStruct = GetStyleColor();
|
|
|
|
color = colorStruct->mColor;
|
|
|
|
}
|
2007-01-25 05:03:02 +03:00
|
|
|
// XXX else?
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2007-01-25 05:03:02 +03:00
|
|
|
nsresult rv = SetToRGBAColor(val, color);
|
|
|
|
if (NS_FAILED(rv)) {
|
2006-12-30 08:17:59 +03:00
|
|
|
delete val;
|
2007-01-25 05:03:02 +03:00
|
|
|
return rv;
|
2003-01-10 18:55:27 +03:00
|
|
|
}
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-12 00:03:08 +03:00
|
|
|
}
|
2001-03-11 23:47:06 +03:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetMarginWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-03-11 23:47:06 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
if (!mFrame) {
|
|
|
|
nsStyleCoord c;
|
|
|
|
SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide, c));
|
2006-12-16 02:39:43 +03:00
|
|
|
} else {
|
2007-02-20 21:43:16 +03:00
|
|
|
FlushPendingReflows();
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
val->SetAppUnits(mFrame->GetUsedMargin().side(aSide));
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-16 02:39:43 +03:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
nsresult
|
2006-12-22 09:10:32 +03:00
|
|
|
nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
|
2001-03-03 03:44:19 +03:00
|
|
|
{
|
2002-09-07 05:48:39 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2001-03-11 23:47:06 +03:00
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
PRUint8 borderStyle = GetStyleBorder()->GetBorderStyle(aSide);
|
2002-01-25 00:19:21 +03:00
|
|
|
|
|
|
|
if (borderStyle != NS_STYLE_BORDER_STYLE_NONE) {
|
2001-11-28 00:13:53 +03:00
|
|
|
const nsAFlatCString& style=
|
2004-10-01 21:15:15 +04:00
|
|
|
nsCSSProps::ValueToKeyword(borderStyle,
|
|
|
|
nsCSSProps::kBorderStyleKTable);
|
2002-03-22 23:18:42 +03:00
|
|
|
val->SetIdent(style);
|
2002-09-07 05:48:39 +04:00
|
|
|
} else {
|
2006-12-26 20:47:52 +03:00
|
|
|
val->SetIdent(nsGkAtoms::none);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
return CallQueryInterface(val, aValue);
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
2002-10-08 05:53:31 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
|
2007-04-23 11:04:33 +04:00
|
|
|
const nsStyleCoord& aCoord,
|
2007-02-20 21:43:16 +03:00
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
|
|
|
const PRInt32 aTable[],
|
2007-04-23 11:04:33 +04:00
|
|
|
nscoord aMinAppUnits,
|
|
|
|
nscoord aMaxAppUnits)
|
2007-02-20 21:43:16 +03:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aValue, "Must have a value to work with");
|
|
|
|
|
|
|
|
switch (aCoord.GetUnit()) {
|
|
|
|
case eStyleUnit_Normal:
|
|
|
|
aValue->SetIdent(nsGkAtoms::normal);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Auto:
|
|
|
|
aValue->SetIdent(nsGkAtoms::_auto);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
{
|
|
|
|
nscoord percentageBase;
|
|
|
|
if (aPercentageBaseGetter &&
|
|
|
|
(this->*aPercentageBaseGetter)(percentageBase)) {
|
|
|
|
nscoord val = nscoord(aCoord.GetPercentValue() * percentageBase);
|
2007-04-23 11:04:33 +04:00
|
|
|
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
|
2007-02-20 21:43:16 +03:00
|
|
|
} else {
|
|
|
|
aValue->SetPercent(aCoord.GetPercentValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Factor:
|
|
|
|
aValue->SetNumber(aCoord.GetFactorValue());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
{
|
|
|
|
nscoord val = aCoord.GetCoordValue();
|
2007-04-23 11:04:33 +04:00
|
|
|
aValue->SetAppUnits(PR_MAX(aMinAppUnits, PR_MIN(val, aMaxAppUnits)));
|
2007-02-20 21:43:16 +03:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Integer:
|
|
|
|
aValue->SetNumber(aCoord.GetIntValue());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
NS_ASSERTION(aTable, "Must have table to handle this case");
|
|
|
|
aValue->SetIdent(nsCSSProps::ValueToKeyword(aCoord.GetIntValue(),
|
|
|
|
aTable));
|
|
|
|
break;
|
|
|
|
|
2007-05-05 10:09:50 +04:00
|
|
|
case eStyleUnit_Chars: {
|
|
|
|
// Get a rendering context
|
|
|
|
nsCOMPtr<nsIRenderingContext> cx;
|
|
|
|
nsIFrame* frame = mPresShell->FrameManager()->GetRootFrame();
|
|
|
|
if (frame) {
|
|
|
|
mPresShell->CreateRenderingContext(frame, getter_AddRefs(cx));
|
|
|
|
}
|
|
|
|
if (cx) {
|
|
|
|
nscoord val =
|
|
|
|
nsLayoutUtils::CharsToCoord(aCoord, cx, mStyleContextHolder);
|
|
|
|
aValue->SetAppUnits(PR_MAX(aMinAppUnits, val));
|
|
|
|
} else {
|
|
|
|
// Oh, well. Give up.
|
|
|
|
aValue->SetAppUnits(0);
|
|
|
|
}
|
2007-02-20 21:43:16 +03:00
|
|
|
break;
|
2007-05-05 10:09:50 +04:00
|
|
|
}
|
|
|
|
|
2007-05-11 10:01:31 +04:00
|
|
|
case eStyleUnit_None:
|
2007-02-20 21:43:16 +03:00
|
|
|
aValue->SetIdent(nsGkAtoms::none);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
NS_ERROR("Can't handle this unit");
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
2007-04-23 11:04:33 +04:00
|
|
|
nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
|
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
|
|
|
nscoord aDefaultValue)
|
2007-02-20 21:43:16 +03:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPercentageBaseGetter, "Must have a percentage base getter");
|
|
|
|
switch (aCoord.GetUnit()) {
|
|
|
|
case eStyleUnit_Coord:
|
|
|
|
return aCoord.GetCoordValue();
|
|
|
|
case eStyleUnit_Percent:
|
|
|
|
{
|
|
|
|
nscoord percentageBase;
|
|
|
|
if ((this->*aPercentageBaseGetter)(percentageBase)) {
|
|
|
|
return nscoord(aCoord.GetPercentValue() * percentageBase);
|
|
|
|
}
|
|
|
|
}
|
2007-04-23 11:04:33 +04:00
|
|
|
// Fall through to returning aDefaultValue if we have no percentage base.
|
2007-02-20 21:43:16 +03:00
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
2007-04-23 11:04:33 +04:00
|
|
|
return aDefaultValue;
|
2007-03-23 02:01:14 +03:00
|
|
|
}
|
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetCBContentWidth(nscoord& aWidth)
|
|
|
|
{
|
2007-03-23 02:01:14 +03:00
|
|
|
if (!mFrame) {
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsIFrame* container = GetContainingBlockFor(mFrame);
|
2007-02-20 21:43:16 +03:00
|
|
|
if (!container) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
FlushPendingReflows();
|
|
|
|
|
|
|
|
aWidth = container->GetContentRect().width;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetCBContentHeight(nscoord& aHeight)
|
|
|
|
{
|
2007-03-23 02:01:14 +03:00
|
|
|
if (!mFrame) {
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
nsIFrame* container = GetContainingBlockFor(mFrame);
|
2007-02-20 21:43:16 +03:00
|
|
|
if (!container) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
FlushPendingReflows();
|
|
|
|
|
|
|
|
aHeight = container->GetContentRect().height;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetFrameBorderRectWidth(nscoord& aWidth)
|
|
|
|
{
|
2007-03-23 02:01:14 +03:00
|
|
|
if (!mFrame) {
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
FlushPendingReflows();
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
aWidth = mFrame->GetSize().width;
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_TRUE;
|
|
|
|
}
|
2002-10-08 05:53:31 +04:00
|
|
|
|
2007-07-21 18:20:25 +04:00
|
|
|
#ifdef MOZ_SVG
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetSVGPaintFor(PRBool aFill,
|
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
const nsStyleSVGPaint* paint = nsnull;
|
|
|
|
|
|
|
|
if (aFill)
|
|
|
|
paint = &svg->mFill;
|
|
|
|
else
|
|
|
|
paint = &svg->mStroke;
|
|
|
|
|
|
|
|
nsAutoString paintString;
|
|
|
|
|
|
|
|
switch (paint->mType) {
|
|
|
|
case eStyleSVGPaintType_None:
|
|
|
|
{
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleSVGPaintType_Color:
|
|
|
|
{
|
|
|
|
nsresult rv = SetToRGBAColor(val, paint->mPaint.mColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleSVGPaintType_Server:
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
if (!valueList->AppendCSSValue(val)) {
|
|
|
|
delete valueList;
|
|
|
|
delete val;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* fallback = GetROCSSPrimitiveValue();
|
|
|
|
if (!fallback || !valueList->AppendCSSValue(fallback)) {
|
|
|
|
delete valueList;
|
|
|
|
delete fallback;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetURI(paint->mPaint.mPaintServer);
|
|
|
|
nsresult rv = SetToRGBAColor(fallback, paint->mFallbackColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete valueList;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFill(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetSVGPaintFor(PR_TRUE, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStroke(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetSVGPaintFor(PR_FALSE, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarkerEnd(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mMarkerEnd)
|
|
|
|
val->SetURI(svg->mMarkerEnd);
|
|
|
|
else
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarkerMid(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mMarkerMid)
|
|
|
|
val->SetURI(svg->mMarkerMid);
|
|
|
|
else
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMarkerStart(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mMarkerStart)
|
|
|
|
val->SetURI(svg->mMarkerStart);
|
|
|
|
else
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeDasharray(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (!svg->mStrokeDasharrayLength || !svg->mStrokeDasharray) {
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
for (PRUint32 i = 0; i < svg->mStrokeDasharrayLength; i++) {
|
|
|
|
nsROCSSPrimitiveValue* dash = GetROCSSPrimitiveValue();
|
|
|
|
if (!dash || !valueList->AppendCSSValue(dash)) {
|
|
|
|
delete valueList;
|
|
|
|
delete dash;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetValueToCoord(dash, svg->mStrokeDasharray[i]);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(valueList, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeDashoffset(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeWidth(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
SetValueToCoord(val, GetStyleSVG()->mStrokeWidth);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFillOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVG()->mFillOpacity);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFloodOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVGReset()->mFloodOpacity);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStopOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVGReset()->mStopOpacity);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeMiterlimit(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVG()->mStrokeMiterlimit);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVG()->mStrokeOpacity);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetClipRule(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleSVG()->mClipRule,
|
|
|
|
nsCSSProps::kFillRuleKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFillRule(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleSVG()->mFillRule,
|
|
|
|
nsCSSProps::kFillRuleKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeLinecap(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleSVG()->mStrokeLinecap,
|
|
|
|
nsCSSProps::kStrokeLinecapKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeLinejoin(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleSVG()->mStrokeLinejoin,
|
|
|
|
nsCSSProps::kStrokeLinejoinKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextAnchor(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(GetStyleSVG()->mTextAnchor,
|
|
|
|
nsCSSProps::kTextAnchorKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColorInterpolation(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mColorInterpolation != NS_STYLE_COLOR_INTERPOLATION_AUTO) {
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(svg->mColorInterpolation,
|
|
|
|
nsCSSProps::kColorInterpolationKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColorInterpolationFilters(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mColorInterpolationFilters != NS_STYLE_COLOR_INTERPOLATION_AUTO) {
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(svg->mColorInterpolationFilters,
|
|
|
|
nsCSSProps::kColorInterpolationKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetDominantBaseline(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVGReset* svg = GetStyleSVGReset();
|
|
|
|
|
|
|
|
if (svg->mDominantBaseline != NS_STYLE_DOMINANT_BASELINE_AUTO) {
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(svg->mDominantBaseline,
|
|
|
|
nsCSSProps::kDominantBaselineKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPointerEvents(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mPointerEvents != NS_STYLE_POINTER_EVENTS_NONE) {
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(svg->mPointerEvents,
|
|
|
|
nsCSSProps::kPointerEventsKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetShapeRendering(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mShapeRendering != NS_STYLE_SHAPE_RENDERING_AUTO) {
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(svg->mShapeRendering,
|
|
|
|
nsCSSProps::kShapeRenderingKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextRendering(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVG* svg = GetStyleSVG();
|
|
|
|
|
|
|
|
if (svg->mTextRendering != NS_STYLE_TEXT_RENDERING_AUTO) {
|
|
|
|
const nsAFlatCString& keyword =
|
|
|
|
nsCSSProps::ValueToKeyword(svg->mTextRendering,
|
|
|
|
nsCSSProps::kTextRenderingKTable);
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(nsGkAtoms::_auto);
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStopColor(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mStopColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFloodColor(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetClipPath(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVGReset* svg = GetStyleSVGReset();
|
|
|
|
|
|
|
|
if (svg->mClipPath)
|
|
|
|
val->SetURI(svg->mClipPath);
|
|
|
|
else
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFilter(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVGReset* svg = GetStyleSVGReset();
|
|
|
|
|
|
|
|
if (svg->mFilter)
|
|
|
|
val->SetURI(svg->mFilter);
|
|
|
|
else
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMask(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleSVGReset* svg = GetStyleSVGReset();
|
|
|
|
|
|
|
|
if (svg->mMask)
|
|
|
|
val->SetURI(svg->mMask);
|
|
|
|
else
|
|
|
|
val->SetIdent(nsGkAtoms::none);
|
|
|
|
|
|
|
|
return CallQueryInterface(val, aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // MOZ_SVG
|
|
|
|
|
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
#define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \
|
|
|
|
{ eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method }
|
2007-07-21 18:20:28 +04:00
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
const nsComputedDOMStyle::ComputedStyleMapEntry*
|
|
|
|
nsComputedDOMStyle::GetQueryablePropertyMap(PRUint32* aLength)
|
2002-10-08 05:53:31 +04:00
|
|
|
{
|
|
|
|
/* ******************************************************************* *\
|
|
|
|
* 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 07:58:32 +04: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 05:53:31 +04: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),
|
2007-07-22 21:58:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_position, BackgroundPosition),
|
2002-10-08 05:53:31 +04:00
|
|
|
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 07:26:58 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_spacing, BorderSpacing),
|
2002-10-08 05:53:31 +04: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),
|
2007-07-22 21:58:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(content, Content),
|
2005-04-02 03:07:00 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(counter_increment, CounterIncrement),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(counter_reset, CounterReset),
|
2002-10-08 05:53:31 +04: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),
|
2007-05-16 19:51:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(ime_mode, IMEMode),
|
2006-08-08 20:41:03 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(opacity, Opacity),
|
2002-10-08 05:53:31 +04:00
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(orphans, Orphans),
|
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(outline, Outline),
|
2005-03-27 15:36:08 +04: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 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(overflow, Overflow),
|
2004-09-05 04:04:04 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(overflow_x, OverflowX),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(overflow_y, OverflowY),
|
2002-10-08 05:53:31 +04: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),
|
2007-07-22 21:58:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(page_break_after, PageBreakAfter),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(page_break_before, PageBreakBefore),
|
2002-10-08 05:53:31 +04:00
|
|
|
// 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),
|
2007-07-22 21:58:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(quotes, Quotes),
|
2002-10-08 05:53:31 +04:00
|
|
|
// 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 14:24:53 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_clip, BackgroundClip),
|
2003-01-17 12:33:52 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_inline_policy, BackgroundInlinePolicy),
|
2002-10-08 14:24:53 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_origin, BackgroundOrigin),
|
2002-10-08 05:53:31 +04: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 15:57:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_count, ColumnCount),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_width, ColumnWidth),
|
2004-07-18 16:12:46 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_gap, ColumnGap),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(float_edge, FloatEdge),
|
2007-07-22 21:58:37 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(force_broken_image_icon, ForceBrokenImageIcon),
|
2004-01-15 05:25:08 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(image_region, ImageRegion),
|
2004-10-14 07:32:28 +04: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 05:53:31 +04: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)
|
2007-07-21 18:20:25 +04:00
|
|
|
|
|
|
|
#ifdef MOZ_SVG
|
|
|
|
,
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(clip_path, ClipPath),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(clip_rule, ClipRule),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(color_interpolation, ColorInterpolation),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(color_interpolation_filters, ColorInterpolationFilters),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(dominant_baseline, DominantBaseline),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(fill, Fill),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(fill_opacity, FillOpacity),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(fill_rule, FillRule),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(filter, Filter),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(flood_color, FloodColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(flood_opacity, FloodOpacity),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(mask, Mask),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(marker_end, MarkerEnd),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(marker_mid, MarkerMid),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(marker_start, MarkerStart),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(pointer_events, PointerEvents),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(shape_rendering, ShapeRendering),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stop_color, StopColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stop_opacity, StopOpacity),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke, Stroke),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_dasharray, StrokeDasharray),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_dashoffset, StrokeDashoffset),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_linecap, StrokeLinecap),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_linejoin, StrokeLinejoin),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_miterlimit, StrokeMiterlimit),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_opacity, StrokeOpacity),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stroke_width, StrokeWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_anchor, TextAnchor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_rendering, TextRendering)
|
|
|
|
#endif
|
|
|
|
|
2002-10-08 05:53:31 +04:00
|
|
|
};
|
|
|
|
|
2004-01-15 05:25:08 +03:00
|
|
|
*aLength = NS_ARRAY_LENGTH(map);
|
2002-10-08 05:53:31 +04:00
|
|
|
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|