Bug 1614208 - Stop including nsStyleConsts.h from WebRenderTypes.h. r=jrmuizel

This is another one which is included everywhere. If the OOL call mattered we
could move these to a different header or something, but I suspect it won't.

Differential Revision: https://phabricator.services.mozilla.com/D62173
This commit is contained in:
Emilio Cobos Álvarez
2020-02-11 01:23:41 +00:00
parent 3feee5b0af
commit 2d51a07ab4
3 changed files with 53 additions and 46 deletions

View File

@@ -7,6 +7,7 @@
#include "WebRenderTypes.h" #include "WebRenderTypes.h"
#include "mozilla/ipc/ByteBuf.h" #include "mozilla/ipc/ByteBuf.h"
#include "nsStyleConsts.h"
namespace mozilla { namespace mozilla {
namespace wr { namespace wr {
@@ -19,6 +20,51 @@ WindowId NewWindowId() {
return id; return id;
} }
BorderStyle ToBorderStyle(StyleBorderStyle aStyle) {
switch (aStyle) {
case StyleBorderStyle::None:
return wr::BorderStyle::None;
case StyleBorderStyle::Solid:
return wr::BorderStyle::Solid;
case StyleBorderStyle::Double:
return wr::BorderStyle::Double;
case StyleBorderStyle::Dotted:
return wr::BorderStyle::Dotted;
case StyleBorderStyle::Dashed:
return wr::BorderStyle::Dashed;
case StyleBorderStyle::Hidden:
return wr::BorderStyle::Hidden;
case StyleBorderStyle::Groove:
return wr::BorderStyle::Groove;
case StyleBorderStyle::Ridge:
return wr::BorderStyle::Ridge;
case StyleBorderStyle::Inset:
return wr::BorderStyle::Inset;
case StyleBorderStyle::Outset:
return wr::BorderStyle::Outset;
default:
MOZ_ASSERT(false);
}
return wr::BorderStyle::None;
}
wr::RepeatMode ToRepeatMode(StyleBorderImageRepeat aRepeat) {
switch (aRepeat) {
case StyleBorderImageRepeat::Stretch:
return wr::RepeatMode::Stretch;
case StyleBorderImageRepeat::Repeat:
return wr::RepeatMode::Repeat;
case StyleBorderImageRepeat::Round:
return wr::RepeatMode::Round;
case StyleBorderImageRepeat::Space:
return wr::RepeatMode::Space;
default:
MOZ_ASSERT(false);
}
return wr::RepeatMode::Stretch;
}
void Assign_WrVecU8(wr::WrVecU8& aVec, mozilla::ipc::ByteBuf&& aOther) { void Assign_WrVecU8(wr::WrVecU8& aVec, mozilla::ipc::ByteBuf&& aOther) {
aVec.data = aOther.mData; aVec.data = aOther.mData;
aVec.length = aOther.mLen; aVec.length = aOther.mLen;

View File

@@ -21,10 +21,12 @@
#include "mozilla/TypeTraits.h" #include "mozilla/TypeTraits.h"
#include "mozilla/Variant.h" #include "mozilla/Variant.h"
#include "Units.h" #include "Units.h"
#include "nsStyleConsts.h"
namespace mozilla { namespace mozilla {
enum class StyleBorderStyle : uint8_t;
enum class StyleBorderImageRepeat : uint8_t;
namespace ipc { namespace ipc {
class ByteBuf; class ByteBuf;
} // namespace ipc } // namespace ipc
@@ -539,36 +541,10 @@ static inline wr::LayoutTransform ToLayoutTransform(
return transform; return transform;
} }
static inline wr::BorderStyle ToBorderStyle(const StyleBorderStyle& style) { wr::BorderStyle ToBorderStyle(StyleBorderStyle style);
switch (style) {
case StyleBorderStyle::None:
return wr::BorderStyle::None;
case StyleBorderStyle::Solid:
return wr::BorderStyle::Solid;
case StyleBorderStyle::Double:
return wr::BorderStyle::Double;
case StyleBorderStyle::Dotted:
return wr::BorderStyle::Dotted;
case StyleBorderStyle::Dashed:
return wr::BorderStyle::Dashed;
case StyleBorderStyle::Hidden:
return wr::BorderStyle::Hidden;
case StyleBorderStyle::Groove:
return wr::BorderStyle::Groove;
case StyleBorderStyle::Ridge:
return wr::BorderStyle::Ridge;
case StyleBorderStyle::Inset:
return wr::BorderStyle::Inset;
case StyleBorderStyle::Outset:
return wr::BorderStyle::Outset;
default:
MOZ_ASSERT(false);
}
return wr::BorderStyle::None;
}
static inline wr::BorderSide ToBorderSide(const gfx::Color& color, static inline wr::BorderSide ToBorderSide(const gfx::Color& color,
const StyleBorderStyle& style) { StyleBorderStyle style) {
wr::BorderSide bs; wr::BorderSide bs;
bs.color = ToColorF(color); bs.color = ToColorF(color);
bs.style = ToBorderStyle(style); bs.style = ToBorderStyle(style);
@@ -649,23 +625,7 @@ static inline wr::LayoutSideOffsets ToLayoutSideOffsets(float top, float right,
return offset; return offset;
} }
static inline wr::RepeatMode ToRepeatMode( wr::RepeatMode ToRepeatMode(StyleBorderImageRepeat);
mozilla::StyleBorderImageRepeat repeatMode) {
switch (repeatMode) {
case mozilla::StyleBorderImageRepeat::Stretch:
return wr::RepeatMode::Stretch;
case mozilla::StyleBorderImageRepeat::Repeat:
return wr::RepeatMode::Repeat;
case mozilla::StyleBorderImageRepeat::Round:
return wr::RepeatMode::Round;
case mozilla::StyleBorderImageRepeat::Space:
return wr::RepeatMode::Space;
default:
MOZ_ASSERT(false);
}
return wr::RepeatMode::Stretch;
}
template <class S, class T> template <class S, class T>
static inline wr::WrTransformProperty ToWrTransformProperty( static inline wr::WrTransformProperty ToWrTransformProperty(

View File

@@ -37,6 +37,7 @@
// for painting the background window // for painting the background window
#include "mozilla/LookAndFeel.h" #include "mozilla/LookAndFeel.h"
#include "mozilla/ServoStyleConsts.h"
// Printing Includes // Printing Includes
#ifdef NS_PRINTING #ifdef NS_PRINTING