Bug 79078 - Add HTML Popup API to ChromeClient
Summary: Add HTML Popup API to ChromeClient
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Major
Assignee: Kent Tamura
URL:
Keywords:
Depends on:
Blocks: 53961 80106
  Show dependency treegraph
 
Reported: 2012-02-20 22:02 PST by Kent Tamura
Modified: 2012-03-01 23:39 PST (History)
6 users (show)

See Also:


Attachments
Patch (9.92 KB, patch)
2012-02-20 22:16 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 2 (8.06 KB, patch)
2012-02-28 22:14 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 3 (8.13 KB, patch)
2012-02-29 23:27 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch 4 (8.13 KB, patch)
2012-02-29 23:43 PST, Kent Tamura
no flags Details | Formatted Diff | Diff
Patch for landing (8.22 KB, patch)
2012-03-01 22:38 PST, Kent Tamura
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Kent Tamura 2012-02-20 22:02:25 PST
Add HTML Popup API to Chrome.  This is required to implement a calendar picker for <input type=date>.
Comment 1 Kent Tamura 2012-02-20 22:16:59 PST
Created attachment 127918 [details]
Patch
Comment 2 Dimitri Glazkov (Google) 2012-02-22 16:22:03 PST
Comment on attachment 127918 [details]
Patch

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

> Source/WebCore/page/Chrome.cpp:561
> +    return m_client->openHTMLPopup(client, originBoundsInRootView);

if client() is public, why do we need these on Chrome?

> Source/WebCore/platform/HTMLPopup.h:32
> +#define HTMLPopup_h

Not sure if HTMLPopup is a good name. HTML is typically used as a prefix for HTML elements.
Comment 3 Dimitri Glazkov (Google) 2012-02-22 16:22:21 PST
Adding Adam, since he's cleaning up in this area.
Comment 4 Adam Barth 2012-02-22 16:30:30 PST
Comment on attachment 127918 [details]
Patch

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

This code shouldn't be in Platform.  I'm not sure what you're trying to achieve so it's a bit hard for me to recommend a better course of action.

>> Source/WebCore/page/Chrome.cpp:561
>> +    return m_client->openHTMLPopup(client, originBoundsInRootView);
> 
> if client() is public, why do we need these on Chrome?

We shouldn't need them.

