| Differences between
and this patch
- Source/WebCore/ChangeLog +35 lines
Lines 1-3 Source/WebCore/ChangeLog_sec1
1
2012-02-03  Hironori Bono  <hbono@chromium.org>
2
3
        Render overflow controls of an RTL element to its left-side.
4
        https://bugs.webkit.org/show_bug.cgi?id=54623
5
6
        This change adds a new flag WTF_USE_RTL_SCROLLBAR and render the
7
        vertical scrollbars and resizers of RTL elements to their left side if
8
        this new flag is enabled.
9
10
        Reviewed by NOBODY (OOPS!).
11
12
        Test: platform/chromium/fast/events/rtl-scrollbar.html
13
14
        * rendering/RenderBlock.cpp:
15
        (WebCore::RenderBlock::addOverflowFromPositionedObjects): Move child elements right.
16
        (WebCore::RenderBlock::determineLogicalLeftPositionForChild): ditto.
17
        * rendering/RenderBox.cpp:
18
        (WebCore::RenderBox::overflowClipRect): Move the content rectangle right.
19
        * rendering/RenderLayer.cpp:
20
        (WebCore::cornerStart): Added a function that calculates the X position of a resizer.
21
        (WebCore):
22
        (WebCore::cornerRect): Use cornerStart to move a resizer.
23
        (WebCore::RenderLayer::verticalScrollbarStart): Added a function that calculates
24
        the X position of a horizontal scrollbar.
25
        (WebCore::RenderLayer::horizontalScrollbarStart): Render a vertical scrollbar to the left side
26
        and move a horizontal scrollbar right by the width of the vertical scrollbar.
27
        (WebCore::RenderLayer::scrollbarOffset): ditto.
28
        (WebCore::RenderLayer::invalidateScrollbarRect): ditto.
29
        (WebCore::RenderLayer::positionOverflowControls): ditto.
30
        (WebCore::RenderLayer::hitTestOverflowControls): ditto.
31
        * rendering/RenderLayer.h:
32
        (RenderLayer):
33
        * rendering/style/RenderStyle.h: Added shouldPlaceBlockDirectionScrollbarOnLogicalLeft,
34
        which returns if we need to move a left scrollbar to its right side.
35
1
2012-02-03  Kentaro Hara  <haraken@chromium.org>
36
2012-02-03  Kentaro Hara  <haraken@chromium.org>
2
37
3
        Add the "CPP" prefix to CPP specific IDL attributes
38
        Add the "CPP" prefix to CPP specific IDL attributes
- Source/WebCore/rendering/RenderBlock.cpp -2 / +12 lines
Lines 1512-1519 void RenderBlock::addOverflowFromPositio Source/WebCore/rendering/RenderBlock.cpp_sec1
1512
        positionedObject = *it;
1512
        positionedObject = *it;
1513
        
1513
        
1514
        // Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
1514
        // Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
1515
        if (positionedObject->style()->position() != FixedPosition)
1515
        if (positionedObject->style()->position() != FixedPosition) {
1516
            addOverflowFromChild(positionedObject);
1516
            int x = positionedObject->x();
1517
#if USE(RTL_SCROLLBAR)
1518
            if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1519
                x -= verticalScrollbarWidth();
1520
#endif
1521
            addOverflowFromChild(positionedObject, IntSize(x, positionedObject->y()));
1522
        }
1517
    }
1523
    }
