• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ nsDisplayList类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: PrintDisplayListTo

static void
PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
                   PRInt32 aIndent, FILE* aOutput)
{
  for (nsDisplayItem* i = aList.GetBottom(); i != nsnull; i = i->GetAbove()) {
    if (aList.DidComputeVisibility() && i->GetVisibleRect().IsEmpty())
      continue;
    for (PRInt32 j = 0; j < aIndent; ++j) {
      fputc(' ', aOutput);
    }
    nsIFrame* f = i->GetUnderlyingFrame();
    nsAutoString fName;
    if (f) {
      f->GetFrameName(fName);
    }
    nsRect rect = i->GetBounds(aBuilder);
    switch (i->GetType()) {
      case nsDisplayItem::TYPE_CLIP:
      case nsDisplayItem::TYPE_CLIP_ROUNDED_RECT: {
        nsDisplayClip* c = static_cast<nsDisplayClip*>(i);
        rect = c->GetClipRect();
        break;
      }
      default:
        break;
    }
    nscolor color;
    nsRect vis = i->GetVisibleRect();
    nsDisplayList* list = i->GetList();
    nsRegion opaque;
    if (!list || list->DidComputeVisibility()) {
      opaque = i->GetOpaqueRegion(aBuilder);
    }
    if (i->GetType() == nsDisplayItem::TYPE_TRANSFORM) {
      nsDisplayTransform* t = static_cast<nsDisplayTransform*>(i);
      list = t->GetStoredList()->GetList();
    }
    fprintf(aOutput, "%s %p(%s) (%d,%d,%d,%d)(%d,%d,%d,%d)%s%s",
            i->Name(), (void*)f, NS_ConvertUTF16toUTF8(fName).get(),
            rect.x, rect.y, rect.width, rect.height,
            vis.x, vis.y, vis.width, vis.height,
            opaque.IsEmpty() ? "" : " opaque",
            i->IsUniform(aBuilder, &color) ? " uniform" : "");
    if (f) {
      PRUint32 key = i->GetPerFrameKey();
      Layer* layer = aBuilder->LayerBuilder()->GetOldLayerFor(f, key);
      if (layer) {
        fprintf(aOutput, " layer=%p", layer);
      }
    }
    fputc('\n', aOutput);
    if (list) {
      PrintDisplayListTo(aBuilder, *list, aIndent + 4, aOutput);
    }
  }
}
开发者ID:,项目名称:,代码行数:56,代码来源:


示例2: BuildListForLayer

// Use shadow layer tree to build display list for the browser's frame.
static void
BuildListForLayer(Layer* aLayer,
                  nsFrameLoader* aRootFrameLoader,
                  const gfx3DMatrix& aTransform,
                  nsDisplayListBuilder* aBuilder,
                  nsDisplayList& aShadowTree,
                  nsIFrame* aSubdocFrame)
{
  const FrameMetrics* metrics = GetFrameMetrics(aLayer);

  gfx3DMatrix transform;

  if (metrics && metrics->IsScrollable()) {
    const ViewID scrollId = metrics->mScrollId;

    // We need to figure out the bounds of the scrollable region using the
    // shadow layer tree from the remote process. The metrics viewport is
    // defined based on all the transformations of its parent layers and
    // the scale of the current layer.

    // Calculate transform for this layer.
    nsContentView* view =
      aRootFrameLoader->GetCurrentRemoteFrame()->GetContentView(scrollId);
    // XXX why don't we include aLayer->GetTransform() in the inverse-scale here?
    // This seems wrong, but it doesn't seem to cause bugs!
    gfx3DMatrix applyTransform = ComputeShadowTreeTransform(
      aSubdocFrame, aRootFrameLoader, metrics, view->GetViewConfig(),
      1 / GetXScale(aTransform), 1 / GetYScale(aTransform));
    gfx3DMatrix layerTransform;
    To3DMatrix(aLayer->GetTransform(), layerTransform);
    transform = applyTransform * layerTransform * aTransform;

    // As mentioned above, bounds calculation also depends on the scale
    // of this layer.
    gfx3DMatrix tmpTransform = aTransform;
    Scale(tmpTransform, GetXScale(applyTransform), GetYScale(applyTransform));

    // Calculate rect for this layer based on aTransform.
    nsRect bounds;
    {
      bounds = CSSRect::ToAppUnits(metrics->mViewport);
      nscoord auPerDevPixel = aSubdocFrame->PresContext()->AppUnitsPerDevPixel();
      ApplyTransform(bounds, tmpTransform, auPerDevPixel);
    }

    aShadowTree.AppendToTop(
      new (aBuilder) nsDisplayRemoteShadow(aBuilder, aSubdocFrame, bounds, scrollId));

  } else {
    gfx3DMatrix layerTransform;
    To3DMatrix(aLayer->GetTransform(), layerTransform);
    transform = layerTransform * aTransform;
  }

  for (Layer* child = aLayer->GetFirstChild(); child;
       child = child->GetNextSibling()) {
    BuildListForLayer(child, aRootFrameLoader, transform,
                      aBuilder, aShadowTree, aSubdocFrame);
  }
}
开发者ID:,项目名称:,代码行数:61,代码来源:


