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


C++ setBodyInnerHTML函数代码示例

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


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

示例1: TEST_F

TEST_F(DocumentMarkerControllerTest, NodeWillBeRemovedBySetInnerHTML)
{
    setBodyInnerHTML("<b><i>foo</i></b>");
    {
        RefPtrWillBeRawPtr<Element> parent = toElement(document().body()->firstChild()->firstChild());
        markNodeContents(parent);
        EXPECT_EQ(1u, markerController().markers().size());
        setBodyInnerHTML("");
    }
    // No more reference to marked node.
    Heap::collectAllGarbage();
    EXPECT_EQ(0u, markerController().markers().size());
}
开发者ID:Pluto-tv,项目名称:blink-crosswalk,代码行数:13,代码来源:DocumentMarkerControllerTest.cpp

示例2: TEST_P

TEST_P(PaintPropertyTreePrinterTest, SimpleClipTree) {
  setBodyInnerHTML("hello world");
  String clipTreeAsString = clipPropertyTreeAsString(*document().view());
  EXPECT_THAT(clipTreeAsString.ascii().data(),
              testing::MatchesRegex("root .*"
                                    "  .*Clip \\(.*\\) .*"));
}
开发者ID:mirror,项目名称:chromium,代码行数:7,代码来源:PaintPropertyTreePrinterTest.cpp

示例3: TEST_F

TEST_F(PaintPropertyTreeBuilderTest, NestedOpacityEffect)
{
    setBodyInnerHTML(
        "<div id='nodeWithoutOpacity'>"
        "  <div id='childWithOpacity' style='opacity: 0.5'>"
        "    <div id='grandChildWithoutOpacity'>"
        "      <div id='greatGrandChildWithOpacity' style='opacity: 0.2'/>"
        "    </div>"
        "  </div"
        "</div>");

    LayoutObject& nodeWithoutOpacity = *document().getElementById("nodeWithoutOpacity")->layoutObject();
    ObjectPaintProperties* nodeWithoutOpacityProperties = nodeWithoutOpacity.objectPaintProperties();
    EXPECT_EQ(nullptr, nodeWithoutOpacityProperties);

    LayoutObject& childWithOpacity = *document().getElementById("childWithOpacity")->layoutObject();
    ObjectPaintProperties* childWithOpacityProperties = childWithOpacity.objectPaintProperties();
    EXPECT_EQ(0.5f, childWithOpacityProperties->effect()->opacity());
    // childWithOpacity is the root effect node.
    EXPECT_EQ(nullptr, childWithOpacityProperties->effect()->parent());

    LayoutObject& grandChildWithoutOpacity = *document().getElementById("grandChildWithoutOpacity")->layoutObject();
    EXPECT_EQ(nullptr, grandChildWithoutOpacity.objectPaintProperties());

    LayoutObject& greatGrandChildWithOpacity = *document().getElementById("greatGrandChildWithOpacity")->layoutObject();
    ObjectPaintProperties* greatGrandChildWithOpacityProperties = greatGrandChildWithOpacity.objectPaintProperties();
    EXPECT_EQ(0.2f, greatGrandChildWithOpacityProperties->effect()->opacity());
    EXPECT_EQ(childWithOpacityProperties->effect(), greatGrandChildWithOpacityProperties->effect()->parent());
}
开发者ID:azureplus,项目名称:chromium,代码行数:29,代码来源:PaintPropertyTreeBuilderTest.cpp

示例4: TEST_F

TEST_F(ImageQualityControllerTest, ImageRenderingPixelated)
{
    setBodyInnerHTML("<img src='myimage' style='image-rendering: pixelated'></img>");
    LayoutObject* obj = document().body()->firstChild()->layoutObject();

    EXPECT_EQ(InterpolationNone, controller()->chooseInterpolationQuality(*obj, nullptr, nullptr, LayoutSize()));
}
开发者ID:howardroark2018,项目名称:chromium,代码行数:7,代码来源:ImageQualityControllerTest.cpp

示例5: TEST_F

// TODO(wangxianzhu): Create a version for slimming paint v2 when it supports interest rect
TEST_F(TableCellPainterTest, TableCellBackgroundInterestRect)
{
    setBodyInnerHTML(
        "<style>"
        "  td { width: 200px; height: 200px; border: none; }"
        "  tr { background-color: blue; }"
        "  table { border: none; border-spacing: 0; border-collapse: collapse; }"
        "</style>"
        "<table>"
        "  <tr><td id='cell1'></td></tr>"
        "  <tr><td id='cell2'></td></tr>"
        "</table>");

    LayoutView& layoutView = *document().layoutView();
    PaintLayer& rootLayer = *layoutView.layer();
    LayoutObject& cell1 = *document().getElementById("cell1")->layoutObject();
    LayoutObject& cell2 = *document().getElementById("cell2")->layoutObject();

    GraphicsContext context(&rootDisplayItemList());
    PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 200, 200), GlobalPaintNormalPhase, LayoutSize());
    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases);
    rootDisplayItemList().commitNewDisplayItems();

    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2,
        TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
        TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromRow));

    PaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 300, 200, 200), GlobalPaintNormalPhase, LayoutSize());
    PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo1, PaintLayerPaintingCompositingAllPhases);
    rootDisplayItemList().commitNewDisplayItems();

    EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2,
        TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
        TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromRow));
}
开发者ID:techtonik,项目名称:chromium,代码行数:36,代码来源:TableCellPainterTest.cpp

示例6: TEST_F

TEST_F(PrintContextFrameTest, WithScrolledSubframe)
{
    MockCanvas canvas;
    document().setBaseURLOverride(KURL(ParsedURLString, "http://a.com/"));
    setBodyInnerHTML("<style>::-webkit-scrollbar { display: none }</style>"
        "<iframe id='frame' src='http://b.com/' width='500' height='500'"
        " style='border-width: 5px; margin: 5px; position: absolute; top: 90px; left: 90px'></iframe>");

    Document& frameDocument = setupChildIframe("frame", absoluteBlockHtmlForLink(10, 10, 20, 20, "http://invisible.com")
        + absoluteBlockHtmlForLink(50, 60, 70, 80, "http://partly.visible.com")
        + absoluteBlockHtmlForLink(150, 160, 170, 180, "http://www.google.com")
        + absoluteBlockHtmlForLink(250, 260, 270, 280, "http://www.google.com#fragment")
        + absoluteBlockHtmlForLink(850, 860, 70, 80, "http://another.invisible.com"));

    frameDocument.domWindow()->scrollTo(100, 100);

    printSinglePage(canvas);

    const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations();
    ASSERT_EQ(3u, operations.size());
    EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
    EXPECT_SKRECT_EQ(50, 60, 70, 80, operations[0].rect); // FIXME: the rect should be clipped.
    EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
    EXPECT_SKRECT_EQ(150, 160, 170, 180, operations[1].rect);
    EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
    EXPECT_SKRECT_EQ(250, 260, 270, 280, operations[2].rect);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:27,代码来源:PrintContextTest.cpp

示例7: TEST_F

TEST_F(PaintControllerPaintTestForSlimmingPaintV2, CompositingFold) {
  setBodyInnerHTML(
      "<div id='div' style='width: 200px; height: 200px; opacity: 0.5'>"
      "  <div style='width: 100px; height: 100px; background-color: "
      "blue'></div>"
      "</div>");
  PaintLayer& htmlLayer =
      *toLayoutBoxModelObject(document().documentElement()->layoutObject())
           ->layer();
  LayoutBlock& div = *toLayoutBlock(getLayoutObjectByElementId("div"));
  LayoutObject& subDiv = *div.firstChild();

  EXPECT_DISPLAY_LIST(
      rootPaintController().getDisplayItemList(), 8,
      TestDisplayItem(layoutView(),
                      DisplayItem::kClipFrameToVisibleContentRect),
      TestDisplayItem(*layoutView().layer(), DisplayItem::kSubsequence),
      TestDisplayItem(layoutView(), documentBackgroundType),
      TestDisplayItem(htmlLayer, DisplayItem::kSubsequence),
      // The begin and end compositing display items have been folded into this
      // one.
      TestDisplayItem(subDiv, backgroundType),
      TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence),
      TestDisplayItem(*layoutView().layer(), DisplayItem::kEndSubsequence),
      TestDisplayItem(layoutView(),
                      DisplayItem::clipTypeToEndClipType(
                          DisplayItem::kClipFrameToVisibleContentRect)));
}
开发者ID:mirror,项目名称:chromium,代码行数:28,代码来源:PaintControllerPaintTest.cpp

示例8: TEST_F

TEST_F(PrintContextTest, LinkTargetComplex)
{
    MockCanvas canvas;
    setBodyInnerHTML("<div>"
        // Link in anonymous block before a block.
        + inlineHtmlForLink("http://www.google.com", "<img style='width: 111; height: 10'>")
        + "<div> " + inlineHtmlForLink("http://www.google1.com", "<img style='width: 122; height: 20'>") + "</div>"
        // Link in anonymous block after a block, containing another block
        + inlineHtmlForLink("http://www.google2.com", "<div style='width:133; height: 30'>BLOCK</div>")
        // Link embedded in inlines
        + "<span><b><i><img style='width: 40px; height: 40px'><br>"
        + inlineHtmlForLink("http://www.google3.com", "<img style='width: 144px; height: 40px'>")
        + "</i></b></span>"
        // Link embedded in relatively positioned inline
        + "<span style='position: relative; top: 50px; left: 50px'><b><i><img style='width: 1px; height: 40px'><br>"
        + inlineHtmlForLink("http://www.google3.com", "<img style='width: 155px; height: 50px'>")
        + "</i></b></span>"
        + "</div>");
    printSinglePage(canvas);

    const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations();
    ASSERT_EQ(4u, operations.size());
    EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
    EXPECT_SKRECT_EQ(0, 0, 111, 10, operations[0].rect);
    EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
    EXPECT_SKRECT_EQ(0, 10, 122, 20, operations[1].rect);
    EXPECT_EQ(MockCanvas::DrawRect, operations[2].type);
    EXPECT_SKRECT_EQ(0, 100, 144, 40, operations[2].rect);
    EXPECT_EQ(MockCanvas::DrawRect, operations[3].type);
    EXPECT_SKRECT_EQ(50, 190, 155, 50, operations[3].rect);
}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:31,代码来源:PrintContextTest.cpp

