Bug 55242 - Plugins needs a way to trigger style recalc
Summary: Plugins needs a way to trigger style recalc
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Plug-ins (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Alok Priyadarshi
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-25 11:17 PST by Alok Priyadarshi
Modified: 2011-03-08 13:19 PST (History)
6 users (show)

See Also:


Attachments
Adds a hook to WebPluginContainer to mark the containing element that it needs style recalc. (2.65 KB, patch)
2011-02-25 11:31 PST, Alok Priyadarshi
fishd: review-
Details | Formatted Diff | Diff
Added WebPluginContainer::setBackingTextureId as suggested by Antoine (4.18 KB, patch)
2011-03-03 13:00 PST, Alok Priyadarshi
no flags Details | Formatted Diff | Diff
Fixed style issues (4.17 KB, patch)
2011-03-04 09:59 PST, Alok Priyadarshi
dglazkov: review-
Details | Formatted Diff | Diff
Fixed ChangeLog (4.28 KB, patch)
2011-03-08 10:30 PST, Alok Priyadarshi
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alok Priyadarshi 2011-02-25 11:17:36 PST
The plugins may dynamically switch between 2D and 3D rendering. Plugins need a way to inform the browser of such changes such that accelerated compositing can be switched on or off. More information in the chromium bug:

http://code.google.com/p/chromium/issues/detail?id=72784
Comment 1 Alok Priyadarshi 2011-02-25 11:31:30 PST
Created attachment 83854 [details]
Adds a hook to WebPluginContainer to mark the containing element that it needs style recalc.
Comment 2 Darin Fisher (:fishd, Google) 2011-02-25 13:56:25 PST
Comment on attachment 83854 [details]
Adds a hook to WebPluginContainer to mark the containing element that it needs style recalc.

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

> WebKit/chromium/public/WebPluginContainer.h:57
> +    virtual void setNeedsStyleRecalc() = 0;

It is really unfortunate to have to expose such a low-level detail to the embedder.
Can you explain why you need this?

Also, if we really need to expose this, then it seems like it should be exposed
on WebElement as that is the wrapper for WebCore::Element methods.
Comment 3 Antoine Labour 2011-02-25 14:01:56 PST
I don't think the method should be named as such.

Fundamentally, the WebPluginContainer asks the WebPlugin for its backing texture ID for compositing when it makes layout decisions. What needs to be exposed is a way for the WebPlugin to tell the WebPluginContainer that it has changed. The notion of style is internal to WebKit.

I would call it something like "changedBackingTextureID". Or maybe better yet, change the API to remove WebPlugin::getBackingTextureID and add WebPluginContainer::setBackingTextureID which would do the proper invalidation. Thoughts ?
Comment 4 Alok Priyadarshi 2011-02-25 14:14:12 PST
PPAPI plugins may dynamically switch between 2D (non-accelerated) and 3D rendering (accelerated). The only way to switch on/off accelerated compositing is to trigger a recalcStyle on the containing element, which in turn reevaluates whether accelerated compositing is required or not. WebPluginContainer::setNeedsStyleRecalc() seems similar to WebPluginContainer::invalidateRect(), which is used by the embedder to notify the containing element that something needs to be updated. May be there are better ways to do this. I am not too familiar with WebKit, so please suggest.

I am fine with adding this function to WebElement, but it seemed like a const-wrapper to WebCore::Element.

More details are provided in the chromium bug:
http://code.google.com/p/chromium/issues/detail?id=72784
Comment 5 Darin Adler 2011-02-25 14:49:35 PST
Comment on attachment 83854 [details]
Adds a hook to WebPluginContainer to mark the containing element that it needs style recalc.

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

>> WebKit/chromium/public/WebPluginContainer.h:57
>> +    virtual void setNeedsStyleRecalc() = 0;
> 
> It is really unfortunate to have to expose such a low-level detail to the embedder.
> Can you explain why you need this?
> 
> Also, if we really need to expose this, then it seems like it should be exposed
> on WebElement as that is the wrapper for WebCore::Element methods.

I don’t understand why a plug-in would have to ask for this explicitly. If the real issue is switching between 2D and 3D rendering, then the call should be about that. Not about “style recalc”, which is an internal detail of the web engine that could be subject to change.

Specifically what is going to change about the plug-in? Presumably something that WebKit queries through the plug-in API, so what? That’s what the call should be named after.
Comment 6 Alok Priyadarshi 2011-03-03 13:00:20 PST
Created attachment 84612 [details]
Added WebPluginContainer::setBackingTextureId as suggested by Antoine

I liked Antoine's suggestion of adding WebPluginContainer::setBackingTextureId(). I think it is much cleaner and at a higher level than my original solution. Please note that WebPlugin::getBackingTextureId() is now obsolete. I will remove it after this CL lands into chromium tree and I have made corresponding changes in chromium.
Comment 7 WebKit Review Bot 2011-03-03 13:02:42 PST
Attachment 84612 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'Source/WebCore/ChangeLog', u'Source/WebCor..." exit_code: 1

Source/WebKit/chromium/public/WebPluginContainer.h:61:  The parameter name "id" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebKit/chromium/src/WebPluginContainerImpl.h:87:  The parameter name "id" adds no information, so it should be removed.  [readability/parameter_name] [5]
Source/WebKit/chromium/src/WebPluginContainerImpl.cpp:321:  Tests for true/false, null/non-null, and zero/non-zero should all be done without equality comparisons.  [readability/comparison_to_zero] [5]
Total errors found: 3 in 6 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 8 Alok Priyadarshi 2011-03-04 09:59:11 PST
Created attachment 84769 [details]
Fixed style issues
Comment 9 Alok Priyadarshi 2011-03-07 14:13:28 PST
Ping! I know Darin Fisher is on paternity leave. Who else can look at it?
Comment 10 Dimitri Glazkov (Google) 2011-03-07 15:16:55 PST
Comment on attachment 84769 [details]
Fixed style issues

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

ok, but please fix the ChangeLog.

> WebCore/ChangeLog:8
> +        No new tests. (OOPS!)

This is usually replaced with either a reference to new test, existing test that covers the change, or an explanation why the test is not necessary or possible.
Comment 11 Alok Priyadarshi 2011-03-08 10:30:13 PST
Created attachment 85060 [details]
Fixed ChangeLog
Comment 12 Dimitri Glazkov (Google) 2011-03-08 10:54:14 PST
Comment on attachment 85060 [details]
Fixed ChangeLog

activate Iconian gateway!
Comment 13 WebKit Commit Bot 2011-03-08 13:19:19 PST
Comment on attachment 85060 [details]
Fixed ChangeLog

Clearing flags on attachment: 85060

Committed r80584: <http://trac.webkit.org/changeset/80584>
Comment 14 WebKit Commit Bot 2011-03-08 13:19:24 PST
All reviewed patches have been landed.  Closing bug.