| Index: third_party/WebKit/WebCore/rendering/RenderObject.cpp
|
| ===================================================================
|
| --- third_party/WebKit/WebCore/rendering/RenderObject.cpp (revision 9391)
|
| +++ third_party/WebKit/WebCore/rendering/RenderObject.cpp (working copy)
|
| @@ -429,7 +429,7 @@
|
| beforeChild = newObject->parent()->findNextLayer(parentLayer, newObject);
|
| newObject = 0;
|
| }
|
| - parentLayer->addChild(toRenderBox(obj)->layer(), beforeChild);
|
| + parentLayer->addChild(toRenderBoxModelObject(obj)->layer(), beforeChild);
|
| return;
|
| }
|
|
|
| @@ -453,7 +453,7 @@
|
| return;
|
|
|
| if (hasLayer()) {
|
| - parentLayer->removeChild(toRenderBox(this)->layer());
|
| + parentLayer->removeChild(toRenderBoxModelObject(this)->layer());
|
| return;
|
| }
|
|
|
| @@ -467,7 +467,7 @@
|
| return;
|
|
|
| if (hasLayer()) {
|
| - RenderLayer* layer = toRenderBox(this)->layer();
|
| + RenderLayer* layer = toRenderBoxModelObject(this)->layer();
|
| if (oldParent)
|
| oldParent->removeChild(layer);
|
| newParent->addChild(layer);
|
| @@ -486,7 +486,7 @@
|
| return 0;
|
|
|
| // Step 1: If our layer is a child of the desired parent, then return our layer.
|
| - RenderLayer* ourLayer = hasLayer() ? toRenderBox(this)->layer() : 0;
|
| + RenderLayer* ourLayer = hasLayer() ? toRenderBoxModelObject(this)->layer() : 0;
|
| if (ourLayer && ourLayer->parent() == parentLayer)
|
| return ourLayer;
|
|
|
| @@ -518,7 +518,7 @@
|
| {
|
| const RenderObject* curr = this;
|
| while (curr) {
|
| - RenderLayer* layer = curr->hasLayer() ? toRenderBox(curr)->layer() : 0;
|
| + RenderLayer* layer = curr->hasLayer() ? toRenderBoxModelObject(curr)->layer() : 0;
|
| if (layer)
|
| return layer;
|
| curr = curr->parent();
|
| @@ -531,7 +531,7 @@
|
| {
|
| const RenderObject* curr = this;
|
| while (curr) {
|
| - RenderLayer* layer = curr->hasLayer() ? toRenderBox(curr)->layer() : 0;
|
| + RenderLayer* layer = curr->hasLayer() ? toRenderBoxModelObject(curr)->layer() : 0;
|
| if (layer && layer->isComposited())
|
| return layer;
|
| curr = curr->parent();
|
| @@ -583,7 +583,8 @@
|
|
|
| void RenderObject::setLayerNeedsFullRepaint()
|
| {
|
| - toRenderBox(this)->layer()->setNeedsFullRepaint(true);
|
| + ASSERT(hasLayer());
|
| + toRenderBoxModelObject(this)->layer()->setNeedsFullRepaint(true);
|
| }
|
|
|
| RenderBlock* RenderObject::containingBlock() const
|
| @@ -1549,7 +1550,7 @@
|
|
|
| void RenderObject::absoluteRectsForRange(Vector<IntRect>& rects, unsigned start, unsigned end, bool)
|
| {
|
| - if (!virtualChildren()->firstChild()) {
|
| + if (!firstChild()) {
|
| if ((isInline() || isAnonymousBlock())) {
|
| FloatPoint absPos = localToAbsolute(FloatPoint());
|
| absoluteRects(rects, absPos.x(), absPos.y());
|
| @@ -1568,7 +1569,7 @@
|
|
|
| void RenderObject::absoluteQuadsForRange(Vector<FloatQuad>& quads, unsigned start, unsigned end, bool)
|
| {
|
| - if (!virtualChildren()->firstChild()) {
|
| + if (!firstChild()) {
|
| if (isInline() || isAnonymousBlock())
|
| absoluteQuads(quads);
|
| return;
|
| @@ -1666,14 +1667,11 @@
|
|
|
| void RenderObject::repaint(bool immediate)
|
| {
|
| - // Can't use view(), since we might be unrooted.
|
| - RenderObject* o = this;
|
| - while (o->parent())
|
| - o = o->parent();
|
| - if (!o->isRenderView())
|
| + // Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
|
| + RenderView* view;
|
| + if (!isRooted(&view))
|
| return;
|
|
|
| - RenderView* view = toRenderView(o);
|
| if (view->printing())
|
| return; // Don't repaint if we're printing.
|
|
|
| @@ -1683,14 +1681,11 @@
|
|
|
| void RenderObject::repaintRectangle(const IntRect& r, bool immediate)
|
| {
|
| - // Can't use view(), since we might be unrooted.
|
| - RenderObject* o = this;
|
| - while (o->parent())
|
| - o = o->parent();
|
| - if (!o->isRenderView())
|
| + // Don't repaint if we're unrooted (note that view() still returns the view when unrooted)
|
| + RenderView* view;
|
| + if (!isRooted(&view))
|
| return;
|
|
|
| - RenderView* view = toRenderView(o);
|
| if (view->printing())
|
| return; // Don't repaint if we're printing.
|
|
|
| @@ -1976,7 +1971,7 @@
|
| setInline(style()->isDisplayInlineType());
|
| if (isInline() != parent()->childrenInline()) {
|
| if (!isInline())
|
| - toRenderBox(parent())->childBecameNonInline(this);
|
| + toRenderBoxModelObject(parent())->childBecameNonInline(this);
|
| else {
|
| // An anonymous block must be made to wrap this inline.
|
| RenderBlock* block = createAnonymousBlock();
|
| @@ -2211,6 +2206,21 @@
|
| return toRenderView(document()->renderer());
|
| }
|
|
|
| +bool RenderObject::isRooted(RenderView** view)
|
| +{
|
| + RenderObject* o = this;
|
| + while (o->parent())
|
| + o = o->parent();
|
| +
|
| + if (!o->isRenderView())
|
| + return false;
|
| +
|
| + if (view)
|
| + *view = toRenderView(o);
|
| +
|
| + return true;
|
| +}
|
| +
|
| bool RenderObject::hasOutlineAnnotation() const
|
| {
|
| return element() && element()->isLink() && document()->printing();
|
| @@ -2287,11 +2297,11 @@
|
|
|
| remove();
|
|
|
| - // FIXME: Would like to do this in RenderBox, but the timing is so complicated that this can't easily
|
| - // be moved into RenderBox::destroy.
|
| + // FIXME: Would like to do this in RenderBoxModelObject, but the timing is so complicated that this can't easily
|
| + // be moved into RenderBoxModelObject::destroy.
|
| RenderArena* arena = renderArena();
|
| if (hasLayer())
|
| - toRenderBox(this)->layer()->destroy(arena);
|
| + toRenderBoxModelObject(this)->layer()->destroy(arena);
|
| arenaDelete(arena, this);
|
| }
|
|
|
| @@ -2789,6 +2799,56 @@
|
| imageChanged(static_cast<WrappedImagePtr>(image), rect);
|
| }
|
|
|
| +RenderBoxModelObject* RenderObject::offsetParent() const
|
| +{
|
| + // If any of the following holds true return null and stop this algorithm:
|
| + // A is the root element.
|
| + // A is the HTML body element.
|
| + // The computed value of the position property for element A is fixed.
|
| + if (isRoot() || isBody() || (isPositioned() && style()->position() == FixedPosition))
|
| + return 0;
|
| +
|
| + // If A is an area HTML element which has a map HTML element somewhere in the ancestor
|
| + // chain return the nearest ancestor map HTML element and stop this algorithm.
|
| + // FIXME: Implement!
|
| +
|
| + // Return the nearest ancestor element of A for which at least one of the following is
|
| + // true and stop this algorithm if such an ancestor is found:
|
| + // * The computed value of the position property is not static.
|
| + // * It is the HTML body element.
|
| + // * The computed value of the position property of A is static and the ancestor
|
| + // is one of the following HTML elements: td, th, or table.
|
| + // * Our own extension: if there is a difference in the effective zoom
|
| + bool skipTables = isPositioned() || isRelPositioned();
|
| + float currZoom = style()->effectiveZoom();
|
| + RenderObject* curr = parent();
|
| + while (curr && (!curr->element() ||
|
| + (!curr->isPositioned() && !curr->isRelPositioned() && !curr->isBody()))) {
|
| + Node* element = curr->element();
|
| + if (!skipTables && element) {
|
| + bool isTableElement = element->hasTagName(tableTag) ||
|
| + element->hasTagName(tdTag) ||
|
| + element->hasTagName(thTag);
|
| +
|
| +#if ENABLE(WML)
|
| + if (!isTableElement && element->isWMLElement())
|
| + isTableElement = element->hasTagName(WMLNames::tableTag) ||
|
| + element->hasTagName(WMLNames::tdTag);
|
| +#endif
|
| +
|
| + if (isTableElement)
|
| + break;
|
| + }
|
| +
|
| + float newZoom = curr->style()->effectiveZoom();
|
| + if (currZoom != newZoom)
|
| + break;
|
| + currZoom = newZoom;
|
| + curr = curr->parent();
|
| + }
|
| + return curr && curr->isBox() ? toRenderBox(curr) : 0;
|
| +}
|
| +
|
| #if ENABLE(SVG)
|
|
|
| FloatRect RenderObject::relativeBBox(bool) const
|
|
|