当前位置: 首页>>代码示例>>C++>>正文


C++ nsCSSValue::SetIntValue方法代码示例

本文整理汇总了C++中nsCSSValue::SetIntValue方法的典型用法代码示例。如果您正苦于以下问题:C++ nsCSSValue::SetIntValue方法的具体用法?C++ nsCSSValue::SetIntValue怎么用?C++ nsCSSValue::SetIntValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在nsCSSValue的用法示例。


在下文中一共展示了nsCSSValue::SetIntValue方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TopDocument

static void
GetDisplayMode(nsIDocument* aDocument, const nsMediaFeature*,
               nsCSSValue& aResult)
{
  nsIDocument* rootDocument = TopDocument(aDocument);

  nsCOMPtr<nsISupports> container = rootDocument->GetContainer();
  if (nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container)) {
    nsCOMPtr<nsIWidget> mainWidget;
    baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
    if (mainWidget && mainWidget->SizeMode() == nsSizeMode_Fullscreen) {
      aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_FULLSCREEN, eCSSUnit_Enumerated);
      return;
    }
  }

  static_assert(nsIDocShell::DISPLAY_MODE_BROWSER == NS_STYLE_DISPLAY_MODE_BROWSER &&
                nsIDocShell::DISPLAY_MODE_MINIMAL_UI == NS_STYLE_DISPLAY_MODE_MINIMAL_UI &&
                nsIDocShell::DISPLAY_MODE_STANDALONE == NS_STYLE_DISPLAY_MODE_STANDALONE &&
                nsIDocShell::DISPLAY_MODE_FULLSCREEN == NS_STYLE_DISPLAY_MODE_FULLSCREEN,
                "nsIDocShell display modes must mach nsStyleConsts.h");

  uint32_t displayMode = NS_STYLE_DISPLAY_MODE_BROWSER;
  if (nsIDocShell* docShell = rootDocument->GetDocShell()) {
    docShell->GetDisplayMode(&displayMode);
  }

  aResult.SetIntValue(displayMode, eCSSUnit_Enumerated);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:29,代码来源:nsMediaFeatures.cpp

示例2:

