View | Details | Raw Unified | Return to bug 65140 | Differences between
and this patch

Collapse All | Expand All

(-)a/LayoutTests/ChangeLog (+31 lines)
Lines 1-3 Link Here
1
2011-08-10  Julien Chaffraix  <jchaffraix@webkit.org>
2
3
        REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
4
        https://bugs.webkit.org/show_bug.cgi?id=65140
5
        <rdar://problem/9835905>
6
7
        Reviewed by NOBODY (OOPS!).
8
9
        * fast/css/link-disabled-attr-expected.txt: This change is a progression, but we are still
10
        not handling updates to the selected style set properly (already covered by bug 62407).
11
12
        * fast/css/stylesheet-enable-first-alternate-expected.txt: Added.
13
        * fast/css/stylesheet-enable-first-alternate-on-load-expected.txt: Added.
14
        * fast/css/stylesheet-enable-first-alternate-on-load.html: Added.
15
        * fast/css/stylesheet-enable-first-alternate.html: Added.
16
        * fast/css/stylesheet-enable-second-alternate-expected.txt: Added.
17
        * fast/css/stylesheet-enable-second-alternate-on-load-expected.txt: Added.
18
        * fast/css/stylesheet-enable-second-alternate-on-load.html: Added.
19
        * fast/css/stylesheet-enable-second-alternate.html: Added.
20
        * http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt: Added.
21
        * http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html: Added.
22
        * http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js: Added.
23
        (onSheetLoaded):
24
        (testWhenLoaded):
25
        * http/tests/css/resources/slow-loading-sheet.php: Added.
26
        Those are a variation on the same theme: we disable some stylesheet and enable others,
27
        either directly or later.
28
29
        * platform/chromium/test_expectations.txt: Maked link-css-disabled-value-with-slow-loading-sheet.js as
30
        SLOW, not sure why as it should run fast enough and does not time out if you run it manually.
31
1
2011-08-10  Abhishek Arya  <inferno@chromium.org>
32
2011-08-10  Abhishek Arya  <inferno@chromium.org>
2
33
3
        Tests that we do not crash when trying to access a removed
34
        Tests that we do not crash when trying to access a removed
(-)a/LayoutTests/fast/css/link-disabled-attr-expected.txt (-3 / +3 lines)
Lines 15-25 PASS getComputedStyle(console).whiteSpace is 'pre-wrap' Link Here
15
altsheet
15
altsheet
16
FAIL link.disabled should be true. Was false.
16
FAIL link.disabled should be true. Was false.
17
PASS link.sheet is non-null.
17
PASS link.sheet is non-null.
18
FAIL getComputedStyle(console).backgroundColor should be rgb(0, 128, 0). Was rgba(0, 0, 0, 0).
18
PASS getComputedStyle(console).backgroundColor is 'rgb(0, 128, 0)'
19
FAIL link.disabled should be true. Was false.
19
FAIL link.disabled should be true. Was false.
20
PASS getComputedStyle(console).backgroundColor is originalBG
20
FAIL getComputedStyle(console).backgroundColor should be rgba(0, 0, 0, 0). Was rgb(0, 128, 0).
21
PASS link.disabled is false
21
PASS link.disabled is false
22
FAIL getComputedStyle(console).backgroundColor should be rgb(0, 128, 0). Was rgba(0, 0, 0, 0).
22
PASS getComputedStyle(console).backgroundColor is 'rgb(0, 128, 0)'
23
PASS getComputedStyle(console).backgroundColor is originalBG
23
PASS getComputedStyle(console).backgroundColor is originalBG
24
PASS successfullyParsed is true
24
PASS successfullyParsed is true
25
25
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
PASSED
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
PASSED
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate-on-load.html (+31 lines)
Line 0 Link Here
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
5
<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
6
<script type="text/javascript">
7
    if (window.layoutTestController)
8
        layoutTestController.dumpAsText();
