#include "core/page/Page.h"
#include "core/frame/Settings.h"
#include "core/frame/UseCounter.h"
-#include "core/frame/animation/AnimationController.h"
#include "core/rendering/CompositedLayerMapping.h"
#include "core/rendering/FlowThreadController.h"
#include "core/rendering/HitTestResult.h"
#include "core/rendering/RenderCounter.h"
#include "core/rendering/RenderDeprecatedFlexibleBox.h"
#include "core/rendering/RenderFlexibleBox.h"
+#include "core/rendering/RenderFlowThread.h"
#include "core/rendering/RenderGeometryMap.h"
#include "core/rendering/RenderGrid.h"
#include "core/rendering/RenderImage.h"
#include "core/rendering/RenderListItem.h"
#include "core/rendering/RenderMarquee.h"
#include "core/rendering/RenderMultiColumnBlock.h"
-#include "core/rendering/RenderNamedFlowThread.h"
-#include "core/rendering/RenderRegion.h"
-#include "core/rendering/RenderRuby.h"
-#include "core/rendering/RenderRubyText.h"
#include "core/rendering/RenderScrollbarPart.h"
#include "core/rendering/RenderTableCaption.h"
#include "core/rendering/RenderTableCell.h"
#include "core/rendering/RenderTableCol.h"
#include "core/rendering/RenderTableRow.h"
-#include "core/rendering/RenderTextControlPlaceholder.h"
#include "core/rendering/RenderTheme.h"
#include "core/rendering/RenderView.h"
#include "core/rendering/style/ContentData.h"
RenderObject* RenderObject::createObject(Element* element, RenderStyle* style)
{
- Document& doc = element->document();
-
// Minimal support for content properties replacing an entire element.
// Works only if we have exactly one piece of content and it's a URL.
// Otherwise acts as if we didn't support this feature.
return image;
}
- if (element->shadowPseudoId() == "-webkit-input-placeholder")
- return new RenderTextControlPlaceholder(element);
-
- if (element->hasTagName(rubyTag)) {
- if (style->display() == INLINE)
- return new RenderRubyAsInline(element);
- else if (style->display() == BLOCK)
- return new RenderRubyAsBlock(element);
- }
- // treat <rt> as ruby text ONLY if it still has its default treatment of block
- if (element->hasTagName(rtTag) && style->display() == BLOCK)
- return new RenderRubyText(element);
-
switch (style->display()) {
case NONE:
return 0;
return new RenderInline(element);
case BLOCK:
case INLINE_BLOCK:
- if ((!style->hasAutoColumnCount() || !style->hasAutoColumnWidth()) && doc.regionBasedColumnsEnabled())
+ if ((!style->hasAutoColumnCount() || !style->hasAutoColumnWidth()) && element->document().regionBasedColumnsEnabled())
return new RenderMultiColumnBlock(element);
return new RenderBlockFlow(element);
case LIST_ITEM:
void RenderObject::setFlowThreadStateIncludingDescendants(FlowThreadState state)
{
- setFlowThreadState(state);
-
- for (RenderObject* child = firstChild(); child; child = child->nextSibling()) {
- // If the child is a fragmentation context it already updated the descendants flag accordingly.
- if (child->isRenderFlowThread())
+ for (RenderObject *object = this; object; object = object->nextInPreOrder(this)) {
+ // If object is a fragmentation context it already updated the descendants flag accordingly.
+ if (object->isRenderFlowThread())
continue;
- ASSERT(state != child->flowThreadState());
- child->setFlowThreadStateIncludingDescendants(state);
+ ASSERT(state != object->flowThreadState());
+ object->setFlowThreadState(state);
}
}
return 0;
}
-RenderNamedFlowThread* RenderObject::renderNamedFlowThreadWrapper() const
-{
- RenderObject* object = const_cast<RenderObject*>(this);
- while (object && object->isAnonymousBlock() && !object->isRenderNamedFlowThread())
- object = object->parent();
-
- return object && object->isRenderNamedFlowThread() ? toRenderNamedFlowThread(object) : 0;
-}
-
RenderBlock* RenderObject::firstLineBlock() const
{
return 0;
o = o->parent();
}
+ if (o && !o->isRenderBlock())
+ o = o->containingBlock();
+
while (o && o->isAnonymousBlock())
o = o->containingBlock();
} else {
if (v->usesCompositing()) {
if (RenderLayer* parentLayer = enclosingLayer()) {
+ // FIXME: CompositingState is not necessarily up to date for many callers of this function.
+ DisableCompositingQueryAsserts disabler;
+
RenderLayer* compLayer = parentLayer->enclosingCompositingLayerForRepaint();
if (compLayer)
repaintContainer = compLayer->renderer();
return;
}
+ // FIXME: Don't read compositing state here since we do this in the middle of recalc/layout.
+ DisableCompositingQueryAsserts disabler;
if (repaintContainer->compositingState() == PaintsIntoGroupedBacking) {
ASSERT(repaintContainer->groupedMapping());
ASSERT(repaintContainer == v);
bool viewHasCompositedLayer = v->hasLayer() && v->layer()->compositingState() == PaintsIntoOwnBacking;
if (!viewHasCompositedLayer) {
- IntRect repaintRectangle = r;
- if (viewHasCompositedLayer && v->layer()->transform())
- repaintRectangle = v->layer()->transform()->mapRect(r);
- v->repaintViewRectangle(repaintRectangle);
+ v->repaintViewRectangle(r);
return;
}
}
if (view->document().printing())
return; // Don't repaint if we're printing.
+ // FIXME: really, we're in the repaint phase here, and the following queries are legal.
+ // Until those states are fully fledged, I'll just disable the ASSERTS.
+ DisableCompositingQueryAsserts disabler;
RenderLayerModelObject* repaintContainer = containerForRepaint();
repaintUsingContainer(repaintContainer ? repaintContainer : view, pixelSnappedIntRect(clippedOverflowRectForRepaint(repaintContainer)));
}
}
}
-void RenderObject::setAnimatableStyle(PassRefPtr<RenderStyle> style)
-{
- if (!isText() && style && !RuntimeEnabledFeatures::webAnimationsCSSEnabled()) {
- setStyle(animation().updateAnimations(*this, *style));
- return;
- }
- setStyle(style);
-}
-
StyleDifference RenderObject::adjustStyleDifference(StyleDifference diff, unsigned contextSensitiveProperties) const
{
+ // FIXME: We call this from within style recalc, but we read compositingState below!
+ DisableCompositingQueryAsserts disabler;
+
// If transform changed, and the layer does not paint into its own separate backing, then we need to do a layout.
// FIXME: The comment above is what the code does, but it is technically not following spec. This means we will
// not to layout for 3d transforms, but we should be invoking a simplified relayout. Is it possible we are avoiding
inline bool RenderObject::hasImmediateNonWhitespaceTextChildOrPropertiesDependentOnColor() const
{
+ if (style()->hasBorder() || style()->hasOutline())
+ return true;
for (const RenderObject* r = firstChild(); r; r = r->nextSibling()) {
if (r->isText() && !toRenderText(r)->isAllCollapsibleWhitespace())
return true;
const size_t maxRectsPerLayer = 100;
LayerHitTestRects::iterator iter = layerRects.find(currentLayer);
+ Vector<WebCore::LayoutRect>* iterValue;
if (iter == layerRects.end())
- iter = layerRects.add(currentLayer, Vector<LayoutRect>()).iterator;
+ iterValue = &layerRects.add(currentLayer, Vector<LayoutRect>()).storedValue->value;
+ else
+ iterValue = &iter->value;
for (size_t i = 0; i < ownRects.size(); i++) {
if (!containerRect.contains(ownRects[i])) {
- iter->value.append(ownRects[i]);
- if (iter->value.size() > maxRectsPerLayer) {
+ iterValue->append(ownRects[i]);
+ if (iterValue->size() > maxRectsPerLayer) {
// Just mark the entire layer instead, and switch to walking the layer
// tree instead of the render tree.
layerRects.remove(currentLayer);
if (Frame* frame = this->frame()) {
if (frame->page())
frame->page()->autoscrollController().stopAutoscrollIfNeeded(this);
- frame->animation().cancelAnimations(this);
}
// For accessibility management, notify the parent of the imminent change to its child set.
if (AXObjectCache* cache = document().existingAXObjectCache())
cache->remove(this);
-#ifndef NDEBUG
- if (!documentBeingDestroyed() && view() && view()->hasRenderNamedFlowThreads()) {
- // After remove, the object and the associated information should not be in any flow thread.
- const RenderNamedFlowThreadList* flowThreadList = view()->flowThreadController()->renderNamedFlowThreadList();
- for (RenderNamedFlowThreadList::const_iterator iter = flowThreadList->begin(); iter != flowThreadList->end(); ++iter) {
- const RenderNamedFlowThread* renderFlowThread = *iter;
- ASSERT(!renderFlowThread->hasChild(this));
- ASSERT(!renderFlowThread->hasChildInfo(this));
- }
- }
-#endif
-
// If this renderer had a parent, remove should have destroyed any counters
// attached to this renderer and marked the affected other counters for
// reevaluation. This apparently redundant check is here for the case when
if (!isFloating() && parent()->childrenInline())
parent()->dirtyLinesFromChangedChild(this);
-
- if (RenderNamedFlowThread* containerFlowThread = parent()->renderNamedFlowThreadWrapper())
- containerFlowThread->addFlowChild(this);
}
void RenderObject::willBeRemovedFromTree()
removeFromRenderFlowThread();
- if (RenderNamedFlowThread* containerFlowThread = parent()->renderNamedFlowThreadWrapper())
- containerFlowThread->removeFlowChild(this);
-
// Update cached boundaries in SVG renderers if a child is removed.
if (parent()->isSVG())
parent()->setNeedsBoundariesUpdate();
child->removeFromRenderFlowThreadRecursive(renderFlowThread);
}
- RenderFlowThread* localFlowThread = renderFlowThread;
- if (flowThreadState() == InsideInFlowThread)
- localFlowThread = flowThreadContainingBlock(); // We have to ask. We can't just assume we are in the same flow thread.
- if (localFlowThread)
- localFlowThread->removeFlowChildInfo(this);
setFlowThreadState(NotInsideFlowThread);
}
{
bool valueChanged = (dragOn != isDragging());
setIsDragging(dragOn);
- if (valueChanged && node() && (style()->affectedByDrag() || (node()->isElementNode() && toElement(node())->childrenAffectedByDrag())))
- node()->setNeedsStyleRecalc();
+ if (valueChanged && node()) {
+ if (node()->isElementNode() && toElement(node())->childrenAffectedByDrag())
+ node()->setNeedsStyleRecalc(SubtreeStyleChange);
+ else if (style()->affectedByDrag())
+ node()->setNeedsStyleRecalc(LocalStyleChange);
+ }
for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling())
curr->updateDragState(dragOn);
}
rect.inflate(outlineSize);
}
-AnimationController& RenderObject::animation() const
-{
- return frame()->animation();
-}
-
bool RenderObject::isInert() const
{
const RenderObject* renderer = this;
imageChanged(static_cast<WrappedImagePtr>(image), rect);
}
-RenderObject* RenderObject::hoverAncestor() const
-{
- // When searching for the hover ancestor and encountering a named flow thread,
- // the search will continue with the DOM ancestor of the top-most element
- // in the named flow thread.
- // See https://code.google.com/p/chromium/issues/detail?id=243278
- RenderObject* hoverAncestor = parent();
-
- // Skip anonymous blocks directly flowed into flow threads as it would
- // prevent us from continuing the search on the DOM tree when reaching the named flow thread.
- if (hoverAncestor && hoverAncestor->isAnonymousBlock() && hoverAncestor->parent() && hoverAncestor->parent()->isRenderNamedFlowThread())
- hoverAncestor = hoverAncestor->parent();
-
- if (hoverAncestor && hoverAncestor->isRenderNamedFlowThread()) {
- hoverAncestor = 0;
-
- Node* node = this->node();
- if (node) {
- Node* domAncestorNode = node->parentNode();
- if (domAncestorNode)
- hoverAncestor = domAncestorNode->renderer();
- }
- }
-
- return hoverAncestor;
-}
-
Element* RenderObject::offsetParent() const
{
if (isRoot() || isBody())
for (RenderObject* ancestor = parent(); ancestor; ancestor = ancestor->parent()) {
// Spec: http://www.w3.org/TR/cssom-view/#offset-attributes
- // CSS regions specification says that region flows should return the body element as their offsetParent.
- if (ancestor->isRenderNamedFlowThread())
- return document().body();
-
node = ancestor->node();
if (!node)
return objectIsRelayoutBoundary(this);
}
-bool RenderObject::isRenderNamedFlowFragmentContainer() const
-{
- return isRenderBlockFlow() && toRenderBlockFlow(this)->renderNamedFlowFragment();
-}
-
} // namespace WebCore
#ifndef NDEBUG