From b6ea0644a45d265d8f1a76a584ee6422470cac0f Mon Sep 17 00:00:00 2001 From: "Carsten \"Tomcat\" Book" Date: Wed, 19 Mar 2014 09:47:43 +0100 Subject: [PATCH] Backed out changeset 094decae8ff3 (bug 917755) for mochitest-1 bustage on a CLOSED TREE --- layout/base/nsLayoutUtils.cpp | 97 ----------------------------------- layout/base/nsLayoutUtils.h | 71 ++++++++----------------- 2 files changed, 22 insertions(+), 146 deletions(-) diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 45a1f9a37e08..80fce5a6cdfc 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -1893,66 +1893,6 @@ nsLayoutUtils::GetTransformToAncestor(nsIFrame *aFrame, const nsIFrame *aAncesto return ctm; } -static nsIFrame* -FindNearestCommonAncestorFrame(nsIFrame* aFrame1, nsIFrame* aFrame2) -{ - nsAutoTArray ancestors1; - nsAutoTArray ancestors2; - nsIFrame* commonAncestor = nullptr; - if (aFrame1->PresContext() == aFrame2->PresContext()) { - commonAncestor = aFrame1->PresContext()->PresShell()->GetRootFrame(); - } - for (nsIFrame* f = aFrame1; f != commonAncestor; - f = nsLayoutUtils::GetCrossDocParentFrame(f)) { - ancestors1.AppendElement(f); - } - for (nsIFrame* f = aFrame2; f != commonAncestor; - f = nsLayoutUtils::GetCrossDocParentFrame(f)) { - ancestors2.AppendElement(f); - } - uint32_t minLengths = std::min(ancestors1.Length(), ancestors2.Length()); - for (uint32_t i = 1; i <= minLengths; ++i) { - if (ancestors1[ancestors1.Length() - i] == ancestors2[ancestors2.Length() - i]) { - commonAncestor = ancestors1[ancestors1.Length() - i]; - } else { - break; - } - } - return commonAncestor; -} - -nsLayoutUtils::TransformResult -nsLayoutUtils::TransformPoints(nsIFrame* aFromFrame, nsIFrame* aToFrame, - uint32_t aPointCount, CSSPoint* aPoints) -{ - nsIFrame* nearestCommonAncestor = FindNearestCommonAncestorFrame(aFromFrame, aToFrame); - if (!nearestCommonAncestor) { - return NO_COMMON_ANCESTOR; - } - gfx3DMatrix downToDest = GetTransformToAncestor(aToFrame, nearestCommonAncestor); - if (downToDest.IsSingular()) { - return NONINVERTIBLE_TRANSFORM; - } - downToDest.Invert(); - gfx3DMatrix upToAncestor = GetTransformToAncestor(aFromFrame, nearestCommonAncestor); - CSSToLayoutDeviceScale devPixelsPerCSSPixelFromFrame( - double(nsPresContext::AppUnitsPerCSSPixel())/ - aFromFrame->PresContext()->AppUnitsPerDevPixel()); - CSSToLayoutDeviceScale devPixelsPerCSSPixelToFrame( - double(nsPresContext::AppUnitsPerCSSPixel())/ - aToFrame->PresContext()->AppUnitsPerDevPixel()); - for (uint32_t i = 0; i < aPointCount; ++i) { - LayoutDevicePoint devPixels = aPoints[i] * devPixelsPerCSSPixelFromFrame; - gfxPoint toDevPixels = downToDest.ProjectPoint( - upToAncestor.ProjectPoint(gfxPoint(devPixels.x, devPixels.y))); - // Divide here so that when the devPixelsPerCSSPixels are the same, we get the correct - // answer instead of some inaccuracy multiplying a number by its reciprocal. - aPoints[i] = LayoutDevicePoint(toDevPixels.x, toDevPixels.y) / - devPixelsPerCSSPixelToFrame; - } - return TRANSFORM_SUCCEEDED; -} - bool nsLayoutUtils::GetLayerTransformForFrame(nsIFrame* aFrame, gfx3DMatrix* aTransform) @@ -2660,43 +2600,6 @@ nsLayoutUtils::GetAllInFlowBoxes(nsIFrame* aFrame, BoxCallback* aCallback) } } -nsIFrame* -nsLayoutUtils::GetFirstNonAnonymousFrame(nsIFrame* aFrame) -{ - while (aFrame) { - nsIAtom* pseudoType = aFrame->StyleContext()->GetPseudo(); - - if (pseudoType == nsCSSAnonBoxes::tableOuter) { - nsIFrame* f = GetFirstNonAnonymousFrame(aFrame->GetFirstPrincipalChild()); - if (f) { - return f; - } - nsIFrame* kid = aFrame->GetFirstChild(nsIFrame::kCaptionList); - if (kid) { - f = GetFirstNonAnonymousFrame(kid); - if (f) { - return f; - } - } - } else if (pseudoType == nsCSSAnonBoxes::mozAnonymousBlock || - pseudoType == nsCSSAnonBoxes::mozAnonymousPositionedBlock || - pseudoType == nsCSSAnonBoxes::mozMathMLAnonymousBlock || - pseudoType == nsCSSAnonBoxes::mozXULAnonymousBlock) { - for (nsIFrame* kid = aFrame->GetFirstPrincipalChild(); kid; kid = kid->GetNextSibling()) { - nsIFrame* f = GetFirstNonAnonymousFrame(kid); - if (f) { - return f; - } - } - } else { - return aFrame; - } - - aFrame = nsLayoutUtils::GetNextContinuationOrIBSplitSibling(aFrame); - } - return nullptr; -} - struct BoxToRect : public nsLayoutUtils::BoxCallback { nsIFrame* mRelativeTo; nsLayoutUtils::RectCallback* mCallback; diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index ab5d6a9a482d..0b6ca91ca306 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -6,29 +6,6 @@ #ifndef nsLayoutUtils_h__ #define nsLayoutUtils_h__ -#include "mozilla/MemoryReporting.h" -#include "nsChangeHint.h" -#include "nsAutoPtr.h" -#include "nsFrameList.h" -#include "nsThreadUtils.h" -#include "nsIPrincipal.h" -#include "GraphicsFilter.h" -#include "nsCSSPseudoElements.h" -#include "FrameMetrics.h" -#include "gfx3DMatrix.h" -#include "nsIWidget.h" -#include "nsCSSProperty.h" -#include "nsStyleCoord.h" -#include "nsStyleConsts.h" -#include "nsGkAtoms.h" -#include "nsRuleNode.h" -#include "imgIContainer.h" -#include "mozilla/gfx/2D.h" -#include "Units.h" - -#include -#include - class nsIFormControlFrame; class nsPresContext; class nsIContent; @@ -53,11 +30,32 @@ class gfxContext; class nsPIDOMWindow; class imgIRequest; class nsIDocument; -class gfxPoint; struct nsStyleFont; struct nsStyleImageOrientation; struct nsOverflowAreas; +#include "mozilla/MemoryReporting.h" +#include "nsChangeHint.h" +#include "nsAutoPtr.h" +#include "nsFrameList.h" +#include "nsThreadUtils.h" +#include "nsIPrincipal.h" +#include "GraphicsFilter.h" +#include "nsCSSPseudoElements.h" +#include "FrameMetrics.h" +#include "gfx3DMatrix.h" +#include "nsIWidget.h" +#include "nsCSSProperty.h" +#include "nsStyleCoord.h" +#include "nsStyleConsts.h" +#include "nsGkAtoms.h" +#include "nsRuleNode.h" +#include "imgIContainer.h" +#include "mozilla/gfx/2D.h" + +#include +#include + namespace mozilla { class SVGImageContext; struct IntrinsicSize; @@ -109,7 +107,6 @@ class nsLayoutUtils public: typedef mozilla::layers::FrameMetrics FrameMetrics; typedef FrameMetrics::ViewID ViewID; - typedef mozilla::CSSPoint CSSPoint; /** * Finds previously assigned ViewID for the given content element, if any. @@ -686,24 +683,6 @@ public: */ static gfx3DMatrix GetTransformToAncestor(nsIFrame *aFrame, const nsIFrame *aAncestor); - /** - * Transforms a list of CSSPoints from aFromFrame to aToFrame, taking into - * account all relevant transformations on the frames up to (but excluding) - * their nearest common ancestor. - * If we encounter a transform that we need to invert but which is - * non-invertible, we return NONINVERTIBLE_TRANSFORM. If the frames have - * no common ancestor, we return NO_COMMON_ANCESTOR. - * If this returns TRANSFORM_SUCCEEDED, the points in aPoints are transformed - * in-place, otherwise they are untouched. - */ - enum TransformResult { - TRANSFORM_SUCCEEDED, - NO_COMMON_ANCESTOR, - NONINVERTIBLE_TRANSFORM - }; - static TransformResult TransformPoints(nsIFrame* aFromFrame, nsIFrame* aToFrame, - uint32_t aPointCount, CSSPoint* aPoints); - /** * Return true if a "layer transform" could be computed for aFrame, * and optionally return the computed transform. The returned @@ -904,12 +883,6 @@ public: */ static void GetAllInFlowBoxes(nsIFrame* aFrame, BoxCallback* aCallback); - /** - * Find the first frame descendant of aFrame (including aFrame) which is - * not an anonymous frame that getBoxQuads/getClientRects should ignore. - */ - static nsIFrame* GetFirstNonAnonymousFrame(nsIFrame* aFrame); - class RectCallback { public: virtual void AddRect(const nsRect& aRect) = 0;