2008-07-17 10:30:25 +04:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
2012-05-21 15:12:37 +04: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 10:30:25 +04:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Inline methods that belong in nsStyleStruct.h, except that they
|
|
|
|
* require more headers.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsStyleStructInlines_h_
|
|
|
|
#define nsStyleStructInlines_h_
|
|
|
|
|
2012-08-02 15:38:49 +04:00
|
|
|
#include "nsIFrame.h"
|
2008-07-17 10:30:25 +04:00
|
|
|
#include "nsStyleStruct.h"
|
|
|
|
#include "imgIRequest.h"
|
2009-11-14 07:23:00 +03:00
|
|
|
#include "imgIContainer.h"
|
2008-07-17 10:30:25 +04:00
|
|
|
|
|
|
|
inline void
|
2012-10-12 16:43:01 +04:00
|
|
|
nsStyleBorder::SetBorderImage(imgRequestProxy* aImage)
|
2008-07-17 10:30:25 +04:00
|
|
|
{
|
2011-12-23 03:34:45 +04:00
|
|
|
mBorderImageSource = aImage;
|
2009-11-14 07:23:00 +03:00
|
|
|
mSubImages.Clear();
|
2008-07-17 10:30:25 +04:00
|
|
|
}
|
|
|
|
|
2012-10-12 16:43:01 +04:00
|
|
|
inline imgRequestProxy*
|
2008-07-17 10:30:25 +04:00
|
|
|
nsStyleBorder::GetBorderImage() const
|
|
|
|
{
|
2011-12-23 03:34:45 +04:00
|
|
|
NS_ABORT_IF_FALSE(!mBorderImageSource || mImageTracked,
|
2010-09-08 04:30:40 +04:00
|
|
|
"Should be tracking any images we're going to use!");
|
2011-12-23 03:34:45 +04:00
|
|
|
return mBorderImageSource;
|
2008-07-17 10:30:25 +04:00
|
|
|
}
|
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
inline bool nsStyleBorder::IsBorderImageLoaded() const
|
2008-07-17 10:30:25 +04:00
|
|
|
{
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t status;
|
2011-12-23 03:34:45 +04:00
|
|
|
return mBorderImageSource &&
|
|
|
|
NS_SUCCEEDED(mBorderImageSource->GetImageStatus(&status)) &&
|
2011-04-04 15:41:02 +04:00
|
|
|
(status & imgIRequest::STATUS_LOAD_COMPLETE) &&
|
|
|
|
!(status & imgIRequest::STATUS_ERROR);
|
2008-07-17 10:30:25 +04:00
|
|
|
}
|
|
|
|
|
2009-11-14 07:23:00 +03:00
|
|
|
inline void
|
2012-08-22 19:56:38 +04:00
|
|
|
nsStyleBorder::SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const
|
2009-11-14 07:23:00 +03:00
|
|
|
{
|
|
|
|
const_cast<nsStyleBorder*>(this)->mSubImages.ReplaceObjectAt(aSubImage, aIndex);
|
|
|
|
}
|
|
|
|
|
|
|
|
inline imgIContainer*
|
2012-08-22 19:56:38 +04:00
|
|
|
nsStyleBorder::GetSubImage(uint8_t aIndex) const
|
2009-11-14 07:23:00 +03:00
|
|
|
{
|
2012-07-30 18:20:58 +04:00
|
|
|
imgIContainer* subImage = nullptr;
|
2010-01-09 08:03:38 +03:00
|
|
|
if (aIndex < mSubImages.Count())
|
2009-11-14 07:23:00 +03:00
|
|
|
subImage = mSubImages[aIndex];
|
|
|
|
return subImage;
|
|
|
|
}
|
|
|
|
|
2012-08-08 15:37:13 +04: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 15:38:51 +04: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 19:56:38 +04:00
|
|
|
uint8_t
|
2012-08-02 15:38:51 +04: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 15:38:49 +04:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsFloating(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsFloatingStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:50 +04:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsPositioned(const nsIFrame* aFrame) const
|
|
|
|
{
|
2012-12-04 08:50:05 +04:00
|
|
|
return (IsAbsolutelyPositionedStyle() ||
|
|
|
|
IsRelativelyPositionedStyle() ||
|
|
|
|
(HasTransform() && aFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) &&
|
|
|
|
!aFrame->IsSVGText();
|
2012-08-02 15:38:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsRelativelyPositioned(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsRelativelyPositionedStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsAbsolutelyPositioned(const nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
return IsAbsolutelyPositionedStyle() && !aFrame->IsSVGText();
|
|
|
|
}
|
|
|
|
|
2012-11-02 14:42:59 +04:00
|
|
|
uint8_t
|
|
|
|
nsStyleVisibility::GetEffectivePointerEvents(nsIFrame* aFrame) const
|
|
|
|
{
|
|
|
|
if (aFrame->GetContent() && !aFrame->GetContent()->GetParent()) {
|
|
|
|
// The root element has a cluster of frames associated with it
|
|
|
|
// (root scroll frame, canvas frame, the actual primary frame). Make
|
|
|
|
// those take their pointer-events value from the root element's primary
|
|
|
|
// frame.
|
|
|
|
nsIFrame* f = aFrame->GetContent()->GetPrimaryFrame();
|
|
|
|
if (f) {
|
|
|
|
return f->GetStyleVisibility()->mPointerEvents;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return mPointerEvents;
|
|
|
|
}
|
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
#endif /* !defined(nsStyleStructInlines_h_) */
|