2008-07-16 23:30:25 -07:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-07-16 23:30:25 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Inline methods that belong in nsStyleStruct.h, except that they
|
|
|
|
* require more headers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsStyleStructInlines_h_
|
|
|
|
#define nsStyleStructInlines_h_
|
|
|
|
|
|
|
|
#include "nsStyleStruct.h"
|
|
|
|
#include "imgIRequest.h"
|
2009-11-13 20:23:00 -08:00
|
|
|
#include "imgIContainer.h"
|
2008-07-16 23:30:25 -07:00
|
|
|
|
|
|
|
inline void
|
|
|
|
nsStyleBorder::SetBorderImage(imgIRequest* aImage)
|
|
|
|
{
|
2011-12-22 15:34:45 -08:00
|
|
|
mBorderImageSource = aImage;
|
2009-11-13 20:23:00 -08:00
|
|
|
mSubImages.Clear();
|
2008-07-16 23:30:25 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
inline imgIRequest*
|
|
|
|
nsStyleBorder::GetBorderImage() const
|
|
|
|
{
|
2011-12-22 15:34:45 -08:00
|
|
|
NS_ABORT_IF_FALSE(!mBorderImageSource || mImageTracked,
|
2010-09-07 17:30:40 -07:00
|
|
|
"Should be tracking any images we're going to use!");
|
2011-12-22 15:34:45 -08:00
|
|
|
return mBorderImageSource;
|
2008-07-16 23:30:25 -07:00
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
inline bool nsStyleBorder::IsBorderImageLoaded() const
|
2008-07-16 23:30:25 -07:00
|
|
|
{
|
|
|
|
PRUint32 status;
|
2011-12-22 15:34:45 -08:00
|
|
|
return mBorderImageSource &&
|
|
|
|
NS_SUCCEEDED(mBorderImageSource->GetImageStatus(&status)) &&
|
2011-04-04 04:41:02 -07:00
|
|
|
(status & imgIRequest::STATUS_LOAD_COMPLETE) &&
|
|
|
|
!(status & imgIRequest::STATUS_ERROR);
|
2008-07-16 23:30:25 -07:00
|
|
|
}
|
|
|
|
|
2009-11-13 20:23:00 -08:00
|
|
|
inline void
|
|
|
|
nsStyleBorder::SetSubImage(PRUint8 aIndex, imgIContainer* aSubImage) const
|
|
|
|
{
|
|
|
|
const_cast<nsStyleBorder*>(this)->mSubImages.ReplaceObjectAt(aSubImage, aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline imgIContainer*
|
|
|
|
nsStyleBorder::GetSubImage(PRUint8 aIndex) const
|
|
|
|
{
|
2010-01-08 21:03:38 -08:00
|
|
|
imgIContainer* subImage = nsnull;
|
|
|
|
if (aIndex < mSubImages.Count())
|
2009-11-13 20:23:00 -08:00
|
|
|
subImage = mSubImages[aIndex];
|
|
|
|
return subImage;
|
|
|
|
}
|
|
|
|
|
2008-07-16 23:30:25 -07:00
|
|
|
#endif /* !defined(nsStyleStructInlines_h_) */
|