| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 #include "platform/graphics/GraphicsContextStateSaver.h" | 68 #include "platform/graphics/GraphicsContextStateSaver.h" |
| 69 #include "platform/graphics/GraphicsLayer.h" | 69 #include "platform/graphics/GraphicsLayer.h" |
| 70 #include "platform/scroll/ScrollAnimator.h" | 70 #include "platform/scroll/ScrollAnimator.h" |
| 71 #include "platform/scroll/ScrollbarTheme.h" | 71 #include "platform/scroll/ScrollbarTheme.h" |
| 72 #include "public/platform/Platform.h" | 72 #include "public/platform/Platform.h" |
| 73 | 73 |
| 74 namespace WebCore { | 74 namespace WebCore { |
| 75 | 75 |
| 76 const int ResizerControlExpandRatioForTouch = 2; | 76 const int ResizerControlExpandRatioForTouch = 2; |
| 77 | 77 |
| 78 // Default value is set to 15 as the default | |
| 79 // minimum size used by firefox is 15x15. | |
| 80 static const int defaultMinimumWidthForResizing = 15; | |
| 81 static const int defaultMinimumHeightForResizing = 15; | |
| 82 | |
| 83 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) | 78 RenderLayerScrollableArea::RenderLayerScrollableArea(RenderLayer& layer) |
| 84 : m_layer(layer) | 79 : m_layer(layer) |
| 85 , m_inResizeMode(false) | 80 , m_inResizeMode(false) |
| 86 , m_scrollsOverflow(false) | 81 , m_scrollsOverflow(false) |
| 87 , m_scrollDimensionsDirty(true) | 82 , m_scrollDimensionsDirty(true) |
| 88 , m_inOverflowRelayout(false) | 83 , m_inOverflowRelayout(false) |
| 89 , m_scrollCorner(0) | 84 , m_scrollCorner(0) |
| 90 , m_resizer(0) | 85 , m_resizer(0) |
| 91 { | 86 { |
| 92 ScrollableArea::setConstrainsScrollingToContentEdge(false); | 87 ScrollableArea::setConstrainsScrollingToContentEdge(false); |
| (...skipping 615 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 static bool overflowRequiresScrollbar(EOverflow overflow) | 703 static bool overflowRequiresScrollbar(EOverflow overflow) |
| 709 { | 704 { |
| 710 return overflow == OSCROLL; | 705 return overflow == OSCROLL; |
| 711 } | 706 } |
| 712 | 707 |
| 713 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) | 708 static bool overflowDefinesAutomaticScrollbar(EOverflow overflow) |
| 714 { | 709 { |
| 715 return overflow == OAUTO || overflow == OOVERLAY; | 710 return overflow == OAUTO || overflow == OOVERLAY; |
| 716 } | 711 } |
| 717 | 712 |
| 718 IntSize RenderLayerScrollableArea::minimumSizeForResizing() | |
| 719 { | |
| 720 int minimumWidth = intValueForLength(box().style()->logicalMinWidth(), box()
.containingBlock()->logicalWidth()); | |
| 721 int minimumHeight = intValueForLength(box().style()->logicalMinHeight(), box
().containingBlock()->logicalHeight()); | |
| 722 | |
| 723 minimumWidth = std::max(minimumWidth, defaultMinimumWidthForResizing); | |
| 724 minimumHeight = std::max(minimumHeight, defaultMinimumHeightForResizing); | |
| 725 return IntSize(minimumWidth, minimumHeight); | |
| 726 } | |
| 727 | |
| 728 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) | 713 void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldSty
le) |
| 729 { | 714 { |
| 730 // List box parts handle the scrollbars by themselves so we have nothing to
do. | 715 // List box parts handle the scrollbars by themselves so we have nothing to
do. |
| 731 if (box().style()->appearance() == ListboxPart) | 716 if (box().style()->appearance() == ListboxPart) |
| 732 return; | 717 return; |
| 733 | 718 |
| 734 // RenderView shouldn't provide scrollbars on its own. | 719 // RenderView shouldn't provide scrollbars on its own. |
| 735 if (box().isRenderView()) | 720 if (box().isRenderView()) |
| 736 return; | 721 return; |
| 737 | 722 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1358 ASSERT_NOT_REACHED(); | 1343 ASSERT_NOT_REACHED(); |
| 1359 } | 1344 } |
| 1360 | 1345 |
| 1361 float zoomFactor = box().style()->effectiveZoom(); | 1346 float zoomFactor = box().style()->effectiveZoom(); |
| 1362 | 1347 |
| 1363 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); | 1348 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte
nts(pos)); |
| 1364 newOffset.setWidth(newOffset.width() / zoomFactor); | 1349 newOffset.setWidth(newOffset.width() / zoomFactor); |
| 1365 newOffset.setHeight(newOffset.height() / zoomFactor); | 1350 newOffset.setHeight(newOffset.height() / zoomFactor); |
| 1366 | 1351 |
| 1367 LayoutSize currentSize = LayoutSize(box().width() / zoomFactor, box().height
() / zoomFactor); | 1352 LayoutSize currentSize = LayoutSize(box().width() / zoomFactor, box().height
() / zoomFactor); |
| 1353 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS
ize); |
| 1354 element->setMinimumSizeForResizing(minimumSize); |
| 1368 | 1355 |
| 1369 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); | 1356 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol
dOffset.height() / zoomFactor); |
| 1370 if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { | 1357 if (box().style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { |
| 1371 newOffset.setWidth(-newOffset.width()); | 1358 newOffset.setWidth(-newOffset.width()); |
| 1372 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); | 1359 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); |
| 1373 } | 1360 } |
| 1374 | 1361 |
| 1375 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand
edTo(minimumSizeForResizing()) - currentSize; | 1362 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand
edTo(minimumSize) - currentSize; |
| 1376 | 1363 |
| 1377 bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX; | 1364 bool isBoxSizingBorder = box().style()->boxSizing() == BORDER_BOX; |
| 1378 | 1365 |
| 1379 EResize resize = box().style()->resize(); | 1366 EResize resize = box().style()->resize(); |
| 1380 if (resize != RESIZE_VERTICAL && difference.width()) { | 1367 if (resize != RESIZE_VERTICAL && difference.width()) { |
| 1381 if (element->isFormControlElement()) { | 1368 if (element->isFormControlElement()) { |
| 1382 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). | 1369 // Make implicit margins from the theme explicit (see <http://bugs.w
ebkit.org/show_bug.cgi?id=9547>). |
| 1383 element->setInlineStyleProperty(CSSPropertyMarginLeft, box().marginL
eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1370 element->setInlineStyleProperty(CSSPropertyMarginLeft, box().marginL
eft() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
| 1384 element->setInlineStyleProperty(CSSPropertyMarginRight, box().margin
Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); | 1371 element->setInlineStyleProperty(CSSPropertyMarginRight, box().margin
Right() / zoomFactor, CSSPrimitiveValue::CSS_PX); |
| 1385 } | 1372 } |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1479 DisableCompositingQueryAsserts disabler; | 1466 DisableCompositingQueryAsserts disabler; |
| 1480 return box().hasCompositedLayerMapping() && box().compositedLayerMapping()->
scrollingLayer(); | 1467 return box().hasCompositedLayerMapping() && box().compositedLayerMapping()->
scrollingLayer(); |
| 1481 } | 1468 } |
| 1482 | 1469 |
| 1483 bool RenderLayerScrollableArea::needsCompositedScrolling() const | 1470 bool RenderLayerScrollableArea::needsCompositedScrolling() const |
| 1484 { | 1471 { |
| 1485 return scrollsOverflow() && box().view()->compositor()->acceleratedCompositi
ngForOverflowScrollEnabled(); | 1472 return scrollsOverflow() && box().view()->compositor()->acceleratedCompositi
ngForOverflowScrollEnabled(); |
| 1486 } | 1473 } |
| 1487 | 1474 |
| 1488 } // Namespace WebCore | 1475 } // Namespace WebCore |
| OLD | NEW |