Commit 7cbc7f49 authored by Stephen Chenney's avatar Stephen Chenney Committed by Commit Bot

[image-orientation] Fix background-position

An error introduced in a previous patch caused
background-position calculations to be broken due
to incorrect source rect transforms. Fix it and
add a more thorough test. The test fails pending
fuzzy matching in Chrome.

Bug: 1108698
Change-Id: Iabdc332474daa0c5dc4aeb61df338c6028212c65
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2365914
Commit-Queue: Stephen Chenney <schenney@chromium.org>
Reviewed-by: default avatarFredrik Söderquist <fs@opera.com>
Cr-Commit-Position: refs/heads/master@{#800083}
parent 904ec13a
...@@ -441,7 +441,7 @@ void DrawTiledBackground(GraphicsContext& context, ...@@ -441,7 +441,7 @@ void DrawTiledBackground(GraphicsContext& context,
// src rect rotation if necessary. // src rect rotation if necessary.
if (respect_orientation && !image->HasDefaultOrientation()) { if (respect_orientation && !image->HasDefaultOrientation()) {
visible_src_rect = image->CorrectSrcRectForImageOrientation( visible_src_rect = image->CorrectSrcRectForImageOrientation(
visible_src_rect.Size(), visible_src_rect); intrinsic_tile_size, visible_src_rect);
} }
context.DrawImage(image, Image::kSyncDecode, snapped_paint_rect, context.DrawImage(image, Image::kSyncDecode, snapped_paint_rect,
...@@ -604,7 +604,7 @@ inline bool PaintFastBottomLayer(Node* node, ...@@ -604,7 +604,7 @@ inline bool PaintFastBottomLayer(Node* node,
// rect rotation if necessaary. // rect rotation if necessaary.
if (info.respect_image_orientation && !image->HasDefaultOrientation()) { if (info.respect_image_orientation && !image->HasDefaultOrientation()) {
src_rect = src_rect =
image->CorrectSrcRectForImageOrientation(src_rect.Size(), src_rect); image->CorrectSrcRectForImageOrientation(intrinsic_tile_size, src_rect);
} }
TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage", TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "PaintImage",
......
...@@ -345,6 +345,7 @@ crbug.com/997202 external/wpt/css/css-images/image-orientation/image-orientation ...@@ -345,6 +345,7 @@ crbug.com/997202 external/wpt/css/css-images/image-orientation/image-orientation
crbug.com/997202 external/wpt/css/css-images/image-orientation/svg-image-orientation.html [ Failure ] crbug.com/997202 external/wpt/css/css-images/image-orientation/svg-image-orientation.html [ Failure ]
crbug.com/997202 external/wpt/css/css-images/image-orientation/svg-image-orientation-none.html [ Failure ] crbug.com/997202 external/wpt/css/css-images/image-orientation/svg-image-orientation-none.html [ Failure ]
crbug.com/997202 external/wpt/css/css-images/image-orientation/svg-image-orientation-aspect-ratio.html [ Failure ] crbug.com/997202 external/wpt/css/css-images/image-orientation/svg-image-orientation-aspect-ratio.html [ Failure ]
crbug.com/997202 external/wpt/css/css-images/image-orientation/image-orientation-background-position.html [ Failure ]
# Ref results are wrong on the background and list case, not sure on border result # Ref results are wrong on the background and list case, not sure on border result
crbug.com/1076121 external/wpt/css/css-images/image-orientation/image-orientation-list-style-image.html [ Failure ] crbug.com/1076121 external/wpt/css/css-images/image-orientation/image-orientation-list-style-image.html [ Failure ]
......
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Images Module Level 3: image-orientation with background positions</title>
<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
<link rel="match" href="reference/image-orientation-background-position-ref.html">
<meta name="fuzzy" content="10;100">
<style>
.exif-2 {
position: absolute;
top: 10px;
left: 10px;
width: 50px;
height: 50PX;
background-color: grey;
background-image: url(support/exif-orientation-2-ur.jpg);
background-repeat: no-repeat;
background-position: -30px -20px;
}
.exif-6 {
position: absolute;
top: 10px;
left: 70px;
width: 50px;
height: 50PX;
background-color: grey;
background-image: url(support/exif-orientation-6-ru.jpg);
background-repeat: no-repeat;
background-position: -20px -30px;
}
</style>
</head>
<body>
<div class="exif-2">
</div>
<div class="exif-6">
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Images Module Level 3: image-orientation with background positions reference</title>
<link rel="author" title="Stephen Chenney" href="mailto:schenney@chromium.org">
<link rel="help" href="https://drafts.csswg.org/css-images-3/#propdef-image-orientation">
<style>
.exif-2 {
position: absolute;
top: 10px;
left: 10px;
width: 50px;
height: 50PX;
background-color: grey;
background-image: url(../support/exif-orientation-2-ur-pre-rotated.jpg);
background-repeat: no-repeat;
background-position: -30px -20px;
}
.exif-6 {
position: absolute;
top: 10px;
left: 70px;
width: 50px;
height: 50PX;
background-color: grey;
background-image: url(../support/exif-orientation-6-ru-pre-rotated.jpg);
background-repeat: no-repeat;
background-position: -20px -30px;
}
</style>
</head>
<body>
<div class="exif-2">
</div>
<div class="exif-6">
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment