• Home
  • Raw
  • Download

Lines Matching refs:dom

40 static std::unique_ptr<SkCanvas> MakeDOMCanvas(SkDOM* dom, uint32_t flags = 0) {  in MakeDOMCanvas()  argument
42 std::make_unique<SkXMLParserWriter>(dom->beginParsing()), in MakeDOMCanvas()
52 const SkDOM& dom, in check_text_node() argument
63 const SkDOM::Node* textElem = dom.getFirstChild(root, "text"); in check_text_node()
68 REPORTER_ASSERT(reporter, dom.getType(textElem) == SkDOM::kElement_Type); in check_text_node()
70 const SkDOM::Node* textNode= dom.getFirstChild(textElem); in check_text_node()
73 REPORTER_ASSERT(reporter, dom.getType(textNode) == SkDOM::kText_Type); in check_text_node()
74 REPORTER_ASSERT(reporter, strcmp(expected, dom.getName(textNode)) == 0); in check_text_node()
79 const char* x = dom.findAttr(textElem, "x"); in check_text_node()
100 const char* y = dom.findAttr(textElem, "y"); in check_text_node()
123 SkDOM dom; in test_whitespace_pos() local
129 MakeDOMCanvas(&dom)->drawSimpleText(txt, len, SkTextEncoding::kUTF8, in test_whitespace_pos()
132 check_text_node(reporter, dom, dom.finishParsing(), offset, 0, txt, expected); in test_whitespace_pos()
141 MakeDOMCanvas(&dom)->drawTextBlob(blob, 0, 0, paint); in test_whitespace_pos()
143 check_text_node(reporter, dom, dom.finishParsing(), offset, 1, txt, expected); in test_whitespace_pos()
152 MakeDOMCanvas(&dom)->drawTextBlob(blob, 0, 0, paint); in test_whitespace_pos()
154 check_text_node(reporter, dom, dom.finishParsing(), offset, 2, txt, expected); in test_whitespace_pos()
191 bool FindImageShaderNodes(skiatest::Reporter* reporter, const SkDOM* dom, const SkDOM::Node* root, in FindImageShaderNodes() argument
194 if (root == nullptr || dom == nullptr) { in FindImageShaderNodes()
200 const SkDOM::Node* rect = dom->getFirstChild(root, "rect"); in FindImageShaderNodes()
207 const SkDOM::Node* defs = dom->getFirstChild(root, "defs"); in FindImageShaderNodes()
213 const SkDOM::Node* pattern = dom->getFirstChild(defs, "pattern"); in FindImageShaderNodes()
220 const SkDOM::Node* image = dom->getFirstChild(pattern, "image"); in FindImageShaderNodes()
230 void ImageShaderTestSetup(SkDOM* dom, SkPaint* paint, int imageWidth, int imageHeight, in ImageShaderTestSetup() argument
233 auto svgCanvas = MakeDOMCanvas(dom); in ImageShaderTestSetup()
241 SkDOM dom; in DEF_TEST() local
245 ImageShaderTestSetup(&dom, &paint, imageWidth, imageHeight, rectWidth, rectHeight, in DEF_TEST()
248 const SkDOM::Node* root = dom.finishParsing(); in DEF_TEST()
252 FindImageShaderNodes(reporter, &dom, root, &patternNode, &imageNode, &rectNode); in DEF_TEST()
256 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "width")) == imageWidth); in DEF_TEST()
257 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "height")) == imageHeight); in DEF_TEST()
261 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(patternNode, "width"), "100%") == 0); in DEF_TEST()
262 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(patternNode, "height"), "100%") == 0); in DEF_TEST()
266 SkDOM dom; in DEF_TEST() local
270 ImageShaderTestSetup(&dom, &paint, imageWidth, imageHeight, rectWidth, rectHeight, in DEF_TEST()
273 const SkDOM::Node* root = dom.finishParsing(); in DEF_TEST()
274 const SkDOM::Node* innerSvg = dom.getFirstChild(root, "svg"); in DEF_TEST()
282 FindImageShaderNodes(reporter, &dom, innerSvg, &patternNode, &imageNode, &rectNode); in DEF_TEST()
286 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "width")) == imageWidth); in DEF_TEST()
287 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "height")) == imageHeight); in DEF_TEST()
291 REPORTER_ASSERT(reporter, atoi(dom.findAttr(patternNode, "width")) == imageWidth); in DEF_TEST()
292 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(patternNode, "height"), "100%") == 0); in DEF_TEST()
296 SkDOM dom; in DEF_TEST() local
300 ImageShaderTestSetup(&dom, &paint, imageNodeWidth, imageNodeHeight, rectNodeWidth, in DEF_TEST()
303 const SkDOM::Node* root = dom.finishParsing(); in DEF_TEST()
304 const SkDOM::Node* innerSvg = dom.getFirstChild(root, "svg"); in DEF_TEST()
312 FindImageShaderNodes(reporter, &dom, innerSvg, &patternNode, &imageNode, &rectNode); in DEF_TEST()
316 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "width")) == imageNodeWidth); in DEF_TEST()
317 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "height")) == imageNodeHeight); in DEF_TEST()
321 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(patternNode, "width"), "100%") == 0); in DEF_TEST()
322 REPORTER_ASSERT(reporter, atoi(dom.findAttr(patternNode, "height")) == imageNodeHeight); in DEF_TEST()
326 SkDOM dom; in DEF_TEST() local
330 ImageShaderTestSetup(&dom, &paint, imageWidth, imageHeight, rectWidth, rectHeight, in DEF_TEST()
333 const SkDOM::Node* root = dom.finishParsing(); in DEF_TEST()
336 const SkDOM::Node* innerSvg = dom.getFirstChild(root, "svg"); in DEF_TEST()
342 FindImageShaderNodes(reporter, &dom, innerSvg, &patternNode, &imageNode, &rectNode); in DEF_TEST()
346 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "width")) == imageWidth); in DEF_TEST()
347 REPORTER_ASSERT(reporter, atoi(dom.findAttr(imageNode, "height")) == imageHeight); in DEF_TEST()
349 REPORTER_ASSERT(reporter, atoi(dom.findAttr(patternNode, "width")) == imageWidth); in DEF_TEST()
350 REPORTER_ASSERT(reporter, atoi(dom.findAttr(patternNode, "height")) == imageHeight); in DEF_TEST()
354 SkDOM dom; in DEF_TEST() local
358 auto svgCanvas = MakeDOMCanvas(&dom); in DEF_TEST()
362 const SkDOM::Node* rootElement = dom.finishParsing(); in DEF_TEST()
365 const SkDOM::Node* filterElement = dom.getFirstChild(rootElement, "filter"); in DEF_TEST()
368 const SkDOM::Node* floodElement = dom.getFirstChild(filterElement, "feFlood"); in DEF_TEST()
371 const SkDOM::Node* compositeElement = dom.getFirstChild(filterElement, "feComposite"); in DEF_TEST()
374 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(filterElement, "width"), "100%") == 0); in DEF_TEST()
375 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(filterElement, "height"), "100%") == 0); in DEF_TEST()
378 strcmp(dom.findAttr(floodElement, "flood-color"), "red") == 0); in DEF_TEST()
379 REPORTER_ASSERT(reporter, atoi(dom.findAttr(floodElement, "flood-opacity")) == 1); in DEF_TEST()
381 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(compositeElement, "in"), "flood") == 0); in DEF_TEST()
382 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(compositeElement, "operator"), "in") == 0); in DEF_TEST()
386 SkDOM dom; in DEF_TEST() local
393 auto svgCanvas = MakeDOMCanvas(&dom, flags); in DEF_TEST()
396 const auto* rootElement = dom.finishParsing(); in DEF_TEST()
398 const auto* textElement = dom.getFirstChild(rootElement, "text"); in DEF_TEST()
400 const auto* pathElement = dom.getFirstChild(rootElement, "path"); in DEF_TEST()
434 SkDOM dom; in DEF_TEST() local
436 MakeDOMCanvas(&dom)->drawRect(SkRect::MakeWH(100, 100), p); in DEF_TEST()
439 const auto* root = dom.finishParsing(); in DEF_TEST()
441 const auto* rect = dom.getFirstChild(root, "rect"); in DEF_TEST()
443 const auto* fill = dom.findAttr(rect, "fill"); in DEF_TEST()
448 const auto* stroke = dom.findAttr(rect, "stroke"); in DEF_TEST()
457 SkDOM dom; in DEF_TEST() local
461 auto svgCanvas = MakeDOMCanvas(&dom); in DEF_TEST()
465 const SkDOM::Node* rootElement = dom.finishParsing(); in DEF_TEST()
468 const SkDOM::Node* rectElement = dom.getFirstChild(rootElement, "rect"); in DEF_TEST()
470 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectElement, "fill"), "blue") == 0); in DEF_TEST()
474 SkDOM dom; in DEF_TEST() local
478 auto svgCanvas = MakeDOMCanvas(&dom); in DEF_TEST()
486 const SkDOM::Node* rootElement = dom.finishParsing(); in DEF_TEST()
490 const SkDOM::Node* rectElement = dom.getFirstChild(rootElement, "rect"); in DEF_TEST()
492 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectElement, "fill"), "#AABCDE") == 0); in DEF_TEST()
495 rectElement = dom.getNextSibling(rectElement, "rect"); in DEF_TEST()
497 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectElement, "fill"), "#ABC") == 0); in DEF_TEST()
500 rectElement = dom.getNextSibling(rectElement, "rect"); in DEF_TEST()
502 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectElement, "fill"), "#AA1123") == 0); in DEF_TEST()
506 SkDOM dom; in DEF_TEST() local
508 auto svgCanvas = MakeDOMCanvas(&dom); in DEF_TEST()
519 const SkDOM::Node* rootElement = dom.finishParsing(); in DEF_TEST()
522 const SkDOM::Node* rectNode = dom.getFirstChild(rootElement, "rect"); in DEF_TEST()
524 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectNode, "fill"), "#00BBAC") == 0); in DEF_TEST()
526 rectNode = dom.getNextSibling(rectNode, "rect"); in DEF_TEST()
528 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectNode, "stroke"), "#123456") == 0); in DEF_TEST()
529 REPORTER_ASSERT(reporter, strcmp(dom.findAttr(rectNode, "stroke-width"), "1") == 0); in DEF_TEST()
533 SkDOM dom; in DEF_TEST() local
547 auto svgCanvas = MakeDOMCanvas(&dom); in DEF_TEST()
550 const auto* rootElement = dom.finishParsing(); in DEF_TEST()
552 const auto* pathElement = dom.getFirstChild(rootElement, "path"); in DEF_TEST()
561 const auto* d = dom.findAttr(pathElement, "d"); in DEF_TEST()
571 SkDOM dom; in DEF_TEST() local
573 auto svgCanvas = MakeDOMCanvas(&dom, SkSVGCanvas::kRelativePathEncoding_Flag); in DEF_TEST()
583 const auto* rootElement = dom.finishParsing(); in DEF_TEST()
585 const auto* pathElement = dom.getFirstChild(rootElement, "path"); in DEF_TEST()
587 const auto* d = dom.findAttr(pathElement, "d"); in DEF_TEST()
592 SkDOM dom; in DEF_TEST() local
594 auto svgCanvas = MakeDOMCanvas(&dom); in DEF_TEST()
602 const auto* rootElement = dom.finishParsing(); in DEF_TEST()
604 const auto* ellipseElement = dom.getFirstChild(rootElement, "ellipse"); in DEF_TEST()
606 const auto* fill = dom.findAttr(ellipseElement, "fill"); in DEF_TEST()