Source/WebCore/ChangeLog

 12012-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
1362012-02-03 Kentaro Hara <haraken@chromium.org>
237
338 Add the "CPP" prefix to CPP specific IDL attributes
106643

Source/WebCore/rendering/RenderBlock.cpp

@@void RenderBlock::addOverflowFromPositio
15121512 positionedObject = *it;
15131513
15141514 // Fixed positioned elements don't contribute to layout overflow, since they don't scroll with the content.
1515  if (positionedObject->style()->position() != FixedPosition)
1516  addOverflowFromChild(positionedObject);
 1515 if (positionedObject->style()->position() != FixedPosition) {
 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 }
15171523 }
15181524}
15191525

@@LayoutUnit RenderBlock::computeStartPosi
19061912void RenderBlock::determineLogicalLeftPositionForChild(RenderBox* child)
19071913{
19081914 LayoutUnit startPosition = borderStart() + paddingStart();
 1915#if USE(RTL_SCROLLBAR)
 1916 if (style()->shouldPlaceBlockDirectionScrollbarOnLogicalLeft())
 1917 startPosition -= verticalScrollbarWidth();
 1918#endif
19091919 LayoutUnit totalAvailableLogicalWidth = borderAndPaddingLogicalWidth() + availableLogicalWidth();
19101920
19111921 // Add in our start margin.
106607

Source/WebCore/rendering/RenderBox.cpp

@@LayoutRect RenderBox::overflowClipRect(c
12061206 clipRect.setSize(clipRect.size() - LayoutSize(borderLeft() + borderRight(), borderTop() + borderBottom()));
12071207
12081208 // 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
12101214 clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy));
 1215 }
12111216
12121217 return clipRect;
12131218}
106607

Source/WebCore/rendering/RenderLayer.cpp

@@bool RenderLayer::isActive() const
17981798 return page && page->focusController()->isActive();
17991799}
18001800
 1801static 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
18011812static IntRect cornerRect(const RenderLayer* layer, const IntRect& bounds)
18021813{
18031814 int horizontalThickness;

@@static IntRect cornerRect(const RenderLa
18171828 horizontalThickness = layer->verticalScrollbar()->width();
18181829 verticalThickness = layer->horizontalScrollbar()->height();
18191830 }
1820  return IntRect(bounds.maxX() - horizontalThickness - layer->renderer()->style()->borderRightWidth(),
 1831 return IntRect(cornerStart(layer, bounds.x(), bounds.maxX(), horizontalThickness),
18211832 bounds.maxY() - verticalThickness - layer->renderer()->style()->borderBottomWidth(),
18221833 horizontalThickness, verticalThickness);
18231834}

@@IntPoint RenderLayer::currentMousePositi
19401951 return renderer()->frame() ? renderer()->frame()->eventHandler()->currentMousePosition() : IntPoint();
19411952}
19421953
 1954LayoutUnit 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
 1966LayoutUnit 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
19431977IntSize RenderLayer::scrollbarOffset(const Scrollbar* scrollbar) const
19441978{
19451979 RenderBox* box = renderBox();
19461980
19471981 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());
19491983
19501984 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());
19521986
19531987 ASSERT_NOT_REACHED();
19541988 return IntSize();

@@void RenderLayer::invalidateScrollbarRec
19732007 RenderBox* box = renderBox();
19742008 ASSERT(box);
19752009 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());
19772011 else
1978  scrollRect.move(box->borderLeft(), box->height() - box->borderBottom() - scrollbar->height());
 2012 scrollRect.move(horizontalScrollbarStart(0), box->height() - box->borderBottom() - scrollbar->height());
19792013 renderer()->repaintRectangle(scrollRect);
19802014}
19812015

