Changeset 38327 in webkit
- Timestamp:
- Nov 11, 2008 5:53:37 PM (15 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r38321 r38327 1 2008-11-11 Eric Seidel <eric@webkit.org> 2 3 Reviewed by Antti Koivisto and Sam Weinig. 4 5 Clean up HTMLTokenizer a litle 6 https://bugs.webkit.org/show_bug.cgi?id=22188 7 8 Rename pendingScripts to m_pendingScripts 9 Rename scriptNode to m_scriptNode make the type specific 10 Rename pendingSrc to m_pendingSrc 11 Rename currentPrependingSrc to m_currentPrependingSrc 12 Rename noMoreData to m_noMoreData and cBuffer to m_cBuffer 13 Remove long-since-dead kdDebug and qDebug calls 14 Rename brokenComments to m_brokenComments 15 Remove HTMLTokenizer includes and document the rest 16 Rename src to m_src 17 Rename parser to m_parser and make it an OwnPtr 18 Rename inWrite to m_inWrite and jsProxy to scriptController 19 Rename brokenServer to m_brokenServer 20 Rename buffer to m_buffer and dest to m_dest 21 Rename size to m_bufferSize 22 Rename attrName to m_attrName 23 Rename searchStopper to m_searchStopper and searchStopperLen to m_searchStopperLen 24 Rename scriptCode* to m_scriptCode* and change scriptCodeMax to m_scriptCodeCapacity 25 Rename scriptStartLineno to m_currentScriptTagStartLineNumber and tagStartLineno to m_currentTagStartLineNumber 26 Rename scriptSrc to m_scriptTagSrcAttrValue and scriptSrcCharset to m_scriptTagCharsetAttrValue -- a bit unwieldy, but more precise 27 Rename flat to selfClosingTag 28 Rename currToken to m_currentToken 29 30 * css/CSSParser.cpp: 31 * dom/XMLTokenizer.cpp: 32 * dom/XMLTokenizerLibxml2.cpp: 33 * html/HTMLDocument.cpp: 34 * html/HTMLElement.cpp: 35 * html/HTMLFormControlElement.cpp: 36 * html/HTMLParser.h: 37 * html/HTMLTokenizer.cpp: 38 (WebCore::Token::addAttribute): 39 (WebCore::HTMLTokenizer::HTMLTokenizer): 40 (WebCore::HTMLTokenizer::reset): 41 (WebCore::HTMLTokenizer::begin): 42 (WebCore::HTMLTokenizer::processListing): 43 (WebCore::HTMLTokenizer::parseSpecial): 44 (WebCore::HTMLTokenizer::scriptHandler): 45 (WebCore::HTMLTokenizer::scriptExecution): 46 (WebCore::HTMLTokenizer::parseComment): 47 (WebCore::HTMLTokenizer::parseServer): 48 (WebCore::HTMLTokenizer::parseProcessingInstruction): 49 (WebCore::HTMLTokenizer::parseText): 50 (WebCore::HTMLTokenizer::parseEntity): 51 (WebCore::HTMLTokenizer::parseTag): 52 (WebCore::HTMLTokenizer::write): 53 (WebCore::HTMLTokenizer::processingData): 54 (WebCore::HTMLTokenizer::end): 55 (WebCore::HTMLTokenizer::finish): 56 (WebCore::HTMLTokenizer::processToken): 57 (WebCore::HTMLTokenizer::processDoctypeToken): 58 (WebCore::HTMLTokenizer::~HTMLTokenizer): 59 (WebCore::HTMLTokenizer::enlargeBuffer): 60 (WebCore::HTMLTokenizer::enlargeScriptBuffer): 61 (WebCore::HTMLTokenizer::notifyFinished): 62 (WebCore::HTMLTokenizer::setSrc): 63 * html/HTMLTokenizer.h: 64 (WebCore::Token::Token): 65 (WebCore::Token::reset): 66 (WebCore::HTMLTokenizer::processingContentWrittenByScript): 67 (WebCore::HTMLTokenizer::htmlParser): 68 (WebCore::HTMLTokenizer::checkBuffer): 69 (WebCore::HTMLTokenizer::checkScriptBuffer): 70 * html/HTMLViewSourceDocument.h: 71 * rendering/RenderBlock.cpp: 72 (WebCore::RenderBlock::leftRelOffset): 73 (WebCore::RenderBlock::rightRelOffset): 74 (WebCore::RenderBlock::lineWidth): 75 * xml/XSLTProcessor.cpp: 76 1 77 2008-11-11 Sam Weinig <sam@webkit.org> 2 78 -
trunk/WebCore/css/CSSParser.cpp
r38117 r38327 4139 4139 } 4140 4140 4141 #ifdef CSS_DEBUG4142 4143 static inline int yyerror(const char *str)4144 {4145 kdDebug(6080) << "CSS parse error " << str << endl;4146 return 1;4147 }4148 4149 #else4150 4151 4141 static inline int yyerror(const char*) { return 1; } 4152 4153 #endif4154 4142 4155 4143 #define END_TOKEN 0 -
trunk/WebCore/dom/XMLTokenizer.cpp
r37061 r38327 41 41 #include "HTMLScriptElement.h" 42 42 #include "HTMLStyleElement.h" 43 #include "HTMLTokenizer.h"44 43 #include "ScriptController.h" 45 44 #include "ProcessingInstruction.h" -
trunk/WebCore/dom/XMLTokenizerLibxml2.cpp
r38094 r38327 39 39 #include "HTMLLinkElement.h" 40 40 #include "HTMLStyleElement.h" 41 #include "HTMLTokenizer.h" 41 #include "HTMLTokenizer.h" // for decodeNamedEntity 42 42 #include "ScriptController.h" 43 43 #include "ProcessingInstruction.h" -
trunk/WebCore/html/HTMLDocument.cpp
r34574 r38327 67 67 #include "FrameView.h" 68 68 #include "HTMLBodyElement.h" 69 #include "HTMLElement.h"70 69 #include "HTMLElementFactory.h" 71 70 #include "HTMLNames.h" -
trunk/WebCore/html/HTMLElement.cpp
r38207 r38327 37 37 #include "HTMLFormElement.h" 38 38 #include "HTMLNames.h" 39 #include "HTMLTokenizer.h" 39 #include "HTMLTokenizer.h" // parseHTMLDocumentFragment 40 40 #include "RenderWordBreak.h" 41 41 #include "Settings.h" -
trunk/WebCore/html/HTMLFormControlElement.cpp
r38094 r38327 36 36 #include "HTMLTokenizer.h" 37 37 #include "RenderTheme.h" 38 #include "Tokenizer.h"39 38 40 39 namespace WebCore { -
trunk/WebCore/html/HTMLParser.cpp
r38207 r38327 225 225 // split large blocks of text to nodes of manageable size 226 226 n = Text::createWithLengthLimit(document, text, charsLeft); 227 if (!insertNode(n.get(), t-> flat))227 if (!insertNode(n.get(), t->selfClosingTag)) 228 228 return 0; 229 229 } … … 255 255 } 256 256 257 if (!insertNode(n.get(), t-> flat)) {257 if (!insertNode(n.get(), t->selfClosingTag)) { 258 258 // we couldn't insert the node 259 259 … … 722 722 { 723 723 RefPtr<Node> n = handleIsindex(t); 724 if (!inBody) {724 if (!inBody) 725 725 m_isindexElement = n.release(); 726 }else {727 t-> flat= true;726 else { 727 t->selfClosingTag = true; 728 728 result = n.release(); 729 729 } -
trunk/WebCore/html/HTMLParser.h
r34507 r38327 40 40 class HTMLMapElement; 41 41 class Node; 42 class Token;43 42 44 43 struct HTMLStackElem; 44 struct Token; 45 45 46 46 /** -
trunk/WebCore/html/HTMLTokenizer.cpp
r38094 r38327 132 132 } 133 133 134 inline void Token::addAttribute(Document* doc, AtomicString& attrName, const AtomicString& v, bool viewSourceMode)134 inline void Token::addAttribute(Document* doc, AtomicString& attrName, const AtomicString& attributeValue, bool viewSourceMode) 135 135 { 136 136 if (!attrName.isEmpty()) { 137 137 ASSERT(!attrName.contains('/')); 138 RefPtr<MappedAttribute> a = MappedAttribute::create(attrName, v);138 RefPtr<MappedAttribute> a = MappedAttribute::create(attrName, attributeValue); 139 139 if (!attrs) { 140 140 attrs = NamedMappedAttrMap::create(); … … 151 151 HTMLTokenizer::HTMLTokenizer(HTMLDocument* doc, bool reportErrors) 152 152 : Tokenizer() 153 , buffer(0)154 , scriptCode(0)155 , scriptCodeSize(0)156 , scriptCodeMaxSize(0)157 , scriptCodeResync(0)153 , m_buffer(0) 154 , m_scriptCode(0) 155 , m_scriptCodeSize(0) 156 , m_scriptCodeCapacity(0) 157 , m_scriptCodeResync(0) 158 158 , m_executingScript(0) 159 159 , m_requestingScript(false) … … 161 161 , m_timer(this, &HTMLTokenizer::timerFired) 162 162 , m_doc(doc) 163 , parser(new HTMLParser(doc, reportErrors))164 , inWrite(false)163 , m_parser(new HTMLParser(doc, reportErrors)) 164 , m_inWrite(false) 165 165 , m_fragment(false) 166 166 { … … 170 170 HTMLTokenizer::HTMLTokenizer(HTMLViewSourceDocument* doc) 171 171 : Tokenizer(true) 172 , buffer(0)173 , scriptCode(0)174 , scriptCodeSize(0)175 , scriptCodeMaxSize(0)176 , scriptCodeResync(0)172 , m_buffer(0) 173 , m_scriptCode(0) 174 , m_scriptCodeSize(0) 175 , m_scriptCodeCapacity(0) 176 , m_scriptCodeResync(0) 177 177 , m_executingScript(0) 178 178 , m_requestingScript(false) … … 180 180 , m_timer(this, &HTMLTokenizer::timerFired) 181 181 , m_doc(doc) 182 , parser(0)183 , inWrite(false)182 , m_parser(0) 183 , m_inWrite(false) 184 184 , m_fragment(false) 185 185 { … … 188 188 189 189 HTMLTokenizer::HTMLTokenizer(DocumentFragment* frag) 190 : buffer(0)191 , scriptCode(0)192 , scriptCodeSize(0)193 , scriptCodeMaxSize(0)194 , scriptCodeResync(0)190 : m_buffer(0) 191 , m_scriptCode(0) 192 , m_scriptCodeSize(0) 193 , m_scriptCodeCapacity(0) 194 , m_scriptCodeResync(0) 195 195 , m_executingScript(0) 196 196 , m_requestingScript(false) … … 198 198 , m_timer(this, &HTMLTokenizer::timerFired) 199 199 , m_doc(frag->document()) 200 , inWrite(false) 200 , m_parser(new HTMLParser(frag)) 201 , m_inWrite(false) 201 202 , m_fragment(true) 202 203 { 203 parser = new HTMLParser(frag);204 204 begin(); 205 205 } … … 209 209 ASSERT(m_executingScript == 0); 210 210 211 while (! pendingScripts.isEmpty()) {212 CachedScript *cs =pendingScripts.first().get();213 pendingScripts.removeFirst();211 while (!m_pendingScripts.isEmpty()) { 212 CachedScript* cs = m_pendingScripts.first().get(); 213 m_pendingScripts.removeFirst(); 214 214 ASSERT(cache()->disabled() || cs->accessCount() > 0); 215 215 cs->removeClient(this); 216 216 } 217 218 fastFree( buffer);219 buffer =dest = 0;220 size = 0;221 222 fastFree( scriptCode);223 scriptCode = 0;224 scriptCodeSize = scriptCodeMaxSize =scriptCodeResync = 0;217 218 fastFree(m_buffer); 219 m_buffer = m_dest = 0; 220 m_bufferSize = 0; 221 222 fastFree(m_scriptCode); 223 m_scriptCode = 0; 224 m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; 225 225 226 226 m_timer.stop(); … … 228 228 m_state.setForceSynchronous(false); 229 229 230 currToken.reset();230 m_currentToken.reset(); 231 231 m_doctypeToken.reset(); 232 232 m_doctypeSearchCount = 0; … … 241 241 m_state.setLoadingExtScript(false); 242 242 reset(); 243 size = 254;244 buffer = static_cast<UChar*>(fastMalloc(sizeof(UChar) * 254));245 dest =buffer;243 m_bufferSize = 254; 244 m_buffer = static_cast<UChar*>(fastMalloc(sizeof(UChar) * 254)); 245 m_dest = m_buffer; 246 246 tquote = NoQuote; 247 247 searchCount = 0; 248 248 m_state.setEntityState(NoEntity); 249 scriptSrc= String();250 pendingSrc.clear();251 currentPrependingSrc = 0;252 noMoreData = false;253 brokenComments = false;254 brokenServer = false;249 m_scriptTagSrcAttrValue = String(); 250 m_pendingSrc.clear(); 251 m_currentPrependingSrc = 0; 252 m_noMoreData = false; 253 m_brokenComments = false; 254 m_brokenServer = false; 255 255 m_lineNumber = 0; 256 scriptStartLineno= 0;257 tagStartLineno= 0;256 m_currentScriptTagStartLineNumber = 0; 257 m_currentTagStartLineNumber = 0; 258 258 m_state.setForceSynchronous(false); 259 259 … … 295 295 state.setDiscardLF(false); // We have discarded 1 LF 296 296 else 297 * dest++ = '\n';297 *m_dest++ = '\n'; 298 298 299 299 /* Check for MS-DOS CRLF sequence */ … … 304 304 } else { 305 305 state.setDiscardLF(false); 306 * dest++ = *list;306 *m_dest++ = *list; 307 307 list.advance(); 308 308 } … … 312 312 } 313 313 314 HTMLTokenizer::State HTMLTokenizer::parseSpecial(SegmentedString &src, State state)314 HTMLTokenizer::State HTMLTokenizer::parseSpecial(SegmentedString& src, State state) 315 315 { 316 316 ASSERT(state.inTextArea() || state.inTitle() || state.inIFrame() || !state.hasEntityState()); 317 317 ASSERT(!state.hasTagState()); 318 318 ASSERT(state.inXmp() + state.inTextArea() + state.inTitle() + state.inStyle() + state.inScript() + state.inIFrame() == 1 ); 319 if (state.inScript() && ! scriptStartLineno)320 scriptStartLineno = m_lineNumber + 1; // Script line numbers are 1 based.319 if (state.inScript() && !m_currentScriptTagStartLineNumber) 320 m_currentScriptTagStartLineNumber = m_lineNumber; 321 321 322 322 if (state.inComment()) … … 324 324 325 325 int lastDecodedEntityPosition = -1; 326 while ( !src.isEmpty()) {326 while (!src.isEmpty()) { 327 327 checkScriptBuffer(); 328 328 UChar ch = *src; 329 329 330 if (! scriptCodeResync && !brokenComments &&331 !state.inXmp() && ch == '-' && scriptCodeSize >= 3 && !src.escaped() &&332 scriptCode[scriptCodeSize-3] == '<' && scriptCode[scriptCodeSize-2] == '!' && scriptCode[scriptCodeSize-1] == '-' &&333 (lastDecodedEntityPosition < scriptCodeSize - 3)) {330 if (!m_scriptCodeResync && !m_brokenComments && 331 !state.inXmp() && ch == '-' && m_scriptCodeSize >= 3 && !src.escaped() && 332 m_scriptCode[m_scriptCodeSize - 3] == '<' && m_scriptCode[m_scriptCodeSize - 2] == '!' && m_scriptCode[m_scriptCodeSize - 1] == '-' && 333 (lastDecodedEntityPosition < m_scriptCodeSize - 3)) { 334 334 state.setInComment(true); 335 335 state = parseComment(src, state); 336 336 continue; 337 337 } 338 if ( scriptCodeResync && !tquote && ch == '>') {338 if (m_scriptCodeResync && !tquote && ch == '>') { 339 339 src.advancePastNonNewline(); 340 scriptCodeSize = scriptCodeResync-1;341 scriptCodeResync = 0;342 scriptCode[ scriptCodeSize ] = scriptCode[ scriptCodeSize + 1] = 0;340 m_scriptCodeSize = m_scriptCodeResync - 1; 341 m_scriptCodeResync = 0; 342 m_scriptCode[m_scriptCodeSize] = m_scriptCode[m_scriptCodeSize + 1] = 0; 343 343 if (state.inScript()) 344 344 state = scriptHandler(state); 345 345 else { 346 state = processListing(SegmentedString( scriptCode,scriptCodeSize), state);346 state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); 347 347 processToken(); 348 348 if (state.inStyle()) { 349 currToken.tagName = styleTag.localName();350 currToken.beginTag = false;349 m_currentToken.tagName = styleTag.localName(); 350 m_currentToken.beginTag = false; 351 351 } else if (state.inTextArea()) { 352 currToken.tagName = textareaTag.localName();353 currToken.beginTag = false;352 m_currentToken.tagName = textareaTag.localName(); 353 m_currentToken.beginTag = false; 354 354 } else if (state.inTitle()) { 355 currToken.tagName = titleTag.localName();356 currToken.beginTag = false;355 m_currentToken.tagName = titleTag.localName(); 356 m_currentToken.beginTag = false; 357 357 } else if (state.inXmp()) { 358 currToken.tagName = xmpTag.localName();359 currToken.beginTag = false;358 m_currentToken.tagName = xmpTag.localName(); 359 m_currentToken.beginTag = false; 360 360 } else if (state.inIFrame()) { 361 currToken.tagName = iframeTag.localName();362 currToken.beginTag = false;361 m_currentToken.tagName = iframeTag.localName(); 362 m_currentToken.beginTag = false; 363 363 } 364 364 processToken(); … … 370 370 state.setInIFrame(false); 371 371 tquote = NoQuote; 372 scriptCodeSize =scriptCodeResync = 0;372 m_scriptCodeSize = m_scriptCodeResync = 0; 373 373 } 374 374 return state; 375 375 } 376 376 // possible end of tagname, lets check. 377 if (! scriptCodeResync && !state.escaped() && !src.escaped() && (ch == '>' || ch == '/' || isASCIISpace(ch)) &&378 scriptCodeSize >= searchStopperLen&&379 tagMatch( searchStopper, scriptCode + scriptCodeSize - searchStopperLen, searchStopperLen) &&380 (lastDecodedEntityPosition < scriptCodeSize - searchStopperLen)) {381 scriptCodeResync = scriptCodeSize-searchStopperLen+1;377 if (!m_scriptCodeResync && !state.escaped() && !src.escaped() && (ch == '>' || ch == '/' || isASCIISpace(ch)) && 378 m_scriptCodeSize >= m_searchStopperLength && 379 tagMatch(m_searchStopper, m_scriptCode + m_scriptCodeSize - m_searchStopperLength, m_searchStopperLength) && 380 (lastDecodedEntityPosition < m_scriptCodeSize - m_searchStopperLength)) { 381 m_scriptCodeResync = m_scriptCodeSize-m_searchStopperLength+1; 382 382 tquote = NoQuote; 383 383 continue; 384 384 } 385 if ( scriptCodeResync && !state.escaped()) {385 if (m_scriptCodeResync && !state.escaped()) { 386 386 if (ch == '\"') 387 387 tquote = (tquote == NoQuote) ? DoubleQuote : ((tquote == SingleQuote) ? SingleQuote : NoQuote); … … 392 392 } 393 393 state.setEscaped(!state.escaped() && ch == '\\'); 394 if (! scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') {395 UChar* scriptCodeDest = scriptCode+scriptCodeSize;394 if (!m_scriptCodeResync && (state.inTextArea() || state.inTitle() || state.inIFrame()) && !src.escaped() && ch == '&') { 395 UChar* scriptCodeDest = m_scriptCode + m_scriptCodeSize; 396 396 src.advancePastNonNewline(); 397 397 state = parseEntity(src, scriptCodeDest, state, m_cBufferPos, true, false); 398 if (scriptCodeDest == scriptCode +scriptCodeSize)399 lastDecodedEntityPosition = scriptCodeSize;398 if (scriptCodeDest == m_scriptCode + m_scriptCodeSize) 399 lastDecodedEntityPosition = m_scriptCodeSize; 400 400 else 401 scriptCodeSize = scriptCodeDest -scriptCode;401 m_scriptCodeSize = scriptCodeDest - m_scriptCode; 402 402 } else { 403 scriptCode[scriptCodeSize++] = ch;403 m_scriptCode[m_scriptCodeSize++] = ch; 404 404 src.advance(m_lineNumber); 405 405 } … … 413 413 // We are inside a <script> 414 414 bool doScriptExec = false; 415 int startLine = scriptStartLineno;416 417 // Reset scriptStartLinenoto indicate that we've finished parsing the current script element418 scriptStartLineno= 0;415 int startLine = m_currentScriptTagStartLineNumber + 1; // Script line numbers are 1 based, HTMLTokenzier line numbers are 0 based 416 417 // Reset m_currentScriptTagStartLineNumber to indicate that we've finished parsing the current script element 418 m_currentScriptTagStartLineNumber = 0; 419 419 420 420 // (Bugzilla 3837) Scripts following a frameset element should not execute or, … … 425 425 // don't load external scripts for standalone documents (for now) 426 426 if (!inViewSourceMode()) { 427 if (! scriptSrc.isEmpty() && m_doc->frame()) {427 if (!m_scriptTagSrcAttrValue.isEmpty() && m_doc->frame()) { 428 428 // forget what we just got; load from src url instead 429 if (! parser->skipMode() && !followingFrameset) {429 if (!m_parser->skipMode() && !followingFrameset) { 430 430 #ifdef INSTRUMENT_LAYOUT_SCHEDULING 431 431 if (!m_doc->ownerElement()) … … 434 434 // The parser might have been stopped by for example a window.close call in an earlier script. 435 435 // If so, we don't want to load scripts. 436 if (!m_parserStopped && (cs = m_doc->docLoader()->requestScript( scriptSrc, scriptSrcCharset)))437 pendingScripts.append(cs);436 if (!m_parserStopped && (cs = m_doc->docLoader()->requestScript(m_scriptTagSrcAttrValue, m_scriptTagCharsetAttrValue))) 437 m_pendingScripts.append(cs); 438 438 else 439 scriptNode = 0;439 m_scriptNode = 0; 440 440 } else 441 scriptNode = 0;442 scriptSrc= String();441 m_scriptNode = 0; 442 m_scriptTagSrcAttrValue = String(); 443 443 } else { 444 // Parse scriptCode containing <script> info444 // Parse m_scriptCode containing <script> info 445 445 #if USE(LOW_BANDWIDTH_DISPLAY) 446 446 if (m_doc->inLowBandwidthDisplay()) { … … 452 452 } else 453 453 #endif 454 doScriptExec = static_cast<HTMLScriptElement*>(scriptNode.get())->shouldExecuteAsJavaScript();455 scriptNode = 0;456 } 457 } 458 459 state = processListing(SegmentedString( scriptCode,scriptCodeSize), state);454 doScriptExec = m_scriptNode->shouldExecuteAsJavaScript(); 455 m_scriptNode = 0; 456 } 457 } 458 459 state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize), state); 460 460 RefPtr<Node> node = processToken(); 461 461 String scriptString = node ? node->textContent() : ""; 462 currToken.tagName = scriptTag.localName();463 currToken.beginTag = false;462 m_currentToken.tagName = scriptTag.localName(); 463 m_currentToken.beginTag = false; 464 464 processToken(); 465 465 466 466 state.setInScript(false); 467 scriptCodeSize =scriptCodeResync = 0;467 m_scriptCodeSize = m_scriptCodeResync = 0; 468 468 469 469 // FIXME: The script should be syntax highlighted. … … 471 471 return state; 472 472 473 SegmentedString *savedPrependingSrc =currentPrependingSrc;473 SegmentedString* savedPrependingSrc = m_currentPrependingSrc; 474 474 SegmentedString prependingSrc; 475 currentPrependingSrc = &prependingSrc;476 477 if (! parser->skipMode() && !followingFrameset) {475 m_currentPrependingSrc = &prependingSrc; 476 477 if (!m_parser->skipMode() && !followingFrameset) { 478 478 if (cs) { 479 479 if (savedPrependingSrc) 480 savedPrependingSrc->append( src);480 savedPrependingSrc->append(m_src); 481 481 else 482 pendingSrc.prepend(src);482 m_pendingSrc.prepend(m_src); 483 483 setSrc(SegmentedString()); 484 484 … … 492 492 state = m_state; 493 493 // will be 0 if script was already loaded and ref() executed it 494 if (! pendingScripts.isEmpty())494 if (!m_pendingScripts.isEmpty()) 495 495 state.setLoadingExtScript(true); 496 496 } else if (!m_fragment && doScriptExec) { 497 497 if (!m_executingScript) 498 pendingSrc.prepend(src);498 m_pendingSrc.prepend(m_src); 499 499 else 500 prependingSrc = src;500 prependingSrc = m_src; 501 501 setSrc(SegmentedString()); 502 502 state = scriptExecution(scriptString, state, String(), startLine); … … 505 505 506 506 if (!m_executingScript && !state.loadingExtScript()) { 507 src.append(pendingSrc);508 pendingSrc.clear();507 m_src.append(m_pendingSrc); 508 m_pendingSrc.clear(); 509 509 } else if (!prependingSrc.isEmpty()) { 510 510 // restore first so that the write appends in the right place 511 511 // (does not hurt to do it again below) 512 currentPrependingSrc = savedPrependingSrc;512 m_currentPrependingSrc = savedPrependingSrc; 513 513 514 514 // we need to do this slightly modified bit of one of the write() cases 515 // because we want to prepend to pendingSrc rather than appending515 // because we want to prepend to m_pendingSrc rather than appending 516 516 // if there's no previous prependingSrc 517 if (!pendingScripts.isEmpty()) { 518 if (currentPrependingSrc) { 519 currentPrependingSrc->append(prependingSrc); 520 } else { 521 pendingSrc.prepend(prependingSrc); 522 } 517 if (!m_pendingScripts.isEmpty()) { 518 if (m_currentPrependingSrc) 519 m_currentPrependingSrc->append(prependingSrc); 520 else 521 m_pendingSrc.prepend(prependingSrc); 523 522 } else { 524 523 m_state = state; … … 529 528 530 529 #if PRELOAD_SCANNER_ENABLED 531 if (! pendingScripts.isEmpty() && !m_executingScript) {530 if (!m_pendingScripts.isEmpty() && !m_executingScript) { 532 531 if (!m_preloadScanner) 533 532 m_preloadScanner.set(new PreloadScanner(m_doc)); 534 533 if (!m_preloadScanner->inProgress()) { 535 534 m_preloadScanner->begin(); 536 m_preloadScanner->write( pendingSrc);535 m_preloadScanner->write(m_pendingSrc); 537 536 } 538 537 } 539 538 #endif 540 currentPrependingSrc = savedPrependingSrc;539 m_currentPrependingSrc = savedPrependingSrc; 541 540 542 541 return state; … … 550 549 String url = scriptURL.isNull() ? m_doc->frame()->document()->url().string() : scriptURL; 551 550 552 SegmentedString *savedPrependingSrc =currentPrependingSrc;551 SegmentedString* savedPrependingSrc = m_currentPrependingSrc; 553 552 SegmentedString prependingSrc; 554 currentPrependingSrc = &prependingSrc;553 m_currentPrependingSrc = &prependingSrc; 555 554 556 555 #ifdef INSTRUMENT_LAYOUT_SCHEDULING … … 573 572 574 573 if (!m_executingScript && !state.loadingExtScript()) { 575 pendingSrc.prepend(prependingSrc);576 src.append(pendingSrc);577 pendingSrc.clear();574 m_pendingSrc.prepend(prependingSrc); 575 m_src.append(m_pendingSrc); 576 m_pendingSrc.clear(); 578 577 } else if (!prependingSrc.isEmpty()) { 579 578 // restore first so that the write appends in the right place 580 579 // (does not hurt to do it again below) 581 currentPrependingSrc = savedPrependingSrc;580 m_currentPrependingSrc = savedPrependingSrc; 582 581 583 582 // we need to do this slightly modified bit of one of the write() cases 584 // because we want to prepend to pendingSrc rather than appending583 // because we want to prepend to m_pendingSrc rather than appending 585 584 // if there's no previous prependingSrc 586 if (! pendingScripts.isEmpty()) {587 if ( currentPrependingSrc)588 currentPrependingSrc->append(prependingSrc);585 if (!m_pendingScripts.isEmpty()) { 586 if (m_currentPrependingSrc) 587 m_currentPrependingSrc->append(prependingSrc); 589 588 else 590 pendingSrc.prepend(prependingSrc);589 m_pendingSrc.prepend(prependingSrc); 591 590 592 591 #if PRELOAD_SCANNER_ENABLED … … 605 604 } 606 605 607 currentPrependingSrc = savedPrependingSrc;606 m_currentPrependingSrc = savedPrependingSrc; 608 607 609 608 return state; 610 609 } 611 610 612 HTMLTokenizer::State HTMLTokenizer::parseComment(SegmentedString &src, State state)611 HTMLTokenizer::State HTMLTokenizer::parseComment(SegmentedString& src, State state) 613 612 { 614 613 // FIXME: Why does this code even run for comments inside <script> and <style>? This seems bogus. … … 616 615 while (!src.isEmpty()) { 617 616 UChar ch = *src; 618 scriptCode[scriptCodeSize++] = ch;617 m_scriptCode[m_scriptCodeSize++] = ch; 619 618 if (ch == '>') { 620 bool handleBrokenComments = brokenComments && !(state.inScript() || state.inStyle());619 bool handleBrokenComments = m_brokenComments && !(state.inScript() || state.inStyle()); 621 620 int endCharsCount = 1; // start off with one for the '>' character 622 if ( scriptCodeSize > 2 && scriptCode[scriptCodeSize-3] == '-' && scriptCode[scriptCodeSize-2] == '-') {621 if (m_scriptCodeSize > 2 && m_scriptCode[m_scriptCodeSize-3] == '-' && m_scriptCode[m_scriptCodeSize-2] == '-') { 623 622 endCharsCount = 3; 624 } else if ( scriptCodeSize > 3 && scriptCode[scriptCodeSize-4] == '-' && scriptCode[scriptCodeSize-3] == '-' &&625 scriptCode[scriptCodeSize-2] == '!') {623 } else if (m_scriptCodeSize > 3 && m_scriptCode[m_scriptCodeSize-4] == '-' && m_scriptCode[m_scriptCodeSize-3] == '-' && 624 m_scriptCode[m_scriptCodeSize-2] == '!') { 626 625 // Other browsers will accept --!> as a close comment, even though it's 627 626 // not technically valid. … … 632 631 if (!(state.inTitle() || state.inScript() || state.inXmp() || state.inTextArea() || state.inStyle() || state.inIFrame())) { 633 632 checkScriptBuffer(); 634 scriptCode[scriptCodeSize] = 0;635 scriptCode[scriptCodeSize + 1] = 0;636 currToken.tagName = commentAtom;637 currToken.beginTag = true;638 state = processListing(SegmentedString( scriptCode,scriptCodeSize - endCharsCount), state);633 m_scriptCode[m_scriptCodeSize] = 0; 634 m_scriptCode[m_scriptCodeSize + 1] = 0; 635 m_currentToken.tagName = commentAtom; 636 m_currentToken.beginTag = true; 637 state = processListing(SegmentedString(m_scriptCode, m_scriptCodeSize - endCharsCount), state); 639 638 processToken(); 640 currToken.tagName = commentAtom;641 currToken.beginTag = false;639 m_currentToken.tagName = commentAtom; 640 m_currentToken.beginTag = false; 642 641 processToken(); 643 scriptCodeSize = 0;642 m_scriptCodeSize = 0; 644 643 } 645 644 state.setInComment(false); … … 658 657 while (!src.isEmpty()) { 659 658 UChar ch = *src; 660 scriptCode[scriptCodeSize++] = ch;661 if (ch == '>' && scriptCodeSize > 1 && scriptCode[scriptCodeSize-2] == '%') {659 m_scriptCode[m_scriptCodeSize++] = ch; 660 if (ch == '>' && m_scriptCodeSize > 1 && m_scriptCode[m_scriptCodeSize - 2] == '%') { 662 661 src.advancePastNonNewline(); 663 662 state.setInServer(false); 664 scriptCodeSize = 0;663 m_scriptCodeSize = 0; 665 664 return state; // Finished parsing server include 666 665 } … … 670 669 } 671 670 672 HTMLTokenizer::State HTMLTokenizer::parseProcessingInstruction(SegmentedString &src, State state)671 HTMLTokenizer::State HTMLTokenizer::parseProcessingInstruction(SegmentedString& src, State state) 673 672 { 674 673 UChar oldchar = 0; … … 696 695 } 697 696 698 HTMLTokenizer::State HTMLTokenizer::parseText(SegmentedString &src, State state)697 HTMLTokenizer::State HTMLTokenizer::parseText(SegmentedString& src, State state) 699 698 { 700 699 while (!src.isEmpty()) { … … 714 713 if (cc == '\r') { 715 714 state.setSkipLF(true); 716 * dest++ = '\n';715 *m_dest++ = '\n'; 717 716 } else 718 * dest++ = cc;717 *m_dest++ = cc; 719 718 src.advance(m_lineNumber); 720 719 } … … 724 723 725 724 726 HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString &src, UChar*& dest, State state, unsigned &cBufferPos, bool start, bool parsingTag) 727 { 728 if (start) 729 { 725 HTMLTokenizer::State HTMLTokenizer::parseEntity(SegmentedString& src, UChar*& dest, State state, unsigned& cBufferPos, bool start, bool parsingTag) 726 { 727 if (start) { 730 728 cBufferPos = 0; 731 729 state.setEntityState(SearchEntity); … … 733 731 } 734 732 735 while(!src.isEmpty()) 736 { 733 while(!src.isEmpty()) { 737 734 UChar cc = *src; 738 735 switch(state.entityState()) { … … 743 740 case SearchEntity: 744 741 if (cc == '#') { 745 cBuffer[cBufferPos++] = cc;742 m_cBuffer[cBufferPos++] = cc; 746 743 src.advancePastNonNewline(); 747 744 state.setEntityState(NumericSearch); … … 752 749 case NumericSearch: 753 750 if (cc == 'x' || cc == 'X') { 754 cBuffer[cBufferPos++] = cc;751 m_cBuffer[cBufferPos++] = cc; 755 752 src.advancePastNonNewline(); 756 753 state.setEntityState(Hexadecimal); … … 775 772 digit = (cc - 'A' + 10) & 0xF; // handle both upper and lower case without a branch 776 773 EntityUnicodeValue = EntityUnicodeValue * 16 + digit; 777 cBuffer[cBufferPos++] = cc;774 m_cBuffer[cBufferPos++] = cc; 778 775 src.advancePastNonNewline(); 779 776 } … … 794 791 795 792 EntityUnicodeValue = EntityUnicodeValue * 10 + (cc - '0'); 796 cBuffer[cBufferPos++] = cc;793 m_cBuffer[cBufferPos++] = cc; 797 794 src.advancePastNonNewline(); 798 795 } … … 812 809 } 813 810 814 cBuffer[cBufferPos++] = cc;811 m_cBuffer[cBufferPos++] = cc; 815 812 src.advancePastNonNewline(); 816 813 } … … 829 826 ASSERT(cBufferPos < 10); 830 827 for (; testedEntityNameLen < cBufferPos; ++testedEntityNameLen) { 831 if ( cBuffer[testedEntityNameLen] > 0x7e)828 if (m_cBuffer[testedEntityNameLen] > 0x7e) 832 829 break; 833 tmpEntityNameBuffer[testedEntityNameLen] = cBuffer[testedEntityNameLen];830 tmpEntityNameBuffer[testedEntityNameLen] = m_cBuffer[testedEntityNameLen]; 834 831 } 835 832 … … 872 869 *dest++ = '&'; 873 870 for (unsigned i = 0; i < cBufferPos; i++) 874 dest[i] = cBuffer[i];871 dest[i] = m_cBuffer[i]; 875 872 dest += cBufferPos; 876 873 if (*src == ';') { … … 884 881 *dest++ = '&'; 885 882 for (unsigned i = 0; i < cBufferPos; i++) 886 dest[i] = cBuffer[i];883 dest[i] = m_cBuffer[i]; 887 884 dest += cBufferPos; 888 885 } … … 1112 1109 } 1113 1110 1114 HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString &src, State state)1111 HTMLTokenizer::State HTMLTokenizer::parseTag(SegmentedString& src, State state) 1115 1112 { 1116 1113 ASSERT(!state.hasEntityState()); … … 1140 1137 // Found '<!--' sequence 1141 1138 src.advancePastNonNewline(); 1142 dest =buffer; // ignore the previous part of this tag1139 m_dest = m_buffer; // ignore the previous part of this tag 1143 1140 state.setInComment(true); 1144 1141 state.setTagState(NoTag); … … 1151 1148 src.advancePastNonNewline(); 1152 1149 if (!src.isEmpty()) 1153 cBuffer[cBufferPos++] = *src;1150 m_cBuffer[cBufferPos++] = *src; 1154 1151 } else 1155 1152 state = parseComment(src, state); … … 1158 1155 return state; // Finished parsing tag! 1159 1156 } 1160 cBuffer[cBufferPos++] = *src;1157 m_cBuffer[cBufferPos++] = *src; 1161 1158 src.advancePastNonNewline(); 1162 1159 break; … … 1168 1165 if (toASCIILower(*src) == doctypeStart[m_doctypeSearchCount]) { 1169 1166 m_doctypeSearchCount++; 1170 cBuffer[cBufferPos++] = *src;1167 m_cBuffer[cBufferPos++] = *src; 1171 1168 src.advancePastNonNewline(); 1172 1169 if (m_doctypeSearchCount == 9) { … … 1176 1173 m_doctypeToken.reset(); 1177 1174 if (inViewSourceMode()) 1178 m_doctypeToken.m_source.append( cBuffer, cBufferPos);1175 m_doctypeToken.m_source.append(m_cBuffer, cBufferPos); 1179 1176 state = parseDoctype(src, state); 1180 1177 m_cBufferPos = cBufferPos; … … 1197 1194 // tolower() shows up on profiles. This is faster! 1198 1195 if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) 1199 cBuffer[cBufferPos++] = curchar + ('a' - 'A');1196 m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); 1200 1197 else 1201 cBuffer[cBufferPos++] = curchar;1198 m_cBuffer[cBufferPos++] = curchar; 1202 1199 src.advancePastNonNewline(); 1203 1200 } … … 1205 1202 // Disadvantage: we add the possible rest of the tag 1206 1203 // as attribute names. ### judge if this causes problems 1207 if (finish || CBUFLEN == cBufferPos) {1204 if (finish || CBUFLEN == cBufferPos) { 1208 1205 bool beginTag; 1209 UChar* ptr = cBuffer;1206 UChar* ptr = m_cBuffer; 1210 1207 unsigned int len = cBufferPos; 1211 cBuffer[cBufferPos] = '\0';1208 m_cBuffer[cBufferPos] = '\0'; 1212 1209 if ((cBufferPos > 0) && (*ptr == '/')) { 1213 1210 // End Tag … … 1227 1224 // FIXME: FireFox and WinIE turn !foo nodes into comments, we ignore comments. (fast/parser/tag-with-exclamation-point.html) 1228 1225 if (ptr[0] != '!' || inViewSourceMode()) { 1229 currToken.tagName = AtomicString(ptr);1230 currToken.beginTag = beginTag;1231 } 1232 dest =buffer;1226 m_currentToken.tagName = AtomicString(ptr); 1227 m_currentToken.beginTag = beginTag; 1228 } 1229 m_dest = m_buffer; 1233 1230 state.setTagState(SearchAttribute); 1234 1231 cBufferPos = 0; … … 1237 1234 } 1238 1235 case SearchAttribute: 1239 #if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 11240 qDebug("SearchAttribute");1241 #endif1242 1236 while(!src.isEmpty()) { 1243 1237 UChar curchar = *src; … … 1253 1247 } 1254 1248 if (inViewSourceMode()) 1255 currToken.addViewSourceChar(curchar);1249 m_currentToken.addViewSourceChar(curchar); 1256 1250 src.advance(m_lineNumber); 1257 1251 } … … 1259 1253 case AttributeName: 1260 1254 { 1261 #if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 1 1262 qDebug("AttributeName"); 1263 #endif 1264 int ll = min(src.length(), CBUFLEN-cBufferPos); 1265 while(ll--) { 1255 int ll = min(src.length(), CBUFLEN - cBufferPos); 1256 while (ll--) { 1266 1257 UChar curchar = *src; 1267 1258 // If we encounter a "/" when scanning an attribute name, treat it as a delimiter. This allows the 1268 1259 // cases like <input type=checkbox checked/> to work (and accommodates XML-style syntax as per HTML5). 1269 1260 if (curchar <= '>' && (curchar >= '<' || isASCIISpace(curchar) || curchar == '/')) { 1270 cBuffer[cBufferPos] = '\0';1271 attrName = AtomicString(cBuffer);1272 dest =buffer;1273 * dest++ = 0;1261 m_cBuffer[cBufferPos] = '\0'; 1262 m_attrName = AtomicString(m_cBuffer); 1263 m_dest = m_buffer; 1264 *m_dest++ = 0; 1274 1265 state.setTagState(SearchEqual); 1275 1266 if (inViewSourceMode()) 1276 currToken.addViewSourceChar('a');1267 m_currentToken.addViewSourceChar('a'); 1277 1268 break; 1278 1269 } … … 1280 1271 // tolower() shows up on profiles. This is faster! 1281 1272 if (curchar >= 'A' && curchar <= 'Z' && !inViewSourceMode()) 1282 cBuffer[cBufferPos++] = curchar + ('a' - 'A');1273 m_cBuffer[cBufferPos++] = curchar + ('a' - 'A'); 1283 1274 else 1284 cBuffer[cBufferPos++] = curchar;1275 m_cBuffer[cBufferPos++] = curchar; 1285 1276 1286 1277 src.advance(m_lineNumber); 1287 1278 } 1288 if ( cBufferPos == CBUFLEN) {1289 cBuffer[cBufferPos] = '\0';1290 attrName = AtomicString(cBuffer);1291 dest =buffer;1292 * dest++ = 0;1279 if (cBufferPos == CBUFLEN) { 1280 m_cBuffer[cBufferPos] = '\0'; 1281 m_attrName = AtomicString(m_cBuffer); 1282 m_dest = m_buffer; 1283 *m_dest++ = 0; 1293 1284 state.setTagState(SearchEqual); 1294 1285 if (inViewSourceMode()) 1295 currToken.addViewSourceChar('a');1286 m_currentToken.addViewSourceChar('a'); 1296 1287 } 1297 1288 break; 1298 1289 } 1299 1290 case SearchEqual: 1300 #if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 1 1301 qDebug("SearchEqual"); 1302 #endif 1303 while(!src.isEmpty()) { 1291 while (!src.isEmpty()) { 1304 1292 UChar curchar = *src; 1305 1293 … … 1307 1295 // This is a quirk (with a long sad history). We have to do this 1308 1296 // since widgets do <script src="foo.js"/> and expect the tag to close. 1309 if ( currToken.tagName == scriptTag)1310 currToken.flat= true;1311 currToken.brokenXMLStyle = true;1297 if (m_currentToken.tagName == scriptTag) 1298 m_currentToken.selfClosingTag = true; 1299 m_currentToken.brokenXMLStyle = true; 1312 1300 } 1313 1301 … … 1315 1303 if (!isASCIISpace(curchar) && curchar != '\'' && curchar != '"' && curchar != '/') { 1316 1304 if (curchar == '=') { 1317 #ifdef TOKEN_DEBUG1318 kdDebug(6036) << "found equal" << endl;1319 #endif1320 1305 state.setTagState(SearchValue); 1321 1306 if (inViewSourceMode()) 1322 currToken.addViewSourceChar(curchar);1307 m_currentToken.addViewSourceChar(curchar); 1323 1308 src.advancePastNonNewline(); 1324 1309 } else { 1325 currToken.addAttribute(m_doc,attrName, emptyAtom, inViewSourceMode());1326 dest =buffer;1310 m_currentToken.addAttribute(m_doc, m_attrName, emptyAtom, inViewSourceMode()); 1311 m_dest = m_buffer; 1327 1312 state.setTagState(SearchAttribute); 1328 1313 lastIsSlash = false; … … 1331 1316 } 1332 1317 if (inViewSourceMode()) 1333 currToken.addViewSourceChar(curchar);1318 m_currentToken.addViewSourceChar(curchar); 1334 1319 1335 1320 lastIsSlash = curchar == '/'; … … 1346 1331 state.setTagState(QuotedValue); 1347 1332 if (inViewSourceMode()) 1348 currToken.addViewSourceChar(curchar);1333 m_currentToken.addViewSourceChar(curchar); 1349 1334 src.advancePastNonNewline(); 1350 1335 } else … … 1354 1339 } 1355 1340 if (inViewSourceMode()) 1356 currToken.addViewSourceChar(curchar);1341 m_currentToken.addViewSourceChar(curchar); 1357 1342 src.advance(m_lineNumber); 1358 1343 } 1359 1344 break; 1360 1345 case QuotedValue: 1361 #if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 11362 qDebug("QuotedValue");1363 #endif1364 1346 while (!src.isEmpty()) { 1365 1347 checkBuffer(); … … 1367 1349 UChar curchar = *src; 1368 1350 if (curchar <= '>' && !src.escaped()) { 1369 if (curchar == '>' && attrName.isEmpty()) {1351 if (curchar == '>' && m_attrName.isEmpty()) { 1370 1352 // Handle a case like <img '>. Just go ahead and be willing 1371 1353 // to close the whole tag. Don't consume the character and … … 1375 1357 // It doesn't handle the general case of 1376 1358 // unmatched quotes among attributes that have names. -dwh 1377 while ( dest > buffer + 1 && (dest[-1] == '\n' ||dest[-1] == '\r'))1378 dest--; // remove trailing newlines1379 AtomicString v(buffer + 1, dest -buffer - 1);1380 if (! v.contains('/'))1381 attrName = v; // Just make the name/value match. (FIXME: Is this some WinIE quirk?)1382 currToken.addAttribute(m_doc, attrName, v, inViewSourceMode());1359 while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) 1360 m_dest--; // remove trailing newlines 1361 AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); 1362 if (!attributeValue.contains('/')) 1363 m_attrName = attributeValue; // Just make the name/value match. (FIXME: Is this some WinIE quirk?) 1364 m_currentToken.addAttribute(m_doc, m_attrName, attributeValue, inViewSourceMode()); 1383 1365 if (inViewSourceMode()) 1384 currToken.addViewSourceChar('x');1366 m_currentToken.addViewSourceChar('x'); 1385 1367 state.setTagState(SearchAttribute); 1386 dest =buffer;1368 m_dest = m_buffer; 1387 1369 tquote = NoQuote; 1388 1370 break; … … 1391 1373 if (curchar == '&') { 1392 1374 src.advancePastNonNewline(); 1393 state = parseEntity(src, dest, state, cBufferPos, true, true);1375 state = parseEntity(src, m_dest, state, cBufferPos, true, true); 1394 1376 break; 1395 1377 } … … 1397 1379 if ((tquote == SingleQuote && curchar == '\'') || (tquote == DoubleQuote && curchar == '\"')) { 1398 1380 // some <input type=hidden> rely on trailing spaces. argh 1399 while ( dest > buffer + 1 && (dest[-1] == '\n' ||dest[-1] == '\r'))1400 dest--; // remove trailing newlines1401 AtomicString v(buffer + 1, dest -buffer - 1);1402 if ( attrName.isEmpty() && !v.contains('/')) {1403 attrName = v; // Make the name match the value. (FIXME: Is this a WinIE quirk?)1381 while (m_dest > m_buffer + 1 && (m_dest[-1] == '\n' || m_dest[-1] == '\r')) 1382 m_dest--; // remove trailing newlines 1383 AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); 1384 if (m_attrName.isEmpty() && !attributeValue.contains('/')) { 1385 m_attrName = attributeValue; // Make the name match the value. (FIXME: Is this a WinIE quirk?) 1404 1386 if (inViewSourceMode()) 1405 currToken.addViewSourceChar('x');1387 m_currentToken.addViewSourceChar('x'); 1406 1388 } else if (inViewSourceMode()) 1407 currToken.addViewSourceChar('v');1408 currToken.addAttribute(m_doc, attrName, v, inViewSourceMode());1409 dest =buffer;1389 m_currentToken.addViewSourceChar('v'); 1390 m_currentToken.addAttribute(m_doc, m_attrName, attributeValue, inViewSourceMode()); 1391 m_dest = m_buffer; 1410 1392 state.setTagState(SearchAttribute); 1411 1393 tquote = NoQuote; 1412 1394 if (inViewSourceMode()) 1413 currToken.addViewSourceChar(curchar);1395 m_currentToken.addViewSourceChar(curchar); 1414 1396 src.advancePastNonNewline(); 1415 1397 break; … … 1417 1399 } 1418 1400 1419 * dest++ = curchar;1401 *m_dest++ = curchar; 1420 1402 src.advance(m_lineNumber); 1421 1403 } 1422 1404 break; 1423 1405 case Value: 1424 #if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 11425 qDebug("Value");1426 #endif1427 1406 while(!src.isEmpty()) { 1428 1407 checkBuffer(); … … 1432 1411 if (curchar == '&') { 1433 1412 src.advancePastNonNewline(); 1434 state = parseEntity(src, dest, state, cBufferPos, true, true);1413 state = parseEntity(src, m_dest, state, cBufferPos, true, true); 1435 1414 break; 1436 1415 } … … 1438 1417 // '/' does not delimit in IE! 1439 1418 if (isASCIISpace(curchar) || curchar == '>') { 1440 AtomicString v(buffer+1, dest-buffer-1);1441 currToken.addAttribute(m_doc, attrName, v, inViewSourceMode());1419 AtomicString attributeValue(m_buffer + 1, m_dest - m_buffer - 1); 1420 m_currentToken.addAttribute(m_doc, m_attrName, attributeValue, inViewSourceMode()); 1442 1421 if (inViewSourceMode()) 1443 currToken.addViewSourceChar('v');1444 dest =buffer;1422 m_currentToken.addViewSourceChar('v'); 1423 m_dest = m_buffer; 1445 1424 state.setTagState(SearchAttribute); 1446 1425 break; … … 1448 1427 } 1449 1428 1450 * dest++ = curchar;1429 *m_dest++ = curchar; 1451 1430 src.advance(m_lineNumber); 1452 1431 } … … 1454 1433 case SearchEnd: 1455 1434 { 1456 #if defined(TOKEN_DEBUG) && TOKEN_DEBUG > 11457 qDebug("SearchEnd");1458 #endif1459 1435 while (!src.isEmpty()) { 1460 1436 UChar ch = *src; … … 1462 1438 break; 1463 1439 if (ch == '/') 1464 currToken.flat= true;1440 m_currentToken.selfClosingTag = true; 1465 1441 if (inViewSourceMode()) 1466 currToken.addViewSourceChar(ch);1442 m_currentToken.addViewSourceChar(ch); 1467 1443 src.advance(m_lineNumber); 1468 1444 } 1469 if (src.isEmpty()) break; 1445 if (src.isEmpty()) 1446 break; 1470 1447 1471 1448 searchCount = 0; // Stop looking for '<!--' sequence … … 1476 1453 src.advance(m_lineNumber); 1477 1454 1478 if ( currToken.tagName == nullAtom) { //stop if tag is unknown1455 if (m_currentToken.tagName == nullAtom) { //stop if tag is unknown 1479 1456 m_cBufferPos = cBufferPos; 1480 1457 return state; 1481 1458 } 1482 1459 1483 AtomicString tagName = currToken.tagName;1460 AtomicString tagName = m_currentToken.tagName; 1484 1461 1485 1462 // Handle <script src="foo"/> like Mozilla/Opera. We have to do this now for Dashboard 1486 1463 // compatibility. 1487 bool isSelfClosingScript = currToken.flat && currToken.beginTag && currToken.tagName == scriptTag;1488 bool beginTag = ! currToken.flat && currToken.beginTag;1489 if ( currToken.beginTag && currToken.tagName == scriptTag && !inViewSourceMode() && !parser->skipMode()) {1464 bool isSelfClosingScript = m_currentToken.selfClosingTag && m_currentToken.beginTag && m_currentToken.tagName == scriptTag; 1465 bool beginTag = !m_currentToken.selfClosingTag && m_currentToken.beginTag; 1466 if (m_currentToken.beginTag && m_currentToken.tagName == scriptTag && !inViewSourceMode() && !m_parser->skipMode()) { 1490 1467 Attribute* a = 0; 1491 scriptSrc= String();1492 scriptSrcCharset= String();1493 if ( currToken.attrs && !m_fragment) {1468 m_scriptTagSrcAttrValue = String(); 1469 m_scriptTagCharsetAttrValue = String(); 1470 if (m_currentToken.attrs && !m_fragment) { 1494 1471 if (m_doc->frame() && m_doc->frame()->script()->isEnabled()) { 1495 if ((a = currToken.attrs->getAttributeItem(srcAttr)))1496 scriptSrc= m_doc->completeURL(parseURL(a->value())).string();1472 if ((a = m_currentToken.attrs->getAttributeItem(srcAttr))) 1473 m_scriptTagSrcAttrValue = m_doc->completeURL(parseURL(a->value())).string(); 1497 1474 } 1498 1475 } … … 1506 1483 state.setDiscardLF(true); // Discard the first LF after we open a pre. 1507 1484 } else if (tagName == scriptTag) { 1508 ASSERT(! scriptNode);1509 scriptNode = n;1510 if ( n)1511 scriptSrcCharset = static_cast<HTMLScriptElement*>(n.get())->scriptCharset();1485 ASSERT(!m_scriptNode); 1486 m_scriptNode = static_pointer_cast<HTMLScriptElement>(n); 1487 if (m_scriptNode) 1488 m_scriptTagCharsetAttrValue = m_scriptNode->scriptCharset(); 1512 1489 if (beginTag) { 1513 searchStopper = scriptEnd;1514 searchStopperLen= 8;1490 m_searchStopper = scriptEnd; 1491 m_searchStopperLength = 8; 1515 1492 state.setInScript(true); 1516 1493 state = parseSpecial(src, state); … … 1521 1498 } else if (tagName == styleTag) { 1522 1499 if (beginTag) { 1523 searchStopper = styleEnd;1524 searchStopperLen= 7;1500 m_searchStopper = styleEnd; 1501 m_searchStopperLength = 7; 1525 1502 state.setInStyle(true); 1526 1503 state = parseSpecial(src, state); … … 1528 1505 } else if (tagName == textareaTag) { 1529 1506 if (beginTag) { 1530 searchStopper = textareaEnd;1531 searchStopperLen= 10;1507 m_searchStopper = textareaEnd; 1508 m_searchStopperLength = 10; 1532 1509 state.setInTextArea(true); 1533 1510 state = parseSpecial(src, state); … … 1535 1512 } else if (tagName == titleTag) { 1536 1513 if (beginTag) { 1537 searchStopper = titleEnd;1538 searchStopperLen= 7;1514 m_searchStopper = titleEnd; 1515 m_searchStopperLength = 7; 1539 1516 State savedState = state; 1540 1517 SegmentedString savedSrc = src; … … 1547 1524 // Let the parser clean up the missing </title> tag. 1548 1525 // FIXME: This is incorrect, because src.isEmpty() doesn't mean we're 1549 // at the end of the document unless noMoreData is also true. We need1526 // at the end of the document unless m_noMoreData is also true. We need 1550 1527 // to detect this case elsewhere, and save the state somewhere other 1551 1528 // than a local variable. … … 1553 1530 src = savedSrc; 1554 1531 m_lineNumber = savedLineno; 1555 scriptCodeSize = 0;1532 m_scriptCodeSize = 0; 1556 1533 } 1557 1534 } 1558 1535 } else if (tagName == xmpTag) { 1559 1536 if (beginTag) { 1560 searchStopper = xmpEnd;1561 searchStopperLen= 5;1537 m_searchStopper = xmpEnd; 1538 m_searchStopperLength = 5; 1562 1539 state.setInXmp(true); 1563 1540 state = parseSpecial(src, state); … … 1565 1542 } else if (tagName == iframeTag) { 1566 1543 if (beginTag) { 1567 searchStopper = iframeEnd;1568 searchStopperLen= 8;1544 m_searchStopper = iframeEnd; 1545 m_searchStopperLength = 8; 1569 1546 state.setInIFrame(true); 1570 1547 state = parseSpecial(src, state); … … 1612 1589 bool HTMLTokenizer::write(const SegmentedString& str, bool appendData) 1613 1590 { 1614 #ifdef TOKEN_DEBUG 1615 kdDebug( 6036 ) << this << " Tokenizer::write(\"" << str.toString() << "\"," << appendData << ")" << endl; 1616 #endif 1617 1618 if (!buffer) 1591 if (!m_buffer) 1619 1592 return false; 1620 1593 … … 1626 1599 source.setExcludeLineNumbers(); 1627 1600 1628 if ((m_executingScript && appendData) || ! pendingScripts.isEmpty()) {1601 if ((m_executingScript && appendData) || !m_pendingScripts.isEmpty()) { 1629 1602 // don't parse; we will do this later 1630 if ( currentPrependingSrc)1631 currentPrependingSrc->append(source);1603 if (m_currentPrependingSrc) 1604 m_currentPrependingSrc->append(source); 1632 1605 else { 1633 pendingSrc.append(source);1606 m_pendingSrc.append(source); 1634 1607 #if PRELOAD_SCANNER_ENABLED 1635 1608 if (m_preloadScanner && m_preloadScanner->inProgress() && appendData) … … 1645 1618 #endif 1646 1619 1647 if (! src.isEmpty())1648 src.append(source);1620 if (!m_src.isEmpty()) 1621 m_src.append(source); 1649 1622 else 1650 1623 setSrc(source); … … 1654 1627 return false; 1655 1628 1656 bool wasInWrite = inWrite;1657 inWrite = true;1629 bool wasInWrite = m_inWrite; 1630 m_inWrite = true; 1658 1631 1659 1632 #ifdef INSTRUMENT_LAYOUT_SCHEDULING … … 1665 1638 double startTime = currentTime(); 1666 1639 1667 Frame *frame = m_doc->frame();1640 Frame* frame = m_doc->frame(); 1668 1641 1669 1642 State state = m_state; 1670 1643 1671 while (! src.isEmpty() && (!frame || !frame->loader()->isScheduledLocationChangePending())) {1644 while (!m_src.isEmpty() && (!frame || !frame->loader()->isScheduledLocationChangePending())) { 1672 1645 if (!continueProcessing(processedCount, startTime, state)) 1673 1646 break; … … 1676 1649 checkBuffer(); 1677 1650 1678 UChar cc = * src;1651 UChar cc = *m_src; 1679 1652 1680 1653 bool wasSkipLF = state.skipLF(); … … 1683 1656 1684 1657 if (wasSkipLF && (cc == '\n')) 1685 src.advance();1658 m_src.advance(); 1686 1659 else if (state.needsSpecialWriteHandling()) { 1687 1660 // it's important to keep needsSpecialWriteHandling with the flags this block tests 1688 1661 if (state.hasEntityState()) 1689 state = parseEntity( src,dest, state, m_cBufferPos, false, state.hasTagState());1662 state = parseEntity(m_src, m_dest, state, m_cBufferPos, false, state.hasTagState()); 1690 1663 else if (state.inPlainText()) 1691 state = parseText( src, state);1664 state = parseText(m_src, state); 1692 1665 else if (state.inAnySpecial()) 1693 state = parseSpecial( src, state);1666 state = parseSpecial(m_src, state); 1694 1667 else if (state.inComment()) 1695 state = parseComment( src, state);1668 state = parseComment(m_src, state); 1696 1669 else if (state.inDoctype()) 1697 state = parseDoctype( src, state);1670 state = parseDoctype(m_src, state); 1698 1671 else if (state.inServer()) 1699 state = parseServer( src, state);1672 state = parseServer(m_src, state); 1700 1673 else if (state.inProcessingInstruction()) 1701 state = parseProcessingInstruction( src, state);1674 state = parseProcessingInstruction(m_src, state); 1702 1675 else if (state.hasTagState()) 1703 state = parseTag( src, state);1676 state = parseTag(m_src, state); 1704 1677 else if (state.startTag()) { 1705 1678 state.setStartTag(false); … … 1718 1691 state.setInProcessingInstruction(true); 1719 1692 tquote = NoQuote; 1720 state = parseProcessingInstruction( src, state);1693 state = parseProcessingInstruction(m_src, state); 1721 1694 continue; 1722 1695 … … 1724 1697 } 1725 1698 case '%': 1726 if (! brokenServer) {1699 if (!m_brokenServer) { 1727 1700 // <% server stuff, handle as comment %> 1728 1701 state.setInServer(true); 1729 1702 tquote = NoQuote; 1730 state = parseServer( src, state);1703 state = parseServer(m_src, state); 1731 1704 continue; 1732 1705 } … … 1738 1711 // Invalid tag 1739 1712 // Add as is 1740 * dest = '<';1741 dest++;1713 *m_dest = '<'; 1714 m_dest++; 1742 1715 continue; 1743 1716 } … … 1749 1722 m_cBufferPos = 0; 1750 1723 state.setTagState(TagName); 1751 state = parseTag( src, state);1752 } 1753 } else if (cc == '&' && ! src.escaped()) {1754 src.advancePastNonNewline();1755 state = parseEntity( src,dest, state, m_cBufferPos, true, state.hasTagState());1756 } else if (cc == '<' && ! src.escaped()) {1757 tagStartLineno= m_lineNumber;1758 src.advancePastNonNewline();1724 state = parseTag(m_src, state); 1725 } 1726 } else if (cc == '&' && !m_src.escaped()) { 1727 m_src.advancePastNonNewline(); 1728 state = parseEntity(m_src, m_dest, state, m_cBufferPos, true, state.hasTagState()); 1729 } else if (cc == '<' && !m_src.escaped()) { 1730 m_currentTagStartLineNumber = m_lineNumber; 1731 m_src.advancePastNonNewline(); 1759 1732 state.setStartTag(true); 1760 1733 state.setDiscardLF(false); … … 1765 1738 else { 1766 1739 // Process this LF 1767 * dest++ = '\n';1768 if (cc == '\r' && ! src.excludeLineNumbers())1740 *m_dest++ = '\n'; 1741 if (cc == '\r' && !m_src.excludeLineNumbers()) 1769 1742 m_lineNumber++; 1770 1743 } … … 1773 1746 if (cc == '\r') 1774 1747 state.setSkipLF(true); 1775 src.advance(m_lineNumber);1748 m_src.advance(m_lineNumber); 1776 1749 } else { 1777 1750 state.setDiscardLF(false); 1778 * dest++ = cc;1779 src.advancePastNonNewline();1751 *m_dest++ = cc; 1752 m_src.advancePastNonNewline(); 1780 1753 } 1781 1754 } … … 1786 1759 #endif 1787 1760 1788 inWrite = wasInWrite;1761 m_inWrite = wasInWrite; 1789 1762 1790 1763 m_state = state; 1791 1764 1792 if ( noMoreData && !inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) {1765 if (m_noMoreData && !m_inWrite && !state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) { 1793 1766 end(); // this actually causes us to be deleted 1794 1767 return true; … … 1810 1783 bool HTMLTokenizer::processingData() const 1811 1784 { 1812 return m_timer.isActive() || inWrite;1785 return m_timer.isActive() || m_inWrite; 1813 1786 } 1814 1787 … … 1836 1809 m_timer.stop(); // Only helps if assertion above fires, but do it anyway. 1837 1810 1838 if ( buffer) {1811 if (m_buffer) { 1839 1812 // parseTag is using the buffer for different matters 1840 1813 if (!m_state.hasTagState()) 1841 1814 processToken(); 1842 1815 1843 fastFree( scriptCode);1844 scriptCode = 0;1845 scriptCodeSize = scriptCodeMaxSize =scriptCodeResync = 0;1846 1847 fastFree( buffer);1848 buffer = 0;1816 fastFree(m_scriptCode); 1817 m_scriptCode = 0; 1818 m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; 1819 1820 fastFree(m_buffer); 1821 m_buffer = 0; 1849 1822 } 1850 1823 1851 1824 if (!inViewSourceMode()) 1852 parser->finished();1825 m_parser->finished(); 1853 1826 else 1854 1827 m_doc->finishedParsing(); … … 1858 1831 { 1859 1832 // do this as long as we don't find matching comment ends 1860 while ((m_state.inComment() || m_state.inServer()) && scriptCode &&scriptCodeSize) {1833 while ((m_state.inComment() || m_state.inServer()) && m_scriptCode && m_scriptCodeSize) { 1861 1834 // we've found an unmatched comment start 1862 1835 if (m_state.inComment()) 1863 brokenComments = true;1836 m_brokenComments = true; 1864 1837 else 1865 brokenServer = true;1838 m_brokenServer = true; 1866 1839 checkScriptBuffer(); 1867 scriptCode[scriptCodeSize] = 0;1868 scriptCode[scriptCodeSize + 1] = 0;1840 m_scriptCode[m_scriptCodeSize] = 0; 1841 m_scriptCode[m_scriptCodeSize + 1] = 0; 1869 1842 int pos; 1870 1843 String food; 1871 1844 if (m_state.inScript() || m_state.inStyle() || m_state.inTextArea()) 1872 food = String( scriptCode,scriptCodeSize);1845 food = String(m_scriptCode, m_scriptCodeSize); 1873 1846 else if (m_state.inServer()) { 1874 1847 food = "<"; 1875 food.append( scriptCode,scriptCodeSize);1848 food.append(m_scriptCode, m_scriptCodeSize); 1876 1849 } else { 1877 pos = find( scriptCode,scriptCodeSize, '>');1878 food = String( scriptCode + pos + 1,scriptCodeSize - pos - 1);1879 } 1880 fastFree( scriptCode);1881 scriptCode = 0;1882 scriptCodeSize = scriptCodeMaxSize =scriptCodeResync = 0;1850 pos = find(m_scriptCode, m_scriptCodeSize, '>'); 1851 food = String(m_scriptCode + pos + 1, m_scriptCodeSize - pos - 1); 1852 } 1853 fastFree(m_scriptCode); 1854 m_scriptCode = 0; 1855 m_scriptCodeSize = m_scriptCodeCapacity = m_scriptCodeResync = 0; 1883 1856 m_state.setInComment(false); 1884 1857 m_state.setInServer(false); … … 1888 1861 // this indicates we will not receive any more data... but if we are waiting on 1889 1862 // an external script to load, we can't finish parsing until that is done 1890 noMoreData = true;1891 if (! inWrite && !m_state.loadingExtScript() && !m_executingScript && !m_timer.isActive())1863 m_noMoreData = true; 1864 if (!m_inWrite && !m_state.loadingExtScript() && !m_executingScript && !m_timer.isActive()) 1892 1865 end(); // this actually causes us to be deleted 1893 1866 } … … 1895 1868 PassRefPtr<Node> HTMLTokenizer::processToken() 1896 1869 { 1897 ScriptController* jsProxy = (!m_fragment && m_doc->frame()) ? m_doc->frame()->script() : 0; 1898 if (jsProxy && m_doc->frame()->script()->isEnabled()) 1899 jsProxy->setEventHandlerLineno(tagStartLineno + 1); // Script line numbers are 1 based. 1900 if (dest > buffer) { 1901 currToken.text = StringImpl::createStrippingNullCharacters(buffer, dest - buffer); 1902 if (currToken.tagName != commentAtom) 1903 currToken.tagName = textAtom; 1904 } else if (currToken.tagName == nullAtom) { 1905 currToken.reset(); 1906 if (jsProxy) 1907 jsProxy->setEventHandlerLineno(m_lineNumber + 1); // Script line numbers are 1 based. 1870 ScriptController* scriptController = (!m_fragment && m_doc->frame()) ? m_doc->frame()->script() : 0; 1871 if (scriptController && scriptController->isEnabled()) 1872 // FIXME: Why isn't this m_currentScriptTagStartLineNumber? I suspect this is wrong. 1873 scriptController->setEventHandlerLineno(m_currentTagStartLineNumber + 1); // Script line numbers are 1 based. 1874 if (m_dest > m_buffer) { 1875 m_currentToken.text = StringImpl::createStrippingNullCharacters(m_buffer, m_dest - m_buffer); 1876 if (m_currentToken.tagName != commentAtom) 1877 m_currentToken.tagName = textAtom; 1878 } else if (m_currentToken.tagName == nullAtom) { 1879 m_currentToken.reset(); 1880 if (scriptController) 1881 scriptController->setEventHandlerLineno(m_lineNumber + 1); // Script line numbers are 1 based. 1908 1882 return 0; 1909 1883 } 1910 1884 1911 dest =buffer;1885 m_dest = m_buffer; 1912 1886 1913 1887 RefPtr<Node> n; 1914 1888 1915 1889 if (!m_parserStopped) { 1916 if (NamedMappedAttrMap* map = currToken.attrs.get())1890 if (NamedMappedAttrMap* map = m_currentToken.attrs.get()) 1917 1891 map->shrinkToLength(); 1918 1892 if (inViewSourceMode()) 1919 static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceToken(& currToken);1893 static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceToken(&m_currentToken); 1920 1894 else 1921 1895 // pass the token over to the parser, the parser DOES NOT delete the token 1922 n = parser->parseToken(&currToken);1923 } 1924 currToken.reset();1925 if ( jsProxy)1926 jsProxy->setEventHandlerLineno(0);1896 n = m_parser->parseToken(&m_currentToken); 1897 } 1898 m_currentToken.reset(); 1899 if (scriptController) 1900 scriptController->setEventHandlerLineno(0); 1927 1901 1928 1902 return n.release(); … … 1934 1908 static_cast<HTMLViewSourceDocument*>(m_doc)->addViewSourceDoctypeToken(&m_doctypeToken); 1935 1909 else 1936 parser->parseDoctypeToken(&m_doctypeToken);1910 m_parser->parseDoctypeToken(&m_doctypeToken); 1937 1911 } 1938 1912 1939 1913 HTMLTokenizer::~HTMLTokenizer() 1940 1914 { 1941 ASSERT(! inWrite);1915 ASSERT(!m_inWrite); 1942 1916 reset(); 1943 delete parser;1944 1917 } 1945 1918 … … 1947 1920 void HTMLTokenizer::enlargeBuffer(int len) 1948 1921 { 1949 int newSize = max( size * 2, size + len);1950 int oldOffset = dest -buffer;1951 buffer = static_cast<UChar*>(fastRealloc(buffer, newSize * sizeof(UChar)));1952 dest =buffer + oldOffset;1953 size = newSize;1922 int newSize = max(m_bufferSize * 2, m_bufferSize + len); 1923 int oldOffset = m_dest - m_buffer; 1924 m_buffer = static_cast<UChar*>(fastRealloc(m_buffer, newSize * sizeof(UChar))); 1925 m_dest = m_buffer + oldOffset; 1926 m_bufferSize = newSize; 1954 1927 } 1955 1928 1956 1929 void HTMLTokenizer::enlargeScriptBuffer(int len) 1957 1930 { 1958 int newSize = max( scriptCodeMaxSize * 2, scriptCodeMaxSize+ len);1959 scriptCode = static_cast<UChar*>(fastRealloc(scriptCode, newSize * sizeof(UChar)));1960 scriptCodeMaxSize= newSize;1931 int newSize = max(m_scriptCodeCapacity * 2, m_scriptCodeCapacity + len); 1932 m_scriptCode = static_cast<UChar*>(fastRealloc(m_scriptCode, newSize * sizeof(UChar))); 1933 m_scriptCodeCapacity = newSize; 1961 1934 } 1962 1935 … … 1976 1949 #endif 1977 1950 1978 ASSERT(! pendingScripts.isEmpty());1951 ASSERT(!m_pendingScripts.isEmpty()); 1979 1952 1980 1953 // Make external scripts wait for external stylesheets. … … 1985 1958 1986 1959 bool finished = false; 1987 while (!finished && pendingScripts.first()->isLoaded()) {1988 CachedScript *cs =pendingScripts.first().get();1989 pendingScripts.removeFirst();1960 while (!finished && m_pendingScripts.first()->isLoaded()) { 1961 CachedScript* cs = m_pendingScripts.first().get(); 1962 m_pendingScripts.removeFirst(); 1990 1963 ASSERT(cache()->disabled() || cs->accessCount() > 0); 1991 1964 … … 1998 1971 bool errorOccurred = cs->errorOccurred(); 1999 1972 cs->removeClient(this); 2000 RefPtr<Node> n = scriptNode.release();1973 RefPtr<Node> n = m_scriptNode.release(); 2001 1974 2002 1975 #ifdef INSTRUMENT_LAYOUT_SCHEDULING … … 2013 1986 } 2014 1987 2015 // The state of pendingScripts.isEmpty() can change inside the scriptExecution()1988 // The state of m_pendingScripts.isEmpty() can change inside the scriptExecution() 2016 1989 // call above, so test afterwards. 2017 finished = pendingScripts.isEmpty();1990 finished = m_pendingScripts.isEmpty(); 2018 1991 if (finished) { 2019 1992 m_state.setLoadingExtScript(false); … … 2026 1999 // 'm_requestingScript' is true when we are called synchronously from 2027 2000 // scriptHandler(). In that case scriptHandler() will take care 2028 // of pendingSrc.2001 // of m_pendingSrc. 2029 2002 if (!m_requestingScript) { 2030 SegmentedString rest = pendingSrc;2031 pendingSrc.clear();2003 SegmentedString rest = m_pendingSrc; 2004 m_pendingSrc.clear(); 2032 2005 write(rest, false); 2033 2006 // we might be deleted at this point, do not access any members. … … 2041 2014 } 2042 2015 2043 void HTMLTokenizer::setSrc(const SegmentedString &source)2044 { 2045 src = source;2016 void HTMLTokenizer::setSrc(const SegmentedString& source) 2017 { 2018 m_src = source; 2046 2019 } 2047 2020 -
trunk/WebCore/html/HTMLTokenizer.h
r36109 r38327 41 41 class Document; 42 42 class HTMLDocument; 43 class HTMLScriptElement; 43 44 class HTMLViewSourceDocument; 44 45 class FrameView; … … 53 54 * text contains the text. 54 55 */ 55 class Token { 56 public: 57 Token() : beginTag(true), flat(false), brokenXMLStyle(false), m_sourceInfo(0) { } 56 struct Token { 57 Token() 58 : beginTag(true) 59 , selfClosingTag(false) 60 , brokenXMLStyle(false) 61 , m_sourceInfo(0) 62 { } 58 63 ~Token() { } 59 64 … … 69 74 tagName = nullAtom; 70 75 beginTag = true; 71 flat= false;76 selfClosingTag = false; 72 77 brokenXMLStyle = false; 73 78 if (m_sourceInfo) … … 81 86 AtomicString tagName; 82 87 bool beginTag; 83 bool flat;88 bool selfClosingTag; 84 89 bool brokenXMLStyle; 85 90 OwnPtr<Vector<UChar> > m_sourceInfo; … … 144 149 virtual int columnNumber() const { return 1; } 145 150 146 bool processingContentWrittenByScript() const { return src.excludeLineNumbers(); }151 bool processingContentWrittenByScript() const { return m_src.excludeLineNumbers(); } 147 152 148 153 virtual void executeScriptsWaitingForStylesheets(); 149 154 150 155 virtual bool isHTMLTokenizer() const { return true; } 151 HTMLParser* htmlParser() const { return parser; }156 HTMLParser* htmlParser() const { return m_parser.get(); } 152 157 153 158 private: … … 170 175 State parseSpecial(SegmentedString&, State); 171 176 State parseTag(SegmentedString&, State); 172 State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& _cBufferPos, bool start, bool parsingTag);177 State parseEntity(SegmentedString&, UChar*& dest, State, unsigned& cBufferPos, bool start, bool parsingTag); 173 178 State parseProcessingInstruction(SegmentedString&, State); 174 179 State scriptHandler(State); … … 180 185 inline void checkBuffer(int len = 10) 181 186 { 182 if (( dest - buffer) > size - len)187 if ((m_dest - m_buffer) > m_bufferSize - len) 183 188 enlargeBuffer(len); 184 189 } … … 186 191 inline void checkScriptBuffer(int len = 10) 187 192 { 188 if ( scriptCodeSize + len >= scriptCodeMaxSize)193 if (m_scriptCodeSize + len >= m_scriptCodeCapacity) 189 194 enlargeScriptBuffer(len); 190 195 } … … 198 203 199 204 // from CachedResourceClient 200 void notifyFinished(CachedResource *finishedObj);205 void notifyFinished(CachedResource*); 201 206 202 207 // Internal buffers 203 208 /////////////////// 204 UChar* buffer; 205 UChar* dest; 206 207 Token currToken; 208 209 // the size of buffer 210 int size; 209 UChar* m_buffer; 210 int m_bufferSize; 211 UChar* m_dest; 212 213 Token m_currentToken; 211 214 212 215 // Tokenizer flags … … 335 338 int m_doctypeSecondarySearchCount; 336 339 337 bool brokenServer;340 bool m_brokenServer; 338 341 339 342 // Name of an attribute that we just scanned. 340 AtomicString attrName;343 AtomicString m_attrName; 341 344 342 345 // Used to store the code of a scripting sequence 343 UChar* scriptCode;346 UChar* m_scriptCode; 344 347 // Size of the script sequenze stored in @ref #scriptCode 345 int scriptCodeSize;348 int m_scriptCodeSize; 346 349 // Maximal size that can be stored in @ref #scriptCode 347 int scriptCodeMaxSize;350 int m_scriptCodeCapacity; 348 351 // resync point of script code size 349 int scriptCodeResync;352 int m_scriptCodeResync; 350 353 351 354 // Stores characters if we are scanning for a string like "</script>" … … 355 358 int searchCount; 356 359 // the stopper string 357 const char* searchStopper; 358 // the stopper len 359 int searchStopperLen; 360 const char* m_searchStopper; 361 int m_searchStopperLength; 360 362 361 363 // if no more data is coming, just parse what we have (including ext scripts that 362 364 // may be still downloading) and finish 363 bool noMoreData;365 bool m_noMoreData; 364 366 // URL to get source code of script from 365 String scriptSrc;366 String scriptSrcCharset;367 String m_scriptTagSrcAttrValue; 368 String m_scriptTagCharsetAttrValue; 367 369 // the HTML code we will parse after the external script we are waiting for has loaded 368 SegmentedString pendingSrc;370 SegmentedString m_pendingSrc; 369 371 370 372 // the HTML code we will parse after this particular script has 371 373 // loaded, but before all pending HTML 372 SegmentedString *currentPrependingSrc;374 SegmentedString* m_currentPrependingSrc; 373 375 374 376 // true if we are executing a script while parsing a document. This causes the parsing of 375 377 // the output of the script to be postponed until after the script has finished executing 376 378 int m_executingScript; 377 Deque<CachedResourceHandle<CachedScript> > pendingScripts;378 RefPtr< Node>scriptNode;379 Deque<CachedResourceHandle<CachedScript> > m_pendingScripts; 380 RefPtr<HTMLScriptElement> m_scriptNode; 379 381 380 382 bool m_requestingScript; … … 383 385 // if we found one broken comment, there are most likely others as well 384 386 // store a flag to get rid of the O(n^2) behaviour in such a case. 385 bool brokenComments;387 bool m_brokenComments; 386 388 // current line number 387 389 int m_lineNumber; 388 // line number at which the current <script> started 389 int scriptStartLineno; 390 int tagStartLineno; 390 int m_currentScriptTagStartLineNumber; 391 int m_currentTagStartLineNumber; 391 392 392 393 double m_tokenizerTimeDelay; … … 400 401 // we'll just make it large enough to handle all imaginable cases. 401 402 #define CBUFLEN 1024 402 UChar cBuffer[CBUFLEN + 2];403 UChar m_cBuffer[CBUFLEN + 2]; 403 404 unsigned int m_cBufferPos; 404 405 405 SegmentedString src;406 SegmentedString m_src; 406 407 Document* m_doc; 407 HTMLParser*parser;408 bool inWrite;408 OwnPtr<HTMLParser> m_parser; 409 bool m_inWrite; 409 410 bool m_fragment; 410 411 -
trunk/WebCore/html/HTMLViewSourceDocument.h
r37133 r38327 31 31 32 32 class DoctypeToken; 33 classToken;33 struct Token; 34 34 35 35 class HTMLViewSourceDocument : public HTMLDocument { -
trunk/WebCore/rendering/RenderBlock.cpp
r38227 r38327 2485 2485 2486 2486 if (applyTextIndent && m_firstLine && style()->direction() == LTR) { 2487 int cw =0;2487 int cw = 0; 2488 2488 if (style()->textIndent().isPercent()) 2489 2489 cw = containingBlock()->availableWidth(); … … 2491 2491 } 2492 2492 2493 //kdDebug( 6040 ) << "leftOffset(" << y << ") = " << left << endl;2494 2493 return left; 2495 2494 } … … 2523 2522 2524 2523 if (applyTextIndent && m_firstLine && style()->direction() == RTL) { 2525 int cw =0;2524 int cw = 0; 2526 2525 if (style()->textIndent().isPercent()) 2527 2526 cw = containingBlock()->availableWidth(); … … 2529 2528 } 2530 2529 2531 //kdDebug( 6040 ) << "rightOffset(" << y << ") = " << right << endl;2532 2530 return right; 2533 2531 } … … 2536 2534 RenderBlock::lineWidth(int y) const 2537 2535 { 2538 //kdDebug( 6040 ) << "lineWidth(" << y << ")=" << rightOffset(y) - leftOffset(y) << endl;2539 2536 int result = rightOffset(y) - leftOffset(y); 2540 2537 return (result < 0) ? 0 : result; -
trunk/WebCore/xml/XSLTProcessor.cpp
r38065 r38327 37 37 #include "FrameView.h" 38 38 #include "HTMLDocument.h" 39 #include "HTMLTokenizer.h" 39 #include "HTMLTokenizer.h" // for parseHTMLDocumentFragment 40 40 #include "Page.h" 41 41 #include "ResourceError.h"
Note: See TracChangeset
for help on using the changeset viewer.