forked from mirrors/gecko-dev
		
	 f6bb5f8a6c
			
		
	
	
		f6bb5f8a6c
		
	
	
	
	
		
			
			This new InspectorCSSParser makes use of the cssparser crate so DevTools end up using the same code as the CSS engine. At the moment, we can't get the token start and end offsets, so we create a JS wrapper class to compute them in JS. This might be removed if we get a way to retrieve utf16 position from the cssparser. The existing lexer xpcshell test is modified so it can run against both js-based and rust-based lexers. Differential Revision: https://phabricator.services.mozilla.com/D202909
		
			
				
	
	
		
			47 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
	
		
			1.4 KiB
		
	
	
	
		
			C++
		
	
	
	
	
	
| /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 | |
| /* vim: set ts=8 sts=2 et sw=2 tw=80: */
 | |
| /* This Source Code Form is subject to the terms of the Mozilla Public
 | |
|  * License, v. 2.0. If a copy of the MPL was not distributed with this
 | |
|  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 | |
| 
 | |
| #ifndef InspectorCSSParser_h___
 | |
| #define InspectorCSSParser_h___
 | |
| 
 | |
| #include "mozilla/dom/InspectorUtilsBinding.h"
 | |
| #include "mozilla/dom/NonRefcountedDOMObject.h"
 | |
| 
 | |
| namespace mozilla {
 | |
| 
 | |
| class StyleParserState;
 | |
| 
 | |
| namespace dom {
 | |
| 
 | |
| class InspectorCSSParser final : public NonRefcountedDOMObject {
 | |
|  public:
 | |
|   explicit InspectorCSSParser(const nsACString&);
 | |
|   // The WebIDL constructor.
 | |
|   static UniquePtr<InspectorCSSParser> Constructor(const GlobalObject& aGlobal,
 | |
|                                                    const nsACString& aText);
 | |
| 
 | |
|   ~InspectorCSSParser();
 | |
| 
 | |
|   bool WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto,
 | |
|                   JS::MutableHandle<JSObject*> aReflector) {
 | |
|     return InspectorCSSParser_Binding::Wrap(aCx, this, aGivenProto, aReflector);
 | |
|   }
 | |
| 
 | |
|   uint32_t LineNumber() const;
 | |
|   uint32_t ColumnNumber() const;
 | |
|   void NextToken(Nullable<InspectorCSSToken>& aResult);
 | |
| 
 | |
|  private:
 | |
|   const nsCString mInput;
 | |
|   StyleParserState* mParserState;
 | |
|   uint32_t mLineNumber = 0;
 | |
|   uint32_t mColumnNumber = 0;
 | |
| };
 | |
| 
 | |
| }  // namespace dom
 | |
| }  // namespace mozilla
 | |
| 
 | |
| #endif /* InspectorCSSParser_h___ */
 |