On Thu, Jun 20, 2013 at 10:39 PM, Robert O'Callahan <robert@ocallahan.org>wrote:
> On Sat, Jun 1, 2013 at 1:57 PM, Ali Juma <ajuma@chromium.org> wrote:
>
>> On Fri, May 31, 2013 at 9:34 PM, Robert O'Callahan <robert@ocallahan.org>wrote:
>>
>>> Is it important to notify the Web page when "the content is ready"? I
>>> thought we were going to do this entirely in the engine?
>>>
>>
>> Without getting such a notification, the page won't know when it's safe
>> to remove placeholder content, or to make other changes that depend on the
>> expensive content being visible (e.g. the page might want to stop a spinner
>> from spinning once the expensive content is visible).
>>
>
> How is that going to work, since the event must be processed on the main
> thread and therefore could happen arbitrarily late? Placeholder content and
> spinning could remain in place for a while after the optional content has
> been rendered.
>
There are a couple approaches that can be used:
1) The optional content can initially be given tiny opacity, such that it's
effectively invisible even after it's rendered. When the event is received
on the main thread, the opacity of the optional content can be changed (or
animated) to 1, and the placeholder content can be removed (and spinning
stopped).
2) Alternatively, if the spinner is part of the placeholder and if there is
no desired to fade-in the optional content, the optional content can be
given a higher z-index than the placeholder. This way, the placeholder
content will immediately disappear once the optional content is rendered
(assuming the optional content has opacity 1). Upon receiving the event,
the (now invisible) spinner can be stopped.
-Ali