|
1 /** |
|
2 * This file is part of the DOM implementation for KDE. |
|
3 * |
|
4 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
|
5 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
|
6 * Copyright (C) 2003 Apple Computer, Inc. |
|
7 * |
|
8 * This library is free software; you can redistribute it and/or |
|
9 * modify it under the terms of the GNU Library General Public |
|
10 * License as published by the Free Software Foundation; either |
|
11 * version 2 of the License, or (at your option) any later version. |
|
12 * |
|
13 * This library is distributed in the hope that it will be useful, |
|
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|
16 * Library General Public License for more details. |
|
17 * |
|
18 * You should have received a copy of the GNU Library General Public License |
|
19 * along with this library; see the file COPYING.LIB. If not, write to |
|
20 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
|
21 * Boston, MA 02110-1301, USA. |
|
22 * |
|
23 */ |
|
24 #include "config.h" |
|
25 #include "HTMLDivElement.h" |
|
26 |
|
27 #include "CSSPropertyNames.h" |
|
28 #include "CSSValueKeywords.h" |
|
29 #include "HTMLNames.h" |
|
30 |
|
31 namespace WebCore { |
|
32 |
|
33 using namespace HTMLNames; |
|
34 |
|
35 HTMLDivElement::HTMLDivElement(Document *doc) |
|
36 : HTMLElement(divTag, doc) |
|
37 { |
|
38 } |
|
39 |
|
40 HTMLDivElement::~HTMLDivElement() |
|
41 { |
|
42 } |
|
43 |
|
44 bool HTMLDivElement::mapToEntry(const QualifiedName& attrName, MappedAttributeEntry& result) const |
|
45 { |
|
46 if (attrName == alignAttr) { |
|
47 result = eBlock; |
|
48 return false; |
|
49 } |
|
50 return HTMLElement::mapToEntry(attrName, result); |
|
51 } |
|
52 |
|
53 void HTMLDivElement::parseMappedAttribute(MappedAttribute *attr) |
|
54 { |
|
55 if (attr->name() == alignAttr) { |
|
56 String v = attr->value(); |
|
57 if (equalIgnoringCase(attr->value(), "middle") || equalIgnoringCase(attr->value(), "center")) |
|
58 addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__WEBKIT_CENTER); |
|
59 else if (equalIgnoringCase(attr->value(), "left")) |
|
60 addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__WEBKIT_LEFT); |
|
61 else if (equalIgnoringCase(attr->value(), "right")) |
|
62 addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, CSS_VAL__WEBKIT_RIGHT); |
|
63 else |
|
64 addCSSProperty(attr, CSS_PROP_TEXT_ALIGN, v); |
|
65 } else |
|
66 HTMLElement::parseMappedAttribute(attr); |
|
67 } |
|
68 |
|
69 String HTMLDivElement::align() const |
|
70 { |
|
71 return getAttribute(alignAttr); |
|
72 } |
|
73 |
|
74 void HTMLDivElement::setAlign(const String &value) |
|
75 { |
|
76 setAttribute(alignAttr, value); |
|
77 } |
|
78 |
|
79 } |