Chromium Code Reviews| Index: Source/platform/BorderImageLength.h |
| diff --git a/Source/platform/BorderImageLength.h b/Source/platform/BorderImageLength.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..436a36f1f1b97bd40712b309db8090cf51e89f71 |
| --- /dev/null |
| +++ b/Source/platform/BorderImageLength.h |
| @@ -0,0 +1,81 @@ |
| +/* |
| + * Copyright (c) 2013, Opera Software ASA. All rights reserved. |
| + * |
| + * Redistribution and use in source and binary forms, with or without |
| + * modification, are permitted provided that the following conditions are |
| + * met: |
| + * |
| + * * Redistributions of source code must retain the above copyright |
| + * notice, this list of conditions and the following disclaimer. |
| + * * Redistributions in binary form must reproduce the above |
| + * copyright notice, this list of conditions and the following disclaimer |
| + * in the documentation and/or other materials provided with the |
| + * distribution. |
| + * * Neither the name of Opera Software ASA nor the names of its |
| + * contributors may be used to endorse or promote products derived from |
| + * this software without specific prior written permission. |
| + * |
| + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| + */ |
| + |
| +#ifndef BorderImageLength_h |
| +#define BorderImageLength_h |
| + |
| +#include "platform/Length.h" |
| + |
| +namespace WebCore { |
| + |
| +class PLATFORM_EXPORT BorderImageLength { |
|
Julien - ping for review
2013/11/04 16:31:40
I like the new name.
It may be worth adding a com
|
| +public: |
| + BorderImageLength() |
| + { |
| + } |
| + |
| + BorderImageLength(double number) |
| + : m_length(number, Relative) |
| + { |
| + } |
| + |
| + BorderImageLength(const Length& length) |
| + : m_length(length) |
| + { |
| + } |
| + |
| + bool isNumber() const { return m_length.isRelative(); } |
| + bool isLength() const { return !isNumber(); } |
| + |
| + const Length& length() const { ASSERT(isLength()); return m_length; } |
| + Length& length() { ASSERT(isLength()); return m_length; } |
| + |
| + double number() const { ASSERT(isNumber()); return m_length.value(); } |
| + |
| + // FIXME: Remove when the conversion to LengthOrMultipleOfBorderWidthBox is complete |
|
Julien - ping for review
2013/11/04 16:31:40
Nit: Sentences end with a dot :)
(I haven't repea
|
| + Length deprecatedUnifiedLength() const { return m_length; } |
| + |
| + bool operator==(const BorderImageLength& o) const |
| + { |
| + return m_length == o.m_length; |
| + } |
| + |
| + bool isZero() const |
| + { |
| + return m_length.isZero(); |
| + } |
| + |
| +private: |
| + Length m_length; |
| +}; |
| + |
| +} // namespace WebCore |
| + |
| +#endif // BorderImageLength_h |