示例9: TEST_F

TEST_F(TextAutosizerTest, DISABLED_NestedTextSizeAdjust)
{
    setBodyInnerHTML(
        "<meta name='viewport' content='width=800'>"
        "<style>"
        "    html { font-size: 16px; }"
        "    body { width: 800px; margin: 0; overflow-y: hidden; }"
        "</style>"
        "<div id='textSizeAdjustA' style='text-size-adjust: 47%;'>"
        "    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
        "    incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud"
        "    exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure"
        "    dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."
        "    Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt"
        "    mollit anim id est laborum."
        "    <div id='textSizeAdjustB' style='text-size-adjust: 53%;'>"
        "        Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor"
        "        incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud"
        "        exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute"
        "        irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla"
        "        pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui"
        "        officia deserunt mollit anim id est laborum."
        "    </div>"
        "</div>");
    LayoutObject* textSizeAdjustA = document().getElementById("textSizeAdjustA")->layoutObject();
    EXPECT_FLOAT_EQ(16.f, textSizeAdjustA->style()->specifiedFontSize());
    // 16px * 47% = 7.52
    EXPECT_FLOAT_EQ(7.52f, textSizeAdjustA->style()->computedFontSize());
    LayoutObject* textSizeAdjustB = document().getElementById("textSizeAdjustB")->layoutObject();
    EXPECT_FLOAT_EQ(16.f, textSizeAdjustB->style()->specifiedFontSize());
    // 16px * 53% = 8.48
    EXPECT_FLOAT_EQ(8.48f, textSizeAdjustB->style()->computedFontSize());
}
开发者ID:endlessm,项目名称:chromium-browser,代码行数:33,代码来源:TextAutosizerTest.cpp

示例10: TEST_F

TEST_F(PaintLayerScrollableAreaTest, OpaqueLayersPromotedOnStyleChange) {
  RuntimeEnabledFeatures::setCompositeOpaqueScrollersEnabled(true);

  setBodyInnerHTML(
      "<style>"
      "#scroller { overflow: scroll; height: 200px; width: 200px; background: "
      "rgba(255,255,255,0.5) local content-box; }"
      "#scrolled { height: 300px; }"
      "</style>"
      "<div id=\"scroller\"><div id=\"scrolled\"></div></div>");
  document().view()->updateAllLifecyclePhases();

  EXPECT_TRUE(RuntimeEnabledFeatures::compositeOpaqueScrollersEnabled());
  Element* scroller = document().getElementById("scroller");
  PaintLayer* paintLayer =
      toLayoutBoxModelObject(scroller->layoutObject())->layer();
  ASSERT_TRUE(paintLayer);
  EXPECT_FALSE(paintLayer->needsCompositedScrolling());

  // Change the background to transparent
  scroller->setAttribute(HTMLNames::styleAttr,
                         "background: white local content-box;");
  document().view()->updateAllLifecyclePhases();
  paintLayer = toLayoutBoxModelObject(scroller->layoutObject())->layer();
  ASSERT_TRUE(paintLayer);
  EXPECT_TRUE(paintLayer->needsCompositedScrolling());
  EXPECT_TRUE(paintLayer->graphicsLayerBacking());
  ASSERT_TRUE(paintLayer->graphicsLayerBackingForScrolling());
  EXPECT_TRUE(paintLayer->graphicsLayerBackingForScrolling()->contentsOpaque());
}
开发者ID:ollie314,项目名称:chromium,代码行数:30,代码来源:PaintLayerScrollableAreaTest.cpp

示例11: TEST_F

TEST_F(LayoutObjectTest, DisplayInlineBlockCreateObject) {
  setBodyInnerHTML("<foo style='display:inline-block'></foo>");
  LayoutObject* layoutObject = document().body()->firstChild()->layoutObject();
  EXPECT_NE(nullptr, layoutObject);
  EXPECT_TRUE(layoutObject->isLayoutBlockFlow());
  EXPECT_TRUE(layoutObject->isInline());
}
开发者ID:mirror,项目名称:chromium,代码行数:7,代码来源:LayoutObjectTest.cpp


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