| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> | 2 * Copyright (C) 1998, 1999 Torben Weis <weis@kde.org> |
| 3 * 1999 Lars Knoll <knoll@kde.org> | 3 * 1999 Lars Knoll <knoll@kde.org> |
| 4 * 1999 Antti Koivisto <koivisto@kde.org> | 4 * 1999 Antti Koivisto <koivisto@kde.org> |
| 5 * 2000 Dirk Mueller <mueller@kde.org> | 5 * 2000 Dirk Mueller <mueller@kde.org> |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved. |
| 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) | 7 * (C) 2006 Graham Dennis (graham.dennis@gmail.com) |
| 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) | 8 * (C) 2006 Alexey Proskuryakov (ap@nypop.com) |
| 9 * Copyright (C) 2009 Google Inc. All rights reserved. | 9 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 10 * | 10 * |
| (...skipping 2688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2699 IntPoint FrameView::convertToLayoutObject(const LayoutObject& layoutObject, cons
t IntPoint& framePoint) const | 2699 IntPoint FrameView::convertToLayoutObject(const LayoutObject& layoutObject, cons
t IntPoint& framePoint) const |
| 2700 { | 2700 { |
| 2701 IntPoint point = framePoint; | 2701 IntPoint point = framePoint; |
| 2702 | 2702 |
| 2703 // Convert from FrameView coords into page ("absolute") coordinates. | 2703 // Convert from FrameView coords into page ("absolute") coordinates. |
| 2704 point += IntSize(scrollX(), scrollY()); | 2704 point += IntSize(scrollX(), scrollY()); |
| 2705 | 2705 |
| 2706 return roundedIntPoint(layoutObject.absoluteToLocal(point, UseTransforms)); | 2706 return roundedIntPoint(layoutObject.absoluteToLocal(point, UseTransforms)); |
| 2707 } | 2707 } |
| 2708 | 2708 |
| 2709 IntRect FrameView::convertToContainingView(const IntRect& localRect) const | 2709 IntRect FrameView::convertToContainingWidget(const IntRect& localRect) const |
| 2710 { | 2710 { |
| 2711 if (const FrameView* parentView = toFrameView(parent())) { | 2711 if (const FrameView* parentView = toFrameView(parent())) { |
| 2712 // Get our layoutObject in the parent view | 2712 // Get our layoutObject in the parent view |
| 2713 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 2713 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
| 2714 if (!layoutObject) | 2714 if (!layoutObject) |
| 2715 return localRect; | 2715 return localRect; |
| 2716 | 2716 |
| 2717 IntRect rect(localRect); | 2717 IntRect rect(localRect); |
| 2718 // Add borders and padding?? | 2718 // Add borders and padding?? |
| 2719 rect.move(layoutObject->borderLeft() + layoutObject->paddingLeft(), | 2719 rect.move(layoutObject->borderLeft() + layoutObject->paddingLeft(), |
| 2720 layoutObject->borderTop() + layoutObject->paddingTop()); | 2720 layoutObject->borderTop() + layoutObject->paddingTop()); |
| 2721 return parentView->convertFromLayoutObject(*layoutObject, rect); | 2721 return parentView->convertFromLayoutObject(*layoutObject, rect); |
| 2722 } | 2722 } |
| 2723 | 2723 |
| 2724 return localRect; | 2724 return localRect; |
| 2725 } | 2725 } |
| 2726 | 2726 |
| 2727 IntRect FrameView::convertFromContainingView(const IntRect& parentRect) const | 2727 IntRect FrameView::convertFromContainingWidget(const IntRect& parentRect) const |
| 2728 { | 2728 { |
| 2729 if (const FrameView* parentView = toFrameView(parent())) { | 2729 if (const FrameView* parentView = toFrameView(parent())) { |
| 2730 // Get our layoutObject in the parent view | 2730 // Get our layoutObject in the parent view |
| 2731 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 2731 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
| 2732 if (!layoutObject) | 2732 if (!layoutObject) |
| 2733 return parentRect; | 2733 return parentRect; |
| 2734 | 2734 |
| 2735 IntRect rect = parentView->convertToLayoutObject(*layoutObject, parentRe
ct); | 2735 IntRect rect = parentView->convertToLayoutObject(*layoutObject, parentRe
ct); |
| 2736 // Subtract borders and padding | 2736 // Subtract borders and padding |
| 2737 rect.move(-layoutObject->borderLeft() - layoutObject->paddingLeft(), | 2737 rect.move(-layoutObject->borderLeft() - layoutObject->paddingLeft(), |
| 2738 -layoutObject->borderTop() - layoutObject->paddingTop()); | 2738 -layoutObject->borderTop() - layoutObject->paddingTop()); |
| 2739 return rect; | 2739 return rect; |
| 2740 } | 2740 } |
| 2741 | 2741 |
| 2742 return parentRect; | 2742 return parentRect; |
| 2743 } | 2743 } |
| 2744 | 2744 |
| 2745 IntPoint FrameView::convertToContainingView(const IntPoint& localPoint) const | 2745 IntPoint FrameView::convertToContainingWidget(const IntPoint& localPoint) const |
| 2746 { | 2746 { |
| 2747 if (const FrameView* parentView = toFrameView(parent())) { | 2747 if (const FrameView* parentView = toFrameView(parent())) { |
| 2748 // Get our layoutObject in the parent view | 2748 // Get our layoutObject in the parent view |
| 2749 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 2749 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
| 2750 if (!layoutObject) | 2750 if (!layoutObject) |
| 2751 return localPoint; | 2751 return localPoint; |
| 2752 | 2752 |
| 2753 IntPoint point(localPoint); | 2753 IntPoint point(localPoint); |
| 2754 | 2754 |
| 2755 // Add borders and padding | 2755 // Add borders and padding |
| 2756 point.move(layoutObject->borderLeft() + layoutObject->paddingLeft(), | 2756 point.move(layoutObject->borderLeft() + layoutObject->paddingLeft(), |
| 2757 layoutObject->borderTop() + layoutObject->paddingTop()); | 2757 layoutObject->borderTop() + layoutObject->paddingTop()); |
| 2758 return parentView->convertFromLayoutObject(*layoutObject, point); | 2758 return parentView->convertFromLayoutObject(*layoutObject, point); |
| 2759 } | 2759 } |
| 2760 | 2760 |
| 2761 return localPoint; | 2761 return localPoint; |
| 2762 } | 2762 } |
| 2763 | 2763 |
| 2764 IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const | 2764 IntPoint FrameView::convertFromContainingWidget(const IntPoint& parentPoint) con
st |
| 2765 { | 2765 { |
| 2766 if (const FrameView* parentView = toFrameView(parent())) { | 2766 if (const FrameView* parentView = toFrameView(parent())) { |
| 2767 // Get our layoutObject in the parent view | 2767 // Get our layoutObject in the parent view |
| 2768 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); | 2768 LayoutPart* layoutObject = m_frame->ownerLayoutObject(); |
| 2769 if (!layoutObject) | 2769 if (!layoutObject) |
| 2770 return parentPoint; | 2770 return parentPoint; |
| 2771 | 2771 |
| 2772 IntPoint point = parentView->convertToLayoutObject(*layoutObject, parent
Point); | 2772 IntPoint point = parentView->convertToLayoutObject(*layoutObject, parent
Point); |
| 2773 // Subtract borders and padding | 2773 // Subtract borders and padding |
| 2774 point.move(-layoutObject->borderLeft() - layoutObject->paddingLeft(), | 2774 point.move(-layoutObject->borderLeft() - layoutObject->paddingLeft(), |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 } | 3229 } |
| 3230 } | 3230 } |
| 3231 | 3231 |
| 3232 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar*
scrollbar) | 3232 IntRect FrameView::adjustScrollbarRectForResizer(const IntRect& rect, Scrollbar*
scrollbar) |
| 3233 { | 3233 { |
| 3234 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov
erlap | 3234 // Get our window resizer rect and see if we overlap. Adjust to avoid the ov
erlap |
| 3235 // if necessary. | 3235 // if necessary. |
| 3236 IntRect adjustedRect(rect); | 3236 IntRect adjustedRect(rect); |
| 3237 bool overlapsResizer = false; | 3237 bool overlapsResizer = false; |
| 3238 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { | 3238 if (!rect.isEmpty() && !windowResizerRect().isEmpty()) { |
| 3239 IntRect resizerRect = convertFromContainingWindow(windowResizerRect()); | 3239 IntRect resizerRect = convertFromRootFrame(windowResizerRect()); |
| 3240 if (rect.intersects(resizerRect)) { | 3240 if (rect.intersects(resizerRect)) { |
| 3241 if (scrollbar->orientation() == HorizontalScrollbar) { | 3241 if (scrollbar->orientation() == HorizontalScrollbar) { |
| 3242 int overlap = rect.maxX() - resizerRect.x(); | 3242 int overlap = rect.maxX() - resizerRect.x(); |
| 3243 if (overlap > 0 && resizerRect.maxX() >= rect.maxX()) { | 3243 if (overlap > 0 && resizerRect.maxX() >= rect.maxX()) { |
| 3244 adjustedRect.setWidth(rect.width() - overlap); | 3244 adjustedRect.setWidth(rect.width() - overlap); |
| 3245 overlapsResizer = true; | 3245 overlapsResizer = true; |
| 3246 } | 3246 } |
| 3247 } else { | 3247 } else { |
| 3248 int overlap = rect.maxY() - resizerRect.y(); | 3248 int overlap = rect.maxY() - resizerRect.y(); |
| 3249 if (overlap > 0 && resizerRect.maxY() >= rect.maxY()) { | 3249 if (overlap > 0 && resizerRect.maxY() >= rect.maxY()) { |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3360 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset)
); | 3360 DoublePoint adjustedScrollPosition = clampScrollPosition(DoublePoint(offset)
); |
| 3361 | 3361 |
| 3362 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { | 3362 if (adjustedScrollPosition != scrollPositionDouble() || scrollOriginChanged(
)) { |
| 3363 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc
roll); | 3363 ScrollableArea::setScrollPosition(adjustedScrollPosition, ProgrammaticSc
roll); |
| 3364 resetScrollOriginChanged(); | 3364 resetScrollOriginChanged(); |
| 3365 } | 3365 } |
| 3366 } | 3366 } |
| 3367 | 3367 |
| 3368 IntRect FrameView::rectToCopyOnScroll() const | 3368 IntRect FrameView::rectToCopyOnScroll() const |
| 3369 { | 3369 { |
| 3370 IntRect scrollViewRect = convertToContainingWindow(IntRect((shouldPlaceVerti
calScrollbarOnLeft() && verticalScrollbar()) ? verticalScrollbar()->width() : 0,
0, visibleWidth(), visibleHeight())); | 3370 IntRect scrollViewRect = convertToRootFrame(IntRect((shouldPlaceVerticalScro
llbarOnLeft() && verticalScrollbar()) ? verticalScrollbar()->width() : 0, 0, vis
ibleWidth(), visibleHeight())); |
| 3371 if (hasOverlayScrollbars()) { | 3371 if (hasOverlayScrollbars()) { |
| 3372 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica
lScrollbar()) ? verticalScrollbar()->width() : 0; | 3372 int verticalScrollbarWidth = (verticalScrollbar() && !hasLayerForVertica
lScrollbar()) ? verticalScrollbar()->width() : 0; |
| 3373 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo
rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; | 3373 int horizontalScrollbarHeight = (horizontalScrollbar() && !hasLayerForHo
rizontalScrollbar()) ? horizontalScrollbar()->height() : 0; |
| 3374 | 3374 |
| 3375 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth)
; | 3375 scrollViewRect.setWidth(scrollViewRect.width() - verticalScrollbarWidth)
; |
| 3376 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe
ight); | 3376 scrollViewRect.setHeight(scrollViewRect.height() - horizontalScrollbarHe
ight); |
| 3377 } | 3377 } |
| 3378 return scrollViewRect; | 3378 return scrollViewRect; |
| 3379 } | 3379 } |
| 3380 | 3380 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3427 return pointInFrame + scrollOffset(); | 3427 return pointInFrame + scrollOffset(); |
| 3428 } | 3428 } |
| 3429 | 3429 |
| 3430 IntRect FrameView::frameToContents(const IntRect& rectInFrame) const | 3430 IntRect FrameView::frameToContents(const IntRect& rectInFrame) const |
| 3431 { | 3431 { |
| 3432 return IntRect(frameToContents(rectInFrame.location()), rectInFrame.size()); | 3432 return IntRect(frameToContents(rectInFrame.location()), rectInFrame.size()); |
| 3433 } | 3433 } |
| 3434 | 3434 |
| 3435 IntPoint FrameView::rootFrameToContents(const IntPoint& rootFramePoint) const | 3435 IntPoint FrameView::rootFrameToContents(const IntPoint& rootFramePoint) const |
| 3436 { | 3436 { |
| 3437 IntPoint framePoint = convertFromContainingWindow(rootFramePoint); | 3437 IntPoint framePoint = convertFromRootFrame(rootFramePoint); |
| 3438 return frameToContents(framePoint); | 3438 return frameToContents(framePoint); |
| 3439 } | 3439 } |
| 3440 | 3440 |
| 3441 IntRect FrameView::rootFrameToContents(const IntRect& rootFrameRect) const | 3441 IntRect FrameView::rootFrameToContents(const IntRect& rootFrameRect) const |
| 3442 { | 3442 { |
| 3443 return IntRect(rootFrameToContents(rootFrameRect.location()), rootFrameRect.
size()); | 3443 return IntRect(rootFrameToContents(rootFrameRect.location()), rootFrameRect.
size()); |
| 3444 } | 3444 } |
| 3445 | 3445 |
| 3446 IntPoint FrameView::contentsToRootFrame(const IntPoint& contentsPoint) const | 3446 IntPoint FrameView::contentsToRootFrame(const IntPoint& contentsPoint) const |
| 3447 { | 3447 { |
| 3448 IntPoint framePoint = contentsToFrame(contentsPoint); | 3448 IntPoint framePoint = contentsToFrame(contentsPoint); |
| 3449 return convertToContainingWindow(framePoint); | 3449 return convertToRootFrame(framePoint); |
| 3450 } | 3450 } |
| 3451 | 3451 |
| 3452 IntRect FrameView::contentsToRootFrame(const IntRect& contentsRect) const | 3452 IntRect FrameView::contentsToRootFrame(const IntRect& contentsRect) const |
| 3453 { | 3453 { |
| 3454 IntRect rectInFrame = contentsToFrame(contentsRect); | 3454 IntRect rectInFrame = contentsToFrame(contentsRect); |
| 3455 return convertToContainingWindow(rectInFrame); | 3455 return convertToRootFrame(rectInFrame); |
| 3456 } | 3456 } |
| 3457 | 3457 |
| 3458 FloatPoint FrameView::rootFrameToContents(const FloatPoint& windowPoint) const | 3458 FloatPoint FrameView::rootFrameToContents(const FloatPoint& pointInRootFrame) co
nst |
| 3459 { | 3459 { |
| 3460 FloatPoint framePoint = convertFromContainingWindow(windowPoint); | 3460 FloatPoint framePoint = convertFromRootFrame(pointInRootFrame); |
| 3461 return frameToContents(framePoint); | 3461 return frameToContents(framePoint); |
| 3462 } | 3462 } |
| 3463 | 3463 |
| 3464 IntRect FrameView::viewportToContents(const IntRect& rectInViewport) const | 3464 IntRect FrameView::viewportToContents(const IntRect& rectInViewport) const |
| 3465 { | 3465 { |
| 3466 IntRect rectInRootFrame = m_frame->host()->visualViewport().viewportToRootFr
ame(rectInViewport); | 3466 IntRect rectInRootFrame = m_frame->host()->visualViewport().viewportToRootFr
ame(rectInViewport); |
| 3467 IntRect frameRect = convertFromContainingWindow(rectInRootFrame); | 3467 IntRect frameRect = convertFromRootFrame(rectInRootFrame); |
| 3468 return frameToContents(frameRect); | 3468 return frameToContents(frameRect); |
| 3469 } | 3469 } |
| 3470 | 3470 |
| 3471 IntPoint FrameView::viewportToContents(const IntPoint& pointInViewport) const | 3471 IntPoint FrameView::viewportToContents(const IntPoint& pointInViewport) const |
| 3472 { | 3472 { |
| 3473 IntPoint pointInRootFrame = m_frame->host()->visualViewport().viewportToRoot
Frame(pointInViewport); | 3473 IntPoint pointInRootFrame = m_frame->host()->visualViewport().viewportToRoot
Frame(pointInViewport); |
| 3474 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); | 3474 IntPoint pointInFrame = convertFromRootFrame(pointInRootFrame); |
| 3475 return frameToContents(pointInFrame); | 3475 return frameToContents(pointInFrame); |
| 3476 } | 3476 } |
| 3477 | 3477 |
| 3478 IntRect FrameView::contentsToViewport(const IntRect& rectInContents) const | 3478 IntRect FrameView::contentsToViewport(const IntRect& rectInContents) const |
| 3479 { | 3479 { |
| 3480 IntRect rectInFrame = contentsToFrame(rectInContents); | 3480 IntRect rectInFrame = contentsToFrame(rectInContents); |
| 3481 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); | 3481 IntRect rectInRootFrame = convertToRootFrame(rectInFrame); |
| 3482 return m_frame->host()->visualViewport().rootFrameToViewport(rectInRootFrame
); | 3482 return m_frame->host()->visualViewport().rootFrameToViewport(rectInRootFrame
); |
| 3483 } | 3483 } |
| 3484 | 3484 |
| 3485 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const | 3485 IntPoint FrameView::contentsToViewport(const IntPoint& pointInContents) const |
| 3486 { | 3486 { |
| 3487 IntPoint pointInFrame = contentsToFrame(pointInContents); | 3487 IntPoint pointInFrame = contentsToFrame(pointInContents); |
| 3488 IntPoint pointInRootFrame = convertToContainingWindow(pointInFrame); | 3488 IntPoint pointInRootFrame = convertToRootFrame(pointInFrame); |
| 3489 return m_frame->host()->visualViewport().rootFrameToViewport(pointInRootFram
e); | 3489 return m_frame->host()->visualViewport().rootFrameToViewport(pointInRootFram
e); |
| 3490 } | 3490 } |
| 3491 | 3491 |
| 3492 IntRect FrameView::contentsToScreen(const IntRect& rect) const | 3492 IntRect FrameView::contentsToScreen(const IntRect& rect) const |
| 3493 { | 3493 { |
| 3494 HostWindow* window = hostWindow(); | 3494 HostWindow* window = hostWindow(); |
| 3495 if (!window) | 3495 if (!window) |
| 3496 return IntRect(); | 3496 return IntRect(); |
| 3497 return window->viewportToScreen(contentsToViewport(rect)); | 3497 return window->viewportToScreen(contentsToViewport(rect)); |
| 3498 } | 3498 } |
| 3499 | 3499 |
| 3500 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const | 3500 IntRect FrameView::soonToBeRemovedContentsToUnscaledViewport(const IntRect& rect
InContents) const |
| 3501 { | 3501 { |
| 3502 IntRect rectInFrame = contentsToFrame(rectInContents); | 3502 IntRect rectInFrame = contentsToFrame(rectInContents); |
| 3503 IntRect rectInRootFrame = convertToContainingWindow(rectInFrame); | 3503 IntRect rectInRootFrame = convertToRootFrame(rectInFrame); |
| 3504 return enclosingIntRect(m_frame->host()->visualViewport().mainViewToViewport
CSSPixels(rectInRootFrame)); | 3504 return enclosingIntRect(m_frame->host()->visualViewport().mainViewToViewport
CSSPixels(rectInRootFrame)); |
| 3505 } | 3505 } |
| 3506 | 3506 |
| 3507 IntPoint FrameView::soonToBeRemovedUnscaledViewportToContents(const IntPoint& po
intInViewport) const | 3507 IntPoint FrameView::soonToBeRemovedUnscaledViewportToContents(const IntPoint& po
intInViewport) const |
| 3508 { | 3508 { |
| 3509 IntPoint pointInRootFrame = flooredIntPoint(m_frame->host()->visualViewport(
).viewportCSSPixelsToRootFrame(pointInViewport)); | 3509 IntPoint pointInRootFrame = flooredIntPoint(m_frame->host()->visualViewport(
).viewportCSSPixelsToRootFrame(pointInViewport)); |
| 3510 IntPoint pointInThisFrame = convertFromContainingWindow(pointInRootFrame); | 3510 IntPoint pointInThisFrame = convertFromRootFrame(pointInRootFrame); |
| 3511 return frameToContents(pointInThisFrame); | 3511 return frameToContents(pointInThisFrame); |
| 3512 } | 3512 } |
| 3513 | 3513 |
| 3514 bool FrameView::containsScrollbarsAvoidingResizer() const | 3514 bool FrameView::containsScrollbarsAvoidingResizer() const |
| 3515 { | 3515 { |
| 3516 return !m_scrollbarsAvoidingResizer; | 3516 return !m_scrollbarsAvoidingResizer; |
| 3517 } | 3517 } |
| 3518 | 3518 |
| 3519 void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) | 3519 void FrameView::adjustScrollbarsAvoidingResizerCount(int overlapDelta) |
| 3520 { | 3520 { |
| 3521 int oldCount = m_scrollbarsAvoidingResizer; | 3521 int oldCount = m_scrollbarsAvoidingResizer; |
| 3522 m_scrollbarsAvoidingResizer += overlapDelta; | 3522 m_scrollbarsAvoidingResizer += overlapDelta; |
| 3523 if (parent()) { | 3523 if (parent()) { |
| 3524 toFrameView(parent())->adjustScrollbarsAvoidingResizerCount(overlapDelta
); | 3524 toFrameView(parent())->adjustScrollbarsAvoidingResizerCount(overlapDelta
); |
| 3525 } else if (!scrollbarsSuppressed()) { | 3525 } else if (!scrollbarsSuppressed()) { |
| 3526 // If we went from n to 0 or from 0 to n and we're the outermost view, | 3526 // If we went from n to 0 or from 0 to n and we're the outermost view, |
| 3527 // we need to invalidate the windowResizerRect(), since it will now need
to paint | 3527 // we need to invalidate the windowResizerRect(), since it will now need
to paint |
| 3528 // differently. | 3528 // differently. |
| 3529 if ((oldCount > 0 && m_scrollbarsAvoidingResizer == 0) | 3529 if ((oldCount > 0 && m_scrollbarsAvoidingResizer == 0) |
| 3530 || (oldCount == 0 && m_scrollbarsAvoidingResizer > 0)) | 3530 || (oldCount == 0 && m_scrollbarsAvoidingResizer > 0)) |
| 3531 invalidateRect(windowResizerRect()); | 3531 invalidateRect(windowResizerRect()); |
| 3532 } | 3532 } |
| 3533 } | 3533 } |
| 3534 | 3534 |
| 3535 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame
) | 3535 Scrollbar* FrameView::scrollbarAtRootFramePoint(const IntPoint& pointInRootFrame
) |
| 3536 { | 3536 { |
| 3537 IntPoint pointInFrame = convertFromContainingWindow(pointInRootFrame); | 3537 IntPoint pointInFrame = convertFromRootFrame(pointInRootFrame); |
| 3538 return scrollbarAtFramePoint(pointInFrame); | 3538 return scrollbarAtFramePoint(pointInFrame); |
| 3539 } | 3539 } |
| 3540 | 3540 |
| 3541 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) | 3541 Scrollbar* FrameView::scrollbarAtFramePoint(const IntPoint& pointInFrame) |
| 3542 { | 3542 { |
| 3543 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe
sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) | 3543 if (m_horizontalScrollbar && m_horizontalScrollbar->shouldParticipateInHitTe
sting() && m_horizontalScrollbar->frameRect().contains(pointInFrame)) |
| 3544 return m_horizontalScrollbar.get(); | 3544 return m_horizontalScrollbar.get(); |
| 3545 if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTestin
g() && m_verticalScrollbar->frameRect().contains(pointInFrame)) | 3545 if (m_verticalScrollbar && m_verticalScrollbar->shouldParticipateInHitTestin
g() && m_verticalScrollbar->frameRect().contains(pointInFrame)) |
| 3546 return m_verticalScrollbar.get(); | 3546 return m_verticalScrollbar.get(); |
| 3547 return nullptr; | 3547 return nullptr; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3674 FramePainter(*this).paint(context, globalPaintFlags, cullRect); | 3674 FramePainter(*this).paint(context, globalPaintFlags, cullRect); |
| 3675 } | 3675 } |
| 3676 | 3676 |
| 3677 void FrameView::paintContents(GraphicsContext* context, const GlobalPaintFlags g
lobalPaintFlags, const IntRect& damageRect) const | 3677 void FrameView::paintContents(GraphicsContext* context, const GlobalPaintFlags g
lobalPaintFlags, const IntRect& damageRect) const |
| 3678 { | 3678 { |
| 3679 if (shouldThrottleRendering()) | 3679 if (shouldThrottleRendering()) |
| 3680 return; | 3680 return; |
| 3681 FramePainter(*this).paintContents(context, globalPaintFlags, damageRect); | 3681 FramePainter(*this).paintContents(context, globalPaintFlags, damageRect); |
| 3682 } | 3682 } |
| 3683 | 3683 |
| 3684 bool FrameView::isPointInScrollbarCorner(const IntPoint& windowPoint) | 3684 bool FrameView::isPointInScrollbarCorner(const IntPoint& pointInRootFrame) |
| 3685 { | 3685 { |
| 3686 if (!scrollbarCornerPresent()) | 3686 if (!scrollbarCornerPresent()) |
| 3687 return false; | 3687 return false; |
| 3688 | 3688 |
| 3689 IntPoint framePoint = convertFromContainingWindow(windowPoint); | 3689 IntPoint framePoint = convertFromRootFrame(pointInRootFrame); |
| 3690 | 3690 |
| 3691 if (m_horizontalScrollbar) { | 3691 if (m_horizontalScrollbar) { |
| 3692 int horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y(); | 3692 int horizontalScrollbarYMin = m_horizontalScrollbar->frameRect().y(); |
| 3693 int horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m
_horizontalScrollbar->frameRect().height(); | 3693 int horizontalScrollbarYMax = m_horizontalScrollbar->frameRect().y() + m
_horizontalScrollbar->frameRect().height(); |
| 3694 int horizontalScrollbarXMin = m_horizontalScrollbar->frameRect().x() + m
_horizontalScrollbar->frameRect().width(); | 3694 int horizontalScrollbarXMin = m_horizontalScrollbar->frameRect().x() + m
_horizontalScrollbar->frameRect().width(); |
| 3695 | 3695 |
| 3696 return framePoint.y() > horizontalScrollbarYMin && framePoint.y() < hori
zontalScrollbarYMax && framePoint.x() > horizontalScrollbarXMin; | 3696 return framePoint.y() > horizontalScrollbarYMin && framePoint.y() < hori
zontalScrollbarYMax && framePoint.x() > horizontalScrollbarXMin; |
| 3697 } | 3697 } |
| 3698 | 3698 |
| 3699 int verticalScrollbarXMin = m_verticalScrollbar->frameRect().x(); | 3699 int verticalScrollbarXMin = m_verticalScrollbar->frameRect().x(); |
| 3700 int verticalScrollbarXMax = m_verticalScrollbar->frameRect().x() + m_vertica
lScrollbar->frameRect().width(); | 3700 int verticalScrollbarXMax = m_verticalScrollbar->frameRect().x() + m_vertica
lScrollbar->frameRect().width(); |
| 3701 int verticalScrollbarYMin = m_verticalScrollbar->frameRect().y() + m_vertica
lScrollbar->frameRect().height(); | 3701 int verticalScrollbarYMin = m_verticalScrollbar->frameRect().y() + m_vertica
lScrollbar->frameRect().height(); |
| 3702 | 3702 |
| 3703 return framePoint.x() > verticalScrollbarXMin && framePoint.x() < verticalSc
rollbarXMax && framePoint.y() > verticalScrollbarYMin; | 3703 return framePoint.x() > verticalScrollbarXMin && framePoint.x() < verticalSc
rollbarXMax && framePoint.y() > verticalScrollbarYMin; |
| 3704 } | 3704 } |
| 3705 | 3705 |
| 3706 bool FrameView::scrollbarCornerPresent() const | 3706 bool FrameView::scrollbarCornerPresent() const |
| 3707 { | 3707 { |
| 3708 return (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() >
0) | 3708 return (m_horizontalScrollbar && width() - m_horizontalScrollbar->width() >
0) |
| 3709 || (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0)
; | 3709 || (m_verticalScrollbar && height() - m_verticalScrollbar->height() > 0)
; |
| 3710 } | 3710 } |
| 3711 | 3711 |
| 3712 IntRect FrameView::convertFromScrollbarToContainingView(const Scrollbar* scrollb
ar, const IntRect& localRect) const | 3712 IntRect FrameView::convertFromScrollbarToContainingWidget(const Scrollbar* scrol
lbar, const IntRect& localRect) const |
| 3713 { | 3713 { |
| 3714 // Scrollbars won't be transformed within us | 3714 // Scrollbars won't be transformed within us |
| 3715 IntRect newRect = localRect; | 3715 IntRect newRect = localRect; |
| 3716 newRect.moveBy(scrollbar->location()); | 3716 newRect.moveBy(scrollbar->location()); |
| 3717 return newRect; | 3717 return newRect; |
| 3718 } | 3718 } |
| 3719 | 3719 |
| 3720 IntRect FrameView::convertFromContainingViewToScrollbar(const Scrollbar* scrollb
ar, const IntRect& parentRect) const | 3720 IntRect FrameView::convertFromContainingWidgetToScrollbar(const Scrollbar* scrol
lbar, const IntRect& parentRect) const |
| 3721 { | 3721 { |
| 3722 IntRect newRect = parentRect; | 3722 IntRect newRect = parentRect; |
| 3723 // Scrollbars won't be transformed within us | 3723 // Scrollbars won't be transformed within us |
| 3724 newRect.moveBy(-scrollbar->location()); | 3724 newRect.moveBy(-scrollbar->location()); |
| 3725 return newRect; | 3725 return newRect; |
| 3726 } | 3726 } |
| 3727 | 3727 |
| 3728 // FIXME: test these on windows | 3728 // FIXME: test these on windows |
| 3729 IntPoint FrameView::convertFromScrollbarToContainingView(const Scrollbar* scroll
bar, const IntPoint& localPoint) const | 3729 IntPoint FrameView::convertFromScrollbarToContainingWidget(const Scrollbar* scro
llbar, const IntPoint& localPoint) const |
| 3730 { | 3730 { |
| 3731 // Scrollbars won't be transformed within us | 3731 // Scrollbars won't be transformed within us |
| 3732 IntPoint newPoint = localPoint; | 3732 IntPoint newPoint = localPoint; |
| 3733 newPoint.moveBy(scrollbar->location()); | 3733 newPoint.moveBy(scrollbar->location()); |
| 3734 return newPoint; | 3734 return newPoint; |
| 3735 } | 3735 } |
| 3736 | 3736 |
| 3737 IntPoint FrameView::convertFromContainingViewToScrollbar(const Scrollbar* scroll
bar, const IntPoint& parentPoint) const | 3737 IntPoint FrameView::convertFromContainingWidgetToScrollbar(const Scrollbar* scro
llbar, const IntPoint& parentPoint) const |
| 3738 { | 3738 { |
| 3739 IntPoint newPoint = parentPoint; | 3739 IntPoint newPoint = parentPoint; |
| 3740 // Scrollbars won't be transformed within us | 3740 // Scrollbars won't be transformed within us |
| 3741 newPoint.moveBy(-scrollbar->location()); | 3741 newPoint.moveBy(-scrollbar->location()); |
| 3742 return newPoint; | 3742 return newPoint; |
| 3743 } | 3743 } |
| 3744 | 3744 |
| 3745 void FrameView::setParentVisible(bool visible) | 3745 void FrameView::setParentVisible(bool visible) |
| 3746 { | 3746 { |
| 3747 if (isParentVisible() == visible) | 3747 if (isParentVisible() == visible) |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3985 return m_hiddenForThrottling && m_crossOriginForThrottling; | 3985 return m_hiddenForThrottling && m_crossOriginForThrottling; |
| 3986 } | 3986 } |
| 3987 | 3987 |
| 3988 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const | 3988 LayoutBox& FrameView::boxForScrollControlPaintInvalidation() const |
| 3989 { | 3989 { |
| 3990 ASSERT(layoutView()); | 3990 ASSERT(layoutView()); |
| 3991 return *layoutView(); | 3991 return *layoutView(); |
| 3992 } | 3992 } |
| 3993 | 3993 |
| 3994 } // namespace blink | 3994 } // namespace blink |
| OLD | NEW |