2001-09-25 01:32:19 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2011-12-22 23:34:45 +00:00
|
|
|
/* vim:set tw=78 expandtab softtabstop=2 ts=2 sw=2: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2006-03-25 05:47:31 +00:00
|
|
|
/* DOM object returned from element.getComputedStyle() */
|
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsComputedDOMStyle.h"
|
|
|
|
|
2013-10-03 10:58:01 +00:00
|
|
|
#include "mozilla/Preferences.h"
|
|
|
|
#include "mozilla/Util.h"
|
|
|
|
|
2012-07-27 14:03:27 +00:00
|
|
|
#include "nsError.h"
|
2004-04-01 19:44:17 +00:00
|
|
|
#include "nsDOMString.h"
|
2008-09-13 09:42:11 +00:00
|
|
|
#include "nsIDOMCSSPrimitiveValue.h"
|
2003-02-22 00:32:13 +00:00
|
|
|
#include "nsStyleContext.h"
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsIScrollableFrame.h"
|
|
|
|
#include "nsContentUtils.h"
|
2013-03-03 00:31:48 +00:00
|
|
|
#include "nsIContent.h"
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2002-03-22 20:18:42 +00:00
|
|
|
#include "nsDOMCSSRect.h"
|
2013-03-03 00:31:48 +00:00
|
|
|
#include "nsDOMCSSRGBColor.h"
|
2012-10-01 16:49:41 +00:00
|
|
|
#include "nsDOMCSSValueList.h"
|
2007-01-30 00:06:41 +00:00
|
|
|
#include "nsGkAtoms.h"
|
2004-11-25 02:43:28 +00:00
|
|
|
#include "nsHTMLReflowState.h"
|
2007-03-08 18:44:45 +00:00
|
|
|
#include "nsStyleUtil.h"
|
2008-07-17 06:30:25 +00:00
|
|
|
#include "nsStyleStructInlines.h"
|
2012-10-01 16:49:41 +00:00
|
|
|
#include "nsROCSSPrimitiveValue.h"
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2004-07-31 23:15:21 +00:00
|
|
|
#include "nsPresContext.h"
|
2001-03-11 20:47:06 +00:00
|
|
|
#include "nsIDocument.h"
|
|
|
|
|
2004-01-17 20:04:26 +00:00
|
|
|
#include "nsCSSPseudoElements.h"
|
2004-01-28 00:18:22 +00:00
|
|
|
#include "nsStyleSet.h"
|
2004-03-09 03:57:51 +00:00
|
|
|
#include "imgIRequest.h"
|
2007-05-05 06:09:50 +00:00
|
|
|
#include "nsLayoutUtils.h"
|
2008-09-13 09:42:11 +00:00
|
|
|
#include "nsCSSKeywords.h"
|
|
|
|
#include "nsStyleCoord.h"
|
|
|
|
#include "nsDisplayList.h"
|
2009-07-13 11:14:57 +00:00
|
|
|
#include "nsDOMCSSDeclaration.h"
|
2013-03-03 00:31:48 +00:00
|
|
|
#include "nsStyleTransformMatrix.h"
|
2010-05-05 18:18:05 +00:00
|
|
|
#include "mozilla/dom/Element.h"
|
2013-08-22 06:29:57 +00:00
|
|
|
#include "prtime.h"
|
2012-08-06 02:55:18 +00:00
|
|
|
#include "nsWrapperCacheInlines.h"
|
2013-09-23 11:55:35 +00:00
|
|
|
#include "mozilla/AppUnits.h"
|
2013-01-15 12:22:03 +00:00
|
|
|
#include <algorithm>
|
2010-04-30 13:12:06 +00:00
|
|
|
|
2011-10-11 05:50:08 +00:00
|
|
|
using namespace mozilla;
|
2010-04-30 13:12:06 +00:00
|
|
|
using namespace mozilla::dom;
|
2004-01-17 20:04:26 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
#if defined(DEBUG_bzbarsky) || defined(DEBUG_caillon)
|
|
|
|
#define DEBUG_ComputedDOMStyle
|
|
|
|
#endif
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
/*
|
|
|
|
* This is the implementation of the readonly CSSStyleDeclaration that is
|
|
|
|
* returned by the getComputedStyle() function.
|
|
|
|
*/
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
static nsComputedDOMStyle *sCachedComputedDOMStyle;
|
|
|
|
|
2012-07-06 12:28:33 +00:00
|
|
|
already_AddRefed<nsComputedDOMStyle>
|
|
|
|
NS_NewComputedDOMStyle(dom::Element* aElement, const nsAString& aPseudoElt,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
nsComputedDOMStyle::StyleType aStyleType)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2009-07-13 11:14:57 +00:00
|
|
|
nsRefPtr<nsComputedDOMStyle> computedStyle;
|
2002-07-08 07:11:59 +00:00
|
|
|
if (sCachedComputedDOMStyle) {
|
|
|
|
// There's an unused nsComputedDOMStyle cached, use it.
|
|
|
|
// But before we use it, re-initialize the object.
|
|
|
|
|
|
|
|
// Oh yeah baby, placement new!
|
2012-07-06 12:28:33 +00:00
|
|
|
computedStyle = new (sCachedComputedDOMStyle)
|
2012-10-17 21:01:56 +00:00
|
|
|
nsComputedDOMStyle(aElement, aPseudoElt, aPresShell, aStyleType);
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
sCachedComputedDOMStyle = nullptr;
|
2002-07-08 07:11:59 +00:00
|
|
|
} else {
|
|
|
|
// No nsComputedDOMStyle cached, create a new one.
|
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
computedStyle = new nsComputedDOMStyle(aElement, aPseudoElt, aPresShell,
|
|
|
|
aStyleType);
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2012-07-06 12:28:33 +00:00
|
|
|
return computedStyle.forget();
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2013-10-03 10:58:01 +00:00
|
|
|
/**
|
|
|
|
* An object that represents the ordered set of properties that are exposed on
|
|
|
|
* an nsComputedDOMStyle object and how their computed values can be obtained.
|
|
|
|
*/
|
|
|
|
struct nsComputedStyleMap
|
|
|
|
{
|
|
|
|
friend class nsComputedDOMStyle;
|
|
|
|
|
|
|
|
struct Entry
|
|
|
|
{
|
|
|
|
// Create a pointer-to-member-function type.
|
|
|
|
typedef mozilla::dom::CSSValue* (nsComputedDOMStyle::*ComputeMethod)();
|
|
|
|
|
|
|
|
nsCSSProperty mProperty;
|
|
|
|
ComputeMethod mGetter;
|
|
|
|
|
|
|
|
bool IsLayoutFlushNeeded() const
|
|
|
|
{
|
|
|
|
return nsCSSProps::PropHasFlags(mProperty,
|
|
|
|
CSS_PROPERTY_GETCS_NEEDS_LAYOUT_FLUSH);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool IsEnabled() const
|
|
|
|
{
|
|
|
|
return nsCSSProps::IsEnabled(mProperty);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
// We define this enum just to count the total number of properties that can
|
|
|
|
// be exposed on an nsComputedDOMStyle, including properties that may be
|
|
|
|
// disabled.
|
|
|
|
enum {
|
|
|
|
#define COMPUTED_STYLE_PROP(prop_, method_) \
|
|
|
|
eComputedStyleProperty_##prop_,
|
|
|
|
#include "nsComputedDOMStylePropertyList.h"
|
|
|
|
#undef COMPUTED_STYLE_PROP
|
|
|
|
eComputedStyleProperty_COUNT
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the number of properties that should be exposed on an
|
|
|
|
* nsComputedDOMStyle, ecxluding any disabled properties.
|
|
|
|
*/
|
|
|
|
uint32_t Length()
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
return mExposedPropertyCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns the property at the given index in the list of properties
|
|
|
|
* that should be exposed on an nsComputedDOMStyle, excluding any
|
|
|
|
* disabled properties.
|
|
|
|
*/
|
|
|
|
nsCSSProperty PropertyAt(uint32_t aIndex)
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
return kEntries[EntryIndex(aIndex)].mProperty;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Searches for and returns the computed style map entry for the given
|
|
|
|
* property, or nullptr if the property is not exposed on nsComputedDOMStyle
|
|
|
|
* or is currently disabled.
|
|
|
|
*/
|
|
|
|
const Entry* FindEntryForProperty(nsCSSProperty aPropID)
|
|
|
|
{
|
|
|
|
Update();
|
|
|
|
for (uint32_t i = 0; i < mExposedPropertyCount; i++) {
|
|
|
|
const Entry* entry = &kEntries[EntryIndex(i)];
|
|
|
|
if (entry->mProperty == aPropID) {
|
|
|
|
return entry;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Records that mIndexMap needs updating, due to prefs changing that could
|
|
|
|
* affect the set of properties exposed on an nsComputedDOMStyle.
|
|
|
|
*/
|
|
|
|
void MarkDirty() { mExposedPropertyCount = 0; }
|
|
|
|
|
|
|
|
// The member variables are public so that we can use an initializer in
|
|
|
|
// nsComputedDOMStyle::GetComputedStyleMap. Use the member functions
|
|
|
|
// above to get information from this object.
|
|
|
|
|
|
|
|
/**
|
|
|
|
* An entry for each property that can be exposed on an nsComputedDOMStyle.
|
|
|
|
*/
|
|
|
|
const Entry kEntries[eComputedStyleProperty_COUNT];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The number of properties that should be exposed on an nsComputedDOMStyle.
|
|
|
|
* This will be less than eComputedStyleProperty_COUNT if some property
|
|
|
|
* prefs are disabled. A value of 0 indicates that it and mIndexMap are out
|
|
|
|
* of date.
|
|
|
|
*/
|
|
|
|
uint32_t mExposedPropertyCount;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* A map of indexes on the nsComputedDOMStyle object to indexes into kEntries.
|
|
|
|
*/
|
|
|
|
uint32_t mIndexMap[eComputedStyleProperty_COUNT];
|
|
|
|
|
|
|
|
private:
|
|
|
|
/**
|
|
|
|
* Returns whether mExposedPropertyCount and mIndexMap are out of date.
|
|
|
|
*/
|
|
|
|
bool IsDirty() { return mExposedPropertyCount == 0; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Updates mExposedPropertyCount and mIndexMap to take into account properties
|
|
|
|
* whose prefs are currently disabled.
|
|
|
|
*/
|
|
|
|
void Update();
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Maps an nsComputedDOMStyle indexed getter index to an index into kEntries.
|
|
|
|
*/
|
|
|
|
uint32_t EntryIndex(uint32_t aIndex) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aIndex < mExposedPropertyCount);
|
|
|
|
return mIndexMap[aIndex];
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
void
|
|
|
|
nsComputedStyleMap::Update()
|
|
|
|
{
|
|
|
|
if (!IsDirty()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t index = 0;
|
|
|
|
for (uint32_t i = 0; i < eComputedStyleProperty_COUNT; i++) {
|
|
|
|
if (kEntries[i].IsEnabled()) {
|
|
|
|
mIndexMap[index++] = i;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
mExposedPropertyCount = index;
|
|
|
|
}
|
|
|
|
|
2012-07-06 12:28:33 +00:00
|
|
|
nsComputedDOMStyle::nsComputedDOMStyle(dom::Element* aElement,
|
|
|
|
const nsAString& aPseudoElt,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
StyleType aStyleType)
|
2012-07-30 14:20:58 +00:00
|
|
|
: mDocumentWeak(nullptr), mOuterFrame(nullptr),
|
|
|
|
mInnerFrame(nullptr), mPresShell(nullptr),
|
2012-10-17 21:01:56 +00:00
|
|
|
mStyleType(aStyleType),
|
2011-10-17 14:59:28 +00:00
|
|
|
mExposeVisitedStyle(false)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2012-07-06 12:28:33 +00:00
|
|
|
MOZ_ASSERT(aElement && aPresShell);
|
|
|
|
|
|
|
|
mDocumentWeak = do_GetWeakReference(aPresShell->GetDocument());
|
|
|
|
|
|
|
|
mContent = aElement;
|
|
|
|
|
|
|
|
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;
|
|
|
|
bool haveTwoColons = true;
|
|
|
|
if (start == end || *start != PRUnichar(':')) {
|
|
|
|
--start;
|
|
|
|
haveTwoColons = false;
|
|
|
|
}
|
|
|
|
mPseudo = do_GetAtom(Substring(start, end));
|
|
|
|
MOZ_ASSERT(mPseudo);
|
|
|
|
|
|
|
|
// There aren't any non-CSS2 pseudo-elements with a single ':'
|
|
|
|
if (!haveTwoColons &&
|
2013-04-18 05:21:46 +00:00
|
|
|
(!nsCSSPseudoElements::IsPseudoElement(mPseudo) ||
|
|
|
|
!nsCSSPseudoElements::IsCSS2PseudoElement(mPseudo))) {
|
2012-07-06 12:28:33 +00:00
|
|
|
// XXXbz I'd really rather we threw an exception or something, but
|
|
|
|
// the DOM spec sucks.
|
2012-07-30 14:20:58 +00:00
|
|
|
mPseudo = nullptr;
|
2012-07-06 12:28:33 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-07-24 12:20:35 +00:00
|
|
|
MOZ_ASSERT(aPresShell->GetPresContext());
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::~nsComputedDOMStyle()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::Shutdown()
|
|
|
|
{
|
|
|
|
// We want to de-allocate without calling the dtor since we
|
|
|
|
// already did that manually in doDestroyComputedDOMStyle(),
|
|
|
|
// so cast our cached object to something that doesn't know
|
|
|
|
// about our dtor.
|
2007-07-08 07:08:04 +00:00
|
|
|
delete reinterpret_cast<char*>(sCachedComputedDOMStyle);
|
2012-07-30 14:20:58 +00:00
|
|
|
sCachedComputedDOMStyle = nullptr;
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2012-08-06 02:16:30 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE_1(nsComputedDOMStyle, mContent)
|
|
|
|
|
2012-02-15 23:29:53 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_BEGIN(nsComputedDOMStyle)
|
2012-08-06 02:16:30 +00:00
|
|
|
return tmp->IsBlack();
|
2012-02-15 23:29:53 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_BEGIN(nsComputedDOMStyle)
|
2012-08-06 02:16:30 +00:00
|
|
|
return tmp->IsBlack();
|
2012-02-15 23:29:53 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_IN_CC_END
|
|
|
|
|
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_BEGIN(nsComputedDOMStyle)
|
2012-08-06 02:16:30 +00:00
|
|
|
return tmp->IsBlack();
|
2012-02-15 23:29:53 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_CAN_SKIP_THIS_END
|
|
|
|
|
2003-07-11 20:44:25 +00:00
|
|
|
// QueryInterface implementation for nsComputedDOMStyle
|
2012-08-06 02:16:30 +00:00
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsComputedDOMStyle)
|
2009-07-13 11:14:57 +00:00
|
|
|
NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
|
2011-05-04 07:26:41 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
|
2000-05-04 00:07:33 +00:00
|
|
|
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
static void doDestroyComputedDOMStyle(nsComputedDOMStyle *aComputedStyle)
|
|
|
|
{
|
|
|
|
if (!sCachedComputedDOMStyle) {
|
|
|
|
// The cache is empty, store aComputedStyle in the cache.
|
|
|
|
|
|
|
|
sCachedComputedDOMStyle = aComputedStyle;
|
|
|
|
sCachedComputedDOMStyle->~nsComputedDOMStyle();
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2002-07-08 07:11:59 +00:00
|
|
|
// The cache is full, delete aComputedStyle
|
|
|
|
|
|
|
|
delete aComputedStyle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-11-27 17:44:26 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsComputedDOMStyle)
|
|
|
|
NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(nsComputedDOMStyle,
|
|
|
|
doDestroyComputedDOMStyle(this))
|
2000-05-04 00:07:33 +00:00
|
|
|
|
|
|
|
|
2004-06-08 01:32:29 +00:00
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComputedDOMStyle::GetPropertyValue(const nsCSSProperty aPropID,
|
|
|
|
nsAString& aValue)
|
|
|
|
{
|
|
|
|
// This is mostly to avoid code duplication with GetPropertyCSSValue(); if
|
|
|
|
// perf ever becomes an issue here (doubtful), we can look into changing
|
|
|
|
// this.
|
|
|
|
return GetPropertyValue(
|
|
|
|
NS_ConvertASCIItoUTF16(nsCSSProps::GetStringValue(aPropID)),
|
|
|
|
aValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
|
|
|
nsComputedDOMStyle::SetPropertyValue(const nsCSSProperty aPropID,
|
|
|
|
const nsAString& aValue)
|
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetCssText(nsAString& aCssText)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
aCssText.Truncate();
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::SetCssText(const nsAString& aCssText)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-08-22 15:56:38 +00:00
|
|
|
nsComputedDOMStyle::GetLength(uint32_t* aLength)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2002-10-08 01:53:31 +00:00
|
|
|
NS_PRECONDITION(aLength, "Null aLength! Prepare to die!");
|
|
|
|
|
2013-10-03 10:58:01 +00:00
|
|
|
*aLength = GetComputedStyleMap()->Length();
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2000-05-15 01:59:05 +00:00
|
|
|
nsComputedDOMStyle::GetParentRule(nsIDOMCSSRule** aParentRule)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
*aParentRule = nullptr;
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetPropertyValue(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-06-14 00:06:36 +00:00
|
|
|
aReturn.Truncate();
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
ErrorResult error;
|
|
|
|
nsRefPtr<CSSValue> val = GetPropertyCSSValue(aPropertyName, error);
|
|
|
|
if (error.Failed()) {
|
|
|
|
return error.ErrorCode();
|
|
|
|
}
|
2000-06-14 00:06:36 +00:00
|
|
|
|
|
|
|
if (val) {
|
2012-10-01 16:49:41 +00:00
|
|
|
nsString text;
|
|
|
|
val->GetCssText(text, error);
|
|
|
|
aReturn.Assign(text);
|
|
|
|
return error.ErrorCode();
|
2000-06-14 00:06:36 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2009-08-10 22:52:29 +00:00
|
|
|
/* static */
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 13:12:06 +00:00
|
|
|
nsComputedDOMStyle::GetStyleContextForElement(Element* aElement,
|
2009-08-10 22:52:29 +00:00
|
|
|
nsIAtom* aPseudo,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
StyleType aStyleType)
|
2009-08-10 22:52:29 +00:00
|
|
|
{
|
2010-10-07 04:25:44 +00:00
|
|
|
// If the content has a pres shell, we must use it. Otherwise we'd
|
|
|
|
// potentially mix rule trees by using the wrong pres shell's style
|
|
|
|
// set. Using the pres shell from the content also means that any
|
|
|
|
// content that's actually *in* a document will get the style from the
|
|
|
|
// correct document.
|
2013-10-14 19:11:47 +00:00
|
|
|
nsCOMPtr<nsIPresShell> presShell = GetPresShellForContent(aElement);
|
2010-10-07 04:25:44 +00:00
|
|
|
if (!presShell) {
|
|
|
|
presShell = aPresShell;
|
|
|
|
if (!presShell)
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
2010-10-07 04:25:44 +00:00
|
|
|
presShell->FlushPendingNotifications(Flush_Style);
|
2009-12-11 07:37:40 +00:00
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
return GetStyleContextForElementNoFlush(aElement, aPseudo, presShell,
|
|
|
|
aStyleType);
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* static */
|
|
|
|
already_AddRefed<nsStyleContext>
|
2010-04-30 13:12:06 +00:00
|
|
|
nsComputedDOMStyle::GetStyleContextForElementNoFlush(Element* aElement,
|
2009-08-20 21:52:47 +00:00
|
|
|
nsIAtom* aPseudo,
|
2012-10-17 21:01:56 +00:00
|
|
|
nsIPresShell* aPresShell,
|
|
|
|
StyleType aStyleType)
|
2009-08-20 21:52:47 +00:00
|
|
|
{
|
2010-04-30 13:12:06 +00:00
|
|
|
NS_ABORT_IF_FALSE(aElement, "NULL element");
|
2010-10-07 04:25:44 +00:00
|
|
|
// If the content has a pres shell, we must use it. Otherwise we'd
|
|
|
|
// potentially mix rule trees by using the wrong pres shell's style
|
|
|
|
// set. Using the pres shell from the content also means that any
|
|
|
|
// content that's actually *in* a document will get the style from the
|
|
|
|
// correct document.
|
|
|
|
nsIPresShell *presShell = GetPresShellForContent(aElement);
|
|
|
|
if (!presShell) {
|
|
|
|
presShell = aPresShell;
|
|
|
|
if (!presShell)
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
if (!aPseudo && aStyleType == eAll) {
|
2013-06-25 05:32:10 +00:00
|
|
|
nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement);
|
2009-08-10 22:52:29 +00:00
|
|
|
if (frame) {
|
2013-06-25 05:32:10 +00:00
|
|
|
nsStyleContext* result = frame->StyleContext();
|
2009-08-10 22:52:29 +00: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
|
2013-04-22 11:15:59 +00:00
|
|
|
nsRefPtr<nsStyleContext> ret = result;
|
|
|
|
return ret.forget();
|
2009-08-10 22:52:29 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
// No frame has been created, or we have a pseudo, or we're looking
|
|
|
|
// for the default style, so resolve the style ourselves.
|
2009-08-10 22:52:29 +00:00
|
|
|
nsRefPtr<nsStyleContext> parentContext;
|
2010-04-30 13:12:06 +00:00
|
|
|
nsIContent* parent = aPseudo ? aElement : aElement->GetParent();
|
2009-08-14 02:09:49 +00:00
|
|
|
// Don't resolve parent context for document fragments.
|
2010-04-30 13:12:06 +00:00
|
|
|
if (parent && parent->IsElement())
|
|
|
|
parentContext = GetStyleContextForElementNoFlush(parent->AsElement(),
|
2012-10-17 21:01:56 +00:00
|
|
|
nullptr, presShell,
|
|
|
|
aStyleType);
|
2009-08-10 22:52:29 +00:00
|
|
|
|
2010-10-07 04:25:44 +00:00
|
|
|
nsPresContext *presContext = presShell->GetPresContext();
|
2009-08-10 22:52:29 +00:00
|
|
|
if (!presContext)
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2009-08-10 22:52:29 +00:00
|
|
|
|
2010-10-07 04:25:44 +00:00
|
|
|
nsStyleSet *styleSet = presShell->StyleSet();
|
2009-08-10 22:52:29 +00:00
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
nsRefPtr<nsStyleContext> sc;
|
2009-08-10 22:52:29 +00:00
|
|
|
if (aPseudo) {
|
2009-12-11 07:37:40 +00:00
|
|
|
nsCSSPseudoElements::Type type = nsCSSPseudoElements::GetPseudoType(aPseudo);
|
|
|
|
if (type >= nsCSSPseudoElements::ePseudo_PseudoElementCount) {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2009-12-11 07:37:40 +00:00
|
|
|
}
|
2012-10-17 21:01:56 +00:00
|
|
|
sc = styleSet->ResolvePseudoElementStyle(aElement, type, parentContext);
|
|
|
|
} else {
|
|
|
|
sc = styleSet->ResolveStyleFor(aElement, parentContext);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (aStyleType == eDefaultOnly) {
|
|
|
|
// We really only want the user and UA rules. Filter out the other ones.
|
|
|
|
nsTArray< nsCOMPtr<nsIStyleRule> > rules;
|
2013-02-16 21:04:53 +00:00
|
|
|
for (nsRuleNode* ruleNode = sc->RuleNode();
|
2012-10-17 21:01:56 +00:00
|
|
|
!ruleNode->IsRoot();
|
|
|
|
ruleNode = ruleNode->GetParent()) {
|
|
|
|
if (ruleNode->GetLevel() == nsStyleSet::eAgentSheet ||
|
|
|
|
ruleNode->GetLevel() == nsStyleSet::eUserSheet) {
|
|
|
|
rules.AppendElement(ruleNode->GetRule());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// We want to build a list of user/ua rules that is in order from least to
|
|
|
|
// most important, so we have to reverse the list.
|
|
|
|
// Integer division to get "stop" is purposeful here: if length is odd, we
|
|
|
|
// don't have to do anything with the middle element of the array.
|
|
|
|
for (uint32_t i = 0, length = rules.Length(), stop = length / 2;
|
|
|
|
i < stop; ++i) {
|
|
|
|
rules[i].swap(rules[length - i - 1]);
|
|
|
|
}
|
|
|
|
|
|
|
|
sc = styleSet->ResolveStyleForRules(parentContext, rules);
|
2009-08-10 22:52:29 +00:00
|
|
|
}
|
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
return sc.forget();
|
2009-08-10 22:52:29 +00:00
|
|
|
}
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2013-04-04 14:00:07 +00:00
|
|
|
nsMargin
|
|
|
|
nsComputedDOMStyle::GetAdjustedValuesForBoxSizing()
|
|
|
|
{
|
|
|
|
// We want the width/height of whatever parts 'width' or 'height' controls,
|
|
|
|
// which can be different depending on the value of the 'box-sizing' property.
|
|
|
|
const nsStylePosition* stylePos = StylePosition();
|
2013-04-05 15:52:59 +00:00
|
|
|
|
2013-04-04 18:54:05 +00:00
|
|
|
nsMargin adjustment;
|
2013-04-04 14:00:07 +00:00
|
|
|
switch(stylePos->mBoxSizing) {
|
|
|
|
case NS_STYLE_BOX_SIZING_BORDER:
|
2013-04-04 18:54:05 +00:00
|
|
|
adjustment += mInnerFrame->GetUsedBorder();
|
2013-04-04 14:00:07 +00:00
|
|
|
// fall through
|
|
|
|
|
|
|
|
case NS_STYLE_BOX_SIZING_PADDING:
|
2013-04-04 18:54:05 +00:00
|
|
|
adjustment += mInnerFrame->GetUsedPadding();
|
2013-04-04 14:00:07 +00:00
|
|
|
}
|
|
|
|
|
2013-04-04 18:54:05 +00:00
|
|
|
return adjustment;
|
2013-04-04 14:00:07 +00:00
|
|
|
}
|
|
|
|
|
2009-08-20 21:52:47 +00:00
|
|
|
/* static */
|
|
|
|
nsIPresShell*
|
|
|
|
nsComputedDOMStyle::GetPresShellForContent(nsIContent* aContent)
|
|
|
|
{
|
|
|
|
nsIDocument* currentDoc = aContent->GetCurrentDoc();
|
|
|
|
if (!currentDoc)
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2009-08-20 21:52:47 +00:00
|
|
|
|
2010-06-25 13:59:57 +00:00
|
|
|
return currentDoc->GetShell();
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
2010-07-14 20:58:56 +00:00
|
|
|
// nsDOMCSSDeclaration abstract methods which should never be called
|
|
|
|
// on a nsComputedDOMStyle object, but must be defined to avoid
|
|
|
|
// compile errors.
|
2010-07-23 18:00:34 +00:00
|
|
|
css::Declaration*
|
2011-09-29 06:19:26 +00:00
|
|
|
nsComputedDOMStyle::GetCSSDeclaration(bool)
|
2010-07-14 20:58:56 +00:00
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSDeclaration");
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-07-14 20:58:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2010-07-23 18:00:47 +00:00
|
|
|
nsComputedDOMStyle::SetCSSDeclaration(css::Declaration*)
|
2010-07-14 20:58:56 +00:00
|
|
|
{
|
2010-07-23 18:00:47 +00:00
|
|
|
NS_RUNTIMEABORT("called nsComputedDOMStyle::SetCSSDeclaration");
|
2010-07-14 20:58:56 +00:00
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsIDocument*
|
|
|
|
nsComputedDOMStyle::DocToUpdate()
|
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("called nsComputedDOMStyle::DocToUpdate");
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2010-07-14 20:58:56 +00:00
|
|
|
}
|
|
|
|
|
2011-04-27 20:53:49 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::GetCSSParsingEnvironment(CSSParsingEnvironment& aCSSParseEnv)
|
2010-07-14 20:58:56 +00:00
|
|
|
{
|
|
|
|
NS_RUNTIMEABORT("called nsComputedDOMStyle::GetCSSParsingEnvironment");
|
2011-04-27 20:53:49 +00:00
|
|
|
// Just in case NS_RUNTIMEABORT ever stops killing us for some reason
|
2012-07-30 14:20:58 +00:00
|
|
|
aCSSParseEnv.mPrincipal = nullptr;
|
2010-07-14 20:58:56 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
already_AddRefed<CSSValue>
|
|
|
|
nsComputedDOMStyle::GetPropertyCSSValue(const nsAString& aPropertyName, ErrorResult& aRv)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2009-08-10 22:52:29 +00:00
|
|
|
NS_ASSERTION(!mStyleContextHolder, "bad state");
|
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
nsCOMPtr<nsIDocument> document = do_QueryReferent(mDocumentWeak);
|
2012-10-01 16:49:41 +00:00
|
|
|
if (!document) {
|
|
|
|
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2011-11-14 03:24:41 +00:00
|
|
|
document->FlushPendingLinkUpdates();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2012-07-13 23:59:05 +00:00
|
|
|
nsCSSProperty prop = nsCSSProps::LookupProperty(aPropertyName,
|
|
|
|
nsCSSProps::eEnabled);
|
2009-02-25 00:14:45 +00:00
|
|
|
|
2012-09-18 18:37:14 +00:00
|
|
|
// We don't (for now, anyway, though it may make sense to change it
|
|
|
|
// for all aliases, including those in nsCSSPropAliasList) want
|
|
|
|
// aliases to be enumerable (via GetLength and IndexedGetter), so
|
|
|
|
// handle them here rather than adding entries to
|
2013-10-03 10:58:01 +00:00
|
|
|
// the nsComputedStyleMap.
|
2012-09-18 19:51:47 +00:00
|
|
|
if (prop != eCSSProperty_UNKNOWN &&
|
|
|
|
nsCSSProps::PropHasFlags(prop, CSS_PROPERTY_IS_ALIAS)) {
|
2012-09-18 18:37:14 +00:00
|
|
|
const nsCSSProperty* subprops = nsCSSProps::SubpropertyEntryFor(prop);
|
|
|
|
NS_ABORT_IF_FALSE(subprops[1] == eCSSProperty_UNKNOWN,
|
|
|
|
"must have list of length 1");
|
|
|
|
prop = subprops[0];
|
|
|
|
}
|
|
|
|
|
2013-10-03 10:58:01 +00:00
|
|
|
const nsComputedStyleMap::Entry* propEntry =
|
|
|
|
GetComputedStyleMap()->FindEntryForProperty(prop);
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
if (!propEntry) {
|
|
|
|
#ifdef DEBUG_ComputedDOMStyle
|
2010-04-27 16:15:01 +00:00
|
|
|
NS_WARNING(PromiseFlatCString(NS_ConvertUTF16toUTF8(aPropertyName) +
|
2009-02-25 00:14:45 +00:00
|
|
|
NS_LITERAL_CSTRING(" is not queryable!")).get());
|
|
|
|
#endif
|
|
|
|
|
|
|
|
// NOTE: For branches, we should flush here for compatibility!
|
2012-10-01 16:49:41 +00:00
|
|
|
return nullptr;
|
2009-02-25 00:14:45 +00:00
|
|
|
}
|
|
|
|
|
2005-06-03 01:51:15 +00:00
|
|
|
// Flush _before_ getting the presshell, since that could create a new
|
|
|
|
// presshell. Also note that we want to flush the style on the document
|
|
|
|
// we're computing style in, not on the document mContent is in -- the two
|
|
|
|
// may be different.
|
2009-02-25 00:14:45 +00:00
|
|
|
document->FlushPendingNotifications(
|
2013-09-23 13:28:55 +00:00
|
|
|
propEntry->IsLayoutFlushNeeded() ? Flush_Layout : Flush_Style);
|
2009-02-25 00:14:45 +00:00
|
|
|
#ifdef DEBUG
|
2013-09-23 13:28:55 +00:00
|
|
|
mFlushedPendingReflows = propEntry->IsLayoutFlushNeeded();
|
2009-02-25 00:14:45 +00:00
|
|
|
#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 16:46:42 +00:00
|
|
|
|
2010-06-25 13:59:57 +00:00
|
|
|
mPresShell = document->GetShell();
|
2012-10-01 16:49:41 +00:00
|
|
|
if (!mPresShell || !mPresShell->GetPresContext()) {
|
|
|
|
aRv.Throw(NS_ERROR_NOT_AVAILABLE);
|
|
|
|
return nullptr;
|
|
|
|
}
|
2004-05-27 22:08:42 +00:00
|
|
|
|
2012-10-17 21:01:56 +00:00
|
|
|
if (!mPseudo && mStyleType == eAll) {
|
2011-04-12 06:18:44 +00:00
|
|
|
mOuterFrame = mContent->GetPrimaryFrame();
|
|
|
|
mInnerFrame = mOuterFrame;
|
|
|
|
if (mOuterFrame) {
|
|
|
|
nsIAtom* type = mOuterFrame->GetType();
|
|
|
|
if (type == nsGkAtoms::tableOuterFrame) {
|
|
|
|
// If the frame is an outer table frame then we should get the style
|
|
|
|
// from the inner table frame.
|
2011-08-24 20:54:30 +00:00
|
|
|
mInnerFrame = mOuterFrame->GetFirstPrincipalChild();
|
2011-04-12 06:18:44 +00:00
|
|
|
NS_ASSERTION(mInnerFrame, "Outer table must have an inner");
|
|
|
|
NS_ASSERTION(!mInnerFrame->GetNextSibling(),
|
|
|
|
"Outer table frames should have just one child, "
|
|
|
|
"the inner table");
|
|
|
|
}
|
2007-05-05 05:30:10 +00:00
|
|
|
|
2013-02-16 05:38:33 +00:00
|
|
|
mStyleContextHolder = mInnerFrame->StyleContext();
|
2011-04-12 06:18:44 +00:00
|
|
|
NS_ASSERTION(mStyleContextHolder, "Frame without style context?");
|
|
|
|
}
|
2006-12-30 05:17:59 +00:00
|
|
|
}
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2009-08-10 22:52:29 +00: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();
|
|
|
|
}
|
2013-11-06 11:38:58 +00:00
|
|
|
NS_ASSERTION(nsCSSPseudoElements::PseudoElementContainsElements(
|
2013-11-17 18:33:56 +00:00
|
|
|
topWithPseudoElementData->GetPseudoType()),
|
2013-11-06 11:38:58 +00:00
|
|
|
"we should be in a pseudo-element that is expected to "
|
|
|
|
"contain elements");
|
2009-08-10 22:52:29 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
// Need to resolve a style context
|
|
|
|
mStyleContextHolder =
|
2010-04-30 13:12:06 +00:00
|
|
|
nsComputedDOMStyle::GetStyleContextForElement(mContent->AsElement(),
|
2009-08-10 22:52:29 +00:00
|
|
|
mPseudo,
|
2012-10-17 21:01:56 +00:00
|
|
|
mPresShell,
|
|
|
|
mStyleType);
|
2012-10-01 16:49:41 +00:00
|
|
|
if (!mStyleContextHolder) {
|
|
|
|
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2009-08-10 22:52:29 +00:00
|
|
|
NS_ASSERTION(mPseudo || !mStyleContextHolder->HasPseudoElementData(),
|
|
|
|
"should not have pseudo-element data");
|
|
|
|
}
|
|
|
|
|
2010-04-03 01:58:25 +00:00
|
|
|
// mExposeVisitedStyle is set to true only by testing APIs that
|
2012-10-25 23:10:53 +00:00
|
|
|
// require chrome privilege.
|
2010-04-03 01:58:25 +00:00
|
|
|
NS_ABORT_IF_FALSE(!mExposeVisitedStyle ||
|
2012-10-25 23:10:53 +00:00
|
|
|
nsContentUtils::IsCallerChrome(),
|
2010-04-03 01:58:25 +00:00
|
|
|
"mExposeVisitedStyle set incorrectly");
|
|
|
|
if (mExposeVisitedStyle && mStyleContextHolder->RelevantLinkVisited()) {
|
|
|
|
nsStyleContext *styleIfVisited = mStyleContextHolder->GetStyleIfVisited();
|
|
|
|
if (styleIfVisited) {
|
|
|
|
mStyleContextHolder = styleIfVisited;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
// Call our pointer-to-member-function.
|
2012-10-01 16:49:41 +00:00
|
|
|
nsRefPtr<CSSValue> val = (this->*(propEntry->mGetter))();
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
mOuterFrame = nullptr;
|
|
|
|
mInnerFrame = nullptr;
|
|
|
|
mPresShell = nullptr;
|
2006-12-22 06:10:32 +00:00
|
|
|
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
// Release the current style context for it should be re-resolved
|
2001-03-11 20:47:06 +00:00
|
|
|
// whenever a frame is not available.
|
2012-07-30 14:20:58 +00:00
|
|
|
mStyleContextHolder = nullptr;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
return val.forget();
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::RemoveProperty(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::GetPropertyPriority(const nsAString& aPropertyName,
|
|
|
|
nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2000-05-15 01:59:05 +00:00
|
|
|
aReturn.Truncate();
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
return NS_OK;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2002-03-23 22:56:05 +00:00
|
|
|
nsComputedDOMStyle::SetProperty(const nsAString& aPropertyName,
|
|
|
|
const nsAString& aValue,
|
|
|
|
const nsAString& aPriority)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
|
|
|
return NS_ERROR_DOM_NO_MODIFICATION_ALLOWED_ERR;
|
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2000-05-04 00:07:33 +00:00
|
|
|
NS_IMETHODIMP
|
2012-08-22 15:56:38 +00:00
|
|
|
nsComputedDOMStyle::Item(uint32_t aIndex, nsAString& aReturn)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2012-08-24 04:08:08 +00:00
|
|
|
return nsDOMCSSDeclaration::Item(aIndex, aReturn);
|
|
|
|
}
|
2002-10-08 01:53:31 +00:00
|
|
|
|
2012-08-24 04:08:08 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::IndexedGetter(uint32_t aIndex, bool& aFound,
|
|
|
|
nsAString& aPropName)
|
|
|
|
{
|
2013-10-03 10:58:01 +00:00
|
|
|
nsComputedStyleMap* map = GetComputedStyleMap();
|
|
|
|
aFound = aIndex < map->Length();
|
2012-08-24 04:08:08 +00:00
|
|
|
if (aFound) {
|
2013-10-03 10:58:01 +00:00
|
|
|
CopyASCIItoUTF16(nsCSSProps::GetStringValue(map->PropertyAt(aIndex)),
|
2012-08-24 04:08:08 +00:00
|
|
|
aPropName);
|
2001-05-14 11:23:53 +00:00
|
|
|
}
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2000-05-15 01:59:05 +00:00
|
|
|
// Property getters...
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBinding()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2000-06-14 00:06:36 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2000-06-14 00:06:36 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (display->mBinding) {
|
2011-05-11 15:28:53 +00:00
|
|
|
val->SetURI(display->mBinding->GetURI());
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2000-06-14 00:06:36 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetClear()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mBreakType,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kClearKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2013-03-25 16:24:21 +00:00
|
|
|
nsComputedDOMStyle::DoGetFloat()
|
2001-09-28 07:39:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mFloats,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kFloatKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-09-28 07:39:41 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBottom()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_BOTTOM);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStackSizing()
|
2008-06-05 06:46:24 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(StyleXUL()->mStretchStack ? eCSSKeyword_stretch_to_fit :
|
2009-01-23 01:28:14 +00:00
|
|
|
eCSSKeyword_ignore);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-06-05 06:46:24 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
void
|
2007-01-25 02:03:02 +00:00
|
|
|
nsComputedDOMStyle::SetToRGBAColor(nsROCSSPrimitiveValue* aValue,
|
|
|
|
nscolor aColor)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2007-01-25 02:03:02 +00:00
|
|
|
if (NS_GET_A(aColor) == 0) {
|
2009-01-23 01:28:14 +00:00
|
|
|
aValue->SetIdent(eCSSKeyword_transparent);
|
2011-03-04 17:28:57 +00:00
|
|
|
return;
|
2007-01-25 02:03:02 +00:00
|
|
|
}
|
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *red = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *green = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *blue = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *alpha = new nsROCSSPrimitiveValue;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t a = NS_GET_A(aColor);
|
2011-03-04 17:28:56 +00:00
|
|
|
nsDOMCSSRGBColor *rgbColor =
|
|
|
|
new nsDOMCSSRGBColor(red, green, blue, alpha, a < 255);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2011-03-04 17:28:56 +00:00
|
|
|
red->SetNumber(NS_GET_R(aColor));
|
|
|
|
green->SetNumber(NS_GET_G(aColor));
|
|
|
|
blue->SetNumber(NS_GET_B(aColor));
|
|
|
|
alpha->SetNumber(nsStyleUtil::ColorComponentToFloat(a));
|
2002-03-22 20:18:42 +00:00
|
|
|
|
2011-03-04 17:28:56 +00:00
|
|
|
aValue->SetColor(rgbColor);
|
2002-03-22 20:18:42 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColor()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetToRGBAColor(val, StyleColor()->mColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOpacity()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleDisplay()->mOpacity);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnCount()
|
2004-06-17 11:57:37 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2004-06-17 11:57:37 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleColumn* column = StyleColumn();
|
2004-06-17 11:57:37 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (column->mColumnCount == NS_STYLE_COLUMN_COUNT_AUTO) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
|
|
|
val->SetNumber(column->mColumnCount);
|
2004-06-17 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-06-17 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnWidth()
|
2004-06-17 11:57:37 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2004-06-17 11:57:37 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
// XXX fix the auto case. When we actually have a column frame, I think
|
|
|
|
// we should return the computed column width.
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleColumn()->mColumnWidth, true);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-06-17 11:57:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnGap()
|
2004-07-18 12:12:46 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2004-07-18 12:12:46 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleColumn* column = StyleColumn();
|
2007-02-20 18:43:16 +00:00
|
|
|
if (column->mColumnGap.GetUnit() == eStyleUnit_Normal) {
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetAppUnits(StyleFont()->mFont.size);
|
2007-02-20 18:43:16 +00:00
|
|
|
} else {
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleColumn()->mColumnGap, true);
|
2004-07-18 12:12:46 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-07-18 12:12:46 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-31 16:21:19 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnFill()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2012-07-31 16:21:19 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleColumn()->mColumnFill,
|
2012-07-31 16:21:19 +00:00
|
|
|
nsCSSProps::kColumnFillKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnRuleWidth()
|
2008-07-19 10:38:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetAppUnits(StyleColumn()->GetComputedColumnRuleWidth());
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-07-19 10:38:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnRuleStyle()
|
2008-07-19 10:38:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleColumn()->mColumnRuleStyle,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kBorderStyleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-07-19 10:38:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColumnRuleColor()
|
2008-07-19 10:38:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2008-07-19 10:38:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleColumn* column = StyleColumn();
|
2008-07-19 10:38:25 +00:00
|
|
|
nscolor ruleColor;
|
|
|
|
if (column->mColumnRuleColorIsForeground) {
|
2013-02-16 21:51:02 +00:00
|
|
|
ruleColor = StyleColor()->mColor;
|
2008-07-19 10:38:25 +00:00
|
|
|
} else {
|
|
|
|
ruleColor = column->mColumnRuleColor;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetToRGBAColor(val, ruleColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-07-19 10:38:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetContent()
|
2007-07-22 17:58:37 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleContent *content = StyleContent();
|
2007-07-22 17:58:37 +00:00
|
|
|
|
|
|
|
if (content->ContentCount() == 0) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (content->ContentCount() == 1 &&
|
|
|
|
content->ContentAt(0).mType == eStyleContentType_AltContent) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2007-07-22 17:58:37 +00:00
|
|
|
val->SetIdent(eCSSKeyword__moz_alt_content);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = content->ContentCount(); i < i_end; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2007-07-22 17:58:37 +00:00
|
|
|
|
|
|
|
const nsStyleContentData &data = content->ContentAt(i);
|
|
|
|
switch (data.mType) {
|
|
|
|
case eStyleContentType_String:
|
|
|
|
{
|
|
|
|
nsString str;
|
2009-03-06 04:05:00 +00:00
|
|
|
nsStyleUtil::AppendEscapedCSSString(
|
|
|
|
nsDependentString(data.mContent.mString), str);
|
2007-07-22 17:58:37 +00: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 20:49:29 +00:00
|
|
|
{
|
|
|
|
nsAutoString str;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentString(data.mContent.mString), str);
|
|
|
|
val->SetString(str, nsIDOMCSSPrimitiveValue::CSS_ATTR);
|
|
|
|
}
|
2007-07-22 17:58:37 +00: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 20:49:29 +00:00
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentString(a->Item(0).GetStringBufferValue()), str);
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t typeItem = 1;
|
2007-07-22 17:58:37 +00:00
|
|
|
if (data.mType == eStyleContentType_Counters) {
|
|
|
|
typeItem = 2;
|
2009-03-06 04:05:00 +00:00
|
|
|
str.AppendLiteral(", ");
|
|
|
|
nsStyleUtil::AppendEscapedCSSString(
|
|
|
|
nsDependentString(a->Item(1).GetStringBufferValue()), str);
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
2009-10-21 21:57:57 +00:00
|
|
|
NS_ABORT_IF_FALSE(eCSSUnit_None != a->Item(typeItem).GetUnit(),
|
|
|
|
"'none' should be handled as enumerated value");
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t type = a->Item(typeItem).GetIntValue();
|
2009-10-21 21:57:57 +00:00
|
|
|
if (type != NS_STYLE_LIST_STYLE_DECIMAL) {
|
|
|
|
str.AppendLiteral(", ");
|
|
|
|
AppendASCIItoUTF16(
|
|
|
|
nsCSSProps::ValueToKeyword(type, nsCSSProps::kListStyleKTable),
|
|
|
|
str);
|
2007-07-22 17:58:37 +00: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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetCounterIncrement()
|
2005-04-01 23:07:00 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleContent *content = StyleContent();
|
2005-04-01 23:07:00 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (content->CounterIncrementCount() == 0) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2005-04-01 23:07:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2005-04-01 23:07:00 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = content->CounterIncrementCount(); i < i_end; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* name = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(name);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(value);
|
2006-12-30 05:17:59 +00:00
|
|
|
|
|
|
|
const nsStyleCounterData *data = content->GetCounterIncrementAt(i);
|
2010-02-04 20:49:29 +00:00
|
|
|
nsAutoString escaped;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(data->mCounter, escaped);
|
|
|
|
name->SetString(escaped);
|
2006-12-30 05:17:59 +00:00
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
2005-04-01 23:07:00 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2005-04-01 23:07:00 +00:00
|
|
|
}
|
|
|
|
|
2008-09-13 09:42:11 +00:00
|
|
|
/* Convert the stored representation into a list of two values and then hand
|
|
|
|
* it back.
|
|
|
|
*/
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-05 09:00:04 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransformOrigin()
|
2008-09-13 09:42:11 +00:00
|
|
|
{
|
|
|
|
/* We need to build up a list of two values. We'll call them
|
|
|
|
* width and height.
|
|
|
|
*/
|
2011-03-04 17:28:57 +00:00
|
|
|
|
|
|
|
/* Store things as a value list */
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
2008-09-13 09:42:11 +00:00
|
|
|
|
|
|
|
/* Now, get the values. */
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-03-04 17:28:57 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* width = new nsROCSSPrimitiveValue;
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(width, display->mTransformOrigin[0], false,
|
2008-09-13 09:42:11 +00:00
|
|
|
&nsComputedDOMStyle::GetFrameBoundsWidthForTransform);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(width);
|
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* height = new nsROCSSPrimitiveValue;
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(height, display->mTransformOrigin[1], false,
|
2008-09-13 09:42:11 +00:00
|
|
|
&nsComputedDOMStyle::GetFrameBoundsHeightForTransform);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(height);
|
2008-09-13 09:42:11 +00:00
|
|
|
|
2011-08-03 03:04:23 +00:00
|
|
|
if (display->mTransformOrigin[2].GetUnit() != eStyleUnit_Coord ||
|
|
|
|
display->mTransformOrigin[2].GetCoordValue() != 0) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* depth = new nsROCSSPrimitiveValue;
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(depth, display->mTransformOrigin[2], false,
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr);
|
2011-08-03 03:04:23 +00:00
|
|
|
valueList->AppendCSSValue(depth);
|
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
|
|
|
|
2011-08-03 03:04:24 +00:00
|
|
|
/* Convert the stored representation into a list of two values and then hand
|
|
|
|
* it back.
|
|
|
|
*/
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-05 09:00:04 +00:00
|
|
|
nsComputedDOMStyle::DoGetPerspectiveOrigin()
|
2011-08-03 03:04:24 +00:00
|
|
|
{
|
|
|
|
/* We need to build up a list of two values. We'll call them
|
|
|
|
* width and height.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Store things as a value list */
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
2011-08-03 03:04:24 +00:00
|
|
|
|
|
|
|
/* Now, get the values. */
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-08-03 03:04:24 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* width = new nsROCSSPrimitiveValue;
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(width, display->mPerspectiveOrigin[0], false,
|
2011-08-03 03:04:24 +00:00
|
|
|
&nsComputedDOMStyle::GetFrameBoundsWidthForTransform);
|
|
|
|
valueList->AppendCSSValue(width);
|
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* height = new nsROCSSPrimitiveValue;
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(height, display->mPerspectiveOrigin[1], false,
|
2011-08-03 03:04:24 +00:00
|
|
|
&nsComputedDOMStyle::GetFrameBoundsHeightForTransform);
|
|
|
|
valueList->AppendCSSValue(height);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-05 09:00:04 +00:00
|
|
|
nsComputedDOMStyle::DoGetPerspective()
|
2011-08-03 03:04:22 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
if (StyleDisplay()->mChildPerspective.GetUnit() == eStyleUnit_Coord &&
|
|
|
|
StyleDisplay()->mChildPerspective.GetCoordValue() == 0.0) {
|
2011-08-03 03:04:22 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
|
|
|
} else {
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleDisplay()->mChildPerspective, false);
|
2011-08-03 03:04:22 +00:00
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-05 09:00:04 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackfaceVisibility()
|
2011-08-03 03:04:22 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-08-03 03:04:22 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mBackfaceVisibility,
|
2011-08-03 03:04:22 +00:00
|
|
|
nsCSSProps::kBackfaceVisibilityKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-05 09:00:04 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransformStyle()
|
2011-08-27 00:01:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-08-27 00:01:06 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mTransformStyle,
|
2011-08-27 00:01:06 +00:00
|
|
|
nsCSSProps::kTransformStyleKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2008-09-13 09:42:11 +00: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.
|
|
|
|
*/
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-05 09:00:04 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransform()
|
2008-09-13 09:42:11 +00:00
|
|
|
{
|
|
|
|
/* First, get the display data. We'll need it. */
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2012-07-05 07:45:09 +00:00
|
|
|
/* If there are no transforms, then we should construct a single-element
|
|
|
|
* entry and hand it back.
|
2008-09-13 09:42:11 +00:00
|
|
|
*/
|
2012-07-05 07:45:09 +00:00
|
|
|
if (!display->mSpecifiedTransform) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2008-09-13 09:42:11 +00:00
|
|
|
/* Set it to "none." */
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2008-09-13 09:42:11 +00: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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* 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));
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool dummy;
|
2011-07-22 22:28:51 +00:00
|
|
|
gfx3DMatrix matrix =
|
2011-07-22 22:28:07 +00:00
|
|
|
nsStyleTransformMatrix::ReadTransforms(display->mSpecifiedTransform,
|
|
|
|
mStyleContextHolder,
|
|
|
|
mStyleContextHolder->PresContext(),
|
|
|
|
dummy,
|
|
|
|
bounds,
|
2013-09-23 11:55:35 +00:00
|
|
|
float(mozilla::AppUnitsPerCSSPixel()));
|
2011-07-22 22:28:07 +00:00
|
|
|
|
2013-05-23 07:09:27 +00:00
|
|
|
return MatrixToCSSValue(matrix);
|
|
|
|
}
|
|
|
|
|
2013-05-30 00:38:27 +00:00
|
|
|
/* static */ nsROCSSPrimitiveValue*
|
2013-05-23 07:09:27 +00:00
|
|
|
nsComputedDOMStyle::MatrixToCSSValue(gfx3DMatrix& matrix)
|
|
|
|
{
|
2011-09-29 06:19:26 +00:00
|
|
|
bool is3D = !matrix.Is2D();
|
2011-09-08 11:15:00 +00:00
|
|
|
|
2011-09-26 21:53:33 +00:00
|
|
|
nsAutoString resultString(NS_LITERAL_STRING("matrix"));
|
|
|
|
if (is3D) {
|
|
|
|
resultString.Append(NS_LITERAL_STRING("3d"));
|
2011-07-22 22:28:51 +00:00
|
|
|
}
|
|
|
|
|
2011-09-26 21:53:33 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING("("));
|
2011-07-22 22:28:51 +00:00
|
|
|
resultString.AppendFloat(matrix._11);
|
2011-07-22 22:28:07 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
2011-07-22 22:28:51 +00:00
|
|
|
resultString.AppendFloat(matrix._12);
|
2011-07-22 22:28:07 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
2011-09-26 21:53:33 +00:00
|
|
|
if (is3D) {
|
|
|
|
resultString.AppendFloat(matrix._13);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._14);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
}
|
2011-07-22 22:28:51 +00:00
|
|
|
resultString.AppendFloat(matrix._21);
|
2011-07-22 22:28:07 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
2011-07-22 22:28:51 +00:00
|
|
|
resultString.AppendFloat(matrix._22);
|
2011-07-22 22:28:07 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
2011-09-26 21:53:33 +00:00
|
|
|
if (is3D) {
|
|
|
|
resultString.AppendFloat(matrix._23);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._24);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._31);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._32);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._33);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._34);
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
}
|
2011-07-22 22:28:51 +00:00
|
|
|
resultString.AppendFloat(matrix._41);
|
2012-02-10 21:04:59 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
2011-07-22 22:28:51 +00:00
|
|
|
resultString.AppendFloat(matrix._42);
|
2011-09-26 21:53:33 +00:00
|
|
|
if (is3D) {
|
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
|
|
|
resultString.AppendFloat(matrix._43);
|
2012-02-10 21:04:59 +00:00
|
|
|
resultString.Append(NS_LITERAL_STRING(", "));
|
2011-09-26 21:53:33 +00:00
|
|
|
resultString.AppendFloat(matrix._44);
|
|
|
|
}
|
|
|
|
resultString.Append(NS_LITERAL_STRING(")"));
|
2008-09-13 09:42:11 +00:00
|
|
|
|
|
|
|
/* Create a value to hold our result. */
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2008-09-13 09:42:11 +00:00
|
|
|
|
2010-06-03 20:11:34 +00:00
|
|
|
val->SetString(resultString);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetCounterReset()
|
2005-04-01 23:07:00 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleContent *content = StyleContent();
|
2005-04-01 23:07:00 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (content->CounterResetCount() == 0) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2005-04-01 23:07:00 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2005-04-01 23:07:00 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = content->CounterResetCount(); i < i_end; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* name = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(name);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(value);
|
2006-12-30 05:17:59 +00:00
|
|
|
|
|
|
|
const nsStyleCounterData *data = content->GetCounterResetAt(i);
|
2010-02-04 20:49:29 +00:00
|
|
|
nsAutoString escaped;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(data->mCounter, escaped);
|
|
|
|
name->SetString(escaped);
|
2006-12-30 05:17:59 +00:00
|
|
|
value->SetNumber(data->mValue); // XXX This should really be integer
|
2005-04-01 23:07:00 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2005-04-01 23:07:00 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetQuotes()
|
2007-07-22 17:58:37 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleQuotes *quotes = StyleQuotes();
|
2007-07-22 17:58:37 +00:00
|
|
|
|
|
|
|
if (quotes->QuotesCount() == 0) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = quotes->QuotesCount(); i < i_end; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* openVal = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(openVal);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* closeVal = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(closeVal);
|
2007-07-22 17:58:37 +00:00
|
|
|
|
|
|
|
nsString s;
|
2009-03-06 04:05:00 +00:00
|
|
|
nsStyleUtil::AppendEscapedCSSString(*quotes->OpenQuoteAt(i), s);
|
2007-07-22 17:58:37 +00:00
|
|
|
openVal->SetString(s);
|
2009-03-06 04:05:00 +00:00
|
|
|
s.Truncate();
|
|
|
|
nsStyleUtil::AppendEscapedCSSString(*quotes->CloseQuoteAt(i), s);
|
2007-07-22 17:58:37 +00:00
|
|
|
closeVal->SetString(s);
|
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontFamily()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleFont* font = StyleFont();
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
nsCOMPtr<nsIDocument> doc = do_QueryReferent(mDocumentWeak);
|
|
|
|
NS_ASSERTION(doc, "document is required");
|
2010-06-25 13:59:57 +00:00
|
|
|
nsIPresShell* presShell = doc->GetShell();
|
2006-12-30 05:17:59 +00: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 16:15:01 +00:00
|
|
|
if (font->mGenericID == kGenericFont_NONE && !font->mFont.systemFont) {
|
2006-12-30 05:17:59 +00:00
|
|
|
const nsFont* defaultFont =
|
2012-01-25 23:52:26 +00:00
|
|
|
presContext->GetDefaultFont(kPresContext_DefaultVariableFont_ID,
|
|
|
|
font->mLanguage);
|
2006-12-30 05:17:59 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t lendiff = fontName.Length() - defaultFont->name.Length();
|
2006-12-30 05:17:59 +00:00
|
|
|
if (lendiff > 0) {
|
|
|
|
val->SetString(Substring(fontName, 0, lendiff-1)); // -1 removes comma
|
2001-09-07 02:28:10 +00:00
|
|
|
} else {
|
2001-09-27 18:33:58 +00:00
|
|
|
val->SetString(fontName);
|
2001-09-07 02:28:10 +00:00
|
|
|
}
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
|
|
|
val->SetString(fontName);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontSize()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
// Note: StyleFont()->mSize is the 'computed size';
|
|
|
|
// StyleFont()->mFont.size is the 'actual size'
|
|
|
|
val->SetAppUnits(StyleFont()->mSize);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontSizeAdjust()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleFont *font = StyleFont();
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (font->mFont.sizeAdjust) {
|
2002-03-16 17:04:35 +00:00
|
|
|
val->SetNumber(font->mFont.sizeAdjust);
|
2002-09-07 01:48:39 +00:00
|
|
|
} else {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2013-07-29 20:00:41 +00:00
|
|
|
CSSValue*
|
2013-07-29 20:01:14 +00:00
|
|
|
nsComputedDOMStyle::DoGetOSXFontSmoothing()
|
2013-07-29 20:00:41 +00:00
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.smoothing,
|
|
|
|
nsCSSProps::kFontSmoothingKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontStretch()
|
2009-01-29 20:39:18 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-01-29 20:39:18 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.stretch,
|
2010-11-10 15:49:52 +00:00
|
|
|
nsCSSProps::kFontStretchKTable));
|
2009-01-29 20:39:18 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2009-01-29 20:39:18 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontStyle()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.style,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kFontStyleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontWeight()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleFont* font = StyleFont();
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint16_t weight = font->mFont.weight;
|
2012-08-30 01:27:01 +00:00
|
|
|
NS_ASSERTION(weight % 100 == 0, "unexpected value of font-weight");
|
2012-10-10 05:00:05 +00:00
|
|
|
val->SetNumber(weight);
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontVariant()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.variant,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kFontVariantKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontFeatureSettings()
|
2010-07-13 20:30:42 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2010-07-13 20:30:42 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleFont* font = StyleFont();
|
2012-04-26 06:24:26 +00:00
|
|
|
if (font->mFont.fontFeatureSettings.IsEmpty()) {
|
2010-07-13 20:30:42 +00:00
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
2012-04-26 06:24:26 +00:00
|
|
|
nsAutoString result;
|
|
|
|
nsStyleUtil::AppendFontFeatureSettings(font->mFont.fontFeatureSettings,
|
|
|
|
result);
|
|
|
|
val->SetString(result);
|
2010-07-13 20:30:42 +00:00
|
|
|
}
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2010-07-13 20:30:42 +00:00
|
|
|
}
|
|
|
|
|
2013-05-20 02:59:20 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontKerning()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleFont()->mFont.kerning,
|
|
|
|
nsCSSProps::kFontKerningKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFontLanguageOverride()
|
2010-07-13 20:30:42 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2010-07-13 20:30:42 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleFont* font = StyleFont();
|
2010-07-13 20:30:42 +00:00
|
|
|
if (font->mFont.languageOverride.IsEmpty()) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
|
|
|
nsString str;
|
|
|
|
nsStyleUtil::AppendEscapedCSSString(font->mFont.languageOverride, str);
|
|
|
|
val->SetString(str);
|
|
|
|
}
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2010-07-13 20:30:42 +00:00
|
|
|
}
|
|
|
|
|
2013-05-20 02:59:20 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontSynthesis()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.synthesis;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
|
|
|
} else {
|
|
|
|
nsAutoString valueStr;
|
|
|
|
|
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_synthesis,
|
|
|
|
intValue, NS_FONT_SYNTHESIS_WEIGHT,
|
|
|
|
NS_FONT_SYNTHESIS_STYLE, valueStr);
|
|
|
|
val->SetString(valueStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontVariantAlternates()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.variantAlternates;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
// first, include enumerated values
|
|
|
|
nsAutoString valueStr;
|
|
|
|
|
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_alternates,
|
|
|
|
intValue & NS_FONT_VARIANT_ALTERNATES_ENUMERATED_MASK,
|
|
|
|
NS_FONT_VARIANT_ALTERNATES_HISTORICAL,
|
|
|
|
NS_FONT_VARIANT_ALTERNATES_HISTORICAL, valueStr);
|
|
|
|
|
|
|
|
// next, include functional values if present
|
|
|
|
if (intValue & NS_FONT_VARIANT_ALTERNATES_FUNCTIONAL_MASK) {
|
|
|
|
nsStyleUtil::SerializeFunctionalAlternates(StyleFont()->mFont.alternateValues,
|
|
|
|
valueStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetString(valueStr);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontVariantCaps()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.variantCaps;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(intValue,
|
|
|
|
nsCSSProps::kFontVariantCapsKTable));
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontVariantEastAsian()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.variantEastAsian;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
|
|
|
nsAutoString valueStr;
|
|
|
|
|
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_east_asian,
|
|
|
|
intValue, NS_FONT_VARIANT_EAST_ASIAN_JIS78,
|
|
|
|
NS_FONT_VARIANT_EAST_ASIAN_RUBY, valueStr);
|
|
|
|
val->SetString(valueStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontVariantLigatures()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.variantLigatures;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
|
|
|
nsAutoString valueStr;
|
|
|
|
|
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_ligatures,
|
|
|
|
intValue, NS_FONT_VARIANT_LIGATURES_COMMON,
|
|
|
|
NS_FONT_VARIANT_LIGATURES_NO_CONTEXTUAL, valueStr);
|
|
|
|
val->SetString(valueStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontVariantNumeric()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.variantNumeric;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
|
|
|
nsAutoString valueStr;
|
|
|
|
|
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_font_variant_numeric,
|
|
|
|
intValue, NS_FONT_VARIANT_NUMERIC_LINING,
|
|
|
|
NS_FONT_VARIANT_NUMERIC_ORDINAL, valueStr);
|
|
|
|
val->SetString(valueStr);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetFontVariantPosition()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-05-20 02:59:20 +00:00
|
|
|
|
|
|
|
int32_t intValue = StyleFont()->mFont.variantPosition;
|
|
|
|
|
|
|
|
if (0 == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_normal);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(intValue,
|
|
|
|
nsCSSProps::kFontVariantPositionKTable));
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-08-22 15:56:38 +00:00
|
|
|
nsComputedDOMStyle::GetBackgroundList(uint8_t nsStyleBackground::Layer::* aMember,
|
|
|
|
uint32_t nsStyleBackground::* aCount,
|
|
|
|
const int32_t aTable[])
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBackground* bg = StyleBackground();
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2002-10-08 10:24:53 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = bg->*aCount; i < i_end; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2009-05-28 18:09:05 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(bg->mLayers[i].*aMember,
|
2009-02-20 05:29:21 +00:00
|
|
|
aTable));
|
|
|
|
}
|
2009-02-19 02:59:47 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2009-02-19 20:33:09 +00:00
|
|
|
}
|
2009-02-19 17:06:18 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundAttachment()
|
2009-02-19 20:33:09 +00:00
|
|
|
{
|
2009-02-20 05:29:21 +00:00
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mAttachment,
|
|
|
|
&nsStyleBackground::mAttachmentCount,
|
2011-03-04 17:28:57 +00:00
|
|
|
nsCSSProps::kBackgroundAttachmentKTable);
|
2009-02-20 05:29:21 +00:00
|
|
|
}
|
2009-02-19 21:51:46 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundClip()
|
2009-02-20 05:29:21 +00:00
|
|
|
{
|
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mClip,
|
|
|
|
&nsStyleBackground::mClipCount,
|
2011-03-04 17:28:57 +00:00
|
|
|
nsCSSProps::kBackgroundOriginKTable);
|
2002-10-08 10:24:53 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundColor()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetToRGBAColor(val, StyleBackground()->mBackgroundColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2010-09-15 15:11:26 +00:00
|
|
|
|
|
|
|
static void
|
2011-05-23 20:36:18 +00:00
|
|
|
SetValueToCalc(const nsStyleCoord::Calc *aCalc, nsROCSSPrimitiveValue *aValue)
|
2010-09-15 15:11:26 +00:00
|
|
|
{
|
2012-10-01 16:49:41 +00:00
|
|
|
nsRefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
|
2010-09-15 15:11:26 +00:00
|
|
|
nsAutoString tmp, result;
|
|
|
|
|
2012-07-13 22:06:50 +00:00
|
|
|
result.AppendLiteral("calc(");
|
2010-09-15 15:11:26 +00:00
|
|
|
|
|
|
|
val->SetAppUnits(aCalc->mLength);
|
|
|
|
val->GetCssText(tmp);
|
|
|
|
result.Append(tmp);
|
|
|
|
|
|
|
|
if (aCalc->mHasPercent) {
|
|
|
|
result.AppendLiteral(" + ");
|
|
|
|
|
|
|
|
val->SetPercent(aCalc->mPercent);
|
|
|
|
val->GetCssText(tmp);
|
|
|
|
result.Append(tmp);
|
|
|
|
}
|
|
|
|
|
|
|
|
result.AppendLiteral(")");
|
|
|
|
|
|
|
|
aValue->SetString(result); // not really SetString
|
|
|
|
}
|
|
|
|
|
2009-08-01 15:53:40 +00:00
|
|
|
static void
|
|
|
|
AppendCSSGradientLength(const nsStyleCoord& aValue,
|
|
|
|
nsROCSSPrimitiveValue* aPrimitive,
|
|
|
|
nsAString& aString)
|
|
|
|
{
|
|
|
|
nsAutoString tokenString;
|
2010-09-15 15:11:26 +00:00
|
|
|
if (aValue.IsCalcUnit())
|
|
|
|
SetValueToCalc(aValue.GetCalcValue(), aPrimitive);
|
|
|
|
else if (aValue.GetUnit() == eStyleUnit_Coord)
|
2009-08-01 15:53:40 +00:00
|
|
|
aPrimitive->SetAppUnits(aValue.GetCoordValue());
|
|
|
|
else
|
|
|
|
aPrimitive->SetPercent(aValue.GetPercentValue());
|
|
|
|
aPrimitive->GetCssText(tokenString);
|
|
|
|
aString.Append(tokenString);
|
|
|
|
}
|
|
|
|
|
2011-10-22 19:41:11 +00:00
|
|
|
static void
|
|
|
|
AppendCSSGradientToBoxPosition(const nsStyleGradient* aGradient,
|
|
|
|
nsAString& aString,
|
|
|
|
bool& aNeedSep)
|
|
|
|
{
|
|
|
|
float xValue = aGradient->mBgPosX.GetPercentValue();
|
|
|
|
float yValue = aGradient->mBgPosY.GetPercentValue();
|
|
|
|
|
|
|
|
if (yValue == 1.0f && xValue == 0.5f) {
|
|
|
|
// omit "to bottom"
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
NS_ASSERTION(yValue != 0.5f || xValue != 0.5f, "invalid box position");
|
|
|
|
|
|
|
|
aString.AppendLiteral("to");
|
|
|
|
|
|
|
|
if (yValue == 0.0f) {
|
|
|
|
aString.AppendLiteral(" top");
|
|
|
|
} else if (yValue == 1.0f) {
|
|
|
|
aString.AppendLiteral(" bottom");
|
|
|
|
} else if (yValue != 0.5f) { // do not write "center" keyword
|
|
|
|
NS_NOTREACHED("invalid box position");
|
|
|
|
}
|
|
|
|
|
|
|
|
if (xValue == 0.0f) {
|
|
|
|
aString.AppendLiteral(" left");
|
|
|
|
} else if (xValue == 1.0f) {
|
|
|
|
aString.AppendLiteral(" right");
|
|
|
|
} else if (xValue != 0.5f) { // do not write "center" keyword
|
|
|
|
NS_NOTREACHED("invalid box position");
|
|
|
|
}
|
|
|
|
|
|
|
|
aNeedSep = true;
|
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
void
|
2009-08-01 15:53:40 +00:00
|
|
|
nsComputedDOMStyle::GetCSSGradientString(const nsStyleGradient* aGradient,
|
|
|
|
nsAString& aString)
|
|
|
|
{
|
2012-07-07 14:27:09 +00:00
|
|
|
if (!aGradient->mLegacySyntax) {
|
|
|
|
aString.Truncate();
|
|
|
|
} else {
|
|
|
|
aString.AssignLiteral("-moz-");
|
|
|
|
}
|
2009-11-02 19:36:43 +00:00
|
|
|
if (aGradient->mRepeating) {
|
2012-07-07 14:27:09 +00:00
|
|
|
aString.AppendLiteral("repeating-");
|
|
|
|
}
|
|
|
|
bool isRadial = aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_LINEAR;
|
|
|
|
if (isRadial) {
|
|
|
|
aString.AppendLiteral("radial-gradient(");
|
2009-11-02 19:36:43 +00:00
|
|
|
} else {
|
2012-07-07 14:27:09 +00:00
|
|
|
aString.AppendLiteral("linear-gradient(");
|
2009-11-02 19:36:43 +00:00
|
|
|
}
|
2009-08-01 15:53:40 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool needSep = false;
|
2009-11-02 19:36:43 +00:00
|
|
|
nsAutoString tokenString;
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *tmpVal = new nsROCSSPrimitiveValue;
|
2009-08-01 15:53:40 +00:00
|
|
|
|
2012-07-07 14:27:09 +00:00
|
|
|
if (isRadial && !aGradient->mLegacySyntax) {
|
|
|
|
if (aGradient->mSize != NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE) {
|
|
|
|
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_CIRCULAR) {
|
|
|
|
aString.AppendLiteral("circle");
|
|
|
|
needSep = true;
|
|
|
|
}
|
|
|
|
if (aGradient->mSize != NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER) {
|
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
}
|
|
|
|
AppendASCIItoUTF16(nsCSSProps::
|
|
|
|
ValueToKeyword(aGradient->mSize,
|
|
|
|
nsCSSProps::kRadialGradientSizeKTable),
|
|
|
|
aString);
|
|
|
|
needSep = true;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
AppendCSSGradientLength(aGradient->mRadiusX, tmpVal, aString);
|
|
|
|
if (aGradient->mShape != NS_STYLE_GRADIENT_SHAPE_CIRCULAR) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
AppendCSSGradientLength(aGradient->mRadiusY, tmpVal, aString);
|
|
|
|
}
|
2011-10-22 19:41:11 +00:00
|
|
|
needSep = true;
|
|
|
|
}
|
2012-07-07 14:27:09 +00:00
|
|
|
}
|
|
|
|
if (aGradient->mBgPosX.GetUnit() != eStyleUnit_None) {
|
|
|
|
MOZ_ASSERT(aGradient->mBgPosY.GetUnit() != eStyleUnit_None);
|
|
|
|
if (!isRadial && !aGradient->mLegacySyntax) {
|
|
|
|
AppendCSSGradientToBoxPosition(aGradient, aString, needSep);
|
|
|
|
} else if (aGradient->mBgPosX.GetUnit() != eStyleUnit_Percent ||
|
|
|
|
aGradient->mBgPosX.GetPercentValue() != 0.5f ||
|
|
|
|
aGradient->mBgPosY.GetUnit() != eStyleUnit_Percent ||
|
|
|
|
aGradient->mBgPosY.GetPercentValue() != (isRadial ? 0.5f : 1.0f)) {
|
|
|
|
if (isRadial && !aGradient->mLegacySyntax) {
|
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
}
|
|
|
|
aString.AppendLiteral("at ");
|
|
|
|
needSep = false;
|
|
|
|
}
|
|
|
|
AppendCSSGradientLength(aGradient->mBgPosX, tmpVal, aString);
|
|
|
|
if (aGradient->mBgPosY.GetUnit() != eStyleUnit_None) {
|
2011-10-22 19:41:11 +00:00
|
|
|
aString.AppendLiteral(" ");
|
2012-07-07 14:27:09 +00:00
|
|
|
AppendCSSGradientLength(aGradient->mBgPosY, tmpVal, aString);
|
2011-10-22 19:41:11 +00:00
|
|
|
}
|
|
|
|
needSep = true;
|
2009-11-02 19:36:43 +00:00
|
|
|
}
|
|
|
|
}
|
2012-02-25 05:23:14 +00:00
|
|
|
if (aGradient->mAngle.GetUnit() != eStyleUnit_None) {
|
2012-07-07 14:27:09 +00:00
|
|
|
MOZ_ASSERT(!isRadial || aGradient->mLegacySyntax);
|
2009-11-02 19:36:43 +00:00
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
}
|
2013-08-28 22:39:06 +00:00
|
|
|
nsStyleUtil::AppendAngleValue(aGradient->mAngle, aString);
|
2011-10-17 14:59:28 +00:00
|
|
|
needSep = true;
|
2009-08-01 15:53:40 +00:00
|
|
|
}
|
|
|
|
|
2012-07-07 14:27:09 +00:00
|
|
|
if (isRadial && aGradient->mLegacySyntax &&
|
|
|
|
(aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_CIRCULAR ||
|
|
|
|
aGradient->mSize != NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER)) {
|
|
|
|
MOZ_ASSERT(aGradient->mSize != NS_STYLE_GRADIENT_SIZE_EXPLICIT_SIZE);
|
2009-11-02 19:36:43 +00:00
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(", ");
|
2012-07-07 14:27:09 +00:00
|
|
|
needSep = false;
|
|
|
|
}
|
|
|
|
if (aGradient->mShape == NS_STYLE_GRADIENT_SHAPE_CIRCULAR) {
|
|
|
|
aString.AppendLiteral("circle");
|
|
|
|
needSep = true;
|
2009-11-02 19:36:43 +00:00
|
|
|
}
|
|
|
|
if (aGradient->mSize != NS_STYLE_GRADIENT_SIZE_FARTHEST_CORNER) {
|
2012-07-07 14:27:09 +00:00
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
}
|
2009-11-02 19:36:43 +00:00
|
|
|
AppendASCIItoUTF16(nsCSSProps::
|
|
|
|
ValueToKeyword(aGradient->mSize,
|
|
|
|
nsCSSProps::kRadialGradientSizeKTable),
|
|
|
|
aString);
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
needSep = true;
|
2009-08-01 15:53:40 +00:00
|
|
|
}
|
|
|
|
|
2009-11-02 19:36:43 +00:00
|
|
|
|
2009-08-01 15:53:40 +00:00
|
|
|
// color stops
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0; i < aGradient->mStops.Length(); ++i) {
|
2009-11-02 19:36:43 +00:00
|
|
|
if (needSep) {
|
|
|
|
aString.AppendLiteral(", ");
|
|
|
|
}
|
2011-03-04 17:28:57 +00:00
|
|
|
SetToRGBAColor(tmpVal, aGradient->mStops[i].mColor);
|
2009-08-01 15:53:40 +00:00
|
|
|
tmpVal->GetCssText(tokenString);
|
|
|
|
aString.Append(tokenString);
|
2009-11-02 19:36:43 +00:00
|
|
|
|
2012-02-25 05:23:14 +00:00
|
|
|
if (aGradient->mStops[i].mLocation.GetUnit() != eStyleUnit_None) {
|
2009-11-02 19:36:43 +00:00
|
|
|
aString.AppendLiteral(" ");
|
|
|
|
AppendCSSGradientLength(aGradient->mStops[i].mLocation, tmpVal, aString);
|
|
|
|
}
|
2011-10-17 14:59:28 +00:00
|
|
|
needSep = true;
|
2009-08-01 15:53:40 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
delete tmpVal;
|
|
|
|
aString.AppendLiteral(")");
|
|
|
|
}
|
|
|
|
|
2009-08-21 20:39:25 +00:00
|
|
|
// -moz-image-rect(<uri>, <top>, <right>, <bottom>, <left>)
|
2011-03-04 17:28:57 +00:00
|
|
|
void
|
2009-08-21 20:39:25 +00:00
|
|
|
nsComputedDOMStyle::GetImageRectString(nsIURI* aURI,
|
|
|
|
const nsStyleSides& aCropRect,
|
|
|
|
nsString& aString)
|
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(true);
|
2009-08-21 20:39:25 +00:00
|
|
|
|
|
|
|
// <uri>
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valURI = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(valURI);
|
2009-08-21 20:39:25 +00:00
|
|
|
valURI->SetURI(aURI);
|
|
|
|
|
|
|
|
// <top>, <right>, <bottom>, <left>
|
|
|
|
NS_FOR_CSS_SIDES(side) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valSide = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(valSide);
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(valSide, aCropRect.Get(side), false);
|
2009-08-21 20:39:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nsAutoString argumentString;
|
|
|
|
valueList->GetCssText(argumentString);
|
|
|
|
delete valueList;
|
|
|
|
|
|
|
|
aString = NS_LITERAL_STRING("-moz-image-rect(") +
|
|
|
|
argumentString +
|
|
|
|
NS_LITERAL_STRING(")");
|
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
void
|
2009-08-21 20:39:25 +00:00
|
|
|
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;
|
2011-03-04 17:28:57 +00:00
|
|
|
GetImageRectString(uri, *cropRect, imageRectString);
|
2009-08-21 20:39:25 +00:00
|
|
|
aValue->SetString(imageRectString);
|
|
|
|
} else {
|
|
|
|
aValue->SetURI(uri);
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleImageType_Gradient:
|
|
|
|
{
|
|
|
|
nsAutoString gradientString;
|
2011-03-04 17:28:57 +00:00
|
|
|
GetCSSGradientString(aStyleImage.GetGradientData(),
|
|
|
|
gradientString);
|
2009-08-21 20:39:25 +00:00
|
|
|
aValue->SetString(gradientString);
|
|
|
|
break;
|
|
|
|
}
|
2010-08-13 13:33:37 +00:00
|
|
|
case eStyleImageType_Element:
|
|
|
|
{
|
|
|
|
nsAutoString elementId;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentString(aStyleImage.GetElementId()), elementId);
|
|
|
|
nsAutoString elementString = NS_LITERAL_STRING("-moz-element(#") +
|
|
|
|
elementId +
|
|
|
|
NS_LITERAL_STRING(")");
|
|
|
|
aValue->SetString(elementString);
|
|
|
|
break;
|
|
|
|
}
|
2009-08-21 20:39:25 +00:00
|
|
|
case eStyleImageType_Null:
|
|
|
|
aValue->SetIdent(eCSSKeyword_none);
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_NOTREACHED("unexpected image type");
|
2011-03-04 17:28:57 +00:00
|
|
|
break;
|
2009-08-21 20:39:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundImage()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBackground* bg = StyleBackground();
|
2009-02-19 15:29:28 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2009-02-19 20:33:09 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = bg->mImageCount; i < i_end; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2009-02-20 05:29:21 +00:00
|
|
|
|
2009-08-21 20:39:25 +00:00
|
|
|
const nsStyleImage& image = bg->mLayers[i].mImage;
|
2011-03-04 17:28:57 +00:00
|
|
|
SetValueToStyleImage(image, val);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundInlinePolicy()
|
2003-01-17 09:33:52 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(
|
2013-02-16 21:51:02 +00:00
|
|
|
StyleBackground()->mBackgroundInlinePolicy,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBackgroundInlinePolicyKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2003-01-17 09:33:52 +00:00
|
|
|
}
|
|
|
|
|
2013-11-08 15:07:36 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetBackgroundBlendMode()
|
|
|
|
{
|
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mBlendMode,
|
|
|
|
&nsStyleBackground::mBlendModeCount,
|
|
|
|
nsCSSProps::kBlendModeKTable);
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundOrigin()
|
2002-10-08 10:24:53 +00:00
|
|
|
{
|
2009-02-20 05:29:21 +00:00
|
|
|
return GetBackgroundList(&nsStyleBackground::Layer::mOrigin,
|
|
|
|
&nsStyleBackground::mOriginCount,
|
2011-03-04 17:28:57 +00:00
|
|
|
nsCSSProps::kBackgroundOriginKTable);
|
2002-10-08 10:24:53 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundPosition()
|
2007-07-22 17:58:37 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBackground* bg = StyleBackground();
|
2009-02-20 05:29:21 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = bg->mPositionCount; i < i_end; ++i) {
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(false);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(itemList);
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valX = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(valX);
|
2009-02-19 01:13:25 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valY = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(valY);
|
2009-02-19 15:29:28 +00:00
|
|
|
|
2009-02-20 05:29:21 +00:00
|
|
|
const nsStyleBackground::Position &pos = bg->mLayers[i].mPosition;
|
2009-02-19 20:33:09 +00:00
|
|
|
|
2011-05-23 20:36:18 +00:00
|
|
|
if (!pos.mXPosition.mHasPercent) {
|
|
|
|
NS_ABORT_IF_FALSE(pos.mXPosition.mPercent == 0.0f,
|
|
|
|
"Shouldn't have mPercent!");
|
2010-09-15 15:11:26 +00:00
|
|
|
valX->SetAppUnits(pos.mXPosition.mLength);
|
2011-05-23 20:36:18 +00:00
|
|
|
} else if (pos.mXPosition.mLength == 0) {
|
|
|
|
valX->SetPercent(pos.mXPosition.mPercent);
|
2009-02-20 05:29:21 +00:00
|
|
|
} else {
|
2011-05-23 20:36:18 +00:00
|
|
|
SetValueToCalc(&pos.mXPosition, valX);
|
2009-02-20 05:29:21 +00:00
|
|
|
}
|
|
|
|
|
2011-05-23 20:36:18 +00:00
|
|
|
if (!pos.mYPosition.mHasPercent) {
|
|
|
|
NS_ABORT_IF_FALSE(pos.mYPosition.mPercent == 0.0f,
|
|
|
|
"Shouldn't have mPercent!");
|
2010-09-15 15:11:26 +00:00
|
|
|
valY->SetAppUnits(pos.mYPosition.mLength);
|
2011-05-23 20:36:18 +00:00
|
|
|
} else if (pos.mYPosition.mLength == 0) {
|
|
|
|
valY->SetPercent(pos.mYPosition.mPercent);
|
2009-02-20 05:29:21 +00:00
|
|
|
} else {
|
2011-05-23 20:36:18 +00:00
|
|
|
SetValueToCalc(&pos.mYPosition, valY);
|
2009-02-20 05:29:21 +00:00
|
|
|
}
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundRepeat()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBackground* bg = StyleBackground();
|
2012-02-25 05:23:14 +00:00
|
|
|
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = bg->mRepeatCount; i < i_end; ++i) {
|
2012-02-25 05:23:14 +00:00
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(false);
|
|
|
|
valueList->AppendCSSValue(itemList);
|
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valX = new nsROCSSPrimitiveValue;
|
2012-02-25 05:23:14 +00:00
|
|
|
itemList->AppendCSSValue(valX);
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
const uint8_t& xRepeat = bg->mLayers[i].mRepeat.mXRepeat;
|
|
|
|
const uint8_t& yRepeat = bg->mLayers[i].mRepeat.mYRepeat;
|
2012-02-25 05:23:14 +00:00
|
|
|
|
|
|
|
bool hasContraction = true;
|
2012-08-22 15:56:38 +00:00
|
|
|
unsigned contraction;
|
2012-02-25 05:23:14 +00:00
|
|
|
if (xRepeat == yRepeat) {
|
|
|
|
contraction = xRepeat;
|
|
|
|
} else if (xRepeat == NS_STYLE_BG_REPEAT_REPEAT &&
|
|
|
|
yRepeat == NS_STYLE_BG_REPEAT_NO_REPEAT) {
|
|
|
|
contraction = NS_STYLE_BG_REPEAT_REPEAT_X;
|
|
|
|
} else if (xRepeat == NS_STYLE_BG_REPEAT_NO_REPEAT &&
|
|
|
|
yRepeat == NS_STYLE_BG_REPEAT_REPEAT) {
|
|
|
|
contraction = NS_STYLE_BG_REPEAT_REPEAT_Y;
|
|
|
|
} else {
|
|
|
|
hasContraction = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (hasContraction) {
|
|
|
|
valX->SetIdent(nsCSSProps::ValueToKeywordEnum(contraction,
|
|
|
|
nsCSSProps::kBackgroundRepeatKTable));
|
|
|
|
} else {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valY = new nsROCSSPrimitiveValue;
|
2012-02-25 05:23:14 +00:00
|
|
|
itemList->AppendCSSValue(valY);
|
|
|
|
|
|
|
|
valX->SetIdent(nsCSSProps::ValueToKeywordEnum(xRepeat,
|
|
|
|
nsCSSProps::kBackgroundRepeatKTable));
|
|
|
|
valY->SetIdent(nsCSSProps::ValueToKeywordEnum(yRepeat,
|
|
|
|
nsCSSProps::kBackgroundRepeatKTable));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return valueList;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBackgroundSize()
|
2009-05-28 18:09:05 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBackground* bg = StyleBackground();
|
2009-05-28 18:09:05 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2009-05-28 18:09:05 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0, i_end = bg->mSizeCount; i < i_end; ++i) {
|
2009-05-28 18:09:05 +00:00
|
|
|
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;
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2009-05-28 18:09:05 +00:00
|
|
|
val->SetIdent(keyword);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default: {
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(false);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(itemList);
|
2009-05-28 18:09:05 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* valX = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(valX);
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* valY = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(valY);
|
2009-05-28 18:09:05 +00:00
|
|
|
|
|
|
|
if (size.mWidthType == nsStyleBackground::Size::eAuto) {
|
|
|
|
valX->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else {
|
2010-09-15 15:11:26 +00:00
|
|
|
NS_ABORT_IF_FALSE(size.mWidthType ==
|
|
|
|
nsStyleBackground::Size::eLengthPercentage,
|
2009-05-28 18:09:05 +00:00
|
|
|
"bad mWidthType");
|
2011-05-23 20:36:18 +00:00
|
|
|
if (!size.mWidth.mHasPercent &&
|
2010-09-15 15:11:26 +00:00
|
|
|
// negative values must have come from calc()
|
2011-05-23 20:36:18 +00:00
|
|
|
size.mWidth.mLength >= 0) {
|
|
|
|
NS_ABORT_IF_FALSE(size.mWidth.mPercent == 0.0f,
|
|
|
|
"Shouldn't have mPercent");
|
2010-09-15 15:11:26 +00:00
|
|
|
valX->SetAppUnits(size.mWidth.mLength);
|
2011-05-23 20:36:18 +00:00
|
|
|
} else if (size.mWidth.mLength == 0 &&
|
|
|
|
// negative values must have come from calc()
|
|
|
|
size.mWidth.mPercent >= 0.0f) {
|
|
|
|
valX->SetPercent(size.mWidth.mPercent);
|
2010-09-15 15:11:26 +00:00
|
|
|
} else {
|
2011-05-23 20:36:18 +00:00
|
|
|
SetValueToCalc(&size.mWidth, valX);
|
2010-09-15 15:11:26 +00:00
|
|
|
}
|
2009-05-28 18:09:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (size.mHeightType == nsStyleBackground::Size::eAuto) {
|
|
|
|
valY->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else {
|
2010-09-15 15:11:26 +00:00
|
|
|
NS_ABORT_IF_FALSE(size.mHeightType ==
|
|
|
|
nsStyleBackground::Size::eLengthPercentage,
|
2009-05-28 18:09:05 +00:00
|
|
|
"bad mHeightType");
|
2011-05-23 20:36:18 +00:00
|
|
|
if (!size.mHeight.mHasPercent &&
|
2010-09-15 15:11:26 +00:00
|
|
|
// negative values must have come from calc()
|
2011-05-23 20:36:18 +00:00
|
|
|
size.mHeight.mLength >= 0) {
|
|
|
|
NS_ABORT_IF_FALSE(size.mHeight.mPercent == 0.0f,
|
|
|
|
"Shouldn't have mPercent");
|
2010-09-15 15:11:26 +00:00
|
|
|
valY->SetAppUnits(size.mHeight.mLength);
|
2011-05-23 20:36:18 +00:00
|
|
|
} else if (size.mHeight.mLength == 0 &&
|
|
|
|
// negative values must have come from calc()
|
|
|
|
size.mHeight.mPercent >= 0.0f) {
|
|
|
|
valY->SetPercent(size.mHeight.mPercent);
|
2010-09-15 15:11:26 +00:00
|
|
|
} else {
|
2011-05-23 20:36:18 +00:00
|
|
|
SetValueToCalc(&size.mHeight, valY);
|
2010-09-15 15:11:26 +00:00
|
|
|
}
|
2009-05-28 18:09:05 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2009-05-28 18:09:05 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPaddingTop()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_TOP);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPaddingBottom()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_BOTTOM);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPaddingLeft()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_LEFT);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPaddingRight()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetPaddingWidthFor(NS_SIDE_RIGHT);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderCollapse()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleTableBorder()->mBorderCollapse,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBorderCollapseKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderSpacing()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2004-09-10 03:26:58 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* xSpacing = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(xSpacing);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* ySpacing = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(ySpacing);
|
2004-09-10 03:26:58 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleTableBorder *border = StyleTableBorder();
|
2008-09-13 03:45:37 +00:00
|
|
|
xSpacing->SetAppUnits(border->mBorderSpacingX);
|
|
|
|
ySpacing->SetAppUnits(border->mBorderSpacingY);
|
2006-12-30 05:17:59 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetCaptionSide()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleTableBorder()->mCaptionSide,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kCaptionSideKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetEmptyCells()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleTableBorder()->mEmptyCells,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kEmptyCellsKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTableLayout()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleTable()->mLayoutStrategy,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kTableLayoutKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderTopStyle()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_TOP);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderBottomStyle()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_BOTTOM);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
2011-03-04 17:28:57 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderLeftStyle()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_LEFT);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderRightStyle()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderStyleFor(NS_SIDE_RIGHT);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderBottomColors()
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorsFor(NS_SIDE_BOTTOM);
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderLeftColors()
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorsFor(NS_SIDE_LEFT);
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderRightColors()
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorsFor(NS_SIDE_RIGHT);
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderTopColors()
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorsFor(NS_SIDE_TOP);
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderBottomLeftRadius()
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_BOTTOM_LEFT, true);
|
2002-06-21 06:42:21 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderBottomRightRadius()
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_BOTTOM_RIGHT, true);
|
2002-06-21 06:42:21 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderTopLeftRadius()
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_TOP_LEFT, true);
|
2002-06-21 06:42:21 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderTopRightRadius()
|
2002-06-21 06:42:21 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleBorder()->mBorderRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_TOP_RIGHT, true);
|
2002-06-21 06:42:21 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderTopWidth()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_TOP);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderBottomWidth()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_BOTTOM);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderLeftWidth()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_LEFT);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderRightWidth()
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderWidthFor(NS_SIDE_RIGHT);
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderTopColor()
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_TOP);
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderBottomColor()
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_BOTTOM);
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderLeftColor()
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_LEFT);
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderRightColor()
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetBorderColorFor(NS_SIDE_RIGHT);
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarginTopWidth()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_TOP);
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarginBottomWidth()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_BOTTOM);
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarginLeftWidth()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_LEFT);
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarginRightWidth()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetMarginWidthFor(NS_SIDE_RIGHT);
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarkerOffset()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleContent()->mMarkerOffset, false);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-05-10 13:47:46 +00:00
|
|
|
nsComputedDOMStyle::DoGetOrient()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-05-10 13:47:46 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOrient,
|
2011-05-10 13:47:46 +00:00
|
|
|
nsCSSProps::kOrientKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineWidth()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleOutline* outline = StyleOutline();
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2009-01-23 01:28:13 +00: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 05:17:59 +00:00
|
|
|
} else {
|
2009-01-23 01:28:13 +00:00
|
|
|
#ifdef DEBUG
|
2011-09-29 06:19:26 +00:00
|
|
|
bool res =
|
2009-01-23 01:28:13 +00:00
|
|
|
#endif
|
|
|
|
outline->GetOutlineWidth(width);
|
|
|
|
NS_ASSERTION(res, "percent outline doesn't exist");
|
2006-12-30 05:17:59 +00:00
|
|
|
}
|
2009-01-23 01:28:13 +00: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 16:46:42 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineStyle()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleOutline()->GetOutlineStyle(),
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kOutlineStyleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineOffset()
|
2004-10-26 12:57:15 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetAppUnits(StyleOutline()->mOutlineOffset);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-10-26 12:57:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineRadiusBottomLeft()
|
2004-10-14 03:32:28 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_BOTTOM_LEFT, false);
|
2004-10-14 03:32:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineRadiusBottomRight()
|
2004-10-14 03:32:28 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_BOTTOM_RIGHT, false);
|
2004-10-14 03:32:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineRadiusTopLeft()
|
2004-10-14 03:32:28 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_TOP_LEFT, false);
|
2004-10-14 03:32:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineRadiusTopRight()
|
2004-10-14 03:32:28 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetEllipseRadii(StyleOutline()->mOutlineRadius,
|
2011-10-17 14:59:28 +00:00
|
|
|
NS_CORNER_TOP_RIGHT, false);
|
2004-10-14 03:32:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOutlineColor()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
nscolor color;
|
2013-02-16 21:51:02 +00:00
|
|
|
if (!StyleOutline()->GetOutlineColor(color))
|
|
|
|
color = StyleColor()->mColor;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
SetToRGBAColor(val, color);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-11 20:47:06 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2008-10-01 05:50:52 +00:00
|
|
|
nsComputedDOMStyle::GetEllipseRadii(const nsStyleCorners& aRadius,
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t aFullCorner,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aIsBorder) // else outline
|
2004-10-14 03:32:28 +00:00
|
|
|
{
|
2010-10-07 04:25:47 +00:00
|
|
|
nsStyleCoord radiusX, radiusY;
|
|
|
|
if (mInnerFrame && aIsBorder) {
|
|
|
|
nscoord radii[8];
|
|
|
|
mInnerFrame->GetBorderRadii(radii);
|
2011-10-17 14:59:28 +00:00
|
|
|
radiusX.SetCoordValue(radii[NS_FULL_TO_HALF_CORNER(aFullCorner, false)]);
|
|
|
|
radiusY.SetCoordValue(radii[NS_FULL_TO_HALF_CORNER(aFullCorner, true)]);
|
2010-10-07 04:25:47 +00:00
|
|
|
} else {
|
2011-10-17 14:59:28 +00:00
|
|
|
radiusX = aRadius.Get(NS_FULL_TO_HALF_CORNER(aFullCorner, false));
|
|
|
|
radiusY = aRadius.Get(NS_FULL_TO_HALF_CORNER(aFullCorner, true));
|
2010-10-07 04:25:47 +00:00
|
|
|
|
|
|
|
if (mInnerFrame) {
|
|
|
|
// We need to convert to absolute coordinates before doing the
|
|
|
|
// equality check below.
|
|
|
|
nscoord v;
|
|
|
|
|
|
|
|
v = StyleCoordToNSCoord(radiusX,
|
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectWidth,
|
2011-10-17 14:59:28 +00:00
|
|
|
0, true);
|
2010-10-07 04:25:47 +00:00
|
|
|
radiusX.SetCoordValue(v);
|
|
|
|
|
|
|
|
v = StyleCoordToNSCoord(radiusY,
|
|
|
|
&nsComputedDOMStyle::GetFrameBorderRectHeight,
|
2011-10-17 14:59:28 +00:00
|
|
|
0, true);
|
2010-10-07 04:25:47 +00:00
|
|
|
radiusY.SetCoordValue(v);
|
|
|
|
}
|
2010-10-07 04:25:47 +00:00
|
|
|
}
|
|
|
|
|
2008-10-01 05:50:52 +00:00
|
|
|
// for compatibility, return a single value if X and Y are equal
|
|
|
|
if (radiusX == radiusY) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2004-10-14 03:32:28 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(val, radiusX, true);
|
2004-10-14 03:32:28 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
|
|
|
}
|
2008-10-01 05:50:52 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2008-10-01 05:50:52 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valX = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(valX);
|
2008-10-01 05:50:52 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valY = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(valY);
|
2008-10-01 05:50:52 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(valX, radiusX, true);
|
|
|
|
SetValueToCoord(valY, radiusY, true);
|
2011-03-04 17:28:57 +00:00
|
|
|
|
|
|
|
return valueList;
|
2004-10-14 03:32:28 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2008-07-08 00:56:52 +00:00
|
|
|
nsComputedDOMStyle::GetCSSShadowArray(nsCSSShadowArray* aArray,
|
|
|
|
const nscolor& aDefaultColor,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aIsBoxShadow)
|
2008-07-08 00:56:52 +00:00
|
|
|
{
|
|
|
|
if (!aArray) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-07-08 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2008-09-13 03:45:37 +00:00
|
|
|
static nscoord nsCSSShadowItem::* const shadowValuesNoSpread[] = {
|
2008-07-08 00:56:52 +00:00
|
|
|
&nsCSSShadowItem::mXOffset,
|
|
|
|
&nsCSSShadowItem::mYOffset,
|
|
|
|
&nsCSSShadowItem::mRadius
|
|
|
|
};
|
|
|
|
|
2008-09-13 03:45:37 +00:00
|
|
|
static nscoord nsCSSShadowItem::* const shadowValuesWithSpread[] = {
|
2008-07-08 00:56:52 +00:00
|
|
|
&nsCSSShadowItem::mXOffset,
|
|
|
|
&nsCSSShadowItem::mYOffset,
|
|
|
|
&nsCSSShadowItem::mRadius,
|
|
|
|
&nsCSSShadowItem::mSpread
|
|
|
|
};
|
|
|
|
|
2008-09-13 03:45:37 +00:00
|
|
|
nscoord nsCSSShadowItem::* const * shadowValues;
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t shadowValuesLength;
|
2009-02-10 08:45:13 +00:00
|
|
|
if (aIsBoxShadow) {
|
2008-07-08 00:56:52 +00:00
|
|
|
shadowValues = shadowValuesWithSpread;
|
2011-10-11 05:50:08 +00:00
|
|
|
shadowValuesLength = ArrayLength(shadowValuesWithSpread);
|
2008-07-08 00:56:52 +00:00
|
|
|
} else {
|
|
|
|
shadowValues = shadowValuesNoSpread;
|
2011-10-11 05:50:08 +00:00
|
|
|
shadowValuesLength = ArrayLength(shadowValuesNoSpread);
|
2008-07-08 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2008-07-08 00:56:52 +00:00
|
|
|
|
|
|
|
for (nsCSSShadowItem *item = aArray->ShadowAt(0),
|
2009-02-20 05:29:21 +00:00
|
|
|
*item_end = item + aArray->Length();
|
2008-07-08 00:56:52 +00:00
|
|
|
item < item_end; ++item) {
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(false);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(itemList);
|
2008-07-08 00:56:52 +00:00
|
|
|
|
|
|
|
// Color is either the specified shadow color or the foreground color
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(val);
|
2008-07-08 00:56:52 +00:00
|
|
|
nscolor shadowColor;
|
|
|
|
if (item->mHasColor) {
|
|
|
|
shadowColor = item->mColor;
|
|
|
|
} else {
|
|
|
|
shadowColor = aDefaultColor;
|
|
|
|
}
|
|
|
|
SetToRGBAColor(val, shadowColor);
|
|
|
|
|
|
|
|
// Set the offsets, blur radius, and spread if available
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0; i < shadowValuesLength; ++i) {
|
2013-05-23 07:09:26 +00:00
|
|
|
val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(val);
|
2008-09-13 03:45:37 +00:00
|
|
|
val->SetAppUnits(item->*(shadowValues[i]));
|
2008-07-08 00:56:52 +00:00
|
|
|
}
|
2009-02-10 08:45:13 +00:00
|
|
|
|
|
|
|
if (item->mInset && aIsBoxShadow) {
|
|
|
|
// This is an inset box-shadow
|
2013-05-23 07:09:26 +00:00
|
|
|
val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(val);
|
2009-02-10 08:45:13 +00:00
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(NS_STYLE_BOX_SHADOW_INSET,
|
|
|
|
nsCSSProps::kBoxShadowTypeKTable));
|
|
|
|
}
|
2008-07-08 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2008-07-08 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxShadow()
|
2008-07-08 00:56:52 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetCSSShadowArray(StyleBorder()->mBoxShadow,
|
|
|
|
StyleColor()->mColor,
|
2011-10-17 14:59:28 +00:00
|
|
|
true);
|
2008-07-08 00:56:52 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetZIndex()
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mZIndex, false);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetListStyleImage()
|
2001-03-08 00:55:01 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2001-03-11 21:03:08 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleList* list = StyleList();
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2009-12-11 04:02:13 +00:00
|
|
|
if (!list->GetListStyleImage()) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
2009-12-11 04:02:13 +00:00
|
|
|
if (list->GetListStyleImage()) {
|
|
|
|
list->GetListStyleImage()->GetURI(getter_AddRefs(uri));
|
2002-01-24 04:22:59 +00:00
|
|
|
}
|
2006-12-30 05:17:59 +00:00
|
|
|
val->SetURI(uri);
|
2001-03-11 21:03:08 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetListStylePosition()
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleList()->mListStylePosition,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kListStylePositionKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetListStyleType()
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleList()->mListStyleType,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kListStyleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-08 00:55:01 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetImageRegion()
|
2004-01-15 02:25:08 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2004-01-15 02:25:08 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleList* list = StyleList();
|
2004-01-15 02:25:08 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (list->mImageRegion.width <= 0 || list->mImageRegion.height <= 0) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
|
|
|
// create the cssvalues for the sides, stick them in the rect object
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *topVal = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *rightVal = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *bottomVal = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *leftVal = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:56 +00:00
|
|
|
nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal,
|
|
|
|
bottomVal, leftVal);
|
|
|
|
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);
|
|
|
|
val->SetRect(domRect);
|
2004-01-15 02:25:08 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-01-15 02:25:08 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetLineHeight()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2002-03-16 17:04:35 +00:00
|
|
|
|
|
|
|
nscoord lineHeight;
|
2009-05-18 22:13:12 +00:00
|
|
|
if (GetLineHeightCoord(lineHeight)) {
|
|
|
|
val->SetAppUnits(lineHeight);
|
|
|
|
} else {
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleText()->mLineHeight, true,
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr, nsCSSProps::kLineHeightKTable);
|
2009-05-18 22:13:12 +00:00
|
|
|
}
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetVerticalAlign()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleTextReset()->mVerticalAlign, false,
|
2007-02-20 18:43:16 +00:00
|
|
|
&nsComputedDOMStyle::GetLineHeightCoord,
|
|
|
|
nsCSSProps::kVerticalAlignKTable);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2013-10-27 20:56:32 +00:00
|
|
|
nsComputedDOMStyle::CreateTextAlignValue(uint8_t aAlign, bool aAlignTrue,
|
|
|
|
const int32_t aTable[])
|
2001-05-04 11:30:34 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-10-27 20:56:32 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(aAlign, aTable));
|
|
|
|
if (!aAlignTrue) {
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsROCSSPrimitiveValue* first = new nsROCSSPrimitiveValue;
|
|
|
|
first->SetIdent(eCSSKeyword_true);
|
|
|
|
|
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
|
|
|
valueList->AppendCSSValue(first);
|
|
|
|
valueList->AppendCSSValue(val);
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetTextAlign()
|
|
|
|
{
|
|
|
|
const nsStyleText* style = StyleText();
|
|
|
|
return CreateTextAlignValue(style->mTextAlign, style->mTextAlignTrue,
|
|
|
|
nsCSSProps::kTextAlignKTable);
|
2001-05-09 03:29:09 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-01-12 17:52:21 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextAlignLast()
|
|
|
|
{
|
2013-10-27 20:56:32 +00:00
|
|
|
const nsStyleText* style = StyleText();
|
|
|
|
return CreateTextAlignValue(style->mTextAlignLast, style->mTextAlignLastTrue,
|
|
|
|
nsCSSProps::kTextAlignLastKTable);
|
2012-01-12 17:52:21 +00:00
|
|
|
}
|
|
|
|
|
2013-08-19 10:26:44 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetTextCombineHorizontal()
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
|
|
|
uint8_t tch = StyleText()->mTextCombineHorizontal;
|
|
|
|
|
|
|
|
if (tch <= NS_STYLE_TEXT_COMBINE_HORIZ_ALL) {
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(tch,
|
|
|
|
nsCSSProps::kTextCombineHorizontalKTable));
|
|
|
|
} else if (tch <= NS_STYLE_TEXT_COMBINE_HORIZ_DIGITS_2) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("digits 2"));
|
|
|
|
} else if (tch <= NS_STYLE_TEXT_COMBINE_HORIZ_DIGITS_3) {
|
|
|
|
val->SetString(NS_LITERAL_STRING("digits 3"));
|
|
|
|
} else {
|
|
|
|
val->SetString(NS_LITERAL_STRING("digits 4"));
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextDecoration()
|
2001-05-09 03:29:09 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2001-05-09 03:29:09 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleTextReset* textReset = StyleTextReset();
|
2011-05-20 05:56:23 +00:00
|
|
|
|
|
|
|
// If decoration style or color wasn't initial value, the author knew the
|
|
|
|
// text-decoration is a shorthand property in CSS 3.
|
2013-10-08 18:47:21 +00:00
|
|
|
// Return nullptr in such cases.
|
2011-05-20 05:56:23 +00:00
|
|
|
if (textReset->GetDecorationStyle() != NS_STYLE_TEXT_DECORATION_STYLE_SOLID) {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2011-05-20 05:56:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
nscolor color;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isForegroundColor;
|
2011-05-20 05:56:23 +00:00
|
|
|
textReset->GetDecorationColor(color, isForegroundColor);
|
|
|
|
if (!isForegroundColor) {
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2011-05-20 05:56:23 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// Otherwise, the web pages may have been written for CSS 2.1 or earlier,
|
|
|
|
// i.e., text-decoration was assumed as a longhand property. In that case,
|
|
|
|
// we should return computed value same as CSS 2.1 for backward compatibility.
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t line = textReset->mTextDecorationLine;
|
2011-04-23 05:16:41 +00:00
|
|
|
// Clear the -moz-anchor-decoration bit and the OVERRIDE_ALL bits -- we
|
|
|
|
// don't want these to appear in the computed style.
|
|
|
|
line &= ~(NS_STYLE_TEXT_DECORATION_LINE_PREF_ANCHORS |
|
|
|
|
NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2013-08-06 14:02:34 +00:00
|
|
|
if (line == NS_STYLE_TEXT_DECORATION_LINE_NONE) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
2011-04-23 05:16:41 +00:00
|
|
|
nsAutoString str;
|
2013-08-06 14:02:34 +00:00
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
|
|
|
|
line, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
|
|
|
NS_STYLE_TEXT_DECORATION_LINE_BLINK, str);
|
2011-04-23 05:16:41 +00:00
|
|
|
val->SetString(str);
|
2001-05-09 03:29:09 +00:00
|
|
|
}
|
2001-09-28 07:39:41 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-05-04 11:30:34 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextDecorationColor()
|
2011-03-31 12:26:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-03-31 12:26:35 +00:00
|
|
|
|
|
|
|
nscolor color;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool isForeground;
|
2013-02-16 21:51:02 +00:00
|
|
|
StyleTextReset()->GetDecorationColor(color, isForeground);
|
2011-03-31 12:26:35 +00:00
|
|
|
if (isForeground) {
|
2013-02-16 21:51:02 +00:00
|
|
|
color = StyleColor()->mColor;
|
2011-03-31 12:26:35 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
SetToRGBAColor(val, color);
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextDecorationLine()
|
2011-04-23 05:16:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-04-23 05:16:41 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
int32_t intValue = StyleTextReset()->mTextDecorationLine;
|
2011-04-23 05:16:41 +00:00
|
|
|
|
|
|
|
if (NS_STYLE_TEXT_DECORATION_LINE_NONE == intValue) {
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
|
|
|
} else {
|
|
|
|
nsAutoString decorationLineString;
|
|
|
|
// 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_LINE_PREF_ANCHORS |
|
|
|
|
NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL);
|
|
|
|
nsStyleUtil::AppendBitmaskCSSValue(eCSSProperty_text_decoration_line,
|
|
|
|
intValue, NS_STYLE_TEXT_DECORATION_LINE_UNDERLINE,
|
2013-08-06 14:02:34 +00:00
|
|
|
NS_STYLE_TEXT_DECORATION_LINE_BLINK, decorationLineString);
|
2011-04-23 05:16:41 +00:00
|
|
|
val->SetString(decorationLineString);
|
|
|
|
}
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextDecorationStyle()
|
2011-03-31 12:26:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-03-31 12:26:35 +00:00
|
|
|
|
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleTextReset()->GetDecorationStyle(),
|
2011-03-31 12:26:35 +00:00
|
|
|
nsCSSProps::kTextDecorationStyleKTable));
|
|
|
|
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextIndent()
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleText()->mTextIndent, false,
|
2007-02-20 18:43:16 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentWidth);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2013-08-19 10:26:44 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetTextOrientation()
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mTextOrientation,
|
|
|
|
nsCSSProps::kTextOrientationKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-06-22 18:11:47 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextOverflow()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleTextReset *style = StyleTextReset();
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *first = new nsROCSSPrimitiveValue;
|
2011-10-12 16:20:46 +00:00
|
|
|
const nsStyleTextOverflowSide *side = style->mTextOverflow.GetFirstValue();
|
|
|
|
if (side->mType == NS_STYLE_TEXT_OVERFLOW_STRING) {
|
2011-06-22 18:11:47 +00:00
|
|
|
nsString str;
|
2011-10-12 16:20:46 +00:00
|
|
|
nsStyleUtil::AppendEscapedCSSString(side->mString, str);
|
|
|
|
first->SetString(str);
|
2011-06-22 18:11:47 +00:00
|
|
|
} else {
|
2011-10-12 16:20:46 +00:00
|
|
|
first->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(side->mType,
|
2011-06-22 18:11:47 +00:00
|
|
|
nsCSSProps::kTextOverflowKTable));
|
|
|
|
}
|
2011-10-12 16:20:46 +00:00
|
|
|
side = style->mTextOverflow.GetSecondValue();
|
|
|
|
if (!side) {
|
|
|
|
return first;
|
2011-08-20 20:41:39 +00:00
|
|
|
}
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *second = new nsROCSSPrimitiveValue;
|
2011-10-12 16:20:46 +00:00
|
|
|
if (side->mType == NS_STYLE_TEXT_OVERFLOW_STRING) {
|
2011-08-20 20:41:39 +00:00
|
|
|
nsString str;
|
2011-10-12 16:20:46 +00:00
|
|
|
nsStyleUtil::AppendEscapedCSSString(side->mString, str);
|
|
|
|
second->SetString(str);
|
2011-08-20 20:41:39 +00:00
|
|
|
} else {
|
2011-10-12 16:20:46 +00:00
|
|
|
second->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(side->mType,
|
2011-08-20 20:41:39 +00:00
|
|
|
nsCSSProps::kTextOverflowKTable));
|
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2011-10-12 16:20:46 +00:00
|
|
|
valueList->AppendCSSValue(first);
|
|
|
|
valueList->AppendCSSValue(second);
|
2011-08-20 20:41:39 +00:00
|
|
|
return valueList;
|
2011-06-22 18:11:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextShadow()
|
2008-06-05 23:06:34 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
return GetCSSShadowArray(StyleText()->mTextShadow,
|
|
|
|
StyleColor()->mColor,
|
2011-10-17 14:59:28 +00:00
|
|
|
false);
|
2008-06-05 23:06:34 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextTransform()
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mTextTransform,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kTextTransformKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 12:51:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTabSize()
|
2009-09-26 20:23:47 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleText()->mTabSize);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2009-09-26 20:23:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetLetterSpacing()
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleText()->mLetterSpacing, false);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetWordSpacing()
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetAppUnits(StyleText()->mWordSpacing);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetWhiteSpace()
|
2002-03-03 19:44:41 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mWhiteSpace,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kWhitespaceKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-03 19:44:41 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetWindowShadow()
|
2008-10-14 14:44:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mWindowShadow,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kWindowShadowKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-10-14 14:44:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-07 19:18:23 +00:00
|
|
|
nsComputedDOMStyle::DoGetWordBreak()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2012-05-07 19:18:23 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mWordBreak,
|
2012-05-07 19:18:23 +00:00
|
|
|
nsCSSProps::kWordBreakKTable));
|
|
|
|
return val;
|
|
|
|
}
|
2008-10-14 14:44:25 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetWordWrap()
|
2008-07-24 07:16:18 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mWordWrap,
|
2012-05-07 19:18:23 +00:00
|
|
|
nsCSSProps::kWordWrapKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2008-07-24 07:16:18 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-05-04 11:14:50 +00:00
|
|
|
nsComputedDOMStyle::DoGetHyphens()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-05-04 11:14:50 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleText()->mHyphens,
|
2011-05-04 11:14:50 +00:00
|
|
|
nsCSSProps::kHyphensKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-11-24 02:48:23 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextSizeAdjust()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
switch (StyleText()->mTextSizeAdjust) {
|
2011-11-24 02:48:23 +00:00
|
|
|
default:
|
|
|
|
NS_NOTREACHED("unexpected value");
|
|
|
|
// fall through
|
|
|
|
case NS_STYLE_TEXT_SIZE_ADJUST_AUTO:
|
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
|
|
|
break;
|
|
|
|
case NS_STYLE_TEXT_SIZE_ADJUST_NONE:
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPointerEvents()
|
2009-08-27 03:53:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleVisibility()->mPointerEvents,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kPointerEventsKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2009-08-27 03:53:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetVisibility()
|
2001-08-07 19:05:21 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleVisibility()->mVisible,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kVisibilityKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2013-05-28 16:00:49 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetWritingMode()
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleVisibility()->mWritingMode,
|
|
|
|
nsCSSProps::kWritingModeKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetDirection()
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleVisibility()->mDirection,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kDirectionKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 17:59:53 +00:00
|
|
|
static_assert(NS_STYLE_UNICODE_BIDI_NORMAL == 0,
|
|
|
|
"unicode-bidi style constants not as expected");
|
2011-10-18 12:51:57 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetUnicodeBidi()
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2012-08-07 08:42:46 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleTextReset()->mUnicodeBidi,
|
2012-08-07 08:42:46 +00:00
|
|
|
nsCSSProps::kUnicodeBidiKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-12 21:16:22 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetCursor()
|
2002-03-12 21:16:22 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2002-03-12 21:16:22 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleUserInterface *ui = StyleUserInterface();
|
2002-03-12 21:16:22 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
for (nsCursorImage *item = ui->mCursorArray,
|
|
|
|
*item_end = ui->mCursorArray + ui->mCursorArrayLength;
|
|
|
|
item < item_end; ++item) {
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *itemList = GetROCSSValueList(false);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(itemList);
|
2006-12-30 05:17:59 +00:00
|
|
|
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
2010-08-16 16:19:26 +00:00
|
|
|
item->GetImage()->GetURI(getter_AddRefs(uri));
|
2006-12-30 05:17:59 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(val);
|
2006-12-30 05:17:59 +00:00
|
|
|
val->SetURI(uri);
|
|
|
|
|
|
|
|
if (item->mHaveHotspot) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valX = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(valX);
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *valY = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
itemList->AppendCSSValue(valY);
|
2005-07-01 04:29:42 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
valX->SetNumber(item->mHotspotX);
|
|
|
|
valY->SetNumber(item->mHotspotY);
|
2004-12-30 21:56:11 +00:00
|
|
|
}
|
2006-12-30 05:17:59 +00:00
|
|
|
}
|
2004-12-30 21:56:11 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(ui->mCursor,
|
|
|
|
nsCSSProps::kCursorKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2001-08-07 19:05:21 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetAppearance()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mAppearance,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kAppearanceKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxAlign()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleXUL()->mBoxAlign,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBoxAlignKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxDirection()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleXUL()->mBoxDirection,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBoxDirectionKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxFlex()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleXUL()->mBoxFlex);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxOrdinalGroup()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleXUL()->mBoxOrdinal);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxOrient()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleXUL()->mBoxOrient,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBoxOrientKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxPack()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleXUL()->mBoxPack,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBoxPackKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetBoxSizing()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StylePosition()->mBoxSizing,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kBoxSizingKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2011-12-22 23:34:45 +00:00
|
|
|
/* Border image properties */
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-12-22 23:34:45 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderImageSource()
|
2008-07-17 06:30:25 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBorder* border = StyleBorder();
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-12-22 23:34:45 +00:00
|
|
|
imgIRequest* imgSrc = border->GetBorderImage();
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
if (imgSrc) {
|
|
|
|
nsCOMPtr<nsIURI> uri;
|
|
|
|
imgSrc->GetURI(getter_AddRefs(uri));
|
|
|
|
val->SetURI(uri);
|
|
|
|
} else {
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-12-22 23:34:45 +00:00
|
|
|
return val;
|
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-12-22 23:34:45 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderImageSlice()
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBorder* border = StyleBorder();
|
2011-12-22 23:34:45 +00:00
|
|
|
// Four slice numbers.
|
|
|
|
NS_FOR_CSS_SIDES (side) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2012-11-22 05:51:39 +00:00
|
|
|
SetValueToCoord(val, border->mBorderImageSlice.Get(side), true, nullptr);
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-12-22 23:34:45 +00:00
|
|
|
// Fill keyword.
|
|
|
|
if (NS_STYLE_BORDER_IMAGE_SLICE_FILL == border->mBorderImageFill) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
|
|
|
val->SetIdent(eCSSKeyword_fill);
|
|
|
|
}
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-12-22 23:34:45 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderImageWidth()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBorder* border = StyleBorder();
|
2011-12-22 23:34:45 +00:00
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
|
|
|
NS_FOR_CSS_SIDES (side) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
|
|
|
SetValueToCoord(val, border->mBorderImageWidth.Get(side),
|
2012-11-22 05:51:39 +00:00
|
|
|
true, nullptr);
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-12-22 23:34:45 +00:00
|
|
|
return valueList;
|
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-12-22 23:34:45 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderImageOutset()
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBorder* border = StyleBorder();
|
2011-12-22 23:34:45 +00:00
|
|
|
// four slice numbers
|
|
|
|
NS_FOR_CSS_SIDES (side) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
|
|
|
SetValueToCoord(val, border->mBorderImageOutset.Get(side),
|
2012-11-22 05:51:39 +00:00
|
|
|
true, nullptr);
|
2011-12-22 23:34:45 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-12-22 23:34:45 +00:00
|
|
|
nsComputedDOMStyle::DoGetBorderImageRepeat()
|
|
|
|
{
|
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBorder* border = StyleBorder();
|
2011-12-22 23:34:45 +00:00
|
|
|
|
|
|
|
// horizontal repeat
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* valX = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
valueList->AppendCSSValue(valX);
|
|
|
|
valX->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(border->mBorderImageRepeatH,
|
|
|
|
nsCSSProps::kBorderImageRepeatKTable));
|
|
|
|
|
|
|
|
// vertical repeat
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* valY = new nsROCSSPrimitiveValue;
|
2011-12-22 23:34:45 +00:00
|
|
|
valueList->AppendCSSValue(valY);
|
|
|
|
valY->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(border->mBorderImageRepeatV,
|
|
|
|
nsCSSProps::kBorderImageRepeatKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:21 +00:00
|
|
|
nsComputedDOMStyle::DoGetAlignItems()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2012-07-07 00:06:21 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StylePosition()->mAlignItems,
|
2012-07-07 00:06:21 +00:00
|
|
|
nsCSSProps::kAlignItemsKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:21 +00:00
|
|
|
nsComputedDOMStyle::DoGetAlignSelf()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
uint8_t computedAlignSelf = StylePosition()->mAlignSelf;
|
2012-07-07 00:06:21 +00:00
|
|
|
|
|
|
|
if (computedAlignSelf == NS_STYLE_ALIGN_SELF_AUTO) {
|
|
|
|
// "align-self: auto" needs to compute to parent's align-items value.
|
|
|
|
nsStyleContext* parentStyleContext = mStyleContextHolder->GetParent();
|
|
|
|
if (parentStyleContext) {
|
|
|
|
computedAlignSelf =
|
2013-02-16 21:51:02 +00:00
|
|
|
parentStyleContext->StylePosition()->mAlignItems;
|
2012-07-07 00:06:21 +00:00
|
|
|
} else {
|
|
|
|
// No parent --> use default.
|
|
|
|
computedAlignSelf = NS_STYLE_ALIGN_ITEMS_INITIAL_VALUE;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(computedAlignSelf != NS_STYLE_ALIGN_SELF_AUTO,
|
|
|
|
"Should have swapped out 'auto' for something non-auto");
|
|
|
|
val->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(computedAlignSelf,
|
|
|
|
nsCSSProps::kAlignSelfKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:23 +00:00
|
|
|
nsComputedDOMStyle::DoGetFlexBasis()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2012-07-07 00:06:23 +00:00
|
|
|
|
|
|
|
// XXXdholbert We could make this more automagic and resolve percentages
|
2012-07-30 14:20:58 +00:00
|
|
|
// if we wanted, by passing in a PercentageBaseGetter instead of nullptr
|
2012-07-07 00:06:23 +00:00
|
|
|
// below. Logic would go like this:
|
|
|
|
// if (i'm a flex item) {
|
|
|
|
// if (my flex container is horizontal) {
|
|
|
|
// percentageBaseGetter = &nsComputedDOMStyle::GetCBContentWidth;
|
|
|
|
// } else {
|
|
|
|
// percentageBaseGetter = &nsComputedDOMStyle::GetCBContentHeight;
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mFlexBasis, true,
|
2012-07-30 14:20:58 +00:00
|
|
|
nullptr, nsCSSProps::kWidthKTable);
|
2012-07-07 00:06:23 +00:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:20 +00:00
|
|
|
nsComputedDOMStyle::DoGetFlexDirection()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2012-07-07 00:06:20 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StylePosition()->mFlexDirection,
|
2012-07-07 00:06:20 +00:00
|
|
|
nsCSSProps::kFlexDirectionKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:22 +00:00
|
|
|
nsComputedDOMStyle::DoGetFlexGrow()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StylePosition()->mFlexGrow);
|
2012-07-07 00:06:22 +00:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:22 +00:00
|
|
|
nsComputedDOMStyle::DoGetFlexShrink()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StylePosition()->mFlexShrink);
|
2012-07-07 00:06:22 +00:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:19 +00:00
|
|
|
nsComputedDOMStyle::DoGetOrder()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StylePosition()->mOrder);
|
2012-07-07 00:06:19 +00:00
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-07-07 00:06:19 +00:00
|
|
|
nsComputedDOMStyle::DoGetJustifyContent()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2012-07-07 00:06:19 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StylePosition()->mJustifyContent,
|
2012-07-07 00:06:19 +00:00
|
|
|
nsCSSProps::kJustifyContentKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFloatEdge()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleBorder()->mFloatEdge,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kFloatEdgeKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetForceBrokenImageIcon()
|
2007-07-22 17:58:37 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleUIReset()->mForceBrokenImageIcon);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2013-08-28 22:39:06 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetImageOrientation()
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
|
|
|
nsAutoString string;
|
|
|
|
nsStyleImageOrientation orientation = StyleVisibility()->mImageOrientation;
|
|
|
|
|
|
|
|
if (orientation.IsFromImage()) {
|
|
|
|
string.AppendLiteral("from-image");
|
|
|
|
} else {
|
|
|
|
nsStyleUtil::AppendAngleValue(orientation.AngleAsCoord(), string);
|
|
|
|
|
|
|
|
if (orientation.IsFlipped()) {
|
|
|
|
string.AppendLiteral(" flip");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetString(string);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetIMEMode()
|
2007-05-16 15:51:37 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mIMEMode,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kIMEModeKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-05-16 15:51:37 +00:00
|
|
|
}
|
2002-04-20 14:30:57 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetUserFocus()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mUserFocus,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kUserFocusKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetUserInput()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mUserInput,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kUserInputKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetUserModify()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleUserInterface()->mUserModify,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kUserModifyKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetUserSelect()
|
2002-04-20 14:30:57 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleUIReset()->mUserSelect,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kUserSelectKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-04-20 14:30:57 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetDisplay()
|
2000-05-15 01:59:05 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mDisplay,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kDisplayKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPosition()
|
2002-01-11 00:15:55 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mPosition,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kPositionKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetClip()
|
2002-01-11 00:15:55 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2002-01-11 00:15:55 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2002-01-11 00:15:55 +00:00
|
|
|
|
2008-12-29 15:07:38 +00:00
|
|
|
if (display->mClipFlags == NS_STYLE_CLIP_AUTO) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
|
|
|
// create the cssvalues for the sides, stick them in the rect object
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *topVal = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *rightVal = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *bottomVal = new nsROCSSPrimitiveValue;
|
|
|
|
nsROCSSPrimitiveValue *leftVal = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:56 +00:00
|
|
|
nsDOMCSSRect * domRect = new nsDOMCSSRect(topVal, rightVal,
|
|
|
|
bottomVal, leftVal);
|
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_TOP_AUTO) {
|
|
|
|
topVal->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else {
|
|
|
|
topVal->SetAppUnits(display->mClip.y);
|
|
|
|
}
|
2006-12-30 05:17:59 +00:00
|
|
|
|
2011-03-04 17:28:56 +00:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_RIGHT_AUTO) {
|
|
|
|
rightVal->SetIdent(eCSSKeyword_auto);
|
2006-12-30 05:17:59 +00:00
|
|
|
} else {
|
2011-03-04 17:28:56 +00:00
|
|
|
rightVal->SetAppUnits(display->mClip.width + display->mClip.x);
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:56 +00:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_BOTTOM_AUTO) {
|
|
|
|
bottomVal->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else {
|
|
|
|
bottomVal->SetAppUnits(display->mClip.height + display->mClip.y);
|
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2011-03-04 17:28:56 +00:00
|
|
|
if (display->mClipFlags & NS_STYLE_CLIP_LEFT_AUTO) {
|
|
|
|
leftVal->SetIdent(eCSSKeyword_auto);
|
|
|
|
} else {
|
|
|
|
leftVal->SetAppUnits(display->mClip.x);
|
|
|
|
}
|
|
|
|
val->SetRect(domRect);
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-01-11 00:15:55 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOverflow()
|
2002-02-16 13:16:10 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2002-02-16 13:16:10 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (display->mOverflowX != display->mOverflowY) {
|
2006-12-12 21:16:23 +00:00
|
|
|
// No value to return. We can't express this combination of
|
|
|
|
// values as a shorthand.
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2006-12-12 21:16:23 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(display->mOverflowX,
|
|
|
|
nsCSSProps::kOverflowKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-09-05 00:04:04 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOverflowX()
|
2004-09-05 00:04:04 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowX,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kOverflowSubKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2004-09-05 00:04:04 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetOverflowY()
|
2004-09-05 00:04:04 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mOverflowY,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kOverflowSubKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-02-16 13:16:10 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetResize()
|
2010-03-19 11:49:33 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mResize,
|
2010-03-19 11:49:33 +00:00
|
|
|
nsCSSProps::kResizeKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2010-03-19 11:49:33 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPageBreakAfter()
|
2007-07-22 17:58:37 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay *display = StyleDisplay();
|
2007-07-22 17:58:37 +00:00
|
|
|
|
|
|
|
if (display->mBreakAfter) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_always);
|
2007-07-22 17:58:37 +00:00
|
|
|
} else {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetPageBreakBefore()
|
2007-07-22 17:58:37 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2007-07-22 17:58:37 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay *display = StyleDisplay();
|
2007-07-22 17:58:37 +00:00
|
|
|
|
|
|
|
if (display->mBreakBefore) {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_always);
|
2007-07-22 17:58:37 +00:00
|
|
|
} else {
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-22 17:58:37 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-11-08 16:09:37 +00:00
|
|
|
nsComputedDOMStyle::DoGetPageBreakInside()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mBreakInside,
|
2012-11-08 16:09:37 +00:00
|
|
|
nsCSSProps::kPageBreakInsideKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetHeight()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool calcHeight = false;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2008-01-29 21:53:09 +00:00
|
|
|
if (mInnerFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
calcHeight = true;
|
2000-05-04 00:07:33 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* displayData = StyleDisplay();
|
2006-12-30 05:17:59 +00:00
|
|
|
if (displayData->mDisplay == NS_STYLE_DISPLAY_INLINE &&
|
2008-01-29 21:53:09 +00:00
|
|
|
!(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced))) {
|
2011-10-17 14:59:28 +00:00
|
|
|
calcHeight = false;
|
2002-09-26 03:46:50 +00:00
|
|
|
}
|
|
|
|
}
|
2001-12-06 21:15:54 +00:00
|
|
|
|
|
|
|
if (calcHeight) {
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2013-04-04 14:00:07 +00:00
|
|
|
nsMargin adjustedValues = GetAdjustedValuesForBoxSizing();
|
|
|
|
val->SetAppUnits(mInnerFrame->GetContentRect().height +
|
|
|
|
adjustedValues.TopBottom());
|
2001-11-10 17:29:04 +00:00
|
|
|
} else {
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStylePosition *positionData = StylePosition();
|
2007-04-23 07:04:33 +00:00
|
|
|
|
|
|
|
nscoord minHeight =
|
|
|
|
StyleCoordToNSCoord(positionData->mMinHeight,
|
2011-10-17 14:59:28 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentHeight, 0, true);
|
2007-04-23 07:04:33 +00:00
|
|
|
|
|
|
|
nscoord maxHeight =
|
|
|
|
StyleCoordToNSCoord(positionData->mMaxHeight,
|
|
|
|
&nsComputedDOMStyle::GetCBContentHeight,
|
2011-10-17 14:59:28 +00:00
|
|
|
nscoord_MAX, true);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
SetValueToCoord(val, positionData->mHeight, true, nullptr, nullptr,
|
2007-04-23 07:04:33 +00:00
|
|
|
minHeight, maxHeight);
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetWidth()
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool calcWidth = false;
|
2002-03-16 17:04:35 +00:00
|
|
|
|
2008-01-29 21:53:09 +00:00
|
|
|
if (mInnerFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
calcWidth = true;
|
2002-10-16 03:38:52 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay *displayData = StyleDisplay();
|
2006-12-30 05:17:59 +00:00
|
|
|
if (displayData->mDisplay == NS_STYLE_DISPLAY_INLINE &&
|
2008-01-29 21:53:09 +00:00
|
|
|
!(mInnerFrame->IsFrameOfType(nsIFrame::eReplaced))) {
|
2011-10-17 14:59:28 +00:00
|
|
|
calcWidth = false;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (calcWidth) {
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2013-04-04 14:00:07 +00:00
|
|
|
nsMargin adjustedValues = GetAdjustedValuesForBoxSizing();
|
|
|
|
val->SetAppUnits(mInnerFrame->GetContentRect().width +
|
|
|
|
adjustedValues.LeftRight());
|
2002-03-16 17:04:35 +00:00
|
|
|
} else {
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStylePosition *positionData = StylePosition();
|
2007-04-23 07:04:33 +00:00
|
|
|
|
|
|
|
nscoord minWidth =
|
|
|
|
StyleCoordToNSCoord(positionData->mMinWidth,
|
2011-10-17 14:59:28 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentWidth, 0, true);
|
2007-04-23 07:04:33 +00:00
|
|
|
|
|
|
|
nscoord maxWidth =
|
|
|
|
StyleCoordToNSCoord(positionData->mMaxWidth,
|
|
|
|
&nsComputedDOMStyle::GetCBContentWidth,
|
2011-10-17 14:59:28 +00:00
|
|
|
nscoord_MAX, true);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2012-07-30 14:20:58 +00:00
|
|
|
SetValueToCoord(val, positionData->mWidth, true, nullptr,
|
2007-05-03 23:11:00 +00:00
|
|
|
nsCSSProps::kWidthKTable, minWidth, maxWidth);
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMaxHeight()
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mMaxHeight, true,
|
2007-04-23 07:04:33 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentHeight);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMaxWidth()
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mMaxWidth, true,
|
2007-05-03 23:11:00 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentWidth,
|
|
|
|
nsCSSProps::kWidthKTable);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMinHeight()
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-03-28 06:33:19 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mMinHeight, true,
|
2007-02-20 18:43:16 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentHeight);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMinWidth()
|
2002-02-18 22:54:15 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-03-28 06:33:19 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mMinWidth, true,
|
2007-05-03 23:11:00 +00:00
|
|
|
&nsComputedDOMStyle::GetCBContentWidth,
|
|
|
|
nsCSSProps::kWidthKTable);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-02-18 22:54:15 +00:00
|
|
|
}
|
|
|
|
|
2013-08-07 07:59:10 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetMixBlendMode()
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleDisplay()->mMixBlendMode,
|
|
|
|
nsCSSProps::kBlendModeKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetLeft()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_LEFT);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetRight()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_RIGHT);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTop()
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetOffsetWidthFor(NS_SIDE_TOP);
|
2000-05-04 00:07:33 +00:00
|
|
|
}
|
|
|
|
|
2002-07-08 07:11:59 +00:00
|
|
|
nsDOMCSSValueList*
|
2011-09-29 06:19:26 +00:00
|
|
|
nsComputedDOMStyle::GetROCSSValueList(bool aCommaDelimited)
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2012-10-01 16:49:41 +00:00
|
|
|
nsDOMCSSValueList *valueList = new nsDOMCSSValueList(aCommaDelimited, true);
|
2002-07-08 07:11:59 +00:00
|
|
|
NS_ASSERTION(valueList != 0, "ran out of memory");
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide)
|
2000-05-04 00:07:33 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2000-05-17 06:26:23 +00:00
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t position = display->mPosition;
|
2010-08-25 10:17:55 +00:00
|
|
|
if (!mOuterFrame) {
|
|
|
|
// GetRelativeOffset and GetAbsoluteOffset don't handle elements
|
|
|
|
// without frames in any sensible way. GetStaticOffset, however,
|
|
|
|
// is perfect for that case.
|
|
|
|
position = NS_STYLE_POSITION_STATIC;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (position) {
|
2006-12-30 05:17:59 +00:00
|
|
|
case NS_STYLE_POSITION_STATIC:
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetStaticOffset(aSide);
|
2006-12-30 05:17:59 +00:00
|
|
|
case NS_STYLE_POSITION_RELATIVE:
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetRelativeOffset(aSide);
|
2013-08-16 00:31:32 +00:00
|
|
|
case NS_STYLE_POSITION_STICKY:
|
|
|
|
return GetStickyOffset(aSide);
|
2006-12-30 05:17:59 +00:00
|
|
|
case NS_STYLE_POSITION_ABSOLUTE:
|
|
|
|
case NS_STYLE_POSITION_FIXED:
|
2011-03-04 17:28:57 +00:00
|
|
|
return GetAbsoluteOffset(aSide);
|
2006-12-30 05:17:59 +00:00
|
|
|
default:
|
|
|
|
NS_ERROR("Invalid position");
|
2012-07-30 14:20:58 +00:00
|
|
|
return nullptr;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide)
|
2001-11-10 17:29:04 +00:00
|
|
|
{
|
2013-02-16 18:34:34 +00:00
|
|
|
MOZ_ASSERT(mOuterFrame, "need a frame, so we can call GetContainingBlock()");
|
|
|
|
|
|
|
|
nsIFrame* container = mOuterFrame->GetContainingBlock();
|
|
|
|
nsMargin margin = mOuterFrame->GetUsedMargin();
|
|
|
|
nsMargin border = container->GetUsedBorder();
|
|
|
|
nsMargin scrollbarSizes(0, 0, 0, 0);
|
|
|
|
nsRect rect = mOuterFrame->GetRect();
|
|
|
|
nsRect containerRect = container->GetRect();
|
|
|
|
|
|
|
|
if (container->GetType() == nsGkAtoms::viewportFrame) {
|
|
|
|
// For absolutely positioned frames scrollbars are taken into
|
|
|
|
// account by virtue of getting a containing block that does
|
|
|
|
// _not_ include the scrollbars. For fixed positioned frames,
|
|
|
|
// the containing block is the viewport, which _does_ include
|
|
|
|
// scrollbars. We have to do some extra work.
|
|
|
|
// the first child in the default frame list is what we want
|
|
|
|
nsIFrame* scrollingChild = container->GetFirstPrincipalChild();
|
|
|
|
nsIScrollableFrame *scrollFrame = do_QueryFrame(scrollingChild);
|
|
|
|
if (scrollFrame) {
|
|
|
|
scrollbarSizes = scrollFrame->GetActualScrollbarSizes();
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
2013-02-16 18:34:34 +00:00
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
nscoord offset = 0;
|
|
|
|
switch (aSide) {
|
|
|
|
case NS_SIDE_TOP:
|
|
|
|
offset = rect.y - margin.top - border.top - scrollbarSizes.top;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
break;
|
|
|
|
case NS_SIDE_RIGHT:
|
|
|
|
offset = containerRect.width - rect.width -
|
|
|
|
rect.x - margin.right - border.right - scrollbarSizes.right;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
break;
|
|
|
|
case NS_SIDE_BOTTOM:
|
|
|
|
offset = containerRect.height - rect.height -
|
|
|
|
rect.y - margin.bottom - border.bottom - scrollbarSizes.bottom;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
break;
|
|
|
|
case NS_SIDE_LEFT:
|
|
|
|
offset = rect.x - margin.left - border.left - scrollbarSizes.left;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
NS_ERROR("Invalid side");
|
|
|
|
break;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 18:34:34 +00:00
|
|
|
val->SetAppUnits(offset);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2013-07-18 17:59:53 +00:00
|
|
|
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
|
|
|
|
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
|
|
|
|
"box side constants not as expected for NS_OPPOSITE_SIDE");
|
2010-04-27 16:15:02 +00:00
|
|
|
#define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3)
|
2004-11-30 05:31:37 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide)
|
2001-11-10 17:29:04 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2001-11-10 17:29:04 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStylePosition* positionData = StylePosition();
|
2012-08-22 15:56:38 +00:00
|
|
|
int32_t sign = 1;
|
2008-03-06 00:05:26 +00:00
|
|
|
nsStyleCoord coord = positionData->mOffset.Get(aSide);
|
2007-08-16 23:19:25 +00:00
|
|
|
|
|
|
|
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
|
|
|
|
coord.GetUnit() == eStyleUnit_Percent ||
|
2010-08-25 10:17:56 +00:00
|
|
|
coord.GetUnit() == eStyleUnit_Auto ||
|
|
|
|
coord.IsCalcUnit(),
|
2007-08-16 23:19:25 +00:00
|
|
|
"Unexpected unit");
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-08-16 23:19:25 +00:00
|
|
|
if (coord.GetUnit() == eStyleUnit_Auto) {
|
2008-03-06 00:05:26 +00:00
|
|
|
coord = positionData->mOffset.Get(NS_OPPOSITE_SIDE(aSide));
|
2006-12-30 05:17:59 +00:00
|
|
|
sign = -1;
|
|
|
|
}
|
2007-08-16 23:19:25 +00:00
|
|
|
PercentageBaseGetter baseGetter;
|
|
|
|
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
|
|
|
baseGetter = &nsComputedDOMStyle::GetCBContentWidth;
|
|
|
|
} else {
|
|
|
|
baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0, false));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2013-08-16 00:31:32 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::GetStickyOffset(mozilla::css::Side aSide)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
|
|
|
|
|
|
|
const nsStylePosition* positionData = StylePosition();
|
|
|
|
nsStyleCoord coord = positionData->mOffset.Get(aSide);
|
|
|
|
|
|
|
|
NS_ASSERTION(coord.GetUnit() == eStyleUnit_Coord ||
|
|
|
|
coord.GetUnit() == eStyleUnit_Percent ||
|
|
|
|
coord.GetUnit() == eStyleUnit_Auto ||
|
|
|
|
coord.IsCalcUnit(),
|
|
|
|
"Unexpected unit");
|
|
|
|
|
|
|
|
if (coord.GetUnit() == eStyleUnit_Auto) {
|
|
|
|
val->SetIdent(eCSSKeyword_auto);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
PercentageBaseGetter baseGetter;
|
|
|
|
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
|
|
|
|
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentWidth;
|
|
|
|
} else {
|
|
|
|
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentHeight;
|
|
|
|
}
|
|
|
|
|
|
|
|
val->SetAppUnits(StyleCoordToNSCoord(coord, baseGetter, 0, false));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide)
|
2001-11-10 17:29:04 +00:00
|
|
|
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StylePosition()->mOffset.Get(aSide), false);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
2000-05-15 01:59:05 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2002-10-16 03:38:52 +00:00
|
|
|
|
2008-01-29 21:53:09 +00:00
|
|
|
if (!mInnerFrame) {
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StylePadding()->mPadding.Get(aSide), true);
|
2006-12-15 23:39:43 +00:00
|
|
|
} else {
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-04-19 03:07:22 +00:00
|
|
|
val->SetAppUnits(mInnerFrame->GetUsedPadding().Side(aSide));
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-11-10 17:29:04 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2007-02-20 18:43:16 +00:00
|
|
|
nsComputedDOMStyle::GetLineHeightCoord(nscoord& aCoord)
|
2002-03-16 17:04:35 +00:00
|
|
|
{
|
2009-05-18 22:13:12 +00:00
|
|
|
AssertFlushedPendingReflows();
|
|
|
|
|
|
|
|
nscoord blockHeight = NS_AUTOHEIGHT;
|
2013-02-16 21:51:02 +00:00
|
|
|
if (StyleText()->mLineHeight.GetUnit() == eStyleUnit_Enumerated) {
|
2009-05-18 22:13:12 +00:00
|
|
|
if (!mInnerFrame)
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2009-05-18 22:13:12 +00:00
|
|
|
|
2011-05-12 04:04:30 +00:00
|
|
|
if (nsLayoutUtils::IsNonWrapperBlock(mInnerFrame)) {
|
2009-05-18 22:13:12 +00:00
|
|
|
blockHeight = mInnerFrame->GetContentRect().height;
|
|
|
|
} else {
|
|
|
|
GetCBContentHeight(blockHeight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-11-24 02:48:23 +00:00
|
|
|
// lie about font size inflation since we lie about font size (since
|
|
|
|
// the inflation only applies to text)
|
2009-05-18 22:13:12 +00:00
|
|
|
aCoord = nsHTMLReflowState::CalcLineHeight(mStyleContextHolder,
|
2011-11-24 02:48:23 +00:00
|
|
|
blockHeight, 1.0f);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-05-05 05:30:10 +00: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.
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleFont* font = StyleFont();
|
2013-06-29 03:28:50 +00:00
|
|
|
float fCoord = float(aCoord);
|
|
|
|
if (font->mAllowZoom) {
|
|
|
|
fCoord /= mPresShell->GetPresContext()->TextZoom();
|
|
|
|
}
|
2011-11-01 07:06:50 +00:00
|
|
|
if (font->mFont.size != font->mSize) {
|
|
|
|
fCoord = fCoord * (float(font->mSize) / float(font->mFont.size));
|
|
|
|
}
|
|
|
|
aCoord = NSToCoordRound(fCoord);
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2002-03-16 17:04:35 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide)
|
2002-07-08 07:11:59 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleBorder *border = StyleBorder();
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2006-12-30 05:17:59 +00:00
|
|
|
if (border->mBorderColors) {
|
2004-11-30 05:31:37 +00:00
|
|
|
nsBorderColors* borderColors = border->mBorderColors[aSide];
|
2002-07-08 07:11:59 +00:00
|
|
|
if (borderColors) {
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2002-07-08 07:11:59 +00:00
|
|
|
|
|
|
|
do {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *primitive = new nsROCSSPrimitiveValue;
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
SetToRGBAColor(primitive, borderColors->mColor);
|
2002-07-08 07:11:59 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(primitive);
|
2002-07-08 07:11:59 +00:00
|
|
|
borderColors = borderColors->mNext;
|
|
|
|
} while (borderColors);
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2002-07-08 07:11:59 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2007-01-28 17:20:01 +00:00
|
|
|
nscoord width;
|
2008-01-29 21:53:09 +00:00
|
|
|
if (mInnerFrame) {
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2011-04-19 03:07:22 +00:00
|
|
|
width = mInnerFrame->GetUsedBorder().Side(aSide);
|
2007-01-28 17:20:01 +00:00
|
|
|
} else {
|
2013-02-16 21:51:02 +00:00
|
|
|
width = StyleBorder()->GetComputedBorderWidth(aSide);
|
2007-01-28 17:20:01 +00:00
|
|
|
}
|
2007-02-07 07:46:44 +00:00
|
|
|
val->SetAppUnits(width);
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-30 02:08:48 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide)
|
2001-03-30 02:08:48 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2001-03-30 02:08:48 +00:00
|
|
|
|
2010-04-27 16:15:01 +00:00
|
|
|
nscolor color;
|
2011-09-29 06:19:26 +00:00
|
|
|
bool foreground;
|
2013-02-16 21:51:02 +00:00
|
|
|
StyleBorder()->GetBorderColor(aSide, color, foreground);
|
2008-09-12 15:35:53 +00:00
|
|
|
if (foreground) {
|
2013-02-16 21:51:02 +00:00
|
|
|
color = StyleColor()->mColor;
|
2008-09-12 15:35:53 +00:00
|
|
|
}
|
2002-09-07 01:48:39 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
SetToRGBAColor(val, color);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-11 21:03:08 +00:00
|
|
|
}
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide)
|
2001-03-11 20:47:06 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2001-03-11 20:47:06 +00:00
|
|
|
|
2008-01-29 21:53:09 +00:00
|
|
|
if (!mInnerFrame) {
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleMargin()->mMargin.Get(aSide), false);
|
2006-12-15 23:39:43 +00:00
|
|
|
} else {
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 18:43:16 +00:00
|
|
|
|
Bug 659828 - Part 1: Apply table margins to the outer table frame instead of the inner table frame (also fixes bug 87277); r=dbaron
Outer table frames act as CSS2.1 table wrapper boxes. We used to lay them out
without taking their margins into the account, which meant that their width was
always equal to the available width. This breaks horizontal positioning of
absolutely positioned kids of a table frame.
The main purpose of this patch is to apply the margins of tables to their outer
frame, instead of the inner frame. This means that the inner table frame will
always have a zero margin, which means that a lot of the stuff which used to
rely on the fact that table margins are applied to the inner frame need to
change.
In particular, in order to get the computed margins of a table, we used to query
the inner table frame, and this patch corrects that. Also, when shrink wrapping
tables, we used to not take the margins of the inner table frame into account,
which is fixed by this patch too. nsBlockReflowState::
ComputeReplacedBlockOffsetsForFloats also needed to be changed to read the
margin values from the outer frame too.
Also, as part of this patch, we start to respect the CSS2.1 margin model for
captions on all sides. This means that in particular, the top/bottom margins on
the top-outside and bottom-outside captions will not be collapsed with the
top/bottom margins of the table, and that the margins of the caption element
contribute to the width and height of the outer table frame. The
427129-table-caption reftest has been modified to match this new behavior.
Another side effect of this bug is fixing bug 87277, and the reftests for that
bug are marked as passing in this patch.
2011-05-31 23:02:56 +00:00
|
|
|
// For tables, GetUsedMargin always returns an empty margin, so we
|
|
|
|
// should read the margin from the outer table frame instead.
|
|
|
|
val->SetAppUnits(mOuterFrame->GetUsedMargin().Side(aSide));
|
|
|
|
NS_ASSERTION(mOuterFrame == mInnerFrame ||
|
|
|
|
mInnerFrame->GetUsedMargin() == nsMargin(0, 0, 0, 0),
|
|
|
|
"Inner tables must have zero margins");
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
Landing the XPCDOM_20010329_BRANCH branch, changes mostly done by jband@netscape.com and jst@netscape.com, also some changes done by shaver@mozilla.org, peterv@netscape.com and markh@activestate.com. r= and sr= by vidur@netscape.com, jband@netscape.com, jst@netscpae.com, danm@netscape.com, hyatt@netscape.com, shaver@mozilla.org, dbradley@netscape.com, rpotts@netscape.com.
2001-05-08 16:46:42 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide)
|
2001-03-03 00:44:19 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleBorder()->GetBorderStyle(aSide),
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kBorderStyleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2001-03-03 00:44:19 +00:00
|
|
|
}
|
2002-10-08 01:53:31 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::SetValueToCoord(nsROCSSPrimitiveValue* aValue,
|
2007-04-23 07:04:33 +00:00
|
|
|
const nsStyleCoord& aCoord,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aClampNegativeCalc,
|
2007-02-20 18:43:16 +00:00
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
2012-08-22 15:56:38 +00:00
|
|
|
const int32_t aTable[],
|
2007-04-23 07:04:33 +00:00
|
|
|
nscoord aMinAppUnits,
|
|
|
|
nscoord aMaxAppUnits)
|
2007-02-20 18:43:16 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aValue, "Must have a value to work with");
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
switch (aCoord.GetUnit()) {
|
|
|
|
case eStyleUnit_Normal:
|
2009-01-23 01:28:14 +00:00
|
|
|
aValue->SetIdent(eCSSKeyword_normal);
|
2007-02-20 18:43:16 +00:00
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
case eStyleUnit_Auto:
|
2009-01-23 01:28:14 +00:00
|
|
|
aValue->SetIdent(eCSSKeyword_auto);
|
2007-02-20 18:43:16 +00:00
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
case eStyleUnit_Percent:
|
|
|
|
{
|
|
|
|
nscoord percentageBase;
|
|
|
|
if (aPercentageBaseGetter &&
|
|
|
|
(this->*aPercentageBaseGetter)(percentageBase)) {
|
2010-07-03 04:18:56 +00:00
|
|
|
nscoord val = NSCoordSaturatingMultiply(percentageBase,
|
|
|
|
aCoord.GetPercentValue());
|
2013-01-15 12:22:03 +00:00
|
|
|
aValue->SetAppUnits(std::max(aMinAppUnits, std::min(val, aMaxAppUnits)));
|
2007-02-20 18:43:16 +00:00
|
|
|
} else {
|
|
|
|
aValue->SetPercent(aCoord.GetPercentValue());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
case eStyleUnit_Factor:
|
|
|
|
aValue->SetNumber(aCoord.GetFactorValue());
|
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
case eStyleUnit_Coord:
|
|
|
|
{
|
|
|
|
nscoord val = aCoord.GetCoordValue();
|
2013-01-15 12:22:03 +00:00
|
|
|
aValue->SetAppUnits(std::max(aMinAppUnits, std::min(val, aMaxAppUnits)));
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
case eStyleUnit_Integer:
|
|
|
|
aValue->SetNumber(aCoord.GetIntValue());
|
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-02-20 18:43:16 +00:00
|
|
|
case eStyleUnit_Enumerated:
|
|
|
|
NS_ASSERTION(aTable, "Must have table to handle this case");
|
2009-01-23 01:28:14 +00:00
|
|
|
aValue->SetIdent(nsCSSProps::ValueToKeywordEnum(aCoord.GetIntValue(),
|
|
|
|
aTable));
|
2007-02-20 18:43:16 +00:00
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-05-11 06:01:31 +00:00
|
|
|
case eStyleUnit_None:
|
2009-01-23 01:28:14 +00:00
|
|
|
aValue->SetIdent(eCSSKeyword_none);
|
2007-02-20 18:43:16 +00:00
|
|
|
break;
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2010-09-11 16:27:13 +00:00
|
|
|
case eStyleUnit_Calc:
|
|
|
|
nscoord percentageBase;
|
|
|
|
if (!aCoord.CalcHasPercent()) {
|
|
|
|
nscoord val = nsRuleNode::ComputeCoordPercentCalc(aCoord, 0);
|
|
|
|
if (aClampNegativeCalc && val < 0) {
|
|
|
|
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(),
|
|
|
|
"parser should have rejected value");
|
|
|
|
val = 0;
|
|
|
|
}
|
2013-01-15 12:22:03 +00:00
|
|
|
aValue->SetAppUnits(std::max(aMinAppUnits, std::min(val, aMaxAppUnits)));
|
2010-09-11 16:27:13 +00:00
|
|
|
} else if (aPercentageBaseGetter &&
|
|
|
|
(this->*aPercentageBaseGetter)(percentageBase)) {
|
|
|
|
nscoord val =
|
|
|
|
nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase);
|
|
|
|
if (aClampNegativeCalc && val < 0) {
|
|
|
|
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(),
|
|
|
|
"parser should have rejected value");
|
|
|
|
val = 0;
|
2010-07-03 04:18:56 +00:00
|
|
|
}
|
2013-01-15 12:22:03 +00:00
|
|
|
aValue->SetAppUnits(std::max(aMinAppUnits, std::min(val, aMaxAppUnits)));
|
2010-07-03 04:18:56 +00:00
|
|
|
} else {
|
2010-09-11 16:27:13 +00:00
|
|
|
nsStyleCoord::Calc *calc = aCoord.GetCalcValue();
|
2010-09-15 15:11:26 +00:00
|
|
|
SetValueToCalc(calc, aValue);
|
2010-07-03 04:18:56 +00:00
|
|
|
}
|
2007-02-20 18:43:16 +00:00
|
|
|
break;
|
2013-07-26 06:02:33 +00:00
|
|
|
|
|
|
|
case eStyleUnit_Degree:
|
|
|
|
aValue->SetDegree(aCoord.GetAngleValue());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Grad:
|
|
|
|
aValue->SetGrad(aCoord.GetAngleValue());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Radian:
|
|
|
|
aValue->SetRadian(aCoord.GetAngleValue());
|
|
|
|
break;
|
|
|
|
|
|
|
|
case eStyleUnit_Turn:
|
|
|
|
aValue->SetTurn(aCoord.GetAngleValue());
|
|
|
|
break;
|
|
|
|
|
2010-09-11 16:27:13 +00:00
|
|
|
default:
|
|
|
|
NS_ERROR("Can't handle this unit");
|
|
|
|
break;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
nscoord
|
2007-04-23 07:04:33 +00:00
|
|
|
nsComputedDOMStyle::StyleCoordToNSCoord(const nsStyleCoord& aCoord,
|
|
|
|
PercentageBaseGetter aPercentageBaseGetter,
|
2010-09-09 15:21:46 +00:00
|
|
|
nscoord aDefaultValue,
|
2011-09-29 06:19:26 +00:00
|
|
|
bool aClampNegativeCalc)
|
2007-02-20 18:43:16 +00:00
|
|
|
{
|
|
|
|
NS_PRECONDITION(aPercentageBaseGetter, "Must have a percentage base getter");
|
2010-07-03 04:18:56 +00:00
|
|
|
if (aCoord.GetUnit() == eStyleUnit_Coord) {
|
|
|
|
return aCoord.GetCoordValue();
|
|
|
|
}
|
|
|
|
if (aCoord.GetUnit() == eStyleUnit_Percent || aCoord.IsCalcUnit()) {
|
|
|
|
nscoord percentageBase;
|
|
|
|
if ((this->*aPercentageBaseGetter)(percentageBase)) {
|
2010-09-09 15:21:46 +00:00
|
|
|
nscoord result =
|
|
|
|
nsRuleNode::ComputeCoordPercentCalc(aCoord, percentageBase);
|
|
|
|
if (aClampNegativeCalc && result < 0) {
|
|
|
|
NS_ABORT_IF_FALSE(aCoord.IsCalcUnit(),
|
|
|
|
"parser should have rejected value");
|
|
|
|
result = 0;
|
|
|
|
}
|
|
|
|
return result;
|
2010-07-03 04:18:56 +00:00
|
|
|
}
|
|
|
|
// Fall through to returning aDefaultValue if we have no percentage base.
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
2010-04-27 16:15:01 +00:00
|
|
|
|
2007-04-23 07:04:33 +00:00
|
|
|
return aDefaultValue;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2007-02-20 18:43:16 +00:00
|
|
|
nsComputedDOMStyle::GetCBContentWidth(nscoord& aWidth)
|
|
|
|
{
|
2008-01-29 21:53:09 +00:00
|
|
|
if (!mOuterFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 18:43:16 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
nsIFrame* container = mOuterFrame->GetContainingBlock();
|
2007-02-20 18:43:16 +00:00
|
|
|
aWidth = container->GetContentRect().width;
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2007-02-20 18:43:16 +00:00
|
|
|
nsComputedDOMStyle::GetCBContentHeight(nscoord& aHeight)
|
|
|
|
{
|
2008-01-29 21:53:09 +00:00
|
|
|
if (!mOuterFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 18:43:16 +00:00
|
|
|
|
2013-02-16 18:34:34 +00:00
|
|
|
nsIFrame* container = mOuterFrame->GetContainingBlock();
|
2007-02-20 18:43:16 +00:00
|
|
|
aHeight = container->GetContentRect().height;
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
|
2013-08-16 00:31:32 +00:00
|
|
|
bool
|
|
|
|
nsComputedDOMStyle::GetScrollFrameContentWidth(nscoord& aWidth)
|
|
|
|
{
|
|
|
|
if (!mOuterFrame) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
AssertFlushedPendingReflows();
|
|
|
|
|
|
|
|
nsIScrollableFrame* scrollableFrame =
|
|
|
|
nsLayoutUtils::GetNearestScrollableFrame(mOuterFrame->GetParent(),
|
|
|
|
nsLayoutUtils::SCROLLABLE_SAME_DOC |
|
|
|
|
nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN);
|
|
|
|
|
|
|
|
if (!scrollableFrame) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aWidth =
|
|
|
|
scrollableFrame->GetScrolledFrame()->GetContentRectRelativeToSelf().width;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsComputedDOMStyle::GetScrollFrameContentHeight(nscoord& aHeight)
|
|
|
|
{
|
|
|
|
if (!mOuterFrame) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
AssertFlushedPendingReflows();
|
|
|
|
|
|
|
|
nsIScrollableFrame* scrollableFrame =
|
|
|
|
nsLayoutUtils::GetNearestScrollableFrame(mOuterFrame->GetParent(),
|
|
|
|
nsLayoutUtils::SCROLLABLE_SAME_DOC |
|
|
|
|
nsLayoutUtils::SCROLLABLE_INCLUDE_HIDDEN);
|
|
|
|
|
|
|
|
if (!scrollableFrame) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
aHeight =
|
|
|
|
scrollableFrame->GetScrolledFrame()->GetContentRectRelativeToSelf().height;
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2007-02-20 18:43:16 +00:00
|
|
|
nsComputedDOMStyle::GetFrameBorderRectWidth(nscoord& aWidth)
|
|
|
|
{
|
2008-01-29 21:53:09 +00:00
|
|
|
if (!mInnerFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2007-02-20 18:43:16 +00:00
|
|
|
|
2008-01-29 21:53:09 +00:00
|
|
|
aWidth = mInnerFrame->GetSize().width;
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2007-02-20 18:43:16 +00:00
|
|
|
}
|
2002-10-08 01:53:31 +00:00
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2010-10-07 04:25:47 +00:00
|
|
|
nsComputedDOMStyle::GetFrameBorderRectHeight(nscoord& aHeight)
|
|
|
|
{
|
|
|
|
if (!mInnerFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2010-10-07 04:25:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
AssertFlushedPendingReflows();
|
|
|
|
|
|
|
|
aHeight = mInnerFrame->GetSize().height;
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2010-10-07 04:25:47 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2008-09-13 09:42:11 +00:00
|
|
|
nsComputedDOMStyle::GetFrameBoundsWidthForTransform(nscoord& aWidth)
|
|
|
|
{
|
|
|
|
// We need a frame to work with.
|
|
|
|
if (!mInnerFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2008-09-13 09:42:11 +00:00
|
|
|
|
|
|
|
aWidth = nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame).width;
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
bool
|
2008-09-13 09:42:11 +00:00
|
|
|
nsComputedDOMStyle::GetFrameBoundsHeightForTransform(nscoord& aHeight)
|
|
|
|
{
|
|
|
|
// We need a frame to work with.
|
|
|
|
if (!mInnerFrame) {
|
2011-10-17 14:59:28 +00:00
|
|
|
return false;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
|
|
|
|
2009-02-25 00:14:45 +00:00
|
|
|
AssertFlushedPendingReflows();
|
2008-09-13 09:42:11 +00:00
|
|
|
|
|
|
|
aHeight = nsDisplayTransform::GetFrameBoundsForTransform(mInnerFrame).height;
|
2011-10-17 14:59:28 +00:00
|
|
|
return true;
|
2008-09-13 09:42:11 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-09-29 06:19:26 +00:00
|
|
|
nsComputedDOMStyle::GetSVGPaintFor(bool aFill)
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVG* svg = StyleSVG();
|
2012-07-30 14:20:58 +00:00
|
|
|
const nsStyleSVGPaint* paint = nullptr;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (aFill)
|
|
|
|
paint = &svg->mFill;
|
|
|
|
else
|
|
|
|
paint = &svg->mStroke;
|
|
|
|
|
|
|
|
nsAutoString paintString;
|
|
|
|
|
|
|
|
switch (paint->mType) {
|
2011-03-04 17:28:57 +00:00
|
|
|
case eStyleSVGPaintType_None:
|
|
|
|
{
|
|
|
|
val->SetIdent(eCSSKeyword_none);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleSVGPaintType_Color:
|
|
|
|
{
|
|
|
|
SetToRGBAColor(val, paint->mPaint.mColor);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case eStyleSVGPaintType_Server:
|
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(false);
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(val);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* fallback = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(fallback);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
val->SetURI(paint->mPaint.mPaintServer);
|
|
|
|
SetToRGBAColor(fallback, paint->mFallbackColor);
|
|
|
|
return valueList;
|
|
|
|
}
|
2013-05-16 02:35:15 +00:00
|
|
|
case eStyleSVGPaintType_ContextFill:
|
2012-09-06 04:58:46 +00:00
|
|
|
{
|
2013-05-16 02:35:15 +00:00
|
|
|
val->SetIdent(eCSSKeyword_context_fill);
|
2012-09-06 04:58:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2013-05-16 02:35:15 +00:00
|
|
|
case eStyleSVGPaintType_ContextStroke:
|
2012-09-06 04:58:46 +00:00
|
|
|
{
|
2013-05-16 02:35:15 +00:00
|
|
|
val->SetIdent(eCSSKeyword_context_stroke);
|
2012-09-06 04:58:46 +00:00
|
|
|
break;
|
|
|
|
}
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFill()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
return GetSVGPaintFor(true);
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStroke()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2011-10-17 14:59:28 +00:00
|
|
|
return GetSVGPaintFor(false);
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarkerEnd()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVG* svg = StyleSVG();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (svg->mMarkerEnd)
|
|
|
|
val->SetURI(svg->mMarkerEnd);
|
|
|
|
else
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarkerMid()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVG* svg = StyleSVG();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (svg->mMarkerMid)
|
|
|
|
val->SetURI(svg->mMarkerMid);
|
|
|
|
else
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMarkerStart()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVG* svg = StyleSVG();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (svg->mMarkerStart)
|
|
|
|
val->SetURI(svg->mMarkerStart);
|
|
|
|
else
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeDasharray()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVG* svg = StyleSVG();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (!svg->mStrokeDasharrayLength || !svg->mStrokeDasharray) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
for (uint32_t i = 0; i < svg->mStrokeDasharrayLength; i++) {
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* dash = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(dash);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
SetValueToCoord(dash, svg->mStrokeDasharray[i], true);
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeDashoffset()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleSVG()->mStrokeDashoffset, false);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeWidth()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetValueToCoord(val, StyleSVG()->mStrokeWidth, true);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2012-05-18 08:33:40 +00:00
|
|
|
nsComputedDOMStyle::DoGetVectorEffect()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(StyleSVGReset()->mVectorEffect,
|
2012-05-18 08:33:40 +00:00
|
|
|
nsCSSProps::kVectorEffectKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFillOpacity()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleSVG()->mFillOpacity);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFloodOpacity()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleSVGReset()->mFloodOpacity);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStopOpacity()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleSVGReset()->mStopOpacity);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeMiterlimit()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleSVG()->mStrokeMiterlimit);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeOpacity()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
val->SetNumber(StyleSVG()->mStrokeOpacity);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetClipRule()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(
|
2013-02-16 21:51:02 +00:00
|
|
|
StyleSVG()->mClipRule, nsCSSProps::kFillRuleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFillRule()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(nsCSSProps::ValueToKeywordEnum(
|
2013-02-16 21:51:02 +00:00
|
|
|
StyleSVG()->mFillRule, nsCSSProps::kFillRuleKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeLinecap()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mStrokeLinecap,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kStrokeLinecapKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStrokeLinejoin()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mStrokeLinejoin,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kStrokeLinejoinKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextAnchor()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mTextAnchor,
|
2009-01-23 01:28:14 +00:00
|
|
|
nsCSSProps::kTextAnchorKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColorInterpolation()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mColorInterpolation,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kColorInterpolationKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetColorInterpolationFilters()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mColorInterpolationFilters,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kColorInterpolationKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetDominantBaseline()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVGReset()->mDominantBaseline,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kDominantBaselineKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetImageRendering()
|
2009-03-21 15:36:38 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mImageRendering,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kImageRenderingKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2009-03-21 15:36:38 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetShapeRendering()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mShapeRendering,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kShapeRenderingKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTextRendering()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2009-10-21 21:57:57 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVG()->mTextRendering,
|
2009-10-21 21:57:57 +00:00
|
|
|
nsCSSProps::kTextRenderingKTable));
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFloodColor()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetToRGBAColor(val, StyleSVGReset()->mFloodColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetLightingColor()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetToRGBAColor(val, StyleSVGReset()->mLightingColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-26 06:57:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetStopColor()
|
2007-07-26 06:57:42 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-02-16 21:51:02 +00:00
|
|
|
SetToRGBAColor(val, StyleSVGReset()->mStopColor);
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetClipPath()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVGReset* svg = StyleSVGReset();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (svg->mClipPath)
|
|
|
|
val->SetURI(svg->mClipPath);
|
|
|
|
else
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2013-07-22 22:08:33 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::SetCssTextToCoord(nsAString& aCssText,
|
|
|
|
const nsStyleCoord& aCoord)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
|
|
|
bool clampNegativeCalc = true;
|
|
|
|
SetValueToCoord(value, aCoord, clampNegativeCalc);
|
|
|
|
value->GetCssText(aCssText);
|
|
|
|
delete value;
|
|
|
|
}
|
|
|
|
|
2013-08-05 07:02:27 +00:00
|
|
|
CSSValue*
|
2013-07-22 22:08:33 +00:00
|
|
|
nsComputedDOMStyle::CreatePrimitiveValueForStyleFilter(
|
|
|
|
const nsStyleFilter& aStyleFilter)
|
|
|
|
{
|
|
|
|
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
|
|
|
// Handle url().
|
2013-08-06 07:53:30 +00:00
|
|
|
if (aStyleFilter.GetType() == NS_STYLE_FILTER_URL) {
|
2013-08-05 07:02:27 +00:00
|
|
|
value->SetURI(aStyleFilter.GetURL());
|
2013-07-22 22:08:33 +00:00
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Filter function name and opening parenthesis.
|
|
|
|
nsAutoString filterFunctionString;
|
2013-08-06 07:53:30 +00:00
|
|
|
AppendASCIItoUTF16(
|
|
|
|
nsCSSProps::ValueToKeyword(aStyleFilter.GetType(),
|
|
|
|
nsCSSProps::kFilterFunctionKTable),
|
|
|
|
filterFunctionString);
|
|
|
|
filterFunctionString.AppendLiteral("(");
|
2013-07-22 22:08:33 +00:00
|
|
|
|
|
|
|
nsAutoString argumentString;
|
2013-08-06 07:53:30 +00:00
|
|
|
if (aStyleFilter.GetType() == NS_STYLE_FILTER_DROP_SHADOW) {
|
2013-08-05 07:02:27 +00:00
|
|
|
// Handle drop-shadow()
|
|
|
|
nsRefPtr<CSSValue> shadowValue =
|
|
|
|
GetCSSShadowArray(aStyleFilter.GetDropShadow(),
|
|
|
|
StyleColor()->mColor,
|
|
|
|
false);
|
|
|
|
ErrorResult dummy;
|
|
|
|
shadowValue->GetCssText(argumentString, dummy);
|
|
|
|
} else {
|
|
|
|
// Filter function argument.
|
|
|
|
SetCssTextToCoord(argumentString, aStyleFilter.GetFilterParameter());
|
|
|
|
}
|
2013-07-22 22:08:33 +00:00
|
|
|
filterFunctionString.Append(argumentString);
|
|
|
|
|
|
|
|
// Filter function closing parenthesis.
|
|
|
|
filterFunctionString.AppendLiteral(")");
|
|
|
|
|
|
|
|
value->SetString(filterFunctionString);
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetFilter()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-07-22 22:08:33 +00:00
|
|
|
const nsTArray<nsStyleFilter>& filters = StyleSVGReset()->mFilters;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-07-22 22:08:33 +00:00
|
|
|
if (filters.IsEmpty()) {
|
|
|
|
nsROCSSPrimitiveValue* value = new nsROCSSPrimitiveValue;
|
|
|
|
value->SetIdent(eCSSKeyword_none);
|
|
|
|
return value;
|
|
|
|
}
|
2013-07-23 15:36:45 +00:00
|
|
|
|
2013-07-22 22:08:33 +00:00
|
|
|
nsDOMCSSValueList* valueList = GetROCSSValueList(false);
|
|
|
|
for(uint32_t i = 0; i < filters.Length(); i++) {
|
2013-08-05 07:02:27 +00:00
|
|
|
CSSValue* value = CreatePrimitiveValueForStyleFilter(filters[i]);
|
2013-07-22 22:08:33 +00:00
|
|
|
valueList->AppendCSSValue(value);
|
|
|
|
}
|
|
|
|
return valueList;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetMask()
|
2007-07-21 14:20:25 +00:00
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* val = new nsROCSSPrimitiveValue;
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleSVGReset* svg = StyleSVGReset();
|
2007-07-21 14:20:25 +00:00
|
|
|
|
|
|
|
if (svg->mMask)
|
|
|
|
val->SetURI(svg->mMask);
|
|
|
|
else
|
2009-01-23 01:28:14 +00:00
|
|
|
val->SetIdent(eCSSKeyword_none);
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return val;
|
2007-07-21 14:20:25 +00:00
|
|
|
}
|
|
|
|
|
2012-12-21 00:15:22 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetMaskType()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2012-12-21 00:15:22 +00:00
|
|
|
val->SetIdent(
|
2013-02-16 21:51:02 +00:00
|
|
|
nsCSSProps::ValueToKeywordEnum(StyleSVGReset()->mMaskType,
|
2012-12-21 00:15:22 +00:00
|
|
|
nsCSSProps::kMaskTypeKTable));
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2013-01-12 23:27:53 +00:00
|
|
|
CSSValue*
|
|
|
|
nsComputedDOMStyle::DoGetPaintOrder()
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue *val = new nsROCSSPrimitiveValue;
|
2013-01-12 23:27:53 +00:00
|
|
|
nsAutoString string;
|
2013-02-16 21:51:02 +00:00
|
|
|
uint8_t paintOrder = StyleSVG()->mPaintOrder;
|
2013-01-12 23:27:53 +00:00
|
|
|
nsStyleUtil::AppendPaintOrderValue(paintOrder, string);
|
|
|
|
val->SetString(string);
|
|
|
|
return val;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransitionDelay()
|
2009-08-20 21:52:47 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2009-08-20 21:52:47 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2009-08-20 21:52:47 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionDelayCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2009-08-20 21:52:47 +00:00
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* delay = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(delay);
|
2009-08-20 21:52:47 +00:00
|
|
|
delay->SetTime((float)transition->GetDelay() / (float)PR_MSEC_PER_SEC);
|
|
|
|
} while (++i < display->mTransitionDelayCount);
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransitionDuration()
|
2009-08-20 21:52:47 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2009-08-20 21:52:47 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2009-08-20 21:52:47 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionDurationCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2009-08-20 21:52:47 +00:00
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* duration = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(duration);
|
2009-08-20 21:52:47 +00:00
|
|
|
|
|
|
|
duration->SetTime((float)transition->GetDuration() / (float)PR_MSEC_PER_SEC);
|
|
|
|
} while (++i < display->mTransitionDurationCount);
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransitionProperty()
|
2009-08-20 21:52:47 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2009-08-20 21:52:47 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2009-08-20 21:52:47 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionPropertyCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2009-08-20 21:52:47 +00:00
|
|
|
do {
|
|
|
|
const nsTransition *transition = &display->mTransitions[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* property = new nsROCSSPrimitiveValue;
|
2011-03-04 17:28:57 +00:00
|
|
|
valueList->AppendCSSValue(property);
|
2009-08-20 21:52:47 +00:00
|
|
|
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 20:49:29 +00:00
|
|
|
nsAutoString escaped;
|
2010-03-08 15:45:00 +00:00
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(
|
|
|
|
nsDependentAtomString(transition->GetUnknownProperty()), escaped);
|
2010-02-04 20:49:29 +00:00
|
|
|
property->SetString(escaped); // really want SetIdent
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
property->SetString(nsCSSProps::GetStringValue(cssprop));
|
|
|
|
} while (++i < display->mTransitionPropertyCount);
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
|
|
|
|
2011-04-12 06:18:42 +00:00
|
|
|
void
|
|
|
|
nsComputedDOMStyle::AppendTimingFunction(nsDOMCSSValueList *aValueList,
|
|
|
|
const nsTimingFunction& aTimingFunction)
|
|
|
|
{
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* timingFunction = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
aValueList->AppendCSSValue(timingFunction);
|
|
|
|
|
2011-07-06 18:25:19 +00:00
|
|
|
nsAutoString tmp;
|
|
|
|
|
2011-04-12 06:18:42 +00:00
|
|
|
if (aTimingFunction.mType == nsTimingFunction::Function) {
|
|
|
|
// set the value from the cubic-bezier control points
|
|
|
|
// (We could try to regenerate the keywords if we want.)
|
2011-07-06 18:25:19 +00:00
|
|
|
tmp.AppendLiteral("cubic-bezier(");
|
|
|
|
tmp.AppendFloat(aTimingFunction.mFunc.mX1);
|
|
|
|
tmp.AppendLiteral(", ");
|
|
|
|
tmp.AppendFloat(aTimingFunction.mFunc.mY1);
|
|
|
|
tmp.AppendLiteral(", ");
|
|
|
|
tmp.AppendFloat(aTimingFunction.mFunc.mX2);
|
|
|
|
tmp.AppendLiteral(", ");
|
|
|
|
tmp.AppendFloat(aTimingFunction.mFunc.mY2);
|
|
|
|
tmp.AppendLiteral(")");
|
2011-04-12 06:18:42 +00:00
|
|
|
} else {
|
|
|
|
tmp.AppendLiteral("steps(");
|
|
|
|
tmp.AppendInt(aTimingFunction.mSteps);
|
|
|
|
if (aTimingFunction.mType == nsTimingFunction::StepStart) {
|
|
|
|
tmp.AppendLiteral(", start)");
|
|
|
|
} else {
|
|
|
|
tmp.AppendLiteral(", end)");
|
|
|
|
}
|
|
|
|
}
|
2011-07-06 18:25:19 +00:00
|
|
|
timingFunction->SetString(tmp);
|
2011-04-12 06:18:42 +00:00
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-03-04 17:28:57 +00:00
|
|
|
nsComputedDOMStyle::DoGetTransitionTimingFunction()
|
2009-08-20 21:52:47 +00:00
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2009-08-20 21:52:47 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2009-08-20 21:52:47 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mTransitionTimingFunctionCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2009-08-20 21:52:47 +00:00
|
|
|
do {
|
2011-04-12 06:18:42 +00:00
|
|
|
AppendTimingFunction(valueList,
|
|
|
|
display->mTransitions[i].GetTimingFunction());
|
2009-08-20 21:52:47 +00:00
|
|
|
} while (++i < display->mTransitionTimingFunctionCount);
|
|
|
|
|
2011-03-04 17:28:57 +00:00
|
|
|
return valueList;
|
2009-08-20 21:52:47 +00:00
|
|
|
}
|
2007-07-21 14:20:25 +00:00
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationName()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationNameCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* property = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(property);
|
|
|
|
|
|
|
|
const nsString& name = animation->GetName();
|
|
|
|
if (name.IsEmpty()) {
|
|
|
|
property->SetIdent(eCSSKeyword_none);
|
|
|
|
} else {
|
|
|
|
nsAutoString escaped;
|
|
|
|
nsStyleUtil::AppendEscapedCSSIdent(animation->GetName(), escaped);
|
|
|
|
property->SetString(escaped); // really want SetIdent
|
|
|
|
}
|
|
|
|
} while (++i < display->mAnimationNameCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationDelay()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationDelayCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* delay = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(delay);
|
|
|
|
delay->SetTime((float)animation->GetDelay() / (float)PR_MSEC_PER_SEC);
|
|
|
|
} while (++i < display->mAnimationDelayCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationDuration()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationDurationCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* duration = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(duration);
|
|
|
|
|
|
|
|
duration->SetTime((float)animation->GetDuration() / (float)PR_MSEC_PER_SEC);
|
|
|
|
} while (++i < display->mAnimationDurationCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationTimingFunction()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationTimingFunctionCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
AppendTimingFunction(valueList,
|
|
|
|
display->mAnimations[i].GetTimingFunction());
|
|
|
|
} while (++i < display->mAnimationTimingFunctionCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationDirection()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationDirectionCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* direction = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(direction);
|
|
|
|
direction->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(animation->GetDirection(),
|
|
|
|
nsCSSProps::kAnimationDirectionKTable));
|
|
|
|
} while (++i < display->mAnimationDirectionCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationFillMode()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationFillModeCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* fillMode = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(fillMode);
|
|
|
|
fillMode->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(animation->GetFillMode(),
|
|
|
|
nsCSSProps::kAnimationFillModeKTable));
|
|
|
|
} while (++i < display->mAnimationFillModeCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationIterationCount()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationIterationCountCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* iterationCount = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(iterationCount);
|
|
|
|
|
|
|
|
float f = animation->GetIterationCount();
|
2011-04-12 08:12:12 +00:00
|
|
|
/* Need a nasty hack here to work around an optimizer bug in gcc
|
|
|
|
4.2 on Mac, which somehow gets confused when directly comparing
|
|
|
|
a float to the return value of NS_IEEEPositiveInfinity when
|
|
|
|
building 32-bit builds. */
|
|
|
|
#ifdef XP_MACOSX
|
|
|
|
volatile
|
|
|
|
#endif
|
|
|
|
float inf = NS_IEEEPositiveInfinity();
|
|
|
|
if (f == inf) {
|
2011-04-12 06:18:42 +00:00
|
|
|
iterationCount->SetIdent(eCSSKeyword_infinite);
|
|
|
|
} else {
|
|
|
|
iterationCount->SetNumber(f);
|
|
|
|
}
|
|
|
|
} while (++i < display->mAnimationIterationCountCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2012-10-01 16:49:41 +00:00
|
|
|
CSSValue*
|
2011-04-12 06:18:42 +00:00
|
|
|
nsComputedDOMStyle::DoGetAnimationPlayState()
|
|
|
|
{
|
2013-02-16 21:51:02 +00:00
|
|
|
const nsStyleDisplay* display = StyleDisplay();
|
2011-04-12 06:18:42 +00:00
|
|
|
|
2011-10-17 14:59:28 +00:00
|
|
|
nsDOMCSSValueList *valueList = GetROCSSValueList(true);
|
2011-04-12 06:18:42 +00:00
|
|
|
|
|
|
|
NS_ABORT_IF_FALSE(display->mAnimationPlayStateCount > 0,
|
|
|
|
"first item must be explicit");
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t i = 0;
|
2011-04-12 06:18:42 +00:00
|
|
|
do {
|
|
|
|
const nsAnimation *animation = &display->mAnimations[i];
|
2013-05-23 07:09:26 +00:00
|
|
|
nsROCSSPrimitiveValue* playState = new nsROCSSPrimitiveValue;
|
2011-04-12 06:18:42 +00:00
|
|
|
valueList->AppendCSSValue(playState);
|
|
|
|
playState->SetIdent(
|
|
|
|
nsCSSProps::ValueToKeywordEnum(animation->GetPlayState(),
|
|
|
|
nsCSSProps::kAnimationPlayStateKTable));
|
|
|
|
} while (++i < display->mAnimationPlayStateCount);
|
|
|
|
|
|
|
|
return valueList;
|
|
|
|
}
|
|
|
|
|
2013-10-03 10:58:01 +00:00
|
|
|
static int
|
|
|
|
MarkComputedStyleMapDirty(const char* aPref, void* aData)
|
|
|
|
{
|
|
|
|
static_cast<nsComputedStyleMap*>(aData)->MarkDirty();
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ nsComputedStyleMap*
|
|
|
|
nsComputedDOMStyle::GetComputedStyleMap()
|
2002-10-08 01:53:31 +00:00
|
|
|
{
|
2013-10-03 10:58:01 +00:00
|
|
|
static nsComputedStyleMap map = {
|
|
|
|
{
|
2013-10-03 10:58:01 +00:00
|
|
|
#define COMPUTED_STYLE_PROP(prop_, method_) \
|
|
|
|
{ eCSSProperty_##prop_, &nsComputedDOMStyle::DoGet##method_ },
|
|
|
|
#include "nsComputedDOMStylePropertyList.h"
|
|
|
|
#undef COMPUTED_STYLE_PROP
|
2013-10-03 10:58:01 +00:00
|
|
|
}
|
2002-10-08 01:53:31 +00:00
|
|
|
};
|
2013-10-03 10:58:01 +00:00
|
|
|
return ↦
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ void
|
|
|
|
nsComputedDOMStyle::RegisterPrefChangeCallbacks()
|
|
|
|
{
|
|
|
|
// Note that this will register callbacks for all properties with prefs, not
|
|
|
|
// just those that are implemented on computed style objects, as it's not
|
|
|
|
// easy to grab specific property data from nsCSSPropList.h based on the
|
|
|
|
// entries iterated in nsComputedDOMStylePropertyList.h.
|
|
|
|
nsComputedStyleMap* data = GetComputedStyleMap();
|
|
|
|
#define REGISTER_CALLBACK(pref_) \
|
|
|
|
if (pref_[0]) { \
|
|
|
|
Preferences::RegisterCallback(MarkComputedStyleMapDirty, pref_, data); \
|
|
|
|
}
|
|
|
|
#define CSS_PROP(prop_, id_, method_, flags_, pref_, parsevariant_, \
|
|
|
|
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
|
|
|
|
REGISTER_CALLBACK(pref_)
|
|
|
|
#include "nsCSSPropList.h"
|
|
|
|
#undef CSS_PROP
|
|
|
|
#undef REGISTER_CALLBACK
|
|
|
|
}
|
|
|
|
|
|
|
|
/* static */ void
|
|
|
|
nsComputedDOMStyle::UnregisterPrefChangeCallbacks()
|
|
|
|
{
|
|
|
|
nsComputedStyleMap* data = GetComputedStyleMap();
|
|
|
|
#define UNREGISTER_CALLBACK(pref_) \
|
|
|
|
if (pref_[0]) { \
|
|
|
|
Preferences::UnregisterCallback(MarkComputedStyleMapDirty, pref_, data); \
|
|
|
|
}
|
|
|
|
#define CSS_PROP(prop_, id_, method_, flags_, pref_, parsevariant_, \
|
|
|
|
kwtable_, stylestruct_, stylestructoffset_, animtype_) \
|
|
|
|
UNREGISTER_CALLBACK(pref_)
|
|
|
|
#include "nsCSSPropList.h"
|
|
|
|
#undef CSS_PROP
|
|
|
|
#undef UNREGISTER_CALLBACK
|
2002-10-08 01:53:31 +00:00
|
|
|
}
|