OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2000 Simon Hausmann (hausmann@kde.org) | 4 * (C) 2000 Simon Hausmann (hausmann@kde.org) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv
ed. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 Frame* frame = document->frame(); | 192 Frame* frame = document->frame(); |
193 float zoomFactor = frame->pageZoomFactor(); | 193 float zoomFactor = frame->pageZoomFactor(); |
194 if (zoomFactor == 1) | 194 if (zoomFactor == 1) |
195 return value; | 195 return value; |
196 // Needed because of truncation (rather than rounding) when scaling up. | 196 // Needed because of truncation (rather than rounding) when scaling up. |
197 if (zoomFactor > 1) | 197 if (zoomFactor > 1) |
198 value++; | 198 value++; |
199 return static_cast<int>(value / zoomFactor); | 199 return static_cast<int>(value / zoomFactor); |
200 } | 200 } |
201 | 201 |
| 202 // FIXME: There are cases where body.scrollLeft is allowed to return |
| 203 // non-zero values in both quirks and strict mode. It happens when |
| 204 // <body> has an overflow that is not the Frame overflow. |
| 205 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft |
| 206 // http://code.google.com/p/chromium/issues/detail?id=312435 |
202 int HTMLBodyElement::scrollLeft() | 207 int HTMLBodyElement::scrollLeft() |
203 { | 208 { |
204 Document& document = this->document(); | 209 Document& document = this->document(); |
| 210 document.updateLayoutIgnorePendingStylesheets(); |
205 | 211 |
206 // FIXME: There are cases where body.scrollLeft is allowed to return | 212 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
207 // non-zero values in both quirks and strict mode. It happens when | 213 if (!document.inQuirksMode()) |
208 // <body> has an overflow that is not the Frame overflow. | 214 return 0; |
209 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrollleft | 215 } |
210 if (!document.inQuirksMode()) | |
211 UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBodyNotQui
rksMode); | |
212 | 216 |
213 document.updateLayoutIgnorePendingStylesheets(); | |
214 FrameView* view = document.view(); | 217 FrameView* view = document.view(); |
215 return view ? adjustForZoom(view->scrollX(), &document) : 0; | 218 return view ? adjustForZoom(view->scrollX(), &document) : 0; |
216 } | 219 } |
217 | 220 |
218 void HTMLBodyElement::setScrollLeft(int scrollLeft) | 221 void HTMLBodyElement::setScrollLeft(int scrollLeft) |
219 { | 222 { |
220 Document& document = this->document(); | 223 Document& document = this->document(); |
| 224 document.updateLayoutIgnorePendingStylesheets(); |
221 | 225 |
222 if (!document.inQuirksMode()) | 226 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
223 UseCounter::countDeprecation(&document, UseCounter::ScrollLeftBodyNotQui
rksMode); | 227 if (!document.inQuirksMode()) |
| 228 return; |
| 229 } |
224 | 230 |
225 document.updateLayoutIgnorePendingStylesheets(); | |
226 Frame* frame = document.frame(); | 231 Frame* frame = document.frame(); |
227 if (!frame) | 232 if (!frame) |
228 return; | 233 return; |
229 FrameView* view = frame->view(); | 234 FrameView* view = frame->view(); |
230 if (!view) | 235 if (!view) |
231 return; | 236 return; |
232 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo
omFactor()), view->scrollY())); | 237 view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZo
omFactor()), view->scrollY())); |
233 } | 238 } |
234 | 239 |
235 int HTMLBodyElement::scrollTop() | 240 int HTMLBodyElement::scrollTop() |
236 { | 241 { |
237 Document& document = this->document(); | 242 Document& document = this->document(); |
| 243 document.updateLayoutIgnorePendingStylesheets(); |
238 | 244 |
239 // FIXME: There are cases where body.scrollTop is allowed to return | 245 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
240 // non-zero values in both quirks and strict mode. It happens when | 246 if (!document.inQuirksMode()) |
241 // body has a overflow that is not the Frame overflow. | 247 return 0; |
242 // http://dev.w3.org/csswg/cssom-view/#dom-element-scrolltop | 248 } |
243 if (!document.inQuirksMode()) | |
244 UseCounter::countDeprecation(&document, UseCounter::ScrollTopBodyNotQuir
ksMode); | |
245 | 249 |
246 document.updateLayoutIgnorePendingStylesheets(); | |
247 FrameView* view = document.view(); | 250 FrameView* view = document.view(); |
248 return view ? adjustForZoom(view->scrollY(), &document) : 0; | 251 return view ? adjustForZoom(view->scrollY(), &document) : 0; |
249 } | 252 } |
250 | 253 |
251 void HTMLBodyElement::setScrollTop(int scrollTop) | 254 void HTMLBodyElement::setScrollTop(int scrollTop) |
252 { | 255 { |
253 Document& document = this->document(); | 256 Document& document = this->document(); |
| 257 document.updateLayoutIgnorePendingStylesheets(); |
254 | 258 |
255 if (!document.inQuirksMode()) | 259 if (RuntimeEnabledFeatures::scrollTopLeftInteropEnabled()) { |
256 UseCounter::countDeprecation(&document, UseCounter::ScrollTopBodyNotQuir
ksMode); | 260 if (!document.inQuirksMode()) |
| 261 return; |
| 262 } |
257 | 263 |
258 document.updateLayoutIgnorePendingStylesheets(); | |
259 Frame* frame = document.frame(); | 264 Frame* frame = document.frame(); |
260 if (!frame) | 265 if (!frame) |
261 return; | 266 return; |
262 FrameView* view = frame->view(); | 267 FrameView* view = frame->view(); |
263 if (!view) | 268 if (!view) |
264 return; | 269 return; |
265 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop
* frame->pageZoomFactor()))); | 270 view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop
* frame->pageZoomFactor()))); |
266 } | 271 } |
267 | 272 |
268 int HTMLBodyElement::scrollHeight() | 273 int HTMLBodyElement::scrollHeight() |
(...skipping 15 matching lines...) Expand all Loading... |
284 } | 289 } |
285 | 290 |
286 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const | 291 void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const |
287 { | 292 { |
288 HTMLElement::addSubresourceAttributeURLs(urls); | 293 HTMLElement::addSubresourceAttributeURLs(urls); |
289 | 294 |
290 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr))
); | 295 addSubresourceURL(urls, document().completeURL(getAttribute(backgroundAttr))
); |
291 } | 296 } |
292 | 297 |
293 } // namespace WebCore | 298 } // namespace WebCore |
OLD | NEW |