- Revision
- 261614
- Author
- [email protected]
- Date
- 2020-05-13 06:48:03 -0700 (Wed, 13 May 2020)
Log Message
Selected element on Web Inspector is not highlighted with CPU Rendering.
https://bugs.webkit.org/show_bug.cgi?id=195933
Patch by Tomoki Imai <[email protected]> on 2020-05-13
Reviewed by Devin Rousso.
Source/WebCore:
Expose InspectorOverlay::shouldShowOverlay via InspectorController.
It's used to determine whether WebPage needs a transparency layer to draw highlight.
* inspector/InspectorController.cpp:
(WebCore::InspectorController::shouldShowOverlay const):
* inspector/InspectorController.h:
* inspector/InspectorOverlay.h:
Source/WebKit:
Since WebInspectorClient::drawHighlight was not called while non accelerated compositing mode, we cannot see element highlight on web inspector.
This patch adds WebInspectorClient::drawHighlight call in WebPage::drawRect, which draws webpage image while non accelerated compositing mode, to overlay the highlight.
WebInspectorClient::highlight and WebInspectorClient::hideHighlight currently requests re-paint whole web page, but it should be able to optimize by only updating dirty rects in the future.
* WebProcess/Inspector/WebInspectorClient.cpp:
(WebKit::WebInspectorClient::highlight): If it's not acceleratedCompositingEnabled, then just request repaint.
(WebKit::WebInspectorClient::hideHighlight): If it's not acceleratedCompositingEnabled, then just request repaint.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::drawRect): Draw inspector overlay here if it's not accelerated compositing mode.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (261613 => 261614)
--- trunk/Source/WebCore/ChangeLog 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebCore/ChangeLog 2020-05-13 13:48:03 UTC (rev 261614)
@@ -1,3 +1,18 @@
+2020-05-13 Tomoki Imai <[email protected]>
+
+ Selected element on Web Inspector is not highlighted with CPU Rendering.
+ https://bugs.webkit.org/show_bug.cgi?id=195933
+
+ Reviewed by Devin Rousso.
+
+ Expose InspectorOverlay::shouldShowOverlay via InspectorController.
+ It's used to determine whether WebPage needs a transparency layer to draw highlight.
+
+ * inspector/InspectorController.cpp:
+ (WebCore::InspectorController::shouldShowOverlay const):
+ * inspector/InspectorController.h:
+ * inspector/InspectorOverlay.h:
+
2020-05-13 Zan Dobersek <[email protected]>
REGRESSION(r261023): [GTK][WPE] Several WebGL tests are failing
Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (261613 => 261614)
--- trunk/Source/WebCore/inspector/InspectorController.cpp 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp 2020-05-13 13:48:03 UTC (rev 261614)
@@ -361,6 +361,11 @@
m_overlay->getHighlight(highlight, coordinateSystem);
}
+bool InspectorController::shouldShowOverlay() const
+{
+ return m_overlay->shouldShowOverlay();
+}
+
void InspectorController::inspect(Node* node)
{
if (!enabled())
Modified: trunk/Source/WebCore/inspector/InspectorController.h (261613 => 261614)
--- trunk/Source/WebCore/inspector/InspectorController.h 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebCore/inspector/InspectorController.h 2020-05-13 13:48:03 UTC (rev 261614)
@@ -90,6 +90,7 @@
WEBCORE_EXPORT void disconnectAllFrontends();
void inspect(Node*);
+ WEBCORE_EXPORT bool shouldShowOverlay() const;
WEBCORE_EXPORT void drawHighlight(GraphicsContext&) const;
WEBCORE_EXPORT void getHighlight(Highlight&, InspectorOverlay::CoordinateSystem) const;
void hideHighlight();
Modified: trunk/Source/WebCore/inspector/InspectorOverlay.h (261613 => 261614)
--- trunk/Source/WebCore/inspector/InspectorOverlay.h 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebCore/inspector/InspectorOverlay.h 2020-05-13 13:48:03 UTC (rev 261614)
@@ -107,6 +107,7 @@
void update();
void paint(GraphicsContext&);
void getHighlight(Highlight&, CoordinateSystem) const;
+ bool shouldShowOverlay() const;
void hideHighlight();
void highlightNodeList(RefPtr<NodeList>&&, const HighlightConfig&);
@@ -128,8 +129,6 @@
private:
using TimeRectPair = std::pair<MonotonicTime, FloatRect>;
- bool shouldShowOverlay() const;
-
struct RulerExclusion {
Highlight::Bounds bounds;
Path titlePath;
Modified: trunk/Source/WebKit/ChangeLog (261613 => 261614)
--- trunk/Source/WebKit/ChangeLog 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebKit/ChangeLog 2020-05-13 13:48:03 UTC (rev 261614)
@@ -1,3 +1,20 @@
+2020-05-13 Tomoki Imai <[email protected]>
+
+ Selected element on Web Inspector is not highlighted with CPU Rendering.
+ https://bugs.webkit.org/show_bug.cgi?id=195933
+
+ Reviewed by Devin Rousso.
+
+ Since WebInspectorClient::drawHighlight was not called while non accelerated compositing mode, we cannot see element highlight on web inspector.
+ This patch adds WebInspectorClient::drawHighlight call in WebPage::drawRect, which draws webpage image while non accelerated compositing mode, to overlay the highlight.
+ WebInspectorClient::highlight and WebInspectorClient::hideHighlight currently requests re-paint whole web page, but it should be able to optimize by only updating dirty rects in the future.
+
+ * WebProcess/Inspector/WebInspectorClient.cpp:
+ (WebKit::WebInspectorClient::highlight): If it's not acceleratedCompositingEnabled, then just request repaint.
+ (WebKit::WebInspectorClient::hideHighlight): If it's not acceleratedCompositingEnabled, then just request repaint.
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::drawRect): Draw inspector overlay here if it's not accelerated compositing mode.
+
2020-05-13 Carlos Garcia Campos <[email protected]>
Unreviewed. Fix GTK debug build after r261554
Modified: trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp (261613 => 261614)
--- trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebKit/WebProcess/Inspector/WebInspectorClient.cpp 2020-05-13 13:48:03 UTC (rev 261614)
@@ -111,8 +111,15 @@
void WebInspectorClient::highlight()
{
- if (!m_page->corePage()->settings().acceleratedCompositingEnabled())
+ if (!m_page->corePage()->settings().acceleratedCompositingEnabled()) {
+#if PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(PLAYSTATION)
+ // FIXME: It can be optimized by marking only highlighted rect dirty.
+ // setNeedsDisplay always makes whole rect dirty, and could lead to poor performance.
+ // https://bugs.webkit.org/show_bug.cgi?id=195933
+ m_page->drawingArea()->setNeedsDisplay();
+#endif
return;
+ }
#if !PLATFORM(IOS_FAMILY)
if (!m_highlightOverlay) {
@@ -133,6 +140,16 @@
void WebInspectorClient::hideHighlight()
{
+#if PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(PLAYSTATION)
+ if (!m_page->corePage()->settings().acceleratedCompositingEnabled()) {
+ // FIXME: It can be optimized by marking only highlighted rect dirty.
+ // setNeedsDisplay always makes whole rect dirty, and could lead to poor performance.
+ // https://bugs.webkit.org/show_bug.cgi?id=195933
+ m_page->drawingArea()->setNeedsDisplay();
+ return;
+ }
+#endif
+
#if !PLATFORM(IOS_FAMILY)
if (m_highlightOverlay)
m_page->corePage()->pageOverlayController().uninstallPageOverlay(*m_highlightOverlay, PageOverlay::FadeMode::Fade);
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (261613 => 261614)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-05-13 13:41:43 UTC (rev 261613)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2020-05-13 13:48:03 UTC (rev 261614)
@@ -1812,6 +1812,14 @@
graphicsContext.clip(rect);
m_mainFrame->coreFrame()->view()->paint(graphicsContext, rect);
+
+#if PLATFORM(GTK) || PLATFORM(WIN) || PLATFORM(PLAYSTATION)
+ if (!m_page->settings().acceleratedCompositingEnabled() && m_page->inspectorController().enabled() && m_page->inspectorController().shouldShowOverlay()) {
+ graphicsContext.beginTransparencyLayer(1);
+ m_page->inspectorController().drawHighlight(graphicsContext);
+ graphicsContext.endTransparencyLayer();
+ }
+#endif
}
double WebPage::textZoomFactor() const