Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(31)

Side by Side Diff: Source/core/rendering/RenderTreeAsText.cpp

Issue 79433004: Display anonymous regions in DRT (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch for landing Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/core/rendering/RenderRegion.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved. 2 * Copyright (C) 2004, 2006, 2007 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 ts << "\n"; 469 ts << "\n";
470 470
471 if (o.isText() && !o.isBR()) { 471 if (o.isText() && !o.isBR()) {
472 const RenderText& text = *toRenderText(&o); 472 const RenderText& text = *toRenderText(&o);
473 for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextB ox()) { 473 for (InlineTextBox* box = text.firstTextBox(); box; box = box->nextTextB ox()) {
474 writeIndent(ts, indent + 1); 474 writeIndent(ts, indent + 1);
475 writeTextRun(ts, text, *box); 475 writeTextRun(ts, text, *box);
476 } 476 }
477 } 477 }
478 478
479 // FIXME: temporary hack to avoid rebase of regions tests 479 for (RenderObject* child = o.firstChild(); child; child = child->nextSibling ()) {
480 if (!o.isRenderNamedFlowFragmentContainer()) { 480 if (child->hasLayer())
481 for (RenderObject* child = o.firstChild(); child; child = child->nextSib ling()) { 481 continue;
482 if (child->hasLayer()) 482 write(ts, *child, indent + 1, behavior);
483 continue;
484 write(ts, *child, indent + 1, behavior);
485 }
486 } 483 }
487 484
488 if (o.isWidget()) { 485 if (o.isWidget()) {
489 Widget* widget = toRenderWidget(&o)->widget(); 486 Widget* widget = toRenderWidget(&o)->widget();
490 if (widget && widget->isFrameView()) { 487 if (widget && widget->isFrameView()) {
491 FrameView* view = toFrameView(widget); 488 FrameView* view = toFrameView(widget);
492 RenderView* root = view->frame().contentRenderer(); 489 RenderView* root = view->frame().contentRenderer();
493 if (root) { 490 if (root) {
494 view->layout(); 491 view->layout();
495 RenderLayer* l = root->layer(); 492 RenderLayer* l = root->layer();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
565 562
566 ts << "\n"; 563 ts << "\n";
567 564
568 if (paintPhase != LayerPaintPhaseBackground) 565 if (paintPhase != LayerPaintPhaseBackground)
569 write(ts, *l.renderer(), indent + 1, behavior); 566 write(ts, *l.renderer(), indent + 1, behavior);
570 } 567 }
571 568
572 static void writeRenderRegionList(const RenderRegionList& flowThreadRegionList, TextStream& ts, int indent) 569 static void writeRenderRegionList(const RenderRegionList& flowThreadRegionList, TextStream& ts, int indent)
573 { 570 {
574 for (RenderRegionList::const_iterator itRR = flowThreadRegionList.begin(); i tRR != flowThreadRegionList.end(); ++itRR) { 571 for (RenderRegionList::const_iterator itRR = flowThreadRegionList.begin(); i tRR != flowThreadRegionList.end(); ++itRR) {
575 RenderRegion* renderRegion = *itRR; 572 const RenderRegion* renderRegion = *itRR;
576 writeIndent(ts, indent + 2); 573
577 ts << "RenderRegion"; 574 writeIndent(ts, indent);
575 ts << renderRegion->renderName();
576
578 Node* generatingNodeForRegion = renderRegion->generatingNodeForRegion(); 577 Node* generatingNodeForRegion = renderRegion->generatingNodeForRegion();
579 if (generatingNodeForRegion) { 578 if (generatingNodeForRegion) {
580 String tagName = getTagName(generatingNodeForRegion); 579 if (renderRegion->hasCustomRegionStyle())
581 if (!tagName.isEmpty()) 580 ts << " region style: 1";
582 ts << " {" << tagName << "}"; 581 if (renderRegion->hasAutoLogicalHeight())
582 ts << " hasAutoLogicalHeight";
583
584 bool isRenderNamedFlowFragment = renderRegion->isRenderNamedFlowFrag ment();
585 if (isRenderNamedFlowFragment)
586 ts << " (anonymous child of";
587
588 StringBuilder tagName;
589 tagName.append(generatingNodeForRegion->nodeName());
590
591 Node* nodeForRegion = renderRegion->nodeForRegion();
592 if (nodeForRegion->isPseudoElement()) {
593 if (nodeForRegion->isBeforePseudoElement())
594 tagName.append("::before");
595 else if (nodeForRegion->isAfterPseudoElement())
596 tagName.append("::after");
597 }
598
599 ts << " {" << tagName.toString() << "}";
600
583 if (generatingNodeForRegion->isElementNode() && generatingNodeForReg ion->hasID()) { 601 if (generatingNodeForRegion->isElementNode() && generatingNodeForReg ion->hasID()) {
584 Element* element = toElement(generatingNodeForRegion); 602 Element* element = toElement(generatingNodeForRegion);
585 ts << " #" << element->idForStyleResolution(); 603 ts << " #" << element->idForStyleResolution();
586 } 604 }
587 if (renderRegion->hasCustomRegionStyle()) 605
588 ts << " region style: 1"; 606 if (isRenderNamedFlowFragment)
589 if (renderRegion->hasAutoLogicalHeight()) 607 ts << ")";
590 ts << " hasAutoLogicalHeight";
591 } 608 }
609
592 if (!renderRegion->isValid()) 610 if (!renderRegion->isValid())
593 ts << " invalid"; 611 ts << " invalid";
612
594 ts << "\n"; 613 ts << "\n";
595 } 614 }
596 } 615 }
597 616
598 static void writeRenderNamedFlowThreads(TextStream& ts, RenderView* renderView, const RenderLayer* rootLayer, 617 static void writeRenderNamedFlowThreads(TextStream& ts, RenderView* renderView, const RenderLayer* rootLayer,
599 const LayoutRect& paintRect, int indent, RenderAsTextBeh avior behavior) 618 const LayoutRect& paintRect, int indent, RenderAsTextBeh avior behavior)
600 { 619 {
601 if (!renderView->hasRenderNamedFlowThreads()) 620 if (!renderView->hasRenderNamedFlowThreads())
602 return; 621 return;
603 622
604 const RenderNamedFlowThreadList* list = renderView->flowThreadController()-> renderNamedFlowThreadList(); 623 const RenderNamedFlowThreadList* list = renderView->flowThreadController()-> renderNamedFlowThreadList();
605 624
606 writeIndent(ts, indent); 625 writeIndent(ts, indent);
607 ts << "Flow Threads\n"; 626 ts << "Named flows\n";
608 627
609 for (RenderNamedFlowThreadList::const_iterator iter = list->begin(); iter != list->end(); ++iter) { 628 for (RenderNamedFlowThreadList::const_iterator iter = list->begin(); iter != list->end(); ++iter) {
610 const RenderNamedFlowThread* renderFlowThread = *iter; 629 const RenderNamedFlowThread* renderFlowThread = *iter;
611 630
612 writeIndent(ts, indent + 1); 631 writeIndent(ts, indent + 1);
613 ts << "Thread with flow-name '" << renderFlowThread->flowThreadName() << "'\n"; 632 ts << "Named flow '" << renderFlowThread->flowThreadName() << "'\n";
614 633
615 RenderLayer* layer = renderFlowThread->layer(); 634 RenderLayer* layer = renderFlowThread->layer();
616 RenderTreeAsText::writeLayers(ts, rootLayer, layer, paintRect, indent + 2, behavior); 635 RenderTreeAsText::writeLayers(ts, rootLayer, layer, paintRect, indent + 2, behavior);
617 636
618 // Display the valid and invalid render regions attached to this flow th read. 637 // Display the valid and invalid render regions attached to this flow th read.
619 const RenderRegionList& validRegionsList = renderFlowThread->renderRegio nList(); 638 const RenderRegionList& validRegionsList = renderFlowThread->renderRegio nList();
639 if (!validRegionsList.isEmpty()) {
640 writeIndent(ts, indent + 2);
641 ts << "Regions for named flow '" << renderFlowThread->flowThreadName () << "'\n";
642 writeRenderRegionList(validRegionsList, ts, indent + 3);
643 }
644
620 const RenderRegionList& invalidRegionsList = renderFlowThread->invalidRe nderRegionList(); 645 const RenderRegionList& invalidRegionsList = renderFlowThread->invalidRe nderRegionList();
621 if (!validRegionsList.isEmpty() || !invalidRegionsList.isEmpty()) { 646 if (!invalidRegionsList.isEmpty()) {
622 writeIndent(ts, indent + 1); 647 writeIndent(ts, indent + 2);
623 ts << "Regions for flow '"<< renderFlowThread->flowThreadName() << " '\n"; 648 ts << "Invalid regions for named flow '" << renderFlowThread->flowTh readName() << "'\n";
624 writeRenderRegionList(validRegionsList, ts, indent); 649 writeRenderRegionList(invalidRegionsList, ts, indent + 3);
625 writeRenderRegionList(invalidRegionsList, ts, indent);
626 } 650 }
627 } 651 }
628 } 652 }
629 653
630 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* layer, 654 void RenderTreeAsText::writeLayers(TextStream& ts, const RenderLayer* rootLayer, RenderLayer* layer,
631 const LayoutRect& paintRect, int indent, RenderAsTextBeh avior behavior) 655 const LayoutRect& paintRect, int indent, RenderAsTextBeh avior behavior)
632 { 656 {
633 // FIXME: Apply overflow to the root layer to not break every test. Complet e hack. Sigh. 657 // FIXME: Apply overflow to the root layer to not break every test. Complet e hack. Sigh.
634 LayoutRect paintDirtyRect(paintRect); 658 LayoutRect paintDirtyRect(paintRect);
635 if (rootLayer == layer) { 659 if (rootLayer == layer) {
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 element->document().updateLayout(); 854 element->document().updateLayout();
831 855
832 RenderObject* renderer = element->renderer(); 856 RenderObject* renderer = element->renderer();
833 if (!renderer || !renderer->isListItem()) 857 if (!renderer || !renderer->isListItem())
834 return String(); 858 return String();
835 859
836 return toRenderListItem(renderer)->markerText(); 860 return toRenderListItem(renderer)->markerText();
837 } 861 }
838 862
839 } // namespace WebCore 863 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/rendering/RenderRegion.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698