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

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

Issue 1477393003: Use LayoutUnit in NinePieceImage drawing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase on top of leviw's sub-pixel changes Created 5 years 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
Index: third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp
diff --git a/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp b/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp
index b59320dcaa719ad9b4f8285df0a6cdf38b6fd002..d1cfda54ca605de0872aeda15cfe37d22655e656 100644
--- a/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp
+++ b/third_party/WebKit/Source/core/paint/NinePieceImageGrid.cpp
@@ -9,7 +9,6 @@
#include "core/style/NinePieceImage.h"
#include "platform/LengthFunctions.h"
#include "platform/geometry/FloatSize.h"
-#include "platform/geometry/IntSize.h"
namespace blink {
@@ -28,7 +27,7 @@ static int computeEdgeSlice(const Length& slice, LayoutUnit maximum)
return std::min<int>(maximum, valueForLength(slice, maximum));
}
-NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& ninePieceImage, IntSize imageSize, IntRect borderImageArea,
+NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& ninePieceImage, LayoutSize imageSize, LayoutRect borderImageArea,
const IntRectOutsets& borderWidths)
: m_borderImageArea(borderImageArea)
, m_imageSize(imageSize)
@@ -71,7 +70,7 @@ NinePieceImageGrid::NinePieceImageGrid(const NinePieceImage& ninePieceImage, Int
// Given a rectangle, construct a subrectangle using offset, width and height. Negative offsets are relative to the
// extent of the given rectangle.
-static FloatRect subrect(IntRect rect, float offsetX, float offsetY, float width, float height)
+static FloatRect subrect(LayoutRect rect, float offsetX, float offsetY, float width, float height)
{
float baseX = rect.x();
if (offsetX < 0)
@@ -84,9 +83,9 @@ static FloatRect subrect(IntRect rect, float offsetX, float offsetY, float width
return FloatRect(baseX + offsetX, baseY + offsetY, width, height);
}
-static FloatRect subrect(IntSize size, float offsetX, float offsetY, float width, float height)
+static FloatRect subrect(LayoutSize size, float offsetX, float offsetY, float width, float height)
{
- return subrect(IntRect(IntPoint(), size), offsetX, offsetY, width, height);
+ return subrect(LayoutRect(LayoutPoint(), size), offsetX, offsetY, width, height);
}
static inline void setCornerPiece(NinePieceImageGrid::NinePieceDrawInfo& drawInfo, bool isDrawable,
@@ -156,8 +155,8 @@ static inline void setVerticalEdge(NinePieceImageGrid::NinePieceDrawInfo& drawIn
void NinePieceImageGrid::setDrawInfoEdge(NinePieceDrawInfo& drawInfo, NinePiece piece) const
{
- IntSize edgeSourceSize = m_imageSize - IntSize(m_left.slice + m_right.slice, m_top.slice + m_bottom.slice);
- IntSize edgeDestinationSize = m_borderImageArea.size() - IntSize(m_left.width + m_right.width, m_top.width + m_bottom.width);
+ LayoutSize edgeSourceSize = m_imageSize - LayoutSize(m_left.slice + m_right.slice, m_top.slice + m_bottom.slice);
+ LayoutSize edgeDestinationSize = m_borderImageArea.size() - LayoutSize(m_left.width + m_right.width, m_top.width + m_bottom.width);
switch (piece) {
case LeftPiece:
@@ -192,9 +191,9 @@ void NinePieceImageGrid::setDrawInfoEdge(NinePieceDrawInfo& drawInfo, NinePiece
void NinePieceImageGrid::setDrawInfoMiddle(NinePieceDrawInfo& drawInfo) const
{
- IntSize sourceSize = m_imageSize - IntSize(m_left.slice + m_right.slice, m_top.slice + m_bottom.slice);
- IntSize destinationSize =
- m_borderImageArea.size() - IntSize(m_left.width + m_right.width, m_top.width + m_bottom.width);
+ LayoutSize sourceSize = m_imageSize - LayoutSize(m_left.slice + m_right.slice, m_top.slice + m_bottom.slice);
+ LayoutSize destinationSize =
+ m_borderImageArea.size() - LayoutSize(m_left.width + m_right.width, m_top.width + m_bottom.width);
drawInfo.isDrawable = m_fill && !sourceSize.isEmpty() && !destinationSize.isEmpty();
if (!drawInfo.isDrawable)

Powered by Google App Engine
This is Rietveld 408576698