@@void RenderLayer::positionOverflowContro
21532187 const IntRect& scrollCorner = scrollCornerRect();
21542188 IntRect absBounds(borderBox.location() + offsetFromLayer, borderBox.size());
21552189 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()),
21572191 absBounds.y() + box->borderTop(),
21582192 m_vBar->width(),
21592193 absBounds.height() - (box->borderTop() + box->borderBottom()) - scrollCorner.height()));
21602194
21612195 if (m_hBar)
2162  m_hBar->setFrameRect(IntRect(absBounds.x() + box->borderLeft(),
 2196 m_hBar->setFrameRect(IntRect(horizontalScrollbarStart(absBounds.x()),
21632197 absBounds.maxY() - box->borderBottom() - m_hBar->height(),
21642198 absBounds.width() - (box->borderLeft() + box->borderRight()) - scrollCorner.width(),
21652199 m_hBar->height()));

@@bool RenderLayer::hitTestOverflowControl
25602594 int resizeControlSize = max(resizeControlRect.height(), 0);
25612595
25622596 if (m_vBar && m_vBar->shouldParticipateInHitTesting()) {
2563  LayoutRect vBarRect(box->width() - box->borderRight() - m_vBar->width(),
 2597 LayoutRect vBarRect(verticalScrollbarStart(0, box->width()),
25642598 box->borderTop(),
25652599 m_vBar->width(),
25662600 box->height() - (box->borderTop() + box->borderBottom()) - (m_hBar ? m_hBar->height() : resizeControlSize));

@@bool RenderLayer::hitTestOverflowControl
25722606
25732607 resizeControlSize = max(resizeControlRect.width(), 0);
25742608 if (m_hBar && m_hBar->shouldParticipateInHitTesting()) {
2575  LayoutRect hBarRect(box->borderLeft(),
 2609 LayoutRect hBarRect(horizontalScrollbarStart(0),
25762610 box->height() - box->borderBottom() - m_hBar->height(),
25772611 box->width() - (box->borderLeft() + box->borderRight()) - (m_vBar ? m_vBar->width() : resizeControlSize),
25782612 m_hBar->height());
106607

Source/WebCore/rendering/RenderLayer.h

@@private:
750750 ;
751751 }
752752
 753 LayoutUnit verticalScrollbarStart(int minX, int maxX) const;
 754 LayoutUnit horizontalScrollbarStart(int minX) const;
 755
753756protected:
754757 // The bitfields are up here so they will fall into the padding from ScrollableArea on 64-bit.
755758
106607

Source/WebCore/rendering/style/RenderStyle.h

@@public:
962962#else
963963 bool hasFilter() const { return false; }
964964#endif
 965
 966 bool shouldPlaceBlockDirectionScrollbarOnLogicalLeft() const { return !isLeftToRightDirection() && isHorizontalWritingMode(); }
965967
966968// attribute setter methods
967969
106607

Source/WebKit/chromium/ChangeLog

 12012-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
1142012-02-02 Tommy Widenflycht <tommyw@google.com>
215
316 [chromium] MediaStream API: Adding the embedding code for MediaStreamCenter
106643

Source/WebKit/chromium/features.gypi

106106 # We can't define it here because it should be present only
107107 # in Debug or release_valgrind_build=1 builds.
108108 'WTF_USE_OPENTYPE_SANITIZER=1',
 109 'WTF_USE_RTL_SCROLLBAR=1',
109110 'WTF_USE_SKIA_TEXT=<(enable_skia_text)',
110111 'WTF_USE_WEBP=1',
111112 'WTF_USE_WEBKIT_IMAGE_DECODERS=1',
106607

LayoutTests/ChangeLog

 12012-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
1152012-01-27 Alexander Pavlov <apavlov@chromium.org>
216
317 Implement touch event emulation in the WebCore layer
106643

LayoutTests/platform/chromium/fast/events/rtl-scrollbar-expected.txt

 1Test that we can scroll down an RTL element with its left-side scrollbar.
 2
 3On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
 4
 5
 6PASS successfullyParsed is true
 7
 8TEST COMPLETE
 9PASS document.getElementById('overflow').scrollTop > scrollTop is true
 10
0

LayoutTests/platform/chromium/fast/events/rtl-scrollbar.html

 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>
 13description('Test that we can scroll down an RTL element with its left-side scrollbar.');
 14
 15var scrollTop = document.getElementById('overflow').scrollTop;
 16
 17if (window.layoutTestController)
 18 layoutTestController.waitUntilDone();
 19
 20if (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
 28function finished()
 29{
 30 shouldBeTrue('document.getElementById(\'overflow\').scrollTop > scrollTop');
 31 window.layoutTestController.notifyDone();
 32}
 33
 34var successfullyParsed = true;
 35</script>
 36<script src="../../../../fast/js/resources/js-test-post.js"></script>
 37</body>
 38</html>
0