Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(577)

Unified Diff: third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp

Issue 2874203002: Tweaking how background images interact with sub pixel borders. *** NOT FOR LANDING
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
diff --git a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
index 41c0b148ca7bd05287de48a2787909a569a2a56f..14ec0a3ee1b002fa1625233b2801dc8199caa147 100644
--- a/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
+++ b/third_party/WebKit/Source/core/paint/BackgroundImageGeometry.cpp
@@ -467,15 +467,19 @@ void BackgroundImageGeometry::Calculate(
LayoutUnit bottom;
// Scroll and Local.
if (fill_layer.Origin() != kBorderFillBox) {
- left = LayoutUnit(positioning_box.BorderLeft());
- right = LayoutUnit(positioning_box.BorderRight());
- top = LayoutUnit(positioning_box.BorderTop());
- bottom = LayoutUnit(positioning_box.BorderBottom());
+ left = LayoutUnit(positioning_box.BorderLeft().Round());
+ right = LayoutUnit(positioning_box.BorderRight().Round());
+ top = LayoutUnit(positioning_box.BorderTop().Round());
+ bottom = LayoutUnit(positioning_box.BorderBottom().Round());
if (fill_layer.Origin() == kContentFillBox) {
- left += positioning_box.PaddingLeft();
- right += positioning_box.PaddingRight();
- top += positioning_box.PaddingTop();
- bottom += positioning_box.PaddingBottom();
+ left = std::max(
+ left, positioning_box.BorderLeft() + positioning_box.PaddingLeft());
+ right = std::max(right, positioning_box.BorderRight() +
+ positioning_box.PaddingRight());
+ top = std::max(
+ top, positioning_box.BorderTop() + positioning_box.PaddingTop());
+ bottom = std::max(bottom, positioning_box.BorderBottom() +
+ positioning_box.PaddingBottom());
}
}
@@ -604,7 +608,9 @@ void BackgroundImageGeometry::Calculate(
if (background_repeat_x == kRepeatFill) {
SetRepeatX(fill_layer, fill_tile_size.Width(), available_width,
- unsnapped_available_width, left, offset_in_background.X());
+ unsnapped_available_width,
+ LayoutUnit(SnapSizeToPixel(left, dest_rect_.X())),
+ offset_in_background.X());
} else if (background_repeat_x == kSpaceFill &&
TileSize().Width() > LayoutUnit()) {
LayoutUnit space = GetSpaceBetweenImageTiles(positioning_area_size.Width(),
@@ -625,7 +631,9 @@ void BackgroundImageGeometry::Calculate(
if (background_repeat_y == kRepeatFill) {
SetRepeatY(fill_layer, fill_tile_size.Height(), available_height,
- unsnapped_available_height, top, offset_in_background.Y());
+ unsnapped_available_height,
+ LayoutUnit(SnapSizeToPixel(top, dest_rect_.Y())),
+ offset_in_background.Y());
} else if (background_repeat_y == kSpaceFill &&
TileSize().Height() > LayoutUnit()) {
LayoutUnit space = GetSpaceBetweenImageTiles(positioning_area_size.Height(),
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698