csshelper.cpp
00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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.