csshelper.cpp Source File (khtml Library)

| # khtml Library API Documentation
Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Source Files

# csshelper.cpp

    00001 /*
    00002  * This file is part of the CSS implementation for KDE.
    00003  *
    00004  * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the GNU Library General Public
    00008  * License as published by the Free Software Foundation; either
    00009  * version 2 of the License, or (at your option) any later version.
    00010  *
    00011  * This library is distributed in the hope that it will be useful,
    00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00014  * Library General Public License for more details.
    00015  *
    00016  * You should have received a copy of the GNU Library General Public License
    00017  * along with this library; see the file COPYING.LIB.  If not, write to
    00018  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
    00019  * Boston, MA 02111-1307, USA.
    00020  *
    00021  * $Id: csshelper.cpp,v 1.41 2002/03/01 01:04:06 mueller Exp $
    00022  */
    00023 #include "csshelper.h"
    00024
    00025 #include <qfontmetrics.h>
    00026 #include <qfontinfo.h>
    00027 #include <qpaintdevice.h>
    00028 #include <qpaintdevicemetrics.h>
    00029 #include <qfontdatabase.h>
    00030
    00031 #include <kcharsets.h>
    00032 #include <kglobal.h>
    00033 #include <kdebug.h>
    00034
    00035 #include "rendering/render_style.h"
    00036 #include "css_valueimpl.h"
    00037 #include "dom/css_value.h"
    00038 #include "misc/helper.h"
    00039 #include "xml/dom_stringimpl.h"
    00040 #include "khtml_settings.h"
    00041
    00042 using namespace DOM;
    00043 using namespace khtml;
    00044
    00045
    00046 DOMString khtml::parseURL(const DOMString &url)
    00047 {
    00048     DOMStringImpl* i = url.implementation();
    00049     if(!i) return DOMString();
    00050
    00051     int o = 0;
    00052     int l = i->l;
    00053     while(o < l && (i->s[o] <= ' ')) { o++; l--; }
    00054     while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
    00055
    00056     if(l >= 5 &&
    00057        (i->s[o].lower() == 'u') &&
    00058        (i->s[o+1].lower() == 'r') &&
    00059        (i->s[o+2].lower() == 'l') &&
    00060        i->s[o+3].latin1() == '(' &&
    00061        i->s[o+l-1].latin1() == ')') {
    00062         o += 4;
    00063         l -= 5;
    00064     }
    00065
    00066     while(o < l && (i->s[o] <= ' ')) { o++; l--; }
    00067     while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
    00068
    00069     if(l >= 2 && i->s[o] == i->s[o+l-1] &&
    00070        (i->s[o].latin1() == '\'' || i->s[o].latin1() == '\"')) {
    00071         o++;
    00072         l -= 2;
    00073     }
    00074
    00075     while(o < l && (i->s[o] <= ' ')) { o++; l--; }
    00076     while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
    00077
    00078     DOMStringImpl* j = new DOMStringImpl(i->s+o,l);
    00079
    00080     int nl = 0;
    00081     for(int k = o; k < o+l; k++)
    00082         if(i->s[k].unicode() > '\r')
    00083             j->s[nl++] = i->s[k];
    00084
    00085     j->l = nl;
    00086
    00087     return j;
    00088 }

This file is part of the documentation for kdelibs Version 3.1.5.
Documentation copyright © 1996-2002 the KDE developers.
Generated on Wed Jan 28 13:33:33 2004 by doxygen 1.3.4 written by Dimitri van Heesch, © 1997-2001