1518
}
1524
}
1519
1525
Lines 1906-1911 LayoutUnit RenderBlock::computeStartPosi Source/WebCore/rendering/RenderBlock.cpp_sec2
1906
void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
1912
void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
1907
{
1913
{
1908
    LayoutUnit startPosition = borderStart() + paddingStart();
1914
    LayoutUnit startPosition = borderStart() + paddingStart();
1915
#if USE(RTL_SCROLLBAR)
1916
    if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1917
        startPosition -= verticalScrollbarWidth();
1918
#endif
1909
    LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();
1919
    LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();
1910
1920
1911
    // Add in our start margin.
1921
    // Add in our start margin.
- Source/WebCore/rendering/RenderBox.cpp -1 / +6 lines
Lines 1206-1213 LayoutRect RenderBox::overflowClipRect(c Source/WebCore/rendering/RenderBox.cpp_sec1
1206
    clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
1206
    clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
1207
1207
1208
    // Subtract out scrollbars if we have them.
1208
    // Subtract out scrollbars if we have them.
1209
    if (layer())
1209
     if (layer()) {
1210
#if USE(RTL_SCROLLBAR)
1211
        if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1212
            clipRect.move(layer()->verticalScrollbarWidth(relevancy), 0);
1213
#endif
1210
        clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy));
1214
        clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy));
1215
     }
1211
1216
1212
    return clipRect;
1217
    return clipRect;
1213
}
1218
}
- Source/WebCore/rendering/RenderLayer.cpp -9 / +43 lines
Lines 1798-1803 bool RenderLayer::isActive() const Source/WebCore/rendering/RenderLayer.cpp_sec1
1798
    return page && page->focusController()->isActive();
1798
    return page && page->focusController()->isActive();
1799
}
1799
}
1800
1800
1801
static LayoutUnit cornerStart(const RenderLayer* layer, int minX, int maxX, int thickness)
1802
{
1803
#if USE(RTL_SCROLLBAR)
1804
    if (layer->renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1805
        return minX + layer->renderer()->style()->borderLeftWidth();
1806
#else
1807
    UNUSED_PARAM(minX);
1808
#endif
1809
    return maxX - thickness - layer->renderer()->style()->borderRightWidth();
1810
}
1811
1801
static IntRect cornerRect(const RenderLayer* layer, const IntRect& bounds)
1812
static IntRect cornerRect(const RenderLayer* layer, const IntRect& bounds)
1802
{
1813
{
1803
    int horizontalThickness;
1814
    int horizontalThickness;
Lines 1817-1823 static IntRect cornerRect(const RenderLa Source/WebCore/rendering/RenderLayer.cpp_sec2
1817
        horizontalThickness = layer->verticalScrollbar()->width();
1828
        horizontalThickness = layer->verticalScrollbar()->width();
1818
        verticalThickness = layer->horizontalScrollbar()->height();
1829
        verticalThickness = layer->horizontalScrollbar()->height();
1819
    }
1830
    }
1820
    return IntRect(bounds.maxX() - horizontalThickness - layer->renderer()->style()->borderRightWidth(), 
1831
    return IntRect(cornerStart(layer, bounds.x(), bounds.maxX(), horizontalThickness),
1821
                   bounds.maxY() - verticalThickness - layer->renderer()->style()->borderBottomWidth(),
1832
                   bounds.maxY() - verticalThickness - layer->renderer()->style()->borderBottomWidth(),
1822
                   horizontalThickness, verticalThickness);
1833
                   horizontalThickness, verticalThickness);
1823
}
1834
}
Lines 1940-1954 IntPoint RenderLayer::currentMousePositi Source/WebCore/rendering/RenderLayer.cpp_sec3
1940
    return renderer()->frame() ? renderer()->frame()->eventHandler()->currentMousePosition() : IntPoint();
1951
    return renderer()->frame() ? renderer()->frame()->eventHandler()->currentMousePosition() : IntPoint();
