WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
111242
Plugins that are appropriately large w.r.t page size should autostart
https://bugs.webkit.org/show_bug.cgi?id=111242
Summary
Plugins that are appropriately large w.r.t page size should autostart
Dean Jackson
Reported
2013-03-01 21:05:47 PST
A "full-page" flash site should never snapshot. The trick is getting the definition of full-page correct. I suggest something like the following: - plugin is in the main frame (not an iframe) - plugin is sized with %, and those are bigger than say 95 - the final size of the plugin is again about 95% of the viewport width and height
Attachments
Patch
(4.77 KB, patch)
2013-03-01 21:10 PST
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Patch
(5.03 KB, patch)
2013-03-01 21:15 PST
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Patch
(4.89 KB, patch)
2013-03-02 22:28 PST
,
Dean Jackson
beidson
: review+
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Dean Jackson
Comment 1
2013-03-01 21:06:10 PST
<
rdar://problem/13328176
>
Dean Jackson
Comment 2
2013-03-01 21:10:47 PST
Created
attachment 191092
[details]
Patch
Dean Jackson
Comment 3
2013-03-01 21:15:37 PST
Created
attachment 191093
[details]
Patch
Tim Horton
Comment 4
2013-03-01 23:05:38 PST
Comment on
attachment 191093
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=191093&action=review
> Source/WebCore/ChangeLog:15 > + - The plug-in is in the main frame (not an iframe). > + - The plug-in is sized using %, and both width and height are above 96%. > + - The final width and height of the plug-in is more than 95% of the viewport > + width and height respectively.
This seems strange. What's the downside to something like thresholding area(intersection(plugin rect, frame visible rect)) / area(frame visible rect)?
> Source/WebCore/html/HTMLPlugInImageElement.cpp:430 > + RenderEmbeddedObject* renderEmbeddedObject = toRenderEmbeddedObject(renderer());
Technically you could go to renderbox instead if you wanted, I think... not that that changes anything.
> Source/WebCore/html/HTMLPlugInImageElement.cpp:441 > + if (inMainFrame && styleWidth.isPercent() && (styleWidth.percent() > sizingFullPageThresholdPercentage) > + && styleHeight.isPercent() && (styleHeight.percent() > sizingFullPageThresholdPercentage) > + && (static_cast<float>(contentWidth) / visibleViewSize.width() * 100 > sizingFullPageThresholdPercentage) > + && (static_cast<float>(contentHeight) / visibleViewSize.height() * 100 > sizingFullPageThresholdPercentage)) {
That's quite the condition. Is there anything we can do to make this less insane?
Jon Lee
Comment 5
2013-03-01 23:38:24 PST
Comment on
attachment 191093
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=191093&action=review
> Source/WebCore/ChangeLog:13 > + - The plug-in is sized using %, and both width and height are above 96%.
Given that I think all the sites that use percentages use 100%, we should just go for that instead.
>> Source/WebCore/ChangeLog:15 >> + width and height respectively. > > This seems strange. What's the downside to something like thresholding area(intersection(plugin rect, frame visible rect)) / area(frame visible rect)?
Checking the height and width separately is more restrictive, which I think is good, but I think we do need to clip the width and height against the visible frame rect. Consider a full-page size plugin that's initially placed mostly along the bottom border of the page.
> Source/WebCore/ChangeLog:20 > + the tests above.
How about considering the border box of the plugin element instead?
>> Source/WebCore/html/HTMLPlugInImageElement.cpp:441 >> + && (static_cast<float>(contentHeight) / visibleViewSize.height() * 100 > sizingFullPageThresholdPercentage)) { > > That's quite the condition. Is there anything we can do to make this less insane?
We might have to extend this to clip the width and height against the frame.
Maciej Stachowiak
Comment 6
2013-03-02 12:11:01 PST
(In reply to
comment #4
)
> (From update of
attachment 191093
[details]
) > View in context:
https://bugs.webkit.org/attachment.cgi?id=191093&action=review
> > > Source/WebCore/ChangeLog:15 > > + - The plug-in is in the main frame (not an iframe). > > + - The plug-in is sized using %, and both width and height are above 96%. > > + - The final width and height of the plug-in is more than 95% of the viewport > > + width and height respectively. > > This seems strange. What's the downside to something like thresholding area(intersection(plugin rect, frame visible rect)) / area(frame visible rect)?
Tim's rule seems more logical to me too, but maybe there is a reason for Dean's?
Dean Jackson
Comment 7
2013-03-02 19:51:50 PST
Comment on
attachment 191093
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=191093&action=review
>>>> Source/WebCore/ChangeLog:15 >>>> + width and height respectively. >>> >>> This seems strange. What's the downside to something like thresholding area(intersection(plugin rect, frame visible rect)) / area(frame visible rect)? >> >> Checking the height and width separately is more restrictive, which I think is good, but I think we do need to clip the width and height against the visible frame rect. Consider a full-page size plugin that's initially placed mostly along the bottom border of the page. > > Tim's rule seems more logical to me too, but maybe there is a reason for Dean's?
I have no attachment to the logic I posted. I'll upload a patch that compares area ratios.
>> Source/WebCore/ChangeLog:20 >> + the tests above. > > How about considering the border box of the plugin element instead?
I should have been a little more clear. zombo.com is an extremely simple page. The "border" is just the default 8px margin on the <body>. The plugin takes up all the available space it can, but if the window size is, say 200x200, then the plugin can only get 186x186. Most full-page plugin sites do margin:0;padding;0 then object 100% * 100%, so I feel like this will be a fairly rarely hit rule.
>> Source/WebCore/html/HTMLPlugInImageElement.cpp:430 >> + RenderEmbeddedObject* renderEmbeddedObject = toRenderEmbeddedObject(renderer()); > > Technically you could go to renderbox instead if you wanted, I think... not that that changes anything.
That's true! I just moved the code around, but I'll swap to RenderBox as well.
>>> Source/WebCore/html/HTMLPlugInImageElement.cpp:441 >>> + && (static_cast<float>(contentHeight) / visibleViewSize.height() * 100 > sizingFullPageThresholdPercentage)) { >> >> That's quite the condition. Is there anything we can do to make this less insane? > > We might have to extend this to clip the width and height against the frame.
It does look over-complex, but it isn't really too bad. How about I separate it into some nested tests? (unfortunately we're testing FOR something here, so I can't return early). We need the logic to make sure we don't miss plugins that are 100% by 100% but contained in an element that provides the sizing (that isn't the body).
Dean Jackson
Comment 8
2013-03-02 22:28:28 PST
Created
attachment 191126
[details]
Patch
Dean Jackson
Comment 9
2013-03-02 22:49:32 PST
New patch uses area calculation, which makes the logic look a little more friendly. And RenderBox rather than RenderEmbeddedObject.
Dean Jackson
Comment 10
2013-03-02 22:50:43 PST
It seems this comment in the review didn't get posted here: I was going to add the intersection, but I'm not sure there would be many cases where it is different from just the plugin rect. Remember that we're already testing for 100% w/h, so it would be unusual to have a bunch of content on the page and then a 100% plugin.
Jon Lee
Comment 11
2013-03-02 23:22:18 PST
(In reply to
comment #10
)
> It seems this comment in the review didn't get posted here: > > I was going to add the intersection, but I'm not sure there would be many cases where it is different from just the plugin rect. Remember that we're already testing for 100% w/h, so it would be unusual to have a bunch of content on the page and then a 100% plugin.
Ok! Unofficial r=me.
Brady Eidson
Comment 12
2013-03-03 10:58:37 PST
Comment on
attachment 191126
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=191126&action=review
> Source/WebCore/ChangeLog:19 > + This is definitely not foolproof. For example, zombo.com has a slight > + border around its plug-in. As the window size gets smaller, the body margin > + takes up more than 5% of the width or height, and the plug-in doesn't pass > + the tests above.
How could you not fix zombo com??? You are supposed to be able to do anything there!!!
Dean Jackson
Comment 13
2013-03-03 11:39:03 PST
Committed
r144577
: <
http://trac.webkit.org/changeset/144577
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug