| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 #ifndef InspectorStyleTextEditor_h | 25 #ifndef InspectorStyleTextEditor_h |
| 26 #define InspectorStyleTextEditor_h | 26 #define InspectorStyleTextEditor_h |
| 27 | 27 |
| 28 #include "CSSPropertySourceData.h" | 28 #include "CSSPropertySourceData.h" |
| 29 | 29 |
| 30 #include <wtf/Vector.h> | 30 #include <wtf/Vector.h> |
| 31 #include <wtf/text/WTFString.h> | 31 #include <wtf/text/WTFString.h> |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace WebCore { |
| 34 | 34 |
| 35 #if ENABLE(INSPECTOR) | |
| 36 | 35 |
| 37 struct InspectorStyleProperty; | 36 struct InspectorStyleProperty; |
| 38 struct SourceRange; | 37 struct SourceRange; |
| 39 | 38 |
| 40 typedef std::pair<String, String> NewLineAndWhitespace; | 39 typedef std::pair<String, String> NewLineAndWhitespace; |
| 41 | 40 |
| 42 class InspectorStyleTextEditor { | 41 class InspectorStyleTextEditor { |
| 43 public: | 42 public: |
| 44 InspectorStyleTextEditor(Vector<InspectorStyleProperty>* allProperties, Vect
or<InspectorStyleProperty>* disabledProperties, const String& styleText, const N
ewLineAndWhitespace& format); | 43 InspectorStyleTextEditor(Vector<InspectorStyleProperty>* allProperties, Vect
or<InspectorStyleProperty>* disabledProperties, const String& styleText, const N
ewLineAndWhitespace& format); |
| 45 void insertProperty(unsigned index, const String& propertyText, unsigned sty
leBodyLength); | 44 void insertProperty(unsigned index, const String& propertyText, unsigned sty
leBodyLength); |
| 46 void replaceProperty(unsigned index, const String& newText); | 45 void replaceProperty(unsigned index, const String& newText); |
| 47 void removeProperty(unsigned index); | 46 void removeProperty(unsigned index); |
| 48 void enableProperty(unsigned index); | 47 void enableProperty(unsigned index); |
| 49 void disableProperty(unsigned index); | 48 void disableProperty(unsigned index); |
| 50 const String& styleText() const { return m_styleText; } | 49 const String& styleText() const { return m_styleText; } |
| 51 | 50 |
| 52 private: | 51 private: |
| 53 unsigned disabledIndexByOrdinal(unsigned ordinal, bool canUseSubsequent); | 52 unsigned disabledIndexByOrdinal(unsigned ordinal, bool canUseSubsequent); |
| 54 void shiftDisabledProperties(unsigned fromIndex, long delta); | 53 void shiftDisabledProperties(unsigned fromIndex, long delta); |
| 55 void internalReplaceProperty(const InspectorStyleProperty&, const String& ne
wText, SourceRange* removedRange, unsigned* insertedLength); | 54 void internalReplaceProperty(const InspectorStyleProperty&, const String& ne
wText, SourceRange* removedRange, unsigned* insertedLength); |
| 56 | 55 |
| 57 Vector<InspectorStyleProperty>* m_allProperties; | 56 Vector<InspectorStyleProperty>* m_allProperties; |
| 58 Vector<InspectorStyleProperty>* m_disabledProperties; | 57 Vector<InspectorStyleProperty>* m_disabledProperties; |
| 59 String m_styleText; | 58 String m_styleText; |
| 60 const std::pair<String, String> m_format; | 59 const std::pair<String, String> m_format; |
| 61 }; | 60 }; |
| 62 | 61 |
| 63 #endif | |
| 64 | 62 |
| 65 } // namespace WebCore | 63 } // namespace WebCore |
| 66 | 64 |
| 67 #endif // !defined(InspectorStyleTextEditor_h) | 65 #endif // !defined(InspectorStyleTextEditor_h) |
| OLD | NEW |