-
caseq@chromium.org authored
Reviewed by Adam Barth. HTML parser should provide script column position within HTML document to JavaScript engine https://bugs.webkit.org/show_bug.cgi?id=45271 Adds TextPosition* classes -- a structure that stores line/column/generation level coordinates inside text document. Adds *BasedNumber classes -- typesafe int wrappers that emphasize whether int number is used as zero-based or one-based. * GNUmakefile.am: * JavaScriptCore.gypi: * JavaScriptCore.xcodeproj/project.pbxproj: * wtf/text/TextPosition.h: Added. (WTF::TextPosition::TextPosition): (WTF::TextPosition::minimumPosition): (WTF::TextPosition::belowRangePosition): (WTF::ZeroBasedNumber::fromZeroBasedInt): (WTF::ZeroBasedNumber::ZeroBasedNumber): (WTF::ZeroBasedNumber::zeroBasedInt): (WTF::ZeroBasedNumber::base): (WTF::ZeroBasedNumber::belowBase): (WTF::OneBasedNumber::fromOneBasedInt): (WTF::OneBasedNumber::OneBasedNumber): (WTF::OneBasedNumber::oneBasedInt): (WTF::OneBasedNumber::convertAsZeroBasedInt): (WTF::OneBasedNumber::convertToZeroBased): (WTF::OneBasedNumber::base): (WTF::OneBasedNumber::belowBase): (WTF::toZeroBasedTextPosition): (WTF::toOneBasedTextPosition): (WTF::ZeroBasedNumber::convertToOneBased): 2010-10-25 Peter Rybin <peter.rybin@gmail.com> Reviewed by Adam Barth. HTML parser should provide script column position within HTML document to JavaScript engine https://bugs.webkit.org/show_bug.cgi?id=45271 Replaces line number with TextPosition struct so that script engine gets script starting line/column. * ForwardingHeaders/wtf/text/TextPosition.h: Added. * bindings/js/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): * bindings/v8/ScheduledAction.cpp: (WebCore::ScheduledAction::ScheduledAction): * bindings/v8/ScriptController.cpp: (WebCore::ScriptController::eventHandlerPosition): * bindings/v8/ScriptController.h: * bindings/v8/ScriptEventListener.cpp: (WebCore::createAttributeEventListener): * bindings/v8/ScriptSourceCode.h: (WebCore::ScriptSourceCode::ScriptSourceCode): (WebCore::ScriptSourceCode::startLine): (WebCore::ScriptSourceCode::startPosition): * bindings/v8/V8LazyEventListener.cpp: (WebCore::V8LazyEventListener::V8LazyEventListener): (WebCore::V8LazyEventListener::prepareListenerObject): * bindings/v8/V8LazyEventListener.h: (WebCore::V8LazyEventListener::create): * bindings/v8/V8Proxy.cpp: (WebCore::V8Proxy::compileScript): (WebCore::V8Proxy::evaluate): (WebCore::V8Proxy::runScript): * bindings/v8/V8Proxy.h: * bindings/v8/WorkerContextExecutionProxy.cpp: (WebCore::WorkerContextExecutionProxy::evaluate): (WebCore::WorkerContextExecutionProxy::runScript): * bindings/v8/WorkerContextExecutionProxy.h: * bindings/v8/WorkerScriptController.cpp: (WebCore::WorkerScriptController::evaluate): * dom/PendingScript.cpp: (WebCore::PendingScript::releaseElementAndClear): * dom/PendingScript.h: (WebCore::PendingScript::PendingScript): (WebCore::PendingScript::operator=): (WebCore::PendingScript::startingPosition): * dom/ScriptableDocumentParser.h: * dom/XMLDocumentParser.h: * dom/XMLDocumentParserLibxml2.cpp: (WebCore::XMLDocumentParser::XMLDocumentParser): (WebCore::XMLDocumentParser::startElementNs): (WebCore::XMLDocumentParser::endElementNs): (WebCore::XMLDocumentParser::lineNumber): (WebCore::XMLDocumentParser::columnNumber): (WebCore::XMLDocumentParser::textPosition): (WebCore::XMLDocumentParser::textPositionOneBased): * dom/XMLDocumentParserQt.cpp: (WebCore::XMLDocumentParser::XMLDocumentParser): (WebCore::XMLDocumentParser::textPosition): (WebCore::XMLDocumentParser::parseStartElement): (WebCore::XMLDocumentParser::parseEndElement): * html/parser/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::runScriptsForPausedTreeBuilder): (WebCore::HTMLDocumentParser::textPosition): * html/parser/HTMLDocumentParser.h: * html/parser/HTMLScriptRunner.cpp: (WebCore::HTMLScriptRunner::sourceFromPendingScript): (WebCore::HTMLScriptRunner::execute): (WebCore::HTMLScriptRunner::runScript): * html/parser/HTMLScriptRunner.h: * html/parser/HTMLTreeBuilder.cpp: (WebCore::uninitializedPositionValue1): (WebCore::HTMLTreeBuilder::HTMLTreeBuilder): (WebCore::HTMLTreeBuilder::takeScriptToProcess): (WebCore::HTMLTreeBuilder::processEndTag): (WebCore::HTMLTreeBuilder::processScriptStartTag): * html/parser/HTMLTreeBuilder.h: 2010-10-25 Peter Rybin <peter.rybin@gmail.com> Reviewed by Adam Barth. HTML parser should provide script column position within HTML document to JavaScript engine https://bugs.webkit.org/show_bug.cgi?id=45271 Replaces script line number with TextPosition structure. * src/WebFrameImpl.cpp: (WebKit::WebFrameImpl::executeScript): (WebKit::WebFrameImpl::executeScriptInIsolatedWorld): (WebKit::WebFrameImpl::executeScriptAndReturnValue): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@70451 268f45cc-cd09-0410-ab3c-d52691b4dbfc
aaa10a8d