9
10
    function test() {
11
        var red = document.getElementsByTagName("link")[0];
12
        red.disabled = true;
13
        var green = document.getElementsByTagName("link")[1];
14
        green.disabled = true;
15
        green.disabled = false;
16
17
        var console = document.getElementById("console");
18
        if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
19
            console.innerHTML = "PASSED";
20
        else
21
            console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
22
    }
23
    window.addEventListener("load", test, false);
24
</script>
25
</head>
26
<body>
27
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
28
<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
29
<div id="console">FAILED</div>
30
</body>
31
</html>
(-)a/LayoutTests/fast/css/stylesheet-enable-first-alternate.html (+31 lines)
Line 0 Link Here
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
5
<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
6
<script type="text/javascript">
7
    if (window.layoutTestController)
8
        layoutTestController.dumpAsText();
9
10
    var red = document.getElementsByTagName("link")[0];
11
    red.disabled = true;
12
    var green = document.getElementsByTagName("link")[1];
13
    green.disabled = true;
14
    green.disabled = false;
15
16
    function test() {
17
        var console = document.getElementById("console");
18
        if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
19
            console.innerHTML = "PASSED";
20
        else
21
            console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
22
    }
23
    window.addEventListener("load", test, false);
24
</script>
25
</head>
26
<body>
27
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
28
<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
29
<div id="console">FAILED</div>
30
</body>
31
</html>
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
PASSED
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load-expected.txt (+5 lines)
Line 0 Link Here
1
Test for 65140: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
2
3
This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).
4
5
PASSED
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate-on-load.html (+31 lines)
Line 0 Link Here
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
5
<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" />
6
<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
7
<script type="text/javascript">
8
    if (window.layoutTestController)
9
        layoutTestController.dumpAsText();
10
11
    function test() {
12
        var red = document.getElementsByTagName("link")[0];
13
        red.disabled = true;
14
        var green = document.getElementsByTagName("link")[2];
15
        green.disabled = false;
16
17
        var console = document.getElementById("console");
18
        if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
19
            console.innerHTML = "PASSED";
20
        else
21
            console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
22
    }
23
    window.addEventListener("load", test, false);
24
</script>
25
</head>
26
<body>
27
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
28
<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
29
<div id="console">FAILED</div>
30
</body>
31
</html>
(-)a/LayoutTests/fast/css/stylesheet-enable-second-alternate.html (+31 lines)
Line 0 Link Here
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="resources/red.css" media="all" title="Default Style Sheet" type="text/css" />
5
<link rel="alternate stylesheet" href="resources/red.css" media="all" title="green" type="text/css" />
6
<link rel="alternate stylesheet" href="resources/green.css" media="all" title="green" type="text/css" />
7
<script type="text/javascript">
8
    if (window.layoutTestController)
9
        layoutTestController.dumpAsText();
10
11
    var red = document.getElementsByTagName("link")[0];
12
    red.disabled = true;
13
    var green = document.getElementsByTagName("link")[2];
14
    green.disabled = false;
15
16
    function test() {
17
        var console = document.getElementById("console");
18
        if (getComputedStyle(console, null).backgroundColor === "rgb(0, 128, 0)")
19
            console.innerHTML = "PASSED";
20
        else
21
            console.innerHTML = "FAILED, background = " + getComputedStyle(console, null).backgroundColor;
22
    }
23
    window.addEventListener("load", test, false);
