Browse Source

Property 'white-space: nowrap' should not disable scrollbars on overflow. See #94.

Michael Ragazzon 5 years ago
parent
commit
9f17bde203
2 changed files with 10 additions and 6 deletions
  1. 6 0
      Samples/basic/demo/src/main.cpp
  2. 4 6
      Source/Core/LayoutBlockBox.cpp

+ 6 - 0
Samples/basic/demo/src/main.cpp

@@ -43,6 +43,12 @@ scrollbarvertical slidertrack:active { background: #ddd; }
 scrollbarvertical sliderbar { width: 15px; min-height: 30px; background: #aaa; }
 scrollbarvertical sliderbar:hover { background: #888; }
 scrollbarvertical sliderbar:active { background: #666; }
+scrollbarhorizontal { height: 15px; }
+scrollbarhorizontal slidertrack { background: #eee; }
+scrollbarhorizontal slidertrack:active { background: #ddd; }
+scrollbarhorizontal sliderbar { height: 15px; min-width: 30px; background: #aaa; }
+scrollbarhorizontal sliderbar:hover { background: #888; }
+scrollbarhorizontal sliderbar:active { background: #666; }
 )";
 
 

+ 4 - 6
Source/Core/LayoutBlockBox.cpp

@@ -221,14 +221,12 @@ LayoutBlockBox::CloseResult LayoutBlockBox::Close()
 			Vector2f space_box = space->GetDimensions();
 			content_box.x = Math::Max(content_box.x, space_box.x);
 
-			// If our content is larger than our window, then we can either extend our box, if we're set to not wrap
-			// our inline content, or enable the horizontal scrollbar, if we're set to auto-scrollbars. If we're set to
-			// always use scrollbars, then the horiontal scrollbar will already have been enabled in the constructor.
+			// If our content is larger than our window, we can enable the horizontal scrollbar if
+			// we're set to auto-scrollbars. If we're set to always use scrollbars, then the horiontal
+			// scrollbar will already have been enabled in the constructor.
 			if (content_box.x > box.GetSize().x)
 			{
-				if (!wrap_content)
-					box.SetContent(Vector2f(content_box.x, box.GetSize().y));
-				else if (overflow_x_property == Style::Overflow::Auto)
+				if (overflow_x_property == Style::Overflow::Auto)
 				{
 					element->GetElementScroll()->EnableScrollbar(ElementScroll::HORIZONTAL, box.GetSize(Box::PADDING).x);