OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. | 4 * Portions are Copyright (C) 1998 Netscape Communications Corporation. |
5 * | 5 * |
6 * Other contributors: | 6 * Other contributors: |
7 * Robert O'Callahan <roc+@cs.cmu.edu> | 7 * Robert O'Callahan <roc+@cs.cmu.edu> |
8 * David Baron <dbaron@fas.harvard.edu> | 8 * David Baron <dbaron@fas.harvard.edu> |
9 * Christian Biesinger <cbiesinger@web.de> | 9 * Christian Biesinger <cbiesinger@web.de> |
10 * Randall Jesup <rjesup@wgate.com> | 10 * Randall Jesup <rjesup@wgate.com> |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 #include "platform/graphics/GraphicsContextStateSaver.h" | 66 #include "platform/graphics/GraphicsContextStateSaver.h" |
67 #include "platform/graphics/GraphicsLayer.h" | 67 #include "platform/graphics/GraphicsLayer.h" |
68 #include "platform/scroll/ScrollAnimator.h" | 68 #include "platform/scroll/ScrollAnimator.h" |
69 #include "platform/scroll/ScrollbarTheme.h" | 69 #include "platform/scroll/ScrollbarTheme.h" |
70 #include "public/platform/Platform.h" | 70 #include "public/platform/Platform.h" |
71 | 71 |
72 namespace WebCore { | 72 namespace WebCore { |
73 | 73 |
74 const int ResizerControlExpandRatioForTouch = 2; | 74 const int ResizerControlExpandRatioForTouch = 2; |
75 | 75 |
76 // Defines the default minimum size while resizing. | |
Julien - ping for review
2014/04/24 21:49:05
I think the variable name conveys this idea pretty
harpreet.sk
2014/04/25 13:33:48
This line of comment removed
| |
77 // Default size is set to 15x15 as it is the default | |
78 // minimum size used by other browsers. | |
Julien - ping for review
2014/04/24 21:49:05
You only mentioned testing on Firefox so this seem
harpreet.sk
2014/04/25 13:33:48
Removed other browsers and added firefox
| |
79 const LayoutSize defaultMinimumSizeForResizing(LayoutUnit(15), LayoutUnit(15)); | |
Julien - ping for review
2014/04/24 21:49:05
It should have static linkage too.
I also think h
harpreet.sk
2014/04/25 13:33:48
Introduce a new variable defaultMinimumValueForRes
| |
80 | |
76 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderBox* box) | 81 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderBox* box) |
77 : m_box(box) | 82 : m_box(box) |
78 , m_inResizeMode(false) | 83 , m_inResizeMode(false) |
79 , m_scrollsOverflow(false) | 84 , m_scrollsOverflow(false) |
80 , m_scrollDimensionsDirty(true) | 85 , m_scrollDimensionsDirty(true) |
81 , m_inOverflowRelayout(false) | 86 , m_inOverflowRelayout(false) |
82 , m_needsCompositedScrolling(false) | 87 , m_needsCompositedScrolling(false) |
83 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) | 88 , m_forceNeedsCompositedScrolling(DoNotForceCompositedScrolling) |
89 , m_minimumSizeForResizing(defaultMinimumSizeForResizing) | |
84 , m_scrollCorner(0) | 90 , m_scrollCorner(0) |
85 , m_resizer(0) | 91 , m_resizer(0) |
86 { | 92 { |
87 ScrollableArea::setConstrainsScrollingToContentEdge(false); | 93 ScrollableArea::setConstrainsScrollingToContentEdge(false); |
88 | 94 |
89 Node* node = m_box->node(); | 95 Node* node = m_box->node(); |
90 if (node && node->isElementNode()) { | 96 if (node && node->isElementNode()) { |
91 // We save and restore only the scrollOffset as the other scroll values are recalculated. | 97 // We save and restore only the scrollOffset as the other scroll values are recalculated. |
92 Element* element = toElement(node); | 98 Element* element = toElement(node); |
93 m_scrollOffset = element->savedLayerScrollOffset(); | 99 m_scrollOffset = element->savedLayerScrollOffset(); |
(...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
709 // RenderView shouldn't provide scrollbars on its own. | 715 // RenderView shouldn't provide scrollbars on its own. |
710 if (m_box->isRenderView()) | 716 if (m_box->isRenderView()) |
711 return; | 717 return; |
712 | 718 |
713 if (!m_scrollDimensionsDirty) | 719 if (!m_scrollDimensionsDirty) |
714 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); | 720 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); |
715 | 721 |
716 EOverflow overflowX = m_box->style()->overflowX(); | 722 EOverflow overflowX = m_box->style()->overflowX(); |
717 EOverflow overflowY = m_box->style()->overflowY(); | 723 EOverflow overflowY = m_box->style()->overflowY(); |
718 | 724 |
725 LayoutUnit minimumWidth; | |
726 LayoutUnit minimumHeight; | |
727 | |
728 if (m_box->parent()) { | |
Julien - ping for review
2014/04/24 21:49:05
This is wrong, you want to use your containingBloc
harpreet.sk
2014/04/25 13:33:48
Replaced with containingBlock()
| |
729 minimumWidth = valueForLength(m_box->style()->logicalMinWidth(), m_box-> parentBox()->logicalWidth()); | |
730 minimumHeight = valueForLength(m_box->style()->logicalMinHeight(), m_box ->parentBox()->logicalHeight()); | |
Julien - ping for review
2014/04/24 21:49:05
I think this could not return what is expected by
harpreet.sk
2014/04/25 13:33:48
I thought of keeping it same as m_box->containingB
Julien - ping for review
2014/04/28 17:07:29
You're misunderstanding here: vertical writing mod
| |
731 } | |
732 | |
733 minimumWidth = std::max(minimumWidth, defaultMinimumSizeForResizing.width()) ; | |
734 minimumHeight = std::max(minimumHeight, defaultMinimumSizeForResizing.height ()); | |
Julien - ping for review
2014/04/24 21:49:05
How about rolling this code into an helper functio
harpreet.sk
2014/04/25 13:33:48
Introduce a helper function updateMinimumSizeForRe
| |
735 m_minimumSizeForResizing = LayoutSize(minimumWidth, minimumHeight); | |
736 | |
719 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present. | 737 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present. |
720 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); | 738 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); |
721 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); | 739 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); |
722 setHasHorizontalScrollbar(needsHorizontalScrollbar); | 740 setHasHorizontalScrollbar(needsHorizontalScrollbar); |
723 setHasVerticalScrollbar(needsVerticalScrollbar); | 741 setHasVerticalScrollbar(needsVerticalScrollbar); |
724 | 742 |
725 // With overflow: scroll, scrollbars are always visible but may be disabled. | 743 // With overflow: scroll, scrollbars are always visible but may be disabled. |
726 // When switching to another value, we need to re-enable them (see bug 11985 ). | 744 // When switching to another value, we need to re-enable them (see bug 11985 ). |
727 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) { | 745 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) { |
728 ASSERT(hasHorizontalScrollbar()); | 746 ASSERT(hasHorizontalScrollbar()); |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1351 ASSERT_NOT_REACHED(); | 1369 ASSERT_NOT_REACHED(); |
1352 } | 1370 } |
1353 | 1371 |
1354 float zoomFactor = m_box->style()->effectiveZoom(); | 1372 float zoomFactor = m_box->style()->effectiveZoom(); |
1355 | 1373 |
1356 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte nts(pos)); | 1374 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte nts(pos)); |
1357 newOffset.setWidth(newOffset.width() / zoomFactor); | 1375 newOffset.setWidth(newOffset.width() / zoomFactor); |
1358 newOffset.setHeight(newOffset.height() / zoomFactor); | 1376 newOffset.setHeight(newOffset.height() / zoomFactor); |
1359 | 1377 |
1360 LayoutSize currentSize = LayoutSize(m_box->width() / zoomFactor, m_box->heig ht() / zoomFactor); | 1378 LayoutSize currentSize = LayoutSize(m_box->width() / zoomFactor, m_box->heig ht() / zoomFactor); |
1361 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS ize); | 1379 LayoutSize minimumSize = m_minimumSizeForResizing; |
Julien - ping for review
2014/04/24 21:49:05
No need for this variable anymore.
harpreet.sk
2014/04/25 13:33:48
Variable removed.
| |
1362 element->setMinimumSizeForResizing(minimumSize); | |
1363 | 1380 |
1364 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol dOffset.height() / zoomFactor); | 1381 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol dOffset.height() / zoomFactor); |
1365 if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 1382 if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
1366 newOffset.setWidth(-newOffset.width()); | 1383 newOffset.setWidth(-newOffset.width()); |
1367 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); | 1384 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); |
1368 } | 1385 } |
1369 | 1386 |
1370 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand edTo(minimumSize) - currentSize; | 1387 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand edTo(minimumSize) - currentSize; |
1371 | 1388 |
1372 bool isBoxSizingBorder = m_box->style()->boxSizing() == BORDER_BOX; | 1389 bool isBoxSizingBorder = m_box->style()->boxSizing() == BORDER_BOX; |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1528 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo sitedScrollingMode mode) | 1545 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo sitedScrollingMode mode) |
1529 { | 1546 { |
1530 if (m_forceNeedsCompositedScrolling == mode) | 1547 if (m_forceNeedsCompositedScrolling == mode) |
1531 return; | 1548 return; |
1532 | 1549 |
1533 m_forceNeedsCompositedScrolling = mode; | 1550 m_forceNeedsCompositedScrolling = mode; |
1534 layer()->didUpdateNeedsCompositedScrolling(); | 1551 layer()->didUpdateNeedsCompositedScrolling(); |
1535 } | 1552 } |
1536 | 1553 |
1537 } // Namespace WebCore | 1554 } // Namespace WebCore |
OLD | NEW |