OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) | 2 * Copyright (C) 1997 Martin Jones (mjones@kde.org) |
3 * (C) 1997 Torben Weis (weis@kde.org) | 3 * (C) 1997 Torben Weis (weis@kde.org) |
4 * (C) 1998 Waldo Bastian (bastian@kde.org) | 4 * (C) 1998 Waldo Bastian (bastian@kde.org) |
5 * (C) 1999 Lars Knoll (knoll@kde.org) | 5 * (C) 1999 Lars Knoll (knoll@kde.org) |
6 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 6 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights
reserved. | 7 * Copyright (C) 2003, 2004, 2005, 2006, 2008, 2010, 2011 Apple Inc. All rights
reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 if (child->isElementNode() && !child->hasTagName(captionTag) && !child->
hasTagName(colgroupTag) && !child->hasTagName(theadTag)) | 122 if (child->isElementNode() && !child->hasTagName(captionTag) && !child->
hasTagName(colgroupTag) && !child->hasTagName(theadTag)) |
123 break; | 123 break; |
124 | 124 |
125 insertBefore(newFoot, child, es); | 125 insertBefore(newFoot, child, es); |
126 } | 126 } |
127 | 127 |
128 PassRefPtr<HTMLElement> HTMLTableElement::createTHead() | 128 PassRefPtr<HTMLElement> HTMLTableElement::createTHead() |
129 { | 129 { |
130 if (HTMLTableSectionElement* existingHead = tHead()) | 130 if (HTMLTableSectionElement* existingHead = tHead()) |
131 return existingHead; | 131 return existingHead; |
132 RefPtr<HTMLTableSectionElement> head = HTMLTableSectionElement::create(thead
Tag, document()); | 132 RefPtr<HTMLTableSectionElement> head = HTMLTableSectionElement::create(thead
Tag, &document()); |
133 setTHead(head, IGNORE_EXCEPTION); | 133 setTHead(head, IGNORE_EXCEPTION); |
134 return head.release(); | 134 return head.release(); |
135 } | 135 } |
136 | 136 |
137 void HTMLTableElement::deleteTHead() | 137 void HTMLTableElement::deleteTHead() |
138 { | 138 { |
139 removeChild(tHead(), IGNORE_EXCEPTION); | 139 removeChild(tHead(), IGNORE_EXCEPTION); |
140 } | 140 } |
141 | 141 |
142 PassRefPtr<HTMLElement> HTMLTableElement::createTFoot() | 142 PassRefPtr<HTMLElement> HTMLTableElement::createTFoot() |
143 { | 143 { |
144 if (HTMLTableSectionElement* existingFoot = tFoot()) | 144 if (HTMLTableSectionElement* existingFoot = tFoot()) |
145 return existingFoot; | 145 return existingFoot; |
146 RefPtr<HTMLTableSectionElement> foot = HTMLTableSectionElement::create(tfoot
Tag, document()); | 146 RefPtr<HTMLTableSectionElement> foot = HTMLTableSectionElement::create(tfoot
Tag, &document()); |
147 setTFoot(foot, IGNORE_EXCEPTION); | 147 setTFoot(foot, IGNORE_EXCEPTION); |
148 return foot.release(); | 148 return foot.release(); |
149 } | 149 } |
150 | 150 |
151 void HTMLTableElement::deleteTFoot() | 151 void HTMLTableElement::deleteTFoot() |
152 { | 152 { |
153 removeChild(tFoot(), IGNORE_EXCEPTION); | 153 removeChild(tFoot(), IGNORE_EXCEPTION); |
154 } | 154 } |
155 | 155 |
156 PassRefPtr<HTMLElement> HTMLTableElement::createTBody() | 156 PassRefPtr<HTMLElement> HTMLTableElement::createTBody() |
157 { | 157 { |
158 RefPtr<HTMLTableSectionElement> body = HTMLTableSectionElement::create(tbody
Tag, document()); | 158 RefPtr<HTMLTableSectionElement> body = HTMLTableSectionElement::create(tbody
Tag, &document()); |
159 Node* referenceElement = lastBody() ? lastBody()->nextSibling() : 0; | 159 Node* referenceElement = lastBody() ? lastBody()->nextSibling() : 0; |
160 | 160 |
161 insertBefore(body, referenceElement); | 161 insertBefore(body, referenceElement); |
162 return body.release(); | 162 return body.release(); |
163 } | 163 } |
164 | 164 |
165 PassRefPtr<HTMLElement> HTMLTableElement::createCaption() | 165 PassRefPtr<HTMLElement> HTMLTableElement::createCaption() |
166 { | 166 { |
167 if (HTMLTableCaptionElement* existingCaption = caption()) | 167 if (HTMLTableCaptionElement* existingCaption = caption()) |
168 return existingCaption; | 168 return existingCaption; |
169 RefPtr<HTMLTableCaptionElement> caption = HTMLTableCaptionElement::create(ca
ptionTag, document()); | 169 RefPtr<HTMLTableCaptionElement> caption = HTMLTableCaptionElement::create(ca
ptionTag, &document()); |
170 setCaption(caption, IGNORE_EXCEPTION); | 170 setCaption(caption, IGNORE_EXCEPTION); |
171 return caption.release(); | 171 return caption.release(); |
172 } | 172 } |
173 | 173 |
174 void HTMLTableElement::deleteCaption() | 174 void HTMLTableElement::deleteCaption() |
175 { | 175 { |
176 removeChild(caption(), IGNORE_EXCEPTION); | 176 removeChild(caption(), IGNORE_EXCEPTION); |
177 } | 177 } |
178 | 178 |
179 HTMLTableSectionElement* HTMLTableElement::lastBody() const | 179 HTMLTableSectionElement* HTMLTableElement::lastBody() const |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 lastRow = row; | 211 lastRow = row; |
212 } | 212 } |
213 } | 213 } |
214 | 214 |
215 RefPtr<ContainerNode> parent; | 215 RefPtr<ContainerNode> parent; |
216 if (lastRow) | 216 if (lastRow) |
217 parent = row ? row->parentNode() : lastRow->parentNode(); | 217 parent = row ? row->parentNode() : lastRow->parentNode(); |
218 else { | 218 else { |
219 parent = lastBody(); | 219 parent = lastBody(); |
220 if (!parent) { | 220 if (!parent) { |
221 RefPtr<HTMLTableSectionElement> newBody = HTMLTableSectionElement::c
reate(tbodyTag, document()); | 221 RefPtr<HTMLTableSectionElement> newBody = HTMLTableSectionElement::c
reate(tbodyTag, &document()); |
222 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(doc
ument()); | 222 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(&do
cument()); |
223 newBody->appendChild(newRow, es); | 223 newBody->appendChild(newRow, es); |
224 appendChild(newBody.release(), es); | 224 appendChild(newBody.release(), es); |
225 return newRow.release(); | 225 return newRow.release(); |
226 } | 226 } |
227 } | 227 } |
228 | 228 |
229 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(document())
; | 229 RefPtr<HTMLTableRowElement> newRow = HTMLTableRowElement::create(&document()
); |
230 parent->insertBefore(newRow, row.get(), es); | 230 parent->insertBefore(newRow, row.get(), es); |
231 return newRow.release(); | 231 return newRow.release(); |
232 } | 232 } |
233 | 233 |
234 void HTMLTableElement::deleteRow(int index, ExceptionState& es) | 234 void HTMLTableElement::deleteRow(int index, ExceptionState& es) |
235 { | 235 { |
236 HTMLTableRowElement* row = 0; | 236 HTMLTableRowElement* row = 0; |
237 if (index == -1) | 237 if (index == -1) |
238 row = HTMLTableRowsCollection::lastRow(this); | 238 row = HTMLTableRowsCollection::lastRow(this); |
239 else { | 239 else { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
310 else if (name == borderAttr) | 310 else if (name == borderAttr) |
311 addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, p
arseBorderWidthAttribute(value), CSSPrimitiveValue::CSS_PX); | 311 addPropertyToPresentationAttributeStyle(style, CSSPropertyBorderWidth, p
arseBorderWidthAttribute(value), CSSPrimitiveValue::CSS_PX); |
312 else if (name == bordercolorAttr) { | 312 else if (name == bordercolorAttr) { |
313 if (!value.isEmpty()) | 313 if (!value.isEmpty()) |
314 addHTMLColorToStyle(style, CSSPropertyBorderColor, value); | 314 addHTMLColorToStyle(style, CSSPropertyBorderColor, value); |
315 } else if (name == bgcolorAttr) | 315 } else if (name == bgcolorAttr) |
316 addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value); | 316 addHTMLColorToStyle(style, CSSPropertyBackgroundColor, value); |
317 else if (name == backgroundAttr) { | 317 else if (name == backgroundAttr) { |
318 String url = stripLeadingAndTrailingHTMLSpaces(value); | 318 String url = stripLeadingAndTrailingHTMLSpaces(value); |
319 if (!url.isEmpty()) | 319 if (!url.isEmpty()) |
320 style->setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageV
alue::create(document()->completeURL(url).string()))); | 320 style->setProperty(CSSProperty(CSSPropertyBackgroundImage, CSSImageV
alue::create(document().completeURL(url).string()))); |
321 } else if (name == valignAttr) { | 321 } else if (name == valignAttr) { |
322 if (!value.isEmpty()) | 322 if (!value.isEmpty()) |
323 addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAl
ign, value); | 323 addPropertyToPresentationAttributeStyle(style, CSSPropertyVerticalAl
ign, value); |
324 } else if (name == cellspacingAttr) { | 324 } else if (name == cellspacingAttr) { |
325 if (!value.isEmpty()) | 325 if (!value.isEmpty()) |
326 addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, value); | 326 addHTMLLengthToStyle(style, CSSPropertyBorderSpacing, value); |
327 } else if (name == vspaceAttr) { | 327 } else if (name == vspaceAttr) { |
328 addHTMLLengthToStyle(style, CSSPropertyMarginTop, value); | 328 addHTMLLengthToStyle(style, CSSPropertyMarginTop, value); |
329 addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value); | 329 addHTMLLengthToStyle(style, CSSPropertyMarginBottom, value); |
330 } else if (name == hspaceAttr) { | 330 } else if (name == hspaceAttr) { |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 | 569 |
570 String HTMLTableElement::summary() const | 570 String HTMLTableElement::summary() const |
571 { | 571 { |
572 return getAttribute(summaryAttr); | 572 return getAttribute(summaryAttr); |
573 } | 573 } |
574 | 574 |
575 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
t | 575 void HTMLTableElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) cons
t |
576 { | 576 { |
577 HTMLElement::addSubresourceAttributeURLs(urls); | 577 HTMLElement::addSubresourceAttributeURLs(urls); |
578 | 578 |
579 addSubresourceURL(urls, document()->completeURL(getAttribute(backgroundAttr)
)); | 579 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr))
); |
580 } | 580 } |
581 | 581 |
582 } | 582 } |
OLD | NEW |