Index: Source/WebCore/rendering/RenderLayer.cpp |
=================================================================== |
--- Source/WebCore/rendering/RenderLayer.cpp (revision 107432) |
+++ Source/WebCore/rendering/RenderLayer.cpp (working copy) |
@@ -67,6 +67,7 @@ |
#include "FrameView.h" |
#include "Gradient.h" |
#include "GraphicsContext.h" |
+#include "HTMLFrameElement.h" |
#include "HTMLFrameOwnerElement.h" |
#include "HTMLNames.h" |
#include "HitTestingTransformState.h" |
@@ -1542,20 +1543,31 @@ |
} |
} else if (!parentLayer && renderer()->isBox() && renderBox()->canBeProgramaticallyScrolled()) { |
if (frameView) { |
- if (renderer()->document() && renderer()->document()->ownerElement() && renderer()->document()->ownerElement()->renderer()) { |
- LayoutRect viewRect = frameView->visibleContentRect(); |
- LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY); |
- |
- LayoutUnit xOffset = r.x(); |
- LayoutUnit yOffset = r.y(); |
- // Adjust offsets if they're outside of the allowable range. |
- xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset)); |
- yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset)); |
+ Element* ownerElement = 0; |
+ if (renderer()->document()) |
+ ownerElement = renderer()->document()->ownerElement(); |
- frameView->setScrollPosition(IntPoint(xOffset, yOffset)); |
- parentLayer = renderer()->document()->ownerElement()->renderer()->enclosingLayer(); |
- newRect.setX(rect.x() - frameView->scrollX() + frameView->x()); |
- newRect.setY(rect.y() - frameView->scrollY() + frameView->y()); |
+ if (ownerElement && ownerElement->renderer()) { |
+ HTMLFrameElement* frameElement = 0; |
+ |
+ if (ownerElement->hasTagName(frameTag) || ownerElement->hasTagName(iframeTag)) |
+ frameElement = static_cast<HTMLFrameElement*>(ownerElement); |
+ |
+ if (frameElement && frameElement->scrollingMode() != ScrollbarAlwaysOff) { |
+ LayoutRect viewRect = frameView->visibleContentRect(); |
+ LayoutRect exposeRect = getRectToExpose(viewRect, rect, alignX, alignY); |
+ |
+ LayoutUnit xOffset = exposeRect.x(); |
+ LayoutUnit yOffset = exposeRect.y(); |
+ // Adjust offsets if they're outside of the allowable range. |
+ xOffset = max<LayoutUnit>(0, min(frameView->contentsWidth(), xOffset)); |
+ yOffset = max<LayoutUnit>(0, min(frameView->contentsHeight(), yOffset)); |
+ |
+ frameView->setScrollPosition(IntPoint(xOffset, yOffset)); |
+ parentLayer = ownerElement->renderer()->enclosingLayer(); |
+ newRect.setX(rect.x() - frameView->scrollX() + frameView->x()); |
+ newRect.setY(rect.y() - frameView->scrollY() + frameView->y()); |
+ } |
} else { |
LayoutRect viewRect = frameView->visibleContentRect(); |
LayoutRect r = getRectToExpose(viewRect, rect, alignX, alignY); |