зеркало из https://github.com/mozilla/gecko-dev.git
Merge inbound to mozilla-central. a=merge
This commit is contained in:
Коммит
aaac9a77dd
|
@ -127,10 +127,6 @@ devtools/client/commandline/**
|
|||
# Soon to be removed, the new/ directory is explicitly excluded below due to
|
||||
# also being an imported repository.
|
||||
devtools/client/debugger/**
|
||||
# Soon to be removed
|
||||
devtools/client/webconsole/old/net/**
|
||||
devtools/client/webconsole/old/test/**
|
||||
devtools/client/webconsole/old/webconsole.js
|
||||
|
||||
# Ignore devtools imported repositories
|
||||
devtools/client/debugger/new/**
|
||||
|
|
|
@ -1632,7 +1632,7 @@ nsDocument::~nsDocument()
|
|||
Accumulate(Telemetry::CSP_UNSAFE_EVAL_DOCUMENTS_COUNT, 1);
|
||||
}
|
||||
|
||||
if (MOZ_UNLIKELY(GetMathMLEnabled())) {
|
||||
if (MOZ_UNLIKELY(mMathMLEnabled)) {
|
||||
ScalarAdd(Telemetry::ScalarID::MATHML_DOC_COUNT, 1);
|
||||
}
|
||||
}
|
||||
|
@ -1695,7 +1695,6 @@ nsDocument::~nsDocument()
|
|||
if (mAttrStyleSheet) {
|
||||
mAttrStyleSheet->SetOwningDocument(nullptr);
|
||||
}
|
||||
// We don't own the mOnDemandBuiltInUASheets, so we don't need to reset them.
|
||||
|
||||
if (mListenerManager) {
|
||||
mListenerManager->Disconnect();
|
||||
|
@ -1918,7 +1917,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument)
|
|||
|
||||
// Traverse all our nsCOMArrays.
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStyleSheets)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOnDemandBuiltInUASheets)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPreloadingImages)
|
||||
|
||||
for (uint32_t i = 0; i < tmp->mFrameRequestCallbacks.Length(); ++i) {
|
||||
|
@ -2457,7 +2455,6 @@ nsIDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
// filled the style set. (This allows us to avoid calling
|
||||
// GetStyleBackendType() too early.)
|
||||
RemoveDocStyleSheetsFromStyleSets();
|
||||
RemoveStyleSheetsFromStyleSets(mOnDemandBuiltInUASheets, SheetType::Agent);
|
||||
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAgentSheet], SheetType::Agent);
|
||||
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eUserSheet], SheetType::User);
|
||||
RemoveStyleSheetsFromStyleSets(mAdditionalSheets[eAuthorSheet], SheetType::Doc);
|
||||
|
@ -2472,7 +2469,6 @@ nsIDocument::ResetStylesheetsToURI(nsIURI* aURI)
|
|||
|
||||
// Release all the sheets
|
||||
mStyleSheets.Clear();
|
||||
mOnDemandBuiltInUASheets.Clear();
|
||||
for (auto& sheets : mAdditionalSheets) {
|
||||
sheets.Clear();
|
||||
}
|
||||
|
@ -2536,13 +2532,6 @@ nsIDocument::FillStyleSet(ServoStyleSet* aStyleSet)
|
|||
}
|
||||
}
|
||||
|
||||
// Iterate backwards to maintain order
|
||||
for (StyleSheet* sheet : Reversed(mOnDemandBuiltInUASheets)) {
|
||||
if (sheet->IsApplicable()) {
|
||||
aStyleSet->PrependStyleSheet(SheetType::Agent, sheet);
|
||||
}
|
||||
}
|
||||
|
||||
AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eAgentSheet],
|
||||
SheetType::Agent);
|
||||
AppendSheetsToStyleSet(aStyleSet, mAdditionalSheets[eUserSheet],
|
||||
|
@ -4131,43 +4120,6 @@ nsIDocument::RemoveChildNode(nsIContent* aKid, bool aNotify)
|
|||
"(maybe somebody called GetRootElement() too early?)");
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::EnsureOnDemandBuiltInUASheet(StyleSheet* aSheet)
|
||||
{
|
||||
if (mOnDemandBuiltInUASheets.Contains(aSheet)) {
|
||||
return;
|
||||
}
|
||||
AddOnDemandBuiltInUASheet(aSheet);
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::AddOnDemandBuiltInUASheet(StyleSheet* aSheet)
|
||||
{
|
||||
MOZ_ASSERT(!mOnDemandBuiltInUASheets.Contains(aSheet));
|
||||
|
||||
// Prepend here so that we store the sheets in mOnDemandBuiltInUASheets in
|
||||
// the same order that they should end up in the style set.
|
||||
mOnDemandBuiltInUASheets.InsertElementAt(0, aSheet);
|
||||
|
||||
if (aSheet->IsApplicable()) {
|
||||
// This is like |AddStyleSheetToStyleSets|, but for an agent sheet.
|
||||
if (nsIPresShell* shell = GetShell()) {
|
||||
// Note that prepending here is necessary to make sure that html.css etc.
|
||||
// does not override Firefox OS/Mobile's content.css sheet.
|
||||
//
|
||||
// Maybe we should have an insertion point to match the order of
|
||||
// nsDocumentViewer::CreateStyleSet though?
|
||||
//
|
||||
// FIXME(emilio): We probably should, randomly prepending stuff here is
|
||||
// very prone to subtle bugs, behavior differences...
|
||||
shell->StyleSet()->PrependStyleSheet(SheetType::Agent, aSheet);
|
||||
shell->ApplicableStylesChanged();
|
||||
}
|
||||
}
|
||||
|
||||
NotifyStyleSheetAdded(aSheet, false);
|
||||
}
|
||||
|
||||
void
|
||||
nsIDocument::AddStyleSheetToStyleSets(StyleSheet* aSheet)
|
||||
{
|
||||
|
@ -9542,21 +9494,6 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Iterate backwards to maintain order
|
||||
for (StyleSheet* sheet : Reversed(thisAsDoc->mOnDemandBuiltInUASheets)) {
|
||||
if (sheet) {
|
||||
if (sheet->IsApplicable()) {
|
||||
RefPtr<StyleSheet> clonedSheet =
|
||||
sheet->Clone(nullptr, nullptr, clonedDoc, nullptr);
|
||||
NS_WARNING_ASSERTION(clonedSheet,
|
||||
"Cloning a stylesheet didn't work!");
|
||||
if (clonedSheet) {
|
||||
clonedDoc->AddOnDemandBuiltInUASheet(clonedSheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
mCreatingStaticClone = false;
|
||||
|
@ -11761,11 +11698,6 @@ nsDocument::DocAddSizeOfExcludingThis(nsWindowSizes& aWindowSizes) const
|
|||
aWindowSizes.mLayoutStyleSheetsSize +=
|
||||
SizeOfOwnedSheetArrayExcludingThis(mStyleSheets,
|
||||
aWindowSizes.mState.mMallocSizeOf);
|
||||
// Note that we do not own the sheets pointed to by mOnDemandBuiltInUASheets
|
||||
// (the nsLayoutStyleSheetCache singleton does).
|
||||
aWindowSizes.mLayoutStyleSheetsSize +=
|
||||
mOnDemandBuiltInUASheets.ShallowSizeOfExcludingThis(
|
||||
aWindowSizes.mState.mMallocSizeOf);
|
||||
for (auto& sheetArray : mAdditionalSheets) {
|
||||
aWindowSizes.mLayoutStyleSheetsSize +=
|
||||
SizeOfOwnedSheetArrayExcludingThis(sheetArray,
|
||||
|
|
|
@ -836,14 +836,6 @@ public:
|
|||
mBidiEnabled = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the document contains (or has contained) any MathML elements.
|
||||
*/
|
||||
bool GetMathMLEnabled() const
|
||||
{
|
||||
return mMathMLEnabled;
|
||||
}
|
||||
|
||||
void SetMathMLEnabled()
|
||||
{
|
||||
mMathMLEnabled = true;
|
||||
|
@ -1468,28 +1460,6 @@ public:
|
|||
* Style sheets are ordered, most significant last.
|
||||
*/
|
||||
|
||||
/**
|
||||
* These exists to allow us to on-demand load user-agent style sheets that
|
||||
* would otherwise be loaded by nsDocumentViewer::CreateStyleSet. This allows
|
||||
* us to keep the memory used by a document's rule cascade data (the stuff in
|
||||
* its nsStyleSet's nsCSSRuleProcessors) - which can be considerable - lower
|
||||
* than it would be if we loaded all built-in user-agent style sheets up
|
||||
* front.
|
||||
*
|
||||
* By "built-in" user-agent style sheets we mean the user-agent style sheets
|
||||
* that gecko itself supplies (such as html.css and svg.css) as opposed to
|
||||
* user-agent level style sheets inserted by add-ons or the like.
|
||||
*
|
||||
* This function prepends the given style sheet to the document's style set
|
||||
* in order to make sure that it does not override user-agent style sheets
|
||||
* supplied by add-ons or by the app (Firefox OS or Firefox Mobile, for
|
||||
* example), since their sheets should override built-in sheets.
|
||||
*
|
||||
* TODO We can get rid of the whole concept of delayed loading if we fix
|
||||
* bug 77999.
|
||||
*/
|
||||
void EnsureOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet);
|
||||
|
||||
mozilla::dom::StyleSheetList* StyleSheets()
|
||||
{
|
||||
return &DocumentOrShadowRoot::EnsureDOMStyleSheets();
|
||||
|
@ -3616,7 +3586,6 @@ protected:
|
|||
|
||||
void UpdateDocumentStates(mozilla::EventStates);
|
||||
|
||||
void AddOnDemandBuiltInUASheet(mozilla::StyleSheet* aSheet);
|
||||
void RemoveDocStyleSheetsFromStyleSets();
|
||||
void RemoveStyleSheetsFromStyleSets(
|
||||
const nsTArray<RefPtr<mozilla::StyleSheet>>& aSheets,
|
||||
|
@ -4418,7 +4387,6 @@ protected:
|
|||
nsCOMPtr<nsIRunnable> mMaybeEndOutermostXBLUpdateRunner;
|
||||
nsCOMPtr<nsIRequest> mOnloadBlocker;
|
||||
|
||||
nsTArray<RefPtr<mozilla::StyleSheet>> mOnDemandBuiltInUASheets;
|
||||
nsTArray<RefPtr<mozilla::StyleSheet>> mAdditionalSheets[AdditionalSheetTypeCount];
|
||||
|
||||
// Member to store out last-selected stylesheet set.
|
||||
|
|
|
@ -27,8 +27,8 @@ nsMappedAttributeElement::GetAttributeMappingFunction() const
|
|||
}
|
||||
|
||||
void
|
||||
nsMappedAttributeElement::MapNoAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData)
|
||||
nsMappedAttributeElement::MapNoAttributesInto(const nsMappedAttributes*,
|
||||
mozilla::MappedDeclarations&)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -13,14 +13,17 @@
|
|||
#define NS_MAPPEDATTRIBUTEELEMENT_H_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/GenericSpecifiedValues.h"
|
||||
#include "nsStyledElement.h"
|
||||
|
||||
namespace mozilla {
|
||||
class MappedDeclarations;
|
||||
}
|
||||
|
||||
class nsMappedAttributes;
|
||||
struct nsRuleData;
|
||||
|
||||
typedef void (*nsMapRuleToAttributesFunc)(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
typedef nsStyledElement nsMappedAttributeElementBase;
|
||||
|
||||
|
@ -37,7 +40,7 @@ public:
|
|||
virtual nsMapRuleToAttributesFunc GetAttributeMappingFunction() const;
|
||||
|
||||
static void MapNoAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
virtual bool SetAndSwapMappedAttribute(nsAtom* aName,
|
||||
nsAttrValue& aValue,
|
||||
|
|
|
@ -12,10 +12,9 @@
|
|||
#include "nsMappedAttributes.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "mozilla/DeclarationBlock.h"
|
||||
#include "mozilla/GenericSpecifiedValues.h"
|
||||
#include "mozilla/HashFunctions.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/ServoSpecifiedValues.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
||||
|
@ -311,8 +310,9 @@ nsMappedAttributes::LazilyResolveServoDeclaration(nsIDocument* aDoc)
|
|||
MOZ_ASSERT(!mServoStyle,
|
||||
"LazilyResolveServoDeclaration should not be called if mServoStyle is already set");
|
||||
if (mRuleMapper) {
|
||||
mServoStyle = Servo_DeclarationBlock_CreateEmpty().Consume();
|
||||
ServoSpecifiedValues servo = ServoSpecifiedValues(aDoc, mServoStyle.get());
|
||||
(*mRuleMapper)(this, &servo);
|
||||
MappedDeclarations declarations(
|
||||
aDoc, Servo_DeclarationBlock_CreateEmpty().Consume());
|
||||
(*mRuleMapper)(this, declarations);
|
||||
mServoStyle = declarations.TakeDeclarationBlock();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "mozilla/dom/HTMLBRElement.h"
|
||||
#include "mozilla/dom/HTMLBRElementBinding.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
@ -53,14 +53,14 @@ HTMLBRElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLBRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_clear)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_clear)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::clear);
|
||||
if (value && value->Type() == nsAttrValue::eEnum)
|
||||
aData->SetKeywordValue(eCSSProperty_clear, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_clear, value->GetEnumValue());
|
||||
}
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -48,7 +48,7 @@ private:
|
|||
virtual ~HTMLBRElement();
|
||||
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "HTMLBodyElement.h"
|
||||
#include "mozilla/dom/HTMLBodyElementBinding.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/HTMLEditor.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
|
@ -74,7 +74,7 @@ HTMLBodyElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// This is the one place where we try to set the same property
|
||||
// multiple times in presentation attributes. Servo does not support
|
||||
|
@ -99,8 +99,8 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (bodyMarginWidth < 0) {
|
||||
bodyMarginWidth = 0;
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_left, (float)bodyMarginWidth);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_right, (float)bodyMarginWidth);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_left, (float)bodyMarginWidth);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_right, (float)bodyMarginWidth);
|
||||
}
|
||||
|
||||
value = aAttributes->GetAttr(nsGkAtoms::marginheight);
|
||||
|
@ -109,8 +109,8 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (bodyMarginHeight < 0) {
|
||||
bodyMarginHeight = 0;
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_top, (float)bodyMarginHeight);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)bodyMarginHeight);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_top, (float)bodyMarginHeight);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)bodyMarginHeight);
|
||||
}
|
||||
|
||||
// topmargin (IE-attribute)
|
||||
|
@ -121,7 +121,7 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (bodyTopMargin < 0) {
|
||||
bodyTopMargin = 0;
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_top, (float)bodyTopMargin);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_top, (float)bodyTopMargin);
|
||||
}
|
||||
}
|
||||
// bottommargin (IE-attribute)
|
||||
|
@ -133,7 +133,7 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (bodyBottomMargin < 0) {
|
||||
bodyBottomMargin = 0;
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)bodyBottomMargin);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)bodyBottomMargin);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -145,7 +145,7 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (bodyLeftMargin < 0) {
|
||||
bodyLeftMargin = 0;
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_left, (float)bodyLeftMargin);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_left, (float)bodyLeftMargin);
|
||||
}
|
||||
}
|
||||
// rightmargin (IE-attribute)
|
||||
|
@ -156,14 +156,14 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (bodyRightMargin < 0) {
|
||||
bodyRightMargin = 0;
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_right, (float)bodyRightMargin);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_right, (float)bodyRightMargin);
|
||||
}
|
||||
}
|
||||
|
||||
// if marginwidth or marginheight is set in the <frame> and not set in the <body>
|
||||
// reflect them as margin in the <body>
|
||||
if (bodyMarginWidth == -1 || bodyMarginHeight == -1) {
|
||||
nsCOMPtr<nsIDocShell> docShell(aData->Document()->GetDocShell());
|
||||
nsCOMPtr<nsIDocShell> docShell(aDecls.Document()->GetDocShell());
|
||||
if (docShell) {
|
||||
nscoord frameMarginWidth=-1; // default value
|
||||
nscoord frameMarginHeight=-1; // default value
|
||||
|
@ -172,26 +172,26 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
|
||||
if (bodyMarginWidth == -1 && frameMarginWidth >= 0) {
|
||||
if (bodyLeftMargin == -1) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_left, (float)frameMarginWidth);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_left, (float)frameMarginWidth);
|
||||
}
|
||||
if (bodyRightMargin == -1) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_right, (float)frameMarginWidth);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_right, (float)frameMarginWidth);
|
||||
}
|
||||
}
|
||||
|
||||
if (bodyMarginHeight == -1 && frameMarginHeight >= 0) {
|
||||
if (bodyTopMargin == -1) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_top, (float)frameMarginHeight);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_top, (float)frameMarginHeight);
|
||||
}
|
||||
if (bodyBottomMargin == -1) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)frameMarginHeight);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)frameMarginHeight);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// When display if first asked for, go ahead and get our colors set up.
|
||||
if (nsHTMLStyleSheet* styleSheet = aData->Document()->GetAttributeStyleSheet()) {
|
||||
if (nsHTMLStyleSheet* styleSheet = aDecls.Document()->GetAttributeStyleSheet()) {
|
||||
nscolor color;
|
||||
value = aAttributes->GetAttr(nsGkAtoms::link);
|
||||
if (value && value->GetColorValue(color)) {
|
||||
|
@ -209,17 +209,17 @@ HTMLBodyElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
}
|
||||
}
|
||||
|
||||
if (!aData->PropertyIsSet(eCSSProperty_color)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_color)) {
|
||||
// color: color
|
||||
nscolor color;
|
||||
value = aAttributes->GetAttr(nsGkAtoms::text);
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->SetColorValue(eCSSProperty_color, color);
|
||||
aDecls.SetColorValue(eCSSProperty_color, color);
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
nsMapRuleToAttributesFunc
|
||||
|
|
|
@ -154,7 +154,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -61,19 +61,19 @@ HTMLDivElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLDivElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
static void
|
||||
MapMarqueeAttributesIntoRule(const nsMappedAttributes* aAttributes, GenericSpecifiedValues* aData)
|
||||
MapMarqueeAttributesIntoRule(const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapBGColorInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapBGColorInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -46,7 +46,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -238,28 +238,28 @@ HTMLEmbedElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
static void
|
||||
MapAttributesIntoRuleBase(const nsMappedAttributes *aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
static void
|
||||
MapAttributesIntoRuleExceptHidden(const nsMappedAttributes *aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
MapAttributesIntoRuleBase(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(aAttributes, aData);
|
||||
MapAttributesIntoRuleBase(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
void
|
||||
HTMLEmbedElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
MapAttributesIntoRuleBase(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
MapAttributesIntoRuleBase(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -150,7 +150,7 @@ private:
|
|||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* This function is called by AfterSetAttr and OnAttrSetButNotChanged.
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "HTMLFontElement.h"
|
||||
#include "mozilla/dom/HTMLFontElementBinding.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
@ -55,42 +55,42 @@ HTMLFontElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLFontElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// face: string list
|
||||
if (!aData->PropertyIsSet(eCSSProperty_font_family)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_font_family)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::face);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!value->IsEmptyString()) {
|
||||
aData->SetFontFamily(value->GetStringValue());
|
||||
aDecls.SetFontFamily(value->GetStringValue());
|
||||
}
|
||||
}
|
||||
// size: int
|
||||
if (!aData->PropertyIsSet(eCSSProperty_font_size)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_font_size)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::size);
|
||||
if (value && value->Type() == nsAttrValue::eInteger)
|
||||
aData->SetKeywordValue(eCSSProperty_font_size, value->GetIntegerValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_font_size, value->GetIntegerValue());
|
||||
}
|
||||
if (!aData->PropertyIsSet(eCSSProperty_color)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_color)) {
|
||||
// color: color
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->SetColorValue(eCSSProperty_color, color);
|
||||
aDecls.SetColorValue(eCSSProperty_color, color);
|
||||
}
|
||||
}
|
||||
if (aData->Document()->GetCompatibilityMode() == eCompatibility_NavQuirks) {
|
||||
if (aDecls.Document()->GetCompatibilityMode() == eCompatibility_NavQuirks) {
|
||||
// Make <a><font color="red">text</font></a> give the text a red underline
|
||||
// in quirks mode. The NS_STYLE_TEXT_DECORATION_LINE_OVERRIDE_ALL flag only
|
||||
// affects quirks mode rendering.
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::color);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->SetTextDecorationColorOverride();
|
||||
aDecls.SetTextDecorationColorOverride();
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -62,7 +62,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -120,7 +120,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -61,7 +61,7 @@ HTMLHRElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
bool noshade = false;
|
||||
|
||||
|
@ -81,24 +81,24 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
// Map align attribute into auto side margins
|
||||
switch (value->GetEnumValue()) {
|
||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_left, 0.0f);
|
||||
aData->SetAutoValueIfUnset(eCSSProperty_margin_right);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_left, 0.0f);
|
||||
aDecls.SetAutoValueIfUnset(eCSSProperty_margin_right);
|
||||
break;
|
||||
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
||||
aData->SetAutoValueIfUnset(eCSSProperty_margin_left);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_right, 0.0f);
|
||||
aDecls.SetAutoValueIfUnset(eCSSProperty_margin_left);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_right, 0.0f);
|
||||
break;
|
||||
case NS_STYLE_TEXT_ALIGN_CENTER:
|
||||
aData->SetAutoValueIfUnset(eCSSProperty_margin_left);
|
||||
aData->SetAutoValueIfUnset(eCSSProperty_margin_right);
|
||||
aDecls.SetAutoValueIfUnset(eCSSProperty_margin_left);
|
||||
aDecls.SetAutoValueIfUnset(eCSSProperty_margin_right);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!aData->PropertyIsSet(eCSSProperty_height)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_height)) {
|
||||
// size: integer
|
||||
if (noshade) {
|
||||
// noshade case: size is set using the border
|
||||
aData->SetAutoValue(eCSSProperty_height);
|
||||
aDecls.SetAutoValue(eCSSProperty_height);
|
||||
} else {
|
||||
// normal case
|
||||
// the height includes the top and bottom borders that are initially 1px.
|
||||
|
@ -106,7 +106,7 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
// removing all but the top border.
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::size);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
|
||||
} // else use default value from html.css
|
||||
}
|
||||
}
|
||||
|
@ -130,22 +130,22 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
} else {
|
||||
sizePerSide = 1.0f; // default to a 2px high line
|
||||
}
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_top_width, sizePerSide);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_top_width, sizePerSide);
|
||||
if (allSides) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_right_width, sizePerSide);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_bottom_width, sizePerSide);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_left_width, sizePerSide);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_right_width, sizePerSide);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_bottom_width, sizePerSide);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_left_width, sizePerSide);
|
||||
}
|
||||
|
||||
if (!aData->PropertyIsSet(eCSSProperty_border_top_style))
|
||||
aData->SetKeywordValue(eCSSProperty_border_top_style,
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_border_top_style))
|
||||
aDecls.SetKeywordValue(eCSSProperty_border_top_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
if (allSides) {
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_right_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_right_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_bottom_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_bottom_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_left_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_left_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
|
||||
// If it would be noticeable, set the border radius to
|
||||
|
@ -155,18 +155,18 @@ HTMLHRElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
for (const nsCSSPropertyID* props =
|
||||
nsCSSProps::SubpropertyEntryFor(eCSSProperty_border_radius);
|
||||
*props != eCSSProperty_UNKNOWN; ++props) {
|
||||
aData->SetPixelValueIfUnset(*props, 10000.0f);
|
||||
aDecls.SetPixelValueIfUnset(*props, 10000.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
// color: a color
|
||||
// (we got the color attribute earlier)
|
||||
if (colorIsSet) {
|
||||
aData->SetColorValueIfUnset(eCSSProperty_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_color, color);
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -86,7 +86,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLHeadingElement.h"
|
||||
#include "mozilla/dom/HTMLHeadingElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
@ -47,10 +47,10 @@ HTMLHeadingElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLHeadingElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -47,7 +47,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "mozilla/dom/HTMLIFrameElement.h"
|
||||
#include "mozilla/dom/HTMLIFrameElementBinding.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsError.h"
|
||||
|
@ -82,7 +82,7 @@ HTMLIFrameElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// frameborder: 0 | 1 (| NO | YES in quirks mode)
|
||||
// If frameborder is 0 or No, set border to 0
|
||||
|
@ -93,16 +93,16 @@ HTMLIFrameElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (NS_STYLE_FRAME_0 == frameborder ||
|
||||
NS_STYLE_FRAME_NO == frameborder ||
|
||||
NS_STYLE_FRAME_OFF == frameborder) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_top_width, 0.0f);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_right_width, 0.0f);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_bottom_width, 0.0f);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_left_width, 0.0f);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_top_width, 0.0f);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_right_width, 0.0f);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_bottom_width, 0.0f);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_left_width, 0.0f);
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -205,7 +205,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
|
||||
static const DOMTokenListSupportedToken sSupportedSandboxTokens[];
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@
|
|||
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/net/ReferrerPolicy.h"
|
||||
|
||||
#include "nsLayoutUtils.h"
|
||||
|
@ -248,13 +248,13 @@ HTMLImageElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLImageElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
|
|
|
@ -407,7 +407,7 @@ private:
|
|||
bool SourceElementMatches(Element* aSourceElement);
|
||||
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
/**
|
||||
* This function is called by AfterSetAttr and OnAttrSetButNotChanged.
|
||||
* It will not be called if the value is being unset.
|
||||
|
|
|
@ -65,7 +65,7 @@
|
|||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/InternalMutationEvent.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
|
@ -5581,19 +5581,19 @@ HTMLInputElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLInputElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
||||
if (value && value->Type() == nsAttrValue::eEnum &&
|
||||
value->GetEnumValue() == NS_FORM_INPUT_IMAGE) {
|
||||
nsGenericHTMLFormElementWithState::MapImageBorderAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapImageBorderAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapImageMarginAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
// Images treat align as "float"
|
||||
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
|
|
|
@ -1667,7 +1667,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* Returns true if this input's type will fire a DOM "change" event when it
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLLIElement.h"
|
||||
#include "mozilla/dom/HTMLLIElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -67,16 +67,16 @@ HTMLLIElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLLIElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_list_style_type)) {
|
||||
// type: enum
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
||||
if (value && value->Type() == nsAttrValue::eEnum)
|
||||
aData->SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -60,7 +60,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -465,14 +465,14 @@ HTMLObjectElement::ParseAttribute(int32_t aNamespaceID,
|
|||
}
|
||||
|
||||
void
|
||||
HTMLObjectElement::MapAttributesIntoRule(const nsMappedAttributes *aAttributes,
|
||||
GenericSpecifiedValues *aData)
|
||||
HTMLObjectElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElement::MapImageMarginAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElement::MapImageAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElement::MapImageBorderAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElement::MapImageMarginAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -275,7 +275,7 @@ private:
|
|||
virtual JSObject* WrapNode(JSContext *aCx, JS::Handle<JSObject*> aGivenProto) override;
|
||||
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* This function is called by AfterSetAttr and OnAttrSetButNotChanged.
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "mozAutoDocUpdate.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/dom/HTMLFormSubmission.h"
|
||||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
#include "mozilla/dom/HTMLOptionsCollectionBinding.h"
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLParagraphElement.h"
|
||||
#include "mozilla/dom/HTMLParagraphElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
||||
|
@ -40,10 +40,10 @@ HTMLParagraphElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLParagraphElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -54,7 +54,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLPreElement.h"
|
||||
#include "mozilla/dom/HTMLPreElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
|
@ -43,15 +43,15 @@ HTMLPreElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLPreElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_white_space)) {
|
||||
// wrap: empty
|
||||
if (aAttributes->GetAttr(nsGkAtoms::wrap))
|
||||
aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::PreWrap);
|
||||
aDecls.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::PreWrap);
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -53,7 +53,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "mozilla/dom/HTMLOptionElement.h"
|
||||
#include "mozilla/dom/HTMLSelectElementBinding.h"
|
||||
#include "mozilla/dom/UnionTypes.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsContentCreatorFunctions.h"
|
||||
#include "nsContentList.h"
|
||||
#include "nsError.h"
|
||||
|
@ -1273,10 +1273,10 @@ HTMLSelectElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLSelectElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapImageAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
|
|
|
@ -613,7 +613,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "mozilla/dom/HTMLParamElementBinding.h"
|
||||
#include "mozilla/dom/HTMLQuoteElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
@ -79,21 +79,21 @@ HTMLSharedElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
static void
|
||||
DirectoryMapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_list_style_type)) {
|
||||
// type: enum
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
||||
if (value) {
|
||||
if (value->Type() == nsAttrValue::eEnum) {
|
||||
aData->SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
||||
} else {
|
||||
aData->SetKeywordValue(eCSSProperty_list_style_type, NS_STYLE_LIST_STYLE_DISC);
|
||||
aDecls.SetKeywordValue(eCSSProperty_list_style_type, NS_STYLE_LIST_STYLE_DISC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include "mozilla/dom/HTMLOListElementBinding.h"
|
||||
#include "mozilla/dom/HTMLUListElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsGenericHTMLElement.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsGkAtoms.h"
|
||||
|
@ -81,17 +81,17 @@ HTMLSharedListElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLSharedListElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_list_style_type)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_list_style_type)) {
|
||||
// type: enum
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::type);
|
||||
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||
aData->SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_list_style_type, value->GetEnumValue());
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -75,7 +75,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLSpanElement.h"
|
||||
#include "mozilla/dom/HTMLSpanElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsAtom.h"
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "mozilla/dom/HTMLTableCaptionElement.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "mozilla/dom/HTMLTableCaptionElementBinding.h"
|
||||
|
@ -53,15 +53,15 @@ HTMLTableCaptionElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTableCaptionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_caption_side)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_caption_side)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
||||
if (value && value->Type() == nsAttrValue::eEnum)
|
||||
aData->SetKeywordValue(eCSSProperty_caption_side, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_caption_side, value->GetEnumValue());
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -48,7 +48,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLTableCellElement.h"
|
||||
#include "mozilla/dom/HTMLTableElement.h"
|
||||
#include "mozilla/dom/HTMLTableRowElement.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "celldata.h"
|
||||
|
@ -183,54 +183,54 @@ HTMLTableCellElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTableCellElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// width: value
|
||||
if (!aData->PropertyIsSet(eCSSProperty_width)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_width)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
if (value->GetIntegerValue() > 0)
|
||||
aData->SetPixelValue(eCSSProperty_width, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValue(eCSSProperty_width, (float)value->GetIntegerValue());
|
||||
// else 0 implies auto for compatibility.
|
||||
}
|
||||
else if (value && value->Type() == nsAttrValue::ePercent) {
|
||||
if (value->GetPercentValue() > 0.0f)
|
||||
aData->SetPercentValue(eCSSProperty_width, value->GetPercentValue());
|
||||
aDecls.SetPercentValue(eCSSProperty_width, value->GetPercentValue());
|
||||
// else 0 implies auto for compatibility
|
||||
}
|
||||
}
|
||||
// height: value
|
||||
if (!aData->PropertyIsSet(eCSSProperty_height)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_height)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
if (value->GetIntegerValue() > 0)
|
||||
aData->SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
|
||||
// else 0 implies auto for compatibility.
|
||||
}
|
||||
else if (value && value->Type() == nsAttrValue::ePercent) {
|
||||
if (value->GetPercentValue() > 0.0f)
|
||||
aData->SetPercentValue(eCSSProperty_height, value->GetPercentValue());
|
||||
aDecls.SetPercentValue(eCSSProperty_height, value->GetPercentValue());
|
||||
// else 0 implies auto for compatibility
|
||||
}
|
||||
}
|
||||
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_white_space)) {
|
||||
// nowrap: enum
|
||||
if (aAttributes->GetAttr(nsGkAtoms::nowrap)) {
|
||||
// See if our width is not a nonzero integer width.
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
||||
nsCompatibility mode = aData->Document()->GetCompatibilityMode();
|
||||
nsCompatibility mode = aDecls.Document()->GetCompatibilityMode();
|
||||
if (!value || value->Type() != nsAttrValue::eInteger ||
|
||||
value->GetIntegerValue() == 0 ||
|
||||
eCompatibility_NavQuirks != mode) {
|
||||
aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Nowrap);
|
||||
aDecls.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Nowrap);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -161,7 +161,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
#include "mozilla/dom/HTMLTableColElementBinding.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
|
||||
NS_IMPL_NS_NEW_HTML_ELEMENT(TableCol)
|
||||
|
||||
|
@ -65,9 +65,9 @@ HTMLTableColElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTableColElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty__x_span)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty__x_span)) {
|
||||
// span: int
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::span);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
|
@ -76,15 +76,15 @@ HTMLTableColElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes
|
|||
// means something special for colspan and rowspan, but for <col
|
||||
// span> and <colgroup span> it's just disallowed.
|
||||
if (val > 0) {
|
||||
aData->SetIntValue(eCSSProperty__x_span, value->GetIntegerValue());
|
||||
aDecls.SetIntValue(eCSSProperty__x_span, value->GetIntegerValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -89,7 +89,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/HTMLTableElement.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsHTMLStyleSheet.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
|
@ -932,7 +932,7 @@ HTMLTableElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// XXX Bug 211636: This function is used by a single style rule
|
||||
// that's used to match two different type of elements -- tables, and
|
||||
|
@ -944,13 +944,13 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
// which *element* it's matching (style rules should not stop matching
|
||||
// when the display type is changed).
|
||||
|
||||
nsCompatibility mode = aData->Document()->GetCompatibilityMode();
|
||||
nsCompatibility mode = aDecls.Document()->GetCompatibilityMode();
|
||||
|
||||
// cellspacing
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::cellspacing);
|
||||
if (value && value->Type() == nsAttrValue::eInteger &&
|
||||
!aData->PropertyIsSet(eCSSProperty_border_spacing)) {
|
||||
aData->SetPixelValue(eCSSProperty_border_spacing, float(value->GetIntegerValue()));
|
||||
!aDecls.PropertyIsSet(eCSSProperty_border_spacing)) {
|
||||
aDecls.SetPixelValue(eCSSProperty_border_spacing, float(value->GetIntegerValue()));
|
||||
}
|
||||
// align; Check for enumerated type (it may be another type if
|
||||
// illegal)
|
||||
|
@ -958,8 +958,8 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||
if (value->GetEnumValue() == NS_STYLE_TEXT_ALIGN_CENTER ||
|
||||
value->GetEnumValue() == NS_STYLE_TEXT_ALIGN_MOZ_CENTER) {
|
||||
aData->SetAutoValueIfUnset(eCSSProperty_margin_left);
|
||||
aData->SetAutoValueIfUnset(eCSSProperty_margin_right);
|
||||
aDecls.SetAutoValueIfUnset(eCSSProperty_margin_left);
|
||||
aDecls.SetAutoValueIfUnset(eCSSProperty_margin_right);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -970,25 +970,25 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
value = aAttributes->GetAttr(nsGkAtoms::hspace);
|
||||
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_left, (float)value->GetIntegerValue());
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_right, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_left, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_right, (float)value->GetIntegerValue());
|
||||
}
|
||||
|
||||
value = aAttributes->GetAttr(nsGkAtoms::vspace);
|
||||
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_top, (float)value->GetIntegerValue());
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_top, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_bottom, (float)value->GetIntegerValue());
|
||||
}
|
||||
}
|
||||
// bordercolor
|
||||
value = aAttributes->GetAttr(nsGkAtoms::bordercolor);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_top_color, color);
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_left_color, color);
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_bottom_color, color);
|
||||
aData->SetColorValueIfUnset(eCSSProperty_border_right_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_border_top_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_border_left_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_border_bottom_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_border_right_color, color);
|
||||
}
|
||||
|
||||
// border
|
||||
|
@ -1001,15 +1001,15 @@ HTMLTableElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
borderThickness = borderValue->GetIntegerValue();
|
||||
|
||||
// by default, set all border sides to the specified width
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_top_width, (float)borderThickness);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_left_width, (float)borderThickness);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_bottom_width, (float)borderThickness);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_right_width, (float)borderThickness);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_top_width, (float)borderThickness);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_left_width, (float)borderThickness);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_bottom_width, (float)borderThickness);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_right_width, (float)borderThickness);
|
||||
}
|
||||
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
@ -1047,7 +1047,7 @@ HTMLTableElement::GetAttributeMappingFunction() const
|
|||
|
||||
static void
|
||||
MapInheritedTableAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::cellpadding);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
|
@ -1055,10 +1055,10 @@ MapInheritedTableAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
|||
// don't have any set.
|
||||
float pad = float(value->GetIntegerValue());
|
||||
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_padding_top, pad);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_padding_right, pad);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_padding_bottom, pad);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_padding_left, pad);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_padding_top, pad);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_padding_right, pad);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_padding_bottom, pad);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_padding_left, pad);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -241,7 +241,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
#include "mozilla/dom/HTMLTableRowElement.h"
|
||||
#include "mozilla/dom/HTMLTableElement.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
@ -260,13 +260,13 @@ HTMLTableRowElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTableRowElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapHeightAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapHeightAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -103,7 +103,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "mozilla/dom/HTMLTableSectionElement.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsMappedAttributes.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
@ -163,18 +163,18 @@ HTMLTableSectionElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTableSectionElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// height: value
|
||||
if (!aData->PropertyIsSet(eCSSProperty_height)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_height)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
|
||||
if (value && value->Type() == nsAttrValue::eInteger)
|
||||
aData->SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
|
||||
aDecls.SetPixelValue(eCSSProperty_height, (float)value->GetIntegerValue());
|
||||
}
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -85,7 +85,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
#include "mozilla/dom/HTMLTemplateElementBinding.h"
|
||||
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "nsGkAtoms.h"
|
||||
#include "nsStyleConsts.h"
|
||||
#include "nsAtom.h"
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "mozilla/dom/HTMLTextAreaElementBinding.h"
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "nsAttrValueInlines.h"
|
||||
#include "nsContentCID.h"
|
||||
|
@ -427,19 +427,19 @@ HTMLTextAreaElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLTextAreaElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// wrap=off
|
||||
if (!aData->PropertyIsSet(eCSSProperty_white_space)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_white_space)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::wrap);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
value->Equals(nsGkAtoms::OFF, eIgnoreCase)) {
|
||||
aData->SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Pre);
|
||||
aDecls.SetKeywordValue(eCSSProperty_white_space, StyleWhiteSpace::Pre);
|
||||
}
|
||||
}
|
||||
|
||||
nsGenericHTMLFormElementWithState::MapDivAlignAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLFormElementWithState::MapDivAlignAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLFormElementWithState::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
nsChangeHint
|
||||
|
|
|
@ -418,7 +418,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
|
@ -101,10 +101,10 @@ HTMLVideoElement::ParseAttribute(int32_t aNamespaceID,
|
|||
|
||||
void
|
||||
HTMLVideoElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
|
|
|
@ -166,7 +166,7 @@ protected:
|
|||
|
||||
private:
|
||||
static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aGenericData);
|
||||
MappedDeclarations&);
|
||||
|
||||
static bool IsVideoStatsEnabled();
|
||||
double TotalPlayTime() const;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/EventStateManager.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/Likely.h"
|
||||
#include "mozilla/MouseEvents.h"
|
||||
#include "mozilla/TextEditor.h"
|
||||
|
@ -1162,25 +1162,25 @@ nsGenericHTMLElement::ParseScrollingValue(const nsAString& aString,
|
|||
}
|
||||
|
||||
static inline void
|
||||
MapLangAttributeInto(const nsMappedAttributes* aAttributes, GenericSpecifiedValues* aData)
|
||||
MapLangAttributeInto(const nsMappedAttributes* aAttributes, MappedDeclarations& aDecls)
|
||||
{
|
||||
const nsAttrValue* langValue = aAttributes->GetAttr(nsGkAtoms::lang);
|
||||
if (!langValue) {
|
||||
return;
|
||||
}
|
||||
MOZ_ASSERT(langValue->Type() == nsAttrValue::eAtom);
|
||||
aData->SetIdentAtomValueIfUnset(eCSSProperty__x_lang,
|
||||
aDecls.SetIdentAtomValueIfUnset(eCSSProperty__x_lang,
|
||||
langValue->GetAtomValue());
|
||||
if (!aData->PropertyIsSet(eCSSProperty_text_emphasis_position)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_text_emphasis_position)) {
|
||||
const nsAtom* lang = langValue->GetAtomValue();
|
||||
if (nsStyleUtil::MatchesLanguagePrefix(lang, u"zh")) {
|
||||
aData->SetKeywordValue(eCSSProperty_text_emphasis_position,
|
||||
aDecls.SetKeywordValue(eCSSProperty_text_emphasis_position,
|
||||
NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT_ZH);
|
||||
} else if (nsStyleUtil::MatchesLanguagePrefix(lang, u"ja") ||
|
||||
nsStyleUtil::MatchesLanguagePrefix(lang, u"mn")) {
|
||||
// This branch is currently no part of the spec.
|
||||
// See bug 1040668 comment 69 and comment 75.
|
||||
aData->SetKeywordValue(eCSSProperty_text_emphasis_position,
|
||||
aDecls.SetKeywordValue(eCSSProperty_text_emphasis_position,
|
||||
NS_STYLE_TEXT_EMPHASIS_POSITION_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
@ -1191,36 +1191,36 @@ MapLangAttributeInto(const nsMappedAttributes* aAttributes, GenericSpecifiedValu
|
|||
*/
|
||||
void
|
||||
nsGenericHTMLElement::MapCommonAttributesIntoExceptHidden(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty__moz_user_modify)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty__moz_user_modify)) {
|
||||
const nsAttrValue* value =
|
||||
aAttributes->GetAttr(nsGkAtoms::contenteditable);
|
||||
if (value) {
|
||||
if (value->Equals(nsGkAtoms::_empty, eCaseMatters) ||
|
||||
value->Equals(nsGkAtoms::_true, eIgnoreCase)) {
|
||||
aData->SetKeywordValue(eCSSProperty__moz_user_modify,
|
||||
aDecls.SetKeywordValue(eCSSProperty__moz_user_modify,
|
||||
StyleUserModify::ReadWrite);
|
||||
}
|
||||
else if (value->Equals(nsGkAtoms::_false, eIgnoreCase)) {
|
||||
aData->SetKeywordValue(eCSSProperty__moz_user_modify,
|
||||
aDecls.SetKeywordValue(eCSSProperty__moz_user_modify,
|
||||
StyleUserModify::ReadOnly);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
MapLangAttributeInto(aAttributes, aData);
|
||||
MapLangAttributeInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
MapCommonAttributesIntoExceptHidden(aAttributes, aData);
|
||||
MapCommonAttributesIntoExceptHidden(aAttributes, aDecls);
|
||||
|
||||
if (!aData->PropertyIsSet(eCSSProperty_display)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_display)) {
|
||||
if (aAttributes->IndexOfAttr(nsGkAtoms::hidden) >= 0) {
|
||||
aData->SetKeywordValue(eCSSProperty_display, StyleDisplay::None);
|
||||
aDecls.SetKeywordValue(eCSSProperty_display, StyleDisplay::None);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1275,25 +1275,25 @@ nsGenericHTMLElement::sBackgroundColorAttributeMap[] = {
|
|||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
||||
if (value && value->Type() == nsAttrValue::eEnum) {
|
||||
int32_t align = value->GetEnumValue();
|
||||
if (!aData->PropertyIsSet(eCSSProperty_float)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_float)) {
|
||||
if (align == NS_STYLE_TEXT_ALIGN_LEFT) {
|
||||
aData->SetKeywordValue(eCSSProperty_float, StyleFloat::Left);
|
||||
aDecls.SetKeywordValue(eCSSProperty_float, StyleFloat::Left);
|
||||
} else if (align == NS_STYLE_TEXT_ALIGN_RIGHT) {
|
||||
aData->SetKeywordValue(eCSSProperty_float, StyleFloat::Right);
|
||||
aDecls.SetKeywordValue(eCSSProperty_float, StyleFloat::Right);
|
||||
}
|
||||
}
|
||||
if (!aData->PropertyIsSet(eCSSProperty_vertical_align)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_vertical_align)) {
|
||||
switch (align) {
|
||||
case NS_STYLE_TEXT_ALIGN_LEFT:
|
||||
case NS_STYLE_TEXT_ALIGN_RIGHT:
|
||||
break;
|
||||
default:
|
||||
aData->SetKeywordValue(eCSSProperty_vertical_align, align);
|
||||
aDecls.SetKeywordValue(eCSSProperty_vertical_align, align);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -1302,31 +1302,31 @@ nsGenericHTMLElement::MapImageAlignAttributeInto(const nsMappedAttributes* aAttr
|
|||
|
||||
void
|
||||
nsGenericHTMLElement::MapDivAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_text_align)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_text_align)) {
|
||||
// align: enum
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::align);
|
||||
if (value && value->Type() == nsAttrValue::eEnum)
|
||||
aData->SetKeywordValue(eCSSProperty_text_align, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_text_align, value->GetEnumValue());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapVAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_vertical_align)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_vertical_align)) {
|
||||
// align: enum
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::valign);
|
||||
if (value && value->Type() == nsAttrValue::eEnum)
|
||||
aData->SetKeywordValue(eCSSProperty_vertical_align, value->GetEnumValue());
|
||||
aDecls.SetKeywordValue(eCSSProperty_vertical_align, value->GetEnumValue());
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageMarginAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
const nsAttrValue* value;
|
||||
|
||||
|
@ -1334,14 +1334,14 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsMappedAttributes* aAtt
|
|||
value = aAttributes->GetAttr(nsGkAtoms::hspace);
|
||||
if (value) {
|
||||
if (value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_left,
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_left,
|
||||
(float)value->GetIntegerValue());
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_right,
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_right,
|
||||
(float)value->GetIntegerValue());
|
||||
} else if (value->Type() == nsAttrValue::ePercent) {
|
||||
aData->SetPercentValueIfUnset(eCSSProperty_margin_left,
|
||||
aDecls.SetPercentValueIfUnset(eCSSProperty_margin_left,
|
||||
value->GetPercentValue());
|
||||
aData->SetPercentValueIfUnset(eCSSProperty_margin_right,
|
||||
aDecls.SetPercentValueIfUnset(eCSSProperty_margin_right,
|
||||
value->GetPercentValue());
|
||||
}
|
||||
}
|
||||
|
@ -1350,14 +1350,14 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsMappedAttributes* aAtt
|
|||
value = aAttributes->GetAttr(nsGkAtoms::vspace);
|
||||
if (value) {
|
||||
if (value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_top,
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_top,
|
||||
(float)value->GetIntegerValue());
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_margin_bottom,
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_margin_bottom,
|
||||
(float)value->GetIntegerValue());
|
||||
} else if (value->Type() == nsAttrValue::ePercent) {
|
||||
aData->SetPercentValueIfUnset(eCSSProperty_margin_top,
|
||||
aDecls.SetPercentValueIfUnset(eCSSProperty_margin_top,
|
||||
value->GetPercentValue());
|
||||
aData->SetPercentValueIfUnset(eCSSProperty_margin_bottom,
|
||||
aDecls.SetPercentValueIfUnset(eCSSProperty_margin_bottom,
|
||||
value->GetPercentValue());
|
||||
}
|
||||
}
|
||||
|
@ -1365,16 +1365,16 @@ nsGenericHTMLElement::MapImageMarginAttributeInto(const nsMappedAttributes* aAtt
|
|||
|
||||
void
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// width: value
|
||||
if (!aData->PropertyIsSet(eCSSProperty_width)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_width)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValue(eCSSProperty_width,
|
||||
aDecls.SetPixelValue(eCSSProperty_width,
|
||||
(float)value->GetIntegerValue());
|
||||
} else if (value && value->Type() == nsAttrValue::ePercent) {
|
||||
aData->SetPercentValue(eCSSProperty_width,
|
||||
aDecls.SetPercentValue(eCSSProperty_width,
|
||||
value->GetPercentValue());
|
||||
}
|
||||
}
|
||||
|
@ -1382,16 +1382,16 @@ nsGenericHTMLElement::MapWidthAttributeInto(const nsMappedAttributes* aAttribute
|
|||
|
||||
void
|
||||
nsGenericHTMLElement::MapHeightAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// height: value
|
||||
if (!aData->PropertyIsSet(eCSSProperty_height)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_height)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::height);
|
||||
if (value && value->Type() == nsAttrValue::eInteger) {
|
||||
aData->SetPixelValue(eCSSProperty_height,
|
||||
aDecls.SetPixelValue(eCSSProperty_height,
|
||||
(float)value->GetIntegerValue());
|
||||
} else if (value && value->Type() == nsAttrValue::ePercent) {
|
||||
aData->SetPercentValue(eCSSProperty_height,
|
||||
aDecls.SetPercentValue(eCSSProperty_height,
|
||||
value->GetPercentValue());
|
||||
}
|
||||
}
|
||||
|
@ -1399,15 +1399,15 @@ nsGenericHTMLElement::MapHeightAttributeInto(const nsMappedAttributes* aAttribut
|
|||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageSizeAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapHeightAttributeInto(aAttributes, aData);
|
||||
nsGenericHTMLElement::MapWidthAttributeInto(aAttributes, aDecls);
|
||||
nsGenericHTMLElement::MapHeightAttributeInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapImageBorderAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// border: pixels
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::border);
|
||||
|
@ -1418,60 +1418,60 @@ nsGenericHTMLElement::MapImageBorderAttributeInto(const nsMappedAttributes* aAtt
|
|||
if (value->Type() == nsAttrValue::eInteger)
|
||||
val = value->GetIntegerValue();
|
||||
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_top_width, (float)val);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_right_width, (float)val);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_bottom_width, (float)val);
|
||||
aData->SetPixelValueIfUnset(eCSSProperty_border_left_width, (float)val);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_top_width, (float)val);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_right_width, (float)val);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_bottom_width, (float)val);
|
||||
aDecls.SetPixelValueIfUnset(eCSSProperty_border_left_width, (float)val);
|
||||
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_top_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_top_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_right_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_right_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_bottom_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_bottom_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
aData->SetKeywordValueIfUnset(eCSSProperty_border_left_style,
|
||||
aDecls.SetKeywordValueIfUnset(eCSSProperty_border_left_style,
|
||||
NS_STYLE_BORDER_STYLE_SOLID);
|
||||
|
||||
aData->SetCurrentColorIfUnset(eCSSProperty_border_top_color);
|
||||
aData->SetCurrentColorIfUnset(eCSSProperty_border_right_color);
|
||||
aData->SetCurrentColorIfUnset(eCSSProperty_border_bottom_color);
|
||||
aData->SetCurrentColorIfUnset(eCSSProperty_border_left_color);
|
||||
aDecls.SetCurrentColorIfUnset(eCSSProperty_border_top_color);
|
||||
aDecls.SetCurrentColorIfUnset(eCSSProperty_border_right_color);
|
||||
aDecls.SetCurrentColorIfUnset(eCSSProperty_border_bottom_color);
|
||||
aDecls.SetCurrentColorIfUnset(eCSSProperty_border_left_color);
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapBackgroundInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
|
||||
if (!aData->PropertyIsSet(eCSSProperty_background_image)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_background_image)) {
|
||||
// background
|
||||
nsAttrValue* value =
|
||||
const_cast<nsAttrValue*>(aAttributes->GetAttr(nsGkAtoms::background));
|
||||
if (value) {
|
||||
aData->SetBackgroundImage(*value);
|
||||
aDecls.SetBackgroundImage(*value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapBGColorInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
if (!aData->PropertyIsSet(eCSSProperty_background_color)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_background_color)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::bgcolor);
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->SetColorValue(eCSSProperty_background_color, color);
|
||||
aDecls.SetColorValue(eCSSProperty_background_color, color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGenericHTMLElement::MapBackgroundAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
MapBackgroundInto(aAttributes, aData);
|
||||
MapBGColorInto(aAttributes, aData);
|
||||
MapBackgroundInto(aAttributes, aDecls);
|
||||
MapBGColorInto(aAttributes, aDecls);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -450,7 +450,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapCommonAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Same as MapCommonAttributesInto except that it does not handle hidden.
|
||||
*
|
||||
|
@ -459,7 +459,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapCommonAttributesIntoExceptHidden(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
static const MappedAttributeEntry sCommonAttributeMap[];
|
||||
static const MappedAttributeEntry sImageMarginSizeAttributeMap[];
|
||||
|
@ -477,7 +477,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapImageAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* Helper to map the align attribute into a style struct for things
|
||||
|
@ -488,7 +488,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapDivAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* Helper to map the valign attribute into a style struct for things
|
||||
|
@ -499,7 +499,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapVAlignAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* Helper to map the image border attribute into a style struct.
|
||||
|
@ -509,7 +509,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapImageBorderAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map the image margin attribute into a style struct.
|
||||
*
|
||||
|
@ -518,7 +518,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapImageMarginAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map the image position attribute into a style struct.
|
||||
*
|
||||
|
@ -527,7 +527,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapImageSizeAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
/**
|
||||
* Helper to map `width` attribute into a style struct.
|
||||
|
@ -537,7 +537,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapWidthAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map `height` attribute into a style struct.
|
||||
*
|
||||
|
@ -546,7 +546,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapHeightAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map the background attribute
|
||||
* into a style struct.
|
||||
|
@ -556,7 +556,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapBackgroundInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map the bgcolor attribute
|
||||
* into a style struct.
|
||||
|
@ -566,7 +566,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapBGColorInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map the background attributes (currently background and bgcolor)
|
||||
* into a style struct.
|
||||
|
@ -576,7 +576,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapBackgroundAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Helper to map the scrolling attribute on FRAME and IFRAME
|
||||
* into a style struct.
|
||||
|
@ -586,7 +586,7 @@ public:
|
|||
* @see GetAttributeMappingFunction
|
||||
*/
|
||||
static void MapScrollingAttributeInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
/**
|
||||
* Get the presentation context for this content node.
|
||||
* @return the presentation context
|
||||
|
|
|
@ -375,7 +375,7 @@ void
|
|||
StructuredCloneData::CopyFromClonedMessageDataForBackgroundParent(const ClonedMessageData& aClonedData)
|
||||
{
|
||||
MOZ_ASSERT(IsOnBackgroundThread());
|
||||
UnpackClonedMessageData<BorrowMemory, Parent>(aClonedData, *this);
|
||||
UnpackClonedMessageData<CopyMemory, Parent>(aClonedData, *this);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -463,6 +463,12 @@ StructuredCloneData::StealExternalData(JSStructuredCloneData& aData)
|
|||
return true;
|
||||
}
|
||||
|
||||
already_AddRefed<SharedJSAllocatedData>
|
||||
StructuredCloneData::TakeSharedData()
|
||||
{
|
||||
return mSharedData.forget();
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -297,6 +297,9 @@ public:
|
|||
protected:
|
||||
explicit StructuredCloneData(TransferringSupport aSupportsTransferring);
|
||||
|
||||
already_AddRefed<SharedJSAllocatedData>
|
||||
TakeSharedData();
|
||||
|
||||
private:
|
||||
JSStructuredCloneData mExternalData;
|
||||
RefPtr<SharedJSAllocatedData> mSharedData;
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
#include "mozilla/EventDispatcher.h"
|
||||
#include "mozilla/EventStates.h"
|
||||
#include "mozilla/GenericSpecifiedValuesInlines.h"
|
||||
#include "mozilla/MappedDeclarations.h"
|
||||
#include "mozilla/dom/ElementBinding.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -106,25 +106,9 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent,
|
|||
aDocument->RegisterPendingLinkUpdate(this);
|
||||
}
|
||||
|
||||
nsIDocument* doc = GetComposedDoc();
|
||||
if (doc) {
|
||||
if (!doc->GetMathMLEnabled()) {
|
||||
// Enable MathML and setup the style sheet during binding, not element
|
||||
// construction, because we could move a MathML element from the document
|
||||
// that created it to another document.
|
||||
auto cache = nsLayoutStylesheetCache::Singleton();
|
||||
doc->SetMathMLEnabled();
|
||||
doc->EnsureOnDemandBuiltInUASheet(cache->MathMLSheet());
|
||||
|
||||
// Rebuild style data for the presshell, because style system
|
||||
// optimizations may have taken place assuming MathML was disabled.
|
||||
// (See nsRuleNode::CheckSpecifiedProperties.)
|
||||
RefPtr<nsPresContext> presContext = doc->GetPresContext();
|
||||
if (presContext) {
|
||||
presContext->
|
||||
PostRebuildAllStyleDataEvent(nsChangeHint(0), eRestyle_Subtree);
|
||||
}
|
||||
}
|
||||
// Set the bit in the document for telemetry.
|
||||
if (nsIDocument* doc = GetComposedDoc()) {
|
||||
doc->SetMathMLEnabled();
|
||||
}
|
||||
|
||||
return rv;
|
||||
|
@ -500,7 +484,7 @@ nsMathMLElement::ParseNumericValue(const nsString& aString,
|
|||
|
||||
void
|
||||
nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
GenericSpecifiedValues* aData)
|
||||
MappedDeclarations& aDecls)
|
||||
{
|
||||
// scriptsizemultiplier
|
||||
//
|
||||
|
@ -513,7 +497,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
const nsAttrValue* value =
|
||||
aAttributes->GetAttr(nsGkAtoms::scriptsizemultiplier_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty__moz_script_size_multiplier)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty__moz_script_size_multiplier)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
str.CompressWhitespace();
|
||||
// MathML numbers can't have leading '+'
|
||||
|
@ -522,11 +506,11 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
float floatValue = str.ToFloat(&errorCode);
|
||||
// Negative scriptsizemultipliers are not parsed
|
||||
if (NS_SUCCEEDED(errorCode) && floatValue >= 0.0f) {
|
||||
aData->SetNumberValue(eCSSProperty__moz_script_size_multiplier, floatValue);
|
||||
aDecls.SetNumberValue(eCSSProperty__moz_script_size_multiplier, floatValue);
|
||||
} else {
|
||||
ReportParseErrorNoTag(str,
|
||||
nsGkAtoms::scriptsizemultiplier_,
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,18 +528,18 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
//
|
||||
value = aAttributes->GetAttr(nsGkAtoms::scriptminsize_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty__moz_script_min_size)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty__moz_script_min_size)) {
|
||||
nsCSSValue scriptMinSize;
|
||||
ParseNumericValue(value->GetStringValue(), scriptMinSize,
|
||||
PARSE_ALLOW_UNITLESS | CONVERT_UNITLESS_TO_PERCENT,
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
|
||||
if (scriptMinSize.GetUnit() == eCSSUnit_Percent) {
|
||||
scriptMinSize.SetFloatValue(8.0 * scriptMinSize.GetPercentValue(),
|
||||
eCSSUnit_Point);
|
||||
}
|
||||
if (scriptMinSize.GetUnit() != eCSSUnit_Null) {
|
||||
aData->SetLengthValue(eCSSProperty__moz_script_min_size, scriptMinSize);
|
||||
aDecls.SetLengthValue(eCSSProperty__moz_script_min_size, scriptMinSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -572,7 +556,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
//
|
||||
value = aAttributes->GetAttr(nsGkAtoms::scriptlevel_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty__moz_script_level)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty__moz_script_level)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
str.CompressWhitespace();
|
||||
if (str.Length() > 0) {
|
||||
|
@ -585,14 +569,14 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
// to indicate that the scriptlevel is absolute.
|
||||
char16_t ch = str.CharAt(0);
|
||||
if (ch == '+' || ch == '-') {
|
||||
aData->SetIntValue(eCSSProperty__moz_script_level, intValue);
|
||||
aDecls.SetIntValue(eCSSProperty__moz_script_level, intValue);
|
||||
} else {
|
||||
aData->SetNumberValue(eCSSProperty__moz_script_level, intValue);
|
||||
aDecls.SetNumberValue(eCSSProperty__moz_script_level, intValue);
|
||||
}
|
||||
} else {
|
||||
ReportParseErrorNoTag(str,
|
||||
nsGkAtoms::scriptlevel_,
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -626,11 +610,11 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
if (value) {
|
||||
WarnDeprecated(nsGkAtoms::fontsize_->GetUTF16String(),
|
||||
nsGkAtoms::mathsize_->GetUTF16String(),
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
}
|
||||
}
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty_font_size)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty_font_size)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
nsCSSValue fontSize;
|
||||
if (!ParseNumericValue(str, fontSize, PARSE_SUPPRESS_WARNINGS |
|
||||
|
@ -645,15 +629,15 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
str.CompressWhitespace();
|
||||
for (uint32_t i = 0; i < ArrayLength(sizes); ++i) {
|
||||
if (str.EqualsASCII(sizes[i])) {
|
||||
aData->SetKeywordValue(eCSSProperty_font_size, values[i]);
|
||||
aDecls.SetKeywordValue(eCSSProperty_font_size, values[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (fontSize.GetUnit() == eCSSUnit_Percent) {
|
||||
aData->SetPercentValue(eCSSProperty_font_size,
|
||||
aDecls.SetPercentValue(eCSSProperty_font_size,
|
||||
fontSize.GetPercentValue());
|
||||
} else if (fontSize.GetUnit() != eCSSUnit_Null) {
|
||||
aData->SetLengthValue(eCSSProperty_font_size, fontSize);
|
||||
aDecls.SetLengthValue(eCSSProperty_font_size, fontSize);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -669,11 +653,11 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
if (value) {
|
||||
WarnDeprecated(nsGkAtoms::fontfamily_->GetUTF16String(),
|
||||
nsGkAtoms::mathvariant_->GetUTF16String(),
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
}
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty_font_family)) {
|
||||
aData->SetFontFamily(value->GetStringValue());
|
||||
!aDecls.PropertyIsSet(eCSSProperty_font_family)) {
|
||||
aDecls.SetFontFamily(value->GetStringValue());
|
||||
}
|
||||
|
||||
// fontstyle
|
||||
|
@ -690,17 +674,17 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
if (value) {
|
||||
WarnDeprecated(nsGkAtoms::fontstyle_->GetUTF16String(),
|
||||
nsGkAtoms::mathvariant_->GetUTF16String(),
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
if (value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty_font_style)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty_font_style)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
str.CompressWhitespace();
|
||||
// FIXME(emilio): This should use FontSlantStyle or what not. Or even
|
||||
// better, it looks deprecated since forever, we should just kill it.
|
||||
if (str.EqualsASCII("normal")) {
|
||||
aData->SetKeywordValue(eCSSProperty_font_style, NS_FONT_STYLE_NORMAL);
|
||||
aDecls.SetKeywordValue(eCSSProperty_font_style, NS_FONT_STYLE_NORMAL);
|
||||
} else if (str.EqualsASCII("italic")) {
|
||||
aData->SetKeywordValue(eCSSProperty_font_style, NS_FONT_STYLE_ITALIC);
|
||||
aDecls.SetKeywordValue(eCSSProperty_font_style, NS_FONT_STYLE_ITALIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -719,16 +703,16 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
if (value) {
|
||||
WarnDeprecated(nsGkAtoms::fontweight_->GetUTF16String(),
|
||||
nsGkAtoms::mathvariant_->GetUTF16String(),
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
if (value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty_font_weight)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty_font_weight)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
str.CompressWhitespace();
|
||||
if (str.EqualsASCII("normal")) {
|
||||
aData->SetKeywordValue(eCSSProperty_font_weight,
|
||||
aDecls.SetKeywordValue(eCSSProperty_font_weight,
|
||||
FontWeight::Normal().ToFloat());
|
||||
} else if (str.EqualsASCII("bold")) {
|
||||
aData->SetKeywordValue(eCSSProperty_font_weight,
|
||||
aDecls.SetKeywordValue(eCSSProperty_font_weight,
|
||||
FontWeight::Bold().ToFloat());
|
||||
}
|
||||
}
|
||||
|
@ -747,7 +731,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
//
|
||||
value = aAttributes->GetAttr(nsGkAtoms::mathvariant_);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty__moz_math_variant)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty__moz_math_variant)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
str.CompressWhitespace();
|
||||
static const char sizes[19][23] = {
|
||||
|
@ -771,7 +755,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
};
|
||||
for (uint32_t i = 0; i < ArrayLength(sizes); ++i) {
|
||||
if (str.EqualsASCII(sizes[i])) {
|
||||
aData->SetKeywordValue(eCSSProperty__moz_math_variant, values[i]);
|
||||
aDecls.SetKeywordValue(eCSSProperty__moz_math_variant, values[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -801,13 +785,13 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
if (value) {
|
||||
WarnDeprecated(nsGkAtoms::background->GetUTF16String(),
|
||||
nsGkAtoms::mathbackground_->GetUTF16String(),
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
}
|
||||
}
|
||||
if (value) {
|
||||
nscolor color;
|
||||
if (value->GetColorValue(color)) {
|
||||
aData->SetColorValueIfUnset(eCSSProperty_background_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_background_color, color);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -834,12 +818,12 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
if (value) {
|
||||
WarnDeprecated(nsGkAtoms::color->GetUTF16String(),
|
||||
nsGkAtoms::mathcolor_->GetUTF16String(),
|
||||
aData->Document());
|
||||
aDecls.Document());
|
||||
}
|
||||
}
|
||||
nscolor color;
|
||||
if (value && value->GetColorValue(color)) {
|
||||
aData->SetColorValueIfUnset(eCSSProperty_color, color);
|
||||
aDecls.SetColorValueIfUnset(eCSSProperty_color, color);
|
||||
}
|
||||
|
||||
// width
|
||||
|
@ -854,17 +838,17 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
// values: "auto" | length
|
||||
// default: auto
|
||||
//
|
||||
if (!aData->PropertyIsSet(eCSSProperty_width)) {
|
||||
if (!aDecls.PropertyIsSet(eCSSProperty_width)) {
|
||||
const nsAttrValue* value = aAttributes->GetAttr(nsGkAtoms::width);
|
||||
nsCSSValue width;
|
||||
// This does not handle auto and unitless values
|
||||
if (value && value->Type() == nsAttrValue::eString) {
|
||||
ParseNumericValue(value->GetStringValue(), width, 0, aData->Document());
|
||||
ParseNumericValue(value->GetStringValue(), width, 0, aDecls.Document());
|
||||
if (width.GetUnit() == eCSSUnit_Percent) {
|
||||
aData->SetPercentValue(eCSSProperty_width,
|
||||
aDecls.SetPercentValue(eCSSProperty_width,
|
||||
width.GetPercentValue());
|
||||
} else if (width.GetUnit() != eCSSUnit_Null) {
|
||||
aData->SetLengthValue(eCSSProperty_width, width);
|
||||
aDecls.SetLengthValue(eCSSProperty_width, width);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -891,7 +875,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
//
|
||||
value = aAttributes->GetAttr(nsGkAtoms::dir);
|
||||
if (value && value->Type() == nsAttrValue::eString &&
|
||||
!aData->PropertyIsSet(eCSSProperty_direction)) {
|
||||
!aDecls.PropertyIsSet(eCSSProperty_direction)) {
|
||||
nsAutoString str(value->GetStringValue());
|
||||
static const char dirs[][4] = { "ltr", "rtl" };
|
||||
static const int32_t dirValues[MOZ_ARRAY_LENGTH(dirs)] = {
|
||||
|
@ -899,7 +883,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
|||
};
|
||||
for (uint32_t i = 0; i < ArrayLength(dirs); ++i) {
|
||||
if (str.EqualsASCII(dirs[i])) {
|
||||
aData->SetKeywordValue(eCSSProperty_direction, dirValues[i]);
|
||||
aDecls.SetKeywordValue(eCSSProperty_direction, dirValues[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
nsIDocument* aDocument);
|
||||
|
||||
static void MapMathMLAttributesInto(const nsMappedAttributes* aAttributes,
|
||||
mozilla::GenericSpecifiedValues* aGenericData);
|
||||
mozilla::MappedDeclarations&);
|
||||
|
||||
void GetEventTargetParent(mozilla::EventChainPreVisitor& aVisitor) override;
|
||||
virtual nsresult PostHandleEvent(
|
||||
|
|
|
@ -581,7 +581,7 @@ PluginModuleChromeParent::InitCrashReporter()
|
|||
}
|
||||
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mCrashReporterMutex);
|
||||
mozilla::RecursiveMutexAutoLock lock(mCrashReporterMutex);
|
||||
mCrashReporter = MakeUnique<ipc::CrashReporterHost>(
|
||||
GeckoProcessType_Plugin,
|
||||
shmem,
|
||||
|
@ -721,7 +721,7 @@ void
|
|||
PluginModuleChromeParent::WriteExtraDataForMinidump()
|
||||
{
|
||||
// mCrashReporterMutex is already held by the caller
|
||||
mCrashReporterMutex.AssertCurrentThreadOwns();
|
||||
mCrashReporterMutex.AssertCurrentThreadIn();
|
||||
|
||||
typedef nsDependentCString cstring;
|
||||
|
||||
|
@ -1087,7 +1087,7 @@ PluginModuleChromeParent::TakeFullMinidump(base::ProcessId aContentPid,
|
|||
std::function<void(nsString)>&& aCallback,
|
||||
bool aAsync)
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mCrashReporterMutex);
|
||||
mozilla::RecursiveMutexAutoLock lock(mCrashReporterMutex);
|
||||
|
||||
if (!mCrashReporter || !mTakeFullMinidumpCallback.IsEmpty()) {
|
||||
aCallback(EmptyString());
|
||||
|
@ -1174,7 +1174,7 @@ PluginModuleChromeParent::TakeBrowserAndPluginMinidumps(bool aReportsReady,
|
|||
const nsAString& aBrowserDumpId,
|
||||
bool aAsync)
|
||||
{
|
||||
mCrashReporterMutex.AssertCurrentThreadOwns();
|
||||
mCrashReporterMutex.AssertCurrentThreadIn();
|
||||
|
||||
// Generate crash report including plugin and browser process minidumps.
|
||||
// The plugin process is the parent report with additional dumps including
|
||||
|
@ -1209,7 +1209,7 @@ PluginModuleChromeParent::OnTakeFullMinidumpComplete(bool aReportsReady,
|
|||
base::ProcessId aContentPid,
|
||||
const nsAString& aBrowserDumpId)
|
||||
{
|
||||
mCrashReporterMutex.AssertCurrentThreadOwns();
|
||||
mCrashReporterMutex.AssertCurrentThreadIn();
|
||||
|
||||
if (aReportsReady) {
|
||||
nsString dumpId = mCrashReporter->MinidumpID();
|
||||
|
@ -1294,7 +1294,7 @@ void
|
|||
PluginModuleChromeParent::TerminateChildProcessOnDumpComplete(MessageLoop* aMsgLoop,
|
||||
const nsCString& aMonitorDescription)
|
||||
{
|
||||
mCrashReporterMutex.AssertCurrentThreadOwns();
|
||||
mCrashReporterMutex.AssertCurrentThreadIn();
|
||||
|
||||
if (!mCrashReporter) {
|
||||
// If mCrashReporter is null then the hang has ended, the plugin module
|
||||
|
@ -1511,7 +1511,7 @@ RemoveMinidump(nsIFile* minidump)
|
|||
void
|
||||
PluginModuleChromeParent::ProcessFirstMinidump()
|
||||
{
|
||||
mozilla::MutexAutoLock lock(mCrashReporterMutex);
|
||||
mozilla::RecursiveMutexAutoLock lock(mCrashReporterMutex);
|
||||
|
||||
if (!mCrashReporter)
|
||||
return;
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
#include "mozilla/plugins/PluginMessageUtils.h"
|
||||
#include "mozilla/plugins/PluginTypes.h"
|
||||
#include "mozilla/ipc/TaskFactory.h"
|
||||
#include "mozilla/RecursiveMutex.h"
|
||||
#include "mozilla/TimeStamp.h"
|
||||
#include "mozilla/Unused.h"
|
||||
#include "npapi.h"
|
||||
|
@ -317,9 +318,11 @@ protected:
|
|||
* This mutex protects the crash reporter when the Plugin Hang UI event
|
||||
* handler is executing off main thread. It is intended to protect both
|
||||
* the mCrashReporter variable in addition to the CrashReporterHost object
|
||||
* that mCrashReporter refers to.
|
||||
* that mCrashReporter refers to. Sometimes asynchronous crash reporter
|
||||
* callbacks are dispatched synchronously while the caller is still holding
|
||||
* the mutex. This requires recursive locking support in the mutex.
|
||||
*/
|
||||
mozilla::Mutex mCrashReporterMutex;
|
||||
mozilla::RecursiveMutex mCrashReporterMutex;
|
||||
UniquePtr<ipc::CrashReporterHost> mCrashReporter;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include "nsIDocument.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
#include "ServiceWorkerCloneData.h"
|
||||
#include "ServiceWorkerImpl.h"
|
||||
#include "ServiceWorkerManager.h"
|
||||
#include "ServiceWorkerPrivate.h"
|
||||
|
@ -18,7 +19,6 @@
|
|||
#include "mozilla/dom/Promise.h"
|
||||
#include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
|
||||
#ifdef XP_WIN
|
||||
#undef PostMessage
|
||||
|
@ -179,8 +179,8 @@ ServiceWorker::PostMessage(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
|||
return;
|
||||
}
|
||||
|
||||
ipc::StructuredCloneData data;
|
||||
data.Write(aCx, aMessage, transferable, aRv);
|
||||
RefPtr<ServiceWorkerCloneData> data = new ServiceWorkerCloneData();
|
||||
data->Write(aCx, aMessage, transferable, aRv);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -20,9 +20,7 @@ class nsIGlobalObject;
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
namespace ipc {
|
||||
class StructuredCloneData;
|
||||
} // namespace ipc
|
||||
class ServiceWorkerCloneData;
|
||||
|
||||
#define NS_DOM_SERVICEWORKER_IID \
|
||||
{0xd42e0611, 0x3647, 0x4319, {0xae, 0x05, 0x19, 0x89, 0x59, 0xba, 0x99, 0x5e}}
|
||||
|
@ -58,7 +56,7 @@ public:
|
|||
RemoveServiceWorker(ServiceWorker* aWorker) = 0;
|
||||
|
||||
virtual void
|
||||
PostMessage(ipc::StructuredCloneData&& aData,
|
||||
PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfo& aClientInfo,
|
||||
const ClientState& aClientState) = 0;
|
||||
|
||||
|
|
|
@ -0,0 +1,29 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#include "ServiceWorkerCloneData.h"
|
||||
|
||||
#include "nsProxyRelease.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
ServiceWorkerCloneData::~ServiceWorkerCloneData()
|
||||
{
|
||||
RefPtr<ipc::SharedJSAllocatedData> sharedData = TakeSharedData();
|
||||
if (sharedData) {
|
||||
NS_ProxyRelease(__func__, mEventTarget, sharedData.forget());
|
||||
}
|
||||
}
|
||||
|
||||
ServiceWorkerCloneData::ServiceWorkerCloneData()
|
||||
: mEventTarget(GetCurrentThreadSerialEventTarget())
|
||||
{
|
||||
MOZ_DIAGNOSTIC_ASSERT(mEventTarget);
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
|
@ -0,0 +1,50 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef mozilla_dom_ServiceWorkerCloneData_h__
|
||||
#define mozilla_dom_ServiceWorkerCloneData_h__
|
||||
|
||||
#include "mozilla/dom/ipc/StructuredCloneData.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
// Helper class used to pack structured clone data so that it can be
|
||||
// passed across thread and process boundaries. Currently the raw
|
||||
// StructuredCloneData and StructureCloneHolder APIs both make it
|
||||
// difficult to meet this needs directly. This helper class improves
|
||||
// the situation by:
|
||||
//
|
||||
// 1. Provides a ref-counted version of StructuredCloneData. We need
|
||||
// StructuredCloneData so we can serialize/deserialize across IPC.
|
||||
// The move constructor problems in StructuredCloneData (bug 1462676),
|
||||
// though, makes it hard to pass it around. Passing a ref-counted
|
||||
// pointer addresses this problem.
|
||||
// 2. Normally StructuredCloneData runs into problems if you try to move
|
||||
// it across thread boundaries because it releases its SharedJSAllocatedData
|
||||
// on the wrong thread. This helper will correctly proxy release the
|
||||
// shared data on the correct thread.
|
||||
//
|
||||
// This helper class should really just be used to serialize on one thread
|
||||
// and then move the reference across thread/process boundries to the
|
||||
// target worker thread. This class is not intended to support simultaneous
|
||||
// read/write operations from different threads at the same time.
|
||||
class ServiceWorkerCloneData final : public ipc::StructuredCloneData
|
||||
{
|
||||
nsCOMPtr<nsISerialEventTarget> mEventTarget;
|
||||
|
||||
~ServiceWorkerCloneData();
|
||||
|
||||
public:
|
||||
ServiceWorkerCloneData();
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(ServiceWorkerCloneData)
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // mozilla_dom_ServiceWorkerCloneData_h__
|
|
@ -37,7 +37,7 @@ ServiceWorkerImpl::RemoveServiceWorker(ServiceWorker* aWorker)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerImpl::PostMessage(ipc::StructuredCloneData&& aData,
|
||||
ServiceWorkerImpl::PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfo& aClientInfo,
|
||||
const ClientState& aClientState)
|
||||
{
|
||||
|
|
|
@ -31,7 +31,7 @@ class ServiceWorkerImpl final : public ServiceWorker::Inner
|
|||
RemoveServiceWorker(ServiceWorker* aWorker) override;
|
||||
|
||||
void
|
||||
PostMessage(ipc::StructuredCloneData&& aData,
|
||||
PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfo& aClientInfo,
|
||||
const ClientState& aClientState) override;
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ ServiceWorkerInfo::RemoveListener(Listener* aListener)
|
|||
}
|
||||
|
||||
void
|
||||
ServiceWorkerInfo::PostMessage(ipc::StructuredCloneData&& aData,
|
||||
ServiceWorkerInfo::PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfo& aClientInfo,
|
||||
const ClientState& aClientState)
|
||||
{
|
||||
|
|
|
@ -17,6 +17,8 @@ namespace mozilla {
|
|||
namespace dom {
|
||||
|
||||
class ClientInfoAndState;
|
||||
class ClientState;
|
||||
class ServiceWorkerCloneData;
|
||||
class ServiceWorkerPrivate;
|
||||
|
||||
/*
|
||||
|
@ -97,7 +99,7 @@ public:
|
|||
RemoveListener(Listener* aListener);
|
||||
|
||||
void
|
||||
PostMessage(ipc::StructuredCloneData&& aData,
|
||||
PostMessage(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfo& aClientInfo,
|
||||
const ClientState& aClientState);
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
|
||||
#include "ServiceWorkerPrivate.h"
|
||||
|
||||
#include "ServiceWorkerCloneData.h"
|
||||
#include "ServiceWorkerManager.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsICacheInfoChannel.h"
|
||||
|
@ -35,7 +36,6 @@
|
|||
#include "mozilla/dom/PromiseNativeHandler.h"
|
||||
#include "mozilla/dom/PushEventBinding.h"
|
||||
#include "mozilla/dom/RequestBinding.h"
|
||||
#include "mozilla/dom/StructuredCloneHolder.h"
|
||||
#include "mozilla/dom/WorkerDebugger.h"
|
||||
#include "mozilla/dom/WorkerRef.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
|
@ -54,9 +54,6 @@ using mozilla::ipc::PrincipalInfo;
|
|||
NS_IMPL_CYCLE_COLLECTING_NATIVE_ADDREF(ServiceWorkerPrivate)
|
||||
NS_IMPL_CYCLE_COLLECTING_NATIVE_RELEASE(ServiceWorkerPrivate)
|
||||
NS_IMPL_CYCLE_COLLECTION(ServiceWorkerPrivate, mSupportsArray)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ServiceWorkerPrivate)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mSandbox)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_ROOT_NATIVE(ServiceWorkerPrivate, AddRef)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNROOT_NATIVE(ServiceWorkerPrivate, Release)
|
||||
|
||||
|
@ -115,8 +112,6 @@ ServiceWorkerPrivate::~ServiceWorkerPrivate()
|
|||
MOZ_ASSERT(mSupportsArray.IsEmpty());
|
||||
|
||||
mIdleWorkerTimer->Cancel();
|
||||
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
@ -220,26 +215,6 @@ ServiceWorkerPrivate::CheckScriptEvaluation(LifeCycleEventCallback* aScriptEvalu
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
ServiceWorkerPrivate::GetOrCreateSandbox(JSContext* aCx,
|
||||
JS::MutableHandle<JSObject*> aSandbox)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
||||
if (!mSandbox) {
|
||||
nsIXPConnect* xpc = nsContentUtils::XPConnect();
|
||||
|
||||
JS::Rooted<JSObject*> sandbox(aCx);
|
||||
nsresult rv = xpc->CreateSandbox(aCx, mInfo->Principal(), sandbox.address());
|
||||
NS_ENSURE_SUCCESS_VOID(rv);
|
||||
|
||||
mSandbox = sandbox;
|
||||
HoldJSObjects(this);
|
||||
}
|
||||
|
||||
aSandbox.set(mSandbox);
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
enum ExtendableEventResult {
|
||||
|
@ -528,20 +503,21 @@ public:
|
|||
};
|
||||
|
||||
class SendMessageEventRunnable final : public ExtendableEventWorkerRunnable
|
||||
, public StructuredCloneHolder
|
||||
{
|
||||
const ClientInfoAndState mClientInfoAndState;
|
||||
RefPtr<ServiceWorkerCloneData> mData;
|
||||
|
||||
public:
|
||||
SendMessageEventRunnable(WorkerPrivate* aWorkerPrivate,
|
||||
KeepAliveToken* aKeepAliveToken,
|
||||
const ClientInfoAndState& aClientInfoAndState)
|
||||
const ClientInfoAndState& aClientInfoAndState,
|
||||
RefPtr<ServiceWorkerCloneData>&& aData)
|
||||
: ExtendableEventWorkerRunnable(aWorkerPrivate, aKeepAliveToken)
|
||||
, StructuredCloneHolder(CloningSupported, TransferringSupported,
|
||||
JS::StructuredCloneScope::SameProcessDifferentThread)
|
||||
, mClientInfoAndState(aClientInfoAndState)
|
||||
, mData(std::move(aData))
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_DIAGNOSTIC_ASSERT(mData);
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -550,13 +526,13 @@ public:
|
|||
JS::Rooted<JS::Value> messageData(aCx);
|
||||
nsCOMPtr<nsIGlobalObject> sgo = aWorkerPrivate->GlobalScope();
|
||||
ErrorResult rv;
|
||||
Read(sgo, aCx, &messageData, rv);
|
||||
mData->Read(aCx, &messageData, rv);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Sequence<OwningNonNull<MessagePort>> ports;
|
||||
if (!TakeTransferredPortsAsSequence(ports)) {
|
||||
if (!mData->TakeTransferredPortsAsSequence(ports)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -591,73 +567,18 @@ public:
|
|||
} // anonymous namespace
|
||||
|
||||
nsresult
|
||||
ServiceWorkerPrivate::SendMessageEvent(ipc::StructuredCloneData&& aData,
|
||||
ServiceWorkerPrivate::SendMessageEvent(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfoAndState& aClientInfoAndState)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
ErrorResult rv;
|
||||
|
||||
// Ideally we would simply move the StructuredCloneData to the
|
||||
// SendMessageEventRunnable, but we cannot because it uses non-threadsafe
|
||||
// ref-counting. The following gnarly code unpacks the IPC-friendly
|
||||
// StructuredCloneData and re-packs it into the thread-friendly
|
||||
// StructuredCloneHolder. In the future we should remove this and make
|
||||
// it easier to simple move the data to the other thread. See bug 1458936.
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JSObject*> global(cx);
|
||||
GetOrCreateSandbox(cx, &global);
|
||||
NS_ENSURE_TRUE(global, NS_ERROR_FAILURE);
|
||||
|
||||
// The CreateSandbox call returns a proxy to the actual sandbox object. We
|
||||
// don't need a proxy here.
|
||||
global = js::UncheckedUnwrap(global);
|
||||
|
||||
JSAutoRealm ar(cx, global);
|
||||
|
||||
JS::Rooted<JS::Value> messageData(cx);
|
||||
aData.Read(cx, &messageData, rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
|
||||
Sequence<OwningNonNull<MessagePort>> ports;
|
||||
if (!aData.TakeTransferredPortsAsSequence(ports)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
JS::Rooted<JSObject*> array(cx, JS_NewArrayObject(cx, ports.Length()));
|
||||
NS_ENSURE_TRUE(array, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
for (uint32_t i = 0; i < ports.Length(); ++i) {
|
||||
JS::Rooted<JS::Value> value(cx);
|
||||
if (!GetOrCreateDOMReflector(cx, ports[i], &value)) {
|
||||
JS_ClearPendingException(cx);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!JS_DefineElement(cx, array, i, value, JSPROP_ENUMERATE)) {
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> transferable(cx);
|
||||
transferable.setObject(*array);
|
||||
|
||||
rv = SpawnWorkerIfNeeded(MessageEvent);
|
||||
if (NS_WARN_IF(rv.Failed())) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
nsresult rv = SpawnWorkerIfNeeded(MessageEvent);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
RefPtr<KeepAliveToken> token = CreateEventKeepAliveToken();
|
||||
RefPtr<SendMessageEventRunnable> runnable =
|
||||
new SendMessageEventRunnable(mWorkerPrivate, token, aClientInfoAndState);
|
||||
|
||||
runnable->Write(cx, messageData, transferable, JS::CloneDataPolicy(), rv);
|
||||
if (rv.Failed()) {
|
||||
return rv.StealNSResult();
|
||||
}
|
||||
new SendMessageEventRunnable(mWorkerPrivate, token, aClientInfoAndState,
|
||||
std::move(aData));
|
||||
|
||||
if (!runnable->Dispatch()) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace dom {
|
|||
|
||||
class ClientInfoAndState;
|
||||
class KeepAliveToken;
|
||||
class ServiceWorkerCloneData;
|
||||
class ServiceWorkerInfo;
|
||||
class ServiceWorkerRegistrationInfo;
|
||||
|
||||
|
@ -77,7 +78,7 @@ class ServiceWorkerPrivate final
|
|||
public:
|
||||
NS_IMETHOD_(MozExternalRefCountType) AddRef();
|
||||
NS_IMETHOD_(MozExternalRefCountType) Release();
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(ServiceWorkerPrivate)
|
||||
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(ServiceWorkerPrivate)
|
||||
|
||||
typedef mozilla::FalseType HasThreadSafeRefCnt;
|
||||
|
||||
|
@ -89,7 +90,7 @@ public:
|
|||
explicit ServiceWorkerPrivate(ServiceWorkerInfo* aInfo);
|
||||
|
||||
nsresult
|
||||
SendMessageEvent(ipc::StructuredCloneData&& aData,
|
||||
SendMessageEvent(RefPtr<ServiceWorkerCloneData>&& aData,
|
||||
const ClientInfoAndState& aClientInfoAndState);
|
||||
|
||||
// This is used to validate the worker script and continue the installation
|
||||
|
@ -205,9 +206,6 @@ private:
|
|||
already_AddRefed<KeepAliveToken>
|
||||
CreateEventKeepAliveToken();
|
||||
|
||||
void
|
||||
GetOrCreateSandbox(JSContext* aCx, JS::MutableHandle<JSObject*> aSandbox);
|
||||
|
||||
// The info object owns us. It is possible to outlive it for a brief period
|
||||
// of time if there are pending waitUntil promises, in which case it
|
||||
// will be null and |SpawnWorkerIfNeeded| will always fail.
|
||||
|
@ -224,11 +222,6 @@ private:
|
|||
// worker a grace period after each event.
|
||||
RefPtr<KeepAliveToken> mIdleKeepAliveToken;
|
||||
|
||||
// Sandbox global used to re-pack structured clone data before sending
|
||||
// to the service worker thread. Ideally we would remove this and just
|
||||
// make StructuredCloneData thread safe enough to pass to the worker thread.
|
||||
JS::Heap<JSObject*> mSandbox;
|
||||
|
||||
uint64_t mDebuggerCount;
|
||||
|
||||
uint64_t mTokenCount;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include "ServiceWorkerRegisterJob.h"
|
||||
|
||||
#include "mozilla/dom/WorkerCommon.h"
|
||||
#include "ServiceWorkerManager.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
|
|
@ -18,6 +18,7 @@ enum class OnFailure : uint8_t;
|
|||
} // namespace serviceWorkerScriptCache
|
||||
|
||||
class ServiceWorkerManager;
|
||||
class ServiceWorkerRegistrationInfo;
|
||||
|
||||
// A job class that performs the Update and Install algorithms from the
|
||||
// service worker spec. This class is designed to be inherited and customized
|
||||
|
|
|
@ -28,6 +28,7 @@ EXPORTS.mozilla.dom += [
|
|||
|
||||
UNIFIED_SOURCES += [
|
||||
'ServiceWorker.cpp',
|
||||
'ServiceWorkerCloneData.cpp',
|
||||
'ServiceWorkerContainer.cpp',
|
||||
'ServiceWorkerContainerImpl.cpp',
|
||||
'ServiceWorkerDescriptor.cpp',
|
||||
|
|
|
@ -25,7 +25,6 @@
|
|||
#include "JoinNodeTransaction.h" // for JoinNodeTransaction
|
||||
#include "PlaceholderTransaction.h" // for PlaceholderTransaction
|
||||
#include "SplitNodeTransaction.h" // for SplitNodeTransaction
|
||||
#include "StyleSheetTransactions.h" // for AddStyleSheetTransaction, etc.
|
||||
#include "TextEditUtils.h" // for TextEditUtils
|
||||
#include "mozilla/CheckedInt.h" // for CheckedInt
|
||||
#include "mozilla/ComputedStyle.h" // for ComputedStyle
|
||||
|
|
|
@ -51,7 +51,6 @@ class nsIWidget;
|
|||
class nsRange;
|
||||
|
||||
namespace mozilla {
|
||||
class AddStyleSheetTransaction;
|
||||
class AutoSelectionRestorer;
|
||||
class AutoTopLevelEditSubActionNotifier;
|
||||
class AutoTransactionsConserveSelection;
|
||||
|
@ -73,7 +72,6 @@ class InsertNodeTransaction;
|
|||
class InsertTextTransaction;
|
||||
class JoinNodeTransaction;
|
||||
class PlaceholderTransaction;
|
||||
class RemoveStyleSheetTransaction;
|
||||
class SplitNodeResult;
|
||||
class SplitNodeTransaction;
|
||||
class TextComposition;
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
#include "HTMLEditRules.h"
|
||||
#include "HTMLEditUtils.h"
|
||||
#include "HTMLURIRefObject.h"
|
||||
#include "StyleSheetTransactions.h"
|
||||
#include "TextEditUtils.h"
|
||||
#include "TypeInState.h"
|
||||
|
||||
|
@ -270,7 +269,6 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLEditor)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIHTMLInlineTableEditor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsITableEditor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIEditorStyleSheets)
|
||||
NS_INTERFACE_MAP_ENTRY(nsICSSLoaderObserver)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
|
||||
NS_INTERFACE_MAP_END_INHERITING(TextEditor)
|
||||
|
||||
|
@ -2915,74 +2913,6 @@ HTMLEditor::GetLinkedObjects(nsIArray** aNodeList)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::AddStyleSheet(const nsAString& aURL)
|
||||
{
|
||||
// Enable existing sheet if already loaded.
|
||||
if (EnableExistingStyleSheet(aURL)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Lose the previously-loaded sheet so there's nothing to replace
|
||||
// This pattern is different from Override methods because
|
||||
// we must wait to remove mLastStyleSheetURL and add new sheet
|
||||
// at the same time (in StyleSheetLoaded callback) so they are undoable together
|
||||
mLastStyleSheetURL.Truncate();
|
||||
return ReplaceStyleSheet(aURL);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::ReplaceStyleSheet(const nsAString& aURL)
|
||||
{
|
||||
// Enable existing sheet if already loaded.
|
||||
if (EnableExistingStyleSheet(aURL)) {
|
||||
// Disable last sheet if not the same as new one
|
||||
if (!mLastStyleSheetURL.IsEmpty() && !mLastStyleSheetURL.Equals(aURL)) {
|
||||
return EnableStyleSheet(mLastStyleSheetURL, false);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// Make sure the pres shell doesn't disappear during the load.
|
||||
if (NS_WARN_IF(!IsInitialized())) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
nsCOMPtr<nsIPresShell> ps = GetPresShell();
|
||||
NS_ENSURE_TRUE(ps, NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
nsCOMPtr<nsIURI> uaURI;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uaURI), aURL);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return ps->GetDocument()->CSSLoader()->LoadSheet(
|
||||
uaURI, false, nullptr, nullptr, this);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::RemoveStyleSheet(const nsAString& aURL)
|
||||
{
|
||||
return RemoveStyleSheetWithTransaction(aURL);
|
||||
}
|
||||
|
||||
nsresult
|
||||
HTMLEditor::RemoveStyleSheetWithTransaction(const nsAString& aURL)
|
||||
{
|
||||
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
|
||||
if (NS_WARN_IF(!sheet)) {
|
||||
return NS_ERROR_UNEXPECTED;
|
||||
}
|
||||
|
||||
RefPtr<RemoveStyleSheetTransaction> transaction =
|
||||
RemoveStyleSheetTransaction::Create(*this, *sheet);
|
||||
nsresult rv = DoTransaction(transaction);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mLastStyleSheetURL.Truncate(); // forget it
|
||||
}
|
||||
// Remove it from our internal list
|
||||
return RemoveStyleSheetFromList(aURL);
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::AddOverrideStyleSheet(const nsAString& aURL)
|
||||
{
|
||||
|
@ -3068,8 +2998,7 @@ HTMLEditor::RemoveOverrideStyleSheet(const nsAString& aURL)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::EnableStyleSheet(const nsAString& aURL,
|
||||
bool aEnable)
|
||||
HTMLEditor::EnableStyleSheet(const nsAString& aURL, bool aEnable)
|
||||
{
|
||||
RefPtr<StyleSheet> sheet = GetStyleSheetForURL(aURL);
|
||||
NS_ENSURE_TRUE(sheet, NS_OK); // Don't fail if sheet not found
|
||||
|
@ -3466,37 +3395,6 @@ HTMLEditor::DebugUnitTests(int32_t* outNumTests,
|
|||
#endif
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
HTMLEditor::StyleSheetLoaded(StyleSheet* aSheet,
|
||||
bool aWasDeferred,
|
||||
nsresult aStatus)
|
||||
{
|
||||
AutoPlaceholderBatch batchIt(this);
|
||||
|
||||
if (!mLastStyleSheetURL.IsEmpty()) {
|
||||
RemoveStyleSheetWithTransaction(mLastStyleSheetURL);
|
||||
}
|
||||
|
||||
RefPtr<AddStyleSheetTransaction> transaction =
|
||||
AddStyleSheetTransaction::Create(*this, *aSheet);
|
||||
nsresult rv = DoTransaction(transaction);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Get the URI, then url spec from the sheet
|
||||
nsAutoCString spec;
|
||||
rv = aSheet->GetSheetURI()->GetSpec(spec);
|
||||
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
// Save it so we can remove before applying the next one
|
||||
CopyASCIItoUTF16(spec, mLastStyleSheetURL);
|
||||
|
||||
// Also save in our arrays of urls and sheets
|
||||
AddNewStyleSheetToList(mLastStyleSheetURL, aSheet);
|
||||
}
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
HTMLEditor::OnStartToHandleTopLevelEditSubAction(
|
||||
EditSubAction aEditSubAction,
|
||||
|
|
|
@ -70,7 +70,6 @@ class HTMLEditor final : public TextEditor
|
|||
, public nsITableEditor
|
||||
, public nsIHTMLInlineTableEditor
|
||||
, public nsIEditorStyleSheets
|
||||
, public nsICSSLoaderObserver
|
||||
, public nsStubMutationObserver
|
||||
{
|
||||
public:
|
||||
|
@ -116,10 +115,6 @@ public:
|
|||
// nsISelectionListener overrides
|
||||
NS_DECL_NSISELECTIONLISTENER
|
||||
|
||||
// nsICSSLoaderObserver
|
||||
NS_IMETHOD StyleSheetLoaded(StyleSheet* aSheet,
|
||||
bool aWasAlternate, nsresult aStatus) override;
|
||||
|
||||
HTMLEditor();
|
||||
|
||||
nsHTMLDocument* GetHTMLDocument() const;
|
||||
|
@ -782,12 +777,6 @@ protected: // Shouldn't be used by friend classes
|
|||
*/
|
||||
nsresult InsertBrElementAtSelectionWithTransaction();
|
||||
|
||||
/**
|
||||
* RemoveStyleSheetWithTransaction() removes the given URL stylesheet
|
||||
* from mStyleSheets and mStyleSheetURLs.
|
||||
*/
|
||||
nsresult RemoveStyleSheetWithTransaction(const nsAString& aURL);
|
||||
|
||||
nsresult LoadHTML(const nsAString& aInputString);
|
||||
|
||||
nsresult GetCSSBackgroundColorState(bool* aMixed, nsAString& aOutColor,
|
||||
|
|
|
@ -1,115 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#include "StyleSheetTransactions.h"
|
||||
|
||||
#include <stddef.h> // for nullptr
|
||||
|
||||
#include "nsAString.h"
|
||||
#include "nsCOMPtr.h" // for nsCOMPtr, do_QueryInterface, etc.
|
||||
#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
|
||||
#include "mozilla/StyleSheetInlines.h"
|
||||
#include "nsDebug.h" // for NS_ENSURE_TRUE
|
||||
#include "nsError.h" // for NS_OK, etc.
|
||||
#include "nsIDocument.h" // for nsIDocument
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
static void
|
||||
AddStyleSheet(EditorBase& aEditor, StyleSheet* aSheet)
|
||||
{
|
||||
if (nsCOMPtr<nsIDocument> doc = aEditor.GetDocument()) {
|
||||
doc->AddStyleSheet(aSheet);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
RemoveStyleSheet(EditorBase& aEditor, StyleSheet* aSheet)
|
||||
{
|
||||
if (nsCOMPtr<nsIDocument> doc = aEditor.GetDocument()) {
|
||||
doc->RemoveStyleSheet(aSheet);
|
||||
}
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* AddStyleSheetTransaction
|
||||
******************************************************************************/
|
||||
|
||||
AddStyleSheetTransaction::AddStyleSheetTransaction(EditorBase& aEditorBase,
|
||||
StyleSheet& aStyleSheet)
|
||||
: mEditorBase(&aEditorBase)
|
||||
, mSheet(&aStyleSheet)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(AddStyleSheetTransaction,
|
||||
EditTransactionBase,
|
||||
mEditorBase,
|
||||
mSheet)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(AddStyleSheetTransaction)
|
||||
NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddStyleSheetTransaction::DoTransaction()
|
||||
{
|
||||
if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mSheet)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
AddStyleSheet(*mEditorBase, mSheet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AddStyleSheetTransaction::UndoTransaction()
|
||||
{
|
||||
if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mSheet)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
RemoveStyleSheet(*mEditorBase, mSheet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* RemoveStyleSheetTransaction
|
||||
******************************************************************************/
|
||||
|
||||
RemoveStyleSheetTransaction::RemoveStyleSheetTransaction(
|
||||
EditorBase& aEditorBase,
|
||||
StyleSheet& aStyleSheet)
|
||||
: mEditorBase(&aEditorBase)
|
||||
, mSheet(&aStyleSheet)
|
||||
{
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED(RemoveStyleSheetTransaction,
|
||||
EditTransactionBase,
|
||||
mEditorBase,
|
||||
mSheet)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(RemoveStyleSheetTransaction)
|
||||
NS_INTERFACE_MAP_END_INHERITING(EditTransactionBase)
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoveStyleSheetTransaction::DoTransaction()
|
||||
{
|
||||
if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mSheet)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
RemoveStyleSheet(*mEditorBase, mSheet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
RemoveStyleSheetTransaction::UndoTransaction()
|
||||
{
|
||||
if (NS_WARN_IF(!mEditorBase) || NS_WARN_IF(!mSheet)) {
|
||||
return NS_ERROR_NOT_INITIALIZED;
|
||||
}
|
||||
AddStyleSheet(*mEditorBase, mSheet);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
|
@ -1,87 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* 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/. */
|
||||
|
||||
#ifndef StylesheetTransactions_h
|
||||
#define StylesheetTransactions_h
|
||||
|
||||
#include "mozilla/EditorBase.h" // mEditor
|
||||
#include "mozilla/EditTransactionBase.h" // for EditTransactionBase, etc.
|
||||
#include "mozilla/StyleSheet.h" // for mozilla::StyleSheet
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsID.h" // for REFNSIID
|
||||
#include "nscore.h" // for NS_IMETHOD
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class AddStyleSheetTransaction final : public EditTransactionBase
|
||||
{
|
||||
protected:
|
||||
AddStyleSheetTransaction(EditorBase& aEditor, StyleSheet& aStyleSheet);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates an add style sheet transaction. This never returns nullptr.
|
||||
*
|
||||
* @param aEditorBase The editor.
|
||||
* @param aSheet The style sheet to add.
|
||||
*/
|
||||
static already_AddRefed<AddStyleSheetTransaction>
|
||||
Create(EditorBase& aEditorBase, StyleSheet& aStyleSheet)
|
||||
{
|
||||
RefPtr<AddStyleSheetTransaction> transaction =
|
||||
new AddStyleSheetTransaction(aEditorBase, aStyleSheet);
|
||||
return transaction.forget();
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(AddStyleSheetTransaction,
|
||||
EditTransactionBase)
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
|
||||
|
||||
NS_DECL_EDITTRANSACTIONBASE
|
||||
|
||||
protected:
|
||||
// The editor that created this transaction.
|
||||
RefPtr<EditorBase> mEditorBase;
|
||||
// The style sheet to add.
|
||||
RefPtr<mozilla::StyleSheet> mSheet;
|
||||
};
|
||||
|
||||
|
||||
class RemoveStyleSheetTransaction final : public EditTransactionBase
|
||||
{
|
||||
protected:
|
||||
RemoveStyleSheetTransaction(EditorBase& aEditor, StyleSheet& aStyleSheet);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Creates a remove style sheet transaction. This never returns nullptr.
|
||||
*
|
||||
* @param aEditor The object providing core editing operations.
|
||||
* @param aSheet The stylesheet to remove.
|
||||
*/
|
||||
static already_AddRefed<RemoveStyleSheetTransaction>
|
||||
Create(EditorBase& aEditorBase, StyleSheet& aStyleSheet)
|
||||
{
|
||||
RefPtr<RemoveStyleSheetTransaction> transaction =
|
||||
new RemoveStyleSheetTransaction(aEditorBase, aStyleSheet);
|
||||
return transaction.forget();
|
||||
}
|
||||
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(RemoveStyleSheetTransaction,
|
||||
EditTransactionBase)
|
||||
NS_IMETHOD QueryInterface(REFNSIID aIID, void** aInstancePtr) override;
|
||||
|
||||
NS_DECL_EDITTRANSACTIONBASE
|
||||
|
||||
protected:
|
||||
// The editor that created this transaction.
|
||||
RefPtr<EditorBase> mEditorBase;
|
||||
// The style sheet to remove.
|
||||
RefPtr<StyleSheet> mSheet;
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // #ifndef StylesheetTransactions_h
|
|
@ -69,7 +69,6 @@ UNIFIED_SOURCES += [
|
|||
'PlaceholderTransaction.cpp',
|
||||
'SelectionState.cpp',
|
||||
'SplitNodeTransaction.cpp',
|
||||
'StyleSheetTransactions.cpp',
|
||||
'TextEditor.cpp',
|
||||
'TextEditorDataTransfer.cpp',
|
||||
'TextEditorTest.cpp',
|
||||
|
|
|
@ -56,7 +56,6 @@ skip-if = toolkit == 'android'
|
|||
[test_bug455992.html]
|
||||
[test_bug456244.html]
|
||||
[test_bug460740.html]
|
||||
[test_bug468353.html]
|
||||
[test_bug471319.html]
|
||||
[test_bug471722.html]
|
||||
[test_bug478725.html]
|
||||
|
|
|
@ -1,117 +0,0 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=468353
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 468353</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=468353">Mozilla Bug 468353</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
var styleSheets = null;
|
||||
|
||||
function checkStylesheets() {
|
||||
// Evidently RemoveStyleSheet is the only method in nsIEditorStyleSheets
|
||||
// that would throw. RemoveOverrideStyleSheet returns NS_OK even if the
|
||||
// sheet is not there
|
||||
var removed = 0;
|
||||
try
|
||||
{
|
||||
styleSheets.removeStyleSheet("resource://gre/res/designmode.css");
|
||||
removed++;
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
try {
|
||||
styleSheets.removeStyleSheet("resource://gre/res/contenteditable.css");
|
||||
removed++;
|
||||
}
|
||||
catch (ex) { }
|
||||
|
||||
is(removed, 0, "Should have thrown if stylesheet was not there");
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
const Ci = SpecialPowers.Ci;
|
||||
|
||||
/** Found while fixing bug 440614 **/
|
||||
var editframe = window.frames[0];
|
||||
var editdoc = editframe.document;
|
||||
var editor = null;
|
||||
editdoc.write('');
|
||||
editdoc.close();
|
||||
|
||||
editdoc.designMode='on';
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
.getEditorForWindow(editframe);
|
||||
|
||||
styleSheets = editor.QueryInterface(Ci.nsIEditorStyleSheets);
|
||||
|
||||
editdoc.designMode='off';
|
||||
|
||||
checkStylesheets();
|
||||
|
||||
// Let go
|
||||
editor = null;
|
||||
styleSheets = null;
|
||||
|
||||
editdoc.body.contentEditable = true;
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
.getEditorForWindow(editframe);
|
||||
|
||||
styleSheets = editor.QueryInterface(Ci.nsIEditorStyleSheets);
|
||||
|
||||
editdoc.body.contentEditable = false;
|
||||
|
||||
checkStylesheets();
|
||||
|
||||
editdoc.designMode = "on";
|
||||
editdoc.body.contentEditable = true;
|
||||
editdoc.designMode = "off";
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
.getEditorForWindow(editframe);
|
||||
|
||||
styleSheets = editor.QueryInterface(Ci.nsIEditorStyleSheets);
|
||||
|
||||
editdoc.body.contentEditable = false;
|
||||
|
||||
checkStylesheets();
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
//XXX I don't know if this is necessary, but we're dealing with iframes...
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(runTest);
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
|
@ -9,22 +9,6 @@
|
|||
|
||||
interface nsIEditorStyleSheets : nsISupports
|
||||
{
|
||||
/** Load and apply the style sheet, specified by aURL, to the
|
||||
* editor's document, replacing the last style sheet added (if any).
|
||||
* This is always asynchronous, and may cause network I/O.
|
||||
*
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
*/
|
||||
void replaceStyleSheet(in AString aURL);
|
||||
|
||||
/** Add the given style sheet to the editor's document,
|
||||
* on top of any that are already there.
|
||||
* This is always asynchronous, and may cause network I/O.
|
||||
*
|
||||
* @param aURL The style sheet to be loaded and applied.
|
||||
*/
|
||||
void addStyleSheet(in AString aURL);
|
||||
|
||||
/** Load and apply the override style sheet, specified by aURL, to the
|
||||
* editor's document, replacing the last override style sheet added (if any).
|
||||
* This is always synchronous, so aURL should be a local file with only
|
||||
|
@ -47,13 +31,6 @@ interface nsIEditorStyleSheets : nsISupports
|
|||
*/
|
||||
void addOverrideStyleSheet(in AString aURL);
|
||||
|
||||
/** Remove the given style sheet from the editor's document
|
||||
* This is always synchronous
|
||||
*
|
||||
* @param aURL The style sheet to be removed
|
||||
*/
|
||||
void removeStyleSheet(in AString aURL);
|
||||
|
||||
/** Remove the given override style sheet from the editor's document
|
||||
* This is always synchronous
|
||||
*
|
||||
|
|
|
@ -649,7 +649,7 @@ BackgroundAllocTask::BackgroundAllocTask(JSRuntime* rt, ChunkPool& pool)
|
|||
{
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
void
|
||||
BackgroundAllocTask::run()
|
||||
{
|
||||
TraceLoggerThread* logger = TraceLoggerForCurrentThread();
|
||||
|
|
251
js/src/gc/GC.cpp
251
js/src/gc/GC.cpp
|
@ -937,9 +937,7 @@ void
|
|||
GCRuntime::releaseArena(Arena* arena, const AutoLockGC& lock)
|
||||
{
|
||||
arena->zone->usage.removeGCArena();
|
||||
if (isBackgroundSweeping())
|
||||
arena->zone->threshold.updateForRemovedArena(tunables);
|
||||
return arena->chunk()->releaseArena(rt, arena, lock);
|
||||
arena->chunk()->releaseArena(rt, arena, lock);
|
||||
}
|
||||
|
||||
GCRuntime::GCRuntime(JSRuntime* rt) :
|
||||
|
@ -1004,8 +1002,8 @@ GCRuntime::GCRuntime(JSRuntime* rt) :
|
|||
#endif
|
||||
lock(mutexid::GCLock),
|
||||
allocTask(rt, emptyChunks_.ref()),
|
||||
sweepTask(rt),
|
||||
decommitTask(rt),
|
||||
helperState(rt),
|
||||
nursery_(rt),
|
||||
storeBuffer_(rt, nursery()),
|
||||
blocksToFreeAfterMinorGC((size_t) JSContext::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE)
|
||||
|
@ -1325,7 +1323,7 @@ GCRuntime::finish()
|
|||
* helper thread shuts down before we forcefully release any remaining GC
|
||||
* memory.
|
||||
*/
|
||||
helperState.finish();
|
||||
sweepTask.join();
|
||||
allocTask.cancelAndWait();
|
||||
decommitTask.cancelAndWait();
|
||||
|
||||
|
@ -2747,7 +2745,7 @@ UpdatePointersTask::updateArenas()
|
|||
UpdateArenaPointers(&trc, arena);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
void
|
||||
UpdatePointersTask::run()
|
||||
{
|
||||
// These checks assert when run in parallel.
|
||||
|
@ -3000,7 +2998,10 @@ GCRuntime::updateRuntimePointersToRelocatedCells(AutoGCSession& session)
|
|||
cache->sweep();
|
||||
|
||||
// Type inference may put more blocks here to free.
|
||||
blocksToFreeAfterSweeping.ref().freeAll();
|
||||
{
|
||||
AutoLockHelperThreadState lock;
|
||||
blocksToFreeAfterSweeping.ref().freeAll();
|
||||
}
|
||||
|
||||
// Call callbacks to get the rest of the system to fixup other untraced pointers.
|
||||
callWeakPointerZonesCallbacks();
|
||||
|
@ -3519,7 +3520,7 @@ js::gc::BackgroundDecommitTask::setChunksToScan(ChunkVector &chunks)
|
|||
Swap(toDecommit.ref(), chunks);
|
||||
}
|
||||
|
||||
/* virtual */ void
|
||||
void
|
||||
js::gc::BackgroundDecommitTask::run()
|
||||
{
|
||||
AutoLockGC lock(runtime());
|
||||
|
@ -3584,6 +3585,11 @@ GCRuntime::sweepBackgroundThings(ZoneList& zones, LifoAlloc& freeBlocks)
|
|||
Arena* next;
|
||||
for (Arena* arena = emptyArenas; arena; arena = next) {
|
||||
next = arena->next;
|
||||
|
||||
// We already calculated the zone's GC trigger after foreground
|
||||
// sweeping finished. Now we must update this value.
|
||||
arena->zone->threshold.updateForRemovedArena(tunables);
|
||||
|
||||
rt->gc.releaseArena(arena, lock);
|
||||
releaseCount++;
|
||||
if (releaseCount % LockReleasePeriod == 0) {
|
||||
|
@ -3598,115 +3604,35 @@ void
|
|||
GCRuntime::assertBackgroundSweepingFinished()
|
||||
{
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(backgroundSweepZones.ref().isEmpty());
|
||||
{
|
||||
AutoLockHelperThreadState lock;
|
||||
MOZ_ASSERT(backgroundSweepZones.ref().isEmpty());
|
||||
MOZ_ASSERT(blocksToFreeAfterSweeping.ref().computedSizeOfExcludingThis() == 0);
|
||||
}
|
||||
|
||||
for (ZonesIter zone(rt, WithAtoms); !zone.done(); zone.next()) {
|
||||
for (auto i : AllAllocKinds()) {
|
||||
MOZ_ASSERT(!zone->arenas.arenaListsToSweep(i));
|
||||
MOZ_ASSERT(zone->arenas.doneBackgroundFinalize(i));
|
||||
}
|
||||
}
|
||||
MOZ_ASSERT(blocksToFreeAfterSweeping.ref().computedSizeOfExcludingThis() == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::finish()
|
||||
{
|
||||
// Wait for any lingering background sweeping to finish.
|
||||
waitBackgroundSweepEnd();
|
||||
}
|
||||
|
||||
GCHelperState::State
|
||||
GCHelperState::state(const AutoLockGC&)
|
||||
{
|
||||
return state_;
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::setState(State state, const AutoLockGC&)
|
||||
{
|
||||
state_ = state;
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::startBackgroundThread(State newState, const AutoLockGC& lock,
|
||||
const AutoLockHelperThreadState& helperLock)
|
||||
{
|
||||
MOZ_ASSERT(!hasThread && state(lock) == IDLE && newState != IDLE);
|
||||
setState(newState, lock);
|
||||
|
||||
{
|
||||
AutoEnterOOMUnsafeRegion noOOM;
|
||||
if (!HelperThreadState().gcHelperWorklist(helperLock).append(this))
|
||||
noOOM.crash("Could not add to pending GC helpers list");
|
||||
}
|
||||
|
||||
HelperThreadState().notifyAll(GlobalHelperThreadState::PRODUCER, helperLock);
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::waitForBackgroundThread(js::AutoLockGC& lock)
|
||||
{
|
||||
while (isBackgroundSweeping())
|
||||
done.wait(lock.guard());
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::work()
|
||||
{
|
||||
MOZ_ASSERT(CanUseExtraThreads());
|
||||
|
||||
AutoLockGC lock(rt);
|
||||
|
||||
MOZ_ASSERT(!hasThread);
|
||||
hasThread = true;
|
||||
|
||||
#ifdef DEBUG
|
||||
MOZ_ASSERT(!TlsContext.get()->gcHelperStateThread);
|
||||
TlsContext.get()->gcHelperStateThread = true;
|
||||
#endif
|
||||
|
||||
TraceLoggerThread* logger = TraceLoggerForCurrentThread();
|
||||
|
||||
switch (state(lock)) {
|
||||
|
||||
case IDLE:
|
||||
MOZ_CRASH("GC helper triggered on idle state");
|
||||
break;
|
||||
|
||||
case SWEEPING: {
|
||||
AutoTraceLog logSweeping(logger, TraceLogger_GCSweeping);
|
||||
doSweep(lock);
|
||||
MOZ_ASSERT(state(lock) == SWEEPING);
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
setState(IDLE, lock);
|
||||
hasThread = false;
|
||||
|
||||
#ifdef DEBUG
|
||||
TlsContext.get()->gcHelperStateThread = false;
|
||||
#endif
|
||||
|
||||
done.notify_all();
|
||||
}
|
||||
|
||||
void
|
||||
GCRuntime::queueZonesForBackgroundSweep(ZoneList& zones)
|
||||
{
|
||||
AutoLockHelperThreadState helperLock;
|
||||
AutoLockGC lock(rt);
|
||||
AutoLockHelperThreadState lock;
|
||||
backgroundSweepZones.ref().transferFrom(zones);
|
||||
helperState.maybeStartBackgroundSweep(lock, helperLock);
|
||||
if (sweepOnBackgroundThread)
|
||||
sweepTask.startIfIdle(lock);
|
||||
}
|
||||
|
||||
void
|
||||
GCRuntime::freeUnusedLifoBlocksAfterSweeping(LifoAlloc* lifo)
|
||||
{
|
||||
MOZ_ASSERT(JS::RuntimeHeapIsBusy());
|
||||
AutoLockGC lock(rt);
|
||||
AutoLockHelperThreadState lock;
|
||||
blocksToFreeAfterSweeping.ref().transferUnusedFrom(lifo);
|
||||
}
|
||||
|
||||
|
@ -3714,7 +3640,7 @@ void
|
|||
GCRuntime::freeAllLifoBlocksAfterSweeping(LifoAlloc* lifo)
|
||||
{
|
||||
MOZ_ASSERT(JS::RuntimeHeapIsBusy());
|
||||
AutoLockGC lock(rt);
|
||||
AutoLockHelperThreadState lock;
|
||||
blocksToFreeAfterSweeping.ref().transferFrom(lifo);
|
||||
}
|
||||
|
||||
|
@ -3724,57 +3650,92 @@ GCRuntime::freeAllLifoBlocksAfterMinorGC(LifoAlloc* lifo)
|
|||
blocksToFreeAfterMinorGC.ref().transferFrom(lifo);
|
||||
}
|
||||
|
||||
BackgroundSweepTask::BackgroundSweepTask(JSRuntime* rt)
|
||||
: GCParallelTaskHelper(rt),
|
||||
done(false)
|
||||
{}
|
||||
|
||||
inline bool
|
||||
BackgroundSweepTask::isRunning() const
|
||||
{
|
||||
AutoLockHelperThreadState lock;
|
||||
return isRunningWithLockHeld(lock);
|
||||
}
|
||||
|
||||
inline bool
|
||||
BackgroundSweepTask::isRunningWithLockHeld(const AutoLockHelperThreadState& lock) const
|
||||
{
|
||||
return Base::isRunningWithLockHeld(lock) && !done;
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::maybeStartBackgroundSweep(const AutoLockGC& lock,
|
||||
const AutoLockHelperThreadState& helperLock)
|
||||
BackgroundSweepTask::startIfIdle(AutoLockHelperThreadState& lock)
|
||||
{
|
||||
MOZ_ASSERT(CanUseExtraThreads());
|
||||
|
||||
if (state(lock) == IDLE)
|
||||
startBackgroundThread(SWEEPING, lock, helperLock);
|
||||
if (isRunningWithLockHeld(lock))
|
||||
return;
|
||||
|
||||
// Join the previous invocation of the task. This will return immediately
|
||||
// if the thread has never been started.
|
||||
joinWithLockHeld(lock);
|
||||
|
||||
done = false;
|
||||
startWithLockHeld(lock);
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::waitBackgroundSweepEnd()
|
||||
BackgroundSweepTask::runFromMainThread(JSRuntime* rt)
|
||||
{
|
||||
AutoLockGC lock(rt);
|
||||
while (state(lock) == SWEEPING)
|
||||
waitForBackgroundThread(lock);
|
||||
{
|
||||
AutoLockHelperThreadState lock;
|
||||
MOZ_ASSERT(!isRunningWithLockHeld(lock));
|
||||
joinWithLockHeld(lock);
|
||||
done = false;
|
||||
}
|
||||
|
||||
Base::runFromMainThread(rt);
|
||||
}
|
||||
|
||||
void
|
||||
BackgroundSweepTask::run()
|
||||
{
|
||||
AutoTraceLog logSweeping(TraceLoggerForCurrentThread(), TraceLogger_GCSweeping);
|
||||
|
||||
AutoLockHelperThreadState lock;
|
||||
AutoSetThreadIsSweeping threadIsSweeping;
|
||||
|
||||
MOZ_ASSERT(!done);
|
||||
|
||||
JSRuntime* rt = runtime();
|
||||
|
||||
// The main thread may call queueZonesForBackgroundSweep() while this is
|
||||
// running so we must check there is no more work after releasing the lock.
|
||||
do {
|
||||
ZoneList zones;
|
||||
zones.transferFrom(rt->gc.backgroundSweepZones.ref());
|
||||
LifoAlloc freeLifoAlloc(JSContext::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
|
||||
freeLifoAlloc.transferFrom(&rt->gc.blocksToFreeAfterSweeping.ref());
|
||||
|
||||
AutoUnlockHelperThreadState unlock(lock);
|
||||
rt->gc.sweepBackgroundThings(zones, freeLifoAlloc);
|
||||
} while (!rt->gc.backgroundSweepZones.ref().isEmpty());
|
||||
|
||||
// Signal to the main thread that we're finished, because we release the
|
||||
// lock again before GCParallelTask's state is changed to finished.
|
||||
done = true;
|
||||
}
|
||||
|
||||
void
|
||||
GCRuntime::waitBackgroundSweepEnd()
|
||||
{
|
||||
sweepTask.join();
|
||||
|
||||
// TODO: Improve assertion to work in incremental GC?
|
||||
if (!rt->gc.isIncrementalGCInProgress())
|
||||
rt->gc.assertBackgroundSweepingFinished();
|
||||
}
|
||||
|
||||
void
|
||||
GCHelperState::doSweep(AutoLockGC& lock)
|
||||
{
|
||||
// The main thread may call queueZonesForBackgroundSweep() while this is
|
||||
// running so we must check there is no more work to do before exiting.
|
||||
|
||||
do {
|
||||
while (!rt->gc.backgroundSweepZones.ref().isEmpty()) {
|
||||
AutoSetThreadIsSweeping threadIsSweeping;
|
||||
|
||||
ZoneList zones;
|
||||
zones.transferFrom(rt->gc.backgroundSweepZones.ref());
|
||||
LifoAlloc freeLifoAlloc(JSContext::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
|
||||
freeLifoAlloc.transferFrom(&rt->gc.blocksToFreeAfterSweeping.ref());
|
||||
|
||||
AutoUnlockGC unlock(lock);
|
||||
rt->gc.sweepBackgroundThings(zones, freeLifoAlloc);
|
||||
}
|
||||
} while (!rt->gc.backgroundSweepZones.ref().isEmpty());
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
|
||||
bool
|
||||
GCHelperState::onBackgroundThread()
|
||||
{
|
||||
return TlsContext.get()->gcHelperStateThread;
|
||||
}
|
||||
|
||||
#endif // DEBUG
|
||||
|
||||
bool
|
||||
GCRuntime::shouldReleaseObservedTypes()
|
||||
{
|
||||
|
@ -5872,10 +5833,10 @@ GCRuntime::endSweepingSweepGroup(FreeOp* fop, SliceBudget& budget)
|
|||
if (sweepAtomsZone)
|
||||
zones.append(atomsZone);
|
||||
|
||||
if (sweepOnBackgroundThread)
|
||||
queueZonesForBackgroundSweep(zones);
|
||||
else
|
||||
sweepBackgroundThings(zones, blocksToFreeAfterSweeping.ref());
|
||||
queueZonesForBackgroundSweep(zones);
|
||||
|
||||
if (!sweepOnBackgroundThread)
|
||||
sweepTask.runFromMainThread(rt);
|
||||
|
||||
return Finished;
|
||||
}
|
||||
|
@ -6921,7 +6882,10 @@ GCRuntime::resetIncrementalGC(gc::AbortReason reason, AutoGCSession& session)
|
|||
zone->arenas.unmarkPreMarkedFreeCells();
|
||||
}
|
||||
|
||||
blocksToFreeAfterSweeping.ref().freeAll();
|
||||
{
|
||||
AutoLockHelperThreadState lock;
|
||||
blocksToFreeAfterSweeping.ref().freeAll();
|
||||
}
|
||||
|
||||
incrementalState = State::NotActive;
|
||||
|
||||
|
@ -7215,7 +7179,6 @@ GCRuntime::incrementalCollectSlice(SliceBudget& budget, JS::gcreason::Reason rea
|
|||
// Yield until background finalization is done.
|
||||
if (!budget.isUnlimited()) {
|
||||
// Poll for end of background sweeping
|
||||
AutoLockGC lock(rt);
|
||||
if (isBackgroundSweeping())
|
||||
break;
|
||||
} else {
|
||||
|
|
|
@ -1,103 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
||||
* 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/. */
|
||||
|
||||
#ifndef gc_GCHelperState_h
|
||||
#define gc_GCHelperState_h
|
||||
|
||||
#include "js/TypeDecls.h"
|
||||
#include "threading/ConditionVariable.h"
|
||||
#include "threading/ProtectedData.h"
|
||||
|
||||
namespace js {
|
||||
class AutoLockHelperThreadState;
|
||||
|
||||
namespace gc {
|
||||
class ArenaLists;
|
||||
} /* namespace gc */
|
||||
|
||||
/*
|
||||
* Helper state for use when JS helper threads sweep and allocate GC thing kinds
|
||||
* that can be swept and allocated off thread.
|
||||
*
|
||||
* In non-threadsafe builds, all actual sweeping and allocation is performed
|
||||
* on the main thread, but GCHelperState encapsulates this from clients as
|
||||
* much as possible.
|
||||
*/
|
||||
class GCHelperState
|
||||
{
|
||||
enum State {
|
||||
IDLE,
|
||||
SWEEPING
|
||||
};
|
||||
|
||||
// Associated runtime.
|
||||
JSRuntime* const rt;
|
||||
|
||||
// Condvar for notifying the main thread when work has finished. This is
|
||||
// associated with the runtime's GC lock --- the worker thread state
|
||||
// condvars can't be used here due to lock ordering issues.
|
||||
ConditionVariable done;
|
||||
|
||||
// Activity for the helper to do, protected by the GC lock.
|
||||
MainThreadOrGCTaskData<State> state_;
|
||||
|
||||
// Whether work is being performed on some thread.
|
||||
GCLockData<bool> hasThread;
|
||||
|
||||
void startBackgroundThread(State newState, const AutoLockGC& lock,
|
||||
const AutoLockHelperThreadState& helperLock);
|
||||
void waitForBackgroundThread(js::AutoLockGC& lock);
|
||||
|
||||
State state(const AutoLockGC&);
|
||||
void setState(State state, const AutoLockGC&);
|
||||
|
||||
friend class js::gc::ArenaLists;
|
||||
|
||||
static void freeElementsAndArray(void** array, void** end) {
|
||||
MOZ_ASSERT(array <= end);
|
||||
for (void** p = array; p != end; ++p)
|
||||
js_free(*p);
|
||||
js_free(array);
|
||||
}
|
||||
|
||||
void doSweep(AutoLockGC& lock);
|
||||
|
||||
public:
|
||||
explicit GCHelperState(JSRuntime* rt)
|
||||
: rt(rt),
|
||||
done(),
|
||||
state_(IDLE)
|
||||
{ }
|
||||
|
||||
JSRuntime* runtime() { return rt; }
|
||||
|
||||
void finish();
|
||||
|
||||
void work();
|
||||
|
||||
void maybeStartBackgroundSweep(const AutoLockGC& lock,
|
||||
const AutoLockHelperThreadState& helperLock);
|
||||
void startBackgroundShrink(const AutoLockGC& lock);
|
||||
|
||||
/* Must be called without the GC lock taken. */
|
||||
void waitBackgroundSweepEnd();
|
||||
|
||||
#ifdef DEBUG
|
||||
bool onBackgroundThread();
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Outside the GC lock may give true answer when in fact the sweeping has
|
||||
* been done.
|
||||
*/
|
||||
bool isBackgroundSweeping() const {
|
||||
return state_ == SWEEPING;
|
||||
}
|
||||
};
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#endif /* gc_GCHelperState_h */
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
namespace js {
|
||||
|
||||
class AutoLockHelperThreadState;
|
||||
|
||||
// A generic task used to dispatch work to the helper thread system.
|
||||
// Users supply a function pointer to call.
|
||||
//
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
|
||||
#include "gc/ArenaList.h"
|
||||
#include "gc/AtomMarking.h"
|
||||
#include "gc/GCHelperState.h"
|
||||
#include "gc/GCMarker.h"
|
||||
#include "gc/GCParallelTask.h"
|
||||
#include "gc/Nursery.h"
|
||||
|
@ -106,6 +105,24 @@ class ChunkPool
|
|||
};
|
||||
};
|
||||
|
||||
class BackgroundSweepTask : public GCParallelTaskHelper<BackgroundSweepTask>
|
||||
{
|
||||
using Base = GCParallelTaskHelper<BackgroundSweepTask>;
|
||||
|
||||
HelperThreadLockData<bool> done;
|
||||
|
||||
public:
|
||||
explicit BackgroundSweepTask(JSRuntime* rt);
|
||||
|
||||
bool isRunning() const;
|
||||
bool isRunningWithLockHeld(const AutoLockHelperThreadState& lock) const;
|
||||
|
||||
void startIfIdle(AutoLockHelperThreadState& lock);
|
||||
void runFromMainThread(JSRuntime* rt);
|
||||
|
||||
void run();
|
||||
};
|
||||
|
||||
// Performs extra allocation off thread so that when memory is required on the
|
||||
// main thread it will already be available and waiting.
|
||||
class BackgroundAllocTask : public GCParallelTaskHelper<BackgroundAllocTask>
|
||||
|
@ -314,17 +331,15 @@ class GCRuntime
|
|||
State state() const { return incrementalState; }
|
||||
bool isHeapCompacting() const { return state() == State::Compact; }
|
||||
bool isForegroundSweeping() const { return state() == State::Sweep; }
|
||||
bool isBackgroundSweeping() { return helperState.isBackgroundSweeping(); }
|
||||
void waitBackgroundSweepEnd() { helperState.waitBackgroundSweepEnd(); }
|
||||
bool isBackgroundSweeping() {
|
||||
return sweepTask.isRunning();
|
||||
}
|
||||
void waitBackgroundSweepEnd();
|
||||
void waitBackgroundSweepOrAllocEnd() {
|
||||
helperState.waitBackgroundSweepEnd();
|
||||
waitBackgroundSweepEnd();
|
||||
allocTask.cancelAndWait();
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool onBackgroundThread() { return helperState.onBackgroundThread(); }
|
||||
#endif // DEBUG
|
||||
|
||||
void lockGC() {
|
||||
lock.lock();
|
||||
}
|
||||
|
@ -613,6 +628,7 @@ class GCRuntime
|
|||
void decommitAllWithoutUnlocking(const AutoLockGC& lock);
|
||||
void startDecommit();
|
||||
void queueZonesForBackgroundSweep(ZoneList& zones);
|
||||
void maybeStartBackgroundSweep(AutoLockHelperThreadState& lock);
|
||||
void sweepBackgroundThings(ZoneList& zones, LifoAlloc& freeBlocks);
|
||||
void assertBackgroundSweepingFinished();
|
||||
bool shouldCompact();
|
||||
|
@ -818,15 +834,14 @@ class GCRuntime
|
|||
MainThreadData<bool> releaseObservedTypes;
|
||||
|
||||
/* Singly linked list of zones to be swept in the background. */
|
||||
MainThreadOrGCTaskData<ZoneList> backgroundSweepZones;
|
||||
HelperThreadLockData<ZoneList> backgroundSweepZones;
|
||||
|
||||
/*
|
||||
* Free LIFO blocks are transferred to this allocator before being freed on
|
||||
* the background GC thread after sweeping.
|
||||
*/
|
||||
MainThreadOrGCTaskData<LifoAlloc> blocksToFreeAfterSweeping;
|
||||
HelperThreadLockData<LifoAlloc> blocksToFreeAfterSweeping;
|
||||
|
||||
private:
|
||||
/* Index of current sweep group (for stats). */
|
||||
MainThreadData<unsigned> sweepGroupIndex;
|
||||
|
||||
|
@ -951,10 +966,11 @@ class GCRuntime
|
|||
friend class js::AutoLockGCBgAlloc;
|
||||
js::Mutex lock;
|
||||
|
||||
BackgroundAllocTask allocTask;
|
||||
BackgroundDecommitTask decommitTask;
|
||||
friend class BackgroundSweepTask;
|
||||
|
||||
js::GCHelperState helperState;
|
||||
BackgroundAllocTask allocTask;
|
||||
BackgroundSweepTask sweepTask;
|
||||
BackgroundDecommitTask decommitTask;
|
||||
|
||||
/*
|
||||
* During incremental sweeping, this field temporarily holds the arenas of
|
||||
|
@ -990,7 +1006,6 @@ class GCRuntime
|
|||
}
|
||||
void freeAllLifoBlocksAfterMinorGC(LifoAlloc* lifo);
|
||||
|
||||
friend class js::GCHelperState;
|
||||
friend class MarkingValidator;
|
||||
friend class AutoEnterIteration;
|
||||
};
|
||||
|
|
|
@ -269,8 +269,7 @@ js::CheckTracedThing(JSTracer* trc, T* thing)
|
|||
* IsThingPoisoned would be racy in this case.
|
||||
*/
|
||||
MOZ_ASSERT_IF(JS::RuntimeHeapIsBusy() &&
|
||||
!zone->isGCCompacting() &&
|
||||
!rt->gc.isBackgroundSweeping(),
|
||||
!zone->isGCSweeping() && !zone->isGCFinished() && !zone->isGCCompacting(),
|
||||
!IsThingPoisoned(thing) || !InFreeList(thing->asTenured().arena(), thing));
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ component_gc = ('Core', 'JavaScript: GC')
|
|||
component_intl = ('Core', 'JavaScript: Internationalization API')
|
||||
component_jit = ('Core', 'JavaScript Engine: JIT')
|
||||
component_stl = ('Core', 'JavaScript: Standard Library')
|
||||
component_wasm = ('Core', 'Javascript: Web Assembly')
|
||||
|
||||
FILES_PER_UNIFIED_FILE = 6
|
||||
|
||||
|
@ -17,7 +18,7 @@ with Files('*'):
|
|||
BUG_COMPONENT = component_engine
|
||||
|
||||
with Files('wasm/**'):
|
||||
BUG_COMPONENT = component_jit
|
||||
BUG_COMPONENT = component_wasm
|
||||
with Files('builtin/**'):
|
||||
BUG_COMPONENT = component_stl
|
||||
with Files('ctypes/**'):
|
||||
|
|
|
@ -26,7 +26,7 @@ OnHelperThread()
|
|||
}
|
||||
|
||||
if (Helper == AllowedHelperThread::GCTask || Helper == AllowedHelperThread::GCTaskOrIonCompile) {
|
||||
if (TlsContext.get()->performingGC || TlsContext.get()->runtime()->gc.onBackgroundThread())
|
||||
if (TlsContext.get()->performingGC)
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -1213,7 +1213,6 @@ GlobalHelperThreadState::addSizeOfIncludingThis(JS::GlobalStats* stats,
|
|||
compressionPendingList_.sizeOfExcludingThis(mallocSizeOf) +
|
||||
compressionWorklist_.sizeOfExcludingThis(mallocSizeOf) +
|
||||
compressionFinishedList_.sizeOfExcludingThis(mallocSizeOf) +
|
||||
gcHelperWorklist_.sizeOfExcludingThis(mallocSizeOf) +
|
||||
gcParallelWorklist_.sizeOfExcludingThis(mallocSizeOf);
|
||||
|
||||
// Report ParseTasks on wait lists
|
||||
|
@ -1299,14 +1298,6 @@ GlobalHelperThreadState::maxCompressionThreads() const
|
|||
return 1;
|
||||
}
|
||||
|
||||
size_t
|
||||
GlobalHelperThreadState::maxGCHelperThreads() const
|
||||
{
|
||||
if (IsHelperThreadSimulatingOOM(js::THREAD_TYPE_GCHELPER))
|
||||
return 1;
|
||||
return threadCount;
|
||||
}
|
||||
|
||||
size_t
|
||||
GlobalHelperThreadState::maxGCParallelThreads() const
|
||||
{
|
||||
|
@ -1488,13 +1479,6 @@ GlobalHelperThreadState::scheduleCompressionTasks(const AutoLockHelperThreadStat
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
GlobalHelperThreadState::canStartGCHelperTask(const AutoLockHelperThreadState& lock)
|
||||
{
|
||||
return !gcHelperWorklist(lock).empty() &&
|
||||
checkTaskThreadLimit<GCHelperState*>(maxGCHelperThreads());
|
||||
}
|
||||
|
||||
bool
|
||||
GlobalHelperThreadState::canStartGCParallelTask(const AutoLockHelperThreadState& lock)
|
||||
{
|
||||
|
@ -2307,26 +2291,6 @@ GlobalHelperThreadState::trace(JSTracer* trc)
|
|||
parseTask->trace(trc);
|
||||
}
|
||||
|
||||
void
|
||||
HelperThread::handleGCHelperWorkload(AutoLockHelperThreadState& locked)
|
||||
{
|
||||
MOZ_ASSERT(HelperThreadState().canStartGCHelperTask(locked));
|
||||
MOZ_ASSERT(idle());
|
||||
|
||||
currentTask.emplace(HelperThreadState().gcHelperWorklist(locked).popCopy());
|
||||
GCHelperState* task = gcHelperTask();
|
||||
|
||||
AutoSetContextRuntime ascr(task->runtime());
|
||||
|
||||
{
|
||||
AutoUnlockHelperThreadState unlock(locked);
|
||||
task->work();
|
||||
}
|
||||
|
||||
currentTask.reset();
|
||||
HelperThreadState().notifyAll(GlobalHelperThreadState::CONSUMER, locked);
|
||||
}
|
||||
|
||||
void
|
||||
JSContext::setHelperThread(HelperThread* thread)
|
||||
{
|
||||
|
@ -2348,11 +2312,6 @@ const HelperThread::TaskSpec HelperThread::taskSpecs[] = {
|
|||
&GlobalHelperThreadState::canStartGCParallelTask,
|
||||
&HelperThread::handleGCParallelWorkload
|
||||
},
|
||||
{
|
||||
THREAD_TYPE_GCHELPER,
|
||||
&GlobalHelperThreadState::canStartGCHelperTask,
|
||||
&HelperThread::handleGCHelperWorkload
|
||||
},
|
||||
{
|
||||
THREAD_TYPE_ION,
|
||||
&GlobalHelperThreadState::canStartIonCompile,
|
||||
|
|
|
@ -96,7 +96,6 @@ class GlobalHelperThreadState
|
|||
typedef Vector<ParseTask*, 0, SystemAllocPolicy> ParseTaskVector;
|
||||
typedef mozilla::LinkedList<ParseTask> ParseTaskList;
|
||||
typedef Vector<UniquePtr<SourceCompressionTask>, 0, SystemAllocPolicy> SourceCompressionTaskVector;
|
||||
typedef Vector<GCHelperState*, 0, SystemAllocPolicy> GCHelperStateVector;
|
||||
typedef Vector<GCParallelTask*, 0, SystemAllocPolicy> GCParallelTaskVector;
|
||||
typedef Vector<PromiseHelperTask*, 0, SystemAllocPolicy> PromiseHelperTaskVector;
|
||||
|
||||
|
@ -141,9 +140,6 @@ class GlobalHelperThreadState
|
|||
// Finished source compression tasks.
|
||||
SourceCompressionTaskVector compressionFinishedList_;
|
||||
|
||||
// Runtimes which have sweeping / allocating work to do.
|
||||
GCHelperStateVector gcHelperWorklist_;
|
||||
|
||||
// GC tasks needing to be done in parallel.
|
||||
GCParallelTaskVector gcParallelWorklist_;
|
||||
|
||||
|
@ -160,7 +156,6 @@ class GlobalHelperThreadState
|
|||
size_t maxPromiseHelperThreads() const;
|
||||
size_t maxParseThreads() const;
|
||||
size_t maxCompressionThreads() const;
|
||||
size_t maxGCHelperThreads() const;
|
||||
size_t maxGCParallelThreads() const;
|
||||
|
||||
GlobalHelperThreadState();
|
||||
|
@ -263,10 +258,6 @@ class GlobalHelperThreadState
|
|||
return compressionFinishedList_;
|
||||
}
|
||||
|
||||
GCHelperStateVector& gcHelperWorklist(const AutoLockHelperThreadState&) {
|
||||
return gcHelperWorklist_;
|
||||
}
|
||||
|
||||
GCParallelTaskVector& gcParallelWorklist(const AutoLockHelperThreadState&) {
|
||||
return gcParallelWorklist_;
|
||||
}
|
||||
|
@ -281,7 +272,6 @@ class GlobalHelperThreadState
|
|||
bool canStartIonFreeTask(const AutoLockHelperThreadState& lock);
|
||||
bool canStartParseTask(const AutoLockHelperThreadState& lock);
|
||||
bool canStartCompressionTask(const AutoLockHelperThreadState& lock);
|
||||
bool canStartGCHelperTask(const AutoLockHelperThreadState& lock);
|
||||
bool canStartGCParallelTask(const AutoLockHelperThreadState& lock);
|
||||
|
||||
// Used by a major GC to signal processing enqueued compression tasks.
|
||||
|
@ -364,7 +354,6 @@ typedef mozilla::Variant<jit::IonBuilder*,
|
|||
PromiseHelperTask*,
|
||||
ParseTask*,
|
||||
SourceCompressionTask*,
|
||||
GCHelperState*,
|
||||
GCParallelTask*> HelperTaskUnion;
|
||||
|
||||
/* Individual helper thread, one allocated per core. */
|
||||
|
@ -415,11 +404,6 @@ struct HelperThread
|
|||
return maybeCurrentTaskAs<SourceCompressionTask*>();
|
||||
}
|
||||
|
||||
/* Any GC state for background sweeping or allocating being performed. */
|
||||
GCHelperState* gcHelperTask() {
|
||||
return maybeCurrentTaskAs<GCHelperState*>();
|
||||
}
|
||||
|
||||
/* State required to perform a GC parallel task. */
|
||||
GCParallelTask* gcParallelTask() {
|
||||
return maybeCurrentTaskAs<GCParallelTask*>();
|
||||
|
@ -466,7 +450,6 @@ struct HelperThread
|
|||
void handleIonFreeWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleParseWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleCompressionWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleGCHelperWorkload(AutoLockHelperThreadState& locked);
|
||||
void handleGCParallelWorkload(AutoLockHelperThreadState& locked);
|
||||
};
|
||||
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче