Home | History | Annotate | Download | only in css
      1 /*
      2  * (C) 1999-2003 Lars Knoll (knoll (at) kde.org)
      3  * Copyright (C) 2004, 2005, 2006, 2008 Apple Inc. All rights reserved.
      4  *
      5  * This library is free software; you can redistribute it and/or
      6  * modify it under the terms of the GNU Library General Public
      7  * License as published by the Free Software Foundation; either
      8  * version 2 of the License, or (at your option) any later version.
      9  *
     10  * This library is distributed in the hope that it will be useful,
     11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
     12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
     13  * Library General Public License for more details.
     14  *
     15  * You should have received a copy of the GNU Library General Public License
     16  * along with this library; see the file COPYING.LIB.  If not, write to
     17  * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
     18  * Boston, MA 02110-1301, USA.
     19  */
     20 
     21 #ifndef CSSBorderImageValue_h
     22 #define CSSBorderImageValue_h
     23 
     24 #include "CSSValue.h"
     25 #include <wtf/PassRefPtr.h>
     26 #include <wtf/RefPtr.h>
     27 
     28 namespace WebCore {
     29 
     30 class Rect;
     31 
     32 class CSSBorderImageValue : public CSSValue {
     33 public:
     34     static PassRefPtr<CSSBorderImageValue> create(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule)
     35     {
     36         return adoptRef(new CSSBorderImageValue(image, sliceRect, horizontalRule, verticalRule));
     37     }
     38     virtual ~CSSBorderImageValue();
     39 
     40     virtual String cssText() const;
     41 
     42     CSSValue* imageValue() const { return m_image.get(); }
     43 
     44     virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
     45 
     46     // The border image.
     47     RefPtr<CSSValue> m_image;
     48 
     49     // These four values are used to make "cuts" in the image.  They can be numbers
     50     // or percentages.
     51     RefPtr<Rect> m_imageSliceRect;
     52 
     53     // Values for how to handle the scaling/stretching/tiling of the image slices.
     54     int m_horizontalSizeRule; // Rule for how to adjust the widths of the top/middle/bottom
     55     int m_verticalSizeRule; // Rule for how to adjust the heights of the left/middle/right
     56 
     57 private:
     58     CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule);
     59     virtual bool isBorderImageValue() const { return true; }
     60 };
     61 
     62 } // namespace WebCore
     63 
     64 #endif // CSSBorderImageValue_h
     65