Changeset 132966 in webkit
- Timestamp:
- Oct 30, 2012 5:03:27 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r132964 r132966 1 2012-10-30 Rick Byers <rbyers@chromium.org> 2 3 cssText for cursor property doesn't include hotspot 4 https://bugs.webkit.org/show_bug.cgi?id=99530 5 6 Reviewed by Darin Adler. 7 8 Add simple test for parsing of CSS cursor property. 9 10 * fast/css/cursor-parsing-expected.txt: Added. 11 * fast/css/cursor-parsing.html: Added. 12 1 13 2012-10-30 Roger Fong <roger_fong@apple.com> 2 14 -
trunk/Source/WebCore/ChangeLog
r132965 r132966 1 2012-10-30 Rick Byers <rbyers@chromium.org> 2 3 cssText for cursor property doesn't include hotspot 4 https://bugs.webkit.org/show_bug.cgi?id=99530 5 6 Reviewed by Darin Adler. 7 8 Implement customCssText in CSSCursorImageValue to include the hotspot when present. 9 Also explicitly track whether or not a hotspot was supplied in the parser, 10 while still using the existing convention of (-1,-1) to denote no hotspot 11 in the rest of the system. 12 13 Test: fast/css/cursor-parsing.html 14 15 * css/CSSCursorImageValue.cpp: 16 (WebCore::CSSCursorImageValue::customCssText): 17 * css/CSSCursorImageValue.h: 18 (CSSCursorImageValue): 19 1 20 2012-10-30 Kenneth Russell <kbr@google.com> 2 21 -
trunk/Source/WebCore/css/CSSCursorImageValue.cpp
r129637 r132966 57 57 #endif 58 58 59 CSSCursorImageValue::CSSCursorImageValue(const String& url, const IntPoint& hotSpot)59 CSSCursorImageValue::CSSCursorImageValue(const String& url, bool hasHotSpot, const IntPoint& hotSpot) 60 60 : CSSImageValue(CursorImageClass, url) 61 , m_hasHotSpot(hasHotSpot) 61 62 , m_hotSpot(hotSpot) 62 63 { … … 81 82 } 82 83 84 String CSSCursorImageValue::customCssText() const 85 { 86 StringBuilder result; 87 result.append(CSSImageValue::customCssText()); 88 if (m_hasHotSpot) { 89 result.append(' '); 90 result.appendNumber(m_hotSpot.x()); 91 result.append(' '); 92 result.appendNumber(m_hotSpot.y()); 93 } 94 return result.toString(); 95 } 96 83 97 bool CSSCursorImageValue::updateIfSVGCursorIsUsed(Element* element) 84 98 { … … 95 109 // FIXME: This will override hot spot specified in CSS, which is probably incorrect. 96 110 SVGLengthContext lengthContext(0); 111 m_hasHotSpot = true; 97 112 float x = roundf(cursorElement->x().value(lengthContext)); 98 113 m_hotSpot.setX(static_cast<int>(x)); -
trunk/Source/WebCore/css/CSSCursorImageValue.h
r124768 r132966 33 33 class CSSCursorImageValue : public CSSImageValue { 34 34 public: 35 static PassRefPtr<CSSCursorImageValue> create(const String& url, const IntPoint& hotSpot)35 static PassRefPtr<CSSCursorImageValue> create(const String& url, bool hasHotSpot, const IntPoint& hotSpot) 36 36 { 37 return adoptRef(new CSSCursorImageValue(url, h otSpot));37 return adoptRef(new CSSCursorImageValue(url, hasHotSpot, hotSpot)); 38 38 } 39 39 40 40 ~CSSCursorImageValue(); 41 41 42 IntPoint hotSpot() const { return m_hotSpot; } 42 bool hasHotSpot() const { return m_hasHotSpot; } 43 44 IntPoint hotSpot() const 45 { 46 if (m_hasHotSpot) 47 return m_hotSpot; 48 return IntPoint(-1, -1); 49 } 50 51 String customCssText() const; 43 52 44 53 bool updateIfSVGCursorIsUsed(Element*); … … 52 61 53 62 private: 54 CSSCursorImageValue(const String& url, const IntPoint& hotSpot);63 CSSCursorImageValue(const String& url, bool hasHotSpot, const IntPoint& hotSpot); 55 64 65 bool m_hasHotSpot; 56 66 IntPoint m_hotSpot; 57 67 -
trunk/Source/WebCore/css/CSSParser.cpp
r132942 r132966 1875 1875 value = m_valueList->next(); 1876 1876 } 1877 bool hasHotSpot = false; 1877 1878 IntPoint hotSpot(-1, -1); 1878 1879 int nrcoords = coords.size(); 1879 1880 if (nrcoords > 0 && nrcoords != 2) 1880 1881 return false; 1881 if (nrcoords == 2) 1882 if (nrcoords == 2) { 1883 hasHotSpot = true; 1882 1884 hotSpot = IntPoint(coords[0], coords[1]); 1885 } 1883 1886 1884 1887 if (!uri.isNull()) 1885 list->append(CSSCursorImageValue::create(completeURL(uri), h otSpot));1888 list->append(CSSCursorImageValue::create(completeURL(uri), hasHotSpot, hotSpot)); 1886 1889 1887 1890 if ((inStrictMode() && !value) || (value && !(value->unit == CSSParserValue::Operator && value->iValue == ',')))
Note: See TracChangeset
for help on using the changeset viewer.