Changeset 30127 in webkit


Ignore:
Timestamp:
Feb 10, 2008 2:30:04 PM (16 years ago)
Author:
hyatt@apple.com
Message:

Fix for bug 17253. <iframe> contents need to be reflected into the DOM as a single text node.

Reviewed by olliej

fast/frames/iframe-text-contents.html

  • html/HTMLParser.cpp: (WebCore::HTMLParser::getNode):
  • html/HTMLTokenizer.cpp: (WebCore::HTMLTokenizer::parseSpecial): (WebCore::HTMLTokenizer::parseComment): (WebCore::HTMLTokenizer::parseTag):
  • html/HTMLTokenizer.h: (WebCore::HTMLTokenizer::State::inIFrame): (WebCore::HTMLTokenizer::State::setInIFrame): (WebCore::HTMLTokenizer::State::inAnySpecial): (WebCore::HTMLTokenizer::State::needsSpecialWriteHandling): (WebCore::HTMLTokenizer::State::):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r30123 r30127  
     12008-02-10  David Hyatt  <hyatt@apple.com>
     2
     3        Fix for bug 17253.  <iframe> contents need to be reflected into the DOM as a single text node.
     4
     5        Reviewed by olliej
     6
     7        fast/frames/iframe-text-contents.html
     8
     9        * html/HTMLParser.cpp:
     10        (WebCore::HTMLParser::getNode):
     11        * html/HTMLTokenizer.cpp:
     12        (WebCore::HTMLTokenizer::parseSpecial):
     13        (WebCore::HTMLTokenizer::parseComment):
     14        (WebCore::HTMLTokenizer::parseTag):
     15        * html/HTMLTokenizer.h:
     16        (WebCore::HTMLTokenizer::State::inIFrame):
     17        (WebCore::HTMLTokenizer::State::setInIFrame):
     18        (WebCore::HTMLTokenizer::State::inAnySpecial):
     19        (WebCore::HTMLTokenizer::State::needsSpecialWriteHandling):
     20        (WebCore::HTMLTokenizer::State::):
     21
    1222008-02-10  Andrew Wellington  <proton@wiretapped.net>
    223
  • trunk/WebCore/html/HTMLParser.cpp

    r30112 r30127  
    678678}
    679679
    680 bool HTMLParser::iframeCreateErrorCheck(Token* t, RefPtr<Node>& result)
    681 {
    682     // a bit of a special case, since the frame is inlined
    683     setSkipMode(iframeTag);
    684     return true;
    685 }
    686 
    687680bool HTMLParser::formCreateErrorCheck(Token* t, RefPtr<Node>& result)
    688681{
     
    799792        gFunctionMap.set(headTag.localName().impl(), &HTMLParser::headCreateErrorCheck);
    800793        gFunctionMap.set(iTag.localName().impl(), &HTMLParser::nestedStyleCreateErrorCheck);
    801         gFunctionMap.set(iframeTag.localName().impl(), &HTMLParser::iframeCreateErrorCheck);
    802794        gFunctionMap.set(isindexTag.localName().impl(), &HTMLParser::isindexCreateErrorCheck);
    803795        gFunctionMap.set(liTag.localName().impl(), &HTMLParser::nestedCreateErrorCheck);
  • trunk/WebCore/html/HTMLTokenizer.cpp

    r30050 r30127  
    8686static const char textareaEnd [] = "</textarea";
    8787static const char titleEnd [] = "</title";
     88static const char iframeEnd [] = "</iframe";
    8889
    8990// Full support for MS Windows extensions to Latin-1.
     
    293294HTMLTokenizer::State HTMLTokenizer::parseSpecial(SegmentedString &src, State state)
    294295{
    295     ASSERT(state.inTextArea() || state.inTitle() || !state.hasEntityState());
     296    ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState());
    296297    ASSERT(!state.hasTagState());
    297     ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() == 1 );
     298    ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1 );
    298299    if (state.inScript())
    299300        scriptStartLineno = m_lineNumber;
     
    333334                    currToken.tagName = xmpTag.localName();
    334335                    currToken.beginTag = false;
     336                } else if (state.inIFrame()) {
     337                    currToken.tagName = iframeTag.localName();
     338                    currToken.beginTag = false;
    335339                }
    336340                processToken();
     
    340344                state.setInTitle(false);
    341345                state.setInXmp(false);
     346                state.setInIFrame(false);
    342347                tquote = NoQuote;
    343348                scriptCodeSize = scriptCodeResync = 0;
     
    362367        }
    363368        state.setEscaped(!state.escaped() && ch == '\\');
    364         if (!scriptCodeResync && (state.inTextArea() || state.inTitle()) && !src.escaped() && ch == '&') {
     369        if (!scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') {
    365370            UChar* scriptCodeDest = scriptCode+scriptCodeSize;
    366371            src.advancePastNonNewline();
     
    579584            if (handleBrokenComments || endCharsCount > 1) {
    580585                src.advancePastNonNewline();
    581                 if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle())) {
     586                if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) {
    582587                    checkScriptBuffer();
    583588                    scriptCode[scriptCodeSize] = 0;
     
    12871292                        state = parseSpecial(src, state);
    12881293                    }
     1294                } else if (tagName == iframeTag) {
     1295                    if (beginTag) {
     1296                        searchStopper = iframeEnd;
     1297                        searchStopperLen = 8;
     1298                        state.setInIFrame(true);
     1299                        state = parseSpecial(src, state);
     1300                    }
    12891301                }
    12901302            }
  • trunk/WebCore/html/HTMLTokenizer.h

    r29805 r30127  
    213213        bool inTitle() const { return testBit(InTitle); }
    214214        void setInTitle(bool v) { setBit(InTitle, v); }
     215        bool inIFrame() const { return testBit(InIFrame); }
     216        void setInIFrame(bool v) { setBit(InIFrame, v); }
    215217        bool inPlainText() const { return testBit(InPlainText); }
    216218        void setInPlainText(bool v) { setBit(InPlainText, v); }
     
    238240        void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); }
    239241
    240         bool inAnySpecial() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle); }
     242        bool inAnySpecial() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame); }
    241243        bool hasTagState() const { return m_bits & TagMask; }
    242244        bool hasEntityState() const { return m_bits & EntityMask; }
    243245
    244         bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | TagMask | EntityMask | InPlainText | InComment | InServer | InProcessingInstruction | StartTag); }
     246        bool needsSpecialWriteHandling() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle | InIFrame | TagMask | EntityMask | InPlainText | InComment | InServer | InProcessingInstruction | StartTag); }
    245247
    246248    private:
     
    265267            AllowYield = 1 << 21,
    266268            LoadingExtScript = 1 << 22,
    267             ForceSynchronous = 1 << 23
     269            ForceSynchronous = 1 << 23,
     270            InIFrame = 1 << 24
    268271        };
    269272
Note: See TracChangeset for help on using the changeset viewer.