Bug 170679 - Webpages shifted to the right in RTL mode
Summary: Webpages shifted to the right in RTL mode
Status: RESOLVED FIXED
Alias: None
Product: konqueror
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Unspecified
: NOR normal (vote)
Target Milestone: ---
Assignee: Konqueror Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-09-08 13:18 UTC by Zayed Al-Saidi
Modified: 2008-10-10 01:46 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
see the gray space on the left side (80.87 KB, image/jpeg)
2008-09-08 13:20 UTC, Zayed Al-Saidi
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Zayed Al-Saidi 2008-09-08 13:18:53 UTC
Version:            (using KDE 4.1.1)
Installed from:    Ubuntu Packages

when I satart konqueror in RTL mode (Arabic Lang.), it display all webpages (Arabic and English) shifted to the right. Please see the screenshot to get the idea.
Comment 1 Zayed Al-Saidi 2008-09-08 13:20:48 UTC
Created attachment 27316 [details]
see the gray space on the left side
Comment 2 Zayed Al-Saidi 2008-10-06 09:29:17 UTC
I test konqueror in kde 4.1.2 (kubuntu packages ). I find some improvement in this problem. Now, the gray space appears when I open new tab and it disappears when the konqueror finish download the page. 

One step in right direction to solve this problem. 
Comment 3 Germain Garand 2008-10-10 01:46:12 UTC
SVN commit 869761 by ggarand:

- fix incomplete repaints happening from time to time
  when jumping early during page load. (#166413)

- various RTL layout application (-reverse cmdline option) fixes
  . implement RTL scrollbars on CSS containers
  . fix iframes scrollbars in RTL mode
  . fix wrong direction when scrolling horizontally (#172258)
  . fix grey block on left of view (#170679)

- avoid smooth scrolling during early stage of layout if the option has
  the WhenEfficient value

BUG: 166413, 172258, 170679


 M  +1 -1      khtml_part.cpp  
 M  +18 -3     khtmlview.cpp  
 M  +2 -1      rendering/render_block.cpp  
 M  +3 -2      rendering/render_layer.cpp  
 M  +2 -1      rendering/render_replaced.cpp  


--- trunk/KDE/kdelibs/khtml/khtml_part.cpp #869760:869761
@@ -2576,7 +2576,7 @@
   bool quirkyName = !n && !d->m_doc->inStrictMode() && (name.isEmpty() || name.toLower() == "top");
 
   if (quirkyName) {
-      d->m_view->setContentsPos(0, 0);
+      d->m_view->setContentsPos( d->m_view->contentsX(), 0);
       return true;
   } else if (!n) {
       kDebug(6050) << name << "not found";
--- trunk/KDE/kdelibs/khtml/khtmlview.cpp #869760:869761
@@ -786,7 +786,8 @@
 
 void KHTMLView::setContentsPos( int x, int y)
 {
-   horizontalScrollBar()->setValue( x );
+   horizontalScrollBar()->setValue( QApplication::isRightToLeft() ?
+                           horizontalScrollBar()->maximum()-x : x );
    verticalScrollBar()->setValue( y );
 }
 
@@ -2382,6 +2383,13 @@
             }
         }
       }
+      case QEvent::Move: {
+          if (static_cast<QMoveEvent*>(e)->pos() != QPoint(0,0)) {
+              widget()->move(0,0);
+              updateScrollBars();
+              return true;
+          }
+      }
       default:
         break;
     }
@@ -3870,6 +3878,8 @@
             unscheduleRelayout();
             layout();
         }
