Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: Source/core/rendering/RenderLayerScrollableArea.cpp

Issue 239983004: Textarea resize-able only to larger; min-height and min-width properly set (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Addressing the changes asked in comments in patch set 1 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 // RenderView shouldn't provide scrollbars on its own. 709 // RenderView shouldn't provide scrollbars on its own.
710 if (m_box->isRenderView()) 710 if (m_box->isRenderView())
711 return; 711 return;
712 712
713 if (!m_scrollDimensionsDirty) 713 if (!m_scrollDimensionsDirty)
714 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow()); 714 updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollab leVerticalOverflow());
715 715
716 EOverflow overflowX = m_box->style()->overflowX(); 716 EOverflow overflowX = m_box->style()->overflowX();
717 EOverflow overflowY = m_box->style()->overflowY(); 717 EOverflow overflowY = m_box->style()->overflowY();
718 718
719 Node* node = m_box->node();
720 if (node && node->isElementNode()) {
721 Element* element = toElement(node);
722 LayoutUnit minimumWidth = valueForLength(m_box->style()->logicalMinWidth (), m_box->logicalWidth());
723 LayoutUnit minimumHeight = valueForLength(m_box->style()->logicalMinHeig ht(), m_box->logicalHeight());
724 if (minimumWidth == 0)
725 minimumWidth = LayoutUnit(15);
726 if (minimumHeight == 0)
727 minimumHeight = LayoutUnit(15);
Julien - ping for review 2014/04/21 17:46:46 I don't think we should only check for 0. We shoul
harpreet.sk 2014/04/24 15:28:27 Now added a check doing a max between the internal
728 element->setMinimumSizeForResizing(LayoutSize(minimumWidth, minimumHeigh t));
Julien - ping for review 2014/04/21 17:46:46 The fact that we do a round-trip through the DOM i
harpreet.sk 2014/04/22 13:56:36 The classes deriving from ScrollableArea other tha
Julien - ping for review 2014/04/22 22:35:12 Your analysis is fine by me.
729 }
730
719 // To avoid doing a relayout in updateScrollbarsAfterLayout, we try to keep any automatic scrollbar that was already present. 731 // 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); 732 bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefines AutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX);
721 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); 733 bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAuto maticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY);
722 setHasHorizontalScrollbar(needsHorizontalScrollbar); 734 setHasHorizontalScrollbar(needsHorizontalScrollbar);
723 setHasVerticalScrollbar(needsVerticalScrollbar); 735 setHasVerticalScrollbar(needsVerticalScrollbar);
724 736
725 // With overflow: scroll, scrollbars are always visible but may be disabled. 737 // 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 ). 738 // When switching to another value, we need to re-enable them (see bug 11985 ).
727 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) { 739 if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) {
728 ASSERT(hasHorizontalScrollbar()); 740 ASSERT(hasHorizontalScrollbar());
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
1351 ASSERT_NOT_REACHED(); 1363 ASSERT_NOT_REACHED();
1352 } 1364 }
1353 1365
1354 float zoomFactor = m_box->style()->effectiveZoom(); 1366 float zoomFactor = m_box->style()->effectiveZoom();
1355 1367
1356 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte nts(pos)); 1368 LayoutSize newOffset = offsetFromResizeCorner(document.view()->windowToConte nts(pos));
1357 newOffset.setWidth(newOffset.width() / zoomFactor); 1369 newOffset.setWidth(newOffset.width() / zoomFactor);
1358 newOffset.setHeight(newOffset.height() / zoomFactor); 1370 newOffset.setHeight(newOffset.height() / zoomFactor);
1359 1371
1360 LayoutSize currentSize = LayoutSize(m_box->width() / zoomFactor, m_box->heig ht() / zoomFactor); 1372 LayoutSize currentSize = LayoutSize(m_box->width() / zoomFactor, m_box->heig ht() / zoomFactor);
1361 LayoutSize minimumSize = element->minimumSizeForResizing().shrunkTo(currentS ize); 1373 LayoutSize minimumSize = element->minimumSizeForResizing();
Julien - ping for review 2014/04/21 17:46:46 Don't we need the shrunkTo call ias zoomFactor can
harpreet.sk 2014/04/24 15:28:27 We do not need shrunkTo() as over here m_box->widt
1362 element->setMinimumSizeForResizing(minimumSize);
1363 1374
1364 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol dOffset.height() / zoomFactor); 1375 LayoutSize adjustedOldOffset = LayoutSize(oldOffset.width() / zoomFactor, ol dOffset.height() / zoomFactor);
1365 if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) { 1376 if (m_box->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) {
1366 newOffset.setWidth(-newOffset.width()); 1377 newOffset.setWidth(-newOffset.width());
1367 adjustedOldOffset.setWidth(-adjustedOldOffset.width()); 1378 adjustedOldOffset.setWidth(-adjustedOldOffset.width());
1368 } 1379 }
1369 1380
1370 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand edTo(minimumSize) - currentSize; 1381 LayoutSize difference = (currentSize + newOffset - adjustedOldOffset).expand edTo(minimumSize) - currentSize;
1371 1382
1372 bool isBoxSizingBorder = m_box->style()->boxSizing() == BORDER_BOX; 1383 bool isBoxSizingBorder = m_box->style()->boxSizing() == BORDER_BOX;
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo sitedScrollingMode mode) 1539 void RenderLayerScrollableArea::setForceNeedsCompositedScrolling(ForceNeedsCompo sitedScrollingMode mode)
1529 { 1540 {
1530 if (m_forceNeedsCompositedScrolling == mode) 1541 if (m_forceNeedsCompositedScrolling == mode)
1531 return; 1542 return;
1532 1543
1533 m_forceNeedsCompositedScrolling = mode; 1544 m_forceNeedsCompositedScrolling = mode;
1534 layer()->didUpdateNeedsCompositedScrolling(); 1545 layer()->didUpdateNeedsCompositedScrolling();
1535 } 1546 }
1536 1547
1537 } // Namespace WebCore 1548 } // Namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698