| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserv
ed. |
| 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) | 3 * Copyright (C) 2006 Alexey Proskuryakov (ap@webkit.org) |
| 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) | 4 * Copyright (C) 2012 Digia Plc. and/or its subsidiary(-ies) |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 554 | 554 |
| 555 if (!node) | 555 if (!node) |
| 556 node = m_frame->document()->focusedElement(); | 556 node = m_frame->document()->focusedElement(); |
| 557 | 557 |
| 558 if (!node) | 558 if (!node) |
| 559 node = m_mousePressNode.get(); | 559 node = m_mousePressNode.get(); |
| 560 | 560 |
| 561 if (!node || !node->layoutObject()) | 561 if (!node || !node->layoutObject()) |
| 562 return ScrollResultOneDimensional(false, delta); | 562 return ScrollResultOneDimensional(false, delta); |
| 563 | 563 |
| 564 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 565 |
| 564 LayoutBox* curBox = node->layoutObject()->enclosingBox(); | 566 LayoutBox* curBox = node->layoutObject()->enclosingBox(); |
| 565 while (curBox && !curBox->isLayoutView()) { | 567 while (curBox && !curBox->isLayoutView()) { |
| 566 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( | 568 ScrollDirectionPhysical physicalDirection = toPhysicalDirection( |
| 567 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli
ppedBlocksWritingMode()); | 569 direction, curBox->isHorizontalWritingMode(), curBox->style()->isFli
ppedBlocksWritingMode()); |
| 568 | 570 |
| 569 // If we're at the stopNode, we should try to scroll it but we shouldn't
bubble past it | 571 // If we're at the stopNode, we should try to scroll it but we shouldn't
bubble past it |
| 570 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st
opNode; | 572 bool shouldStopBubbling = stopNode && *stopNode && curBox->node() == *st
opNode; |
| 571 ScrollResultOneDimensional result = curBox->scroll(physicalDirection, gr
anularity, delta); | 573 ScrollResultOneDimensional result = curBox->scroll(physicalDirection, gr
anularity, delta); |
| 572 | 574 |
| 573 if (result.didScroll && stopNode) | 575 if (result.didScroll && stopNode) |
| 574 *stopNode = curBox->node(); | 576 *stopNode = curBox->node(); |
| 575 | 577 |
| 576 if (result.didScroll || shouldStopBubbling) { | 578 if (result.didScroll || shouldStopBubbling) { |
| 577 setFrameWasScrolledByUser(); | 579 setFrameWasScrolledByUser(); |
| 578 result.didScroll = true; | 580 result.didScroll = true; |
| 579 return result; | 581 return result; |
| 580 } | 582 } |
| 581 | 583 |
| 582 curBox = curBox->containingBlock(); | 584 curBox = curBox->containingBlock(); |
| 583 } | 585 } |
| 584 | 586 |
| 585 return ScrollResultOneDimensional(false, delta); | 587 return ScrollResultOneDimensional(false, delta); |
| 586 } | 588 } |
| 587 | 589 |
| 588 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt
ate) | 590 void EventHandler::customizedScroll(const Node& startNode, ScrollState& scrollSt
ate) |
| 589 { | 591 { |
| 590 if (scrollState.fullyConsumed()) | 592 if (scrollState.fullyConsumed()) |
| 591 return; | 593 return; |
| 592 | 594 |
| 595 if (scrollState.deltaX() || scrollState.deltaY()) |
| 596 m_frame->document()->updateLayoutIgnorePendingStylesheets(); |
| 597 |
| 593 if (m_currentScrollChain.isEmpty()) | 598 if (m_currentScrollChain.isEmpty()) |
| 594 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); | 599 recomputeScrollChain(*m_frame, startNode, m_currentScrollChain); |
| 595 scrollState.setScrollChain(m_currentScrollChain); | 600 scrollState.setScrollChain(m_currentScrollChain); |
| 596 scrollState.distributeToScrollChainDescendant(); | 601 scrollState.distributeToScrollChainDescendant(); |
| 597 } | 602 } |
| 598 | 603 |
| 599 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g
ranularity, Node* startingNode) | 604 bool EventHandler::bubblingScroll(ScrollDirection direction, ScrollGranularity g
ranularity, Node* startingNode) |
| 600 { | 605 { |
| 601 // The layout needs to be up to date to determine if we can scroll. We may b
e | 606 // The layout needs to be up to date to determine if we can scroll. We may b
e |
| 602 // here because of an onLoad event, in which case the final layout hasn't be
en performed yet. | 607 // here because of an onLoad event, in which case the final layout hasn't be
en performed yet. |
| (...skipping 3153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3756 unsigned EventHandler::accessKeyModifiers() | 3761 unsigned EventHandler::accessKeyModifiers() |
| 3757 { | 3762 { |
| 3758 #if OS(MACOSX) | 3763 #if OS(MACOSX) |
| 3759 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; | 3764 return PlatformEvent::CtrlKey | PlatformEvent::AltKey; |
| 3760 #else | 3765 #else |
| 3761 return PlatformEvent::AltKey; | 3766 return PlatformEvent::AltKey; |
| 3762 #endif | 3767 #endif |
| 3763 } | 3768 } |
| 3764 | 3769 |
| 3765 } // namespace blink | 3770 } // namespace blink |
| OLD | NEW |