static void
GetIsResourceDocument(nsPresContext* aPresContext, const nsMediaFeature*,
                      nsCSSValue& aResult)
{
  nsIDocument* doc = aPresContext->Document();
  aResult.SetIntValue(doc && doc->IsResourceDoc() ? 1 : 0, eCSSUnit_Integer);
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:7,代码来源:nsMediaFeatures.cpp

示例3:

static void
GetIsGlyph(nsIDocument* aDocument, const nsMediaFeature* aFeature,
           nsCSSValue& aResult)
{
  MOZ_ASSERT(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);
  aResult.SetIntValue(aDocument->IsSVGGlyphsDocument() ? 1 : 0, eCSSUnit_Integer);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:7,代码来源:nsMediaFeatures.cpp

示例4: HasSystemMetric

static void
GetSystemMetric(nsIDocument* aDocument, const nsMediaFeature* aFeature,
                nsCSSValue& aResult)
{
  aResult.Reset();

  const bool isAccessibleFromContentPages =
    !(aFeature->mReqFlags & nsMediaFeature::eUserAgentAndChromeOnly);

  MOZ_ASSERT(!isAccessibleFromContentPages ||
             *aFeature->mName == nsGkAtoms::_moz_touch_enabled);

  if (isAccessibleFromContentPages &&
      nsContentUtils::ShouldResistFingerprinting(aDocument)) {
    // If "privacy.resistFingerprinting" is enabled, then we simply don't
    // return any system-backed media feature values. (No spoofed values
    // returned.)
    return;
  }

  MOZ_ASSERT(aFeature->mValueType == nsMediaFeature::eBoolInteger,
             "unexpected type");

  nsAtom* metricAtom = *aFeature->mData.mMetric;
  bool hasMetric = HasSystemMetric(metricAtom);
  aResult.SetIntValue(hasMetric ? 1 : 0, eCSSUnit_Integer);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:27,代码来源:nsMediaFeatures.cpp

示例5:

static nsresult
GetIsGlyph(nsPresContext* aPresContext, const nsMediaFeature* aFeature,
          nsCSSValue& aResult)
{
    aResult.SetIntValue(aPresContext->IsGlyph() ? 1 : 0, eCSSUnit_Integer);
    return NS_OK;
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:7,代码来源:nsMediaFeatures.cpp

示例6: GetDeviceSize

static void
GetDeviceOrientation(nsIDocument* aDocument, const nsMediaFeature*,
                     nsCSSValue& aResult)
{
  nsSize size = GetDeviceSize(aDocument);
  // Per spec, square viewports should be 'portrait'
  int32_t orientation = size.width > size.height
    ? NS_STYLE_ORIENTATION_LANDSCAPE : NS_STYLE_ORIENTATION_PORTRAIT;
  aResult.SetIntValue(orientation, eCSSUnit_Enumerated);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:10,代码来源:nsMediaFeatures.cpp

示例7: GetDeviceSize

static void
GetDeviceOrientation(nsPresContext* aPresContext, const nsMediaFeature*,
                     nsCSSValue& aResult)
{
  nsSize size = GetDeviceSize(aPresContext);
  int32_t orientation;
  if (size.width > size.height) {
    orientation = NS_STYLE_ORIENTATION_LANDSCAPE;
  } else {
    // Per spec, square viewports should be 'portrait'
    orientation = NS_STYLE_ORIENTATION_PORTRAIT;
  }

  aResult.SetIntValue(orientation, eCSSUnit_Enumerated);
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:15,代码来源:nsMediaFeatures.cpp

示例8: switch

static void
GetDisplayMode(nsPresContext* aPresContext, const nsMediaFeature*,
               nsCSSValue& aResult)
{
  nsCOMPtr<nsISupports> container;
  if (aPresContext) {
    // Calling GetRootPresContext() can be slow, so make sure to call it
    // just once.
    nsRootPresContext* root = aPresContext->GetRootPresContext();
    if (root && root->Document()) {
      container = root->Document()->GetContainer();
    }
  }
  nsCOMPtr<nsIBaseWindow> baseWindow = do_QueryInterface(container);
  if (!baseWindow) {
    aResult.SetIntValue(NS_STYLE_DISPLAY_MODE_BROWSER, eCSSUnit_Enumerated);
    return;
  }
  nsCOMPtr<nsIWidget> mainWidget;
  baseWindow->GetMainWidget(getter_AddRefs(mainWidget));
  int32_t displayMode;
  nsSizeMode mode = mainWidget ? mainWidget->SizeMode() : nsSizeMode_Normal;
  // Background tabs are always in 'browser' mode for now.
  // If new modes are supported, please ensure not cause the regression in
  // Bug 1259641.
  switch (mode) {
    case nsSizeMode_Fullscreen:
      displayMode = NS_STYLE_DISPLAY_MODE_FULLSCREEN;
      break;
    default:
      displayMode = NS_STYLE_DISPLAY_MODE_BROWSER;
      break;
  }

  aResult.SetIntValue(displayMode, eCSSUnit_Enumerated);
}
开发者ID:Wafflespeanut,项目名称:gecko-dev,代码行数:36,代码来源:nsMediaFeatures.cpp

示例9: GetDeviceContextFor

static nsresult
GetColor(nsPresContext* aPresContext, const nsMediaFeature*,
         nsCSSValue& aResult)
{
    // FIXME:  This implementation is bogus.  nsDeviceContext
    // doesn't provide reliable information (should be fixed in bug
    // 424386).
    // FIXME: On a monochrome device, return 0!
    nsDeviceContext *dx = GetDeviceContextFor(aPresContext);
    uint32_t depth;
    dx->GetDepth(depth);
    // The spec says to use bits *per color component*, so divide by 3,
    // and round down, since the spec says to use the smallest when the
    // color components differ.
    depth /= 3;
    aResult.SetIntValue(int32_t(depth), eCSSUnit_Integer);
    return NS_OK;
}
开发者ID:BrunoReX,项目名称:palemoon,代码行数:18,代码来源:nsMediaFeatures.cpp


注:本文中的nsCSSValue::SetIntValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。