Bug 1143130 - Initialize nsIFrame::ContentOffsets members, and some additional cleanup. r=roc

This commit is contained in:
Mats Palmgren 2015-04-09 17:57:34 +00:00
parent 6299561ace
commit 75b029a916
2 changed files with 9 additions and 23 deletions

View File

@ -8857,22 +8857,6 @@ nsIFrame::GetPseudoElement(nsCSSPseudoElements::Type aType)
return nullptr;
}
nsIFrame::ContentOffsets::ContentOffsets()
{
}
nsIFrame::ContentOffsets::ContentOffsets(const ContentOffsets& rhs)
: content(rhs.content),
offset(rhs.offset),
secondaryOffset(rhs.secondaryOffset),
associate(rhs.associate)
{
}
nsIFrame::ContentOffsets::~ContentOffsets()
{
}
nsIFrame::CaretPosition::CaretPosition()
: mContentOffset(0)
{

View File

@ -1279,18 +1279,20 @@ public:
// Note that the primary offset can be after the secondary offset; for places
// that need the beginning and end of the object, the StartOffset and
// EndOffset helpers can be used.
struct MOZ_STACK_CLASS ContentOffsets {
ContentOffsets();
ContentOffsets(const ContentOffsets&);
~ContentOffsets();
nsCOMPtr<nsIContent> content;
struct MOZ_STACK_CLASS ContentOffsets
{
ContentOffsets() : offset(0)
, secondaryOffset(0)
, associate(mozilla::CARET_ASSOCIATE_BEFORE) {}
bool IsNull() { return !content; }
int32_t offset;
int32_t secondaryOffset;
// Helpers for places that need the ends of the offsets and expect them in
// numerical order, as opposed to wanting the primary and secondary offsets
int32_t StartOffset() { return std::min(offset, secondaryOffset); }
int32_t EndOffset() { return std::max(offset, secondaryOffset); }
nsCOMPtr<nsIContent> content;
int32_t offset;
int32_t secondaryOffset;
// This value indicates whether the associated content is before or after
// the offset; the most visible use is to allow the caret to know which line
// to display on.