> Source/WebCore/platform/HTMLPopup.h:39
> +class HTMLPopup {

Things in the Platform directory shouldn't know anything about HTML.  There's some sort of layering confusion here.
Comment 5 Kent Tamura 2012-02-22 16:49:01 PST
Comment on attachment 127918 [details]
Patch

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

>>> Source/WebCore/page/Chrome.cpp:561
>>> +    return m_client->openHTMLPopup(client, originBoundsInRootView);
>> 
>> if client() is public, why do we need these on Chrome?
> 
> We shouldn't need them.

Ok, I'll remove Chrome functions.
I just followed what other functions in Chrome did.

>> Source/WebCore/platform/HTMLPopup.h:32
>> +#define HTMLPopup_h
> 
> Not sure if HTMLPopup is a good name. HTML is typically used as a prefix for HTML elements.

How about DocumentPopup?

>> Source/WebCore/platform/HTMLPopup.h:39
>> +class HTMLPopup {
> 
> Things in the Platform directory shouldn't know anything about HTML.  There's some sort of layering confusion here.

Yeah, I also wonder what was the best directory.  I put it to platform/ because these classes doesn't depend on non-platform classes.

Is it ok to put it into WebCore/html/ because it would be a functionality to realize UI of HTML elements?
Comment 6 Adam Barth 2012-02-22 16:55:56 PST
Comment on attachment 127918 [details]
Patch

Yeah, WebCore/html seems appropriate.  It looks like it's HTML-related because it has an htmlSource() and it is used to implement HTML elements.

Question: How are you planning to create the htmlSource text?  We want to make sure we avoid XSS.
Comment 7 Kent Tamura 2012-02-22 17:02:51 PST
(In reply to comment #6)
> Question: How are you planning to create the htmlSource text?  We want to make sure we avoid XSS.

The source text will be built in WebCore C++ code.  We will need to pass some values specified in the main HTML document.  e.g. Passing min/max/step/value values of <input type=date>.
We have to escape such values.
Comment 8 Kent Tamura 2012-02-23 20:51:09 PST
(In reply to comment #5)
> >> +#define HTMLPopup_h
> > 
> > Not sure if HTMLPopup is a good name. HTML is typically used as a prefix for HTML elements.
> 
> How about DocumentPopup?

Does anyone have a good idea of the name?
Comment 9 Kent Tamura 2012-02-28 22:14:33 PST
Created attachment 129387 [details]
Patch 2

Remove Chrome changes, move HTMLPopup* to html/
Comment 10 Dimitri Glazkov (Google) 2012-02-29 09:15:08 PST
Comment on attachment 129387 [details]
Patch 2

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

> Source/WebCore/ChangeLog:13
> +        * html/HTMLPopupClient.h: Added.

I am sorry for jerking you around, but I don't think html is the right place for this. I could be wrong, but I think this directory is loosely associated with the "stuff in HTML spec." (aside from workers and some other stuff in HTML spec that probably should've been its own spec anyway).

Since we have no intention of making this an author-facing API, perhaps this should live in Source/page?

I also noticed that in https://bugs.webkit.org/show_bug.cgi?id=53961, you actually create a new Page for the popup. Perhaps this should be called something like a PagePopup?
Comment 11 Kent Tamura 2012-02-29 17:14:41 PST
Comment on attachment 129387 [details]
Patch 2

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

>> Source/WebCore/ChangeLog:13
>> +        * html/HTMLPopupClient.h: Added.
> 
> I am sorry for jerking you around, but I don't think html is the right place for this. I could be wrong, but I think this directory is loosely associated with the "stuff in HTML spec." (aside from workers and some other stuff in HTML spec that probably should've been its own spec anyway).
> 
> Since we have no intention of making this an author-facing API, perhaps this should live in Source/page?
> 
> I also noticed that in https://bugs.webkit.org/show_bug.cgi?id=53961, you actually create a new Page for the popup. Perhaps this should be called something like a PagePopup?

page/PagePopup* sounds good.  I'll update the patch.
Comment 12 Kent Tamura 2012-02-29 23:27:08 PST
Created attachment 129639 [details]
Patch 3

Renamed to PagePopup
Comment 13 Kent Tamura 2012-02-29 23:43:09 PST
Created attachment 129643 [details]
Patch 4

Fix a typo in a comment
Comment 14 Dimitri Glazkov (Google) 2012-03-01 09:41:40 PST
Comment on attachment 129643 [details]
Patch 4

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

> Source/WebCore/page/PagePopupClient.h:50
> +    virtual String htmlSource() = 0;

This seems really hacky. After building this string by combining embedded resources, you will still need to use a loader to get this into the popup. Would it be better to implement a new kind of loader that just allows pulling stuff from resources? Well, that may have its own problems, such as performance. We don't want the popup to take forever to load...
Comment 15 Kent Tamura 2012-03-01 22:11:25 PST
Comment on attachment 129643 [details]
Patch 4

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

>> Source/WebCore/page/PagePopupClient.h:50
>> +    virtual String htmlSource() = 0;
> 
> This seems really hacky. After building this string by combining embedded resources, you will still need to use a loader to get this into the popup. Would it be better to implement a new kind of loader that just allows pulling stuff from resources? Well, that may have its own problems, such as performance. We don't want the popup to take forever to load...

ok,  I'll change this to:
  virtual void writeDocument(DocumentWriter&) = 0;
Comment 16 Kent Tamura 2012-03-01 22:38:16 PST
Created attachment 129823 [details]
Patch for landing
Comment 17 Kent Tamura 2012-03-01 22:43:47 PST
Committed r109513: <http://trac.webkit.org/changeset/109513>