зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1642603 - Make TransformAndClipBounds stop discarding the corner positions of empty rectangles. r=kip
Differential Revision: https://phabricator.services.mozilla.com/D79582
This commit is contained in:
Родитель
6822e213d4
Коммит
c5cf53e63b
|
@ -122,7 +122,7 @@ Span<Point4DTyped<UnknownUnits, F>> IntersectPolygon(
|
|||
Span<Point4DTyped<UnknownUnits, F>> aPoints,
|
||||
const Point4DTyped<UnknownUnits, F>& aPlaneNormal,
|
||||
Span<Point4DTyped<UnknownUnits, F>> aDestBuffer) {
|
||||
if (aPoints.Length() < 3 || aDestBuffer.Length() < 3) {
|
||||
if (aPoints.Length() < 1 || aDestBuffer.Length() < 1) {
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
|
@ -837,10 +837,6 @@ class Matrix4x4Typed {
|
|||
size_t TransformAndClipRect(const RectTyped<SourceUnits, F>& aRect,
|
||||
const RectTyped<TargetUnits, F>& aClip,
|
||||
PointTyped<TargetUnits, F>* aVerts) const {
|
||||
if (aRect.IsEmpty() || aClip.IsEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
typedef Point4DTyped<UnknownUnits, F> P4D;
|
||||
|
||||
// The initial polygon is made up by the corners of aRect in homogenous
|
||||
|
|
|
@ -57,6 +57,14 @@ TEST(Matrix, TransformAndClipRect)
|
|||
EXPECT_TRUE(
|
||||
m2.TransformAndClipBounds(Rect(0, 0, 100, 100), Rect(1024, 1024, 0, 0))
|
||||
.IsEmpty());
|
||||
|
||||
// Empty rectangles should still have meaningful corners.
|
||||
EXPECT_TRUE(m.TransformAndClipBounds(Rect(150, 50, 0, 200), c)
|
||||
.IsEqualEdges(Rect(150, 100, 0, 100)));
|
||||
EXPECT_TRUE(m.TransformAndClipBounds(Rect(150, 150, 0, 0), c)
|
||||
.IsEqualEdges(Rect(150, 150, 0, 0)));
|
||||
EXPECT_TRUE(m.TransformAndClipBounds(Rect(150, 100, 300, 0), c)
|
||||
.IsEqualEdges(Rect(150, 100, 50, 0)));
|
||||
}
|
||||
|
||||
TEST(Matrix4x4Flagged, Mult)
|
||||
|
|
|
@ -581,7 +581,8 @@ class PresShell final : public nsStubDocumentObserver,
|
|||
* Scrolls the view of the document so that the given area of a frame
|
||||
* is visible, if possible. Layout is not flushed before scrolling.
|
||||
*
|
||||
* @param aRect relative to aFrame
|
||||
* @param aRect Relative to aFrame. The rect edges will be respected even if
|
||||
* the rect is empty.
|
||||
* @param aVertical see ScrollContentIntoView and ScrollAxis
|
||||
* @param aHorizontal see ScrollContentIntoView and ScrollAxis
|
||||
* @param aScrollFlags if SCROLL_FIRST_ANCESTOR_ONLY is set, only the
|
||||
|
|
|
@ -921,6 +921,8 @@ class nsLayoutUtils {
|
|||
* aAncestor. Computes the bounding-box of the true quadrilateral.
|
||||
* Pass non-null aPreservesAxisAlignedRectangles and it will be set to true if
|
||||
* we only need to use a 2d transform that PreservesAxisAlignedRectangles().
|
||||
* The corner positions of aRect are treated as meaningful even if aRect is
|
||||
* empty.
|
||||
*
|
||||
* |aMatrixCache| allows for optimizations in recomputing the same matrix over
|
||||
* and over. The argument can be one of the following values:
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>Reference: Bug 1642603 - scrollIntoView() should work on empty rects, even inside transforms</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
overflow: auto;
|
||||
perspective: 5px;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.absoluteElement {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
.zeroSizeBox {
|
||||
margin-left: 30px;
|
||||
width: 0;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div class="absoluteElement">
|
||||
<div class="spacer"></div>
|
||||
<p>This text should be visible.</p>
|
||||
<div class="zeroSizeBox"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.querySelector('.container').scrollTop = 1000; // scroll to the end
|
||||
</script>
|
|
@ -0,0 +1,47 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<meta charset="utf-8">
|
||||
<title>Bug 1642603 - scrollIntoView() should work on empty rects, even inside transforms</title>
|
||||
|
||||
<style>
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
overflow: auto;
|
||||
perspective: 5px;
|
||||
border: 1px solid black;
|
||||
width: 300px;
|
||||
height: 300px;
|
||||
}
|
||||
|
||||
.absoluteElement {
|
||||
transform: translateX(0);
|
||||
}
|
||||
|
||||
.spacer {
|
||||
height: 500px;
|
||||
}
|
||||
|
||||
.zeroSizeBox {
|
||||
margin-left: 30px;
|
||||
width: 0;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div class="container">
|
||||
<div class="absoluteElement">
|
||||
<div class="spacer"></div>
|
||||
<p>This text should be visible.</p>
|
||||
<div class="zeroSizeBox"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
document.querySelector('.container').scrollTop = 0;
|
||||
document.querySelector('.zeroSizeBox').scrollIntoView();
|
||||
</script>
|
|
@ -2103,3 +2103,4 @@ fuzzy(0-145,0-48536) == 1614788-1.svg 1614788-1-ref.svg # large fuzz necesary to
|
|||
fuzzy-if(OSX,0-42,0-4) fuzzy-if((Android||winWidget)&&!webrender,0-115,0-2) == 1617515-1.html 1617515-1-ref.html
|
||||
fuzzy(0-2,0-21184) == 1626259-1.html 1626259-1-ref.html
|
||||
fuzzy(0-2,0-21184) == 1626259-2.html 1626259-2-ref.html
|
||||
== 1642603-1.html 1642603-1-ref.html
|
||||
|
|
Загрузка…
Ссылка в новой задаче