示例3: PrintDisplayListTo

static void
PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
                   std::stringstream& aStream, uint32_t aIndent, bool aDumpHtml)
{
  if (aDumpHtml) {
    aStream << "<ul>";
  }

  for (nsDisplayItem* i = aList.GetBottom(); i != nullptr; i = i->GetAbove()) {
    if (aDumpHtml) {
      aStream << "<li>";
    }
    PrintDisplayItemTo(aBuilder, i, aStream, aIndent, true, aDumpHtml);
    if (aDumpHtml) {
      aStream << "</li>";
    }
  }

  if (aDumpHtml) {
    aStream << "</ul>";
  }
}
开发者ID:carriercomm,项目名称:system-addons,代码行数:22,代码来源:nsLayoutDebugger.cpp


示例4: PrintDisplayListTo

static void
PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
                   FILE* aOutput)
{
  fprintf(aOutput, "<ul>");

  for (nsDisplayItem* i = aList.GetBottom(); i != nsnull; i = i->GetAbove()) {
#ifdef DEBUG
    if (aList.DidComputeVisibility() && i->GetVisibleRect().IsEmpty())
      continue;
#endif
    fprintf(aOutput, "<li>");
    nsIFrame* f = i->GetUnderlyingFrame();
    nsAutoString fName;
#ifdef DEBUG
    if (f) {
      f->GetFrameName(fName);
    }
#endif
    bool snap;
    nsRect rect = i->GetBounds(aBuilder, &snap);
    switch (i->GetType()) {
      case nsDisplayItem::TYPE_CLIP:
      case nsDisplayItem::TYPE_CLIP_ROUNDED_RECT: {
        nsDisplayClip* c = static_cast<nsDisplayClip*>(i);
        rect = c->GetClipRect();
        break;
      }
      default:
        break;
    }
    nscolor color;
    nsRect vis = i->GetVisibleRect();
    nsDisplayList* list = i->GetList();
    nsRegion opaque;
    if (i->GetType() == nsDisplayItem::TYPE_TRANSFORM) {
        nsDisplayTransform* t = static_cast<nsDisplayTransform*>(i);
        list = t->GetStoredList()->GetList();
    }
#ifdef DEBUG
    if (!list || list->DidComputeVisibility()) {
      opaque = i->GetOpaqueRegion(aBuilder, &snap);
    }
#endif
    if (i->Painted()) {
      nsCString string(i->Name());
      string.Append("-");
      string.AppendInt((PRUint64)i);
      fprintf(aOutput, "<a href=\"javascript:ViewImage('%s')\">", string.BeginReading());
    }
    fprintf(aOutput, "%s %p(%s) (%d,%d,%d,%d)(%d,%d,%d,%d)%s%s",
            i->Name(), (void*)f, NS_ConvertUTF16toUTF8(fName).get(),
            rect.x, rect.y, rect.width, rect.height,
            vis.x, vis.y, vis.width, vis.height,
            opaque.IsEmpty() ? "" : " opaque",
            i->IsUniform(aBuilder, &color) ? " uniform" : "");
    if (i->Painted()) {
      fprintf(aOutput, "</a>");
    }
    if (f) {
      PRUint32 key = i->GetPerFrameKey();
      Layer* layer = aBuilder->LayerBuilder()->GetOldLayerFor(f, key);
      if (layer) {
        fprintf(aOutput, " <a href=\"#%p\">layer=%p</a>", layer, layer);
      }
    }
    if (i->GetType() == nsDisplayItem::TYPE_SVG_EFFECTS) {
      (static_cast<nsDisplaySVGEffects*>(i))->PrintEffects(aOutput);
    }
    fputc('\n', aOutput);
    if (list) {
      PrintDisplayListTo(aBuilder, *list, aOutput);
    }
    fprintf(aOutput, "</li>");
  }
  
  fprintf(aOutput, "</ul>");
}
开发者ID:msliu,项目名称:mozilla-central,代码行数:78,代码来源:nsLayoutDebugger.cpp


