diff options
Diffstat (limited to 'WebCore/html/HTMLBodyElement.cpp')
-rw-r--r-- | WebCore/html/HTMLBodyElement.cpp | 50 |
1 files changed, 28 insertions, 22 deletions
diff --git a/WebCore/html/HTMLBodyElement.cpp b/WebCore/html/HTMLBodyElement.cpp index 98e0d6f..05c13ac 100644 --- a/WebCore/html/HTMLBodyElement.cpp +++ b/WebCore/html/HTMLBodyElement.cpp @@ -275,9 +275,9 @@ void HTMLBodyElement::setVLink(const String& value) setAttribute(vlinkAttr, value); } -static int adjustForZoom(int value, FrameView* frameView) +static int adjustForZoom(int value, Document* document) { - float zoomFactor = frameView->zoomFactor(); + float zoomFactor = document->frame()->pageZoomFactor(); if (zoomFactor == 1) return value; // Needed because of truncation (rather than rounding) when scaling up. @@ -289,57 +289,63 @@ static int adjustForZoom(int value, FrameView* frameView) int HTMLBodyElement::scrollLeft() const { // Update the document's layout. - Document* doc = document(); - doc->updateLayoutIgnorePendingStylesheets(); - FrameView* view = doc->view(); - return view ? adjustForZoom(view->scrollX(), view) : 0; + Document* document = this->document(); + document->updateLayoutIgnorePendingStylesheets(); + FrameView* view = document->view(); + return view ? adjustForZoom(view->scrollX(), document) : 0; } void HTMLBodyElement::setScrollLeft(int scrollLeft) { Document* document = this->document(); document->updateLayoutIgnorePendingStylesheets(); - FrameView* view = document->view(); + Frame* frame = document->frame(); + if (!frame) + return; + FrameView* view = frame->view(); if (!view) return; - view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * view->zoomFactor()), view->scrollY())); + view->setScrollPosition(IntPoint(static_cast<int>(scrollLeft * frame->pageZoomFactor()), view->scrollY())); } int HTMLBodyElement::scrollTop() const { // Update the document's layout. - Document* doc = document(); - doc->updateLayoutIgnorePendingStylesheets(); - FrameView* view = doc->view(); - return view ? adjustForZoom(view->scrollY(), view) : 0; + Document* document = this->document(); + document->updateLayoutIgnorePendingStylesheets(); + FrameView* view = document->view(); + return view ? adjustForZoom(view->scrollY(), document) : 0; } void HTMLBodyElement::setScrollTop(int scrollTop) { Document* document = this->document(); document->updateLayoutIgnorePendingStylesheets(); - FrameView* view = document->view(); + Frame* frame = document->frame(); + if (!frame) + return; + FrameView* view = frame->view(); if (!view) return; - view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * view->zoomFactor()))); + view->setScrollPosition(IntPoint(view->scrollX(), static_cast<int>(scrollTop * frame->pageZoomFactor()))); } int HTMLBodyElement::scrollHeight() const { // Update the document's layout. - Document* doc = document(); - doc->updateLayoutIgnorePendingStylesheets(); - FrameView* view = doc->view(); - return view ? adjustForZoom(view->contentsHeight(), view) : 0; + Document* document = this->document(); + document->updateLayoutIgnorePendingStylesheets(); + FrameView* view = document->view(); + return view ? adjustForZoom(view->contentsHeight(), document) : 0; } int HTMLBodyElement::scrollWidth() const { // Update the document's layout. - Document* doc = document(); - doc->updateLayoutIgnorePendingStylesheets(); - FrameView* view = doc->view(); - return view ? adjustForZoom(view->contentsWidth(), view) : 0; + Document* document = this->document(); + document->updateLayoutIgnorePendingStylesheets(); + FrameView* view = document->view(); + return view ? adjustForZoom(view->contentsWidth(), document) : 0; } void HTMLBodyElement::addSubresourceAttributeURLs(ListHashSet<KURL>& urls) const |