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

Side by Side Diff: Source/core/inspector/InspectorOverlay.cpp

Issue 977113003: Rename renderer() to layoutObject(). (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase to master Created 5 years, 9 months 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google 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 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 contentsQuadToRootFrame(containingView, *content); 297 contentsQuadToRootFrame(containingView, *content);
298 contentsQuadToRootFrame(containingView, *padding); 298 contentsQuadToRootFrame(containingView, *padding);
299 contentsQuadToRootFrame(containingView, *border); 299 contentsQuadToRootFrame(containingView, *border);
300 contentsQuadToRootFrame(containingView, *margin); 300 contentsQuadToRootFrame(containingView, *margin);
301 301
302 return true; 302 return true;
303 } 303 }
304 304
305 static void buildNodeHighlight(Node& node, const HighlightConfig& highlightConfi g, Highlight* highlight) 305 static void buildNodeHighlight(Node& node, const HighlightConfig& highlightConfi g, Highlight* highlight)
306 { 306 {
307 LayoutObject* renderer = node.renderer(); 307 LayoutObject* renderer = node.layoutObject();
308 if (!renderer) 308 if (!renderer)
309 return; 309 return;
310 310
311 highlight->setDataFromConfig(highlightConfig); 311 highlight->setDataFromConfig(highlightConfig);
312 312
313 // LayoutSVGRoot should be highlighted through the isBox() code path, all ot her SVG elements should just dump their absoluteQuads(). 313 // LayoutSVGRoot should be highlighted through the isBox() code path, all ot her SVG elements should just dump their absoluteQuads().
314 if (renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVG Root()) { 314 if (renderer->node() && renderer->node()->isSVGElement() && !renderer->isSVG Root()) {
315 Vector<FloatQuad> quads; 315 Vector<FloatQuad> quads;
316 renderer->absoluteQuads(quads); 316 renderer->absoluteQuads(quads);
317 FrameView* containingView = renderer->frameView(); 317 FrameView* containingView = renderer->frameView();
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 array->addItem(quad.p2().y()); 585 array->addItem(quad.p2().y());
586 array->addItem(quad.p3().x()); 586 array->addItem(quad.p3().x());
587 array->addItem(quad.p3().y()); 587 array->addItem(quad.p3().y());
588 array->addItem(quad.p4().x()); 588 array->addItem(quad.p4().x());
589 array->addItem(quad.p4().y()); 589 array->addItem(quad.p4().y());
590 return array.release(); 590 return array.release();
591 } 591 }
592 592
593 static const ShapeOutsideInfo* shapeOutsideInfoForNode(Node* node, Shape::Displa yPaths* paths, FloatQuad* bounds) 593 static const ShapeOutsideInfo* shapeOutsideInfoForNode(Node* node, Shape::Displa yPaths* paths, FloatQuad* bounds)
594 { 594 {
595 LayoutObject* renderer = node->renderer(); 595 LayoutObject* renderer = node->layoutObject();
596 if (!renderer || !renderer->isBox() || !toLayoutBox(renderer)->shapeOutsideI nfo()) 596 if (!renderer || !renderer->isBox() || !toLayoutBox(renderer)->shapeOutsideI nfo())
597 return nullptr; 597 return nullptr;
598 598
599 FrameView* containingView = node->document().view(); 599 FrameView* containingView = node->document().view();
600 LayoutBox* layoutBox = toLayoutBox(renderer); 600 LayoutBox* layoutBox = toLayoutBox(renderer);
601 const ShapeOutsideInfo* shapeOutsideInfo = layoutBox->shapeOutsideInfo(); 601 const ShapeOutsideInfo* shapeOutsideInfo = layoutBox->shapeOutsideInfo();
602 602
603 shapeOutsideInfo->computedShape().buildDisplayPaths(*paths); 603 shapeOutsideInfo->computedShape().buildDisplayPaths(*paths);
604 604
605 LayoutRect shapeBounds = shapeOutsideInfo->computedShapePhysicalBoundingBox( ); 605 LayoutRect shapeBounds = shapeOutsideInfo->computedShapePhysicalBoundingBox( );
(...skipping 10 matching lines...) Expand all
616 616
617 const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &pa ths, &boundsQuad); 617 const ShapeOutsideInfo* shapeOutsideInfo = shapeOutsideInfoForNode(node, &pa ths, &boundsQuad);
618 if (!shapeOutsideInfo) 618 if (!shapeOutsideInfo)
619 return; 619 return;
620 620
621 if (!paths.shape.length()) { 621 if (!paths.shape.length()) {
622 highlight.appendQuad(boundsQuad, config.shape); 622 highlight.appendQuad(boundsQuad, config.shape);
623 return; 623 return;
624 } 624 }
625 625
626 highlight.appendPath(ShapePathBuilder::buildPath(*node->document().view(), * node->renderer(), *shapeOutsideInfo, paths.shape), config.shape, Color::transpar ent); 626 highlight.appendPath(ShapePathBuilder::buildPath(*node->document().view(), * node->layoutObject(), *shapeOutsideInfo, paths.shape), config.shape, Color::tran sparent);
627 if (paths.marginShape.length()) 627 if (paths.marginShape.length())
628 highlight.appendPath(ShapePathBuilder::buildPath(*node->document().view( ), *node->renderer(), *shapeOutsideInfo, paths.marginShape), config.shapeMargin, Color::transparent); 628 highlight.appendPath(ShapePathBuilder::buildPath(*node->document().view( ), *node->layoutObject(), *shapeOutsideInfo, paths.marginShape), config.shapeMar gin, Color::transparent);
629 } 629 }
630 630
631 PassRefPtr<JSONObject> buildElementInfo(Element* element) 631 PassRefPtr<JSONObject> buildElementInfo(Element* element)
632 { 632 {
633 RefPtr<JSONObject> elementInfo = JSONObject::create(); 633 RefPtr<JSONObject> elementInfo = JSONObject::create();
634 Element* realElement = element; 634 Element* realElement = element;
635 PseudoElement* pseudoElement = nullptr; 635 PseudoElement* pseudoElement = nullptr;
636 if (element->isPseudoElement()) { 636 if (element->isPseudoElement()) {
637 pseudoElement = toPseudoElement(element); 637 pseudoElement = toPseudoElement(element);
638 realElement = element->parentOrShadowHostElement(); 638 realElement = element->parentOrShadowHostElement();
(...skipping 16 matching lines...) Expand all
655 } 655 }
656 if (pseudoElement) { 656 if (pseudoElement) {
657 if (pseudoElement->pseudoId() == BEFORE) 657 if (pseudoElement->pseudoId() == BEFORE)
658 classNames.appendLiteral("::before"); 658 classNames.appendLiteral("::before");
659 else if (pseudoElement->pseudoId() == AFTER) 659 else if (pseudoElement->pseudoId() == AFTER)
660 classNames.appendLiteral("::after"); 660 classNames.appendLiteral("::after");
661 } 661 }
662 if (!classNames.isEmpty()) 662 if (!classNames.isEmpty())
663 elementInfo->setString("className", classNames.toString()); 663 elementInfo->setString("className", classNames.toString());
664 664
665 LayoutObject* renderer = element->renderer(); 665 LayoutObject* renderer = element->layoutObject();
666 FrameView* containingView = element->document().view(); 666 FrameView* containingView = element->document().view();
667 if (!renderer || !containingView) 667 if (!renderer || !containingView)
668 return elementInfo; 668 return elementInfo;
669 669
670 // Render the getBoundingClientRect() data in the tooltip 670 // Render the getBoundingClientRect() data in the tooltip
671 // to be consistent with the rulers (see http://crbug.com/262338). 671 // to be consistent with the rulers (see http://crbug.com/262338).
672 RefPtrWillBeRawPtr<ClientRect> boundingBox = element->getBoundingClientRect( ); 672 RefPtrWillBeRawPtr<ClientRect> boundingBox = element->getBoundingClientRect( );
673 elementInfo->setString("nodeWidth", String::number(boundingBox->width())); 673 elementInfo->setString("nodeWidth", String::number(boundingBox->width()));
674 elementInfo->setString("nodeHeight", String::number(boundingBox->height())); 674 elementInfo->setString("nodeHeight", String::number(boundingBox->height()));
675 675
676 return elementInfo; 676 return elementInfo;
677 } 677 }
678 678
679 void InspectorOverlay::drawNodeHighlight() 679 void InspectorOverlay::drawNodeHighlight()
680 { 680 {
681 if (!m_highlightNode) 681 if (!m_highlightNode)
682 return; 682 return;
683 683
684 Highlight highlight; 684 Highlight highlight;
685 appendPathsForShapeOutside(highlight, m_nodeHighlightConfig, m_highlightNode .get()); 685 appendPathsForShapeOutside(highlight, m_nodeHighlightConfig, m_highlightNode .get());
686 buildNodeHighlight(*m_highlightNode, m_nodeHighlightConfig, &highlight); 686 buildNodeHighlight(*m_highlightNode, m_nodeHighlightConfig, &highlight);
687 687
688 if (m_eventTargetNode && m_eventTargetNode->renderer()) { 688 if (m_eventTargetNode && m_eventTargetNode->layoutObject()) {
689 FloatQuad border, unused; 689 FloatQuad border, unused;
690 if (buildNodeQuads(m_eventTargetNode->renderer(), &unused, &unused, &bor der, &unused)) 690 if (buildNodeQuads(m_eventTargetNode->layoutObject(), &unused, &unused, &border, &unused))
691 highlight.appendQuad(border, m_nodeHighlightConfig.eventTarget); 691 highlight.appendQuad(border, m_nodeHighlightConfig.eventTarget);
692 } 692 }
693 693
694 if (m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightCon fig.showInfo && m_highlightNode->renderer() && m_highlightNode->document().frame ()) 694 if (m_highlightNode->isElementNode() && !m_omitTooltip && m_nodeHighlightCon fig.showInfo && m_highlightNode->layoutObject() && m_highlightNode->document().f rame())
695 highlight.setElementInfo(buildElementInfo(toElement(m_highlightNode.get( )))); 695 highlight.setElementInfo(buildElementInfo(toElement(m_highlightNode.get( ))));
696 696
697 evaluateInOverlay("drawHighlight", highlight.asJSONObject()); 697 evaluateInOverlay("drawHighlight", highlight.asJSONObject());
698 } 698 }
699 699
700 void InspectorOverlay::drawQuadHighlight() 700 void InspectorOverlay::drawQuadHighlight()
701 { 701 {
702 if (!m_highlightQuad) 702 if (!m_highlightQuad)
703 return; 703 return;
704 704
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 } 813 }
814 814
815 void InspectorOverlay::onTimer(Timer<InspectorOverlay>*) 815 void InspectorOverlay::onTimer(Timer<InspectorOverlay>*)
816 { 816 {
817 m_drawViewSize = false; 817 m_drawViewSize = false;
818 update(); 818 update();
819 } 819 }
820 820
821 bool InspectorOverlay::getBoxModel(Node* node, RefPtr<TypeBuilder::DOM::BoxModel >& model) 821 bool InspectorOverlay::getBoxModel(Node* node, RefPtr<TypeBuilder::DOM::BoxModel >& model)
822 { 822 {
823 LayoutObject* renderer = node->renderer(); 823 LayoutObject* renderer = node->layoutObject();
824 FrameView* view = node->document().view(); 824 FrameView* view = node->document().view();
825 if (!renderer || !view) 825 if (!renderer || !view)
826 return false; 826 return false;
827 827
828 FloatQuad content, padding, border, margin; 828 FloatQuad content, padding, border, margin;
829 if (!buildNodeQuads(node->renderer(), &content, &padding, &border, &margin)) 829 if (!buildNodeQuads(node->layoutObject(), &content, &padding, &border, &marg in))
830 return false; 830 return false;
831 831
832 IntRect boundingBox = view->contentsToRootFrame(renderer->absoluteBoundingBo xRect()); 832 IntRect boundingBox = view->contentsToRootFrame(renderer->absoluteBoundingBo xRect());
833 LayoutBoxModelObject* modelObject = renderer->isBoxModelObject() ? toLayoutB oxModelObject(renderer) : nullptr; 833 LayoutBoxModelObject* modelObject = renderer->isBoxModelObject() ? toLayoutB oxModelObject(renderer) : nullptr;
834 834
835 model = TypeBuilder::DOM::BoxModel::create() 835 model = TypeBuilder::DOM::BoxModel::create()
836 .setContent(buildArrayForQuad(content)) 836 .setContent(buildArrayForQuad(content))
837 .setPadding(buildArrayForQuad(padding)) 837 .setPadding(buildArrayForQuad(padding))
838 .setBorder(buildArrayForQuad(border)) 838 .setBorder(buildArrayForQuad(border))
839 .setMargin(buildArrayForQuad(margin)) 839 .setMargin(buildArrayForQuad(margin))
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 hideHighlight(); 888 hideHighlight();
889 } 889 }
890 890
891 void InspectorOverlay::startedRecordingProfile() 891 void InspectorOverlay::startedRecordingProfile()
892 { 892 {
893 if (!m_activeProfilerCount++) 893 if (!m_activeProfilerCount++)
894 freePage(); 894 freePage();
895 } 895 }
896 896
897 } // namespace blink 897 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698