# khtml Library API Documentation

Overview | Class Hierarchy | Classes | Classes (annotated) | Members | Namespaces | 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  */
    00022 #include "csshelper.h"
    00023
    00024 #include <qfontmetrics.h>
    00025 #include <qfontinfo.h>
    00026 #include <qpaintdevice.h>
    00027 #include <qpaintdevicemetrics.h>
    00028 #include <qfontdatabase.h>
    00029
    00030 #include <kcharsets.h>
    00031 #include <kglobal.h>
    00032 #include <kdebug.h>
    00033
    00034 #include "rendering/render_style.h"
    00035 #include "css_valueimpl.h"
    00036 #include "dom/css_value.h"
    00037 #include "misc/helper.h"
    00038 #include "xml/dom_stringimpl.h"
    00039 #include "khtml_settings.h"
    00040
    00041 using namespace DOM;
    00042 using namespace khtml;
    00043
    00044
    00045 DOMString khtml::parseURL(const DOMString &url)
    00046 {
    00047     DOMStringImpl* i = url.implementation();
    00048     if(!i) return DOMString();
    00049
    00050     int o = 0;
    00051     int l = i->l;
    00052     while(o < l && (i->s[o] <= ' ')) { o++; l--; }
    00053     while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
    00054
    00055     if(l >= 5 &&
    00056        (i->s[o].lower() == 'u') &&
    00057        (i->s[o+1].lower() == 'r') &&
    00058        (i->s[o+2].lower() == 'l') &&
    00059        i->s[o+3].latin1() == '(' &&
    00060        i->s[o+l-1].latin1() == ')') {
    00061         o += 4;
    00062         l -= 5;
    00063     }
    00064
    00065     while(o < l && (i->s[o] <= ' ')) { o++; l--; }
    00066     while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
    00067
    00068     if(l >= 2 && i->s[o] == i->s[o+l-1] &&
    00069        (i->s[o].latin1() == '\'' || i->s[o].latin1() == '\"')) {
    00070         o++;
    00071         l -= 2;
    00072     }
    00073
    00074     while(o < l && (i->s[o] <= ' ')) { o++; l--; }
    00075     while(l > 0 && (i->s[o+l-1] <= ' ')) l--;
    00076
    00077     DOMStringImpl* j = new DOMStringImpl(i->s+o,l);
    00078
    00079     int nl = 0;
    00080     for(int k = o; k < o+l; k++)
    00081         if(i->s[k].unicode() > '\r')
    00082             j->s[nl++] = i->s[k];
    00083
    00084     j->l = nl;
    00085
    00086     return j;
    00087 }

This file is part of the documentation for khtml Library Version 3.4.1.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Sat Jun 11 20:33:08 2005 by doxygen 1.4.1 written by Dimitri van Heesch, © 1997-2003