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

Unified Diff: Source/core/rendering/style/NinePieceImage.h

Issue 55783002: Introduce BorderImageLength and BorderImageLengthBox (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moved BorderImageLength{,Box} to core/rendering/style Created 7 years, 1 month 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 | « Source/core/rendering/style/BorderImageLengthBox.h ('k') | Source/core/rendering/style/NinePieceImage.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/style/NinePieceImage.h
diff --git a/Source/core/rendering/style/NinePieceImage.h b/Source/core/rendering/style/NinePieceImage.h
index 3bf40c17408d06ddc4a73ae394bc46cb984a2154..5ba5124038622e5f4d2da47568d14db3b0b48d6a 100644
--- a/Source/core/rendering/style/NinePieceImage.h
+++ b/Source/core/rendering/style/NinePieceImage.h
@@ -24,6 +24,7 @@
#ifndef NinePieceImage_h
#define NinePieceImage_h
+#include "core/rendering/style/BorderImageLengthBox.h"
#include "core/rendering/style/DataRef.h"
#include "core/rendering/style/StyleImage.h"
#include "platform/LayoutUnit.h"
@@ -48,8 +49,8 @@ public:
unsigned verticalRule : 2; // ENinePieceImageRule
RefPtr<StyleImage> image;
LengthBox imageSlices;
- LengthBox borderSlices;
- LengthBox outset;
+ BorderImageLengthBox borderSlices;
+ BorderImageLengthBox outset;
private:
NinePieceImageData();
@@ -59,7 +60,8 @@ private:
class NinePieceImage {
public:
NinePieceImage();
- NinePieceImage(PassRefPtr<StyleImage>, LengthBox imageSlices, bool fill, LengthBox borderSlices, LengthBox outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
+ NinePieceImage(PassRefPtr<StyleImage>, LengthBox imageSlices, bool fill, const BorderImageLengthBox& borderSlices,
+ const BorderImageLengthBox& outset, ENinePieceImageRule horizontalRule, ENinePieceImageRule verticalRule);
bool operator==(const NinePieceImage& other) const { return m_data == other.m_data; }
bool operator!=(const NinePieceImage& other) const { return m_data != other.m_data; }
@@ -74,11 +76,11 @@ public:
bool fill() const { return m_data->fill; }
void setFill(bool fill) { m_data.access()->fill = fill; }
- const LengthBox& borderSlices() const { return m_data->borderSlices; }
- void setBorderSlices(const LengthBox& slices) { m_data.access()->borderSlices = slices; }
+ const BorderImageLengthBox& borderSlices() const { return m_data->borderSlices; }
+ void setBorderSlices(const BorderImageLengthBox& slices) { m_data.access()->borderSlices = slices; }
- const LengthBox& outset() const { return m_data->outset; }
- void setOutset(const LengthBox& outset) { m_data.access()->outset = outset; }
+ const BorderImageLengthBox& outset() const { return m_data->outset; }
+ void setOutset(const BorderImageLengthBox& outset) { m_data.access()->outset = outset; }
ENinePieceImageRule horizontalRule() const { return static_cast<ENinePieceImageRule>(m_data->horizontalRule); }
void setHorizontalRule(ENinePieceImageRule rule) { m_data.access()->horizontalRule = rule; }
@@ -112,14 +114,14 @@ public:
{
m_data.access()->imageSlices = LengthBox(0);
m_data.access()->fill = true;
- m_data.access()->borderSlices = LengthBox();
+ m_data.access()->borderSlices = BorderImageLengthBox();
}
- static LayoutUnit computeOutset(Length outsetSide, LayoutUnit borderSide)
+ static LayoutUnit computeOutset(const BorderImageLength& outsetSide, LayoutUnit borderSide)
{
- if (outsetSide.isRelative())
- return outsetSide.value() * borderSide;
- return outsetSide.value();
+ if (outsetSide.isNumber())
+ return outsetSide.number() * borderSide;
+ return outsetSide.length().value();
}
private:
« no previous file with comments | « Source/core/rendering/style/BorderImageLengthBox.h ('k') | Source/core/rendering/style/NinePieceImage.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698