Bug 103719 - Implement anchored positioning used by <dialog>
Summary: Implement anchored positioning used by <dialog>
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: Layout and Rendering (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: 84635
  Show dependency treegraph
 
Reported: 2012-11-30 00:40 PST by Matt Falkenhagen
Modified: 2017-12-02 08:01 PST (History)
3 users (show)

See Also:


Attachments
work in progress patch (18.77 KB, patch)
2012-11-30 00:51 PST, Matt Falkenhagen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Falkenhagen 2012-11-30 00:40:30 PST
<dialog> elements can be anchored to other elements, specified in the call show/showModal():

  dialog.show(anchor);

The spec calls this magical alignment:
http://www.whatwg.org/specs/web-apps/current-work/multipage/commands.html#magically-aligned
Comment 1 Matt Falkenhagen 2012-11-30 00:51:13 PST
Created attachment 176914 [details]
work in progress patch
Comment 2 Matt Falkenhagen 2012-11-30 00:58:51 PST
This patch is very much a WIP but I hope it can spark some discussion.

I think the anchored positioning step must occur after normal layout, or else we don't know where the anchor itself is be positioned. The tricky part is that an anchor can itself be anchored to something else (or it may be in the subtree of an anchored object). So the order in which the anchored objects are processed is important.

This WIP patch simply traverses the render tree but this is incorrect. The order of anchoring has nothing to do with the render tree structure.

I think we need to somehow build a anchored object tree, and then traverse that instead.
Comment 3 Simon Fraser (smfr) 2012-11-30 09:21:59 PST
If the anchor target is being animated, should the dialog also move around?
Comment 4 Matt Falkenhagen 2012-12-02 21:32:22 PST
(In reply to comment #3)
> If the anchor target is being animated, should the dialog also move around?

Yes, I think so. If I'm interpreting the spec correctly, the dialog follows the anchor if its position is changed dynamically. It looks like animations can be considered the same thing.

Is it more difficult to handle following an animated anchor?
Comment 5 Simon Fraser (smfr) 2012-12-02 22:08:35 PST
(In reply to comment #4)
> (In reply to comment #3)
> > If the anchor target is being animated, should the dialog also move around?
> 
> Yes, I think so. If I'm interpreting the spec correctly, the dialog follows the anchor if its position is changed dynamically. It looks like animations can be considered the same thing.
> 
> Is it more difficult to handle following an animated anchor?

Yes, in some cases. You also need to consider the effects of CSS transforms on your target.