Skip to content

Commit

Permalink
Check if an <embed> can transition to an "Active" state from "potenti…
Browse files Browse the repository at this point in the history
…ally-active" state when the src attribute on an <embed> is set.

* plugins/embed-attributes-setting.html
  Updating src attribute should trigger content loading. So This CL removes
  the code to update src attribute.

* AUTHORS
  Adding George Joseph.

BUG=543905

Review-Url: https://codereview.chromium.org/2347553002
Cr-Commit-Position: refs/heads/master@{#428661}
  • Loading branch information
gecko19 authored and Commit bot committed Oct 31, 2016
1 parent 1ab21eb commit 72ea580
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Gajendra N <gajendra.n@samsung.com>
Gajendra Singh <wxjg68@motorola.com>
Gao Chun <chun.gao@intel.com>
Gao Chun <gaochun.dev@gmail.com>
George Joseph <kottackal.george@gmail.com>
George Liaskos <geo.liaskos@gmail.com>
Georgy Buranov <gburanov@gmail.com>
Gergely Nagy <ngg@ngg.hu>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<html>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<body>
<embed style="visibility: hidden" type="image/svg+xml" id='embed'></embed>
<script>
var testobject = async_test("crbug.com/543905 : check that an embed does get loaded when setting properties type and src respectively");
var embed = document.getElementById('embed');
embed.addEventListener("load", testobject.step_func(() => {
testobject.done();
}));
embed.type = "image/svg+xml"; // setting the type attribute should not effect the plugin once loaded
embed.src = "resources/410.svg"; // setting the source attribute should not effect the plugin once loaded
</script>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ PASS: embed.getAttribute('height') should be 1 and is.
PASS: embed.getAttribute('name') should be 1 and is.
PASS: embed.getAttribute('width') should be 1 and is.
PASS: embed.getAttribute('type') should be 1 and is.
PASS: embed.getAttribute('src') should be 1 and is.
PASS: typeof embed.postMessage should be function and is.
----------
[Embed is dynamically created element with only type specified]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,12 @@
embed.name = 1;
embed.width = 1;
embed.type = 1; // setting the type attribute should not effect the plugin once loaded
embed.src = 1; // setting the source attribute should not effect the plugin once loaded

shouldBe("embed.getAttribute('align')", 1);
shouldBe("embed.getAttribute('height')", 1);
shouldBe("embed.getAttribute('name')", 1);
shouldBe("embed.getAttribute('width')", 1);
shouldBe("embed.getAttribute('type')", 1);
shouldBe("embed.getAttribute('src')", 1);
shouldBe("typeof embed.postMessage", "function");

print("----------");
Expand Down
5 changes: 5 additions & 0 deletions third_party/WebKit/LayoutTests/plugins/resources/410.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions third_party/WebKit/Source/core/html/HTMLEmbedElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ void HTMLEmbedElement::parseAttribute(const QualifiedName& name,
if (!m_imageLoader)
m_imageLoader = HTMLImageLoader::create(this);
m_imageLoader->updateFromElement(ImageLoader::UpdateIgnorePreviousError);
} else if (layoutObject()) {
// Check if this Embed can transition from potentially-active to active
if (fastHasAttribute(typeAttr)) {
setNeedsWidgetUpdate(true);
lazyReattachIfNeeded();
}
} else {
requestPluginCreationWithoutLayoutObjectIfPossible();
}
} else {
HTMLPlugInElement::parseAttribute(name, oldValue, value);
Expand Down

0 comments on commit 72ea580

Please sign in to comment.