1941
}
1952
}
1942
1953
1954
LayoutUnit RenderLayer::verticalScrollbarStart(int minX, int maxX) const
1955
{
1956
    const RenderBox* box = renderBox();
1957
#if USE(RTL_SCROLLBAR)
1958
    if (renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1959
        return minX + box->borderLeft();
1960
#else
1961
    UNUSED_PARAM(minX);
1962
#endif
1963
    return maxX - box->borderRight() - m_vBar->width();
1964
}
1965
1966
LayoutUnit RenderLayer::horizontalScrollbarStart(int minX) const
1967
{
1968
    const RenderBox* box = renderBox();
1969
    int x = minX + box->borderLeft();
1970
#if USE(RTL_SCROLLBAR)
1971
    if (renderer()->style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
1972
        x += m_vBar ? m_vBar->width() : resizerCornerRect(this, box->borderBoxRect()).width();
1973
#endif
1974
    return x;
1975
}
1976
1943
IntSize RenderLayer::scrollbarOffset(const Scrollbar* scrollbar) const
1977
IntSize RenderLayer::scrollbarOffset(const Scrollbar* scrollbar) const
1944
{
1978
{
1945
    RenderBox* box = renderBox();
1979
    RenderBox* box = renderBox();
1946
1980
1947
    if (scrollbar == m_vBar.get())
1981
    if (scrollbar == m_vBar.get())
1948
        return IntSize(box->width() - box->borderRight() - scrollbar->width(), box->borderTop());
1982
        return IntSize(verticalScrollbarStart(0, box->width()), box->borderTop());
1949
1983
1950
    if (scrollbar == m_hBar.get())
1984
    if (scrollbar == m_hBar.get())
1951
        return IntSize(box->borderLeft(), box->height() - box->borderBottom() - scrollbar->height());
1985
        return IntSize(horizontalScrollbarStart(0), box->height() - box->borderBottom() - scrollbar->height());
1952
    
1986
    
1953
    ASSERT_NOT_REACHED();
1987
    ASSERT_NOT_REACHED();
1954
    return IntSize();
1988
    return IntSize();
Lines 1973-1981 void RenderLayer::invalidateScrollbarRec Source/WebCore/rendering/RenderLayer.cpp_sec4
1973
    RenderBox* box = renderBox();
2007
    RenderBox* box = renderBox();
1974
    ASSERT(box);
2008
    ASSERT(box);
1975
    if (scrollbar == m_vBar.get())
2009
    if (scrollbar == m_vBar.get())
1976
        scrollRect.move(box->width() - box->borderRight() - scrollbar->width(), box->borderTop());
2010
        scrollRect.move(verticalScrollbarStart(0, box->width()), box->borderTop());
1977
    else
2011
    else
1978
        scrollRect.move(box->borderLeft(), box->height() - box->borderBottom() - scrollbar->height());
2012
        scrollRect.move(horizontalScrollbarStart(0), box->height() - box->borderBottom() - scrollbar->height());
1979
    renderer()->repaintRectangle(scrollRect);
2013
    renderer()->repaintRectangle(scrollRect);
1980
}
2014
}
1981
2015
Lines 2153-2165 void RenderLayer::positionOverflowContro Source/WebCore/rendering/RenderLayer.cpp_sec5
2153
    const IntRect& scrollCorner = scrollCornerRect();
2187
    const IntRect& scrollCorner = scrollCornerRect();
2154
    IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());
2188
    IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());
2155
    if (m_vBar)
2189
    if (m_vBar)
2156
        m_vBar->setFrameRect(IntRect(absBounds.maxX() - box->borderRight() - m_vBar->width(),
2190
        m_vBar->setFrameRect(IntRect(verticalScrollbarStart(absBounds.x(), absBounds.maxX()),
2157
                                     absBounds.y() + box->borderTop(),
2191
                                     absBounds.y() + box->borderTop(),
2158
                                     m_vBar->width(),
2192
                                     m_vBar->width(),
2159
                                     absBounds.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height()));
2193
                                     absBounds.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height()));
2160
2194
2161
    if (m_hBar)
2195
    if (m_hBar)
2162
        m_hBar->setFrameRect(IntRect(absBounds.x() + box->borderLeft(),
2196
        m_hBar->setFrameRect(IntRect(horizontalScrollbarStart(absBounds.x()),
2163
                                     absBounds.maxY() - box->borderBottom() - m_hBar->height(),
2197
                                     absBounds.maxY() - box->borderBottom() - m_hBar->height(),
2164
                                     absBounds.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),
2198
                                     absBounds.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),
2165
                                     m_hBar->height()));
