Files
palemoon27/dom/base/nsMappedAttributes.h
T
roytam1 2234923354 import changes from `dev' branch of rmottola/Arctic-Fox:
- Bug 1222226 - Don't return eRestyleResult_StopWithStyleChange if the old style context is shared. r=dbaron (ad682c717e)
- Bug 1222745 - Restore eRestyleResult_StopWithStyleChange optimization for shared style contexts by comparing rule nodes for inherited style data changes. r=dbaron (766bb79aac)
- Bug 1032613 part 1: Promote FrameMaintainsOverflow to be a public nsIFrame method, & implement it using HasAllStateBits. r=dbaron (b3c44e7ba6)
- Bug 1032613 part 2: Make RestyleManager::AddSubtreeToOverflowTracker skip frames that don't maintain overflow areas. r=dbaron (7519ac2937)
- Bug 1165918 - Qt widget port does not compile anymore. r=rojkov (583700d86a)
- Bug 1224403 (part 12) - Remove WidgetToScreenOffsetUntyped(). r=kats. (742aa54a28)
- Bug 1224482 (part 1) - Tweak typed/untyped versions of Get{,Client,Screen}Bounds(). r=kats. (65e7bf71fa)
- Bug 1224482 (part 2) - Replace GetNaturalBoundsUntyped() with GetNaturalBounds(). r=kats. (21159528de)
- Bug 1224482 (part 3) - Replace GetClientOffsetUntyped() with GetClientOffset(). r=kats. (fa06021002)
- Bug 1224482 (part 4) - Make GetClientSize() return a LayoutDeviceIntSize. r=kats. (f10d7bce64)
- Bug 1224482 (part 5) - Avoid excessive mozilla:: prefixes in nsIWidget and its subclasses. r=kats. (1d05c2e783)
- Bug 1170061 - ClearOnShutdown for hwcomposer, r=sotaro (5acab07299)
- Bug 1194034 - Remove unused GonkDisplayJB::StopBootAnim() in GonkDisplayJB. r=mwu (50d2cb93d6)
- Bug 1221446 - Add virtual display support to GonkDisplayJB r=mwu (d1c64f5c62)
- Bug 1224482 (part 6) - Change nsScreenGonk::m{Virtual,Natural}Bounds to LayoutDevcieIntRect. r=kats. (8e44f87785)
- Bug 1224482 (part 7) - Make GetScaledScreenBounds() return a CSSIntRect. r=kats. (76de754cae)
- Bug 1224790 - Use SetFakeModal instead of SetModal for non-modal window opened by modal window. r=smaug, mstange (051fe46311)
2023-01-19 10:53:04 +08:00

120 lines
3.2 KiB
C++

/* -*- 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/. */
/*
* A unique per-element set of attributes that is used as an
* nsIStyleRule; used to implement presentational attributes.
*/
#ifndef nsMappedAttributes_h___
#define nsMappedAttributes_h___
#include "nsAttrAndChildArray.h"
#include "nsMappedAttributeElement.h"
#include "nsIStyleRule.h"
#include "mozilla/Attributes.h"
#include "mozilla/MemoryReporting.h"
class nsIAtom;
class nsHTMLStyleSheet;
class nsMappedAttributes final : public nsIStyleRule
{
public:
nsMappedAttributes(nsHTMLStyleSheet* aSheet,
nsMapRuleToAttributesFunc aMapRuleFunc);
// Do not return null.
void* operator new(size_t size, uint32_t aAttrCount = 1) CPP_THROW_NEW;
nsMappedAttributes* Clone(bool aWillAddAttr);
NS_DECL_ISUPPORTS
void SetAndTakeAttr(nsIAtom* aAttrName, nsAttrValue& aValue);
const nsAttrValue* GetAttr(nsIAtom* aAttrName) const;
const nsAttrValue* GetAttr(const nsAString& aAttrName) const;
uint32_t Count() const
{
return mAttrCount;
}
bool Equals(const nsMappedAttributes* aAttributes) const;
uint32_t HashValue() const;
void DropStyleSheetReference()
{
mSheet = nullptr;
}
void SetStyleSheet(nsHTMLStyleSheet* aSheet);
nsHTMLStyleSheet* GetStyleSheet()
{
return mSheet;
}
const nsAttrName* NameAt(uint32_t aPos) const
{
NS_ASSERTION(aPos < mAttrCount, "out-of-bounds");
return &Attrs()[aPos].mName;
}
const nsAttrValue* AttrAt(uint32_t aPos) const
{
NS_ASSERTION(aPos < mAttrCount, "out-of-bounds");
return &Attrs()[aPos].mValue;
}
// Remove the attr at position aPos. The value of the attr is placed in
// aValue; any value that was already in aValue is destroyed.
void RemoveAttrAt(uint32_t aPos, nsAttrValue& aValue);
const nsAttrName* GetExistingAttrNameFromQName(const nsAString& aName) const;
int32_t IndexOfAttr(nsIAtom* aLocalName) const;
// nsIStyleRule
virtual void MapRuleInfoInto(nsRuleData* aRuleData) override;
virtual bool MightMapInheritedStyleData() override;
#ifdef DEBUG
virtual void List(FILE* out = stdout, int32_t aIndent = 0) const override;
#endif
size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const;
private:
nsMappedAttributes(const nsMappedAttributes& aCopy);
~nsMappedAttributes();
struct InternalAttr
{
nsAttrName mName;
nsAttrValue mValue;
};
/**
* Due to a compiler bug in VisualAge C++ for AIX, we need to return the
* address of the first index into mAttrs here, instead of simply
* returning mAttrs itself.
*
* See Bug 231104 for more information.
*/
const InternalAttr* Attrs() const
{
return reinterpret_cast<const InternalAttr*>(&(mAttrs[0]));
}
InternalAttr* Attrs()
{
return reinterpret_cast<InternalAttr*>(&(mAttrs[0]));
}
uint16_t mAttrCount;
#ifdef DEBUG
uint16_t mBufferSize;
#endif
nsHTMLStyleSheet* mSheet; //weak
nsMapRuleToAttributesFunc mRuleMapper;
void* mAttrs[1];
};
#endif /* nsMappedAttributes_h___ */