Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2011 Apple Inc. All rights reserved. |
| 3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) | 3 * 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo bile.com/) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * | 8 * |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 220 m_scrollToRevealSelectionAfterLayout = false; | 220 m_scrollToRevealSelectionAfterLayout = false; |
| 221 | 221 |
| 222 int firstIndex = listIndexToRenderListBoxIndex(select->activeSelectionStartL istIndex()); | 222 int firstIndex = listIndexToRenderListBoxIndex(select->activeSelectionStartL istIndex()); |
| 223 int lastIndex = listIndexToRenderListBoxIndex(select->activeSelectionEndList Index()); | 223 int lastIndex = listIndexToRenderListBoxIndex(select->activeSelectionEndList Index()); |
| 224 if (firstIndex >= 0 && !listIndexIsVisible(lastIndex)) | 224 if (firstIndex >= 0 && !listIndexIsVisible(lastIndex)) |
| 225 scrollToRevealElementAtListIndexInternal(firstIndex); | 225 scrollToRevealElementAtListIndexInternal(firstIndex); |
| 226 } | 226 } |
| 227 | 227 |
| 228 void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L ayoutUnit& maxLogicalWidth) const | 228 void RenderListBox::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, L ayoutUnit& maxLogicalWidth) const |
| 229 { | 229 { |
| 230 maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal; | 230 maxLogicalWidth = m_optionsWidth + 2 * optionsSpacingHorizontal + verticalSc rollbarWidth(); |
| 231 if (m_vBar) | |
| 232 maxLogicalWidth += verticalScrollbarWidth(); | |
| 233 if (!style()->width().isPercent()) | 231 if (!style()->width().isPercent()) |
| 234 minLogicalWidth = maxLogicalWidth; | 232 minLogicalWidth = maxLogicalWidth; |
| 235 } | 233 } |
| 236 | 234 |
| 237 void RenderListBox::computePreferredLogicalWidths() | 235 void RenderListBox::computePreferredLogicalWidths() |
| 238 { | 236 { |
| 239 ASSERT(!m_optionsChanged); | 237 ASSERT(!m_optionsChanged); |
| 240 | 238 |
| 241 m_minPreferredLogicalWidth = 0; | 239 m_minPreferredLogicalWidth = 0; |
| 242 m_maxPreferredLogicalWidth = 0; | 240 m_maxPreferredLogicalWidth = 0; |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 } | 380 } |
| 383 } | 381 } |
| 384 } | 382 } |
| 385 | 383 |
| 386 int RenderListBox::scrollbarLeft() const | 384 int RenderListBox::scrollbarLeft() const |
| 387 { | 385 { |
| 388 int scrollbarLeft = 0; | 386 int scrollbarLeft = 0; |
| 389 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) | 387 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) |
| 390 scrollbarLeft = borderLeft(); | 388 scrollbarLeft = borderLeft(); |
| 391 else | 389 else |
| 392 scrollbarLeft = width() - borderRight() - verticalScrollbarWidth(); | 390 scrollbarLeft = width() - borderRight() - (m_vBar ? m_vBar->width() : 0) ; |
|
tkent
2014/06/18 04:52:22
Why isn't this verticalScrollbarWidth()?
pals
2014/06/18 05:11:44
As we see, in case of overlayscrollbars, verticalS
tkent
2014/06/18 05:14:42
Ah, I see. This function calculates the position o
| |
| 393 return scrollbarLeft; | 391 return scrollbarLeft; |
| 394 } | 392 } |
| 395 | 393 |
| 396 void RenderListBox::paintScrollbar(PaintInfo& paintInfo, const LayoutPoint& pain tOffset) | 394 void RenderListBox::paintScrollbar(PaintInfo& paintInfo, const LayoutPoint& pain tOffset) |
| 397 { | 395 { |
| 398 if (m_vBar) { | 396 if (m_vBar) { |
| 399 IntRect scrollRect = pixelSnappedIntRect(paintOffset.x() + scrollbarLeft (), | 397 IntRect scrollRect = pixelSnappedIntRect(paintOffset.x() + scrollbarLeft (), |
| 400 paintOffset.y() + borderTop(), | 398 paintOffset.y() + borderTop(), |
| 401 verticalScrollbarWidth(), | 399 m_vBar->width(), |
| 402 height() - (borderTop() + borderBottom())); | 400 height() - (borderTop() + borderBottom())); |
| 403 m_vBar->setFrameRect(scrollRect); | 401 m_vBar->setFrameRect(scrollRect); |
| 404 m_vBar->paint(paintInfo.context, paintInfo.rect); | 402 m_vBar->paint(paintInfo.context, paintInfo.rect); |
| 405 } | 403 } |
| 406 } | 404 } |
| 407 | 405 |
| 408 static LayoutSize itemOffsetForAlignment(TextRun textRun, RenderStyle* itemStyle , Font itemFont, LayoutRect itemBoudingBox) | 406 static LayoutSize itemOffsetForAlignment(TextRun textRun, RenderStyle* itemStyle , Font itemFont, LayoutRect itemBoudingBox) |
| 409 { | 407 { |
| 410 ETextAlign actualAlignment = itemStyle->textAlign(); | 408 ETextAlign actualAlignment = itemStyle->textAlign(); |
| 411 // FIXME: Firefox doesn't respect JUSTIFY. Should we? | 409 // FIXME: Firefox doesn't respect JUSTIFY. Should we? |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1022 { | 1020 { |
| 1023 return itemBoundingBoxRectInternal(point, listIndexToRenderListBoxIndex(inde x)); | 1021 return itemBoundingBoxRectInternal(point, listIndexToRenderListBoxIndex(inde x)); |
| 1024 } | 1022 } |
| 1025 | 1023 |
| 1026 bool RenderListBox::scrollToRevealElementAtListIndex(int index) | 1024 bool RenderListBox::scrollToRevealElementAtListIndex(int index) |
| 1027 { | 1025 { |
| 1028 return scrollToRevealElementAtListIndexInternal(listIndexToRenderListBoxInde x(index)); | 1026 return scrollToRevealElementAtListIndexInternal(listIndexToRenderListBoxInde x(index)); |
| 1029 } | 1027 } |
| 1030 | 1028 |
| 1031 } // namespace WebCore | 1029 } // namespace WebCore |
| OLD | NEW |