本文整理汇总了C++中nsCSSValue::SetStringValue方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCSSValue::SetStringValue方法的具体用法?C++ nsCSSValue::SetStringValue怎么用?C++ nsCSSValue::SetStringValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类nsCSSValue
的用法示例。
在下文中一共展示了nsCSSValue::SetStringValue方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
static nsresult
GetOperatingSystemVersion(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.Reset();
if (ShouldResistFingerprinting(aPresContext)) {
return NS_OK;
}
#ifdef XP_WIN
int32_t metricResult;
if (NS_SUCCEEDED(
LookAndFeel::GetInt(LookAndFeel::eIntID_OperatingSystemVersionIdentifier,
&metricResult))) {
for (size_t i = 0; i < ArrayLength(osVersionStrings); ++i) {
if (metricResult == osVersionStrings[i].id) {
aResult.SetStringValue(nsDependentString(osVersionStrings[i].name),
eCSSUnit_Ident);
break;
}
}
}
#endif
return NS_OK;
}
示例2:
static void
GetOperatingSystemVersion(nsIDocument* aDocument, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.Reset();
MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
return;
}
#ifdef XP_WIN
int32_t metricResult;
if (NS_SUCCEEDED(
LookAndFeel::GetInt(LookAndFeel::eIntID_OperatingSystemVersionIdentifier,
&metricResult))) {
for (size_t i = 0; i < ArrayLength(osVersionStrings); ++i) {
if (metricResult == osVersionStrings[i].id) {
aResult.SetStringValue(nsDependentString(osVersionStrings[i].name),
eCSSUnit_Ident);
break;
}
}
}
#endif
}
示例3: GetWindowsThemeIdentifier
static void
GetWindowsTheme(nsIDocument* aDocument, const nsMediaFeature* aFeature,
nsCSSValue& aResult)
{
aResult.Reset();
MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
if (nsContentUtils::ShouldResistFingerprinting(aDocument)) {
return;
}
#ifdef XP_WIN
uint8_t windowsThemeId = GetWindowsThemeIdentifier();
// Classic mode should fail to match.
if (windowsThemeId == LookAndFeel::eWindowsTheme_Classic)
return;
// Look up the appropriate theme string
for (size_t i = 0; i < ArrayLength(themeStrings); ++i) {
if (windowsThemeId == themeStrings[i].id) {
aResult.SetStringValue(nsDependentString(themeStrings[i].name),
eCSSUnit_Ident);
break;
}
}
#endif
}