[webkit-dev] Web Inspector tests for DOM node highlights

Max Vujovic mvujovic at adobe.com
Fri Feb 24 11:32:31 PST 2012


(CC-ing webkit-dev)


> I would not do that. We should not add methods for testing into the
>inspector protocol. Also, having the highlight figures right does not
>guarantee proper rendering (scrollbars, etc. might affect things).

Ok. That makes sense. A lot can go wrong between having the correct quad
values and getting them on the screen. I'll keep going with the pixel
tests approach.

Thanks for feedback,
Max

On 2/24/12 12:10 AM, "Pavel Feldman" <pfeldman at chromium.org> wrote:

>
>
>On Fri, Feb 24, 2012 at 2:00 AM, Max Vujovic <mvujovic at adobe.com> wrote:
>
>Hi Pavel,
>
>I'd like your opinion on another approach to enable highlight tests
>without using pixel tests.
>
>We could expose the highlight data to the inspector via a new method in
>InspectorDOMAgent.h called "getHighlight". This would enable us to test
>the position and size of highlight quadrants programmatically, like the
>other inspector tests.
>
>
>
>
>I would not do that. We should not add methods for testing into the
>inspector protocol. Also, having the highlight figures right does not
>guarantee proper rendering (scrollbars, etc. might affect things).
>
>
>I would define "getHighlight" next to InspectorDOMAgent.h's other
>highlight-related methods (hideHighlight, highlightRect, highlightNode,
>and highlightFrame).
>
>A variant to this approach is that instead of defining a new method, the
>highlightNode method could return the highlight data. However, this
>approach is perhaps not as flexible or elegant in case the highlight
>changes (e.g. page zoom changes, the node changes).
>
>I'm bringing all of this up because I usually try to avoid pixel tests
>because of the associated platform maintenance, and the PNGs that make
>WebKit bigger.
>
>
>
>In this case, you are validating the result of the paint, so I think
>pixel tests are appropriate.
>
>
>
>
>What are your thoughts? Do you think we should expose the highlight
>information or create pixel tests?
>
>(Also, do you mind if we re-CC webkit-dev on this? I noticed we start
>emailing each other directly, and I have some colleagues at work who have
>become interested in this discussion.)
>
>
>
>Sure I don't mind.
>
>Regards
>Pavel
> 
>
>
>Thanks,
>Max
>
>On 2/23/12 11:21 AM, "Max Vujovic" <mvujovic at adobe.com> wrote:
>
>>Hi Pavel,
>>
>>Thanks for the guidance. I'll try the approach you described for grabbing
>>pixels. I've been digging into the inspector harness lately
>>(inspector-test.js), and it's making sense so far, but I'll inevitably
>>have some questions for you when I hit a snag :).
>>
>>Thanks,
>>Max
>>
>>On 2/23/12 11:05 AM, "Pavel Feldman" <pfeldman at chromium.org> wrote:
>>
>>>Hi Max,
>>>
>>>Got it. I hate to say it, but implementing a harness for this case is
>>>likely to be more expensive than the fix itself. In your case,
>>>DOMNodeHighlighter::drawHighlight receives proper data (the node), but
>>>converts it into the graphics context poorly.
>>>
>>>As you suggested, I would probably go for a pixel test. Inspector's
>>>harness is fairly complex: our tests live under LayoutTests/inspector
>>>and
>>>LayoutTests/http/tests/inspector. I'd create a page like in your use
>>>case, pass node's handle to the front-end (as in many tests under
>>>inspector/elements), issue a DOMAgent.highlightNode(nodeId) followed by
>>>a
>>>RuntimeAgent.evaluate that would call a method on a page that tells
>>>layoutTestController to grab pixels. We don't have pixel tests for
>>>inspector, so I'd expect this last step to be challenging.
>>>
>>>If you are willing to give it a try, please go ahead. If you hit an
>>>issue, I'll be happy to help you out. Otherwise, I am now feeling bad
>>>for
>>>the lack of the highlight tests, so I'll probably put an effort into
>>>doing it myself.
>>>
>>>Regards
>>>Pavel
>>>
>>>On Thu, Feb 23, 2012 at 10:53 PM, Max Vujovic <mvujovic at adobe.com>
>>>wrote:
>>>
>>>Hi Pavel,
>>>
>>>I'm trying to test the position and size of the highlight quadrants (not
>>>the node).
>>>
>>>This screenshot of the bug I'm working on might make it more clear:
>>>https://bug-78037-attachments.webkit.org/attachment.cgi?id=128501
>>>Here's direct link to the bug:
>>>https://bugs.webkit.org/show_bug.cgi?id=78037
>>>
>>>
>>>In the screenshot, the blue, green, yellow, and orange quadrants should
>>>line up with the SVG element when the bug is fixed, and I'd like to
>>>create
>>>a test for that.
>>>
>>>Thanks,
>>>Max
>>>
>>>On 2/23/12 4:00 AM, "Pavel Feldman" <pfeldman at chromium.org> wrote:
>>>
>>>>There are no tests covering the DOM Node highlight. It just paints
>>>>quadrants for a given node. What are you trying to test, the highlight
>>>>or
>>>>the node position? Is there a bug you are fixing?
>>>>Regards
>>>>Pavel
>>>>
>>>>On Wed, Feb 22, 2012 at 11:10 PM, Max Vujovic <mvujovic at adobe.com>
>>>>wrote:
>>>>
>>>>Hello,
>>>>
>>>>I was wondering if there are any Web Inspector tests that check the
>>>>appearance, size, or position of a DOM node highlight. By DOM node
>>>>highlight, I mean the translucent margin box, border box, padding box,
>>>>and
>>>>content box combination that WebKit draws over a DOM node when you
>>>>inspect
>>>>it.
>>>>
>>>>I need to write a test for a bug to check the size and position of the
>>>>DOM
>>>>node highlight for an SVG root element, and I've been searching for a
>>>>similar test to imitate. I'd like to query the size and position of the
>>>>DOM node highlight from JavaScript, but I'm not sure that information
>>>>is
>>>>exposed. I could probably do a pixel test if this isn't currently
>>>>possible, but I was wondering if there's a better way. (The bug I'm
>>>>working on is: https://bugs.webkit.org/show_bug.cgi?id=78037).
>>>>
>>>>Thanks,
>>>>Max Vujovic
>>>>
>>>>_______________________________________________
>>>>webkit-dev mailing list
>>>>webkit-dev at lists.webkit.org
>>>>http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>
>
>
>
>
>
>



More information about the webkit-dev mailing list