text = toHTMLOptGroupElement(element)->groupLabelText();
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
- itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+ itemFont = Font(d);
itemFont.update(document().styleEngine()->fontSelector());
}
{
maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal;
if (m_vBar)
- maxLogicalWidth += m_vBar->width();
+ maxLogicalWidth += verticalScrollbarWidth();
if (!style()->width().isPercent())
minLogicalWidth = maxLogicalWidth;
}
LayoutRect RenderListBox::itemBoundingBoxRect(const LayoutPoint& additionalOffset, int index)
{
// For RTL, items start after the left-side vertical scrollbar.
- int scrollbarOffset = style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? m_vBar->width() : 0;
+ int scrollbarOffset = style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? verticalScrollbarWidth() : 0;
return LayoutRect(additionalOffset.x() + borderLeft() + paddingLeft() + scrollbarOffset,
additionalOffset.y() + borderTop() + paddingTop() + itemHeight() * (index - m_indexOffset),
contentWidth(), itemHeight());
}
// Paint the children.
- RenderBlock::paintObject(paintInfo, paintOffset);
+ RenderBlockFlow::paintObject(paintInfo, paintOffset);
switch (paintInfo.phase) {
// Depending on whether we have overlay scrollbars they
void RenderListBox::addFocusRingRects(Vector<IntRect>& rects, const LayoutPoint& additionalOffset, const RenderLayerModelObject* paintContainer)
{
if (!isSpatialNavigationEnabled(frame()))
- return RenderBlock::addFocusRingRects(rects, additionalOffset, paintContainer);
+ return RenderBlockFlow::addFocusRingRects(rects, additionalOffset, paintContainer);
HTMLSelectElement* select = selectElement();
if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
scrollbarLeft = borderLeft();
else
- scrollbarLeft = width() - borderRight() - m_vBar->width();
+ scrollbarLeft = width() - borderRight() - verticalScrollbarWidth();
return scrollbarLeft;
}
if (m_vBar) {
IntRect scrollRect = pixelSnappedIntRect(paintOffset.x() + scrollbarLeft(),
paintOffset.y() + borderTop(),
- m_vBar->width(),
+ verticalScrollbarWidth(),
height() - (borderTop() + borderBottom()));
m_vBar->setFrameRect(scrollRect);
m_vBar->paint(paintInfo.context, paintInfo.rect);
if (element->hasTagName(optgroupTag)) {
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
- itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+ itemFont = Font(d);
itemFont.update(document().styleEngine()->fontSelector());
}
LayoutRect vertRect(accumulatedOffset.x() + scrollbarLeft(),
accumulatedOffset.y() + borderTop(),
- m_vBar->width(),
+ verticalScrollbarWidth(),
height() - borderTop() - borderBottom());
if (vertRect.contains(locationInContainer)) {
if (offset.height() < borderTop() + paddingTop() || offset.height() > height() - paddingBottom() - borderBottom())
return -1;
- int scrollbarWidth = m_vBar ? m_vBar->width() : 0;
+ int scrollbarWidth = verticalScrollbarWidth();
int rightScrollbarOffset = style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? scrollbarWidth : 0;
int leftScrollbarOffset = style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft() ? 0 : scrollbarWidth;
if (offset.width() < borderLeft() + paddingLeft() + rightScrollbarOffset
return;
m_indexOffset = newOffset;
- repaint();
+
+ if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && frameView()->isInPerformLayout())
+ setShouldDoFullRepaintAfterLayout(true);
+ else
+ repaint();
+
node()->document().enqueueScrollEventForNode(node());
}
bool RenderListBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, HitTestAction hitTestAction)
{
- if (!RenderBlock::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction))
+ if (!RenderBlockFlow::nodeAtPoint(request, result, locationInContainer, accumulatedOffset, hitTestAction))
return false;
const Vector<HTMLElement*>& listItems = selectElement()->listItems();
int size = numItems();
{
LayoutRect clipRect = contentBoxRect();
if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
- clipRect.moveBy(additionalOffset + LayoutPoint(m_vBar->width(), 0));
+ clipRect.moveBy(additionalOffset + LayoutPoint(verticalScrollbarWidth(), 0));
else
clipRect.moveBy(additionalOffset);
return clipRect;
scrollRect.move(borderLeft(), borderTop());
else
scrollRect.move(width() - borderRight() - scrollbar->width(), borderTop());
- repaintRectangle(scrollRect);
+
+ if (RuntimeEnabledFeatures::repaintAfterLayoutEnabled() && frameView()->isInPerformLayout()) {
+ m_verticalBarDamage = scrollRect;
+ m_hasVerticalBarDamage = true;
+ } else {
+ repaintRectangle(scrollRect);
+ }
+}
+
+void RenderListBox::repaintScrollbarIfNeeded()
+{
+ if (!hasVerticalBarDamage())
+ return;
+ repaintRectangle(verticalBarDamage());
+
+ resetScrollbarDamage();
}
IntRect RenderListBox::convertFromScrollbarToContainingView(const Scrollbar* scrollbar, const IntRect& scrollbarRect) const
IntPoint RenderListBox::maximumScrollPosition() const
{
- return IntPoint(0, numItems() - numVisibleItems());
+ return IntPoint(0, std::max(numItems() - numVisibleItems(), 0));
}
bool RenderListBox::userInputScrollable(ScrollbarOrientation orientation) const