+        if (d->smoothScrollMode == KHTMLView::SSMWhenEfficient)
+            d->shouldSmoothScroll = false;
     }
 
     if ( d->smoothScrollMode != SSMDisabled &&
@@ -3888,6 +3898,9 @@
     if (m_part->xmlDocImpl() && m_part->xmlDocImpl()->documentElement())
         m_part->xmlDocImpl()->documentElement()->dispatchHTMLEvent(EventImpl::SCROLL_EVENT, false, false);
 
+    if (QApplication::isRightToLeft())
+        dx = -dx;
+
     if (!d->smoothScrolling) {
         d->updateContentsXY();
     } else {
@@ -3907,6 +3920,7 @@
         KHTMLView* v = m_kwp->rootViewPos( off );
         if (v)
             w = v->widget();
+        off = viewport()->mapTo(this, off);
     }
 
 #ifdef FIX_QT_BROKEN_QWIDGET_SCROLL
@@ -3967,8 +3981,6 @@
         }
         return;
     }
-    if (d->firstRepaintPending)
-        return;
 
 #ifdef FIX_QT_BROKEN_QWIDGET_SCROLL
     if (hideScrollBars) {
@@ -4359,6 +4371,9 @@
     horizontalScrollBar()->setPageStep(p.width());
     verticalScrollBar()->setRange(0, v.height() - p.height());
     verticalScrollBar()->setPageStep(p.height());
+    if (!d->smoothScrolling) {
+        d->updateContentsXY();
+    }
 }
 
 void KHTMLView::slotMouseScrollTimer()
--- trunk/KDE/kdelibs/khtml/rendering/render_block.cpp #869760:869761
@@ -2617,7 +2617,8 @@
         return false;
 
     if (m_layer->verticalScrollbarWidth()) {
-        QRect vertRect(_tx + width() - borderRight() - m_layer->verticalScrollbarWidth(),
+        bool rtl = QApplication::isRightToLeft();
+        QRect vertRect(_tx + (rtl ? borderLeft() :  width() - borderRight() - m_layer->verticalScrollbarWidth()),
                        _ty + borderTop() - borderTopExtra(),
                        m_layer->verticalScrollbarWidth(),
                        height() + borderTopExtra() + borderBottomExtra()-borderTop()-borderBottom());
--- trunk/KDE/kdelibs/khtml/rendering/render_layer.cpp #869760:869761
@@ -843,15 +843,16 @@
     if (!m_hBar)
        b = m_vBar;
     int sw = b->style()->pixelMetric(QStyle::PM_ScrollBarExtent);
+    bool rtl = b->layoutDirection() == Qt::RightToLeft;
 
     if (m_vBar) {
-       QRect vBarRect = QRect(tx + w - sw, ty, sw, h - (m_hBar ? sw : 0));
+       QRect vBarRect = QRect(tx + (rtl ? 0 : w-sw), ty, sw, h - (m_hBar ? sw : 0));
         m_vBar->resize(vBarRect.width(), vBarRect.height());
         m_vBar->m_kwp->setPos(QPoint(vBarRect.x(), vBarRect.y()));
     }
 
     if (m_hBar) {
-       QRect hBarRect = QRect(tx, ty + h - sw, w - (m_vBar ? sw : 0), sw);
+       QRect hBarRect = QRect(tx + (rtl && m_vBar ? sw : 0), ty + h - sw, w - (!rtl && m_vBar ? sw : 0), sw);
         m_hBar->resize(hBarRect.width(), hBarRect.height());
         m_hBar->m_kwp->setPos(QPoint(hBarRect.x(), hBarRect.y()));
     }
--- trunk/KDE/kdelibs/khtml/rendering/render_replaced.cpp #869760:869761
@@ -794,7 +794,8 @@
             if (hbr.isValid() && !hbr.isEmpty())
                 copyWidget(hbr, p, v->horizontalScrollBar(), tx+ of.x(), ty+ of.y(), buffered, buffer[1]);
         }
-        QRect vr = (r & v->viewport()->rect());
+        QPoint of = v->viewport()->mapTo(v, QPoint(0,0));
+        QRect vr = (r & v->viewport()->rect().translated(of));
         if (vr.isValid() && !vr.isEmpty())
             v->render(p, vr, thePoint);
     } else {