| OLD | NEW |
| 1 /* | 1 /* |
| 2 * CSS Media Query | 2 * CSS Media Query |
| 3 * | 3 * |
| 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. | 4 * Copyright (C) 2006 Kimmo Kinnunen <kimmo.t.kinnunen@nokia.com>. |
| 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). | 5 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
| 6 * Copyright (C) 2013 Apple Inc. All rights reserved. | 6 * Copyright (C) 2013 Apple Inc. All rights reserved. |
| 7 * | 7 * |
| 8 * Redistribution and use in source and binary forms, with or without | 8 * Redistribution and use in source and binary forms, with or without |
| 9 * modification, are permitted provided that the following conditions | 9 * modification, are permitted provided that the following conditions |
| 10 * are met: | 10 * are met: |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 , m_expValue(other.expValue()) | 196 , m_expValue(other.expValue()) |
| 197 { | 197 { |
| 198 } | 198 } |
| 199 | 199 |
| 200 MediaQueryExp::MediaQueryExp(const String& mediaFeature, const MediaQueryExpValu
e& expValue) | 200 MediaQueryExp::MediaQueryExp(const String& mediaFeature, const MediaQueryExpValu
e& expValue) |
| 201 : m_mediaFeature(mediaFeature) | 201 : m_mediaFeature(mediaFeature) |
| 202 , m_expValue(expValue) | 202 , m_expValue(expValue) |
| 203 { | 203 { |
| 204 } | 204 } |
| 205 | 205 |
| 206 PassOwnPtrWillBeRawPtr<MediaQueryExp> MediaQueryExp::createIfValid(const String&
mediaFeature, const Vector<CSSParserToken, 4>& tokenList) | 206 RawPtr<MediaQueryExp> MediaQueryExp::createIfValid(const String& mediaFeature, c
onst Vector<CSSParserToken, 4>& tokenList) |
| 207 { | 207 { |
| 208 ASSERT(!mediaFeature.isNull()); | 208 ASSERT(!mediaFeature.isNull()); |
| 209 | 209 |
| 210 MediaQueryExpValue expValue; | 210 MediaQueryExpValue expValue; |
| 211 String lowerMediaFeature = attemptStaticStringCreation(mediaFeature.lower())
; | 211 String lowerMediaFeature = attemptStaticStringCreation(mediaFeature.lower())
; |
| 212 | 212 |
| 213 // Create value for media query expression that must have 1 or more values. | 213 // Create value for media query expression that must have 1 or more values. |
| 214 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { | 214 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { |
| 215 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue | 215 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue |
| 216 } else if (tokenList.size() == 1) { | 216 } else if (tokenList.size() == 1) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 if (denominator.type() != NumberToken || denominator.numericValue() <= 0
|| denominator.numericValueType() != IntegerValueType) | 260 if (denominator.type() != NumberToken || denominator.numericValue() <= 0
|| denominator.numericValueType() != IntegerValueType) |
| 261 return nullptr; | 261 return nullptr; |
| 262 | 262 |
| 263 expValue.numerator = (unsigned)numerator.numericValue(); | 263 expValue.numerator = (unsigned)numerator.numericValue(); |
| 264 expValue.denominator = (unsigned)denominator.numericValue(); | 264 expValue.denominator = (unsigned)denominator.numericValue(); |
| 265 expValue.isRatio = true; | 265 expValue.isRatio = true; |
| 266 } else { | 266 } else { |
| 267 return nullptr; | 267 return nullptr; |
| 268 } | 268 } |
| 269 | 269 |
| 270 return adoptPtrWillBeNoop(new MediaQueryExp(lowerMediaFeature, expValue)); | 270 return new MediaQueryExp(lowerMediaFeature, expValue); |
| 271 } | 271 } |
| 272 | 272 |
| 273 MediaQueryExp::~MediaQueryExp() | 273 MediaQueryExp::~MediaQueryExp() |
| 274 { | 274 { |
| 275 } | 275 } |
| 276 | 276 |
| 277 bool MediaQueryExp::operator==(const MediaQueryExp& other) const | 277 bool MediaQueryExp::operator==(const MediaQueryExp& other) const |
| 278 { | 278 { |
| 279 return (other.m_mediaFeature == m_mediaFeature) | 279 return (other.m_mediaFeature == m_mediaFeature) |
| 280 && ((!other.m_expValue.isValid() && !m_expValue.isValid()) | 280 && ((!other.m_expValue.isValid() && !m_expValue.isValid()) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 311 output.append('/'); | 311 output.append('/'); |
| 312 output.append(printNumber(denominator)); | 312 output.append(printNumber(denominator)); |
| 313 } else if (isID) { | 313 } else if (isID) { |
| 314 output.append(getValueName(id)); | 314 output.append(getValueName(id)); |
| 315 } | 315 } |
| 316 | 316 |
| 317 return output.toString(); | 317 return output.toString(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace blink | 320 } // namespace blink |
| OLD | NEW |