Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force inline block display style for <object>. #7404

Merged
merged 1 commit into from
Jun 11, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions extensions/chromium/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ function updateObjectElement(elem) {
elem.type = 'application/not-a-pee-dee-eff-type';
// Force the <object> to reload and render its fallback content.
elem.data += '';

// Usually the browser renders plugin content in this tag, which is completely
// oblivious of styles such as padding, but we insert and render child nodes,
// so force padding to be zero to avoid undesired dimension changes.
elem.style.padding = '0';

// <object> and <embed> elements have a "display:inline" style by default.
// Despite this property, when a plugin is loaded in the tag, the tag is
// treated like "display:inline-block". However, when the browser does not
// render plugin content, the <object> tag does not behave like that, and as
// a result the width and height is ignored.
// Force "display:inline-block" to make sure that the width/height as set by
// web pages is respected.
// (<embed> behaves as expected with the default display value, but setting it
// to display:inline-block doesn't hurt).
elem.style.display = 'inline-block';
}

// Create an <iframe> element without borders that takes the full width and
Expand Down