Wed, 31 Dec 2014 13:27:57 +0100
Ignore runtime configuration files generated during quality assurance.
michael@0 | 1 | /* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */ |
michael@0 | 2 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 5 | |
michael@0 | 6 | /* |
michael@0 | 7 | * Inline methods that belong in nsStyleStruct.h, except that they |
michael@0 | 8 | * require more headers. |
michael@0 | 9 | */ |
michael@0 | 10 | |
michael@0 | 11 | #ifndef nsStyleStructInlines_h_ |
michael@0 | 12 | #define nsStyleStructInlines_h_ |
michael@0 | 13 | |
michael@0 | 14 | #include "nsIFrame.h" |
michael@0 | 15 | #include "nsStyleStruct.h" |
michael@0 | 16 | #include "imgIRequest.h" |
michael@0 | 17 | #include "imgIContainer.h" |
michael@0 | 18 | #include "nsIContent.h" |
michael@0 | 19 | |
michael@0 | 20 | inline void |
michael@0 | 21 | nsStyleImage::SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const |
michael@0 | 22 | { |
michael@0 | 23 | const_cast<nsStyleImage*>(this)->mSubImages.ReplaceObjectAt(aSubImage, aIndex); |
michael@0 | 24 | } |
michael@0 | 25 | |
michael@0 | 26 | inline imgIContainer* |
michael@0 | 27 | nsStyleImage::GetSubImage(uint8_t aIndex) const |
michael@0 | 28 | { |
michael@0 | 29 | imgIContainer* subImage = nullptr; |
michael@0 | 30 | if (aIndex < mSubImages.Count()) |
michael@0 | 31 | subImage = mSubImages[aIndex]; |
michael@0 | 32 | return subImage; |
michael@0 | 33 | } |
michael@0 | 34 | |
michael@0 | 35 | bool |
michael@0 | 36 | nsStyleText::HasTextShadow() const |
michael@0 | 37 | { |
michael@0 | 38 | return mTextShadow; |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | nsCSSShadowArray* |
michael@0 | 42 | nsStyleText::GetTextShadow() const |
michael@0 | 43 | { |
michael@0 | 44 | return mTextShadow; |
michael@0 | 45 | } |
michael@0 | 46 | |
michael@0 | 47 | bool |
michael@0 | 48 | nsStyleText::WhiteSpaceCanWrap(const nsIFrame* aContextFrame) const |
michael@0 | 49 | { |
michael@0 | 50 | NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame"); |
michael@0 | 51 | return WhiteSpaceCanWrapStyle() && !aContextFrame->IsSVGText(); |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | bool |
michael@0 | 55 | nsStyleText::WordCanWrap(const nsIFrame* aContextFrame) const |
michael@0 | 56 | { |
michael@0 | 57 | NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame"); |
michael@0 | 58 | return WordCanWrapStyle() && !aContextFrame->IsSVGText(); |
michael@0 | 59 | } |
michael@0 | 60 | |
michael@0 | 61 | bool |
michael@0 | 62 | nsStyleDisplay::IsBlockInside(const nsIFrame* aContextFrame) const |
michael@0 | 63 | { |
michael@0 | 64 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 65 | if (aContextFrame->IsSVGText()) { |
michael@0 | 66 | return aContextFrame->GetType() == nsGkAtoms::blockFrame; |
michael@0 | 67 | } |
michael@0 | 68 | return IsBlockInsideStyle(); |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | bool |
michael@0 | 72 | nsStyleDisplay::IsBlockOutside(const nsIFrame* aContextFrame) const |
michael@0 | 73 | { |
michael@0 | 74 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 75 | if (aContextFrame->IsSVGText()) { |
michael@0 | 76 | return aContextFrame->GetType() == nsGkAtoms::blockFrame; |
michael@0 | 77 | } |
michael@0 | 78 | return IsBlockOutsideStyle(); |
michael@0 | 79 | } |
michael@0 | 80 | |
michael@0 | 81 | bool |
michael@0 | 82 | nsStyleDisplay::IsInlineOutside(const nsIFrame* aContextFrame) const |
michael@0 | 83 | { |
michael@0 | 84 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 85 | if (aContextFrame->IsSVGText()) { |
michael@0 | 86 | return aContextFrame->GetType() != nsGkAtoms::blockFrame; |
michael@0 | 87 | } |
michael@0 | 88 | return IsInlineOutsideStyle(); |
michael@0 | 89 | } |
michael@0 | 90 | |
michael@0 | 91 | bool |
michael@0 | 92 | nsStyleDisplay::IsOriginalDisplayInlineOutside(const nsIFrame* aContextFrame) const |
michael@0 | 93 | { |
michael@0 | 94 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 95 | if (aContextFrame->IsSVGText()) { |
michael@0 | 96 | return aContextFrame->GetType() != nsGkAtoms::blockFrame; |
michael@0 | 97 | } |
michael@0 | 98 | return IsOriginalDisplayInlineOutsideStyle(); |
michael@0 | 99 | } |
michael@0 | 100 | |
michael@0 | 101 | uint8_t |
michael@0 | 102 | nsStyleDisplay::GetDisplay(const nsIFrame* aContextFrame) const |
michael@0 | 103 | { |
michael@0 | 104 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 105 | if (aContextFrame->IsSVGText() && |
michael@0 | 106 | mDisplay != NS_STYLE_DISPLAY_NONE) { |
michael@0 | 107 | return aContextFrame->GetType() == nsGkAtoms::blockFrame ? |
michael@0 | 108 | NS_STYLE_DISPLAY_BLOCK : |
michael@0 | 109 | NS_STYLE_DISPLAY_INLINE; |
michael@0 | 110 | } |
michael@0 | 111 | return mDisplay; |
michael@0 | 112 | } |
michael@0 | 113 | |
michael@0 | 114 | bool |
michael@0 | 115 | nsStyleDisplay::IsFloating(const nsIFrame* aContextFrame) const |
michael@0 | 116 | { |
michael@0 | 117 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 118 | return IsFloatingStyle() && !aContextFrame->IsSVGText(); |
michael@0 | 119 | } |
michael@0 | 120 | |
michael@0 | 121 | bool |
michael@0 | 122 | nsStyleDisplay::HasTransform(const nsIFrame* aContextFrame) const |
michael@0 | 123 | { |
michael@0 | 124 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 125 | return HasTransformStyle() && aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms); |
michael@0 | 126 | } |
michael@0 | 127 | |
michael@0 | 128 | bool |
michael@0 | 129 | nsStyleDisplay::IsPositioned(const nsIFrame* aContextFrame) const |
michael@0 | 130 | { |
michael@0 | 131 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, |
michael@0 | 132 | "unexpected aContextFrame"); |
michael@0 | 133 | return (IsAbsolutelyPositionedStyle() || |
michael@0 | 134 | IsRelativelyPositionedStyle() || |
michael@0 | 135 | HasTransform(aContextFrame) || |
michael@0 | 136 | HasPerspectiveStyle()) && |
michael@0 | 137 | !aContextFrame->IsSVGText(); |
michael@0 | 138 | } |
michael@0 | 139 | |
michael@0 | 140 | bool |
michael@0 | 141 | nsStyleDisplay::IsRelativelyPositioned(const nsIFrame* aContextFrame) const |
michael@0 | 142 | { |
michael@0 | 143 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 144 | return IsRelativelyPositionedStyle() && !aContextFrame->IsSVGText(); |
michael@0 | 145 | } |
michael@0 | 146 | |
michael@0 | 147 | bool |
michael@0 | 148 | nsStyleDisplay::IsAbsolutelyPositioned(const nsIFrame* aContextFrame) const |
michael@0 | 149 | { |
michael@0 | 150 | NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame"); |
michael@0 | 151 | return IsAbsolutelyPositionedStyle() && !aContextFrame->IsSVGText(); |
michael@0 | 152 | } |
michael@0 | 153 | |
michael@0 | 154 | uint8_t |
michael@0 | 155 | nsStyleVisibility::GetEffectivePointerEvents(nsIFrame* aFrame) const |
michael@0 | 156 | { |
michael@0 | 157 | if (aFrame->GetContent() && !aFrame->GetContent()->GetParent()) { |
michael@0 | 158 | // The root element has a cluster of frames associated with it |
michael@0 | 159 | // (root scroll frame, canvas frame, the actual primary frame). Make |
michael@0 | 160 | // those take their pointer-events value from the root element's primary |
michael@0 | 161 | // frame. |
michael@0 | 162 | nsIFrame* f = aFrame->GetContent()->GetPrimaryFrame(); |
michael@0 | 163 | if (f) { |
michael@0 | 164 | return f->StyleVisibility()->mPointerEvents; |
michael@0 | 165 | } |
michael@0 | 166 | } |
michael@0 | 167 | return mPointerEvents; |
michael@0 | 168 | } |
michael@0 | 169 | |
michael@0 | 170 | #endif /* !defined(nsStyleStructInlines_h_) */ |