[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/3.5/kdelibs/khtml/rendering
From: Germain Garand <germain () ebooksfrance ! com>
Date: 2005-09-27 2:20:55
Message-ID: 1127787655.542032.20017.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 464355 by ggarand:
merging adjustments for positioned children inside relpos inlines
from WebCore.
BUG: 109354
M +2 -0 render_box.h
M +41 -1 render_layer.cpp
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_box.h #464354:464355
@@ -107,6 +107,8 @@
void setStaticX(short staticX);
void setStaticY(int staticY);
+ int staticX() const { return m_staticX; }
+ int staticY() const { return m_staticY; }
virtual void caretPos(int offset, int flags, int &_x, int &_y, int &width, int \
&height);
--- branches/KDE/3.5/kdelibs/khtml/rendering/render_layer.cpp #464354:464355
@@ -137,7 +137,47 @@
static_cast<RenderBox*>(m_object)->relativePositionOffset(x, y);
// Subtract our parent's scroll offset.
- if (parent())
+ if (m_object->isPositioned() && enclosingPositionedAncestor()) {
+ RenderLayer* positionedParent = enclosingPositionedAncestor();
+
+ // For positioned layers, we subtract out the enclosing positioned layer's \
scroll offset. + positionedParent->subtractScrollOffset(x, y);
+
+ if (positionedParent->renderer()->isRelPositioned() &&
+ positionedParent->renderer()->isInlineFlow()) {
+ // When we have an enclosing relpositioned inline, we need to add in the \
offset of the first line + // box from the rest of the content, but only \
in the cases where we know we're positioned + // relative to the inline \
itself. + RenderFlow* flow = \
static_cast<RenderFlow*>(positionedParent->renderer()); + int sx = 0, sy = \
0; + if (flow->firstLineBox()) {
+ if (flow->style()->direction() == LTR)
+ sx = flow->firstLineBox()->xPos();
+ else
+ sx = flow->lastLineBox()->xPos();
+ sy = flow->firstLineBox()->yPos();
+ } else {
+ sx = flow->staticX(); // ###
+ sy = flow->staticY();
+ }
+ bool isInlineType = m_object->style()->isOriginalDisplayInlineType();
+
+ if (!m_object->hasStaticX())
+ x += sx;
+
+ // This is not terribly intuitive, but we have to match other browsers. \
Despite being a block display type inside + // an inline, we still keep \
our x locked to the left of the relative positioned inline. Arguably the correct + \
// behavior would be to go flush left to the block that contains the inline, but that \
isn't what other browsers + // do.
+ if (m_object->hasStaticX() && !isInlineType)
+ // Avoid adding in the left border/padding of the containing block \
twice. Subtract it out. + x += sx - \
(m_object->containingBlock()->borderLeft() + \
m_object->containingBlock()->paddingLeft()); +
+ if (!m_object->hasStaticY())
+ y += sy;
+ }
+ }
+ else if (parent())
parent()->subtractScrollOffset(x, y);
setPos(x,y);
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic