Bug 110216

Summary: [WK2][EFL] Move AC code from EwkView to WebView
Product: WebKit Reporter: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Component: WebKit EFLAssignee: Mikhail Pozdnyakov <mikhail.pozdnyakov>
Status: RESOLVED FIXED    
Severity: Normal CC: cdumez, cmarcelo, gyuyoung.kim, kenneth, lucas.de.marchi, rakuco, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on:    
Bug Blocks: 107657, 107662    
Attachments:
Description Flags
WIP patch
none
patch
none
patch v2
none
patch v3
none
patch v4
none
patch v5
andersca: review+, webkit.review.bot: commit-queue-
to be landed none

Description Mikhail Pozdnyakov 2013-02-19 06:43:05 PST
SSIA. The goal is to stop direct accessing to coord graphics scene from EwkView.
Comment 1 Mikhail Pozdnyakov 2013-02-19 13:10:23 PST
Created attachment 189149 [details]
WIP patch
Comment 2 Kenneth Rohde Christiansen 2013-02-19 13:24:31 PST
Comment on attachment 189149 [details]
WIP patch

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

> Source/WebKit2/UIProcess/API/C/efl/WKView.cpp:61
> +void WKViewSetUserViewportTransformation(WKViewRef viewRef, const WKViewMatrix* userViewportTransformation)

I think "transformation" would be fine here...

> Source/WebKit2/UIProcess/API/C/efl/WKView.cpp:63
> +    WebCore::TransformationMatrix transform(userViewportTransformation->xx, userViewportTransformation->yx,

I could just call it matrix

matrix(transformation->xx,...

> Source/WebKit2/UIProcess/API/C/efl/WKView.h:78
> +WK_EXPORT void WKViewSetUserViewportTransformation(WKViewRef, const WKViewMatrix* userViewportTransformation);

no need to add userView...

> Source/WebKit2/UIProcess/API/efl/EwkView.cpp:269
> -    if (behavior == DefaultBehavior) {
> -        coordinatedGraphicsScene()->setActive(true);
> -        WKPageSetUseFixedLayout(wkPage(), true);
> -    }
> +    WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior);

Are you sure it should not be active?
Comment 3 Kenneth Rohde Christiansen 2013-02-19 13:42:44 PST
Comment on attachment 189149 [details]
WIP patch

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

> Source/WebKit2/UIProcess/efl/WebView.cpp:109
> +    RefPtr<cairo_t> graphicsContext = adoptRef(cairo_create(surface));
> +
> +    const FloatPoint& pagePosition = m_ewkView->pagePosition();
> +    cairo_translate(graphicsContext.get(), - pagePosition.x(), - pagePosition.y());
> +    cairo_scale(graphicsContext.get(), m_ewkView->pageScaleFactor(), m_ewkView->pageScaleFactor());
> +    cairo_scale(graphicsContext.get(), m_page->deviceScaleFactor(), m_page->deviceScaleFactor());

can we do this smarter with a matrix instead? like one operation?

> Source/WebKit2/UIProcess/efl/WebView.cpp:218
> +    WebKit::CoordinatedLayerTreeHostProxy* coordinatedLayerTreeHostProxy = drawingArea->coordinatedLayerTreeHostProxy();
> +    if (!coordinatedLayerTreeHostProxy)

wouldnt calling it laterTreeHostProxy not be sufficient

> Source/WebKit2/UIProcess/efl/WebView.h:93
> +    // FIXME: Should be private.
> +    WebCore::AffineTransform transformFromScene() const;
> +    WebCore::AffineTransform transformToScene() const;
> +

why are they not?
Comment 4 Mikhail Pozdnyakov 2013-02-20 02:45:32 PST
(In reply to comment #2)
> (From update of attachment 189149 [details])
> 
> > Source/WebKit2/UIProcess/API/efl/EwkView.cpp:269
> > -    if (behavior == DefaultBehavior) {
> > -        coordinatedGraphicsScene()->setActive(true);
> > -        WKPageSetUseFixedLayout(wkPage(), true);
> > -    }
> > +    WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior);
> 
> Are you sure it should not be active?

It is set in WebView::initialize() now.
Comment 5 Mikhail Pozdnyakov 2013-02-20 02:47:31 PST
> > Source/WebKit2/UIProcess/efl/WebView.h:93
> > +    // FIXME: Should be private.
> > +    WebCore::AffineTransform transformFromScene() const;
> > +    WebCore::AffineTransform transformToScene() const;
> > +
> 
> why are they not?

Unfortunately they are used in EwkView so far :/ (until we move event handling to web view where it should be).
Comment 6 Mikhail Pozdnyakov 2013-02-20 03:25:21 PST
Created attachment 189276 [details]
patch
Comment 7 WebKit Review Bot 2013-02-20 03:26:37 PST
Attachment 189276 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/UIProcess/API/C/efl/WKView.cpp', u'Source/WebKit2/UIProcess/API/C/efl/WKView.h', u'Source/WebKit2/UIProcess/API/efl/EwkView.cpp', u'Source/WebKit2/UIProcess/API/efl/EwkView.h', u'Source/WebKit2/UIProcess/efl/WebView.cpp', u'Source/WebKit2/UIProcess/efl/WebView.h']" exit_code: 1
Source/WebKit2/UIProcess/API/C/efl/WKView.h:42:  More than one command on the same line  [whitespace/newline] [4]
Source/WebKit2/UIProcess/API/C/efl/WKView.h:43:  More than one command on the same line  [whitespace/newline] [4]
Source/WebKit2/UIProcess/API/C/efl/WKView.h:44:  More than one command on the same line  [whitespace/newline] [4]
Source/WebKit2/UIProcess/API/C/efl/WKView.cpp:64:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Source/WebKit2/UIProcess/API/C/efl/WKView.cpp:65:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 5 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Kenneth Rohde Christiansen 2013-02-20 04:16:07 PST
Comment on attachment 189276 [details]
patch

LGTM, maybe let cmarcelo have a look
Comment 9 Caio Marcelo de Oliveira Filho 2013-02-20 04:53:04 PST
Comment on attachment 189276 [details]
patch

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

> Source/WebKit2/UIProcess/API/C/efl/WKView.h:73
> +WK_EXPORT void WKViewSetUserViewportTransformation(WKViewRef, const WKViewMatrix* transformation);
> +WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint);

