2008-07-17 06:30:25 +00:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2008-07-17 06:30:25 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Inline methods that belong in nsStyleStruct.h, except that they
|
|
|
|
* require more headers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsStyleStructInlines_h_
|
|
|
|
#define nsStyleStructInlines_h_
|
|
|
|
|
2012-08-02 11:38:49 +00:00
|
|
|
#include "nsIFrame.h"
|
2008-07-17 06:30:25 +00:00
|
|
|
#include "nsStyleStruct.h"
|
|
|
|
#include "imgIRequest.h"
|
2009-11-14 04:23:00 +00:00
|
|
|
#include "imgIContainer.h"
|
2008-07-17 06:30:25 +00:00
|
|
|
|
|
|
|
inline void
|
|
|
|
nsStyleBorder::SetBorderImage(imgIRequest* aImage)
|
|
|
|
{
|
2011-12-22 23:34:45 +00:00
|
|
|
mBorderImageSource = aImage;
|
2009-11-14 04:23:00 +00:00
|
|
|
mSubImages.Clear();
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
inline imgIRequest*
|
|
|
|
nsStyleBorder::GetBorderImage() const
|
|
|
|
{
|
2011-12-22 23:34:45 +00:00
|
|
|
NS_ABORT_IF_FALSE(!mBorderImageSource || mImageTracked,
|
2010-09-08 00:30:40 +00:00
|
|
|
"Should be tracking any images we're going to use!");
|
2011-12-22 23:34:45 +00:00
|
|
|
return mBorderImageSource;
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
|
|
|
|
2011-09-29 06:19:26 +00:00
|
|
|
inline bool nsStyleBorder::IsBorderImageLoaded() const
|
2008-07-17 06:30:25 +00:00
|
|
|
{
|
2012-08-22 15:56:38 +00:00
|
|
|
uint32_t status;
|
2011-12-22 23:34:45 +00:00
|
|
|
return mBorderImageSource &&
|
|
|
|
NS_SUCCEEDED(mBorderImageSource->GetImageStatus(&status)) &&
|
2011-04-04 11:41:02 +00:00
|
|
|
(status & imgIRequest::STATUS_LOAD_COMPLETE) &&
|
|
|
|
!(status & imgIRequest::STATUS_ERROR);
|
2008-07-17 06:30:25 +00:00
|
|
|
}
|
|
|
|
|
2009-11-14 04:23:00 +00:00
|
|
|
inline void
|
2012-08-22 15:56:38 +00:00
|
|
|
nsStyleBorder::SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const
|
2009-11-14 04:23:00 +00:00
|
|
|
{
|
|
|
|
const_cast<nsStyleBorder*>(this)->mSubImages.ReplaceObjectAt(aSubImage, aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline imgIContainer*
|
2012-08-22 15:56:38 +00:00
|
|
|
nsStyleBorder::GetSubImage(uint8_t aIndex) const
|
2009-11-14 04:23:00 +00:00
|
|
|
{
|
2012-07-30 14:20:58 +00:00
|
|
|
imgIContainer* subImage = nullptr;
|
2010-01-09 05:03:38 +00:00
|
|
|
if (aIndex < mSubImages.Count())
|
2009-11-14 04:23:00 +00:00
|
|
|
subImage = mSubImages[aIndex];
|
|
|
|
return subImage;
|
|
|
|
}
|
|
|
|
|
2012-08-08 11:37:13 +00:00
|
|
|
bool
|
|
|
|
nsStyleText::HasTextShadow(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return mTextShadow && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
|
|
|
nsCSSShadowArray*
|
|
|
|
nsStyleText::GetTextShadow(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if (aFrame->IsSVGText()) {
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
return mTextShadow;
|
|
|
|
}
|
|
|
|
|
2012-08-02 11:38:51 +00:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsBlockInside(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if (aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT) {
|
|
|
|
return aFrame->GetType() == nsGkAtoms::blockFrame;
|
|
|
|
}
|
|
|
|
return IsBlockInsideStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsBlockOutside(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if (aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT) {
|
|
|
|
return aFrame->GetType() == nsGkAtoms::blockFrame;
|
|
|
|
}
|
|
|
|
return IsBlockOutsideStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsInlineOutside(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if (aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT) {
|
|
|
|
return aFrame->GetType() != nsGkAtoms::blockFrame;
|
|
|
|
}
|
|
|
|
return IsInlineOutsideStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsOriginalDisplayInlineOutside(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if (aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT) {
|
|
|
|
return aFrame->GetType() != nsGkAtoms::blockFrame;
|
|
|
|
}
|
|
|
|
return IsOriginalDisplayInlineOutsideStyle();
|
|
|
|
}
|
|
|
|
|
2012-08-22 15:56:38 +00:00
|
|
|
uint8_t
|
2012-08-02 11:38:51 +00:00
|
|
|
nsStyleDisplay::GetDisplay(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if ((aFrame->GetStateBits() & NS_FRAME_IS_SVG_TEXT) &&
|
|
|
|
mDisplay != NS_STYLE_DISPLAY_NONE) {
|
|
|
|
return aFrame->GetType() == nsGkAtoms::blockFrame ?
|
|
|
|
NS_STYLE_DISPLAY_BLOCK :
|
|
|
|
NS_STYLE_DISPLAY_INLINE;
|
|
|
|
}
|
|
|
|
return mDisplay;
|
|
|
|
}
|
|
|
|
|
2012-08-02 11:38:49 +00:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsFloating(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsFloatingStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
2012-08-02 11:38:50 +00:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsPositioned(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsPositionedStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsRelativelyPositioned(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsRelativelyPositionedStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsAbsolutelyPositioned(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsAbsolutelyPositionedStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
2008-07-17 06:30:25 +00:00
|
|
|
#endif /* !defined(nsStyleStructInlines_h_) */
|