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 
     39     virtual String cssText() const;
     40 
     41     CSSValue* imageValue() const { return m_image.get(); }
     42 
     43     virtual void addSubresourceStyleURLs(ListHashSet<KURL>&, const CSSStyleSheet*);
     44 
     45     // The border image.
     46     RefPtr<CSSValue> m_image;
     47 
     48     // These four values are used to make "cuts" in the image.  They can be numbers
     49     // or percentages.
     50     RefPtr<Rect> m_imageSliceRect;
     51 
     52     // Values for how to handle the scaling/stretching/tiling of the image slices.
     53     int m_horizontalSizeRule; // Rule for how to adjust the widths of the top/middle/bottom
     54     int m_verticalSizeRule; // Rule for how to adjust the heights of the left/middle/right
     55 
     56 private:
     57     CSSBorderImageValue(PassRefPtr<CSSValue> image, PassRefPtr<Rect> sliceRect, int horizontalRule, int verticalRule);
     58 };
     59 
     60 } // namespace WebCore
     61 
     62 #endif // CSSBorderImageValue_h
     63