Bug 110753

Summary: [WK2][EFL] WebView should own view size
Product: WebKit Reporter: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Component: WebKit EFLAssignee: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Status: RESOLVED FIXED    
Severity: Normal CC: andersca, ap, benjamin, cmarcelo, dongseong.hwang, gyuyoung.kim, kenneth, kling, lucas.de.marchi, rakuco, sam, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 107657, 107662    
Attachments:
Description Flags
WIP
none
patch
none
patch v2
none
patch v3
none
patch v4 kling: review+, webkit.review.bot: commit-queue-

Description Mikhail Pozdnyakov 2013-02-25 06:36:39 PST
At the moment the view size is contained within EwkView class and WebView has to call EwkView method to know its size which is wrong.
Comment 1 Mikhail Pozdnyakov 2013-02-26 01:13:58 PST
Created attachment 190235 [details]
WIP
Comment 2 Mikhail Pozdnyakov 2013-02-26 01:46:08 PST
Created attachment 190241 [details]
patch
Comment 3 Kenneth Rohde Christiansen 2013-02-26 02:30:22 PST
Comment on attachment 190241 [details]
patch

LGTM
Comment 4 Mikhail Pozdnyakov 2013-03-06 01:30:24 PST
Created attachment 191685 [details]
patch v2

rebased
Comment 5 Kenneth Rohde Christiansen 2013-03-06 01:33:34 PST
Comment on attachment 191685 [details]
patch v2

So, I would say that these should take values in UI units (ie not physical ones) so it should be able to test this by setting setDeviceScaleFactor somehow.

Can we have a unit test?
Comment 6 Mikhail Pozdnyakov 2013-03-06 01:48:41 PST
(In reply to comment #5)
> (From update of attachment 191685 [details])
> So, I would say that these should take values in UI units (ie not physical ones) so it should be able to test this by setting setDeviceScaleFactor somehow.
> 
> Can we have a unit test?

I'd say layout tests would be more helpful there rather than unit tests,   thing to be tested is how page is looking if device scale factor is changed.
Comment 7 Dongseong Hwang 2013-03-13 01:33:35 PDT
Comment on attachment 191685 [details]
patch v2

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

> Source/WebKit2/UIProcess/efl/WebView.cpp:282
> +    return size();

LGTM without one point.

It should return the size in ui units, because WebView now deal with m_size in device units.
FloatSize dipSize(m_size);
dipSize.scale(1 / page()->deviceScaleFactor());
Comment 8 Dongseong Hwang 2013-03-13 01:40:12 PDT
Comment on attachment 191685 [details]
patch v2

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

> Source/WebKit2/UIProcess/API/efl/EwkView.h:134
> +    WebCore::IntSize size() const;

Could you rebase to upstream?
Currently, there is two methods: size() and deviceSize(). ui units and device units respectively.

Your patch moves role dealing with device size to WebView. and you need to reserve carefully the behavior on each sites using either two methods.
Comment 9 Mikhail Pozdnyakov 2013-03-13 03:00:44 PDT
Created attachment 192891 [details]
patch v3

Rebased. Took comments from Dongsung Huang into consideration - thanks.
Comment 10 Dongseong Hwang 2013-03-13 18:04:08 PDT
Comment on attachment 192891 [details]
patch v3

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

LGTM. I add some comments.

> Source/WebKit2/UIProcess/API/efl/EwkView.cpp:471
>  IntSize EwkView::size() const

I think size() and deviceSize() can be private now.

> Source/WebKit2/UIProcess/API/efl/EwkView.cpp:1104
> +        if (WKPageUseFixedLayout(self->wkPage()))

It is not needed because WebView::setSize already call WebView::updateViewportSize().

> Source/WebKit2/UIProcess/efl/WebView.cpp:-199
> -    if (m_page->useFixedLayout()) {

Could you explain why this code is moved to EwkView::handleEvasObjectCalculate?
Previously if there is pageViewportController, we skipped notifying to drawing area, but now the behavior is changed.

> Source/WebKit2/UIProcess/efl/WebView.cpp:527
> +inline WebCore::FloatSize WebView::dipSize() const

How about uiSize because we already used uiSize as a local variable in EwkView.
Comment 11 Mikhail Pozdnyakov 2013-03-14 03:57:45 PDT
Comment on attachment 192891 [details]
patch v3

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

>> Source/WebKit2/UIProcess/API/efl/EwkView.cpp:1104
>> +        if (WKPageUseFixedLayout(self->wkPage()))
> 
> It is not needed because WebView::setSize already call WebView::updateViewportSize().

WebView is not aware of pageViewportController(), so it is needed.

>> Source/WebKit2/UIProcess/efl/WebView.cpp:-199
>> -    if (m_page->useFixedLayout()) {
> 
> Could you explain why this code is moved to EwkView::handleEvasObjectCalculate?
> Previously if there is pageViewportController, we skipped notifying to drawing area, but now the behavior is changed.

Well actually we notified drawing area, as viewportcontroller invokes drawingArea()->setSize(roundedIntSize(newSize), IntSize()); plus it updates its internal state.

The reason for moving is fixing of API layering: WebView should not access viewport controller directly.

>> Source/WebKit2/UIProcess/efl/WebView.cpp:527
>> +inline WebCore::FloatSize WebView::dipSize() const
> 
> How about uiSize because we already used uiSize as a local variable in EwkView.

mmm.. I'd say dip size is clearer (ui size might mean that page scale factor is also taken for calculation).
Comment 12 Mikhail Pozdnyakov 2013-03-14 09:17:07 PDT
Created attachment 193135 [details]
patch v4

Made EwkView size getters private as was pointed out by Dongsung Huang.
Comment 13 Kenneth Rohde Christiansen 2013-03-14 13:58:25 PDT
Comment on attachment 193135 [details]
patch v4

LGTM
Comment 14 Kenneth Rohde Christiansen 2013-03-20 04:50:28 PDT
Ping owner review/sign off?
Comment 15 WebKit Review Bot 2013-04-04 03:03:09 PDT
Comment on attachment 193135 [details]
patch v4

Rejecting attachment 193135 [details] from commit-queue.

Failed to run "['/mnt/git/webkit-commit-queue/Tools/Scripts/webkit-patch', '--status-host=webkit-commit-queue.appspot.com', '--bot-id=gce-cq-04', 'apply-attachment', '--no-update', '--non-interactive', 193135, '--port=chromium-xvfb']" exit_code: 2 cwd: /mnt/git/webkit-commit-queue

Last 500 characters of output:
ffset 12 lines).
Hunk #5 succeeded at 544 (offset 20 lines).
patching file Source/WebKit2/UIProcess/efl/WebView.h
Hunk #1 succeeded at 57 (offset 2 lines).
Hunk #2 succeeded at 92 (offset 2 lines).
Hunk #3 FAILED at 98.
Hunk #4 FAILED at 175.
2 out of 4 hunks FAILED -- saving rejects to file Source/WebKit2/UIProcess/efl/WebView.h.rej

Failed to run "[u'/mnt/git/webkit-commit-queue/Tools/Scripts/svn-apply', '--force', '--reviewer', 'Andreas Kling']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue

Full output: http://webkit-commit-queue.appspot.com/results/17418080
Comment 16 Mikhail Pozdnyakov 2013-04-04 03:46:27 PDT
Committed r147617: <http://trac.webkit.org/changeset/147617>