2017-10-27 20:33:53 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
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"
|
2014-08-18 18:44:50 +04:00
|
|
|
#include "nsIContent.h" // for GetParent()
|
2015-05-04 00:52:53 +03:00
|
|
|
#include "nsTextFrame.h" // for nsTextFrame::ShouldSuppressLineBreak
|
2017-03-23 10:29:11 +03:00
|
|
|
#include "nsSVGUtils.h" // for nsSVGUtils::IsInSVGTextSubtree
|
2017-02-02 23:51:34 +03:00
|
|
|
|
2016-08-01 03:23:00 +03:00
|
|
|
inline void
|
|
|
|
nsStyleImage::EnsureCachedBIData() const
|
|
|
|
{
|
|
|
|
if (!mCachedBIData) {
|
|
|
|
const_cast<nsStyleImage*>(this)->mCachedBIData =
|
|
|
|
mozilla::MakeUnique<CachedBorderImageData>();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
inline void
|
2014-01-31 07:36:41 +04:00
|
|
|
nsStyleImage::SetSubImage(uint8_t aIndex, imgIContainer* aSubImage) const
|
2008-07-17 10:30:25 +04:00
|
|
|
{
|
2016-08-01 03:23:00 +03:00
|
|
|
EnsureCachedBIData();
|
|
|
|
mCachedBIData->SetSubImage(aIndex, aSubImage);
|
2009-11-14 07:23:00 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
inline imgIContainer*
|
2014-01-31 07:36:41 +04:00
|
|
|
nsStyleImage::GetSubImage(uint8_t aIndex) const
|
2009-11-14 07:23:00 +03:00
|
|
|
{
|
2016-08-01 03:23:00 +03:00
|
|
|
return (mCachedBIData) ? mCachedBIData->GetSubImage(aIndex) : nullptr;
|
2009-11-14 07:23:00 +03:00
|
|
|
}
|
|
|
|
|
2012-08-08 15:37:13 +04:00
|
|
|
bool
|
2014-01-13 16:21:42 +04:00
|
|
|
nsStyleText::HasTextShadow() const
|
2012-08-08 15:37:13 +04:00
|
|
|
{
|
2014-01-13 16:21:42 +04:00
|
|
|
return mTextShadow;
|
2012-08-08 15:37:13 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
nsCSSShadowArray*
|
2014-01-13 16:21:42 +04:00
|
|
|
nsStyleText::GetTextShadow() const
|
2012-08-08 15:37:13 +04:00
|
|
|
{
|
|
|
|
return mTextShadow;
|
|
|
|
}
|
|
|
|
|
2015-03-17 11:10:15 +03:00
|
|
|
bool
|
2015-05-04 00:52:53 +03:00
|
|
|
nsStyleText::NewlineIsSignificant(const nsTextFrame* aContextFrame) const
|
2015-03-17 11:10:15 +03:00
|
|
|
{
|
|
|
|
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
|
|
|
|
return NewlineIsSignificantStyle() &&
|
2016-05-03 07:39:24 +03:00
|
|
|
!aContextFrame->ShouldSuppressLineBreak() &&
|
2018-03-22 21:20:41 +03:00
|
|
|
!aContextFrame->Style()->IsTextCombined();
|
2015-03-17 11:10:15 +03:00
|
|
|
}
|
|
|
|
|
2013-03-25 07:50:59 +04:00
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleText::WhiteSpaceCanWrap(const nsIFrame* aContextFrame) const
|
2013-03-25 07:50:59 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
return WhiteSpaceCanWrapStyle() &&
|
|
|
|
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame) &&
|
2018-03-22 21:20:41 +03:00
|
|
|
!aContextFrame->Style()->IsTextCombined();
|
2013-03-25 07:50:59 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleText::WordCanWrap(const nsIFrame* aContextFrame) const
|
2013-03-25 07:50:59 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleText() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
return WordCanWrapStyle() && !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
|
2013-03-25 07:50:59 +04:00
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:51 +04:00
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsBlockInside(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:51 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
|
2017-04-30 18:30:08 +03:00
|
|
|
return aContextFrame->IsBlockFrame();
|
2012-08-02 15:38:51 +04:00
|
|
|
}
|
|
|
|
return IsBlockInsideStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsBlockOutside(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:51 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
|
2017-04-30 18:30:08 +03:00
|
|
|
return aContextFrame->IsBlockFrame();
|
2012-08-02 15:38:51 +04:00
|
|
|
}
|
|
|
|
return IsBlockOutsideStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsInlineOutside(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:51 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
|
2017-04-30 18:30:08 +03:00
|
|
|
return !aContextFrame->IsBlockFrame();
|
2012-08-02 15:38:51 +04:00
|
|
|
}
|
|
|
|
return IsInlineOutsideStyle();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsOriginalDisplayInlineOutside(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:51 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame)) {
|
2017-04-30 18:30:08 +03:00
|
|
|
return !aContextFrame->IsBlockFrame();
|
2012-08-02 15:38:51 +04:00
|
|
|
}
|
|
|
|
return IsOriginalDisplayInlineOutsideStyle();
|
|
|
|
}
|
|
|
|
|
2016-08-28 05:31:50 +03:00
|
|
|
mozilla::StyleDisplay
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::GetDisplay(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:51 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
if (nsSVGUtils::IsInSVGTextSubtree(aContextFrame) &&
|
|
|
|
mDisplay != mozilla::StyleDisplay::None) {
|
2017-04-30 18:30:08 +03:00
|
|
|
return aContextFrame->IsBlockFrame() ? mozilla::StyleDisplay::Block
|
|
|
|
: mozilla::StyleDisplay::Inline;
|
2012-08-02 15:38:51 +04:00
|
|
|
}
|
|
|
|
return mDisplay;
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:49 +04:00
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsFloating(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:49 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
return IsFloatingStyle() && !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
|
2012-08-02 15:38:49 +04:00
|
|
|
}
|
|
|
|
|
2015-03-12 06:21:01 +03:00
|
|
|
// If you change this function, also change the corresponding block in
|
|
|
|
// nsCSSFrameConstructor::ConstructFrameFromItemInternal that references
|
|
|
|
// this function in comments.
|
2015-03-20 07:12:17 +03:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::HasTransform(const nsIFrame* aContextFrame) const
|
|
|
|
{
|
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
|
|
|
return HasTransformStyle() && aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms);
|
|
|
|
}
|
|
|
|
|
2018-05-23 01:41:19 +03:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::HasPerspective(const nsIFrame* aContextFrame) const
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
|
|
|
return HasPerspectiveStyle() && aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms);
|
|
|
|
}
|
|
|
|
|
2016-08-29 21:43:29 +03:00
|
|
|
bool
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
nsStyleDisplay::IsFixedPosContainingBlockForNonSVGTextFrames(
|
2018-05-24 16:30:30 +03:00
|
|
|
mozilla::ComputedStyle& aStyle) const
|
2016-08-29 21:43:29 +03:00
|
|
|
{
|
|
|
|
// NOTE: Any CSS properties that influence the output of this function
|
2018-03-27 03:05:05 +03:00
|
|
|
// should have the FIXPOS_CB flag set on them.
|
2018-05-24 16:30:30 +03:00
|
|
|
NS_ASSERTION(aStyle.ThreadsafeStyleDisplay() == this, "unexpected aStyle");
|
2017-02-02 23:51:34 +03:00
|
|
|
|
|
|
|
if (mWillChangeBitField & NS_STYLE_WILL_CHANGE_FIXPOS_CB) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-05-24 16:30:30 +03:00
|
|
|
return aStyle.ThreadsafeStyleEffects()->HasFilters();
|
2016-08-29 21:43:29 +03:00
|
|
|
}
|
|
|
|
|
2018-08-08 01:02:08 +03:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsFixedPosContainingBlockForContainLayoutAndPaintSupportingFrames() const
|
|
|
|
{
|
2018-07-20 20:57:22 +03:00
|
|
|
return IsContainPaint() || IsContainLayout();
|
2018-08-08 01:02:08 +03:00
|
|
|
}
|
|
|
|
|
2016-08-29 21:43:29 +03:00
|
|
|
bool
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
nsStyleDisplay::IsFixedPosContainingBlockForTransformSupportingFrames() const
|
2016-08-29 21:43:29 +03:00
|
|
|
{
|
|
|
|
// NOTE: Any CSS properties that influence the output of this function
|
2018-03-27 03:05:05 +03:00
|
|
|
// should have the FIXPOS_CB flag set on them.
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
return HasTransformStyle() || HasPerspectiveStyle();
|
2016-08-29 21:43:29 +03:00
|
|
|
}
|
|
|
|
|
2015-03-20 07:12:17 +03:00
|
|
|
bool
|
|
|
|
nsStyleDisplay::IsFixedPosContainingBlock(const nsIFrame* aContextFrame) const
|
|
|
|
{
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
mozilla::ComputedStyle* style = aContextFrame->Style();
|
|
|
|
NS_ASSERTION(style->ThreadsafeStyleDisplay() == this,
|
|
|
|
"unexpected aContextFrame");
|
2015-12-01 02:46:44 +03:00
|
|
|
// NOTE: Any CSS properties that influence the output of this function
|
2018-03-27 03:05:05 +03:00
|
|
|
// should have the FIXPOS_CB flag set on them.
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
if (!IsFixedPosContainingBlockForNonSVGTextFrames(*style) &&
|
2018-08-08 01:02:08 +03:00
|
|
|
(!IsFixedPosContainingBlockForContainLayoutAndPaintSupportingFrames() ||
|
|
|
|
!aContextFrame->IsFrameOfType(nsIFrame::eSupportsContainLayoutAndPaint)) &&
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
(!IsFixedPosContainingBlockForTransformSupportingFrames() ||
|
|
|
|
!aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) {
|
2016-08-29 21:43:29 +03:00
|
|
|
return false;
|
|
|
|
}
|
2017-03-23 10:29:11 +03:00
|
|
|
return !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
|
2016-08-29 21:43:29 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
nsStyleDisplay::IsAbsPosContainingBlockForNonSVGTextFrames() const
|
2016-08-29 21:43:29 +03:00
|
|
|
{
|
|
|
|
// NOTE: Any CSS properties that influence the output of this function
|
2018-03-27 03:05:05 +03:00
|
|
|
// should have the ABSPOS_CB set on them.
|
2016-08-29 21:43:29 +03:00
|
|
|
return IsAbsolutelyPositionedStyle() ||
|
|
|
|
IsRelativelyPositionedStyle() ||
|
|
|
|
(mWillChangeBitField & NS_STYLE_WILL_CHANGE_ABSPOS_CB);
|
|
|
|
}
|
|
|
|
|
2012-08-02 15:38:50 +04:00
|
|
|
bool
|
2015-03-12 06:21:01 +03:00
|
|
|
nsStyleDisplay::IsAbsPosContainingBlock(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:50 +04:00
|
|
|
{
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
mozilla::ComputedStyle *style = aContextFrame->Style();
|
|
|
|
NS_ASSERTION(style->ThreadsafeStyleDisplay() == this,
|
2018-05-24 16:30:30 +03:00
|
|
|
"unexpected aContextFrame");
|
2016-08-29 21:43:29 +03:00
|
|
|
// NOTE: Any CSS properties that influence the output of this function
|
2018-03-27 03:05:05 +03:00
|
|
|
// should have the ABSPOS_CB set on them.
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
if (!IsAbsPosContainingBlockForNonSVGTextFrames() &&
|
|
|
|
!IsFixedPosContainingBlockForNonSVGTextFrames(*style) &&
|
2018-08-08 01:02:08 +03:00
|
|
|
(!IsFixedPosContainingBlockForContainLayoutAndPaintSupportingFrames() ||
|
|
|
|
!aContextFrame->IsFrameOfType(nsIFrame::eSupportsContainLayoutAndPaint)) &&
|
Bug 1479859 patch 2 - Send nsChangeHint_UpdateContainingBlock when containing block-ness changes due to one property change, while another property that might trigger containing block-ness doesn't do so because of the frame type. r=emilio
This fixes a rather subtle bug. What the underlying code here is trying
to do is remove nsChangeHint_UpdateContainingBlock when some properties
that influence whether a frame is a containing block for absolutely
positioned or fixed positioned elements have changed, but the final
calculation of being a containing block has not changed. However, the
old code was using a function that tested whether the style could
*possibly* lead to a frame being a containing block. Some of the
properties (like the transform properties) that lead to being a
containing block, for example, don't apply to non-replaced inlines.
Some, however, do (such as 'filter'). So if there's a dynamic change
adding or removing a filter, on an inline that also has an *ignored*
transform property (like 'transform' or 'perspective') set, then the
code prior to this patch causes us to remove the UpdateContainingBlock
hint.
This patch fixes things by testing whether being a containing block
could have changed for *any* type of frame, by separately testing the
changes.
The added tests fail without the patch and pass with the patch, viewed
in isolation. However, without the previous patch, test 003 passes.
Test 003 also fails in Chrome (but 001 and 002 pass).
Differential Revision: https://phabricator.services.mozilla.com/D2814
--HG--
extra : rebase_source : 0a5dbb15a058cf4a43d989bf53f042c5b718e24d
2018-08-08 01:02:07 +03:00
|
|
|
(!IsFixedPosContainingBlockForTransformSupportingFrames() ||
|
|
|
|
!aContextFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) {
|
2016-08-29 21:43:29 +03:00
|
|
|
return false;
|
|
|
|
}
|
2017-03-23 10:29:11 +03:00
|
|
|
return !nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
|
2012-08-02 15:38:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsRelativelyPositioned(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:50 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
return IsRelativelyPositionedStyle() &&
|
|
|
|
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
|
2012-08-02 15:38:50 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2013-04-07 03:40:07 +04:00
|
|
|
nsStyleDisplay::IsAbsolutelyPositioned(const nsIFrame* aContextFrame) const
|
2012-08-02 15:38:50 +04:00
|
|
|
{
|
2013-04-07 03:40:07 +04:00
|
|
|
NS_ASSERTION(aContextFrame->StyleDisplay() == this, "unexpected aContextFrame");
|
2017-03-23 10:29:11 +03:00
|
|
|
return IsAbsolutelyPositionedStyle() &&
|
|
|
|
!nsSVGUtils::IsInSVGTextSubtree(aContextFrame);
|
2012-08-02 15:38:50 +04:00
|
|
|
}
|
|
|
|
|
2012-11-02 14:42:59 +04:00
|
|
|
uint8_t
|
2016-04-12 08:52:41 +03:00
|
|
|
nsStyleUserInterface::GetEffectivePointerEvents(nsIFrame* aFrame) const
|
2012-11-02 14:42:59 +04:00
|
|
|
{
|
|
|
|
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) {
|
2016-04-12 08:52:41 +03:00
|
|
|
return f->StyleUserInterface()->mPointerEvents;
|
2012-11-02 14:42:59 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return mPointerEvents;
|
|
|
|
}
|
|
|
|
|
2016-07-15 22:56:39 +03:00
|
|
|
bool
|
|
|
|
nsStyleBackground::HasLocalBackground() const
|
|
|
|
{
|
|
|
|
NS_FOR_VISIBLE_IMAGE_LAYERS_BACK_TO_FRONT(i, mImage) {
|
|
|
|
const nsStyleImageLayers::Layer& layer = mImage.mLayers[i];
|
|
|
|
if (!layer.mImage.IsEmpty() &&
|
2018-05-09 01:05:33 +03:00
|
|
|
layer.mAttachment == mozilla::StyleImageLayerAttachment::Local) {
|
2016-07-15 22:56:39 +03:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2008-07-17 10:30:25 +04:00
|
|
|
#endif /* !defined(nsStyleStructInlines_h_) */
|