Diff
Modified: trunk/LayoutTests/ChangeLog (115772 => 115773)
--- trunk/LayoutTests/ChangeLog 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/ChangeLog 2012-05-02 01:09:53 UTC (rev 115773)
@@ -1,3 +1,33 @@
+2012-05-01 Eric Seidel <[email protected]>
+
+ Add support for seamless attribute as well as seamless sandbox flag and default CSS styling
+ https://bugs.webkit.org/show_bug.cgi?id=85302
+
+ Reviewed by Ojan Vafai.
+
+ Update all the test results now that the html.css changes have
+ been added for seamless, as specified by HTML5:
+ http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#replaced-elements
+
+ I also added a new test for about:blank iframes (per a code-FIXME)
+ as well as some new testing to confirm that the default seamless-CSS style
+ applies even when iframes cannot render seamless due to security restrictions.
+
+ * fast/frames/seamless/seamless-basic-expected.txt:
+ * fast/frames/seamless/seamless-basic.html:
+ * fast/frames/seamless/seamless-inherited-origin-expected.txt: Added.
+ * fast/frames/seamless/seamless-inherited-origin.html: Added.
+ * fast/frames/seamless/seamless-inline-expected.txt:
+ * fast/frames/seamless/seamless-min-max-expected.txt:
+ * fast/frames/seamless/seamless-nested-expected.txt:
+ * fast/frames/seamless/seamless-quirks-expected.txt:
+ * fast/frames/seamless/seamless-sandbox-flag-expected.txt:
+ * fast/frames/seamless/seamless-sandbox-flag.html:
+ * fast/frames/seamless/seamless-sandbox-srcdoc-expected.txt:
+ * http/tests/security/seamless/seamless-cross-origin-expected.txt:
+ * http/tests/security/seamless/seamless-sandbox-srcdoc-expected.txt:
+ * svg/in-html/by-reference.html: was using seamless, but really doens't want to, doing so just adds noise.
+
2012-05-01 James Simonsen <[email protected]>
Ensure HTMLElementStack fails gracefully if it has a non-Element.
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-basic-expected.txt (115772 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-basic-expected.txt 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-basic-expected.txt 2012-05-02 01:09:53 UTC (rev 115773)
@@ -1,5 +1,6 @@
Test basic seamless auto-sizing-to-content functionality.
FAIL iframe.seamless should be true (of type boolean). Was undefined (of type undefined).
+PASS window.getComputedStyle(iframe).display is "block"
FAIL window.getComputedStyle(iframe).width should be 200px. Was 300px.
FAIL window.getComputedStyle(iframe).height should be 100px. Was 150px.
FAIL window.getComputedStyle(iframe).height should be 200px. Was 150px.
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-basic.html (115772 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-basic.html 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-basic.html 2012-05-02 01:09:53 UTC (rev 115773)
@@ -11,6 +11,7 @@
// Seamless iframes are blocks, filling their parent width
// and setting their height to that of their children.
+ shouldBeEqualToString("window.getComputedStyle(iframe).display", "block");
// Spec: In visual media, in a CSS-supporting user agent: the user agent
// should set the intrinsic width of the iframe to the width that the element
Copied: trunk/LayoutTests/fast/frames/seamless/seamless-inherited-origin-expected.txt (from rev 115772, trunk/LayoutTests/fast/frames/seamless/seamless-basic-expected.txt) (0 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-inherited-origin-expected.txt (rev 0)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-inherited-origin-expected.txt 2012-05-02 01:09:53 UTC (rev 115773)
@@ -0,0 +1,7 @@
+Test that frames with inherited security origins can still be seamless.
+FAIL iframe.seamless should be true (of type boolean). Was undefined (of type undefined).
+FAIL window.getComputedStyle(iframe).width should be 200px. Was 300px.
+FAIL window.getComputedStyle(iframe).height should be 0px. Was 150px.
+FAIL window.getComputedStyle(iframe).width should be 200px. Was 300px.
+FAIL window.getComputedStyle(iframe).height should be 100px. Was 150px.
+
Added: trunk/LayoutTests/fast/frames/seamless/seamless-inherited-origin.html (0 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-inherited-origin.html (rev 0)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-inherited-origin.html 2012-05-02 01:09:53 UTC (rev 115773)
@@ -0,0 +1,21 @@
+<!DOCTYPE html>
+<script src=""
+<div id="parent" style="width: 200px; height: 200px;">
+<iframe id="iframe" seamless src=""
+</div>
+<script>
+debug("Test that frames with inherited security origins can still be seamless.")
+window._onload_ = function () {
+ window.iframe = document.getElementById("iframe");
+ shouldBeTrue("iframe.seamless");
+
+ // Initially about:blank should have 0 height.
+ shouldBeEqualToString("window.getComputedStyle(iframe).width", "200px");
+ shouldBeEqualToString("window.getComputedStyle(iframe).height", "0px");
+
+ // Replace the empty document with a 100x100px square to test if it displays seamlessly.
+ window.iframe.contentDocument.write("<!DOCTYPE html><html style='width: 100px; height: 100px; background-color: green'></html>");
+ shouldBeEqualToString("window.getComputedStyle(iframe).width", "200px");
+ shouldBeEqualToString("window.getComputedStyle(iframe).height", "100px");
+}
+</script>
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-inline-expected.txt (115772 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-inline-expected.txt 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-inline-expected.txt 2012-05-02 01:09:53 UTC (rev 115773)
@@ -3,9 +3,9 @@
FAIL window.getComputedStyle(iframe2).display should be inline-block. Was inline.
FAIL window.getComputedStyle(iframe1).width should be 150px. Was 300px.
FAIL window.getComputedStyle(iframe1).height should be 50px. Was 150px.
-FAIL window.getComputedStyle(parent1).height should be 50px. Was 204px.
+FAIL window.getComputedStyle(parent1).height should be 50px. Was 200px.
FAIL window.getComputedStyle(iframe2).width should be 100px. Was 300px.
FAIL window.getComputedStyle(iframe2).height should be 100px. Was 150px.
-FAIL window.getComputedStyle(parent2).height should be 150px. Was 204px.
+FAIL window.getComputedStyle(parent2).height should be 150px. Was 200px.
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-min-max-expected.txt (115772 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-min-max-expected.txt 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-min-max-expected.txt 2012-05-02 01:09:53 UTC (rev 115773)
@@ -3,4 +3,4 @@
PASS window.getComputedStyle(iframe1).height is "300px"
PASS window.getComputedStyle(iframe2).width is "50px"
PASS window.getComputedStyle(iframe2).height is "50px"
-
+
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-sandbox-flag-expected.txt (115772 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-sandbox-flag-expected.txt 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-sandbox-flag-expected.txt 2012-05-02 01:09:53 UTC (rev 115773)
@@ -1,6 +1,9 @@
Test that sandbox disables nested seamless iframes correctly.
FAIL iframe.seamless should be true (of type boolean). Was undefined (of type undefined).
FAIL nestedFrame.seamless should be true (of type boolean). Was undefined (of type undefined).
+PASS window.getComputedStyle(iframe).display is "block"
+PASS window.getComputedStyle(iframe).borderWidth is "0px"
+PASS window.getComputedStyle(iframe).borderStyle is "none"
FAIL window.getComputedStyle(iframe).width should be 200px. Was 300px.
PASS window.getComputedStyle(iframe).height is "150px"
Modified: trunk/LayoutTests/fast/frames/seamless/seamless-sandbox-flag.html (115772 => 115773)
--- trunk/LayoutTests/fast/frames/seamless/seamless-sandbox-flag.html 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/fast/frames/seamless/seamless-sandbox-flag.html 2012-05-02 01:09:53 UTC (rev 115773)
@@ -12,6 +12,10 @@
// The nested iframe is also "seamless", but the seamless-ness should be disabled by the sandbox.
window.nestedFrame = iframe.contentDocument.getElementById("iframe");
shouldBeTrue("nestedFrame.seamless");
+ // Even though it's prevented from actually being seamless, it should get the seamless styling from html.css.
+ shouldBeEqualToString("window.getComputedStyle(iframe).display", "block");
+ shouldBeEqualToString("window.getComputedStyle(iframe).borderWidth", "0px");
+ shouldBeEqualToString("window.getComputedStyle(iframe).borderStyle", "none");
// The sandboxed iframe is still seamless, but the iframe inside it is not and
// thus 300x150. Thus the sandboxed iframe should be the width of its parent,
Modified: trunk/LayoutTests/svg/in-html/by-reference.html (115772 => 115773)
--- trunk/LayoutTests/svg/in-html/by-reference.html 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/LayoutTests/svg/in-html/by-reference.html 2012-05-02 01:09:53 UTC (rev 115773)
@@ -23,9 +23,9 @@
<div>
<object type='image/svg+xml' width='50' height='50' data=''></object>
<embed width='50' height='50' src=''></embed>
- <iframe seamless='seamless' width='100' height='100' src=''></iframe>
+ <iframe width='100' height='100' src=''></iframe>
<object type='text/xml' width='50' height='50' data=''></object>
<object type='application/xml' width='50' height='50' data=''></object-->
</div>
</body>
-</html>
\ No newline at end of file
+</html>
Modified: trunk/Source/WebCore/ChangeLog (115772 => 115773)
--- trunk/Source/WebCore/ChangeLog 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/ChangeLog 2012-05-02 01:09:53 UTC (rev 115773)
@@ -1,3 +1,59 @@
+2012-05-01 Eric Seidel <[email protected]>
+
+ Add support for seamless attribute as well as seamless sandbox flag and default CSS styling
+ https://bugs.webkit.org/show_bug.cgi?id=85302
+
+ Reviewed by Ojan Vafai.
+
+ This also adds support for the seamless sandbox flag from HTML 5.
+ The sandbox flag is not speficially overridable in the current HTML5,
+ but it is set (like all sandbox flags) by default when sandbox is specified.
+ Unfortunately this support is not yet observable in this patch, as
+ this patch adds not observable features of seamless.
+
+ This patch also adds the html.css additions for seamless, as specified:
+ http://www.whatwg.org/specs/web-apps/current-work/multipage/rendering.html#replaced-elements
+
+ I noticed that my previous testing did not confirm that iframes marked
+ for seamless (but not possible to display as seamless due to sandbox, etc.)
+ were still to have this seamless styling. I've added additional testing for this case.
+
+ I also added another test for the about:blank FIXME added as part of this change.
+
+ In order to support srcdoc w/ seamless, we needed to move the srcdoc determination
+ sooner in the initSecurityContext function (before the should-inherit early return).
+
+ The next patch will make seamless actually observable from JS/DOM, this one
+ just lays down all the plumbing, and separates the security aspects for
+ easy review.
+
+ Test: fast/frames/seamless/seamless-inherited-origin.html
+
+ * css/html.css:
+ (iframe:not([seamless])):
+ (iframe[seamless]):
+ * dom/Document.cpp:
+ (WebCore::isEligibleForSeamless):
+ (WebCore):
+ (WebCore::Document::initSecurityContext):
+ (WebCore::Document::seamlessParentIFrame):
+ (WebCore::Document::shouldDisplaySeamlesslyWithParent):
+ * dom/Document.h:
+ (WebCore):
+ (Document):
+ * dom/SecurityContext.cpp:
+ (WebCore::SecurityContext::SecurityContext):
+ * dom/SecurityContext.h:
+ (WebCore::SecurityContext::mayDisplaySeamlessWithParent):
+ (SecurityContext):
+ * html/HTMLAttributeNames.in:
+ * html/HTMLIFrameElement.cpp:
+ (WebCore::HTMLIFrameElement::shouldDisplaySeamlessly):
+ (WebCore):
+ * html/HTMLIFrameElement.h:
+ (HTMLIFrameElement):
+ * html/HTMLIFrameElement.idl:
+
2012-05-01 Min Qin <[email protected]>
use USE(NATIVE_FULLSCREEN_VIDEO) instead of ENABLE(NATIVE_FULLSCREEN_VIDEO)
Modified: trunk/Source/WebCore/css/html.css (115772 => 115773)
--- trunk/Source/WebCore/css/html.css 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/css/html.css 2012-05-02 01:09:53 UTC (rev 115773)
@@ -983,10 +983,14 @@
border-color: inherit
}
-iframe {
+iframe:not([seamless]) {
border: 2px inset
}
+iframe[seamless] {
+ display: block
+}
+
details {
display: block
}
Modified: trunk/Source/WebCore/dom/Document.cpp (115772 => 115773)
--- trunk/Source/WebCore/dom/Document.cpp 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/dom/Document.cpp 2012-05-02 01:09:53 UTC (rev 115773)
@@ -4857,6 +4857,20 @@
return m_useSecureKeyboardEntryWhenActive;
}
+static bool isEligibleForSeamless(Document* parent, Document* child)
+{
+ // It should not matter what we return for the top-most document.
+ if (!parent)
+ return false;
+ if (parent->isSandboxed(SandboxSeamlessIframes))
+ return false;
+ if (child->isSrcdocDocument())
+ return true;
+ if (parent->securityOrigin()->canAccess(child->securityOrigin()))
+ return true;
+ return parent->securityOrigin()->canRequest(child->url());
+}
+
void Document::initSecurityContext()
{
if (haveInitializedSecurityOrigin()) {
@@ -4910,6 +4924,16 @@
}
}
+ Document* parentDocument = ownerElement() ? ownerElement()->document() : 0;
+ if (parentDocument && m_frame->loader()->shouldTreatURLAsSrcdocDocument(url())) {
+ m_isSrcdocDocument = true;
+ setBaseURLOverride(parentDocument->baseURL());
+ }
+
+ // FIXME: What happens if we inherit the security origin? This check may need to be later.
+ // <iframe seamless src="" likely won't work as-is.
+ m_mayDisplaySeamlessWithParent = isEligibleForSeamless(parentDocument, this);
+
if (!shouldInheritSecurityOriginFromOwner(m_url))
return;
@@ -4925,11 +4949,6 @@
return;
}
- if (m_frame->loader()->shouldTreatURLAsSrcdocDocument(url())) {
- m_isSrcdocDocument = true;
- setBaseURLOverride(ownerFrame->document()->baseURL());
- }
-
if (isSandboxed(SandboxOrigin)) {
// If we're supposed to inherit our security origin from our owner,
// but we're also sandboxed, the only thing we inherit is the ability
@@ -5845,6 +5864,24 @@
mainFrame->notifyChromeClientTouchEventHandlerCountChanged();
}
+HTMLIFrameElement* Document::seamlessParentIFrame() const
+{
+ if (!shouldDisplaySeamlesslyWithParent())
+ return 0;
+
+ HTMLFrameOwnerElement* ownerElement = this->ownerElement();
+ ASSERT(ownerElement->hasTagName(iframeTag));
+ return static_cast<HTMLIFrameElement*>(ownerElement);
+}
+
+bool Document::shouldDisplaySeamlesslyWithParent() const
+{
+ HTMLFrameOwnerElement* ownerElement = this->ownerElement();
+ if (!ownerElement)
+ return false;
+ return m_mayDisplaySeamlessWithParent && ownerElement->hasTagName(iframeTag) && ownerElement->fastHasAttribute(seamlessAttr);
+}
+
DocumentLoader* Document::loader() const
{
if (!m_frame)
Modified: trunk/Source/WebCore/dom/Document.h (115772 => 115773)
--- trunk/Source/WebCore/dom/Document.h 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/dom/Document.h 2012-05-02 01:09:53 UTC (rev 115773)
@@ -97,6 +97,7 @@
class HTMLFrameOwnerElement;
class HTMLHeadElement;
class HTMLInputElement;
+class HTMLIFrameElement;
class HTMLMapElement;
class HTMLNameCollection;
class HitTestRequest;
@@ -828,6 +829,9 @@
// Returns 0 if this is the top level document.
HTMLFrameOwnerElement* ownerElement() const;
+ HTMLIFrameElement* seamlessParentIFrame() const;
+ bool shouldDisplaySeamlesslyWithParent() const;
+
// Used by DOM bindings; no direction known.
String title() const { return m_title.string(); }
void setTitle(const String&);
Modified: trunk/Source/WebCore/dom/SecurityContext.cpp (115772 => 115773)
--- trunk/Source/WebCore/dom/SecurityContext.cpp 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/dom/SecurityContext.cpp 2012-05-02 01:09:53 UTC (rev 115773)
@@ -34,7 +34,8 @@
namespace WebCore {
SecurityContext::SecurityContext()
- : m_haveInitializedSecurityOrigin(false)
+ : m_mayDisplaySeamlessWithParent(false)
+ , m_haveInitializedSecurityOrigin(false)
, m_sandboxFlags(SandboxNone)
{
}
Modified: trunk/Source/WebCore/dom/SecurityContext.h (115772 => 115773)
--- trunk/Source/WebCore/dom/SecurityContext.h 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/dom/SecurityContext.h 2012-05-02 01:09:53 UTC (rev 115773)
@@ -48,7 +48,7 @@
SandboxTopNavigation = 1 << 5,
SandboxPopups = 1 << 6, // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=12393
SandboxAutomaticFeatures = 1 << 7,
- // FIXME: Add http://www.whatwg.org/specs/web-apps/current-work/#sandboxed-seamless-iframes-flag when we implement seamless.
+ SandboxSeamlessIframes = 1 << 8,
SandboxAll = -1 // Mask with all bits set to 1.
};
@@ -67,6 +67,8 @@
static SandboxFlags parseSandboxPolicy(const String& policy);
+ bool mayDisplaySeamlessWithParent() const { return m_mayDisplaySeamlessWithParent; }
+
protected:
SecurityContext();
~SecurityContext();
@@ -80,6 +82,10 @@
void didFailToInitializeSecurityOrigin() { m_haveInitializedSecurityOrigin = false; }
bool haveInitializedSecurityOrigin() const { return m_haveInitializedSecurityOrigin; }
+ // Set in Document::initSecurityContext() at Document creation, per:
+ // http://www.whatwg.org/specs/web-apps/current-work/#attr-iframe-seamless
+ bool m_mayDisplaySeamlessWithParent;
+
private:
bool m_haveInitializedSecurityOrigin;
SandboxFlags m_sandboxFlags;
Modified: trunk/Source/WebCore/html/HTMLAttributeNames.in (115772 => 115773)
--- trunk/Source/WebCore/html/HTMLAttributeNames.in 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/html/HTMLAttributeNames.in 2012-05-02 01:09:53 UTC (rev 115773)
@@ -283,6 +283,7 @@
scrollamount
scrolldelay
scrolling
+seamless
select
selected
shape
Modified: trunk/Source/WebCore/html/HTMLIFrameElement.cpp (115772 => 115773)
--- trunk/Source/WebCore/html/HTMLIFrameElement.cpp 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/html/HTMLIFrameElement.cpp 2012-05-02 01:09:53 UTC (rev 115773)
@@ -115,6 +115,11 @@
static_cast<HTMLDocument*>(document())->removeExtraNamedItem(m_name);
}
+bool HTMLIFrameElement::shouldDisplaySeamlessly() const
+{
+ return contentDocument() && contentDocument()->mayDisplaySeamlessWithParent() && hasAttribute(seamlessAttr);
+}
+
#if ENABLE(MICRODATA)
String HTMLIFrameElement::itemValueText() const
{
Modified: trunk/Source/WebCore/html/HTMLIFrameElement.h (115772 => 115773)
--- trunk/Source/WebCore/html/HTMLIFrameElement.h 2012-05-02 00:41:34 UTC (rev 115772)
+++ trunk/Source/WebCore/html/HTMLIFrameElement.h 2012-05-02 01:09:53 UTC (rev 115773)
@@ -32,6 +32,8 @@
public:
static PassRefPtr<HTMLIFrameElement> create(const QualifiedName&, Document*);
+ bool shouldDisplaySeamlessly() const;
+
private:
HTMLIFrameElement(const QualifiedName&, Document*);