Bug 1331102 - Move #include around to avoid triggering this issue. r=heycam
authorXidorn Quan <me@upsuper.org>
Tue, 21 Feb 2017 22:27:58 +1100
changeset 373129 f872b2b4adee721a649b8dadd950d1a19403ce69
parent 373128 b819211e52a441b4edee1d32e448da80b20ee310
child 373130 5627b59436dbac71d07b98c8d1f87e74628930b9
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1331102
milestone54.0a1
Bug 1331102 - Move #include around to avoid triggering this issue. r=heycam MozReview-Commit-ID: Fx2DbUwuf0v
layout/style/moz.build
layout/style/nsStyleCoord.cpp
--- a/layout/style/moz.build
+++ b/layout/style/moz.build
@@ -143,16 +143,17 @@ EXPORTS.mozilla.css += [
     'Rule.h',
     'SheetParsingMode.h',
     'StyleRule.h',
 ]
 
 UNIFIED_SOURCES += [
     'AnimationCollection.cpp',
     'AnimationCommon.cpp',
+    'BindingStyleRule.cpp',
     'CounterStyleManager.cpp',
     'CSS.cpp',
     'CSSLexer.cpp',
     'CSSRuleList.cpp',
     'CSSStyleSheet.cpp',
     'CSSVariableDeclarations.cpp',
     'CSSVariableResolver.cpp',
     'CSSVariableValues.cpp',
@@ -203,40 +204,33 @@ UNIFIED_SOURCES += [
     'nsTransitionManager.cpp',
     'PreloadedStyleSheet.cpp',
     'RuleNodeCacheConditions.cpp',
     'RuleProcessorCache.cpp',
     'ServoBindings.cpp',
     'ServoCSSRuleList.cpp',
     'ServoDeclarationBlock.cpp',
     'ServoElementSnapshot.cpp',
+    'ServoSpecifiedValues.cpp',
     'ServoStyleRule.cpp',
     'ServoStyleSet.cpp',
     'ServoStyleSheet.cpp',
     'StyleAnimationValue.cpp',
     'StyleRule.cpp',
     'StyleSheet.cpp',
     'SVGAttrAnimationRuleProcessor.cpp',
 ]
 
-# - BindingStyleRule.cpp doesn't _really_ needs to be built separately,
-# except insofar as it shifts unified build boundaries, causing
-# Unified_cpp_layout_style4.cpp to include nsStyleCoord.cpp, which
-# includes, via nsStyleCoord.h, <type_traits>, which ends up including
-# <xutility>, which fails in much the way described in
-# <https://bugzilla.mozilla.org/show_bug.cgi?id=1331102>.
 # - nsCSSRuleProcessor.cpp needs to be built separately because it uses
 # plarena.h.
 # - nsLayoutStylesheetCache.cpp needs to be built separately because it uses
 # nsExceptionHandler.h, which includes windows.h.
 SOURCES += [
-    'BindingStyleRule.cpp',
     'nsCSSRuleProcessor.cpp',
     'nsLayoutStylesheetCache.cpp',
-    'ServoSpecifiedValues.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../base',
--- a/layout/style/nsStyleCoord.cpp
+++ b/layout/style/nsStyleCoord.cpp
@@ -1,19 +1,23 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 /* representation of length values in computed style data */
 
-#include "nsStyleCoord.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/PodOperations.h"
 
+// nsStyleCoord.h must not be the first header in a unified source file,
+// otherwise it may not build with MSVC due to a bug in our STL wrapper.
+// See bug 1331102.
+#include "nsStyleCoord.h"
+
 using namespace mozilla;
 
 nsStyleCoord::nsStyleCoord(nsStyleUnit aUnit)
   : mUnit(aUnit)
 {
   NS_ASSERTION(aUnit < eStyleUnit_Percent, "not a valueless unit");
   if (aUnit >= eStyleUnit_Percent) {
     mUnit = eStyleUnit_Null;