24
</script>
25
</head>
26
<body>
27
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=65140">65140</a>: REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page</p>
28
<p>This test PASSED if PASSED is written below (alternatively the next line should have a GREEN background).</p>
29
<div id="console">FAILED</div>
30
</body>
31
</html>
(-)a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet-expected.txt (+19 lines)
Line 0 Link Here
1
Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
Testing value of 'disabled' prior to load just after setting them
7
PASS mainSheetLink.sheet is non-null.
8
PASS alternateSheetLink.sheet is null
9
PASS mainSheetLink.disabled is true
10
PASS alternateSheetLink.disabled is false
11
Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)
12
PASS mainSheetLink.sheet is non-null.
13
PASS alternateSheetLink.sheet is non-null.
14
PASS mainSheetLink.disabled is true
15
PASS alternateSheetLink.disabled is false
16
PASS successfullyParsed is true
17
18
TEST COMPLETE
19
(-)a/LayoutTests/http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html (+14 lines)
Line 0 Link Here
1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
2
<html>
3
<head>
4
<link rel="stylesheet" href="resources/slow-loading-sheet.php?color=red" media="all" title="Default Style Sheet" type="text/css" />
5
<link rel="alternate stylesheet" href="resources/slow-loading-sheet.php?color=green" media="all" title="green" type="text/css" />
6
<script src="/js-test-resources/js-test-pre.js"></script>
7
</head>
8
<body>
9
<p id="description"></p>
10
<div id="console"></div>
11
<script src="resources/link-css-disabled-value-with-slow-loading-sheet.js"></script>
12
<script src="/js-test-resources/js-test-post.js"></script>
13
</body>
14
</html>
(-)a/LayoutTests/http/tests/css/resources/link-css-disabled-value-with-slow-loading-sheet.js (+45 lines)
Line 0 Link Here
1
description("Test that HTMLLinkElement's disabled attribute is properly cached while set when loading a stylesheet.");
2
3
if (window.layoutTestController)
4
    layoutTestController.waitUntilDone();
5
6
window.jsTestIsAsync = true;
7
8
mainSheetLink = document.getElementsByTagName("link")[0];
9
alternateSheetLink = document.getElementsByTagName("link")[1];
10
11
mainSheetLink.disabled = true;
12
alternateSheetLink.disabled = false;
13
14
debug("Testing value of 'disabled' prior to load just after setting them");
15
shouldBeNonNull("mainSheetLink.sheet");
16
shouldBeNull("alternateSheetLink.sheet");
17
shouldBeTrue("mainSheetLink.disabled", true);
18
shouldBeFalse("alternateSheetLink.disabled");
19
20
debug("Testing the values when the alternate sheet is loaded (as this is the only one that has sheet() === null)");
21
22
function onSheetLoaded(f, elem, maxtime) {
23
    if (elem.sheet || maxtime <= 0)
24
        f();
25
    else
26
        setTimeout(function () { onSheetLoaded(f, elem, maxtime - 25);}, 25);
27
}
28
29
function testWhenLoaded() {
30
        // Those next 2 lines are a sanity check.
31
        // If the second check fails, it is likely that the test timed out and thus
32
        // you can discard the rest of results as it is not testing what we want
33
        // (namely that the disabled value is passed to the final sheet).
34
        shouldBeNonNull("mainSheetLink.sheet");
35
        shouldBeNonNull("alternateSheetLink.sheet");
36
37
        shouldBeTrue("mainSheetLink.disabled");
38
        shouldBeFalse("alternateSheetLink.disabled");
39
40
        finishJSTest();
41
}
42
43
onSheetLoaded(testWhenLoaded, alternateSheetLink, 500);
44
45
var successfullyParsed = true;
(-)a/LayoutTests/http/tests/css/resources/slow-loading-sheet.php (+15 lines)
Line 0 Link Here
1
<?php
2
// We sleep here so that we are have enough time to test the different attributes before the stylesheet is fully loaded.
3
usleep(100);
4
5
header("Expires: Thu, 01 Dec 2003 16:00:00 GMT");
6
header("Cache-Control: no-cache, no-store, must-revalidate");
7
header("Pragma: no-cache");
8
header("Content-Type: text/css");
9
10
$color = $_GET['color'];
11
12
echo "h1 { background-color: $color }\n";
13
ob_flush();
14
flush();
15
?>
(-)a/LayoutTests/platform/chromium/test_expectations.txt (+2 lines)
Lines 64-69 BUGWK64498 SLOW DEBUG : fast/encoding/parser-tests-40.html = PASS Link Here
64
BUGWK64502 SLOW DEBUG : fast/forms/form-associated-element-crash3.html = PASS
64
BUGWK64502 SLOW DEBUG : fast/forms/form-associated-element-crash3.html = PASS
65
WONTFIX SLOW : fast/dom/Window/window-postmessage-clone-really-deep-array.html = PASS
65
WONTFIX SLOW : fast/dom/Window/window-postmessage-clone-really-deep-array.html = PASS
66
66
67
BUGWK65140 SLOW: http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html = PASS
68
67
// -----------------------------------------------------------------
69
// -----------------------------------------------------------------
68
// SKIPPED TESTS
70
// SKIPPED TESTS
69
// -----------------------------------------------------------------
71
// -----------------------------------------------------------------
(-)a/Source/WebCore/ChangeLog (+47 lines)
Lines 1-3 Link Here
1
2011-08-10  Julien Chaffraix  <jchaffraix@webkit.org>
2
3
        REGRESSION (r84327-r84329): CSS stylesheets fail to load on www.flagstar.com login page
