WebKit Bugzilla
Attachment 357882 Details for
Bug 105023
: Web Inspector: Change the InspectorOverlay to use native rather than canvas
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
[Patch] WIP
bug-105023-20181220164716.patch (text/plain), 4.96 KB, created by
Devin Rousso
on 2018-12-20 15:47:17 PST
(
hide
)
Description:
[Patch] WIP
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2018-12-20 15:47:17 PST
Size:
4.96 KB
patch
obsolete
>diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp >index 3e3bc816ea90c6436313ca5e3c8f0d985e53d9aa..fed59a17a21e884596a99ff566e98f87fe4e1725 100644 >--- a/Source/WebCore/inspector/InspectorOverlay.cpp >+++ b/Source/WebCore/inspector/InspectorOverlay.cpp >@@ -180,19 +180,14 @@ void InspectorOverlay::paint(GraphicsContext& context) > if (!shouldShowOverlay()) > return; > >- Page* overlayPage = this->overlayPage(); >- if (!overlayPage) >- return; >- >- GraphicsContextStateSaver stateSaver(context); >- FrameView* view = overlayPage->mainFrame().view(); >- >-#if PLATFORM(MAC) >- LocalDefaultSystemAppearance localAppearance(view->useDarkAppearance()); >-#endif >- >- view->updateLayoutAndStyleIfNeededRecursive(); >- view->paint(context, IntRect(0, 0, view->width(), view->height())); >+ if (m_highlightNode) >+ drawNodeHighlight(context, *m_highlightNode); >+ else if (m_highlightNodeList) { >+ for (unsigned i = 0; i < m_highlightNodeList->length(); ++i) { >+ if (auto* node = m_highlightNodeList->item(i)) >+ drawNodeHighlight(context, *node); >+ } >+ } > } > > void InspectorOverlay::getHighlight(Highlight& highlight, InspectorOverlay::CoordinateSystem coordinateSystem) const >@@ -307,7 +302,6 @@ void InspectorOverlay::update() > reset(viewportSize, scrollOffset); > > // Include scrollbars to avoid masking them by the gutter. >- drawNodeHighlight(); > drawQuadHighlight(); > drawPausedInDebuggerMessage(); > drawPaintRects(); >@@ -688,10 +682,78 @@ Ref<JSON::ArrayOf<Inspector::Protocol::OverlayTypes::NodeHighlightData>> Inspect > return highlights; > } > >-void InspectorOverlay::drawNodeHighlight() >+static Path quadToPath(const FloatQuad& quad) > { >- if (m_highlightNode || m_highlightNodeList) >- evaluateInOverlay("drawNodeHighlight", buildObjectForHighlightedNodes()); >+ Path path; >+ path.moveTo(quad.p1()); >+ path.addLineTo(quad.p2()); >+ path.addLineTo(quad.p3()); >+ path.addLineTo(quad.p4()); >+ path.closeSubpath(); >+ return path; >+} >+ >+static void drawOutlinedQuadWithClip(GraphicsContext& context, const FloatQuad& quad, const FloatQuad& clipQuad, const Color& fillColor) >+{ >+ GraphicsContextStateSaver stateSaver(context); >+ >+ context.setFillColor(fillColor); >+ context.setStrokeThickness(0); >+ context.fillPath(quadToPath(quad)); >+ >+ context.setCompositeOperation(CompositeDestinationOut); >+ context.setFillColor(Color::createUnchecked(255, 0, 0)); >+ context.fillPath(quadToPath(clipQuad)); >+} >+ >+static void drawOutlinedQuad(GraphicsContext& context, const FloatQuad& quad, const Color& fillColor, const Color& outlineColor) >+{ >+ auto path = quadToPath(quad); >+ >+ GraphicsContextStateSaver stateSaver(context); >+ >+ context.setStrokeThickness(2); >+ >+ context.clipPath(path); >+ >+ context.setFillColor(fillColor); >+ context.fillPath(path); >+ >+ context.setStrokeColor(outlineColor); >+ context.strokePath(path); >+} >+ >+void InspectorOverlay::drawNodeHighlight(GraphicsContext& context, Node& node) >+{ >+ auto* renderer = node.renderer(); >+ if (!renderer) >+ return; >+ >+ Highlight highlight; >+ buildRendererHighlight(renderer, m_nodeHighlightConfig, highlight, InspectorOverlay::CoordinateSystem::View); >+ >+ auto& marginQuad = highlight.quads[0]; >+ auto& borderQuad = highlight.quads[1]; >+ auto& paddingQuad = highlight.quads[2]; >+ auto& contentQuad = highlight.quads[3]; >+ >+ GraphicsContextStateSaver stateSaver(context); >+ >+ auto* mainView = m_page.mainFrame().view(); >+ if (!mainView->delegatesScrolling()) >+ context.translate(mainView->visibleContentRect().location()); >+ >+ if (highlight.marginColor.isVisible() && marginQuad != borderQuad) >+ drawOutlinedQuadWithClip(context, marginQuad, borderQuad, highlight.marginColor); >+ >+ if (highlight.borderColor.isVisible() && borderQuad != paddingQuad) >+ drawOutlinedQuadWithClip(context, borderQuad, paddingQuad, highlight.borderColor); >+ >+ if (highlight.paddingColor.isVisible() && paddingQuad != contentQuad) >+ drawOutlinedQuadWithClip(context, paddingQuad, contentQuad, highlight.paddingColor); >+ >+ if (highlight.contentColor.isVisible() || highlight.contentOutlineColor.isVisible()) >+ drawOutlinedQuad(context, contentQuad, highlight.contentColor, highlight.contentOutlineColor); > } > > void InspectorOverlay::drawQuadHighlight() >diff --git a/Source/WebCore/inspector/InspectorOverlay.h b/Source/WebCore/inspector/InspectorOverlay.h >index a24becdd27125ab3aa0e2971c1708f3d3f5cbfef..691d55f2f37071b685417d4bad500e02be47a338 100644 >--- a/Source/WebCore/inspector/InspectorOverlay.h >+++ b/Source/WebCore/inspector/InspectorOverlay.h >@@ -130,7 +130,7 @@ public: > void freePage(); > private: > bool shouldShowOverlay() const; >- void drawNodeHighlight(); >+ void drawNodeHighlight(GraphicsContext&, Node&); > void drawQuadHighlight(); > void drawPausedInDebuggerMessage(); > void drawPaintRects();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 105023
:
357882
|
358151
|
358152
|
358153
|
358158
|
358160
|
358161
|
358162
|
358163
|
358165
|
358215
|
358222
|
358223
|
358226
|
360812
|
360821
|
361060
|
361061
|
361062
|
362873
|
362874