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>
|
2008-06-06 03:06:34 +04:00
|
|
|
* Michael Ventnor <m.ventnor@gmail.com>
|
2009-08-21 01:52:47 +04:00
|
|
|
* Jonathon Jongsma <jonathon.jongsma@collabora.co.uk>, Collabora Ltd.
|
|
|
|
* L. David Baron <dbaron@dbaron.org>, Mozilla Corporation
|
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"
|
2009-08-21 01:52:47 +04:00
|
|
|
#include "nsPrintfCString.h"
|
2009-01-17 00:32:09 +03:00
|
|
|
#include "nsIDOMNSCSS2Properties.h"
|
2000-05-04 04:07:33 +04:00
|
|
|
#include "nsIDOMElement.h"
|
2008-09-13 13:42:11 +04:00
|
|
|
#include "nsIDOMCSSPrimitiveValue.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"
|
2008-07-17 10:30:25 +04:00
|
|
|
#include "nsStyleStructInlines.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"
|
2007-05-05 10:09:50 +04:00
|
|
|
#include "nsLayoutUtils.h"
|
|
|
|
#include "nsFrameManager.h"
|
2009-01-29 23:39:18 +03:00
|
|
|
#include "prlog.h"
|
2008-09-13 13:42:11 +04:00
|
|
|
#include "nsCSSKeywords.h"
|
|
|
|
#include "nsStyleCoord.h"
|
|
|
|
#include "nsDisplayList.h"
|
2009-07-13 15:14:57 +04:00
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2010-05-05 22:18:05 +04:00
|
|
|
#include "mozilla/dom/Element.h"
|
2010-04-30 17:12:06 +04:00
|
|
|
|
|
|
|
using namespace mozilla::dom;
|
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
|
2009-07-13 15:14:57 +04:00
|
|
|
NS_NewComputedDOMStyle(nsIDOMElement *aElement, const nsAString &aPseudoElt,
|
|
|
|
nsIPresShell *aPresShell,
|
|
|
|
nsComputedDOMStyle **aComputedStyle)
|
2000-05-04 04:07:33 +04:00
|
|
|
{
|
2009-07-13 15:14:57 +04:00
|
|
|
nsRefPtr<nsComputedDOMStyle> computedStyle;
|
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!
|
2009-07-13 15:14:57 +04:00
|
|
|
computedStyle = new (sCachedComputedDOMStyle) nsComputedDOMStyle();
|
2002-07-08 11:11:59 +04:00
|
|
|
|
|
|
|
sCachedComputedDOMStyle = nsnull;
|
|
|
|
} else {
|
|
|
|
// No nsComputedDOMStyle cached, create a new one.
|
|
|
|
|
2009-07-13 15:14:57 +04:00
|
|
|
computedStyle = new nsComputedDOMStyle();
|
|
|
|
NS_ENSURE_TRUE(computedStyle, NS_ERROR_OUT_OF_MEMORY);
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2009-07-13 15:14:57 +04:00
|
|
|
nsresult rv = computedStyle->Init(aElement, aPseudoElt, aPresShell);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2009-07-13 15:14:57 +04:00
|
|
|
*aComputedStyle = nsnull;
|
|
|
|
computedStyle.swap(*aComputedStyle);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
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()
|
2009-09-18 17:09:55 +04:00
|
|
|
: mDocumentWeak(nsnull), mOuterFrame(nsnull),
|
2010-04-03 05:58:25 +04:00
|
|
|
mInnerFrame(nsnull), mPresShell(nsnull), mAppUnitsPerInch(0),
|
|
|
|
mExposeVisitedStyle(PR_FALSE)
|
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
|
|
|
|
2009-11-29 11:32:39 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_1(nsComputedDOMStyle, mContent)
|
2008-11-27 20:44:26 +03:00
|
|
|
|
2010-01-12 16:08:43 +03:00
|
|
|
DOMCI_DATA(ComputedCSSStyleDeclaration, nsComputedDOMStyle)
|
|
|
|
|
2003-07-12 00:44:25 +04:00
|
|
|
// QueryInterface implementation for nsComputedDOMStyle
|
2009-07-13 15:14:57 +04:00
|
|
|
NS_INTERFACE_TABLE_HEAD(nsComputedDOMStyle)
|
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
|
|
|
NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsComputedDOMStyle)
|
|
|
|
NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, nsICSSDeclaration)
|
|
|
|
NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle,
|
|
|
|
nsIDOMCSSStyleDeclaration)
|
|
|
|
NS_INTERFACE_TABLE_ENTRY(nsComputedDOMStyle, nsISupports)
|
|
|
|
NS_OFFSET_AND_INTERFACE_TABLE_END
|
|
|
|
NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
|
|
|
|
NS_INTERFACE_MAP_ENTRIES_CYCLE_COLLECTION(nsComputedDOMStyle)
|
2009-09-18 17:09:55 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMCSS2Properties,
|
|
|
|
new CSS2PropertiesTearoff(this))
|
2010-02-06 16:46:54 +03:00
|
|
|
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMSVGCSS2Properties,
|
|
|
|
new CSS2PropertiesTearoff(this))
|
2009-09-18 17:09:55 +04:00
|
|
|
NS_INTERFACE_MAP_ENTRY_AGGREGATED(nsIDOMNSCSS2Properties,
|
|
|
|
new CSS2PropertiesTearoff(this))
|
2010-03-17 18:09:05 +03:00
|
|
|
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(ComputedCSSStyleDeclaration)
|
2003-07-12 00:44:25 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-27 20:44:26 +03:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsComputedDOMStyle)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsComputedDOMStyle,
|
|
|
|
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
|
|
|
*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();
|
|
|
|
|
2009-02-05 00:22:45 +03:00
|
|
|
nsresult rv = GetPropertyCSSValue(aPropertyName, getter_AddRefs(val));
|
2000-06-14 04:06:36 +04:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
if (val) {
|
|
|
|
rv = val->GetCssText(aReturn);
|
|
|
|
}
|
|
|
|
|
|
|
|
return rv;
|
2000-05-04 04:07:33 +04:00
|
|
|
}
|
|
|
|
|
2009-08-11 02:52:29 +04:00
|
|
|
/* static */
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 17:12:06 +04:00
|
|
|
nsComputedDOMStyle::GetStyleContextForElement(Element* aElement,
|
2009-08-11 02:52:29 +04:00
|
|
|
nsIAtom* aPseudo,
|
|
|
|
nsIPresShell* aPresShell)
|
|
|
|
{
|
2009-12-11 10:37:40 +03:00
|
|
|
// If there's no pres shell, get it from the content
|
|
|
|
if (!aPresShell) {
|
2010-04-30 17:12:06 +04:00
|
|
|
aPresShell = GetPresShellForContent(aElement);
|
2009-12-11 10:37:40 +03:00
|
|
|
if (!aPresShell)
|
|
|
|
return nsnull;
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
2009-12-11 10:37:40 +03:00
|
|
|
aPresShell->FlushPendingNotifications(Flush_Style);
|
|
|
|
|
2010-04-30 17:12:06 +04:00
|
|
|
return GetStyleContextForElementNoFlush(aElement, aPseudo, aPresShell);
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 17:12:06 +04:00
|
|
|
nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
|
2009-08-21 01:52:47 +04:00
|
|
|
nsIAtom* aPseudo,
|
|
|
|
nsIPresShell* aPresShell)
|
|
|
|
{
|
2010-04-30 17:12:06 +04:00
|
|
|
NS_ABORT_IF_FALSE(aElement, "NULL element");
|
2009-08-21 01:52:47 +04:00
|
|
|
|
|
|
|
// If there's no pres shell, get it from the content
|
|
|
|
if (!aPresShell) {
|
2010-04-30 17:12:06 +04:00
|
|
|
aPresShell = GetPresShellForContent(aElement);
|
2009-08-21 01:52:47 +04:00
|
|
|
if (!aPresShell)
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!aPseudo) {
|
2010-04-30 17:12:06 +04:00
|
|
|
nsIFrame* frame = aElement->GetPrimaryFrame();
|
2009-08-11 02:52:29 +04:00
|
|
|
if (frame) {
|
2009-12-01 20:21:00 +03:00
|
|
|
nsStyleContext* result =
|
|
|
|
nsLayoutUtils::GetStyleFrame(frame)->GetStyleContext();
|
2009-08-11 02:52:29 +04:00
|
|
|
// Don't use the style context if it was influenced by
|
|
|
|
// pseudo-elements, since then it's not the primary style
|
|
|
|
// for this element.
|
|
|
|
if (!result->HasPseudoElementData()) {
|
|
|
|
// this function returns an addrefed style context
|
|
|
|
result->AddRef();
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// No frame has been created or we have a pseudo, so resolve the
|
|
|
|
// style ourselves
|
|
|
|
nsRefPtr<nsStyleContext> parentContext;
|
2010-04-30 17:12:06 +04:00
|
|
|
nsIContent* parent = aPseudo ? aElement : aElement->GetParent();
|
2009-08-14 06:09:49 +04:00
|
|
|
// Don't resolve parent context for document fragments.
|
2010-04-30 17:12:06 +04:00
|
|
|
if (parent && parent->IsElement())
|
|
|
|
parentContext = GetStyleContextForElementNoFlush(parent->AsElement(),
|
|
|
|
nsnull, aPresShell);
|
2009-08-11 02:52:29 +04:00
|
|
|
|
|
|
|
nsPresContext *presContext = aPresShell->GetPresContext();
|
|
|
|
if (!presContext)
|
|
|
|
return nsnull;
|
|
|
|
|
|
|
|
nsStyleSet *styleSet = aPresShell->StyleSet();
|
|
|
|
|
|
|
|
if (aPseudo) {
|
2009-12-11 10:37:40 +03:00
|
|
|
nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
|
|
|
|
if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
|
|
|
return nsnull;
|
|
|
|
}
|
2010-04-30 17:12:06 +04:00
|
|
|
return styleSet->ResolvePseudoElementStyle(aElement, type, parentContext);
|
2009-08-11 02:52:29 +04:00
|
|
|
}
|
|
|
|
|
2010-04-30 17:12:06 +04:00
|
|
|
return styleSet->ResolveStyleFor(aElement, parentContext);
|
2009-08-11 02:52:29 +04:00
|
|
|
}
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2009-08-21 01:52:47 +04:00
|
|
|
/* static */
|
|
|
|
nsIPresShell*
|
|
|
|
nsComputedDOMStyle::GetPresShellForContent(nsIContent* aContent)
|
|
|
|
{
|
|
|
|
nsIDocument* currentDoc = aContent->GetCurrentDoc();
|
|
|
|
if (!currentDoc)
|
|
|
|
return nsnull;
|
|
|
|
|
|
|
|
return currentDoc->GetPrimaryShell();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2009-08-11 02:52:29 +04:00
|
|
|
NS_ASSERTION(!mStyleContextHolder, "bad state");
|
|
|
|
|
2000-05-15 05:59:05 +04:00
|
|
|
*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
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName);
|
|
|
|
|
|
|
|
const ComputedStyleMapEntry* propEntry = nsnull;
|
|
|
|
{
|
|
|
|
PRUint32 length = 0;
|
|
|
|
const ComputedStyleMapEntry* propMap = GetQueryablePropertyMap(&length);
|
|
|
|
for (PRUint32 i = 0; i < length; ++i) {
|
|
|
|
if (prop == propMap[i].mProperty) {
|
|
|
|
propEntry = &propMap[i];
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (!propEntry) {
|
|
|
|
#ifdef DEBUG_ComputedDOMStyle
|
2010-04-27 20:15:01 +04:00
|
|
|
NS_WARNING(PromiseFlatCString(NS_ConvertUTF16toUTF8(aPropertyName) +
|
2009-02-25 03:14:45 +03:00
|
|
|
NS_LITERAL_CSTRING(" is not queryable!")).get());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// NOTE: For branches, we should flush here for compatibility!
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
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.
|
2009-02-25 03:14:45 +03:00
|
|
|
document->FlushPendingNotifications(
|
|
|
|
propEntry->mNeedsLayoutFlush ? Flush_Layout : Flush_Style);
|
|
|
|
#ifdef DEBUG
|
|
|
|
mFlushedPendingReflows = propEntry->mNeedsLayoutFlush;
|
|
|
|
#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-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
|
|
|
|
2009-12-25 00:20:06 +03:00
|
|
|
mOuterFrame = mContent->GetPrimaryFrame();
|
2008-01-30 00:53:09 +03:00
|
|
|
mInnerFrame = mOuterFrame;
|
2009-08-11 02:52:29 +04:00
|
|
|
if (mOuterFrame && !mPseudo) {
|
2008-01-30 00:53:09 +03:00
|
|
|
nsIAtom* type = mOuterFrame->GetType();
|
2007-05-05 09:30:10 +04:00
|
|
|
if (type == nsGkAtoms::tableOuterFrame) {
|
|
|
|
// If the frame is an outer table frame then we should get the style
|
|
|
|
// from the inner table frame.
|
2008-01-30 00:53:09 +03:00
|
|
|
mInnerFrame = mOuterFrame->GetFirstChild(nsnull);
|
|
|
|
NS_ASSERTION(mInnerFrame, "Outer table must have an inner");
|
|
|
|
NS_ASSERTION(!mInnerFrame->GetNextSibling(),
|
2007-05-05 09:30:10 +04:00
|
|
|
"Outer table frames should have just one child, the inner "
|
|
|
|
"table");
|
|
|
|
}
|
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
mStyleContextHolder = mInnerFrame->GetStyleContext();
|
2007-05-05 09:30:10 +04:00
|
|
|
NS_ASSERTION(mStyleContextHolder, "Frame without style context?");
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2000-05-15 05:59:05 +04:00
|
|
|
|
2009-08-11 02:52:29 +04:00
|
|
|
if (!mStyleContextHolder || mStyleContextHolder->HasPseudoElementData()) {
|
|
|
|
#ifdef DEBUG
|
|
|
|
if (mStyleContextHolder) {
|
|
|
|
// We want to check that going through this path because of
|
|
|
|
// HasPseudoElementData is rare, because it slows us down a good
|
|
|
|
// bit. So check that we're really inside something associated
|
|
|
|
// with a pseudo-element that contains elements.
|
|
|
|
nsStyleContext *topWithPseudoElementData = mStyleContextHolder;
|
|
|
|
while (topWithPseudoElementData->GetParent()->HasPseudoElementData()) {
|
|
|
|
topWithPseudoElementData = topWithPseudoElementData->GetParent();
|
|
|
|
}
|
|
|
|
NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(
|
2009-10-30 00:17:56 +03:00
|
|
|
topWithPseudoElementData->GetPseudo()),
|
2009-08-11 02:52:29 +04:00
|
|
|
"we should be in a pseudo-element that is expected to "
|
|
|
|
"contain elements");
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// Need to resolve a style context
|
|
|
|
mStyleContextHolder =
|
2010-04-30 17:12:06 +04:00
|
|
|
nsComputedDOMStyle::GetStyleContextForElement(mContent->AsElement(),
|
2009-08-11 02:52:29 +04:00
|
|
|
mPseudo,
|
|
|
|
mPresShell);
|
2009-08-11 02:52:29 +04:00
|
|
|
NS_ENSURE_TRUE(mStyleContextHolder, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
NS_ASSERTION(mPseudo || !mStyleContextHolder->HasPseudoElementData(),
|
|
|
|
"should not have pseudo-element data");
|
|
|
|
}
|
|
|
|
|
2010-04-03 05:58:25 +04:00
|
|
|
// mExposeVisitedStyle is set to true only by testing APIs that
|
|
|
|
// require UniversalXPConnect.
|
|
|
|
NS_ABORT_IF_FALSE(!mExposeVisitedStyle ||
|
|
|
|
nsContentUtils::IsCallerTrustedForCapability(
|
|
|
|
"UniversalXPConnect"),
|
|
|
|
"mExposeVisitedStyle set incorrectly");
|
|
|
|
if (mExposeVisitedStyle && mStyleContextHolder->RelevantLinkVisited()) {
|
|
|
|
nsStyleContext *styleIfVisited = mStyleContextHolder->GetStyleIfVisited();
|
|
|
|
if (styleIfVisited) {
|
|
|
|
mStyleContextHolder = styleIfVisited;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
// Call our pointer-to-member-function.
|
|
|
|
nsresult rv = (this->*(propEntry->mGetter))(aReturn);
|
2002-10-08 05:53:31 +04:00
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
*aReturn = nsnull;
|
2000-05-15 05:59:05 +04:00
|
|
|
}
|
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
mOuterFrame = nsnull;
|
|
|
|
mInnerFrame = 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 {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2000-06-14 04:06:36 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mBreakType,
|
|
|
|
nsCSSProps::kClearKTable));
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mFloats,
|
|
|
|
nsCSSProps::kFloatKTable));
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
}
|
|
|
|
|
2008-06-05 10:46:24 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStackSizing(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(GetStyleXUL()->mStretchStack ? eCSSKeyword_stretch_to_fit :
|
|
|
|
eCSSKeyword_ignore);
|
2008-06-05 10:46:24 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-06-05 10:46:24 +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) {
|
2009-01-23 04:28:14 +03:00
|
|
|
aValue->SetIdent(eCSSKeyword_transparent);
|
2007-01-25 05:03:02 +03:00
|
|
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
val->SetNumber(column->mColumnCount);
|
2004-06-17 15:57:37 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-06-17 15:57:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-06-17 15:57:37 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-07-18 16:12:46 +04:00
|
|
|
}
|
|
|
|
|
2008-07-19 14:38:25 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColumnRuleWidth(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2009-10-14 06:38:20 +04:00
|
|
|
val->SetAppUnits(GetStyleColumn()->GetComputedColumnRuleWidth());
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-07-19 14:38:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColumnRuleStyle(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleColumn()->mColumnRuleStyle,
|
|
|
|
nsCSSProps::kBorderStyleKTable));
|
2008-07-19 14:38:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-07-19 14:38:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColumnRuleColor(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
const nsStyleColumn* column = GetStyleColumn();
|
|
|
|
nscolor ruleColor;
|
|
|
|
if (column->mColumnRuleColorIsForeground) {
|
|
|
|
ruleColor = GetStyleColor()->mColor;
|
|
|
|
} else {
|
|
|
|
ruleColor = column->mColumnRuleColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetToRGBAColor(val, ruleColor);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-07-19 14:38:25 +04:00
|
|
|
}
|
|
|
|
|
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);
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
2009-03-06 07:05:00 +03:00
|
|
|
nsStyleUtil::AppendEscapedCSSString(
|
|
|
|
nsDependentString(data.mContent.mString), str);
|
2007-07-22 21:58:37 +04:00
|
|
|
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:
|
2010-02-04 23:49:29 +03:00
|
|
|
{
|
|
|
|
nsAutoString str;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentString(data.mContent.mString), str);
|
|
|
|
val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_ATTR);
|
|
|
|
}
|
2007-07-22 21:58:37 +04:00
|
|
|
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;
|
|
|
|
|
2010-02-04 23:49:29 +03:00
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentString(a->Item(0).GetStringBufferValue()), str);
|
2007-07-22 21:58:37 +04:00
|
|
|
PRInt32 typeItem = 1;
|
|
|
|
if (data.mType == eStyleContentType_Counters) {
|
|
|
|
typeItem = 2;
|
2009-03-06 07:05:00 +03:00
|
|
|
str.AppendLiteral(", ");
|
|
|
|
nsStyleUtil::AppendEscapedCSSString(
|
|
|
|
nsDependentString(a->Item(1).GetStringBufferValue()), str);
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
2009-10-22 01:57:57 +04:00
|
|
|
NS_ABORT_IF_FALSE(eCSSUnit_None != a->Item(typeItem).GetUnit(),
|
|
|
|
"'none' should be handled as enumerated value");
|
|
|
|
PRInt32 type = a->Item(typeItem).GetIntValue();
|
|
|
|
if (type != NS_STYLE_LIST_STYLE_DECIMAL) {
|
|
|
|
str.AppendLiteral(", ");
|
|
|
|
AppendASCIItoUTF16(
|
|
|
|
nsCSSProps::ValueToKeyword(type, nsCSSProps::kListStyleKTable),
|
|
|
|
str);
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
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);
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2010-04-27 20:15:01 +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);
|
2010-02-04 23:49:29 +03:00
|
|
|
nsAutoString escaped;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(data->mCounter, escaped);
|
|
|
|
name->SetString(escaped);
|
2006-12-30 08:17:59 +03:00
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
/* Convert the stored representation into a list of two values and then hand
|
|
|
|
* it back.
|
|
|
|
*/
|
|
|
|
nsresult nsComputedDOMStyle::GetMozTransformOrigin(nsIDOMCSSValue **aValue)
|
|
|
|
{
|
|
|
|
/* We need to build up a list of two values. We'll call them
|
|
|
|
* width and height.
|
|
|
|
*/
|
2010-06-04 00:11:34 +04:00
|
|
|
nsRefPtr<nsROCSSPrimitiveValue> width = GetROCSSPrimitiveValue();
|
|
|
|
nsRefPtr<nsROCSSPrimitiveValue> height = GetROCSSPrimitiveValue();
|
2008-09-13 13:42:11 +04:00
|
|
|
if (!width || !height)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
/* Now, get the values. */
|
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
|
|
|
SetValueToCoord(width, display->mTransformOrigin[0],
|
|
|
|
&nsComputedDOMStyle::GetFrameBoundsWidthForTransform);
|
|
|
|
SetValueToCoord(height, display->mTransformOrigin[1],
|
|
|
|
&nsComputedDOMStyle::GetFrameBoundsHeightForTransform);
|
|
|
|
|
|
|
|
/* Store things as a value list, fail if we can't get one. */
|
2010-06-04 00:11:34 +04:00
|
|
|
nsRefPtr<nsDOMCSSValueList> valueList = GetROCSSValueList(PR_FALSE);
|
2008-09-13 13:42:11 +04:00
|
|
|
if (!valueList)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
|
|
|
/* Chain on width and height, fail if we can't. */
|
|
|
|
if (!valueList->AppendCSSValue(width))
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
if (!valueList->AppendCSSValue(height))
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
valueList.forget(aValue);
|
|
|
|
return NS_OK;
|
2008-09-13 13:42:11 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
/* If the property is "none", hand back "none" wrapped in a value.
|
|
|
|
* Otherwise, compute the aggregate transform matrix and hands it back in a
|
|
|
|
* "matrix" wrapper.
|
|
|
|
*/
|
|
|
|
nsresult nsComputedDOMStyle::GetMozTransform(nsIDOMCSSValue **aValue)
|
|
|
|
{
|
|
|
|
static const PRInt32 NUM_FLOATS = 4;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
/* First, get the display data. We'll need it. */
|
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
/* If the "no transforms" flag is set, then we should construct a
|
|
|
|
* single-element entry and hand it back.
|
|
|
|
*/
|
|
|
|
if (!display->mTransformPresent) {
|
2010-06-04 00:11:34 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2008-09-13 13:42:11 +04:00
|
|
|
if (!val)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
/* Set it to "none." */
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-09-13 13:42:11 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
/* Otherwise, we need to compute the current value of the transform matrix,
|
|
|
|
* store it in a string, and hand it back to the caller.
|
|
|
|
*/
|
|
|
|
nsAutoString resultString(NS_LITERAL_STRING("matrix("));
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
/* Now, we need to convert the matrix into a string. We'll start by taking
|
|
|
|
* the first four entries and converting them directly to floating-point
|
|
|
|
* values.
|
|
|
|
*/
|
|
|
|
for (PRInt32 index = 0; index < NUM_FLOATS; ++index) {
|
|
|
|
resultString.AppendFloat(display->mTransform.GetMainMatrixEntry(index));
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Use the inner frame for width and height. If we fail, assume zero.
|
|
|
|
* TODO: There is no good way for us to represent the case where there's no
|
|
|
|
* frame, which is problematic. The reason is that when we have percentage
|
|
|
|
* transforms, there are a total of four stored matrix entries that influence
|
|
|
|
* the transform based on the size of the element. However, this poses a
|
|
|
|
* problem, because only two of these values can be explicitly referenced
|
|
|
|
* using the named transforms. Until a real solution is found, we'll just
|
|
|
|
* use this approach.
|
|
|
|
*/
|
|
|
|
nsRect bounds =
|
|
|
|
(mInnerFrame ? nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame) :
|
|
|
|
nsRect(0, 0, 0, 0));
|
|
|
|
|
|
|
|
/* Now, compute the dX and dY components by adding the stored coord value
|
|
|
|
* (in CSS pixels) to the translate values.
|
|
|
|
*/
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
float deltaX = nsPresContext::AppUnitsToFloatCSSPixels
|
|
|
|
(display->mTransform.GetXTranslation(bounds));
|
|
|
|
float deltaY = nsPresContext::AppUnitsToFloatCSSPixels
|
|
|
|
(display->mTransform.GetYTranslation(bounds));
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
|
|
|
|
/* Append these values! */
|
|
|
|
resultString.AppendFloat(deltaX);
|
|
|
|
resultString.Append(NS_LITERAL_STRING("px, "));
|
|
|
|
resultString.AppendFloat(deltaY);
|
|
|
|
resultString.Append(NS_LITERAL_STRING("px)"));
|
|
|
|
|
|
|
|
/* Create a value to hold our result. */
|
2010-06-04 00:11:34 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
2008-09-13 13:42:11 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
if (!val)
|
2008-09-13 13:42:11 +04:00
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
val->SetString(resultString);
|
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-09-13 13:42:11 +04:00
|
|
|
}
|
|
|
|
|
2005-04-02 03:07:00 +04:00
|
|
|
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);
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2010-04-27 20:15:01 +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);
|
2010-02-04 23:49:29 +03:00
|
|
|
nsAutoString escaped;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(data->mCounter, escaped);
|
|
|
|
name->SetString(escaped);
|
2006-12-30 08:17:59 +03:00
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2005-04-02 03:07:00 +04:00
|
|
|
}
|
|
|
|
|
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);
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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;
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsROCSSPrimitiveValue* closeVal = GetROCSSPrimitiveValue();
|
|
|
|
if (!closeVal || !valueList->AppendCSSValue(closeVal)) {
|
|
|
|
delete valueList;
|
|
|
|
delete closeVal;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsString s;
|
2009-03-06 07:05:00 +03:00
|
|
|
nsStyleUtil::AppendEscapedCSSString(*quotes->OpenQuoteAt(i), s);
|
2007-07-22 21:58:37 +04:00
|
|
|
openVal->SetString(s);
|
2009-03-06 07:05:00 +03:00
|
|
|
s.Truncate();
|
|
|
|
nsStyleUtil::AppendEscapedCSSString(*quotes->CloseQuoteAt(i), s);
|
2007-07-22 21:58:37 +04:00
|
|
|
closeVal->SetString(s);
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
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;
|
2010-04-27 20:15:01 +04:00
|
|
|
if (font->mGenericID == kGenericFont_NONE && !font->mFont.systemFont) {
|
2006-12-30 08:17:59 +03:00
|
|
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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 {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2009-01-29 23:39:18 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFontStretch(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleFont* font = GetStyleFont();
|
|
|
|
|
|
|
|
// The computed value space isn't actually representable in string
|
|
|
|
// form, so just represent anything with widers or narrowers in it as
|
|
|
|
// 'wider' or 'narrower'.
|
|
|
|
PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER % 2 == 0);
|
|
|
|
PR_STATIC_ASSERT(NS_FONT_STRETCH_WIDER % 2 == 0);
|
|
|
|
PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER + NS_FONT_STRETCH_WIDER == 0);
|
|
|
|
PR_STATIC_ASSERT(NS_FONT_STRETCH_NARROWER < 0);
|
|
|
|
PRInt16 stretch = font->mFont.stretch;
|
2009-11-15 06:16:59 +03:00
|
|
|
if (stretch <= NS_FONT_STRETCH_NARROWER / 2) {
|
2009-01-29 23:39:18 +03:00
|
|
|
val->SetIdent(eCSSKeyword_narrower);
|
|
|
|
} else if (stretch >= NS_FONT_STRETCH_WIDER / 2) {
|
|
|
|
val->SetIdent(eCSSKeyword_wider);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(stretch, nsCSSProps::kFontStretchKTable));
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2009-01-29 23:39:18 +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
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.style,
|
|
|
|
nsCSSProps::kFontStyleKTable));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, 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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2009-11-15 06:16:59 +03:00
|
|
|
PRUint16 weight = font->mFont.weight;
|
|
|
|
if (weight % 100 == 0) {
|
2006-12-30 08:17:59 +03:00
|
|
|
val->SetNumber(font->mFont.weight);
|
2009-11-15 06:16:59 +03:00
|
|
|
} else if (weight % 100 > 50) {
|
|
|
|
// FIXME: This doesn't represent the full range of computed values,
|
|
|
|
// but at least it's legal CSS.
|
|
|
|
val->SetIdent(eCSSKeyword_lighter);
|
|
|
|
} else {
|
|
|
|
// FIXME: This doesn't represent the full range of computed values,
|
|
|
|
// but at least it's legal CSS.
|
|
|
|
val->SetIdent(eCSSKeyword_bolder);
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleFont()->mFont.variant,
|
|
|
|
nsCSSProps::kFontVariantKTable));
|
2001-03-11 23:47:06 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2002-03-16 20:04:35 +03:00
|
|
|
nsresult
|
2009-02-20 08:29:21 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundList(PRUint8 nsStyleBackground::Layer::* aMember,
|
|
|
|
PRUint32 nsStyleBackground::* aCount,
|
|
|
|
const PRInt32 aTable[],
|
|
|
|
nsIDOMCSSValue** aResult)
|
2002-03-16 20:04:35 +03:00
|
|
|
{
|
2009-02-20 08:29:21 +03:00
|
|
|
const nsStyleBackground* bg = GetStyleBackground();
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
2002-10-08 14:24:53 +04:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
for (PRUint32 i = 0, i_end = bg->*aCount; i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !valueList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2009-05-28 22:09:05 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(bg->mLayers[i].*aMember,
|
2009-02-20 08:29:21 +03:00
|
|
|
aTable));
|
|
|
|
}
|
2009-02-19 05:59:47 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aResult = valueList);
|
|
|
|
return NS_OK;
|
2009-02-19 23:33:09 +03:00
|
|
|
}
|
2009-02-19 20:06:18 +03:00
|
|
|
|
2009-02-19 23:33:09 +03:00
|
|
|
nsresult
|
2009-02-20 08:29:21 +03:00
|
|
|
nsComputedDOMStyle::GetBackgroundAttachment(nsIDOMCSSValue** aValue)
|
2009-02-19 23:33:09 +03:00
|
|
|
{
|
2009-02-20 08:29:21 +03:00
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mAttachment,
|
|
|
|
&nsStyleBackground::mAttachmentCount,
|
|
|
|
nsCSSProps::kBackgroundAttachmentKTable,
|
|
|
|
aValue);
|
|
|
|
}
|
2009-02-20 00:51:46 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundClip(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mClip,
|
|
|
|
&nsStyleBackground::mClipCount,
|
2010-06-09 05:44:32 +04:00
|
|
|
nsCSSProps::kBackgroundOriginKTable,
|
2009-02-20 08:29:21 +03:00
|
|
|
aValue);
|
2002-10-08 14:24:53 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2009-06-16 19:00:20 +04:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2009-02-20 08:29:21 +03:00
|
|
|
|
2009-06-16 19:00:20 +04:00
|
|
|
const nsStyleBackground* color = GetStyleBackground();
|
|
|
|
nsresult rv = SetToRGBAColor(val, color->mBackgroundColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2001-03-03 03:44:19 +03:00
|
|
|
}
|
|
|
|
|
2009-08-01 19:53:40 +04:00
|
|
|
static void
|
|
|
|
AppendCSSGradientLength(const nsStyleCoord& aValue,
|
|
|
|
nsROCSSPrimitiveValue* aPrimitive,
|
|
|
|
nsAString& aString)
|
|
|
|
{
|
|
|
|
nsAutoString tokenString;
|
|
|
|
if (aValue.GetUnit() == eStyleUnit_Coord)
|
|
|
|
aPrimitive->SetAppUnits(aValue.GetCoordValue());
|
|
|
|
else
|
|
|
|
aPrimitive->SetPercent(aValue.GetPercentValue());
|
|
|
|
aPrimitive->GetCssText(tokenString);
|
|
|
|
aString.Append(tokenString);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
|
|
|
|
nsAString& aString)
|
|
|
|
{
|
2009-11-02 22:36:43 +03:00
|
|
|
if (aGradient->mRepeating) {
|
|
|
|
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR)
|
|
|
|
aString.AssignLiteral("-moz-repeating-linear-gradient(");
|
|
|
|
else
|
|
|
|
aString.AssignLiteral("-moz-repeating-radial-gradient(");
|
|
|
|
} else {
|
|
|
|
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_LINEAR)
|
|
|
|
aString.AssignLiteral("-moz-linear-gradient(");
|
|
|
|
else
|
|
|
|
aString.AssignLiteral("-moz-radial-gradient(");
|
|
|
|
}
|
2009-08-01 19:53:40 +04:00
|
|
|
|
2009-11-02 22:36:43 +03:00
|
|
|
PRBool needSep = PR_FALSE;
|
|
|
|
nsAutoString tokenString;
|
2009-08-01 19:53:40 +04:00
|
|
|
nsROCSSPrimitiveValue *tmpVal = GetROCSSPrimitiveValue();
|
|
|
|
if (!tmpVal)
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
|
2009-11-02 22:36:43 +03:00
|
|
|
if (aGradient->mBgPosX.mUnit != eStyleUnit_None) {
|
|
|
|
AppendCSSGradientLength(aGradient->mBgPosX, tmpVal, aString);
|
|
|
|
needSep = PR_TRUE;
|
|
|
|
}
|
|
|
|
if (aGradient->mBgPosY.mUnit != eStyleUnit_None) {
|
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
}
|
|
|
|
AppendCSSGradientLength(aGradient->mBgPosY, tmpVal, aString);
|
|
|
|
needSep = PR_TRUE;
|
|
|
|
}
|
|
|
|
if (aGradient->mAngle.mUnit != eStyleUnit_None) {
|
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
}
|
|
|
|
tmpVal->SetNumber(aGradient->mAngle.GetAngleValue());
|
|
|
|
tmpVal->GetCssText(tokenString);
|
|
|
|
aString.Append(tokenString);
|
|
|
|
switch (aGradient->mAngle.mUnit) {
|
|
|
|
case eStyleUnit_Degree: aString.AppendLiteral("deg"); break;
|
|
|
|
case eStyleUnit_Grad: aString.AppendLiteral("grad"); break;
|
|
|
|
case eStyleUnit_Radian: aString.AppendLiteral("rad"); break;
|
|
|
|
default: NS_NOTREACHED("unrecognized angle unit");
|
|
|
|
}
|
|
|
|
needSep = PR_TRUE;
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
|
|
|
|
2009-11-02 22:36:43 +03:00
|
|
|
if (aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR) {
|
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(", ");
|
|
|
|
}
|
|
|
|
AppendASCIItoUTF16(nsCSSProps::
|
|
|
|
ValueToKeyword(aGradient->mShape,
|
|
|
|
nsCSSProps::kRadialGradientShapeKTable),
|
|
|
|
aString);
|
|
|
|
if (aGradient->mSize != NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
AppendASCIItoUTF16(nsCSSProps::
|
|
|
|
ValueToKeyword(aGradient->mSize,
|
|
|
|
nsCSSProps::kRadialGradientSizeKTable),
|
|
|
|
aString);
|
|
|
|
}
|
|
|
|
needSep = PR_TRUE;
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
|
|
|
|
2009-11-02 22:36:43 +03:00
|
|
|
|
2009-08-01 19:53:40 +04:00
|
|
|
// color stops
|
|
|
|
for (PRUint32 i = 0; i < aGradient->mStops.Length(); ++i) {
|
2009-11-02 22:36:43 +03:00
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(", ");
|
|
|
|
}
|
2009-08-01 19:53:40 +04:00
|
|
|
nsresult rv = SetToRGBAColor(tmpVal, aGradient->mStops[i].mColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete tmpVal;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
tmpVal->GetCssText(tokenString);
|
|
|
|
aString.Append(tokenString);
|
2009-11-02 22:36:43 +03:00
|
|
|
|
|
|
|
if (aGradient->mStops[i].mLocation.mUnit != eStyleUnit_None) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
AppendCSSGradientLength(aGradient->mStops[i].mLocation, tmpVal, aString);
|
|
|
|
}
|
|
|
|
needSep = PR_TRUE;
|
2009-08-01 19:53:40 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
delete tmpVal;
|
|
|
|
aString.AppendLiteral(")");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2009-08-22 00:39:25 +04:00
|
|
|
// -moz-image-rect(<uri>, <top>, <right>, <bottom>, <left>)
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetImageRectString(nsIURI* aURI,
|
|
|
|
const nsStyleSides& aCropRect,
|
|
|
|
nsString& aString)
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
// <uri>
|
|
|
|
nsROCSSPrimitiveValue *valURI = GetROCSSPrimitiveValue();
|
|
|
|
if (!valURI || !valueList->AppendCSSValue(valURI)) {
|
|
|
|
delete valURI;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
valURI->SetURI(aURI);
|
|
|
|
|
|
|
|
// <top>, <right>, <bottom>, <left>
|
|
|
|
NS_FOR_CSS_SIDES(side) {
|
|
|
|
nsROCSSPrimitiveValue *valSide = GetROCSSPrimitiveValue();
|
|
|
|
if (!valSide || !valueList->AppendCSSValue(valSide)) {
|
|
|
|
delete valSide;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
SetValueToCoord(valSide, aCropRect.Get(side));
|
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString argumentString;
|
|
|
|
valueList->GetCssText(argumentString);
|
|
|
|
delete valueList;
|
|
|
|
|
|
|
|
aString = NS_LITERAL_STRING("-moz-image-rect(") +
|
|
|
|
argumentString +
|
|
|
|
NS_LITERAL_STRING(")");
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::SetValueToStyleImage(const nsStyleImage& aStyleImage,
|
|
|
|
nsROCSSPrimitiveValue* aValue)
|
|
|
|
{
|
|
|
|
switch (aStyleImage.GetType()) {
|
|
|
|
case eStyleImageType_Image:
|
|
|
|
{
|
|
|
|
imgIRequest *req = aStyleImage.GetImageData();
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
req->GetURI(getter_AddRefs(uri));
|
|
|
|
|
|
|
|
const nsStyleSides* cropRect = aStyleImage.GetCropRect();
|
|
|
|
if (cropRect) {
|
|
|
|
nsAutoString imageRectString;
|
|
|
|
nsresult rv = GetImageRectString(uri, *cropRect, imageRectString);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
aValue->SetString(imageRectString);
|
|
|
|
} else {
|
|
|
|
aValue->SetURI(uri);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleImageType_Gradient:
|
|
|
|
{
|
|
|
|
nsAutoString gradientString;
|
|
|
|
nsresult rv = GetCSSGradientString(aStyleImage.GetGradientData(),
|
|
|
|
gradientString);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
aValue->SetString(gradientString);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleImageType_Null:
|
|
|
|
aValue->SetIdent(eCSSKeyword_none);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("unexpected image type");
|
|
|
|
return NS_ERROR_UNEXPECTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2009-02-20 08:29:21 +03:00
|
|
|
const nsStyleBackground* bg = GetStyleBackground();
|
2009-02-19 18:29:28 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
2009-02-19 23:33:09 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
for (PRUint32 i = 0, i_end = bg->mImageCount; i < i_end; ++i) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !valueList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
2009-08-22 00:39:25 +04:00
|
|
|
const nsStyleImage& image = bg->mLayers[i].mImage;
|
|
|
|
nsresult rv = SetValueToStyleImage(image, val);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete valueList;
|
|
|
|
return rv;
|
2002-01-11 03:15:55 +03: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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(
|
|
|
|
GetStyleBackground()->mBackgroundInlinePolicy,
|
|
|
|
nsCSSProps::kBackgroundInlinePolicyKTable));
|
2003-01-17 12:33:52 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2003-01-17 12:33:52 +03:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2009-02-20 08:29:21 +03:00
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mOrigin,
|
|
|
|
&nsStyleBackground::mOriginCount,
|
|
|
|
nsCSSProps::kBackgroundOriginKTable,
|
|
|
|
aValue);
|
2002-10-08 14:24:53 +04:00
|
|
|
}
|
|
|
|
|
2007-07-22 21:58:37 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBackgroundPosition(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
2009-02-20 08:29:21 +03:00
|
|
|
const nsStyleBackground* bg = GetStyleBackground();
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
2007-07-22 21:58:37 +04:00
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
for (PRUint32 i = 0, i_end = bg->mPositionCount; i < i_end; ++i) {
|
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE);
|
|
|
|
if (!itemList || !valueList->AppendCSSValue(itemList)) {
|
|
|
|
delete valueList;
|
|
|
|
delete itemList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2007-07-22 21:58:37 +04:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue();
|
|
|
|
if (!valX || !itemList->AppendCSSValue(valX)) {
|
|
|
|
delete valueList;
|
|
|
|
delete valX;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2009-02-19 04:13:25 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue();
|
|
|
|
if (!valY || !itemList->AppendCSSValue(valY)) {
|
|
|
|
delete valueList;
|
|
|
|
delete valY;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2009-02-19 18:29:28 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
const nsStyleBackground::Position &pos = bg->mLayers[i].mPosition;
|
2009-02-19 23:33:09 +03:00
|
|
|
|
2009-02-20 08:29:21 +03:00
|
|
|
if (pos.mXIsPercent) {
|
|
|
|
valX->SetPercent(pos.mXPosition.mFloat);
|
|
|
|
} else {
|
|
|
|
valX->SetAppUnits(pos.mXPosition.mCoord);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (pos.mYIsPercent) {
|
|
|
|
valY->SetPercent(pos.mYPosition.mFloat);
|
|
|
|
} else {
|
|
|
|
valY->SetAppUnits(pos.mYPosition.mCoord);
|
|
|
|
}
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2009-02-20 08:29:21 +03:00
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mRepeat,
|
|
|
|
&nsStyleBackground::mRepeatCount,
|
|
|
|
nsCSSProps::kBackgroundRepeatKTable,
|
|
|
|
aValue);
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2009-05-28 22:09:05 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMozBackgroundSize(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleBackground* bg = GetStyleBackground();
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
for (PRUint32 i = 0, i_end = bg->mSizeCount; i < i_end; ++i) {
|
|
|
|
const nsStyleBackground::Size &size = bg->mLayers[i].mSize;
|
|
|
|
|
|
|
|
switch (size.mWidthType) {
|
|
|
|
case nsStyleBackground::Size::eContain:
|
|
|
|
case nsStyleBackground::Size::eCover: {
|
|
|
|
NS_ABORT_IF_FALSE(size.mWidthType == size.mHeightType,
|
|
|
|
"unsynced types");
|
|
|
|
nsCSSKeyword keyword = size.mWidthType == nsStyleBackground::Size::eContain
|
|
|
|
? eCSSKeyword_contain
|
|
|
|
: eCSSKeyword_cover;
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !valueList->AppendCSSValue(val)) {
|
|
|
|
delete valueList;
|
|
|
|
delete val;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
val->SetIdent(keyword);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE);
|
|
|
|
if (!itemList || !valueList->AppendCSSValue(itemList)) {
|
|
|
|
delete valueList;
|
|
|
|
delete itemList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* valX = GetROCSSPrimitiveValue();
|
|
|
|
nsROCSSPrimitiveValue* valY = GetROCSSPrimitiveValue();
|
|
|
|
if (!valX || !itemList->AppendCSSValue(valX)) {
|
|
|
|
delete valueList;
|
|
|
|
delete valX;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
if (!valY || !itemList->AppendCSSValue(valY)) {
|
|
|
|
delete valueList;
|
|
|
|
delete valY;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size.mWidthType == nsStyleBackground::Size::eAuto) {
|
|
|
|
valX->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else if (size.mWidthType == nsStyleBackground::Size::ePercentage) {
|
|
|
|
valX->SetPercent(size.mWidth.mFloat);
|
|
|
|
} else {
|
|
|
|
NS_ABORT_IF_FALSE(size.mWidthType == nsStyleBackground::Size::eLength,
|
|
|
|
"bad mWidthType");
|
|
|
|
valX->SetAppUnits(size.mWidth.mCoord);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (size.mHeightType == nsStyleBackground::Size::eAuto) {
|
|
|
|
valY->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else if (size.mHeightType == nsStyleBackground::Size::ePercentage) {
|
|
|
|
valY->SetPercent(size.mHeight.mFloat);
|
|
|
|
} else {
|
|
|
|
NS_ABORT_IF_FALSE(size.mHeightType == nsStyleBackground::Size::eLength,
|
|
|
|
"bad mHeightType");
|
|
|
|
valY->SetAppUnits(size.mHeight.mCoord);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2009-05-28 22:09:05 +04: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.
|
2009-02-25 03:14:46 +03:00
|
|
|
*aValue = nsnull;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
return 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
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mBorderCollapse,
|
|
|
|
nsCSSProps::kBorderCollapseKTable));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, 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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
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::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;
|
|
|
|
}
|
2010-04-27 20:15:01 +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();
|
2008-09-13 07:45:37 +04:00
|
|
|
xSpacing->SetAppUnits(border->mBorderSpacingX);
|
|
|
|
ySpacing->SetAppUnits(border->mBorderSpacingY);
|
2006-12-30 08:17:59 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mCaptionSide,
|
|
|
|
nsCSSProps::kCaptionSideKTable));
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleTableBorder()->mEmptyCells,
|
|
|
|
nsCSSProps::kEmptyCellsKTable));
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleTable()->mLayoutStrategy,
|
|
|
|
nsCSSProps::kTableLayoutKTable));
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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.
|
2009-02-25 03:14:46 +03:00
|
|
|
*aValue = nsnull;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleBorder()->mBorderRadius,
|
|
|
|
NS_CORNER_BOTTOM_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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleBorder()->mBorderRadius,
|
|
|
|
NS_CORNER_BOTTOM_RIGHT, 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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleBorder()->mBorderRadius,
|
|
|
|
NS_CORNER_TOP_LEFT, 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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleBorder()->mBorderRadius,
|
|
|
|
NS_CORNER_TOP_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.
|
2009-02-25 03:14:46 +03:00
|
|
|
*aValue = nsnull;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
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.
|
2009-02-25 03:14:46 +03:00
|
|
|
*aValue = nsnull;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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.
|
2009-02-25 03:14:46 +03:00
|
|
|
*aValue = nsnull;
|
2002-09-07 05:48:39 +04:00
|
|
|
|
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
|
|
|
|
2009-01-23 04:28:13 +03:00
|
|
|
nscoord width;
|
|
|
|
if (outline->GetOutlineStyle() == NS_STYLE_BORDER_STYLE_NONE) {
|
|
|
|
NS_ASSERTION(outline->GetOutlineWidth(width) && width == 0,
|
|
|
|
"unexpected width");
|
|
|
|
width = 0;
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
2009-01-23 04:28:13 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
PRBool res =
|
|
|
|
#endif
|
|
|
|
outline->GetOutlineWidth(width);
|
|
|
|
NS_ASSERTION(res, "percent outline doesn't exist");
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2009-01-23 04:28:13 +03:00
|
|
|
val->SetAppUnits(width);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 20:46:42 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleOutline()->GetOutlineStyle(),
|
|
|
|
nsCSSProps::kOutlineStyleKTable));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, 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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
val->SetAppUnits(GetStyleOutline()->mOutlineOffset);
|
2004-10-26 16:57:15 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-10-26 16:57:15 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleOutline()->mOutlineRadius,
|
|
|
|
NS_CORNER_BOTTOM_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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleOutline()->mOutlineRadius,
|
|
|
|
NS_CORNER_BOTTOM_RIGHT, 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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleOutline()->mOutlineRadius,
|
|
|
|
NS_CORNER_TOP_LEFT, 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
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
return GetEllipseRadii(GetStyleOutline()->mOutlineRadius,
|
|
|
|
NS_CORNER_TOP_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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2001-03-11 23:47:06 +03:00
|
|
|
}
|
|
|
|
|
2004-10-14 07:32:28 +04:00
|
|
|
nsresult
|
2008-10-01 09:50:52 +04:00
|
|
|
nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius,
|
|
|
|
PRUint8 aFullCorner,
|
|
|
|
nsIDOMCSSValue** aValue)
|
2004-10-14 07:32:28 +04:00
|
|
|
{
|
2008-10-01 09:50:52 +04:00
|
|
|
const nsStyleCoord& radiusX
|
|
|
|
= aRadius.Get(NS_FULL_TO_HALF_CORNER(aFullCorner, PR_FALSE));
|
|
|
|
const nsStyleCoord& radiusY
|
|
|
|
= aRadius.Get(NS_FULL_TO_HALF_CORNER(aFullCorner, PR_TRUE));
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-10-01 09:50:52 +04:00
|
|
|
// for compatibility, return a single value if X and Y are equal
|
|
|
|
if (radiusX == radiusY) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2004-10-14 07:32:28 +04:00
|
|
|
|
2008-10-01 09:50:52 +04:00
|
|
|
SetValueToCoord(val, radiusX,
|
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectWidth);
|
2004-10-14 07:32:28 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-10-01 09:50:52 +04:00
|
|
|
} else {
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *valX = GetROCSSPrimitiveValue();
|
|
|
|
if (!valX || !valueList->AppendCSSValue(valX)) {
|
|
|
|
delete valX;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *valY = GetROCSSPrimitiveValue();
|
|
|
|
if (!valY || !valueList->AppendCSSValue(valY)) {
|
|
|
|
delete valY;
|
|
|
|
// valX deleted by valueList destructor
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetValueToCoord(valX, radiusX,
|
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectWidth);
|
|
|
|
SetValueToCoord(valY, radiusY,
|
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectWidth);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2008-10-01 09:50:52 +04:00
|
|
|
}
|
2004-10-14 07:32:28 +04:00
|
|
|
}
|
|
|
|
|
2008-07-08 04:56:52 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray,
|
|
|
|
const nscolor& aDefaultColor,
|
2009-02-10 11:45:13 +03:00
|
|
|
PRBool aIsBoxShadow,
|
2008-07-08 04:56:52 +04:00
|
|
|
nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
if (!aArray) {
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
static nscoord nsCSSShadowItem::* const shadowValuesNoSpread[] = {
|
2008-07-08 04:56:52 +04:00
|
|
|
&nsCSSShadowItem::mXOffset,
|
|
|
|
&nsCSSShadowItem::mYOffset,
|
|
|
|
&nsCSSShadowItem::mRadius
|
|
|
|
};
|
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
static nscoord nsCSSShadowItem::* const shadowValuesWithSpread[] = {
|
2008-07-08 04:56:52 +04:00
|
|
|
&nsCSSShadowItem::mXOffset,
|
|
|
|
&nsCSSShadowItem::mYOffset,
|
|
|
|
&nsCSSShadowItem::mRadius,
|
|
|
|
&nsCSSShadowItem::mSpread
|
|
|
|
};
|
|
|
|
|
2008-09-13 07:45:37 +04:00
|
|
|
nscoord nsCSSShadowItem::* const * shadowValues;
|
2008-07-08 04:56:52 +04:00
|
|
|
PRUint32 shadowValuesLength;
|
2009-02-10 11:45:13 +03:00
|
|
|
if (aIsBoxShadow) {
|
2008-07-08 04:56:52 +04:00
|
|
|
shadowValues = shadowValuesWithSpread;
|
|
|
|
shadowValuesLength = NS_ARRAY_LENGTH(shadowValuesWithSpread);
|
|
|
|
} else {
|
|
|
|
shadowValues = shadowValuesNoSpread;
|
|
|
|
shadowValuesLength = NS_ARRAY_LENGTH(shadowValuesNoSpread);
|
|
|
|
}
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
for (nsCSSShadowItem *item = aArray->ShadowAt(0),
|
2009-02-20 08:29:21 +03:00
|
|
|
*item_end = item + aArray->Length();
|
2008-07-08 04:56:52 +04:00
|
|
|
item < item_end; ++item) {
|
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(PR_FALSE);
|
|
|
|
if (!itemList || !valueList->AppendCSSValue(itemList)) {
|
|
|
|
delete itemList;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Color is either the specified shadow color or the foreground color
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !itemList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
nscolor shadowColor;
|
|
|
|
if (item->mHasColor) {
|
|
|
|
shadowColor = item->mColor;
|
|
|
|
} else {
|
|
|
|
shadowColor = aDefaultColor;
|
|
|
|
}
|
|
|
|
SetToRGBAColor(val, shadowColor);
|
|
|
|
|
|
|
|
// Set the offsets, blur radius, and spread if available
|
|
|
|
for (PRUint32 i = 0; i < shadowValuesLength; ++i) {
|
|
|
|
val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !itemList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2008-09-13 07:45:37 +04:00
|
|
|
val->SetAppUnits(item->*(shadowValues[i]));
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
2009-02-10 11:45:13 +03:00
|
|
|
|
|
|
|
if (item->mInset && aIsBoxShadow) {
|
|
|
|
// This is an inset box-shadow
|
|
|
|
val = GetROCSSPrimitiveValue();
|
|
|
|
if (!val || !itemList->AppendCSSValue(val)) {
|
|
|
|
delete val;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(NS_STYLE_BOX_SHADOW_INSET,
|
|
|
|
nsCSSProps::kBoxShadowTypeKTable));
|
|
|
|
}
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2008-07-08 04:56:52 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBoxShadow(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
return GetCSSShadowArray(GetStyleBorder()->mBoxShadow,
|
|
|
|
GetStyleColor()->mColor,
|
|
|
|
PR_TRUE, 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);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2009-12-11 07:02:13 +03:00
|
|
|
if (!list->GetListStyleImage()) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
2009-12-11 07:02:13 +03:00
|
|
|
if (list->GetListStyleImage()) {
|
|
|
|
list->GetListStyleImage()->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
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleList()->mListStylePosition,
|
|
|
|
nsCSSProps::kListStylePositionKTable));
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleList()->mListStyleType,
|
|
|
|
nsCSSProps::kListStyleKTable));
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
// create the cssvalues for the sides, stick them in the rect object
|
|
|
|
topVal = GetROCSSPrimitiveValue();
|
|
|
|
rightVal = GetROCSSPrimitiveValue();
|
|
|
|
bottomVal = GetROCSSPrimitiveValue();
|
|
|
|
leftVal = GetROCSSPrimitiveValue();
|
|
|
|
if (topVal && rightVal && bottomVal && leftVal) {
|
|
|
|
nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal,
|
|
|
|
bottomVal, leftVal);
|
|
|
|
if (domRect) {
|
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;
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-01-15 05:25:08 +03:00
|
|
|
}
|
|
|
|
|
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;
|
2009-05-19 02:13:12 +04:00
|
|
|
if (GetLineHeightCoord(lineHeight)) {
|
|
|
|
val->SetAppUnits(lineHeight);
|
|
|
|
} else {
|
|
|
|
SetValueToCoord(val, GetStyleText()->mLineHeight,
|
|
|
|
nsnull, nsCSSProps::kLineHeightKTable);
|
|
|
|
}
|
2002-03-16 20:04:35 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleText()->mTextAlign,
|
|
|
|
nsCSSProps::kTextAlignKTable));
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
PRInt32 intValue = GetStyleTextReset()->mTextDecoration;
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
if (NS_STYLE_TEXT_DECORATION_NONE == intValue) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
nsAutoString decorationString;
|
2009-10-25 06:51:45 +03:00
|
|
|
// Clear the -moz-anchor-decoration bit and the OVERRIDE_ALL bits -- we
|
|
|
|
// don't want these to appear in the computed style.
|
|
|
|
intValue &= ~(NS_STYLE_TEXT_DECORATION_PREF_ANCHORS |
|
|
|
|
NS_STYLE_TEXT_DECORATION_OVERRIDE_ALL);
|
2009-10-22 01:57:57 +04:00
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration, intValue,
|
|
|
|
NS_STYLE_TEXT_DECORATION_UNDERLINE,
|
|
|
|
NS_STYLE_TEXT_DECORATION_BLINK,
|
|
|
|
decorationString);
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
2008-06-06 03:06:34 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextShadow(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
2008-07-08 04:56:52 +04:00
|
|
|
return GetCSSShadowArray(GetStyleText()->mTextShadow,
|
|
|
|
GetStyleColor()->mColor,
|
|
|
|
PR_FALSE, aValue);
|
2008-06-06 03:06:34 +04:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleText()->mTextTransform,
|
|
|
|
nsCSSProps::kTextTransformKTable));
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
2009-09-27 00:23:47 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetMozTabSize(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleText()->mTabSize);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2009-09-27 00:23:47 +04:00
|
|
|
}
|
|
|
|
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2008-12-28 04:58:14 +03:00
|
|
|
val->SetAppUnits(GetStyleText()->mWordSpacing);
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleText()->mWhiteSpace,
|
|
|
|
nsCSSProps::kWhitespaceKTable));
|
2002-03-03 22:44:41 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-03-03 22:44:41 +03:00
|
|
|
}
|
|
|
|
|
2008-10-14 18:44:25 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetWindowShadow(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mWindowShadow,
|
|
|
|
nsCSSProps::kWindowShadowKTable));
|
2008-10-14 18:44:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-10-14 18:44:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-07-24 11:16:18 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetWordWrap(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleText()->mWordWrap,
|
|
|
|
nsCSSProps::kWordwrapKTable));
|
2008-07-24 11:16:18 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2008-07-24 11:16:18 +04:00
|
|
|
}
|
|
|
|
|
2009-08-27 07:53:35 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPointerEvents(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mPointerEvents,
|
|
|
|
nsCSSProps::kPointerEventsKTable));
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2009-08-27 07:53:35 +04: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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mVisible,
|
|
|
|
nsCSSProps::kVisibilityKTable));
|
2001-09-28 11:39:41 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleVisibility()->mDirection,
|
|
|
|
nsCSSProps::kDirectionKTable));
|
2004-01-18 05:42:27 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleTextReset()->mUnicodeBidi,
|
|
|
|
nsCSSProps::kUnicodeBidiKTable));
|
2002-03-13 00:16:22 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(ui->mCursor,
|
|
|
|
nsCSSProps::kCursorKTable));
|
2006-12-30 08:17:59 +03:00
|
|
|
if (!valueList->AppendCSSValue(val)) {
|
|
|
|
delete valueList;
|
|
|
|
delete val;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
2002-03-13 00:16:22 +03:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mAppearance,
|
|
|
|
nsCSSProps::kAppearanceKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxAlign,
|
|
|
|
nsCSSProps::kBoxAlignKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxDirection,
|
|
|
|
nsCSSProps::kBoxDirectionKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxOrient,
|
|
|
|
nsCSSProps::kBoxOrientKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleXUL()->mBoxPack,
|
|
|
|
nsCSSProps::kBoxPackKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStylePosition()->mBoxSizing,
|
|
|
|
nsCSSProps::kBoxSizingKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-04-20 18:30:57 +04:00
|
|
|
}
|
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetBorderImage(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleBorder* border = GetStyleBorder();
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
// none
|
|
|
|
if (!border->GetBorderImage()) {
|
|
|
|
nsROCSSPrimitiveValue *valNone = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(valNone, NS_ERROR_OUT_OF_MEMORY);
|
2009-01-23 04:28:14 +03:00
|
|
|
valNone->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valNone);
|
|
|
|
return NS_OK;
|
2008-07-17 10:30:25 +04:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
// uri
|
|
|
|
nsROCSSPrimitiveValue *valURI = GetROCSSPrimitiveValue();
|
|
|
|
if (!valURI || !valueList->AppendCSSValue(valURI)) {
|
|
|
|
delete valURI;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
border->GetBorderImage()->GetURI(getter_AddRefs(uri));
|
|
|
|
valURI->SetURI(uri);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
// four split numbers
|
|
|
|
NS_FOR_CSS_SIDES(side) {
|
|
|
|
nsROCSSPrimitiveValue *valSplit = GetROCSSPrimitiveValue();
|
|
|
|
if (!valSplit || !valueList->AppendCSSValue(valSplit)) {
|
|
|
|
delete valSplit;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
SetValueToCoord(valSplit, border->mBorderImageSplit.Get(side), nsnull,
|
|
|
|
nsnull);
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
// copy of border-width
|
|
|
|
if (border->mHaveBorderImageWidth) {
|
|
|
|
nsROCSSPrimitiveValue *slash = GetROCSSPrimitiveValue();
|
|
|
|
if (!slash || !valueList->AppendCSSValue(slash)) {
|
|
|
|
delete slash;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
slash->SetString(NS_LITERAL_STRING("/"));
|
|
|
|
NS_FOR_CSS_SIDES(side) {
|
|
|
|
nsROCSSPrimitiveValue *borderWidth = GetROCSSPrimitiveValue();
|
|
|
|
if (!borderWidth || !valueList->AppendCSSValue(borderWidth)) {
|
|
|
|
delete borderWidth;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
nscoord width = GetStyleBorder()->mBorderImageWidth.side(side);
|
|
|
|
borderWidth->SetAppUnits(width);
|
|
|
|
}
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
// first keyword
|
|
|
|
nsROCSSPrimitiveValue *keyword = GetROCSSPrimitiveValue();
|
|
|
|
if (!keyword || !valueList->AppendCSSValue(keyword)) {
|
|
|
|
delete keyword;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2009-01-23 04:28:14 +03:00
|
|
|
keyword->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mBorderImageHFill,
|
|
|
|
nsCSSProps::kBorderImageKTable));
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
// second keyword
|
|
|
|
nsROCSSPrimitiveValue *keyword2 = GetROCSSPrimitiveValue();
|
|
|
|
if (!keyword2 || !valueList->AppendCSSValue(keyword2)) {
|
|
|
|
delete keyword2;
|
|
|
|
delete valueList;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
2009-01-23 04:28:14 +03:00
|
|
|
keyword2->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mBorderImageVFill,
|
|
|
|
nsCSSProps::kBorderImageKTable));
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2008-07-17 10:30:25 +04:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->mFloatEdge,
|
|
|
|
nsCSSProps::kFloatEdgeKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mIMEMode,
|
|
|
|
nsCSSProps::kIMEModeKTable));
|
2007-05-16 19:51:37 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-05-16 19:51:37 +04:00
|
|
|
}
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserFocus,
|
|
|
|
nsCSSProps::kUserFocusKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserInput,
|
|
|
|
nsCSSProps::kUserInputKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleUserInterface()->mUserModify,
|
|
|
|
nsCSSProps::kUserModifyKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleUIReset()->mUserSelect,
|
|
|
|
nsCSSProps::kUserSelectKTable));
|
2002-04-20 18:30:57 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mDisplay,
|
|
|
|
nsCSSProps::kDisplayKTable));
|
2000-05-04 04:07:33 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mPosition,
|
|
|
|
nsCSSProps::kPositionKTable));
|
2004-01-18 05:42:27 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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;
|
2008-12-29 18:07:38 +03:00
|
|
|
if (display->mClipFlags == NS_STYLE_CLIP_AUTO) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
|
|
|
// create the cssvalues for the sides, stick them in the rect object
|
|
|
|
topVal = GetROCSSPrimitiveValue();
|
|
|
|
rightVal = GetROCSSPrimitiveValue();
|
|
|
|
bottomVal = GetROCSSPrimitiveValue();
|
|
|
|
leftVal = GetROCSSPrimitiveValue();
|
|
|
|
if (topVal && rightVal && bottomVal && leftVal) {
|
|
|
|
nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal,
|
|
|
|
bottomVal, leftVal);
|
|
|
|
if (domRect) {
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) {
|
2009-01-23 04:28:14 +03:00
|
|
|
topVal->SetIdent(eCSSKeyword_auto);
|
2006-12-30 08:17:59 +03:00
|
|
|
} else {
|
2007-02-07 10:46:44 +03:00
|
|
|
topVal->SetAppUnits(display->mClip.y);
|
2006-12-30 08:17:59 +03:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) {
|
2009-01-23 04:28:14 +03:00
|
|
|
rightVal->SetIdent(eCSSKeyword_auto);
|
2006-12-30 08:17:59 +03:00
|
|
|
} 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
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) {
|
2009-01-23 04:28:14 +03:00
|
|
|
bottomVal->SetIdent(eCSSKeyword_auto);
|
2006-12-30 08:17:59 +03:00
|
|
|
} 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
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2006-12-30 08:17:59 +03:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) {
|
2009-01-23 04:28:14 +03:00
|
|
|
leftVal->SetIdent(eCSSKeyword_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;
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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;
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2006-12-13 00:16:23 +03:00
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowKTable));
|
2004-09-05 04:04:04 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-09-05 04:04:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowSubKTable));
|
2004-09-05 04:04:04 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2004-09-05 04:04:04 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mOverflowY,
|
|
|
|
nsCSSProps::kOverflowSubKTable));
|
2002-02-16 16:16:10 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-02-16 16:16:10 +03:00
|
|
|
}
|
|
|
|
|
2010-03-19 14:49:33 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetResize(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(GetStyleDisplay()->mResize,
|
|
|
|
nsCSSProps::kResizeKTable));
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2010-03-19 14:49:33 +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) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_always);
|
2007-07-22 21:58:37 +04:00
|
|
|
} else {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetPageBreakBefore(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
const nsStyleDisplay *display = GetStyleDisplay();
|
|
|
|
|
|
|
|
if (display->mBreakBefore) {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_always);
|
2007-07-22 21:58:37 +04:00
|
|
|
} else {
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-22 21:58:37 +04:00
|
|
|
}
|
|
|
|
|
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;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
if (mInnerFrame) {
|
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 &&
|
2008-01-30 00:53:09 +03:00
|
|
|
!(mInnerFrame->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) {
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
val->SetAppUnits(mInnerFrame->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);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-04-23 11:04:33 +04:00
|
|
|
SetValueToCoord(val, positionData->mHeight, nsnull, nsnull,
|
|
|
|
minHeight, maxHeight);
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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;
|
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
if (mInnerFrame) {
|
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 &&
|
2008-01-30 00:53:09 +03:00
|
|
|
!(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced))) {
|
2003-08-06 07:07:12 +04:00
|
|
|
calcWidth = PR_FALSE;
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (calcWidth) {
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 21:43:16 +03:00
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
val->SetAppUnits(mInnerFrame->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);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
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
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side 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
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side 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
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
nsIFrame* container = GetContainingBlockFor(mOuterFrame);
|
2001-11-10 20:29:04 +03:00
|
|
|
if (container) {
|
2008-01-30 00:53:09 +03:00
|
|
|
nsMargin margin = mOuterFrame->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);
|
2008-01-30 00:53:09 +03:00
|
|
|
nsRect rect = mOuterFrame->GetRect();
|
2003-08-06 07:07:12 +04:00
|
|
|
nsRect containerRect = container->GetRect();
|
2010-04-27 20:15:01 +04: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);
|
2009-01-12 22:20:59 +03:00
|
|
|
nsIScrollableFrame *scrollFrame = do_QueryFrame(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
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2010-04-27 20:15:02 +04:00
|
|
|
PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));
|
|
|
|
#define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3)
|
2004-11-30 08:31:37 +03:00
|
|
|
|
2001-11-10 20:29:04 +03:00
|
|
|
nsresult
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side 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();
|
2006-12-30 08:17:59 +03:00
|
|
|
PRInt32 sign = 1;
|
2008-03-06 03:05:26 +03:00
|
|
|
nsStyleCoord coord = positionData->mOffset.Get(aSide);
|
2007-08-17 03:19:25 +04:00
|
|
|
|
|
|
|
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
|
|
|
|
coord.GetUnit() == eStyleUnit_Percent ||
|
|
|
|
coord.GetUnit() == eStyleUnit_Auto,
|
|
|
|
"Unexpected unit");
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-08-17 03:19:25 +04:00
|
|
|
if (coord.GetUnit() == eStyleUnit_Auto) {
|
2008-03-06 03:05:26 +03:00
|
|
|
coord = positionData->mOffset.Get(NS_OPPOSITE_SIDE(aSide));
|
2006-12-30 08:17:59 +03:00
|
|
|
sign = -1;
|
|
|
|
}
|
2007-08-17 03:19:25 +04:00
|
|
|
PercentageBaseGetter baseGetter;
|
|
|
|
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
|
|
|
baseGetter = &nsComputedDOMStyle::GetCBContentWidth;
|
|
|
|
} else {
|
|
|
|
baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2007-08-17 03:19:25 +04:00
|
|
|
val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0));
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
|
2001-11-10 20:29:04 +03:00
|
|
|
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2008-03-06 03:05:26 +03:00
|
|
|
SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide));
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2001-11-10 20:29:04 +03: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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side 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
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
if (!mInnerFrame) {
|
2008-03-06 03:05:26 +03:00
|
|
|
SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide));
|
2006-12-16 02:39:43 +03:00
|
|
|
} else {
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
val->SetAppUnits(mInnerFrame->GetUsedPadding().side(aSide));
|
2001-11-10 20:29:04 +03:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
|
|
{
|
2009-05-19 02:13:12 +04:00
|
|
|
AssertFlushedPendingReflows();
|
|
|
|
|
|
|
|
nscoord blockHeight = NS_AUTOHEIGHT;
|
|
|
|
if (GetStyleText()->mLineHeight.GetUnit() == eStyleUnit_Enumerated) {
|
|
|
|
if (!mInnerFrame)
|
|
|
|
return PR_FALSE;
|
|
|
|
|
|
|
|
if (mInnerFrame->IsContainingBlock()) {
|
|
|
|
blockHeight = mInnerFrame->GetContentRect().height;
|
|
|
|
} else {
|
|
|
|
GetCBContentHeight(blockHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
aCoord = nsHTMLReflowState::CalcLineHeight(mStyleContextHolder,
|
|
|
|
blockHeight);
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-05-05 09:30:10 +04:00
|
|
|
// 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());
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-05-05 09:30:10 +04:00
|
|
|
return PR_TRUE;
|
2002-03-16 20:04:35 +03:00
|
|
|
}
|
|
|
|
|
2002-07-08 11:11:59 +04:00
|
|
|
nsresult
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side 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;
|
|
|
|
}
|
2008-09-12 19:35:53 +04:00
|
|
|
nsresult rv = SetToRGBAColor(primitive, borderColors->mColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete valueList;
|
|
|
|
delete primitive;
|
|
|
|
return rv;
|
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);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2002-07-08 11:11:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2002-07-08 11:11:59 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2002-07-08 11:11:59 +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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side 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;
|
2008-01-30 00:53:09 +03:00
|
|
|
if (mInnerFrame) {
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2008-01-30 00:53:09 +03:00
|
|
|
width = mInnerFrame->GetUsedBorder().side(aSide);
|
2007-01-28 20:20:01 +03:00
|
|
|
} else {
|
2008-07-17 10:30:25 +04:00
|
|
|
width = GetStyleBorder()->GetActualBorderWidth(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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side 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);
|
|
|
|
|
2010-04-27 20:15:01 +04:00
|
|
|
nscolor color;
|
2006-12-30 08:17:59 +03:00
|
|
|
PRBool foreground;
|
2008-09-12 19:35:53 +04:00
|
|
|
GetStyleBorder()->GetBorderColor(aSide, color, foreground);
|
|
|
|
if (foreground) {
|
|
|
|
color = GetStyleColor()->mColor;
|
|
|
|
}
|
2002-09-07 05:48:39 +04:00
|
|
|
|
2008-09-12 19:35:53 +04:00
|
|
|
nsresult rv = SetToRGBAColor(val, color);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
2001-03-30 06:08:48 +04:00
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side 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);
|
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
if (!mInnerFrame) {
|
2008-03-06 03:05:26 +03:00
|
|
|
SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide));
|
2006-12-16 02:39:43 +03:00
|
|
|
} else {
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 21:43:16 +03:00
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
val->SetAppUnits(mInnerFrame->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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
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
|
2010-04-27 20:15:02 +04:00
|
|
|
nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side 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
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->GetBorderStyle(aSide),
|
|
|
|
nsCSSProps::kBorderStyleKTable));
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, 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
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
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");
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
switch (aCoord.GetUnit()) {
|
|
|
|
case eStyleUnit_Normal:
|
2009-01-23 04:28:14 +03:00
|
|
|
aValue->SetIdent(eCSSKeyword_normal);
|
2007-02-20 21:43:16 +03:00
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
case eStyleUnit_Auto:
|
2009-01-23 04:28:14 +03:00
|
|
|
aValue->SetIdent(eCSSKeyword_auto);
|
2007-02-20 21:43:16 +03:00
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
case eStyleUnit_Percent:
|
|
|
|
{
|
|
|
|
nscoord percentageBase;
|
|
|
|
if (aPercentageBaseGetter &&
|
|
|
|
(this->*aPercentageBaseGetter)(percentageBase)) {
|
|
|
|
nscoord val = nscoord(aCoord.GetPercentValue() * percentageBase);
|
2009-09-16 19:01:36 +04:00
|
|
|
aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits)));
|
2007-02-20 21:43:16 +03:00
|
|
|
} else {
|
|
|
|
aValue->SetPercent(aCoord.GetPercentValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
case eStyleUnit_Factor:
|
|
|
|
aValue->SetNumber(aCoord.GetFactorValue());
|
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
case eStyleUnit_Coord:
|
|
|
|
{
|
|
|
|
nscoord val = aCoord.GetCoordValue();
|
2009-09-16 19:01:36 +04:00
|
|
|
aValue->SetAppUnits(NS_MAX(aMinAppUnits, NS_MIN(val, aMaxAppUnits)));
|
2007-02-20 21:43:16 +03:00
|
|
|
}
|
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
case eStyleUnit_Integer:
|
|
|
|
aValue->SetNumber(aCoord.GetIntValue());
|
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
NS_ASSERTION(aTable, "Must have table to handle this case");
|
2009-01-23 04:28:14 +03:00
|
|
|
aValue->SetIdent(nsCSSProps::ValueToKeywordEnum(aCoord.GetIntValue(),
|
|
|
|
aTable));
|
2007-02-20 21:43:16 +03:00
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-05-11 10:01:31 +04:00
|
|
|
case eStyleUnit_None:
|
2009-01-23 04:28:14 +03:00
|
|
|
aValue->SetIdent(eCSSKeyword_none);
|
2007-02-20 21:43:16 +03:00
|
|
|
break;
|
2010-04-27 20:15:01 +04:00
|
|
|
|
2007-02-20 21:43:16 +03:00
|
|
|
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;
|
|
|
|
}
|
2010-04-27 20:15:01 +04:00
|
|
|
|
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)
|
|
|
|
{
|
2008-01-30 00:53:09 +03:00
|
|
|
if (!mOuterFrame) {
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
nsIFrame* container = GetContainingBlockFor(mOuterFrame);
|
2007-02-20 21:43:16 +03:00
|
|
|
if (!container) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 21:43:16 +03:00
|
|
|
|
|
|
|
aWidth = container->GetContentRect().width;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetCBContentHeight(nscoord& aHeight)
|
|
|
|
{
|
2008-01-30 00:53:09 +03:00
|
|
|
if (!mOuterFrame) {
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
nsIFrame* container = GetContainingBlockFor(mOuterFrame);
|
2007-02-20 21:43:16 +03:00
|
|
|
if (!container) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 21:43:16 +03:00
|
|
|
|
|
|
|
aHeight = container->GetContentRect().height;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetFrameBorderRectWidth(nscoord& aWidth)
|
|
|
|
{
|
2008-01-30 00:53:09 +03:00
|
|
|
if (!mInnerFrame) {
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 21:43:16 +03:00
|
|
|
|
2008-01-30 00:53:09 +03:00
|
|
|
aWidth = mInnerFrame->GetSize().width;
|
2007-02-20 21:43:16 +03:00
|
|
|
return PR_TRUE;
|
|
|
|
}
|
2002-10-08 05:53:31 +04:00
|
|
|
|
2008-09-13 13:42:11 +04:00
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetFrameBoundsWidthForTransform(nscoord& aWidth)
|
|
|
|
{
|
|
|
|
// We need a frame to work with.
|
|
|
|
if (!mInnerFrame) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2008-09-13 13:42:11 +04:00
|
|
|
|
|
|
|
// Check to see that we're transformed.
|
|
|
|
if (!mInnerFrame->GetStyleDisplay()->HasTransform())
|
|
|
|
return PR_FALSE;
|
|
|
|
|
|
|
|
aWidth = nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame).width;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRBool
|
|
|
|
nsComputedDOMStyle::GetFrameBoundsHeightForTransform(nscoord& aHeight)
|
|
|
|
{
|
|
|
|
// We need a frame to work with.
|
|
|
|
if (!mInnerFrame) {
|
|
|
|
return PR_FALSE;
|
|
|
|
}
|
|
|
|
|
2009-02-25 03:14:45 +03:00
|
|
|
AssertFlushedPendingReflows();
|
2008-09-13 13:42:11 +04:00
|
|
|
|
|
|
|
// Check to see that we're transformed.
|
|
|
|
if (!mInnerFrame->GetStyleDisplay()->HasTransform())
|
|
|
|
return PR_FALSE;
|
|
|
|
|
|
|
|
aHeight = nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame).height;
|
|
|
|
return PR_TRUE;
|
|
|
|
}
|
|
|
|
|
2007-07-21 18:20:25 +04:00
|
|
|
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:
|
|
|
|
{
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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]);
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeDashoffset(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
SetValueToCoord(val, GetStyleSVG()->mStrokeDashoffset);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeWidth(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
SetValueToCoord(val, GetStyleSVG()->mStrokeWidth);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFillOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVG()->mFillOpacity);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFloodOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVGReset()->mFloodOpacity);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStopOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVGReset()->mStopOpacity);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeMiterlimit(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVG()->mStrokeMiterlimit);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeOpacity(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
val->SetNumber(GetStyleSVG()->mStrokeOpacity);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetClipRule(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(
|
|
|
|
GetStyleSVG()->mClipRule, nsCSSProps::kFillRuleKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetFillRule(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(
|
|
|
|
GetStyleSVG()->mFillRule, nsCSSProps::kFillRuleKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeLinecap(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mStrokeLinecap,
|
|
|
|
nsCSSProps::kStrokeLinecapKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStrokeLinejoin(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mStrokeLinejoin,
|
|
|
|
nsCSSProps::kStrokeLinejoinKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextAnchor(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mTextAnchor,
|
|
|
|
nsCSSProps::kTextAnchorKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColorInterpolation(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mColorInterpolation,
|
|
|
|
nsCSSProps::kColorInterpolationKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetColorInterpolationFilters(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mColorInterpolationFilters,
|
|
|
|
nsCSSProps::kColorInterpolationKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetDominantBaseline(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVGReset()->mDominantBaseline,
|
|
|
|
nsCSSProps::kDominantBaselineKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
2009-03-21 18:36:38 +03:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetImageRendering(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mImageRendering,
|
|
|
|
nsCSSProps::kImageRenderingKTable));
|
2009-03-21 18:36:38 +03:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2009-03-21 18:36:38 +03:00
|
|
|
}
|
|
|
|
|
2007-07-21 18:20:25 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetShapeRendering(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mShapeRendering,
|
|
|
|
nsCSSProps::kShapeRenderingKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTextRendering(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2009-10-22 01:57:57 +04:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(GetStyleSVG()->mTextRendering,
|
|
|
|
nsCSSProps::kTextRenderingKTable));
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2007-07-26 10:57:42 +04:00
|
|
|
nsComputedDOMStyle::GetFloodColor(nsIDOMCSSValue** aValue)
|
2007-07-21 18:20:25 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-07-26 10:57:42 +04:00
|
|
|
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mFloodColor);
|
2007-07-21 18:20:25 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2007-07-26 10:57:42 +04:00
|
|
|
nsComputedDOMStyle::GetLightingColor(nsIDOMCSSValue** aValue)
|
2007-07-21 18:20:25 +04:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2007-07-26 10:57:42 +04:00
|
|
|
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mLightingColor);
|
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-26 10:57:42 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetStopColor(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
|
|
|
|
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
nsresult rv = SetToRGBAColor(val, GetStyleSVGReset()->mStopColor);
|
2007-07-21 18:20:25 +04:00
|
|
|
if (NS_FAILED(rv)) {
|
|
|
|
delete val;
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
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
|
2009-01-23 04:28:14 +03:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = val);
|
|
|
|
return NS_OK;
|
2007-07-21 18:20:25 +04:00
|
|
|
}
|
|
|
|
|
2009-08-21 01:52:47 +04:00
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTransitionDelay(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionDelayCount > 0,
|
|
|
|
"first item must be explicit");
|
|
|
|
PRUint32 i = 0;
|
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
|
|
|
nsROCSSPrimitiveValue* delay = GetROCSSPrimitiveValue();
|
|
|
|
if (!delay || !valueList->AppendCSSValue(delay)) {
|
|
|
|
delete valueList;
|
|
|
|
delete delay;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
delay->SetTime((float)transition->GetDelay() / (float)PR_MSEC_PER_SEC);
|
|
|
|
} while (++i < display->mTransitionDelayCount);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTransitionDuration(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionDurationCount > 0,
|
|
|
|
"first item must be explicit");
|
|
|
|
PRUint32 i = 0;
|
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
|
|
|
nsROCSSPrimitiveValue* duration = GetROCSSPrimitiveValue();
|
|
|
|
if (!duration || !valueList->AppendCSSValue(duration)) {
|
|
|
|
delete valueList;
|
|
|
|
delete duration;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
duration->SetTime((float)transition->GetDuration() / (float)PR_MSEC_PER_SEC);
|
|
|
|
} while (++i < display->mTransitionDurationCount);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTransitionProperty(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionPropertyCount > 0,
|
|
|
|
"first item must be explicit");
|
|
|
|
PRUint32 i = 0;
|
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
|
|
|
nsROCSSPrimitiveValue* property = GetROCSSPrimitiveValue();
|
|
|
|
if (!property || !valueList->AppendCSSValue(property)) {
|
|
|
|
delete valueList;
|
|
|
|
delete property;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
nsCSSProperty cssprop = transition->GetProperty();
|
|
|
|
if (cssprop == eCSSPropertyExtra_all_properties)
|
|
|
|
property->SetIdent(eCSSKeyword_all);
|
|
|
|
else if (cssprop == eCSSPropertyExtra_no_properties)
|
|
|
|
property->SetIdent(eCSSKeyword_none);
|
|
|
|
else if (cssprop == eCSSProperty_UNKNOWN)
|
|
|
|
{
|
2010-02-04 23:49:29 +03:00
|
|
|
nsAutoString escaped;
|
2010-03-08 18:45:00 +03:00
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentAtomString(transition->GetUnknownProperty()), escaped);
|
2010-02-04 23:49:29 +03:00
|
|
|
property->SetString(escaped); // really want SetIdent
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
property->SetString(nsCSSProps::GetStringValue(cssprop));
|
|
|
|
} while (++i < display->mTransitionPropertyCount);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
|
|
|
nsComputedDOMStyle::GetTransitionTimingFunction(nsIDOMCSSValue** aValue)
|
|
|
|
{
|
|
|
|
const nsStyleDisplay* display = GetStyleDisplay();
|
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_TRUE);
|
|
|
|
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionTimingFunctionCount > 0,
|
|
|
|
"first item must be explicit");
|
|
|
|
PRUint32 i = 0;
|
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
|
|
|
nsROCSSPrimitiveValue* timingFunction = GetROCSSPrimitiveValue();
|
|
|
|
if (!timingFunction || !valueList->AppendCSSValue(timingFunction)) {
|
|
|
|
delete valueList;
|
|
|
|
delete timingFunction;
|
|
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
}
|
|
|
|
|
|
|
|
// set the value from the cubic-bezier control points
|
|
|
|
// (We could try to regenerate the keywords if we want.)
|
|
|
|
const nsTimingFunction& tf = transition->GetTimingFunction();
|
|
|
|
timingFunction->SetString(
|
|
|
|
nsPrintfCString(64, "cubic-bezier(%f, %f, %f, %f)",
|
|
|
|
tf.mX1, tf.mY1, tf.mX2, tf.mY2));
|
|
|
|
} while (++i < display->mTransitionTimingFunctionCount);
|
|
|
|
|
2010-06-04 00:11:34 +04:00
|
|
|
NS_ADDREF(*aValue = valueList);
|
|
|
|
return NS_OK;
|
2009-08-21 01:52:47 +04:00
|
|
|
}
|
2007-07-21 18:20:25 +04:00
|
|
|
|
2007-03-23 02:01:14 +03:00
|
|
|
#define COMPUTED_STYLE_MAP_ENTRY(_prop, _method) \
|
2009-02-25 03:14:45 +03:00
|
|
|
{ eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method, PR_FALSE }
|
|
|
|
#define COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_prop, _method) \
|
|
|
|
{ eCSSProperty_##_prop, &nsComputedDOMStyle::Get##_method, PR_TRUE }
|
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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_bottom_width, BorderBottomWidth),
|
2002-10-08 05:53:31 +04:00
|
|
|
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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_left_width, BorderLeftWidth),
|
2002-10-08 05:53:31 +04:00
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_right, BorderRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_color, BorderRightColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_style, BorderRightStyle),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(border_top_width, BorderTopWidth),
|
2002-10-08 05:53:31 +04:00
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(border_width, BorderWidth),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(bottom, Bottom),
|
2002-10-08 05:53:31 +04:00
|
|
|
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),
|
2009-01-29 23:39:18 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_stretch, FontStretch),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_style, FontStyle),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_variant, FontVariant),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(font_weight, FontWeight),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(height, Height),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(left, Left),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(letter_spacing, LetterSpacing),
|
2009-05-19 02:13:12 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(line_height, LineHeight),
|
2002-10-08 05:53:31 +04:00
|
|
|
//// 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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_bottom, MarginBottomWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_left, MarginLeftWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_right, MarginRightWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(margin_top, MarginTopWidth),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(marker_offset, MarkerOffset),
|
|
|
|
// COMPUTED_STYLE_MAP_ENTRY(marks, Marks),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(max_height, MaxHeight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(max_width, MaxWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(min_height, MinHeight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_bottom, PaddingBottom),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_left, PaddingLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_right, PaddingRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(padding_top, PaddingTop),
|
2002-10-08 05:53:31 +04:00
|
|
|
// 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),
|
2009-08-27 07:53:35 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(pointer_events, PointerEvents),
|
2002-10-08 05:53:31 +04:00
|
|
|
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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(right, Right),
|
2002-10-08 05:53:31 +04:00
|
|
|
//// 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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(text_indent, TextIndent),
|
2008-06-06 03:06:34 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_shadow, TextShadow),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(text_transform, TextTransform),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(top, Top),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(unicode_bidi, UnicodeBidi),
|
2009-05-19 02:13:12 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(vertical_align, VerticalAlign),
|
2002-10-08 05:53:31 +04:00
|
|
|
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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(width, Width),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(word_spacing, WordSpacing),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(z_index, ZIndex),
|
|
|
|
|
|
|
|
/* ******************************* *\
|
|
|
|
* Implementations of -moz- styles *
|
|
|
|
\* ******************************* */
|
|
|
|
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(appearance, Appearance),
|
2010-06-09 05:44:33 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_clip, BackgroundClip),
|
2003-01-17 12:33:52 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_background_inline_policy, BackgroundInlinePolicy),
|
2010-06-09 05:44:33 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_origin, BackgroundOrigin),
|
2010-06-09 05:44:33 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(background_size, MozBackgroundSize),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(binding, Binding),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_bottom_colors, BorderBottomColors),
|
2008-07-17 10:30:25 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_image, BorderImage),
|
2002-10-08 05:53:31 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_left_colors, BorderLeftColors),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_right_colors, BorderRightColors),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(border_top_colors, BorderTopColors),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_border_radius_bottomLeft, BorderRadiusBottomLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_border_radius_bottomRight,BorderRadiusBottomRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_border_radius_topLeft, BorderRadiusTopLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_border_radius_topRight, BorderRadiusTopRight),
|
2002-10-08 05:53:31 +04:00
|
|
|
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),
|
2008-07-08 04:56:52 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(box_shadow, BoxShadow),
|
2002-10-08 05:53:31 +04:00
|
|
|
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),
|
2008-07-19 14:38:25 +04:00
|
|
|
//// COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule, ColumnRule),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_color, ColumnRuleColor),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_width, ColumnRuleWidth),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_column_rule_style, ColumnRuleStyle),
|
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),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_bottomLeft, OutlineRadiusBottomLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_bottomRight,OutlineRadiusBottomRight),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_topLeft, OutlineRadiusTopLeft),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_outline_radius_topRight, OutlineRadiusTopRight),
|
2010-03-19 14:49:33 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(resize, Resize),
|
2008-06-05 10:46:24 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(stack_sizing, StackSizing),
|
2009-09-27 00:23:47 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_tab_size, MozTabSize),
|
2009-02-25 03:14:45 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_transform, MozTransform),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY_LAYOUT(_moz_transform_origin, MozTransformOrigin),
|
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),
|
2008-07-24 11:16:18 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(user_select, UserSelect),
|
2009-08-21 01:52:47 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(transition_delay, TransitionDelay),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(transition_duration, TransitionDuration),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(transition_property, TransitionProperty),
|
|
|
|
COMPUTED_STYLE_MAP_ENTRY(transition_timing_function, TransitionTimingFunction),
|
2008-10-14 18:44:25 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(_moz_window_shadow, WindowShadow),
|
2009-12-12 22:43:34 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(word_wrap, WordWrap),
|
2007-07-21 18:20:25 +04:00
|
|
|
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),
|
2007-07-26 10:57:42 +04:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(lighting_color, LightingColor),
|
2009-03-21 18:36:38 +03:00
|
|
|
COMPUTED_STYLE_MAP_ENTRY(image_rendering, ImageRendering),
|
2007-07-21 18:20:25 +04:00
|
|
|
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(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)
|
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|