void InspectorOverlay::drawQuadHighlight() { if (!m_highlightQuad) return; Highlight highlight; buildQuadHighlight(*m_highlightQuad, m_quadHighlightConfig, &highlight); evaluateInOverlay("drawQuadHighlight", buildObjectForHighlight(highlight)); }
void InspectorOverlay::drawQuadHighlight() { if (!m_highlightQuad) return; Highlight highlight; buildQuadHighlight(m_page, *m_highlightQuad, m_quadHighlightConfig, &highlight); evaluateInOverlay("drawQuadHighlight", buildObjectForHighlight(m_page->mainFrame()->view(), highlight)); }
void InspectorOverlay::drawRectHighlight() { if (!m_highlightRect) return; Highlight highlight; buildRectHighlight(m_page, m_highlightRect.get(), m_rectHighlightConfig, &highlight); evaluateInOverlay("drawRectHighlight", buildObjectForHighlight(m_page->mainFrame()->view(), highlight)); }
static PassRefPtr<InspectorArray> buildObjectForRendererFragments(RenderObject* renderer, const HighlightConfig& config) { RefPtr<InspectorArray> fragmentsArray = InspectorArray::create(); RenderFlowThread* containingFlowThread = renderer->flowThreadContainingBlock(); if (!containingFlowThread) { Highlight highlight; buildRendererHighlight(renderer, nullptr, config, &highlight, InspectorOverlay::CoordinateSystem::View); fragmentsArray->pushObject(buildObjectForHighlight(highlight)); } else { RenderRegion* startRegion = nullptr; RenderRegion* endRegion = nullptr; if (!containingFlowThread->getRegionRangeForBox(&renderer->enclosingBox(), startRegion, endRegion)) { // The flow has no visible regions. The renderer is not visible on screen. return nullptr; } const RenderRegionList& regionList = containingFlowThread->renderRegionList(); for (RenderRegionList::const_iterator iter = regionList.find(startRegion); iter != regionList.end(); ++iter) { RenderRegion* region = *iter; if (region->isValid()) { // Compute the highlight of the fragment inside the current region. Highlight highlight; buildRendererHighlight(renderer, region, config, &highlight, InspectorOverlay::CoordinateSystem::View); RefPtr<InspectorObject> fragmentObject = buildObjectForHighlight(highlight); // Compute the clipping area of the region. fragmentObject->setObject("region", buildObjectForCSSRegionContentClip(region)); fragmentsArray->pushObject(fragmentObject.release()); } if (region == endRegion) break; } } return fragmentsArray.release(); }
void InspectorOverlay::drawNodeHighlight() { if (!m_highlightNode) return; Highlight highlight; buildNodeHighlight(m_highlightNode.get(), m_nodeHighlightConfig, &highlight); if (m_eventTargetNode) { Highlight eventTargetHighlight; buildNodeHighlight(m_eventTargetNode.get(), m_nodeHighlightConfig, &eventTargetHighlight); highlight.quads.append(eventTargetHighlight.quads[1]); // Add border from eventTargetNode to highlight. } RefPtr<InspectorObject> highlightObject = buildObjectForHighlight(highlight); Node* node = m_highlightNode.get(); if (node->isElementNode() && m_nodeHighlightConfig.showInfo && node->renderer() && node->document()->frame()) { RefPtr<InspectorObject> elementInfo = InspectorObject::create(); Element* element = toElement(node); bool isXHTML = element->document()->isXHTMLDocument(); elementInfo->setString("tagName", isXHTML ? element->nodeName() : element->nodeName().lower()); elementInfo->setString("idValue", element->getIdAttribute()); HashSet<AtomicString> usedClassNames; if (element->hasClass() && element->isStyledElement()) { StringBuilder classNames; const SpaceSplitString& classNamesString = static_cast<StyledElement*>(element)->classNames(); size_t classNameCount = classNamesString.size(); for (size_t i = 0; i < classNameCount; ++i) { const AtomicString& className = classNamesString[i]; if (!usedClassNames.add(className).isNewEntry) continue; classNames.append('.'); classNames.append(className); } elementInfo->setString("className", classNames.toString()); } RenderObject* renderer = node->renderer(); Frame* containingFrame = node->document()->frame(); FrameView* containingView = containingFrame->view(); IntRect boundingBox = pixelSnappedIntRect(containingView->contentsToRootView(renderer->absoluteBoundingBoxRect())); RenderBoxModelObject* modelObject = renderer->isBoxModelObject() ? toRenderBoxModelObject(renderer) : 0; elementInfo->setString("nodeWidth", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetWidth(), modelObject) : boundingBox.width())); elementInfo->setString("nodeHeight", String::number(modelObject ? adjustForAbsoluteZoom(modelObject->pixelSnappedOffsetHeight(), modelObject) : boundingBox.height())); highlightObject->setObject("elementInfo", elementInfo.release()); } evaluateInOverlay("drawNodeHighlight", highlightObject); }