forked from mirrors/gecko-dev
		
	 680815cd6e
			
		
	
	
		680815cd6e
		
	
	
	
	
		
			
			This patch was generated automatically by the "modeline.py" script, available here: https://github.com/amccreight/moz-source-tools/blob/master/modeline.py For every file that is modified in this patch, the changes are as follows: (1) The patch changes the file to use the exact C++ mode lines from the Mozilla coding style guide, available here: https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Coding_Style#Mode_Line (2) The patch deletes any blank lines between the mode line & the MPL boilerplate comment. (3) If the file previously had the mode lines and MPL boilerplate in a single contiguous C++ comment, then the patch splits them into separate C++ comments, to match the boilerplate in the coding style. MozReview-Commit-ID: EuRsDue63tK --HG-- extra : rebase_source : 3356d4b80ff6213935192e87cdbc9103fec6084c
		
			
				
	
	
		
			133 lines
		
	
	
	
		
			3.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			133 lines
		
	
	
	
		
			3.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 | |
| /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 | |
| /* 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/. */
 | |
| 
 | |
| #include "mozilla/ServoBindings.h"
 | |
| #include "mozilla/ServoSpecifiedValues.h"
 | |
| 
 | |
| namespace {
 | |
| 
 | |
| #define STYLE_STRUCT(name, checkdata_cb) | NS_STYLE_INHERIT_BIT(name)
 | |
| const uint64_t ALL_SIDS = 0
 | |
| #include "nsStyleStructList.h"
 | |
|   ;
 | |
| #undef STYLE_STRUCT
 | |
| 
 | |
| } // anonymous namespace
 | |
| 
 | |
| using namespace mozilla;
 | |
| 
 | |
| ServoSpecifiedValues::ServoSpecifiedValues(nsPresContext* aContext,
 | |
|                                            RawServoDeclarationBlock* aDecl)
 | |
| 
 | |
|   : GenericSpecifiedValues(StyleBackendType::Servo, aContext, ALL_SIDS)
 | |
|   , mDecl(aDecl)
 | |
| {}
 | |
| 
 | |
| bool
 | |
| ServoSpecifiedValues::PropertyIsSet(nsCSSPropertyID aId)
 | |
| {
 | |
|   return Servo_DeclarationBlock_PropertyIsSet(mDecl, aId);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetIdentStringValue(nsCSSPropertyID aId,
 | |
|                                           const nsString& aValue)
 | |
| {
 | |
|   RefPtr<nsAtom> atom = NS_Atomize(aValue);
 | |
|   SetIdentAtomValue(aId, atom);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetIdentAtomValue(nsCSSPropertyID aId, nsAtom* aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetIdentStringValue(mDecl, aId, aValue);
 | |
|   if (aId == eCSSProperty__x_lang) {
 | |
|     // This forces the lang prefs result to be cached
 | |
|     // so that we can access them off main thread during traversal
 | |
|     mPresContext->ForceCacheLang(aValue);
 | |
|   }
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetKeywordValue(nsCSSPropertyID aId, int32_t aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetKeywordValue(mDecl, aId, aValue);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetIntValue(nsCSSPropertyID aId, int32_t aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetIntValue(mDecl, aId, aValue);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetPixelValue(nsCSSPropertyID aId, float aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetPixelValue(mDecl, aId, aValue);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetLengthValue(nsCSSPropertyID aId, nsCSSValue aValue)
 | |
| {
 | |
|   MOZ_ASSERT(aValue.IsLengthUnit());
 | |
|   Servo_DeclarationBlock_SetLengthValue(
 | |
|     mDecl, aId, aValue.GetFloatValue(), aValue.GetUnit());
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetNumberValue(nsCSSPropertyID aId, float aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetNumberValue(mDecl, aId, aValue);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetPercentValue(nsCSSPropertyID aId, float aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetPercentValue(mDecl, aId, aValue);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetAutoValue(nsCSSPropertyID aId)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetAutoValue(mDecl, aId);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetCurrentColor(nsCSSPropertyID aId)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetCurrentColor(mDecl, aId);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetColorValue(nsCSSPropertyID aId, nscolor aColor)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetColorValue(mDecl, aId, aColor);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetFontFamily(const nsString& aValue)
 | |
| {
 | |
|   Servo_DeclarationBlock_SetFontFamily(mDecl, aValue);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetTextDecorationColorOverride()
 | |
| {
 | |
|   Servo_DeclarationBlock_SetTextDecorationColorOverride(mDecl);
 | |
| }
 | |
| 
 | |
| void
 | |
| ServoSpecifiedValues::SetBackgroundImage(nsAttrValue& aValue)
 | |
| {
 | |
|   if (aValue.Type() != nsAttrValue::eURL &&
 | |
|       aValue.Type() != nsAttrValue::eImage) {
 | |
|     return;
 | |
|   }
 | |
|   nsAutoString str;
 | |
|   aValue.ToString(str);
 | |
|   Servo_DeclarationBlock_SetBackgroundImage(
 | |
|     mDecl, str, mPresContext->Document()->DefaultStyleAttrURLData());
 | |
| }
 |