WebKit Bugzilla
Attachment 373585 Details for
Bug 199369
: Web Inspector: Overlay: add page width/height display
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199369-20190706155435.patch (text/plain), 3.42 KB, created by
Devin Rousso
on 2019-07-06 15:54:36 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-07-06 15:54:36 PDT
Size:
3.42 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 3ad5fedf933bd6bfc81809a8ca08d4ceab0fbdce..6e18fd293a46a7fea622b2fc3cef9df6b1e1b902 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,16 @@ >+2019-07-06 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: Overlay: add page width/height display >+ https://bugs.webkit.org/show_bug.cgi?id=199369 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Show `${width}px x ${height}px` in the corner where the horizontal and vertical rulers meet. >+ This way, if the rulers shift due to the highlighted content, the page width/height does too. >+ >+ * inspector/InspectorOverlay.cpp: >+ (WebCore::InspectorOverlay::drawRulers): >+ > 2019-07-05 Youenn Fablet <youenn@apple.com> > > Carvana.com needs the fetch AbortSignal quirk >diff --git a/Source/WebCore/inspector/InspectorOverlay.cpp b/Source/WebCore/inspector/InspectorOverlay.cpp >index 09cbf6564181eed5b37c9fd43ad64a1640acadd3..30892e86bd04c902277fbcf058cf95703354263b 100644 >--- a/Source/WebCore/inspector/InspectorOverlay.cpp >+++ b/Source/WebCore/inspector/InspectorOverlay.cpp >@@ -74,6 +74,8 @@ static constexpr float rulerStepLength = 8; > static constexpr float rulerSubStepIncrement = 5; > static constexpr float rulerSubStepLength = 5; > >+static constexpr float viewportSizePadding = 5; >+ > static void truncateWithEllipsis(String& string, size_t length) > { > const UChar ellipsisUChar[] = { 0x2026, 0 }; >@@ -832,6 +834,44 @@ void InspectorOverlay::drawRulers(GraphicsContext& context, const Highlight::Bou > } > } > } >+ >+ // Draw viewport size. >+ { >+ auto viewportRect = pageView->visualViewportRect(); >+ auto viewportWidthText = String::numberToStringFixedPrecision(viewportRect.width() / pageZoomFactor); >+ auto viewportHeightText = String::numberToStringFixedPrecision(viewportRect.height() / pageZoomFactor); >+ >+ const UChar multiplicationSignUChar[] = { 0x00D7, 0 }; >+ TextRun viewportTextRun(makeString(viewportWidthText, "px", ' ', multiplicationSignUChar, ' ', viewportHeightText, "px")); >+ >+ FontCascadeDescription fontDescription; >+ fontDescription.setOneFamily(m_page.settings().sansSerifFontFamily()); >+ fontDescription.setComputedSize(14); >+ >+ FontCascade font(WTFMove(fontDescription), 0, 0); >+ font.update(nullptr); >+ >+ float viewportTextWidth = font.width(viewportTextRun); >+ float viewportTextHeight = font.fontMetrics().height(); >+ >+ GraphicsContextStateSaver viewportSizeStateSaver(context); >+ >+ if (drawLeftEdge) >+ context.translate(cornerX + rulerSize, 0); >+ else >+ context.translate(cornerX - (viewportSizePadding * 2.0f) - viewportTextWidth, 0); >+ >+ if (drawTopEdge) >+ context.translate(0, cornerY + rulerSize); >+ else >+ context.translate(0, cornerY - (viewportSizePadding * 2.0f) - viewportTextHeight); >+ >+ context.setFillColor(rulerBackgroundColor); >+ context.fillRect({ 0, 0, (viewportSizePadding * 2.0f) + viewportTextWidth, (viewportSizePadding * 2.0f) + viewportTextHeight }); >+ >+ context.setFillColor(Color::black); >+ context.drawText(font, viewportTextRun, { viewportSizePadding, (viewportSizePadding * 2.0f) + (viewportTextHeight / 2.0f) }); >+ } > } > > void InspectorOverlay::drawElementTitle(GraphicsContext& context, Node& node, const Highlight::Bounds& bounds)
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 199369
:
373585
|
373821
|
373822
|
375236
|
375237