Changeset 140467 in webkit
- Timestamp:
- Jan 22, 2013 2:12:52 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r140465 r140467 1 2013-01-22 Tony Gentilcore <tonyg@chromium.org> 2 3 Make BackgroundHTMLParser track line/column numbers 4 https://bugs.webkit.org/show_bug.cgi?id=107561 5 6 Reviewed by Adam Barth. 7 8 No new tests because covered by existing fast/parser tests. 9 10 * html/parser/BackgroundHTMLParser.cpp: 11 (WebCore::BackgroundHTMLParser::pumpTokenizer): 12 * html/parser/CompactHTMLToken.cpp: 13 (WebCore::CompactHTMLToken::CompactHTMLToken): 14 * html/parser/CompactHTMLToken.h: 15 (CompactHTMLToken): 16 (WebCore::CompactHTMLToken::textPosition): 17 * html/parser/HTMLDocumentParser.cpp: 18 (WebCore::HTMLDocumentParser::didReceiveTokensFromBackgroundParser): 19 (WebCore::HTMLDocumentParser::lineNumber): 20 (WebCore::HTMLDocumentParser::textPosition): 21 * html/parser/HTMLDocumentParser.h: 22 (HTMLDocumentParser): 23 1 24 2013-01-22 Alec Flett <alecflett@chromium.org> 2 25 -
trunk/Source/WebCore/html/parser/BackgroundHTMLParser.cpp
r140446 r140467 38 38 #include <wtf/MainThread.h> 39 39 #include <wtf/Vector.h> 40 #include <wtf/text/TextPosition.h> 40 41 41 42 namespace WebCore { … … 171 172 172 173 while (m_tokenizer->nextToken(m_input, m_token)) { 173 m_pendingTokens.append(CompactHTMLToken(m_token ));174 m_pendingTokens.append(CompactHTMLToken(m_token, TextPosition(m_input.currentLine(), m_input.currentColumn()))); 174 175 m_token.clear(); 175 176 -
trunk/Source/WebCore/html/parser/CompactHTMLToken.cpp
r140453 r140467 38 38 String name; 39 39 Vector<CompactAttribute> vector; 40 TextPosition textPosition; 40 41 }; 41 42 42 43 COMPILE_ASSERT(sizeof(CompactHTMLToken) == sizeof(SameSizeAsCompactHTMLToken), CompactHTMLToken_should_stay_small); 43 44 44 CompactHTMLToken::CompactHTMLToken(const HTMLToken& token )45 CompactHTMLToken::CompactHTMLToken(const HTMLToken& token, const TextPosition& textPosition) 45 46 : m_type(token.type()) 47 , m_textPosition(textPosition) 46 48 { 47 49 switch (m_type) { -
trunk/Source/WebCore/html/parser/CompactHTMLToken.h
r140453 r140467 33 33 #include <wtf/RefPtr.h> 34 34 #include <wtf/Vector.h> 35 #include <wtf/text/TextPosition.h> 35 36 #include <wtf/text/WTFString.h> 36 37 … … 57 58 class CompactHTMLToken { 58 59 public: 59 explicit CompactHTMLToken(const HTMLToken& );60 explicit CompactHTMLToken(const HTMLToken&, const TextPosition&); 60 61 61 62 bool isSafeToSendToAnotherThread() const; … … 65 66 bool selfClosing() const { return m_selfClosing; } 66 67 const Vector<CompactAttribute>& attributes() const { return m_attributes; } 68 const TextPosition& textPosition() const { return m_textPosition; } 67 69 68 70 // There is only 1 DOCTYPE token per document, so to avoid increasing the … … 77 79 String m_data; // "name", "characters", or "data" depending on m_type 78 80 Vector<CompactAttribute> m_attributes; 81 TextPosition m_textPosition; 79 82 }; 80 83 -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r140402 r140467 277 277 278 278 // FIXME: Call m_xssAuditor.filterToken(*it). 279 m_textPosition = it->textPosition(); 279 280 constructTreeFromCompactHTMLToken(*it); 280 281 … … 614 615 OrdinalNumber HTMLDocumentParser::lineNumber() const 615 616 { 617 #if ENABLE(THREADED_HTML_PARSER) 618 if (shouldUseThreading()) 619 return m_textPosition.m_line; 620 #endif 621 616 622 return m_input.current().currentLine(); 617 623 } … … 619 625 TextPosition HTMLDocumentParser::textPosition() const 620 626 { 627 #if ENABLE(THREADED_HTML_PARSER) 628 if (shouldUseThreading()) 629 return m_textPosition; 630 #endif 631 621 632 const SegmentedString& currentString = m_input.current(); 622 633 OrdinalNumber line = currentString.currentLine(); -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r140055 r140467 39 39 #include "XSSAuditor.h" 40 40 #include <wtf/OwnPtr.h> 41 #include <wtf/text/TextPosition.h> 41 42 42 43 namespace WebCore { … … 164 165 OwnPtr<HTMLParserScheduler> m_parserScheduler; 165 166 HTMLSourceTracker m_sourceTracker; 167 TextPosition m_textPosition; 166 168 XSSAuditor m_xssAuditor; 167 169
Note: See TracChangeset
for help on using the changeset viewer.