4
        https://bugs.webkit.org/show_bug.cgi?id=65140
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        Tests: fast/css/stylesheet-enable-first-alternate-on-load.html
9
               fast/css/stylesheet-enable-first-alternate.html
10
               fast/css/stylesheet-enable-second-alternate-on-load.html
11
               fast/css/stylesheet-enable-second-alternate.html
12
               http/tests/css/link-css-disabled-value-with-slow-loading-sheet.html
13
14
        The gist of the issue is that we were ignoring calls to HTMLLinkElement::setDisabled that would enable a
15
        style sheet when we were loading a stylesheet (m_sheet was 0 and thus ignored the call per the spec).
16
17
        FF goes against the spec here and just always keep an associated sheet as long as 'rel' hints at a stylesheet
18
        link and href is present. Instead of siding with FF, I continued to follow the specification and store the
19
        enabled via javascript state into the existing m_isEnabledViaScript fiedl. This information gets merged back
20
        into the style sheet disabled state.
21
22
        While debugging the case at hand, I found some cases that were not properly handled and were
23
        fixed as part of this change.
24
25
        * html/HTMLLinkElement.cpp:
26
        (WebCore::HTMLLinkElement::setDisabled): Store the temporary information here. Also if
27
        we set disabled to the existing value, make sure m_isEnabledViaScript is set properly
28
        as we could lose the "forced via JS" information in some cases. I had to move setting
29
        m_isEnabledViaScript above setDisabled as it would do a recalcStyleSelect and trigger
30
        the ASSERT.
31
32
        (WebCore::HTMLLinkElement::sheetLoaded): Push back the disabled information if
33
        m_isEnabledViaScript is set.
34
35
        (WebCore::HTMLLinkElement::disabled): Be consistent with FF here by returning the cached
36
        information if we are loading. Also check that the value of m_isEnabledViaScript and disabled()
37
        are consistent.
38
39
        * html/HTMLLinkElement.h: m_isEnabledViaScript is an enum as we do need to store 3 states:
40
        Unset, Disabled and Enabled.
41
42
        (WebCore::HTMLLinkElement::isEnabledViaScript): Call checkDisabledAndEnabledViaScriptState.
43
        (WebCore::HTMLLinkElement::setEnabledViaScript): Helper method.
44
        (WebCore::HTMLLinkElement::checkDisabledAndEnabledViaScriptState): This method make sure
45
        that disabled() and m_isEnabledViaScriptState are consistent with each other, that is if
46
        JS forces a sheet to be enabled / disabled, it should be the case.
47
1
2011-08-10  Abhishek Arya  <inferno@chromium.org>
48
2011-08-10  Abhishek Arya  <inferno@chromium.org>
2
49
3
        Check that we do not need layout before trying to dirty
50
        Check that we do not need layout before trying to dirty
(-)a/Source/WebCore/html/HTMLLinkElement.cpp (-5 / +43 lines)
Lines 56-62 inline HTMLLinkElement::HTMLLinkElement(const QualifiedName& tagName, Document* Link Here
56
    , m_linkLoader(this)
56
    , m_linkLoader(this)
57
    , m_sizes(DOMSettableTokenList::create())
57
    , m_sizes(DOMSettableTokenList::create())
58
    , m_loading(false)
58
    , m_loading(false)
59
    , m_isEnabledViaScript(false)
59
    , m_isEnabledViaScript(Unset)
60
    , m_createdByParser(createdByParser)
60
    , m_createdByParser(createdByParser)
61
    , m_isInShadowTree(false)
61
    , m_isInShadowTree(false)
62
    , m_pendingSheetType(None)
62
    , m_pendingSheetType(None)
Lines 82-96 HTMLLinkElement::~HTMLLinkElement() Link Here
82
82
83
void HTMLLinkElement::setDisabled(bool disabled)
83
void HTMLLinkElement::setDisabled(bool disabled)
84
{
84
{
85
    if (!m_sheet)
85
    if (!m_sheet) {
86
        // If we are in the middle of loading a stylesheet, we store the information from this call
87
        // as it is a common pattern to disable / enable the stylesheet through JS (regardless of
88
        // whether the sheet was loaded).
89
        // See https://bugs.webkit.org/show_bug.cgi?id=65140
90
        if (m_relAttribute.m_isStyleSheet && m_loading)
91
            setEnabledViaScript(!disabled);
86
        return;
92
        return;
93
    }
87
94
88
    bool wasDisabled = m_sheet->disabled();
95
    bool wasDisabled = m_sheet->disabled();
89
    if (wasDisabled == disabled)
96
97
    if (wasDisabled == disabled) {
98
        // If JS forces the sheet to be enabled, we need to force a recalcStyleSelector or
99
        // we may not apply the stylesheet (for example for alternate stylesheet).
100
        if (isEnabledViaScript() != !disabled) {
101
            setEnabledViaScript(!disabled);
102
            document()->styleSelectorChanged(DeferRecalcStyle);
103
        }
90
        return;
104
        return;
105
    }
91
106
107
    setEnabledViaScript(!disabled);
92
    m_sheet->setDisabled(disabled);
108
    m_sheet->setDisabled(disabled);
93
    m_isEnabledViaScript = !disabled;
94
109
95
    // If we change the disabled state while the sheet is still loading, then we have to
110
    // If we change the disabled state while the sheet is still loading, then we have to
96
    // perform three checks:
111
    // perform three checks:
Lines 117-122 void HTMLLinkElement::setDisabled(bool disabled) Link Here
117
132
118
    if (!disabled)
133
    if (!disabled)
119
        process();
134
        process();
135
136
    checkDisabledAndEnabledViaScriptState();
120
}
137
}
121
138
122
StyleSheet* HTMLLinkElement::sheet() const
139
StyleSheet* HTMLLinkElement::sheet() const
Lines 356-365 void HTMLLinkElement::linkLoadingErrored() Link Here
356
373
357
bool HTMLLinkElement::sheetLoaded()
374
bool HTMLLinkElement::sheetLoaded()
358
{
375
{
376
    // Migrate the disabled information before removePendingSheet is called
377
    // as it will start a recalStyleSelector which needs this information.
378
    if (m_isEnabledViaScript != Unset) {
379
        ASSERT(!m_loading);
380
        ASSERT(m_relAttribute.m_isStyleSheet);
381
        setDisabled(m_isEnabledViaScript == Disabled);
382
    }
383
359
    if (!isLoading()) {
384
    if (!isLoading()) {
360
        removePendingSheet();
385
        removePendingSheet();
361
        return true;
386
        return true;
362
    }
387
    }
388
363
    return false;
389
    return false;
364
}
390
}
365
391
Lines 442-448 void HTMLLinkElement::removePendingSheet() Link Here
442
468
443
bool HTMLLinkElement::disabled() const
469
bool HTMLLinkElement::disabled() const
444
{
470
{
445
    return m_sheet && m_sheet->disabled();
471
    checkDisabledAndEnabledViaScriptState();
472
473
    if (m_sheet)
474
        return m_sheet->disabled();
475
476
    // FF disagrees with the spec and always has an associated stylesheet if the 'rel' attribute indicates a
477
    // stylesheet and href is provided (regardless of whether the resource may be in error). As we store the
478
    // enabled state in m_isEnabledViaScript while loading, return this information to be consistent with FF
479
    // and our future self here.
480
    if (isLoading() && m_isEnabledViaScript != Unset)
481
        return m_isEnabledViaScript == Disabled;
482
483
    return false;
446
}
484
}
447
485
448
DOMSettableTokenList* HTMLLinkElement::sizes() const
486
DOMSettableTokenList* HTMLLinkElement::sizes() const
(-)a/Source/WebCore/html/HTMLLinkElement.h (-4 / +13 lines)
Lines 57-63 public: Link Here
57
57
58
    // FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
58
    // FIXME: This should be renamed isStyleSheetLoading as this is only used for stylesheets.
59
    bool isLoading() const;
59
    bool isLoading() const;
60
    bool isEnabledViaScript() const { return m_isEnabledViaScript; }
60
    bool isEnabledViaScript() const { checkDisabledAndEnabledViaScriptState(); return m_isEnabledViaScript == Enabled; }
61
    void setEnabledViaScript(bool enabled) { m_isEnabledViaScript = enabled ? Enabled : Disabled; }
61
    bool disabled() const;
62
    bool disabled() const;
62
    void setDisabled(bool);
63
    void setDisabled(bool);
63
    void setSizes(const String&);
64
    void setSizes(const String&);
Lines 85-91 private: Link Here
85
    
86
    
86
    virtual bool isURLAttribute(Attribute*) const;
87
    virtual bool isURLAttribute(Attribute*) const;
87
88
88
private:
89
    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
89
    virtual void addSubresourceAttributeURLs(ListHashSet<KURL>&) const;
90
90
91
    virtual void finishParsingChildren();
91
    virtual void finishParsingChildren();
Lines 94-99 private: Link Here
94
    void addPendingSheet(PendingSheetType);
94
    void addPendingSheet(PendingSheetType);
95
    void removePendingSheet();
95
    void removePendingSheet();
96
96
97
    void checkDisabledAndEnabledViaScriptState() const
98
    {
99
        // When we are loading, m_isEnabledViaScript stores the information if JS calls us and can thus have any value.
100
        // If m_isEnabledViaScript is Unset, the style sheet may be unabled or disabled.
101
        // Finally if we are not in the 2 previous cases, then JS should override our disabled value so we must make sure
102
        // that both values match.
103
        ASSERT(isLoading() || m_isEnabledViaScript == Unset || ((m_isEnabledViaScript == Disabled && sheet()->disabled()) || (m_isEnabledViaScript == Enabled && !sheet()->disabled())));
104
    }
97
private:
105
private:
98
    HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser);
106
    HTMLLinkElement(const QualifiedName&, Document*, bool createdByParser);
99
107
Lines 106-115 private: Link Here
106
    RefPtr<DOMSettableTokenList> m_sizes;
114
    RefPtr<DOMSettableTokenList> m_sizes;
107
    LinkRelAttribute m_relAttribute;
115
    LinkRelAttribute m_relAttribute;
108
    bool m_loading;
116
    bool m_loading;
109
    bool m_isEnabledViaScript;
117
    enum EnabledViaScriptState { Unset, Enabled, Disabled };
118
    EnabledViaScriptState m_isEnabledViaScript;
110
    bool m_createdByParser;
119
    bool m_createdByParser;
111
    bool m_isInShadowTree;
120
    bool m_isInShadowTree;
112
    
121
113
    PendingSheetType m_pendingSheetType;
122
    PendingSheetType m_pendingSheetType;
114
};
123
};
115
124

Return to bug 65140