| OLD | NEW |
| 1 /* | 1 /* |
| 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) | 2 * (C) 1999-2003 Lars Knoll (knoll@kde.org) |
| 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 3 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * This library is free software; you can redistribute it and/or | 5 * This library is free software; you can redistribute it and/or |
| 6 * modify it under the terms of the GNU Library General Public | 6 * modify it under the terms of the GNU Library General Public |
| 7 * License as published by the Free Software Foundation; either | 7 * License as published by the Free Software Foundation; either |
| 8 * version 2 of the License, or (at your option) any later version. | 8 * version 2 of the License, or (at your option) any later version. |
| 9 * | 9 * |
| 10 * This library is distributed in the hope that it will be useful, | 10 * This library is distributed in the hope that it will be useful, |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 double zoomedResult = result * multiplier; | 472 double zoomedResult = result * multiplier; |
| 473 if (result >= 1.0) | 473 if (result >= 1.0) |
| 474 zoomedResult = max(1.0, zoomedResult); | 474 zoomedResult = max(1.0, zoomedResult); |
| 475 return zoomedResult; | 475 return zoomedResult; |
| 476 } | 476 } |
| 477 | 477 |
| 478 void CSSPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue
, ExceptionCode& ec) | 478 void CSSPrimitiveValue::setFloatValue(unsigned short unitType, double floatValue
, ExceptionCode& ec) |
| 479 { | 479 { |
| 480 ec = 0; | 480 ec = 0; |
| 481 | 481 |
| 482 // FIXME: check if property supports this type | 482 if (m_type < CSS_NUMBER || m_type > CSS_DIMENSION || unitType < CSS_NUMBER |
| unitType > CSS_DIMENSION) { |
| 483 if (m_type > CSS_DIMENSION) { | 483 ec = INVALID_ACCESS_ERR; |
| 484 ec = SYNTAX_ERR; | |
| 485 return; | 484 return; |
| 486 } | 485 } |
| 487 | 486 |
| 488 cleanup(); | 487 cleanup(); |
| 489 | 488 |
| 490 //if(m_type > CSS_DIMENSION) throw DOMException(INVALID_ACCESS_ERR); | |
| 491 m_value.num = floatValue; | 489 m_value.num = floatValue; |
| 492 m_type = unitType; | 490 m_type = unitType; |
| 493 } | 491 } |
| 494 | 492 |
| 495 static double scaleFactorForConversion(unsigned short unitType) | 493 static double scaleFactorForConversion(unsigned short unitType) |
| 496 { | 494 { |
| 497 double factor = 1.0; | 495 double factor = 1.0; |
| 498 switch (unitType) { | 496 switch (unitType) { |
| 499 case CSSPrimitiveValue::CSS_PX: | 497 case CSSPrimitiveValue::CSS_PX: |
| 500 break; | 498 break; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 563 convertedValue /= factor; | 561 convertedValue /= factor; |
| 564 | 562 |
| 565 return convertedValue; | 563 return convertedValue; |
| 566 } | 564 } |
| 567 | 565 |
| 568 | 566 |
| 569 void CSSPrimitiveValue::setStringValue(unsigned short stringType, const String&
stringValue, ExceptionCode& ec) | 567 void CSSPrimitiveValue::setStringValue(unsigned short stringType, const String&
stringValue, ExceptionCode& ec) |
| 570 { | 568 { |
| 571 ec = 0; | 569 ec = 0; |
| 572 | 570 |
| 573 //if(m_type < CSS_STRING) throw DOMException(INVALID_ACCESS_ERR); | 571 if (m_type < CSS_STRING || m_type > CSS_ATTR || stringType < CSS_STRING || s
tringType > CSS_ATTR) { |
| 574 //if(m_type > CSS_ATTR) throw DOMException(INVALID_ACCESS_ERR); | 572 ec = INVALID_ACCESS_ERR; |
| 575 if (m_type < CSS_STRING || m_type > CSS_ATTR) { | |
| 576 ec = SYNTAX_ERR; | |
| 577 return; | 573 return; |
| 578 } | 574 } |
| 579 | 575 |
| 580 cleanup(); | 576 cleanup(); |
| 581 | 577 |
| 582 if (stringType != CSS_IDENT) { | 578 if (stringType != CSS_IDENT) { |
| 583 m_value.string = stringValue.impl(); | 579 m_value.string = stringValue.impl(); |
| 584 m_value.string->ref(); | 580 m_value.string->ref(); |
| 585 m_type = stringType; | 581 m_type = stringType; |
| 586 } | 582 } |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 return value; | 1028 return value; |
| 1033 } | 1029 } |
| 1034 | 1030 |
| 1035 void CSSPrimitiveValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const C
SSStyleSheet* styleSheet) | 1031 void CSSPrimitiveValue::addSubresourceStyleURLs(ListHashSet<KURL>& urls, const C
SSStyleSheet* styleSheet) |
| 1036 { | 1032 { |
| 1037 if (m_type == CSS_URI) | 1033 if (m_type == CSS_URI) |
| 1038 addSubresourceURL(urls, styleSheet->completeURL(m_value.string)); | 1034 addSubresourceURL(urls, styleSheet->completeURL(m_value.string)); |
| 1039 } | 1035 } |
| 1040 | 1036 |
| 1041 } // namespace WebCore | 1037 } // namespace WebCore |
| OLD | NEW |