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

Side by Side Diff: Source/core/rendering/RenderBoxModelObject.cpp

Issue 24066007: Mask/background-repeat: round should round the number of tiles of an image to the nearest natural n… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Added round function instead of roundToInt Created 7 years, 3 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 unified diff | Download patch
« no previous file with comments | « LayoutTests/css3/masking/mask-repeat-round-padding-expected.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) 3 * (C) 1999 Antti Koivisto (koivisto@kde.org)
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
7 * Copyright (C) 2010 Google Inc. All rights reserved. 7 * Copyright (C) 2010 Google Inc. All rights reserved.
8 * 8 *
9 * This library is free software; you can redistribute it and/or 9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public 10 * modify it under the terms of the GNU Library General Public
(...skipping 1044 matching lines...) Expand 10 before | Expand all | Expand 10 after
1055 geometry.setTileSize(fillTileSize); 1055 geometry.setTileSize(fillTileSize);
1056 1056
1057 EFillRepeat backgroundRepeatX = fillLayer->repeatX(); 1057 EFillRepeat backgroundRepeatX = fillLayer->repeatX();
1058 EFillRepeat backgroundRepeatY = fillLayer->repeatY(); 1058 EFillRepeat backgroundRepeatY = fillLayer->repeatY();
1059 RenderView* renderView = view(); 1059 RenderView* renderView = view();
1060 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width (); 1060 int availableWidth = positioningAreaSize.width() - geometry.tileSize().width ();
1061 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei ght(); 1061 int availableHeight = positioningAreaSize.height() - geometry.tileSize().hei ght();
1062 1062
1063 LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, renderView, true); 1063 LayoutUnit computedXPosition = minimumValueForLength(fillLayer->xPosition(), availableWidth, renderView, true);
1064 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fil lTileSize.width() > 0) { 1064 if (backgroundRepeatX == RoundFill && positioningAreaSize.width() > 0 && fil lTileSize.width() > 0) {
1065 int nrTiles = ceil((double)positioningAreaSize.width() / 1065 int nrTiles = static_cast<int>(round((float)positioningAreaSize.width() / fillTileSize.width()));
eseidel 2013/09/17 15:48:44 We don't have a helper function do to this for us?
Julien - ping for review 2013/09/17 16:26:27 lround would do the trick (or lroundf if we want t
1066 fillTileSize.width());
1067 1066
1068 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != Rou ndFill) { 1067 if (fillLayer->size().size.height().isAuto() && backgroundRepeatY != Rou ndFill) {
1069 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w idth() / (nrTiles * fillTileSize.width())); 1068 fillTileSize.setHeight(fillTileSize.height() * positioningAreaSize.w idth() / (nrTiles * fillTileSize.width()));
1070 } 1069 }
1071 1070
1072 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles); 1071 fillTileSize.setWidth(positioningAreaSize.width() / nrTiles);
1073 geometry.setTileSize(fillTileSize); 1072 geometry.setTileSize(fillTileSize);
1074 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0); 1073 geometry.setPhaseX(geometry.tileSize().width() ? geometry.tileSize().wid th() - roundToInt(computedXPosition + left) % geometry.tileSize().width() : 0);
1075 } 1074 }
1076 1075
1077 LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, renderView, true); 1076 LayoutUnit computedYPosition = minimumValueForLength(fillLayer->yPosition(), availableHeight, renderView, true);
1078 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fi llTileSize.height() > 0) { 1077 if (backgroundRepeatY == RoundFill && positioningAreaSize.height() > 0 && fi llTileSize.height() > 0) {
1079 int nrTiles = ceil((double)positioningAreaSize.height() / 1078 int nrTiles = static_cast<int>(round((float)positioningAreaSize.height() / fillTileSize.height()));
1080 fillTileSize.height());
1081 1079
1082 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != Roun dFill) { 1080 if (fillLayer->size().size.width().isAuto() && backgroundRepeatX != Roun dFill) {
1083 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei ght() / (nrTiles * fillTileSize.height())); 1081 fillTileSize.setWidth(fillTileSize.width() * positioningAreaSize.hei ght() / (nrTiles * fillTileSize.height()));
1084 } 1082 }
1085 1083
1086 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles); 1084 fillTileSize.setHeight(positioningAreaSize.height() / nrTiles);
1087 geometry.setTileSize(fillTileSize); 1085 geometry.setTileSize(fillTileSize);
1088 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ; 1086 geometry.setPhaseY(geometry.tileSize().height() ? geometry.tileSize().he ight() - roundToInt(computedYPosition + top) % geometry.tileSize().height() : 0) ;
1089 } 1087 }
1090 1088
(...skipping 1695 matching lines...) Expand 10 before | Expand all | Expand 10 after
2786 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent()); 2784 ASSERT(!beforeChild || toBoxModelObject == beforeChild->parent());
2787 for (RenderObject* child = startChild; child && child != endChild; ) { 2785 for (RenderObject* child = startChild; child && child != endChild; ) {
2788 // Save our next sibling as moveChildTo will clear it. 2786 // Save our next sibling as moveChildTo will clear it.
2789 RenderObject* nextSibling = child->nextSibling(); 2787 RenderObject* nextSibling = child->nextSibling();
2790 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert); 2788 moveChildTo(toBoxModelObject, child, beforeChild, fullRemoveInsert);
2791 child = nextSibling; 2789 child = nextSibling;
2792 } 2790 }
2793 } 2791 }
2794 2792
2795 } // namespace WebCore 2793 } // namespace WebCore
OLDNEW
« no previous file with comments | « LayoutTests/css3/masking/mask-repeat-round-padding-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698