[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml/rendering
From:       Germain Garand <germain () ebooksfrance ! org>
Date:       2008-09-24 23:51:21
Message-ID: 1222300281.772423.15922.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 864536 by ggarand:

automatically merged revision 864534:
fix offsetTop/Left/Parent properties to be more in conformance with draft
CSSOM View module specification.

http://www.w3.org/TR/cssom-view/#offset-attributes

brings better compatibility as  a bonus.

BUG: 170091, 170055

 M  +24 -22    render_object.cpp  


--- branches/KDE/4.1/kdelibs/khtml/rendering/render_object.cpp #864535:864536
@@ -572,16 +572,20 @@
 
 int RenderObject::offsetLeft() const
 {
+    if (isBody())
+        return 0;
+
     RenderObject* offsetPar = offsetParent();
-    if (!offsetPar)
-        return 0;
-    int x = xPos() -offsetPar->borderLeft();
+    int x, dummy;
+    if (!offsetPar || offsetPar->isBody()) {
+        absolutePosition(x, dummy);
+        return x;
+    }
+
+    x = xPos() -offsetPar->borderLeft();
     if ( isPositioned() )
         return x;
 
-    if ( isBody() && style()->htmlHacks() )
-        return 0;
-
     if (isRelPositioned()) {
         int y = 0;
         static_cast<const RenderBox*>(this)->relativePositionOffset(x, y);
@@ -592,26 +596,27 @@
          curr = curr->parent() )
         x += curr->xPos();
 
-    if ( offsetPar && offsetPar->isBody() && style()->htmlHacks() )
-        x += offsetPar->xPos();
-
-    return x;
+     return x;
 }
 
 int RenderObject::offsetTop() const
 {
-    RenderObject* offsetPar = offsetParent();
-    if (!offsetPar)
+    if (isBody())
         return 0;
 
-    int y = yPos() -offsetPar->borderTop();
+    RenderObject* offsetPar = offsetParent();
+    int y, dummy;
+ 
+    if (!offsetPar || offsetPar->isBody()) {
+        absolutePosition(dummy, y);
+        return y;
+    }
+
+    y = yPos() -offsetPar->borderTop();
     if ( isPositioned() )
         return y;
 
-    if ( isBody() && style()->htmlHacks() )
-        return 0;
-
-    if (isRelPositioned()) {
+     if (isRelPositioned()) {
         int x = 0;
         static_cast<const RenderBox*>(this)->relativePositionOffset(x, y);
     }
@@ -620,15 +625,12 @@
          curr = curr->parent() )
         y += curr->yPos();
 
-    if ( offsetPar && offsetPar->isBody() && style()->htmlHacks() )
-        y += offsetPar->yPos();
-
-    return y;
+     return y;
 }
 
 RenderObject* RenderObject::offsetParent() const
 {
-    if (isBody())
+    if (isBody() || style()->position() == FIXED)
         return 0;
 
     // can't really use containing blocks here (#113280)
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic