Bug 816458. Instead of removing the MAY_BE_TRANSFORMED bit in certain frame classes, add an nsIFrame::SupportsCSSTransforms method and call it when necessary. r=mats

This commit is contained in:
Robert O'Callahan 2012-12-04 17:50:05 +13:00
parent 0cb80ab541
commit 8e7070bef2
12 changed files with 46 additions and 38 deletions

View File

@ -7793,9 +7793,8 @@ ApplyRenderingChangeToTree(nsPresContext* aPresContext,
nsChangeHint aChange)
{
// We check GetStyleDisplay()->HasTransform() in addition to checking
// IsTransformed() since we can get here for some frames that don't have the
// NS_FRAME_MAY_BE_TRANSFORMED bit set (e.g. nsTableFrame; for a transformed
// table that bit is only set on the nsTableOuterFrame).
// IsTransformed() since we can get here for some frames that don't support
// CSS transforms.
NS_ASSERTION(!(aChange & nsChangeHint_UpdateTransformLayer) ||
aFrame->IsTransformed() ||
aFrame->GetStyleDisplay()->HasTransform(),

View File

@ -985,11 +985,12 @@ bool
nsIFrame::IsTransformed() const
{
return ((mState & NS_FRAME_MAY_BE_TRANSFORMED) &&
(GetStyleDisplay()->HasTransform() ||
((GetStyleDisplay()->HasTransform() && IsFrameOfType(eSupportsCSSTransforms)) ||
IsSVGTransformed() ||
(mContent &&
nsLayoutUtils::HasAnimationsForCompositor(mContent,
eCSSProperty_transform) &&
IsFrameOfType(eSupportsCSSTransforms) &&
mContent->GetPrimaryFrame() == this)));
}

View File

@ -2093,6 +2093,7 @@ public:
// children. For example, the whitespace between <table>\n<tr>\n<td>
// will be excluded during the construction of children.
eExcludesIgnorableWhitespace = 1 << 13,
eSupportsCSSTransforms = 1 << 14,
// These are to allow nsFrame::Init to assert that IsFrameOfType
// implementations all call the base class method. They are only
@ -2111,9 +2112,9 @@ public:
virtual bool IsFrameOfType(uint32_t aFlags) const
{
#ifdef DEBUG
return !(aFlags & ~(nsIFrame::eDEBUGAllFrames));
return !(aFlags & ~(nsIFrame::eDEBUGAllFrames | nsIFrame::eSupportsCSSTransforms));
#else
return !aFlags;
return !(aFlags & ~nsIFrame::eSupportsCSSTransforms);
#endif
}

View File

@ -38,20 +38,6 @@ NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
return new (aPresShell) nsInlineFrame(aContext);
}
NS_IMETHODIMP
nsInlineFrame::Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow)
{
// Let the base class do its processing
nsresult rv = nsContainerFrame::Init(aContent, aParent, aPrevInFlow);
// Transforms do not affect regular inline elements (bug 722463)
mState &= ~NS_FRAME_MAY_BE_TRANSFORMED;
return rv;
}
NS_IMPL_FRAMEARENA_HELPERS(nsInlineFrame)
NS_QUERYFRAME_HEAD(nsInlineFrame)

View File

@ -38,13 +38,6 @@ public:
friend nsIFrame* NS_NewInlineFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
/** sets defaults for inline-specific style.
* @see nsIFrame::Init
*/
NS_IMETHOD Init(nsIContent* aContent,
nsIFrame* aParent,
nsIFrame* aPrevInFlow);
// nsIFrame overrides
NS_IMETHOD BuildDisplayList(nsDisplayListBuilder* aBuilder,
const nsRect& aDirtyRect,
@ -61,6 +54,9 @@ public:
virtual bool IsFrameOfType(uint32_t aFlags) const
{
if (aFlags & eSupportsCSSTransforms) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags &
~(nsIFrame::eBidiInlineContainer | nsIFrame::eLineParticipant));
}

View File

@ -0,0 +1,8 @@
<!DOCTYPE html>
<html>
<body>
<table border="1" style="width:100%; transform:rotate(90deg)">
<tbody><tr><td></td></tr></tbody>
</table>
</body>
</html>

View File

@ -0,0 +1,15 @@
<!DOCTYPE html>
<html class="reftest-wait">
<body>
<table id="t" border="1" style="width:100%">
<tbody><tr><td></td></tr></tbody>
</table>
<script>
var t = document.getElementById("t");
window.addEventListener("MozReftestInvalidate", function() {
t.style.transform = "rotate(90deg)";
document.documentElement.removeAttribute("class");
}, false);
</script>
</body>
</html>

View File

@ -1734,3 +1734,4 @@ fuzzy(40,800) == 797797-2.html 797797-2-ref.html # 'opacity:N' and rgba(,,,N) te
== 812824-1.html 812824-1-ref.html
== 814677.html 814677-ref.html
== 815593-1.html 815593-1-ref.html
== 816458-1.html 816458-1-ref.html

View File

@ -1682,13 +1682,6 @@ struct nsStyleDisplay {
NS_STYLE_POSITION_FIXED == mPosition;
}
/* Returns true if we're positioned or there's a transform in effect. */
bool IsPositionedStyle() const {
return IsAbsolutelyPositionedStyle() ||
IsRelativelyPositionedStyle() ||
HasTransform();
}
bool IsRelativelyPositionedStyle() const {
return mPosition == NS_STYLE_POSITION_RELATIVE;
}

View File

@ -127,7 +127,10 @@ nsStyleDisplay::IsFloating(const nsIFrame* aFrame) const
bool
nsStyleDisplay::IsPositioned(const nsIFrame* aFrame) const
{
return IsPositionedStyle() && !aFrame->IsSVGText();
return (IsAbsolutelyPositionedStyle() ||
IsRelativelyPositionedStyle() ||
(HasTransform() && aFrame->IsFrameOfType(nsIFrame::eSupportsCSSTransforms))) &&
!aFrame->IsSVGText();
}
bool

View File

@ -181,9 +181,6 @@ nsTableFrame::Init(nsIContent* aContent,
bool borderCollapse = (NS_STYLE_BORDER_COLLAPSE == tableStyle->mBorderCollapse);
SetBorderCollapse(borderCollapse);
// Transforms need to affect the outer frame, not the inner frame (bug 722777)
mState &= ~NS_FRAME_MAY_BE_TRANSFORMED;
// Create the cell map if this frame is the first-in-flow.
if (!aPrevInFlow) {
mCellMap = new nsTableCellMap(*this, borderCollapse);

View File

@ -333,6 +333,14 @@ public:
*/
virtual nsIAtom* GetType() const;
virtual bool IsFrameOfType(uint32_t aFlags) const
{
if (aFlags & eSupportsCSSTransforms) {
return false;
}
return nsContainerFrame::IsFrameOfType(aFlags);
}
#ifdef DEBUG
/** @see nsIFrame::GetFrameName */
NS_IMETHOD GetFrameName(nsAString& aResult) const;