示例5: PrintDisplayListTo

static void
PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
                   FILE* aOutput, bool aDumpHtml)
{
  if (aDumpHtml) {
    fprintf(aOutput, "<ul>");
  }

  for (nsDisplayItem* i = aList.GetBottom(); i != nullptr; i = i->GetAbove()) {
#ifdef DEBUG
    if (aList.DidComputeVisibility() && i->GetVisibleRect().IsEmpty())
      continue;
#endif
    if (aDumpHtml) {
      fprintf(aOutput, "<li>");
    } else {
      sPrintDisplayListIndent ++;
      for (int indent = 0; indent < sPrintDisplayListIndent; indent++) {
        fprintf(aOutput, "  ");
      }
    }
    nsIFrame* f = i->GetUnderlyingFrame();
    nsAutoString fName;
#ifdef DEBUG
    if (f) {
      f->GetFrameName(fName);
    }
#endif
    bool snap;
    nsRect rect = i->GetBounds(aBuilder, &snap);
    switch (i->GetType()) {
      case nsDisplayItem::TYPE_CLIP:
      case nsDisplayItem::TYPE_CLIP_ROUNDED_RECT: {
        nsDisplayClip* c = static_cast<nsDisplayClip*>(i);
        rect = c->GetClipRect();
        break;
      }
      default:
        break;
    }
    nscolor color;
    nsRect vis = i->GetVisibleRect();
    nsRect component = i->GetComponentAlphaBounds(aBuilder);
    nsDisplayList* list = i->GetChildren();
    nsRegion opaque;
#ifdef DEBUG
    if (!list || list->DidComputeVisibility()) {
      opaque = i->GetOpaqueRegion(aBuilder, &snap);
    }
#endif
    if (aDumpHtml && i->Painted()) {
      nsCString string(i->Name());
      string.Append("-");
      string.AppendInt((uint64_t)i);
      fprintf(aOutput, "<a href=\"javascript:ViewImage('%s')\">", string.BeginReading());
    }
    fprintf(aOutput, "%s %p(%s) (%d,%d,%d,%d)(%d,%d,%d,%d)(%d,%d,%d,%d)%s",
            i->Name(), (void*)f, NS_ConvertUTF16toUTF8(fName).get(),
            rect.x, rect.y, rect.width, rect.height,
            vis.x, vis.y, vis.width, vis.height,
            component.x, component.y, component.width, component.height,
            i->IsUniform(aBuilder, &color) ? " uniform" : "");
    nsRegionRectIterator iter(opaque);
    for (const nsRect* r = iter.Next(); r; r = iter.Next()) {
      printf("(opaque %d,%d,%d,%d)", r->x, r->y, r->width, r->height);
    }
    if (aDumpHtml && i->Painted()) {
      fprintf(aOutput, "</a>");
    }
    if (f) {
      uint32_t key = i->GetPerFrameKey();
      Layer* layer = mozilla::FrameLayerBuilder::GetDebugOldLayerFor(f, key);
      if (layer) {
        if (aDumpHtml) {
          fprintf(aOutput, " <a href=\"#%p\">layer=%p</a>", layer, layer);
        } else {
          fprintf(aOutput, " layer=%p", layer);
        }
      }
    }
    if (i->GetType() == nsDisplayItem::TYPE_SVG_EFFECTS) {
      (static_cast<nsDisplaySVGEffects*>(i))->PrintEffects(aOutput);
    }
    fputc('\n', aOutput);
    if (list) {
      PrintDisplayListTo(aBuilder, *list, aOutput, aDumpHtml);
    }
    if (aDumpHtml) {
      fprintf(aOutput, "</li>");
    } else {
      sPrintDisplayListIndent --;
    }
  }

  if (aDumpHtml) {
    fprintf(aOutput, "</ul>");
  }
}
开发者ID:AshishNamdev,项目名称:mozilla-central,代码行数:98,代码来源:nsLayoutDebugger.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ nsDisplayListSet类代码示例发布时间:2022-05-31
下一篇:
C++ nsDependentCSubstring类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap