Changeset 38816 in webkit


Ignore:
Timestamp:
Nov 26, 2008 9:07:45 PM (15 years ago)
Author:
Nikolas Zimmermann
Message:

Reviewed by George Staikos.

Fixes: https://bugs.webkit.org/show_bug.cgi?id=22522

Catch WML errors (invalid variable name/reference, multiple access elements, etc)
while parsing the document, and stop parsing immediately and wrap the document
fragment in a XHTML error document, just like it's done from XML parsing errors.

Until now all card elements were hidden by default (no renderer created), and
WMLDocument::finishedParsing() took care of showing the right card (either the first,
or any named card in the document, specified by document URL reference). Change this
behaviour to support displaying partially parsed WML document fragments: Mark the first
WMLCardElement inserted into the document as visible. If the document parsing finishes
without problems, WMLDocument::finishedParsing() will be called, which takes care of
showing the desired card (common case: first card in the document, which is already
visible, so nothing actually has to be done). If an error occours, the document is
correctly rendered until the error happened - wrapped in a XHTML document.

Fixes: fast/wml/err-event-binding-conflict.wml

fast/wml/err-invalid-variable-name.wml
fast/wml/err-multi-access.wml
fast/wml/err-unallowed-task-in-anchor.wml

Location:
trunk
Files:
2 added
29 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r38815 r38816  
     12008-11-26  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
     2
     3        Reviewed by George Staikos.
     4
     5        Fixes: https://bugs.webkit.org/show_bug.cgi?id=22522
     6
     7        Catch WML errors (invalid variable name/reference, multiple access elements, etc)
     8        while parsing the document, and stop parsing immediately and wrap the document
     9        fragment in a XHTML error document, just like it's done from XML parsing errors.
     10
     11        Update affected layout tests (all fixed).
     12
     13        * platform/mac/fast/wml/do-shadow-expected.txt:
     14        * platform/mac/fast/wml/do-template-expected.txt:
     15        * platform/mac/fast/wml/err-event-binding-conflict-expected.checksum:
     16        * platform/mac/fast/wml/err-event-binding-conflict-expected.png:
     17        * platform/mac/fast/wml/err-event-binding-conflict-expected.txt:
     18        * platform/mac/fast/wml/err-invalid-variable-name-expected.checksum:
     19        * platform/mac/fast/wml/err-invalid-variable-name-expected.png:
     20        * platform/mac/fast/wml/err-invalid-variable-name-expected.txt:
     21        * platform/mac/fast/wml/err-multi-access-expected.checksum:
     22        * platform/mac/fast/wml/err-multi-access-expected.png:
     23        * platform/mac/fast/wml/err-multi-access-expected.txt:
     24        * platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.checksum:
     25        * platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.png:
     26        * platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.txt:
     27
    1282008-11-26  Nikolas Zimmermann  <zimmermann@kde.org>
    229
  • trunk/LayoutTests/platform/mac/fast/wml/do-shadow-expected.txt

    r38736 r38816  
    2727          RenderText {#text} at (0,0) size 0x0
    2828        RenderText {#text} at (0,0) size 0x0
    29     RenderBlock (anonymous) at (0,110) size 800x0
    30       RenderText {#text} at (0,0) size 0x0
    31       RenderText {#text} at (0,0) size 0x0
    32       RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/wml/do-template-expected.txt

    r38736 r38816  
    2727          RenderText {#text} at (0,0) size 75x18
    2828            text run at (0,0) width 75: "Go to card2"
    29     RenderBlock (anonymous) at (0,152) size 800x0
    30       RenderText {#text} at (0,0) size 0x0
    31       RenderText {#text} at (0,0) size 0x0
    32       RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.checksum

    r38577 r38816  
    1 6f780541d5c1d3eb12cf50cf3a519ebc
     12618d52c86b6b9544a6bfc0e1dc3deaa
  • trunk/LayoutTests/platform/mac/fast/wml/err-event-binding-conflict-expected.txt

    r38577 r38816  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x76
    4   RenderBlock {wml} at (0,0) size 800x76
    5     RenderBlock {card} at (8,16) size 784x52
    6       RenderBlock (anonymous) at (0,0) size 784x0
    7         RenderInline {onevent} at (0,0) size 0x0
     3layer at (0,0) size 800x166
     4  RenderBlock {html} at (0,0) size 800x166
     5    RenderBody {body} at (8,16) size 784x134
     6      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 716x22
     8          RenderText {#text} at (0,0) size 324x22
     9            text run at (0,0) width 324: "This page contains the following errors:"
     10        RenderBlock {div} at (18,60) size 716x14
     11          RenderText {#text} at (0,0) size 525x14
     12            text run at (0,0) width 525: "error on line 9 at column 61: Conflicting event bindings within an element."
     13        RenderBlock {h3} at (18,92) size 716x22
     14          RenderText {#text} at (0,0) size 429x22
     15            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
     16      RenderBlock (anonymous) at (0,150) size 784x0
     17        RenderInline {wml} at (0,0) size 0x0
    818          RenderText {#text} at (0,0) size 0x0
    9           RenderInline {refresh} at (0,0) size 0x0
     19      RenderBlock (anonymous) at (0,150) size 784x0
     20        RenderBlock {card} at (8,0) size 768x0
     21          RenderInline {onevent} at (0,0) size 0x0
     22            RenderText {#text} at (0,0) size 0x0
     23            RenderInline {refresh} at (0,0) size 0x0
     24            RenderText {#text} at (0,0) size 0x0
    1025          RenderText {#text} at (0,0) size 0x0
    11         RenderText {#text} at (0,0) size 0x0
    12         RenderInline {onevent} at (0,0) size 0x0
    13           RenderText {#text} at (0,0) size 0x0
    14           RenderInline {prev} at (0,0) size 0x0
    15           RenderText {#text} at (0,0) size 0x0
    16         RenderText {#text} at (0,0) size 0x0
    17       RenderBlock {p} at (0,0) size 784x18
    18         RenderText {#text} at (0,0) size 248x18
    19           text run at (0,0) width 248: "Test for the error event-binding conflict"
    20       RenderBlock (anonymous) at (0,34) size 784x18
    21         RenderText {#text} at (0,0) size 563x18
    22           text run at (0,0) width 563: "You should NOT see this text, because of the error of event-binding error in card element"
     26          RenderInline {onevent} at (0,0) size 0x0
     27            RenderText {#text} at (0,0) size 0x0
     28            RenderInline {prev} at (0,0) size 0x0
     29      RenderBlock (anonymous) at (0,150) size 784x0
     30        RenderInline {wml} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.checksum

    r38577 r38816  
    1 131183d1b978afcf6c978cd9465251d8
     1c82466655925da8da5243041ef093570
  • trunk/LayoutTests/platform/mac/fast/wml/err-invalid-variable-name-expected.txt

    r38577 r38816  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x50
    4   RenderBlock {wml} at (0,0) size 800x50
    5     RenderBlock {card} at (8,16) size 784x18
    6       RenderBlock {p} at (0,0) size 784x18
    7         RenderText {#text} at (0,0) size 207x18
    8           text run at (0,0) width 207: "Test for variable name validation"
    9       RenderBlock (anonymous) at (0,34) size 784x0
    10         RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
     3layer at (0,0) size 800x200
     4  RenderBlock {html} at (0,0) size 800x200
     5    RenderBody {body} at (8,16) size 784x168
     6      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 716x22
     8          RenderText {#text} at (0,0) size 324x22
     9            text run at (0,0) width 324: "This page contains the following errors:"
     10        RenderBlock {div} at (18,60) size 716x14
     11          RenderText {#text} at (0,0) size 525x14
     12            text run at (0,0) width 525: "error on line 10 at column 68: A variable name contains invalid characters."
     13        RenderBlock {h3} at (18,92) size 716x22
     14          RenderText {#text} at (0,0) size 429x22
     15            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
     16      RenderBlock (anonymous) at (0,150) size 784x0
     17        RenderInline {wml} at (0,0) size 0x0
    1118          RenderText {#text} at (0,0) size 0x0
    12           RenderInline {refresh} at (0,0) size 0x0
    13             RenderText {#text} at (0,0) size 0x0
    14             RenderInline {setvar} at (0,0) size 0x0
    15             RenderText {#text} at (0,0) size 0x0
    16           RenderText {#text} at (0,0) size 0x0
    17         RenderText {#text} at (0,0) size 0x0
     19      RenderBlock (anonymous) at (0,150) size 784x18
     20        RenderBlock {card} at (8,0) size 768x18
     21          RenderBlock {p} at (0,0) size 768x18
     22            RenderText {#text} at (0,0) size 207x18
     23              text run at (0,0) width 207: "Test for variable name validation"
     24          RenderBlock (anonymous) at (0,34) size 768x0
     25            RenderInline {do} at (0,0) size 0x0 [bgcolor=#D3D3D3]
     26              RenderText {#text} at (0,0) size 0x0
     27              RenderInline {refresh} at (0,0) size 0x0
     28                RenderText {#text} at (0,0) size 0x0
     29                RenderInline {setvar} at (0,0) size 0x0
     30      RenderBlock (anonymous) at (0,184) size 784x0
     31        RenderInline {wml} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.checksum

    r38577 r38816  
    1 977525a2b91990cd4954ff442f8e862d
     1dd59cde7038b906d636611d411cc3616
  • trunk/LayoutTests/platform/mac/fast/wml/err-multi-access-expected.txt

    r38577 r38816  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x76
    4   RenderBlock {wml} at (0,0) size 800x76
    5     RenderBlock {card} at (8,16) size 784x52
    6       RenderBlock {p} at (0,0) size 784x18
    7         RenderText {#text} at (0,0) size 164x18
    8           text run at (0,0) width 164: "Test for multi-access error"
    9       RenderBlock (anonymous) at (0,34) size 784x18
    10         RenderText {#text} at (0,0) size 508x18
    11           text run at (0,0) width 508: "You should not see this text, because of the error of multi-access in head element"
     3layer at (0,0) size 800x166
     4  RenderBlock {html} at (0,0) size 800x166
     5    RenderBody {body} at (8,16) size 784x134
     6      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 716x22
     8          RenderText {#text} at (0,0) size 324x22
     9            text run at (0,0) width 324: "This page contains the following errors:"
     10        RenderBlock {div} at (18,60) size 716x14
     11          RenderText {#text} at (0,0) size 525x14
     12            text run at (0,0) width 525: "error on line 6 at column 52: Only one access element is allowed in a deck."
     13        RenderBlock {h3} at (18,92) size 716x22
     14          RenderText {#text} at (0,0) size 429x22
     15            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
     16      RenderBlock (anonymous) at (0,150) size 784x0
     17        RenderInline {wml} at (0,0) size 0x0
     18          RenderText {#text} at (0,0) size 0x0
  • trunk/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.checksum

    r38577 r38816  
    1 7fb8b89b45160c5aa01ae5e48d8a9cbe
     1aa8d9127eb80040dcb92e8d29ffc1973
  • trunk/LayoutTests/platform/mac/fast/wml/err-unallowed-task-in-anchor-expected.txt

    r38736 r38816  
    11layer at (0,0) size 800x600
    22  RenderView at (0,0) size 800x600
    3 layer at (0,0) size 800x76
    4   RenderBlock {wml} at (0,0) size 800x76
    5     RenderBlock {card} at (8,16) size 784x52
    6       RenderBlock (anonymous) at (0,0) size 784x0
    7         RenderInline {anchor} at (0,0) size 0x0 [color=#0000EE]
     3layer at (0,0) size 800x166
     4  RenderBlock {html} at (0,0) size 800x166
     5    RenderBody {body} at (8,16) size 784x134
     6      RenderBlock {parsererror} at (16,0) size 752x134 [bgcolor=#FFDDDD] [border: (2px solid #CC7777)]
     7        RenderBlock {h3} at (18,20) size 716x22
     8          RenderText {#text} at (0,0) size 324x22
     9            text run at (0,0) width 324: "This page contains the following errors:"
     10        RenderBlock {div} at (18,60) size 716x14
     11          RenderText {#text} at (0,0) size 511x14
     12            text run at (0,0) width 511: "error on line 6 at column 28: Forbidden task contained in anchor element."
     13        RenderBlock {h3} at (18,92) size 716x22
     14          RenderText {#text} at (0,0) size 429x22
     15            text run at (0,0) width 429: "Below is a rendering of the page up to the first error."
     16      RenderBlock (anonymous) at (0,150) size 784x0
     17        RenderInline {wml} at (0,0) size 0x0
    818          RenderText {#text} at (0,0) size 0x0
    9           RenderInline {noop} at (0,0) size 0x0
    10           RenderText {#text} at (0,0) size 0x0
    11         RenderText {#text} at (0,0) size 0x0
    12       RenderBlock {p} at (0,0) size 784x18
    13         RenderText {#text} at (0,0) size 383x18
    14           text run at (0,0) width 383: "Test for the error that specifying noop task to anchor element"
    15       RenderBlock (anonymous) at (0,34) size 784x18
    16         RenderText {#text} at (0,0) size 632x18
    17           text run at (0,0) width 632: "You should NOT see this text, because of the error that specifying unallowed task to anchor element"
     19      RenderBlock (anonymous) at (0,150) size 784x0
     20        RenderBlock {card} at (8,0) size 768x0
     21          RenderInline {anchor} at (0,0) size 0x0 [color=#0000EE]
     22            RenderText {#text} at (0,0) size 0x0
     23            RenderInline {noop} at (0,0) size 0x0
     24      RenderBlock (anonymous) at (0,150) size 784x0
     25        RenderInline {wml} at (0,0) size 0x0
  • trunk/WebCore/ChangeLog

    r38806 r38816  
     12008-11-26  Nikolas Zimmermann  <nikolas.zimmermann@torchmobile.com>
     2
     3        Reviewed by George Staikos.
     4
     5        Fixes: https://bugs.webkit.org/show_bug.cgi?id=22522
     6
     7        Catch WML errors (invalid variable name/reference, multiple access elements, etc)
     8        while parsing the document, and stop parsing immediately and wrap the document
     9        fragment in a XHTML error document, just like it's done from XML parsing errors.
     10
     11        Until now all card elements were hidden by default (no renderer created), and
     12        WMLDocument::finishedParsing() took care of showing the right card (either the first,
     13        or any named card in the document, specified by document URL reference). Change this
     14        behaviour to support displaying partially parsed WML document fragments: Mark the first
     15        WMLCardElement inserted into the document as visible. If the document parsing finishes
     16        without problems, WMLDocument::finishedParsing() will be called, which takes care of
     17        showing the desired card (common case: first card in the document, which is already
     18        visible, so nothing actually has to be done). If an error occours, the document is
     19        correctly rendered until the error happened - wrapped in a XHTML document.
     20
     21        Fixes: fast/wml/err-event-binding-conflict.wml
     22               fast/wml/err-invalid-variable-name.wml
     23               fast/wml/err-multi-access.wml
     24               fast/wml/err-unallowed-task-in-anchor.wml
     25
     26        * WebCore.xcodeproj/project.pbxproj:
     27        * wml/WMLAccessElement.cpp:
     28        (WebCore::WMLAccessElement::parseMappedAttribute):
     29        (WebCore::WMLAccessElement::insertedIntoDocument):
     30        * wml/WMLAccessElement.h:
     31        * wml/WMLCardElement.cpp:
     32        (WebCore::WMLCardElement::insertedIntoDocument):
     33        (WebCore::WMLCardElement::setActiveCardInDocument):
     34        * wml/WMLCardElement.h:
     35        * wml/WMLDocument.cpp:
     36        (WebCore::WMLDocument::finishedParsing):
     37        * wml/WMLErrorHandling.cpp: Added.
     38        (WebCore::reportWMLError):
     39        * wml/WMLErrorHandling.h: Added.
     40        (WebCore::):
     41        * wml/WMLIntrinsicEventHandler.cpp:
     42        (WebCore::WMLIntrinsicEventHandler::registerIntrinsicEvent):
     43        * wml/WMLIntrinsicEventHandler.h:
     44        * wml/WMLNoopElement.cpp:
     45        (WebCore::WMLNoopElement::insertedIntoDocument):
     46        * wml/WMLOnEventElement.cpp:
     47        (WebCore::WMLOnEventElement::parseMappedAttribute):
     48        (WebCore::WMLOnEventElement::registerTask):
     49        * wml/WMLPageState.cpp:
     50        (WebCore::WMLPageState::setNeedCheckDeckAccess):
     51        * wml/WMLPageState.h:
     52        * wml/WMLSetvarElement.cpp:
     53        (WebCore::WMLSetvarElement::parseMappedAttribute):
     54
    1552008-11-10  Glenn Wilson  <gwilson@chromium.org>
    256
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r38792 r38816  
    8787                08CD61BC0ED3929C002DDF51 /* WMLTaskElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08CD61B80ED3929C002DDF51 /* WMLTaskElement.cpp */; };
    8888                08CD61BD0ED3929C002DDF51 /* WMLTaskElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 08CD61B90ED3929C002DDF51 /* WMLTaskElement.h */; };
     89                08E192530EDE0C3A0087B780 /* WMLErrorHandling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E192510EDE0C390087B780 /* WMLErrorHandling.cpp */; };
     90                08E192540EDE0C3A0087B780 /* WMLErrorHandling.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E192520EDE0C3A0087B780 /* WMLErrorHandling.h */; };
    8991                08E4FE460E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */; };
    9092                0A4844990CA44CB200B7BD48 /* SoftLinking.h in Headers */ = {isa = PBXBuildFile; fileRef = 0A4844980CA44CB200B7BD48 /* SoftLinking.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    48454847                08CD61B80ED3929C002DDF51 /* WMLTaskElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLTaskElement.cpp; sourceTree = "<group>"; };
    48464848                08CD61B90ED3929C002DDF51 /* WMLTaskElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLTaskElement.h; sourceTree = "<group>"; };
     4849                08E192510EDE0C390087B780 /* WMLErrorHandling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLErrorHandling.cpp; sourceTree = "<group>"; };
     4850                08E192520EDE0C3A0087B780 /* WMLErrorHandling.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WMLErrorHandling.h; sourceTree = "<group>"; };
    48474851                08E4FE450E2BD41400F4CAE0 /* JSSVGLengthCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSVGLengthCustom.cpp; sourceTree = "<group>"; };
    48484852                08FB84B00ECE373300DC064E /* WMLElementFactory.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WMLElementFactory.cpp; sourceTree = "<group>"; };
     
    95229526                                4C6B99250E52E37300487BB7 /* WMLElement.cpp */,
    95239527                                4C6B99260E52E37300487BB7 /* WMLElement.h */,
     9528                                08E192510EDE0C390087B780 /* WMLErrorHandling.cpp */,
     9529                                08E192520EDE0C3A0087B780 /* WMLErrorHandling.h */,
    95249530                                0818AEE00EDB86BC00647B66 /* WMLEventHandlingElement.cpp */,
    95259531                                0818AEE10EDB86BC00647B66 /* WMLEventHandlingElement.h */,
     
    1643916445                                0818AEE30EDB86BC00647B66 /* WMLEventHandlingElement.h in Headers */,
    1644016446                                0865CCE70EDDF51B00DF9EC3 /* WMLNoopElement.h in Headers */,
     16447                                08E192540EDE0C3A0087B780 /* WMLErrorHandling.h in Headers */,
    1644116448                        );
    1644216449                        runOnlyForDeploymentPostprocessing = 0;
     
    1837518382                                0818AEE20EDB86BC00647B66 /* WMLEventHandlingElement.cpp in Sources */,
    1837618383                                0865CCE60EDDF51B00DF9EC3 /* WMLNoopElement.cpp in Sources */,
     18384                                08E192530EDE0C3A0087B780 /* WMLErrorHandling.cpp in Sources */,
    1837718385                        );
    1837818386                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebCore/wml/WMLAccessElement.cpp

    r38743 r38816  
    2525#include "WMLAccessElement.h"
    2626
     27#include "WMLErrorHandling.h"
    2728#include "WMLDocument.h"
    2829#include "WMLNames.h"
     
    4445        const AtomicString& value = attr->value();
    4546        if (containsVariableReference(value)) {
    46             // FIXME: Error rerporting
    47             // WMLHelper::tokenizer()->reportError(InvalidVariableReferenceError);
     47            reportWMLError(document(), WMLErrorInvalidVariableReference);
    4848            return;
    4949        }
     
    5454        const AtomicString& value = attr->value();
    5555        if (containsVariableReference(value)) {
    56             // FIXME: Error reporting
    57             // WMLHelper::tokenizer()->reportError(InvalidVariableReferenceError);
     56            reportWMLError(document(), WMLErrorInvalidVariableReference);
    5857            return;
    5958        }
     
    6564}
    6665
     66void WMLAccessElement::insertedIntoDocument()
     67{
     68    WMLElement::insertedIntoDocument();
     69
     70    WMLPageState* pageState = wmlPageStateForDocument(document());
     71    if (pageState && !pageState->setNeedCheckDeckAccess(true))
     72        reportWMLError(document(), WMLErrorMultipleAccessElements);
     73}
     74
    6775}
    6876
  • trunk/WebCore/wml/WMLAccessElement.h

    r38733 r38816  
    3333
    3434    virtual void parseMappedAttribute(MappedAttribute*);
     35    virtual void insertedIntoDocument();
    3536};
    3637
  • trunk/WebCore/wml/WMLCardElement.cpp

    r38773 r38816  
    4545}
    4646
     47void WMLCardElement::insertedIntoDocument()
     48{
     49    WMLEventHandlingElement::insertedIntoDocument();
     50
     51    // The first card inserted into a document, is visible by default.
     52    if (!m_isVisible) {
     53        RefPtr<NodeList> nodeList = document()->getElementsByTagName("card");
     54        if (nodeList && nodeList->length() == 1 && nodeList->item(0) == this)
     55            m_isVisible = true;
     56    }
     57}
     58
    4759RenderObject* WMLCardElement::createRenderer(RenderArena* arena, RenderStyle* style)
    4860{
     
    6981        return 0;
    7082
    71     // Hide all cards in document
    72     for (unsigned i = 0; i < length; ++i) {
    73         WMLCardElement* card = static_cast<WMLCardElement*>(nodeList->item(i));
    74 
    75         // Only need to recalculate the card style if the card was visible
    76         // before otherwhise we have no associated RenderObject anyway
    77         if (card->isVisible())
    78             card->setChanged();
    79 
    80         card->setVisible(false);
    81     }
    82 
    8383    // Figure out the new target card
    8484    WMLCardElement* activeCard = 0;
     
    103103    }
    104104
    105     // Show active card
    106     if (!activeCard)
     105    if (activeCard) {
     106        // Hide all cards - except the destination card - in document
     107        for (unsigned i = 0; i < length; ++i) {
     108            WMLCardElement* card = static_cast<WMLCardElement*>(nodeList->item(i));
     109            bool cardShouldBeVisible = (card == activeCard);
     110
     111            if (cardShouldBeVisible && !card->isVisible()) {
     112                card->setChanged();
     113                card->setVisible(true);
     114            } else if (!cardShouldBeVisible && card->isVisible()) {
     115                card->setChanged();
     116                card->setVisible(false);
     117            }
     118        }
     119    } else {
     120        // The first card should already be visible.
    107121        activeCard = static_cast<WMLCardElement*>(nodeList->item(0));
    108 
    109     activeCard->setChanged();
    110     activeCard->setVisible(true);
     122        ASSERT(activeCard->isVisible());
     123    }
    111124
    112125    // Update the document title
  • trunk/WebCore/wml/WMLCardElement.h

    r38773 r38816  
    3333    virtual ~WMLCardElement();
    3434
     35    virtual void insertedIntoDocument();
    3536    virtual RenderObject* createRenderer(RenderArena*, RenderStyle*);
    3637
  • trunk/WebCore/wml/WMLDocument.cpp

    r38743 r38816  
    2727#include "Page.h"
    2828#include "WMLCardElement.h"
     29#include "WMLErrorHandling.h"
    2930#include "WMLPageState.h"
    3031
     
    5354    WMLPageState* wmlPageState = wmlPageStateForDocument(document());
    5455    if (!wmlPageState || !wmlPageState->isDeckAccessible()) {
    55         // FIXME: Error reporting
     56        reportWMLError(document(), WMLErrorDeckNotAccessible);
    5657        Document::finishedParsing();
    5758        return;
     
    6465    WMLCardElement* card = WMLCardElement::setActiveCardInDocument(document(), KURL());
    6566    if (!card) {
    66         // FIXME: Error reporting
     67        reportWMLError(document(), WMLErrorNoCardInDocument);
    6768        Document::finishedParsing();
    6869        return;
  • trunk/WebCore/wml/WMLIntrinsicEventHandler.cpp

    r38744 r38816  
    3131}
    3232
    33 void WMLIntrinsicEventHandler::registerIntrinsicEvent(WMLIntrinsicEventType type, PassRefPtr<WMLIntrinsicEvent> event)
     33bool WMLIntrinsicEventHandler::registerIntrinsicEvent(WMLIntrinsicEventType type, PassRefPtr<WMLIntrinsicEvent> event)
    3434{
    35     if (m_events.contains(type)) {
    36         // FIXME: error reporting
    37         // WMLHelper::tokenizer()->reportError(ConflictingEventBindingError);
    38         return;
    39     }
     35    if (m_events.contains(type))
     36        return false;
    4037
    4138    m_events.set(type, event);
     39    return true;
    4240}
    4341
  • trunk/WebCore/wml/WMLIntrinsicEventHandler.h

    r38744 r38816  
    4545    WMLIntrinsicEventHandler();
    4646
    47     void registerIntrinsicEvent(WMLIntrinsicEventType, PassRefPtr<WMLIntrinsicEvent>);
     47    bool registerIntrinsicEvent(WMLIntrinsicEventType, PassRefPtr<WMLIntrinsicEvent>);
    4848    void triggerIntrinsicEvent(WMLIntrinsicEventType) const;
    4949    bool hasIntrinsicEvent(WMLIntrinsicEventType) const;
  • trunk/WebCore/wml/WMLNoopElement.cpp

    r38792 r38816  
    2525#include "WMLNoopElement.h"
    2626
     27#include "WMLErrorHandling.h"
    2728#include "WMLNames.h"
    2829
     
    5455    */
    5556
    56     if (parent->hasTagName(anchorTag)) {
    57         // FIXME: Error reporting   
    58         // WMLHelper::tokenizer()->reportError(WrongTaskInAnchorElementError);
    59     }
     57    if (parent->hasTagName(anchorTag))
     58        reportWMLError(document(), WMLErrorForbiddenTaskInAnchorElement);
    6059}
    6160
  • trunk/WebCore/wml/WMLOnEventElement.cpp

    r38775 r38816  
    2626
    2727#include "HTMLNames.h"
     28#include "WMLErrorHandling.h"
    2829#include "WMLEventHandlingElement.h"
    2930#include "WMLIntrinsicEventHandler.h"
     
    4647        const AtomicString& value = attr->value();
    4748        if (containsVariableReference(value)) {
    48             // FIXME: error reporting
    49             // WMLHelper::tokenizer()->reportError(InvalidVariableReferenceError);
     49            reportWMLError(document(), WMLErrorInvalidVariableReference);
    5050            return;
    5151        }
     
    8383
    8484    RefPtr<WMLIntrinsicEvent> event = WMLIntrinsicEvent::createWithTask(task);
    85     eventHandlingElement->eventHandler()->registerIntrinsicEvent(m_type, event);
     85    if (!eventHandlingElement->eventHandler()->registerIntrinsicEvent(m_type, event))
     86        reportWMLError(document(), WMLErrorConflictingEventBinding);
    8687}
    8788
  • trunk/WebCore/wml/WMLPageState.cpp

    r38790 r38816  
    5959}
    6060
    61 void WMLPageState::setNeedCheckDeckAccess(bool need)
     61bool WMLPageState::setNeedCheckDeckAccess(bool need)
    6262{
    63     if (m_hasDeckAccess && need) {
    64         // FIXME: Report MultiAccessElementsError
    65     } else {
    66         m_hasDeckAccess = need;
    67         m_accessPath = String();
    68         m_accessDomain = String();
    69     }
     63    if (m_hasDeckAccess && need)
     64        return false;
     65
     66    m_hasDeckAccess = need;
     67    m_accessPath = String();
     68    m_accessDomain = String();
     69    return true;
    7070}
    7171
  • trunk/WebCore/wml/WMLPageState.h

    r38734 r38816  
    6464    bool hasDeckAccess() const { return m_hasDeckAccess; }
    6565 
    66     void setNeedCheckDeckAccess(bool);
     66    bool setNeedCheckDeckAccess(bool);
    6767    bool isDeckAccessible();
    6868
  • trunk/WebCore/wml/WMLSetvarElement.cpp

    r38773 r38816  
    2626
    2727#include "HTMLNames.h"
     28#include "WMLErrorHandling.h"
    2829#include "WMLTaskElement.h"
    2930#include "WMLVariables.h"
     
    5455        if (isValid)
    5556            m_name = name;
    56         else {
    57             // FIXME: Error reporting
    58             // WMLHelper::tokenizer()->reportError(InvalidVariableNameError);
    59         }
     57        else
     58            reportWMLError(document(), WMLErrorInvalidVariableName);
    6059    } else if (attr->name() == HTMLNames::valueAttr)
    6160        m_value = substituteVariableReferences(attr->value(), document());
Note: See TracChangeset for help on using the changeset viewer.