| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef SKY_ENGINE_CORE_CSS_CSSTOLENGTHCONVERSIONDATA_H_ | 31 #ifndef DartExceptionState_h |
| 32 #define SKY_ENGINE_CORE_CSS_CSSTOLENGTHCONVERSIONDATA_H_ | 32 #define DartExceptionState_h |
| 33 | 33 |
| 34 #include "sky/engine/wtf/Assertions.h" | 34 #include "bindings/common/ExceptionState.h" |
| 35 #include "sky/engine/wtf/Noncopyable.h" | 35 #include <dart_api.h> |
| 36 | 36 |
| 37 namespace blink { | 37 namespace blink { |
| 38 | 38 |
| 39 class RenderStyle; | 39 class DartExceptionState : public ExceptionState { |
| 40 class RenderView; | 40 WTF_MAKE_NONCOPYABLE(DartExceptionState); |
| 41 public: |
| 42 DartExceptionState() : ExceptionState(), m_exception(0) { } |
| 41 | 43 |
| 42 class CSSToLengthConversionData { | 44 ~DartExceptionState() |
| 43 public: | 45 { |
| 44 CSSToLengthConversionData(const RenderStyle* currStyle, const RenderView*, b
ool computingFontSize = false); | 46 ASSERT(!m_exception); |
| 47 clearException(); |
| 48 } |
| 45 | 49 |
| 46 const RenderStyle& style() const { return *m_style; } | 50 virtual void throwDOMException(const ExceptionCode&, const String& message
= String()); |
| 47 bool computingFontSize() const { return m_computingFontSize; } | 51 virtual void throwTypeError(const String& message = String()); |
| 52 virtual void throwSecurityError(const String& sanitizedMessage, const String
& unsanitizedMessage = String()); |
| 53 virtual void rethrowV8Exception(v8::Handle<v8::Value> value); |
| 54 virtual void clearException(); |
| 55 virtual void throwException(); |
| 56 virtual void throwRangeError(const String& message = String()) OVERRIDE; |
| 57 virtual ScriptPromise reject(ScriptState*) OVERRIDE FINAL; |
| 48 | 58 |
| 49 // Accessing these marks the style as having viewport units | 59 Dart_Handle toDart(Dart_NativeArguments args, bool autoDartScope = false); |
| 50 double viewportWidthPercent() const; | |
| 51 double viewportHeightPercent() const; | |
| 52 double viewportMinPercent() const; | |
| 53 double viewportMaxPercent() const; | |
| 54 | |
| 55 void setStyle(const RenderStyle* style) { m_style = style; } | |
| 56 | 60 |
| 57 private: | 61 private: |
| 58 const RenderStyle* m_style; | 62 void throwDartCoreError(const String& className, const String& message, cons
t ExceptionCode& ec); |
| 59 float m_viewportWidth; | 63 void setException(const ExceptionCode&, const String& message = String()); |
| 60 float m_viewportHeight; | 64 |
| 61 bool m_computingFontSize; | 65 Dart_PersistentHandle m_exception; |
| 62 }; | 66 }; |
| 63 | 67 |
| 64 } // namespace blink | 68 } // namespace blink |
| 65 | 69 |
| 66 #endif // SKY_ENGINE_CORE_CSS_CSSTOLENGTHCONVERSIONDATA_H_ | 70 #endif // DartExceptionState_h |
| OLD | NEW |