Changeset 117026 in webkit


Ignore:
Timestamp:
May 14, 2012 9:36:22 PM (12 years ago)
Author:
eric@webkit.org
Message:

Styles are not recalculated when the seamless attribute is dynamically added/removed
https://bugs.webkit.org/show_bug.cgi?id=86315

Reviewed by Andreas Kling.

Source/WebCore:

Covered by fast/frames/seamless/seamless-css-cascade.html.

  • html/HTMLIFrameElement.cpp:

(WebCore::HTMLIFrameElement::isPresentationAttribute):

  • Make seamless a presentational attribute, which means style on the <iframe> will be forced to recalculate when it changes. This is correct, but not observable until the layout changes are landed (as then the iframe should correctly revert to not being sized to fit its content if seamless is removed).

(WebCore::HTMLIFrameElement::parseAttribute):

  • When the seamless attribute is added or remove, force the content document to recalc its style resolver, which will refresh the list of inherited stylesheets from the parent. This doesn't need to happen synchronously. When the layout changes land the content document will actually cause that recalc to redirect to the parent document in the seamless case anyway, but it's more correct to ask the content document directly.

LayoutTests:

Add a subtest to cover this case.

  • fast/frames/seamless/seamless-css-cascade-expected.txt:
  • fast/frames/seamless/seamless-css-cascade.html:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r117024 r117026  
     12012-05-14  Eric Seidel  <eric@webkit.org>
     2
     3        Styles are not recalculated when the seamless attribute is dynamically added/removed
     4        https://bugs.webkit.org/show_bug.cgi?id=86315
     5
     6        Reviewed by Andreas Kling.
     7
     8        Add a subtest to cover this case.
     9
     10        * fast/frames/seamless/seamless-css-cascade-expected.txt:
     11        * fast/frames/seamless/seamless-css-cascade.html:
     12
    1132012-05-14  Kent Tamura  <tkent@chromium.org>
    214
  • trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade-expected.txt

    r116694 r117026  
    66PASS window.getComputedStyle(rootElement).color is "rgb(1, 2, 3)"
    77PASS window.getComputedStyle(one).color is "rgb(3, 2, 1)"
     8PASS window.getComputedStyle(one).color is "rgb(0, 0, 0)"
     9PASS window.getComputedStyle(two).color is "rgb(128, 0, 128)"
     10PASS window.getComputedStyle(three).color is "rgb(0, 0, 0)"
    811
  • trunk/LayoutTests/fast/frames/seamless/seamless-css-cascade.html

    r115742 r117026  
    4343    // #one's style is only specified by this parent, so adding a later sheet should override the color and update the child frame.
    4444    shouldBeEqualToString("window.getComputedStyle(one).color", "rgb(3, 2, 1)");
     45
     46    // Test that removing the seamless attribute recalculates the child's style.
     47    window.iframe.removeAttribute("seamless");
     48    shouldBeEqualToString("window.getComputedStyle(one).color", "rgb(0, 0, 0)"); // black, default.
     49    shouldBeEqualToString("window.getComputedStyle(two).color", "rgb(128, 0, 128)"); // purple, selector in child.
     50    shouldBeEqualToString("window.getComputedStyle(three).color", "rgb(0, 0, 0)"); // black, default.
    4551}
    4652</script>
  • trunk/Source/WebCore/ChangeLog

    r117022 r117026  
     12012-05-14  Eric Seidel  <eric@webkit.org>
     2
     3        Styles are not recalculated when the seamless attribute is dynamically added/removed
     4        https://bugs.webkit.org/show_bug.cgi?id=86315
     5
     6        Reviewed by Andreas Kling.
     7
     8        Covered by fast/frames/seamless/seamless-css-cascade.html.
     9
     10        * html/HTMLIFrameElement.cpp:
     11        (WebCore::HTMLIFrameElement::isPresentationAttribute):
     12         - Make seamless a presentational attribute, which means style on the <iframe> will
     13           be forced to recalculate when it changes.  This is correct, but not observable
     14           until the layout changes are landed (as then the iframe should correctly revert to not
     15           being sized to fit its content if seamless is removed).
     16        (WebCore::HTMLIFrameElement::parseAttribute):
     17         - When the seamless attribute is added or remove, force the content document to recalc
     18           its style resolver, which will refresh the list of inherited stylesheets from the
     19           parent.  This doesn't need to happen synchronously.  When the layout changes land
     20           the content document will actually cause that recalc to redirect to the parent document
     21           in the seamless case anyway, but it's more correct to ask the content document directly.
     22
    1232012-05-14  Alexandre Elias  <aelias@google.com>
    224
  • trunk/Source/WebCore/html/HTMLIFrameElement.cpp

    r116694 r117026  
    5252bool HTMLIFrameElement::isPresentationAttribute(const QualifiedName& name) const
    5353{
    54     if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr)
     54    if (name == widthAttr || name == heightAttr || name == alignAttr || name == frameborderAttr || name == seamlessAttr)
    5555        return true;
    5656    return HTMLFrameElementBase::isPresentationAttribute(name);
     
    8888    } else if (attr->name() == sandboxAttr)
    8989        setSandboxFlags(attr->isNull() ? SandboxNone : SecurityContext::parseSandboxPolicy(attr->value()));
    90     else
     90    else if (attr->name() == seamlessAttr) {
     91        // If we're adding or removing the seamless attribute, we need to force the content document to recalculate its StyleResolver.
     92        if (contentDocument())
     93            contentDocument()->styleResolverChanged(DeferRecalcStyle);
     94    } else
    9195        HTMLFrameElementBase::parseAttribute(attr);
    9296}
Note: See TracChangeset for help on using the changeset viewer.