| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 , m_expValue(other.expValue()) | 194 , m_expValue(other.expValue()) |
| 195 { | 195 { |
| 196 } | 196 } |
| 197 | 197 |
| 198 MediaQueryExp::MediaQueryExp(const String& mediaFeature, const MediaQueryExpValu
e& expValue) | 198 MediaQueryExp::MediaQueryExp(const String& mediaFeature, const MediaQueryExpValu
e& expValue) |
| 199 : m_mediaFeature(mediaFeature) | 199 : m_mediaFeature(mediaFeature) |
| 200 , m_expValue(expValue) | 200 , m_expValue(expValue) |
| 201 { | 201 { |
| 202 } | 202 } |
| 203 | 203 |
| 204 PassOwnPtrWillBeRawPtr<MediaQueryExp> MediaQueryExp::createIfValid(const String&
mediaFeature, const Vector<CSSParserToken, 4>& tokenList) | 204 RawPtr<MediaQueryExp> MediaQueryExp::createIfValid(const String& mediaFeature, c
onst Vector<CSSParserToken, 4>& tokenList) |
| 205 { | 205 { |
| 206 ASSERT(!mediaFeature.isNull()); | 206 ASSERT(!mediaFeature.isNull()); |
| 207 | 207 |
| 208 MediaQueryExpValue expValue; | 208 MediaQueryExpValue expValue; |
| 209 String lowerMediaFeature = attemptStaticStringCreation(mediaFeature.lower())
; | 209 String lowerMediaFeature = attemptStaticStringCreation(mediaFeature.lower())
; |
| 210 | 210 |
| 211 // Create value for media query expression that must have 1 or more values. | 211 // Create value for media query expression that must have 1 or more values. |
| 212 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { | 212 if (tokenList.size() == 0 && featureWithoutValue(lowerMediaFeature)) { |
| 213 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue | 213 // Valid, creates a MediaQueryExp with an 'invalid' MediaQueryExpValue |
| 214 } else if (tokenList.size() == 1) { | 214 } else if (tokenList.size() == 1) { |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 if (denominator.type() != NumberToken || denominator.numericValue() <= 0
|| denominator.numericValueType() != IntegerValueType) | 258 if (denominator.type() != NumberToken || denominator.numericValue() <= 0
|| denominator.numericValueType() != IntegerValueType) |
| 259 return nullptr; | 259 return nullptr; |
| 260 | 260 |
| 261 expValue.numerator = (unsigned)numerator.numericValue(); | 261 expValue.numerator = (unsigned)numerator.numericValue(); |
| 262 expValue.denominator = (unsigned)denominator.numericValue(); | 262 expValue.denominator = (unsigned)denominator.numericValue(); |
| 263 expValue.isRatio = true; | 263 expValue.isRatio = true; |
| 264 } else { | 264 } else { |
| 265 return nullptr; | 265 return nullptr; |
| 266 } | 266 } |
| 267 | 267 |
| 268 return adoptPtrWillBeNoop(new MediaQueryExp(lowerMediaFeature, expValue)); | 268 return (new MediaQueryExp(lowerMediaFeature, expValue)); |
| 269 } | 269 } |
| 270 | 270 |
| 271 MediaQueryExp::~MediaQueryExp() | 271 MediaQueryExp::~MediaQueryExp() |
| 272 { | 272 { |
| 273 } | 273 } |
| 274 | 274 |
| 275 bool MediaQueryExp::operator==(const MediaQueryExp& other) const | 275 bool MediaQueryExp::operator==(const MediaQueryExp& other) const |
| 276 { | 276 { |
| 277 return (other.m_mediaFeature == m_mediaFeature) | 277 return (other.m_mediaFeature == m_mediaFeature) |
| 278 && ((!other.m_expValue.isValid() && !m_expValue.isValid()) | 278 && ((!other.m_expValue.isValid() && !m_expValue.isValid()) |
| (...skipping 30 matching lines...) Expand all Loading... |
| 309 output.append('/'); | 309 output.append('/'); |
| 310 output.append(printNumber(denominator)); | 310 output.append(printNumber(denominator)); |
| 311 } else if (isID) { | 311 } else if (isID) { |
| 312 output.append(getValueName(id)); | 312 output.append(getValueName(id)); |
| 313 } | 313 } |
| 314 | 314 |
| 315 return output.toString(); | 315 return output.toString(); |
| 316 } | 316 } |
| 317 | 317 |
| 318 } // namespace blink | 318 } // namespace blink |
| OLD | NEW |