Bug 1285235 - Use fully qualified inner types instead of casting; r=emilio
authorManish Goregaokar <manishearth@gmail.com>
Tue, 12 Jul 2016 13:40:39 +0530
changeset 330083 bb82d8367ebe9dfdc78eee1b770d986a7f7de073
parent 330082 f1584e420e6e5214ff19f18a72a0824fdfe411da
child 330084 1f46363545f03eeeaee0fbe534e6c751e7603ab6
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersemilio
bugs1285235
milestone50.0a1
Bug 1285235 - Use fully qualified inner types instead of casting; r=emilio
layout/style/ServoBindings.cpp
layout/style/ServoBindings.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -566,19 +566,19 @@ Gecko_EnsureTArrayCapacity(void* aArray,
   auto base = reinterpret_cast<nsTArray_base<nsTArrayInfallibleAllocator, nsTArray_CopyWithMemutils> *>(aArray);
   base->EnsureCapacity<nsTArrayInfallibleAllocator>(aCapacity, aElemSize);
 }
 
 void Gecko_EnsureImageLayersLength(nsStyleImageLayers* aLayers, size_t aLen) {
   aLayers->mLayers.EnsureLengthAtLeast(aLen);
 }
 
-void Gecko_InitializeImageLayer(nsStyleImageLayers_Layer* aLayer, uint8_t aLayerType) {
-  auto layer = reinterpret_cast<nsStyleImageLayers::Layer*>(aLayer);
-  layer->Initialize(static_cast<nsStyleImageLayers::LayerType>(aLayerType));
+void Gecko_InitializeImageLayer(nsStyleImageLayers::Layer* aLayer,
+                                nsStyleImageLayers::LayerType aLayerType) {
+  aLayer->Initialize(aLayerType);
 }
 
 #define STYLE_STRUCT(name, checkdata_cb)                                      \
                                                                               \
 void                                                                          \
 Gecko_Construct_nsStyle##name(nsStyle##name* ptr)                             \
 {                                                                             \
   new (ptr) nsStyle##name(StyleStructContext::ServoContext());                \
--- a/layout/style/ServoBindings.h
+++ b/layout/style/ServoBindings.h
@@ -4,16 +4,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_ServoBindings_h
 #define mozilla_ServoBindings_h
 
 #include "stdint.h"
 #include "nsColor.h"
+#include "nsStyleStruct.h"
 #include "mozilla/css/SheetParsingMode.h"
 #include "nsProxyRelease.h"
 
 /*
  * API for Servo to access Gecko data structures. This file must compile as valid
  * C code in order for the binding generator to parse it.
  *
  * Functions beginning with Gecko_ are implemented in Gecko and invoked from Servo.
@@ -39,18 +40,16 @@ class nsIDocument;
 typedef nsIDocument RawGeckoDocument;
 struct ServoNodeData;
 struct ServoComputedValues;
 struct RawServoStyleSheet;
 struct RawServoStyleSet;
 class nsHTMLCSSStyleSheet;
 struct nsStyleList;
 struct nsStyleImage;
-struct nsStyleImageLayers;
-struct nsStyleImageLayers_Layer;
 struct nsStyleGradientStop;
 class nsStyleGradient;
 class nsStyleCoord;
 struct nsStyleDisplay;
 struct ServoDeclarationBlock;
 
 #define NS_DECL_THREADSAFE_FFI_REFCOUNTING(class_, name_)                     \
   void Gecko_AddRef##name_##ArbitraryThread(class_* aPtr);                    \
@@ -186,18 +185,19 @@ void Gecko_UnsetNodeFlags(RawGeckoNode* 
 // `array` must be an nsTArray
 // If changing this signature, please update the
 // friend function declaration in nsTArray.h
 void Gecko_EnsureTArrayCapacity(void* array, size_t capacity, size_t elem_size);
 
 
 void Gecko_EnsureImageLayersLength(nsStyleImageLayers* layers, size_t len);
 
-// fill_type is a nsStyleImageLayers::LayerType
-void Gecko_InitializeImageLayer(nsStyleImageLayers_Layer* layer, uint8_t layer_type);
+void Gecko_InitializeImageLayer(nsStyleImageLayers::Layer* layer,
+                                nsStyleImageLayers::LayerType layer_type);
+
 // Styleset and Stylesheet management.
 //
 // TODO: Make these return already_AddRefed and UniquePtr when the binding
 // generator is smart enough to handle them.
 RawServoStyleSheet* Servo_StylesheetFromUTF8Bytes(
     const uint8_t* bytes, uint32_t length,
     mozilla::css::SheetParsingMode parsing_mode,
     ThreadSafeURIHolder* base,