Question: does arbitrary matrices work correctly here? What about start smaller and support vertical and horizontal displacement and then we change to use matrices when we have means to test this? That would spare us having this WKViewMatrix type for now.
Comment 10 Mikhail Pozdnyakov 2013-02-20 05:01:03 PST
(In reply to comment #9)
> (From update of attachment 189276 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=189276&action=review
> 
> > Source/WebKit2/UIProcess/API/C/efl/WKView.h:73
> > +WK_EXPORT void WKViewSetUserViewportTransformation(WKViewRef, const WKViewMatrix* transformation);
> > +WK_EXPORT WKPoint WKViewUserViewportToContents(WKViewRef, WKPoint);
> 
> Question: does arbitrary matrices work correctly here? What about start smaller and support vertical and horizontal displacement and then we change to use matrices when we have means to test this? That would spare us having this WKViewMatrix type for now.

makes sense to me, having just viewport translation api looks sufficient at the moment. Kenneth, what do you think?
Comment 11 Kenneth Rohde Christiansen 2013-02-20 05:01:49 PST
fine with me
Comment 12 Mikhail Pozdnyakov 2013-02-20 05:28:21 PST
Created attachment 189293 [details]
patch v2

Updated due to cmarcelo comment.
Comment 13 Kenneth Rohde Christiansen 2013-02-20 05:38:07 PST
Comment on attachment 189293 [details]
patch v2

Anyway to unit test this?
Comment 14 Mikhail Pozdnyakov 2013-02-20 05:53:57 PST
(In reply to comment #13)
> (From update of attachment 189293 [details])
> Anyway to unit test this?

WKView is now used as middle layer for ewk_view, so WKView's functionality is covered by ewk tests.
Comment 15 Caio Marcelo de Oliveira Filho 2013-02-20 06:13:36 PST
(In reply to comment #14)
> (In reply to comment #13)
> > (From update of attachment 189293 [details] [details])
> > Anyway to unit test this?
> 
> WKView is now used as middle layer for ewk_view, so WKView's functionality is covered by ewk tests.

In the future we should import the API tests we created for NIXView, but renaming to WKView. They are in our github branch inside Tools/TestWebKitAPI/Tests/nix.
Comment 16 Mikhail Pozdnyakov 2013-02-20 06:49:41 PST
Created attachment 189310 [details]
patch v3

WKViewTranslateUserViewport -> WKViewSetUserViewportTranslation (after talking to cmarcelo on irc)
Comment 17 WebKit Review Bot 2013-02-20 06:52:58 PST
Attachment 189310 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebKit2/ChangeLog', u'Source/WebKit2/UIProcess/API/C/efl/WKView.cpp', u'Source/WebKit2/UIProcess/API/C/efl/WKView.h', u'Source/WebKit2/UIProcess/API/efl/EwkView.cpp', u'Source/WebKit2/UIProcess/API/efl/EwkView.h', u'Source/WebKit2/UIProcess/efl/WebView.cpp', u'Source/WebKit2/UIProcess/efl/WebView.h']" exit_code: 1
Source/WebKit2/UIProcess/efl/WebView.cpp:227:  Extra space after ( in function call  [whitespace/parens] [4]
Total errors found: 1 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 18 Mikhail Pozdnyakov 2013-02-20 06:58:48 PST
Created attachment 189313 [details]
patch v4

fixed style nit.
Comment 19 Caio Marcelo de Oliveira Filho 2013-02-20 08:25:19 PST
Comment on attachment 189313 [details]
patch v4

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

LGTM with comments.

> Source/WebKit2/UIProcess/API/efl/EwkView.cpp:269
> -    if (behavior == DefaultBehavior) {
> -        coordinatedGraphicsScene()->setActive(true);
> -        WKPageSetUseFixedLayout(wkPage(), true);
> -    }
> +    WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior);

Do we need to set use fixed layout when behavior != DefaultBehavior?

> Source/WebKit2/UIProcess/efl/WebView.h:97
> +    // FIXME: Should be private.

Explain here what is preventing to become private, and how we fix. It seems to me they are not private yet for the sake of creating Events, which will be moved later on to WKView too. Is that correct?
Comment 20 Mikhail Pozdnyakov 2013-02-21 00:08:00 PST
(In reply to comment #19)
> (From update of attachment 189313 [details])
> View in context: https://bugs.webkit.org/attachment.cgi?id=189313&action=review
> 
> LGTM with comments.
> 
> > Source/WebKit2/UIProcess/API/efl/EwkView.cpp:269
> > -    if (behavior == DefaultBehavior) {
> > -        coordinatedGraphicsScene()->setActive(true);
> > -        WKPageSetUseFixedLayout(wkPage(), true);
> > -    }
> > +    WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior);
> 
> Do we need to set use fixed layout when behavior != DefaultBehavior?
In principal we should not, as web page does not use fixed layout by default.

However WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior); does not hurt because WebPageProxy::setUseFixedLayout checks whether the current value is equal to the new one and returns if it is.

I prefer WKPageSetUseFixedLayout(wkPage(), behavior == DefaultBehavior); to 

if (behavior == DefaultBehavior)
    WKPageSetUseFixedLayout(wkPage(), true);

for the sake of code compactness.

> 
> > Source/WebKit2/UIProcess/efl/WebView.h:97
> > +    // FIXME: Should be private.
> 
> Explain here what is preventing to become private, and how we fix. It seems to me they are not private yet for the sake of creating Events, which will be moved later on to WKView too. Is that correct?

Absolutely correct. I'll improve the comment.
Comment 21 Mikhail Pozdnyakov 2013-02-21 00:25:08 PST
Created attachment 189466 [details]
patch v5

Improved code comment.
Comment 22 Caio Marcelo de Oliveira Filho 2013-02-21 04:46:36 PST
LGTM, needs someone from WK2 to look at it.
Comment 23 WebKit Review Bot 2013-02-21 10:07:09 PST
Comment on attachment 189466 [details]
patch v5

Rejecting attachment 189466 [details] from commit-queue.

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

Last 500 characters of output:
nk #5 succeeded at 413 (offset -3 lines).
patching file Source/WebKit2/UIProcess/efl/WebView.h
Hunk #1 succeeded at 31 with fuzz 1.
Hunk #2 succeeded at 55 (offset -3 lines).
Hunk #3 succeeded at 91 (offset -3 lines).
Hunk #4 FAILED at 181.
1 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', 'Anders Carlsson']" exit_code: 1 cwd: /mnt/git/webkit-commit-queue

Full output: http://queues.webkit.org/results/16696169
Comment 24 Mikhail Pozdnyakov 2013-02-22 00:35:07 PST
Created attachment 189707 [details]
to be landed
Comment 25 WebKit Review Bot 2013-02-22 00:54:22 PST
Comment on attachment 189707 [details]
to be landed

Clearing flags on attachment: 189707

Committed r143699: <http://trac.webkit.org/changeset/143699>
Comment 26 WebKit Review Bot 2013-02-22 00:54:28 PST
All reviewed patches have been landed.  Closing bug.