OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights |
3 * reserved. | 3 * reserved. |
4 * | 4 * |
5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 5 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
6 * | 6 * |
7 * Other contributors: | 7 * Other contributors: |
8 * Robert O'Callahan <roc+@cs.cmu.edu> | 8 * Robert O'Callahan <roc+@cs.cmu.edu> |
9 * David Baron <dbaron@fas.harvard.edu> | 9 * David Baron <dbaron@fas.harvard.edu> |
10 * Christian Biesinger <cbiesinger@gmail.com> | 10 * Christian Biesinger <cbiesinger@gmail.com> |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 #include "core/layout/compositing/PaintLayerCompositor.h" | 68 #include "core/layout/compositing/PaintLayerCompositor.h" |
69 #include "core/loader/FrameLoaderClient.h" | 69 #include "core/loader/FrameLoaderClient.h" |
70 #include "core/page/ChromeClient.h" | 70 #include "core/page/ChromeClient.h" |
71 #include "core/page/FocusController.h" | 71 #include "core/page/FocusController.h" |
72 #include "core/page/Page.h" | 72 #include "core/page/Page.h" |
73 #include "core/page/scrolling/RootScrollerController.h" | 73 #include "core/page/scrolling/RootScrollerController.h" |
74 #include "core/page/scrolling/RootScrollerUtil.h" | 74 #include "core/page/scrolling/RootScrollerUtil.h" |
75 #include "core/page/scrolling/ScrollingCoordinator.h" | 75 #include "core/page/scrolling/ScrollingCoordinator.h" |
76 #include "core/page/scrolling/TopDocumentRootScrollerController.h" | 76 #include "core/page/scrolling/TopDocumentRootScrollerController.h" |
77 #include "core/paint/PaintLayerFragment.h" | 77 #include "core/paint/PaintLayerFragment.h" |
78 #include "platform/PlatformGestureEvent.h" | |
79 #include "platform/PlatformMouseEvent.h" | 78 #include "platform/PlatformMouseEvent.h" |
80 #include "platform/graphics/CompositorMutableProperties.h" | 79 #include "platform/graphics/CompositorMutableProperties.h" |
81 #include "platform/graphics/GraphicsLayer.h" | 80 #include "platform/graphics/GraphicsLayer.h" |
82 #include "platform/graphics/paint/DrawingRecorder.h" | 81 #include "platform/graphics/paint/DrawingRecorder.h" |
83 #include "platform/scroll/ScrollAnimatorBase.h" | 82 #include "platform/scroll/ScrollAnimatorBase.h" |
84 #include "platform/scroll/ScrollbarTheme.h" | 83 #include "platform/scroll/ScrollbarTheme.h" |
85 #include "public/platform/Platform.h" | 84 #include "public/platform/Platform.h" |
86 | 85 |
87 namespace blink { | 86 namespace blink { |
88 | 87 |
(...skipping 1411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1500 // the case? | 1499 // the case? |
1501 IntSize elementSize = layer()->size(); | 1500 IntSize elementSize = layer()->size(); |
1502 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 1501 if (box().shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
1503 elementSize.setWidth(0); | 1502 elementSize.setWidth(0); |
1504 IntPoint resizerPoint = IntPoint(elementSize); | 1503 IntPoint resizerPoint = IntPoint(elementSize); |
1505 IntPoint localPoint = | 1504 IntPoint localPoint = |
1506 roundedIntPoint(box().absoluteToLocal(absolutePoint, UseTransforms)); | 1505 roundedIntPoint(box().absoluteToLocal(absolutePoint, UseTransforms)); |
1507 return localPoint - resizerPoint; | 1506 return localPoint - resizerPoint; |
1508 } | 1507 } |
1509 | 1508 |
1509 void PaintLayerScrollableArea::resize(const WebGestureEvent& evt, | |
majidvp
2016/12/01 15:46:30
Feels like the two resize method here don't really
dtapuska
2016/12/01 16:26:43
Yes I agree. There are only two calls into resize;
| |
1510 const LayoutSize& oldOffset) { | |
1511 if (evt.type == WebInputEvent::GestureScrollUpdate) { | |
1512 IntPoint pos = roundedIntPoint(evt.positionInRootFrame()); | |
1513 pos.move(evt.deltaXInRootFrame(), evt.deltaYInRootFrame()); | |
1514 resize(pos, oldOffset); | |
1515 } else { | |
1516 NOTREACHED(); | |
1517 } | |
1518 } | |
1519 | |
1510 void PaintLayerScrollableArea::resize(const PlatformEvent& evt, | 1520 void PaintLayerScrollableArea::resize(const PlatformEvent& evt, |
1511 const LayoutSize& oldOffset) { | 1521 const LayoutSize& oldOffset) { |
1522 if (evt.type() == PlatformEvent::MouseMoved) { | |
1523 const PlatformMouseEvent* mouseMove = | |
1524 static_cast<const PlatformMouseEvent*>(&evt); | |
1525 if ((mouseMove->getModifiers() & | |
1526 (PlatformEvent::LeftButtonDown | PlatformEvent::MiddleButtonDown | | |
1527 PlatformEvent::RightButtonDown)) == 0) | |
1528 return; | |
1529 resize(mouseMove->position(), oldOffset); | |
1530 } else { | |
1531 NOTREACHED(); | |
1532 } | |
1533 } | |
1534 | |
1535 void PaintLayerScrollableArea::resize(const IntPoint& pos, | |
1536 const LayoutSize& oldOffset) { | |
1512 // FIXME: This should be possible on generated content but is not right now. | 1537 // FIXME: This should be possible on generated content but is not right now. |
1513 if (!inResizeMode() || !box().canResize() || !box().node()) | 1538 if (!inResizeMode() || !box().canResize() || !box().node()) |
1514 return; | 1539 return; |
1515 | 1540 |
1516 DCHECK(box().node()->isElementNode()); | 1541 DCHECK(box().node()->isElementNode()); |
1517 Element* element = toElement(box().node()); | 1542 Element* element = toElement(box().node()); |
1518 | 1543 |
1519 Document& document = element->document(); | 1544 Document& document = element->document(); |
1520 | 1545 |
1521 IntPoint pos; | |
1522 const PlatformGestureEvent* gevt = 0; | |
1523 | |
1524 switch (evt.type()) { | |
1525 case PlatformEvent::MouseMoved: | |
1526 if (!document.frame()->eventHandler().mousePressed()) | |
1527 return; | |
1528 pos = static_cast<const PlatformMouseEvent*>(&evt)->position(); | |
1529 break; | |
1530 case PlatformEvent::GestureScrollUpdate: | |
1531 pos = static_cast<const PlatformGestureEvent*>(&evt)->position(); | |
1532 gevt = static_cast<const PlatformGestureEvent*>(&evt); | |
1533 pos = gevt->position(); | |
1534 pos.move(gevt->deltaX(), gevt->deltaY()); | |
1535 break; | |
1536 default: | |
1537 ASSERT_NOT_REACHED(); | |
1538 } | |
1539 | |
1540 float zoomFactor = box().style()->effectiveZoom(); | 1546 float zoomFactor = box().style()->effectiveZoom(); |
1541 | 1547 |
1542 IntSize newOffset = | 1548 IntSize newOffset = |
1543 offsetFromResizeCorner(document.view()->rootFrameToContents(pos)); | 1549 offsetFromResizeCorner(document.view()->rootFrameToContents(pos)); |
1544 newOffset.setWidth(newOffset.width() / zoomFactor); | 1550 newOffset.setWidth(newOffset.width() / zoomFactor); |
1545 newOffset.setHeight(newOffset.height() / zoomFactor); | 1551 newOffset.setHeight(newOffset.height() / zoomFactor); |
1546 | 1552 |
1547 LayoutSize currentSize = box().size(); | 1553 LayoutSize currentSize = box().size(); |
1548 currentSize.scale(1 / zoomFactor); | 1554 currentSize.scale(1 / zoomFactor); |
1549 LayoutSize minimumSize = | 1555 LayoutSize minimumSize = |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2016 | 2022 |
2017 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: | 2023 void PaintLayerScrollableArea::DelayScrollOffsetClampScope:: |
2018 clampScrollableAreas() { | 2024 clampScrollableAreas() { |
2019 for (auto& scrollableArea : *s_needsClamp) | 2025 for (auto& scrollableArea : *s_needsClamp) |
2020 scrollableArea->clampScrollOffsetAfterOverflowChange(); | 2026 scrollableArea->clampScrollOffsetAfterOverflowChange(); |
2021 delete s_needsClamp; | 2027 delete s_needsClamp; |
2022 s_needsClamp = nullptr; | 2028 s_needsClamp = nullptr; |
2023 } | 2029 } |
2024 | 2030 |
2025 } // namespace blink | 2031 } // namespace blink |
OLD | NEW |