2199
                                     m_hBar->height()));
Lines 2560-2566 bool RenderLayer::hitTestOverflowControl Source/WebCore/rendering/RenderLayer.cpp_sec6
2560
    int resizeControlSize = max(resizeControlRect.height(), 0);
2594
    int resizeControlSize = max(resizeControlRect.height(), 0);
2561
2595
2562
    if (m_vBar && m_vBar->shouldParticipateInHitTesting()) {
2596
    if (m_vBar && m_vBar->shouldParticipateInHitTesting()) {
2563
        LayoutRect vBarRect(box->width() - box->borderRight() - m_vBar->width(), 
2597
        LayoutRect vBarRect(verticalScrollbarStart(0, box->width()),
2564
                            box->borderTop(),
2598
                            box->borderTop(),
2565
                            m_vBar->width(),
2599
                            m_vBar->width(),
2566
                            box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));
2600
                            box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));
Lines 2572-2578 bool RenderLayer::hitTestOverflowControl Source/WebCore/rendering/RenderLayer.cpp_sec7
2572
2606
2573
    resizeControlSize = max(resizeControlRect.width(), 0);
2607
    resizeControlSize = max(resizeControlRect.width(), 0);
2574
    if (m_hBar && m_hBar->shouldParticipateInHitTesting()) {
2608
    if (m_hBar && m_hBar->shouldParticipateInHitTesting()) {
2575
        LayoutRect hBarRect(box->borderLeft(),
2609
        LayoutRect hBarRect(horizontalScrollbarStart(0),
2576
                            box->height() - box->borderBottom() - m_hBar->height(),
2610
                            box->height() - box->borderBottom() - m_hBar->height(),
2577
                            box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
2611
                            box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
2578
                            m_hBar->height());
2612
                            m_hBar->height());
- Source/WebCore/rendering/RenderLayer.h +3 lines
Lines 750-755 private: Source/WebCore/rendering/RenderLayer.h_sec1
750
            ;
750
            ;
751
    }
751
    }
752
752
753
    LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
754
    LayoutUnit horizontalScrollbarStart(int minX) const;
755
753
protected:
756
protected:
754
    // The bitfields are up here so they will fall into the padding from ScrollableArea on 64-bit.
757
    // The bitfields are up here so they will fall into the padding from ScrollableArea on 64-bit.
755
758
- Source/WebCore/rendering/style/RenderStyle.h +2 lines
Lines 962-967 public: Source/WebCore/rendering/style/RenderStyle.h_sec1
962
#else
962
#else
963
    bool hasFilter() const { return false; }
963
    bool hasFilter() const { return false; }
964
#endif
964
#endif
965
966
    bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
965
        
967
        
966
// attribute setter methods
968
// attribute setter methods
967
969
- Source/WebKit/chromium/ChangeLog +13 lines
Lines 1-3 Source/WebKit/chromium/ChangeLog_sec1
1
2012-02-03  Hironori Bono  <hbono@chromium.org>
2
3
        Render overflow controls of an RTL element to its left-side.
4
        https://bugs.webkit.org/show_bug.cgi?id=54623
5
6
        This change sets a new flag WTF_USE_RTL_SCROLLBAR on Chromium so we can
7
        render the vertical scrollbars and resizers of RTL elements to their
8
        left side.
9
10
        Reviewed by NOBODY (OOPS!).
11
12
        * features.gypi: Set WTF_USE_RTL_SCROLLBAR to 1 on Chromium.
