OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) | 4 * (C) 2005 Allan Sandfeld Jensen (kde@carewolf.com) |
5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) | 5 * (C) 2005, 2006 Samuel Weinig (sam.weinig@gmail.com) |
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. | 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserv ed. |
7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. | 7 * Copyright (C) 2013 Adobe Systems Incorporated. All rights reserved. |
8 * | 8 * |
9 * This library is free software; you can redistribute it and/or | 9 * This library is free software; you can redistribute it and/or |
10 * modify it under the terms of the GNU Library General Public | 10 * modify it under the terms of the GNU Library General Public |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
93 // The <body> only paints its background if the root element has defined a b ackground independent of the body, | 93 // The <body> only paints its background if the root element has defined a b ackground independent of the body, |
94 // or if the <body>'s parent is not the document element's renderer (e.g. in side SVG foreignObject). | 94 // or if the <body>'s parent is not the document element's renderer (e.g. in side SVG foreignObject). |
95 LayoutObject* documentElementRenderer = bodyElementRenderer->document().docu mentElement()->layoutObject(); | 95 LayoutObject* documentElementRenderer = bodyElementRenderer->document().docu mentElement()->layoutObject(); |
96 return documentElementRenderer | 96 return documentElementRenderer |
97 && !documentElementRenderer->hasBackground() | 97 && !documentElementRenderer->hasBackground() |
98 && (documentElementRenderer == bodyElementRenderer->parent()); | 98 && (documentElementRenderer == bodyElementRenderer->parent()); |
99 } | 99 } |
100 | 100 |
101 LayoutBox::LayoutBox(ContainerNode* node) | 101 LayoutBox::LayoutBox(ContainerNode* node) |
102 : LayoutBoxModelObject(node) | 102 : LayoutBoxModelObject(node) |
103 , m_unusedDelta(IntPoint()) | |
103 , m_intrinsicContentLogicalHeight(-1) | 104 , m_intrinsicContentLogicalHeight(-1) |
104 , m_minPreferredLogicalWidth(-1) | 105 , m_minPreferredLogicalWidth(-1) |
105 , m_maxPreferredLogicalWidth(-1) | 106 , m_maxPreferredLogicalWidth(-1) |
106 { | 107 { |
107 setIsBox(); | 108 setIsBox(); |
108 } | 109 } |
109 | 110 |
110 DeprecatedPaintLayerType LayoutBox::layerTypeRequired() const | 111 DeprecatedPaintLayerType LayoutBox::layerTypeRequired() const |
111 { | 112 { |
112 // hasAutoZIndex only returns true if the element is positioned or a flex-it em since | 113 // hasAutoZIndex only returns true if the element is positioned or a flex-it em since |
(...skipping 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
739 { | 740 { |
740 // Presumably the same issue as in setScrollTop. See crbug.com/343132. | 741 // Presumably the same issue as in setScrollTop. See crbug.com/343132. |
741 DisableCompositingQueryAsserts disabler; | 742 DisableCompositingQueryAsserts disabler; |
742 | 743 |
743 // Logical scroll is a higher level concept, all directions by here must be physical | 744 // Logical scroll is a higher level concept, all directions by here must be physical |
744 ASSERT(!isLogical(direction)); | 745 ASSERT(!isLogical(direction)); |
745 | 746 |
746 if (!layer() || !layer()->scrollableArea()) | 747 if (!layer() || !layer()->scrollableArea()) |
747 return false; | 748 return false; |
748 | 749 |
749 return layer()->scrollableArea()->scroll(direction, granularity, delta); | 750 Scrollbar* scrollbar = (direction == ScrollUp || direction == ScrollDown) ? layer()->scrollableArea()->verticalScrollbar() : layer()->scrollableArea()->hori zontalScrollbar(); |
751 IntPoint initialPoint = scrollbar ? layer()->scrollableArea()->convertFromSc rollbarToContainingView(scrollbar, layer()->scrollableArea()->scrollPosition()) : IntPoint(); | |
752 bool didScroll = layer()->scrollableArea()->scroll(direction, granularity, d elta); | |
753 IntPoint afterScrollPoint = scrollbar ? layer()->scrollableArea()->convertFr omScrollbarToContainingView(scrollbar, layer()->scrollableArea()->scrollPosition ()) : IntPoint(); | |
754 if (direction == ScrollUp || direction == ScrollDown) | |
755 m_unusedDelta.setY(((afterScrollPoint.y() - initialPoint.y()) + delta) * -1); | |
756 else if (direction == ScrollLeft || direction == ScrollRight) | |
757 m_unusedDelta.setX(((afterScrollPoint.x() - initialPoint.x()) + delta) * -1); | |
758 return didScroll; | |
750 } | 759 } |
751 | 760 |
majidvp
2015/04/23 18:25:08
unused scroll delta is already being calculated in
MuVen
2015/04/27 12:53:46
Done.
| |
752 bool LayoutBox::canBeScrolledAndHasScrollableArea() const | 761 bool LayoutBox::canBeScrolledAndHasScrollableArea() const |
753 { | 762 { |
754 return canBeProgramaticallyScrolled() && (pixelSnappedScrollHeight() != pixe lSnappedClientHeight() || pixelSnappedScrollWidth() != pixelSnappedClientWidth() ); | 763 return canBeProgramaticallyScrolled() && (pixelSnappedScrollHeight() != pixe lSnappedClientHeight() || pixelSnappedScrollWidth() != pixelSnappedClientWidth() ); |
755 } | 764 } |
756 | 765 |
757 bool LayoutBox::canBeProgramaticallyScrolled() const | 766 bool LayoutBox::canBeProgramaticallyScrolled() const |
758 { | 767 { |
759 Node* node = this->node(); | 768 Node* node = this->node(); |
760 if (node && node->isDocumentNode()) | 769 if (node && node->isDocumentNode()) |
761 return true; | 770 return true; |
(...skipping 3927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4689 computedValues.m_margins.m_end = marginEnd(); | 4698 computedValues.m_margins.m_end = marginEnd(); |
4690 | 4699 |
4691 setLogicalTop(oldLogicalTop); | 4700 setLogicalTop(oldLogicalTop); |
4692 setLogicalWidth(oldLogicalWidth); | 4701 setLogicalWidth(oldLogicalWidth); |
4693 setLogicalLeft(oldLogicalLeft); | 4702 setLogicalLeft(oldLogicalLeft); |
4694 setMarginLeft(oldMarginLeft); | 4703 setMarginLeft(oldMarginLeft); |
4695 setMarginRight(oldMarginRight); | 4704 setMarginRight(oldMarginRight); |
4696 } | 4705 } |
4697 | 4706 |
4698 } // namespace blink | 4707 } // namespace blink |
OLD | NEW |