Bug 136138

Summary: Implement paint flashing in the WK1 InspectorOverlay page
Product: WebKit Reporter: Simon Fraser (smfr) <simon.fraser>
Component: Web InspectorAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: graouts, joepeck, simon.fraser, timothy, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch sam: review+

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