13
1
2012-02-02  Tommy Widenflycht  <tommyw@google.com>
14
2012-02-02  Tommy Widenflycht  <tommyw@google.com>
2
15
3
        [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
16
        [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
- Source/WebKit/chromium/features.gypi +1 lines
Lines 106-111 Source/WebKit/chromium/features.gypi_sec1
106
      # We can't define it here because it should be present only
106
      # We can't define it here because it should be present only
107
      # in Debug or release_valgrind_build=1 builds.
107
      # in Debug or release_valgrind_build=1 builds.
108
      'WTF_USE_OPENTYPE_SANITIZER=1',
108
      'WTF_USE_OPENTYPE_SANITIZER=1',
109
      'WTF_USE_RTL_SCROLLBAR=1',
109
      'WTF_USE_SKIA_TEXT=<(enable_skia_text)',
110
      'WTF_USE_SKIA_TEXT=<(enable_skia_text)',
110
      'WTF_USE_WEBP=1',
111
      'WTF_USE_WEBP=1',
111
      'WTF_USE_WEBKIT_IMAGE_DECODERS=1',
112
      'WTF_USE_WEBKIT_IMAGE_DECODERS=1',
- LayoutTests/ChangeLog +14 lines
Lines 1-3 LayoutTests/ChangeLog_sec1
1
2012-02-03  Hironori Bono  <hbono@chromium.org>
2
3
        Render overflow controls of an RTL element to its left-side.
4
        https://bugs.webkit.org/show_bug.cgi?id=54623
5
6
        This change adds a new flag WTF_USE_RTL_SCROLLBAR and render the
7
        vertical scrollbars and resizers of RTL elements to their left side if
8
        this new flag is enabled.
9
10
        Reviewed by NOBODY (OOPS!).
11
12
        * platform/chromium/fast/events/rtl-scrollbar-expected.txt: Added.
13
        * platform/chromium/fast/events/rtl-scrollbar.html: Added.
14
1
2012-01-27  Alexander Pavlov  <apavlov@chromium.org>
15
2012-01-27  Alexander Pavlov  <apavlov@chromium.org>
2
16
3
        Implement touch event emulation in the WebCore layer
17
        Implement touch event emulation in the WebCore layer
- LayoutTests/platform/chromium/fast/events/rtl-scrollbar-expected.txt +10 lines
Line 0 LayoutTests/platform/chromium/fast/events/rtl-scrollbar-expected.txt_sec1
1
Test that we can scroll down an RTL element with its left-side scrollbar.
2
3
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
4
5
6
PASS successfullyParsed is true
7
8
TEST COMPLETE
9
PASS document.getElementById('overflow').scrollTop > scrollTop is true
10
- LayoutTests/platform/chromium/fast/events/rtl-scrollbar.html +38 lines
Line 0 LayoutTests/platform/chromium/fast/events/rtl-scrollbar.html_sec1
1
<!DOCTYPE html>
2
<html>
3
<head>
4
<script src="../../../../fast/js/resources/js-test-pre.js"></script>
5
</head>
6
<body style="margin:0">
7
<div id="overflow" dir="rtl" style="border:2px solid black;overflow:auto;height:400px;width:400px; position:absolute;">
8
<div style="background-color:red;height:720px"></div>
9
<div style="background-color:green;height:1600px"></div>
10
</div>
11
12
<script>
13
description('Test that we can scroll down an RTL element with its left-side scrollbar.');
14
15
var scrollTop = document.getElementById('overflow').scrollTop;
16
17
if (window.layoutTestController)
18
    layoutTestController.waitUntilDone();
19
20
if (window.eventSender) {
21
    var node = document.getElementById('overflow');
22
    eventSender.mouseMoveTo(node.offsetLeft + 5, node.offsetTop + node.offsetHeight - 50);
23
    eventSender.mouseDown();
24
    eventSender.mouseUp();
25
    setTimeout(finished, 0);
26
}
27
28
function finished()
29
{
30
    shouldBeTrue('document.getElementById(\'overflow\').scrollTop > scrollTop');
31
    window.layoutTestController.notifyDone();
32
}
33
34
var successfullyParsed = true;
35
</script>
36
<script src="../../../../fast/js/resources/js-test-post.js"></script>
37
</body>
38
</html>

Return to Bug 54623