DXR is a code search and navigation tool aimed at making sense of large projects. It supports full-text and regex searches as well as structural queries.

Header

Mercurial (d38398e5144e)

VCS Links

Macros

Line Code
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105
/* -*- 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/. */

#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)
{
  // We always create fresh ServoSpecifiedValues for each property
  // mapping, so unlike Gecko there aren't existing properties from
  // the cascade that we wish to avoid overwriting.
  //
  // If a property is being overwritten, that's a bug. Check for it
  // in debug mode (this is O(n^2) behavior since Servo will traverse
  // the array each time you add a new property)
  MOZ_ASSERT(!Servo_DeclarationBlock_PropertyIsSet(mDecl, aId),
             "Presentation attribute mappers should never attempt to set the same property twice");
  return false;
}

void
ServoSpecifiedValues::SetIdentStringValue(nsCSSPropertyID aId,
                                          const nsString& aValue)
{
  nsCOMPtr<nsIAtom> atom = NS_Atomize(aValue);
  Servo_DeclarationBlock_SetIdentStringValue(mDecl, aId, atom);
}

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::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);
}