Bug 136138 - Implement paint flashing in the WK1 InspectorOverlay page
Summary: Implement paint flashing in the WK1 InspectorOverlay page
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Simon Fraser (smfr)
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2014-08-21 16:34 PDT by Simon Fraser (smfr)
Modified: 2014-08-22 13:26 PDT (History)
5 users (show)

See Also:


Attachments
Patch (19.82 KB, patch)
2014-08-21 16:38 PDT, Simon Fraser (smfr)
sam: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Simon Fraser (smfr) 2014-08-21 16:34:15 PDT
Implement paint flashing in the WK1 InspectorOverlay page
Comment 1 Simon Fraser (smfr) 2014-08-21 16:38:00 PDT
Created attachment 236944 [details]
Patch
Comment 2 Radar WebKit Bug Importer 2014-08-21 16:38:58 PDT
<rdar://problem/18096165>
Comment 3 Sam Weinig 2014-08-21 18:04:19 PDT
Comment on attachment 236944 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236944&action=review

> Source/WebCore/inspector/InspectorOverlay.cpp:494
> +    double removeTime = currentTime() + 0.25;

Wat? Crono?

> Source/WebCore/inspector/InspectorOverlay.cpp:498
> +        m_paintRectUpdateTimer.startRepeating(0.016);

Wat?

> Source/WebCore/inspector/InspectorOverlayPage.js:210
> +    // Don't get the context until we need to paint, to avoid backing store allocation.

This comment is weirdly paragraphed?

> Source/WebCore/inspector/InspectorOverlayPage.js:216
> +    // clear paint rects?

This is weird? At least add a FIXME: and capitalize the C in clear.

> Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h:107
> +#if PLATFORM(IOS)
> +    bool m_showingPaintRects;
> +#endif
>  };

This is unused. You should remove it.
Comment 4 Joseph Pecoraro 2014-08-21 18:27:09 PDT
Comment on attachment 236944 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=236944&action=review

> Source/WebCore/inspector/InspectorOverlay.cpp:347
> +    object->setNumber("x", rect.x());
> +    object->setNumber("y", rect.y());
> +    object->setNumber("width", rect.width());
> +    object->setNumber("height", rect.height());

Nit: ASCIILiteral for each of the keys.

> Source/WebCore/inspector/InspectorOverlay.cpp:528
> +    evaluateInOverlay("updatePaintRects", fragmentsArray.release());

Nit: ASCIILiteral("updatePaintRects")

> Source/WebCore/inspector/InspectorOverlayPage.js:183
> +    for (var i in paintRectList) {
> +        var rectObject = paintRectList[i];
> +        context.fillRect(rectObject.x, rectObject.y, rectObject.width, rectObject.height);
> +    }

You should not use "for..in" for array iteration (and paintRectList is an Array).

You could write this:

    for (var rectObject of paintRectList)
        context.fillRect(rectObject.x, rectObject.y, rectObject.width, rectObject.height);

> Source/WebKit/mac/WebCoreSupport/WebInspectorClient.h:80
> +    virtual bool overridesShowPaintRects() override { return true; }

Ideally this would be "const".
Comment 5 Simon Fraser (smfr) 2014-08-22 13:26:46 PDT
https://trac.webkit.org/r172869