diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-08-12 09:27:39 +0200 |
commit | 3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch) | |
tree | 73dc228333948738bbe02976cacca8cd382bc978 /Source/WebCore/rendering/RenderObject.cpp | |
parent | b32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff) | |
download | qtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz |
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/WebCore/rendering/RenderObject.cpp')
-rwxr-xr-x | Source/WebCore/rendering/RenderObject.cpp | 96 |
1 files changed, 59 insertions, 37 deletions
diff --git a/Source/WebCore/rendering/RenderObject.cpp b/Source/WebCore/rendering/RenderObject.cpp index 6391334ef..b5f69575a 100755 --- a/Source/WebCore/rendering/RenderObject.cpp +++ b/Source/WebCore/rendering/RenderObject.cpp @@ -151,7 +151,7 @@ RenderObject* RenderObject::createObject(Node* node, RenderStyle* style) if (node->hasTagName(rtTag) && style->display() == BLOCK) return new (arena) RenderRubyText(node); if (doc->cssRegionsEnabled() && style->isDisplayRegionType() && !style->regionThread().isEmpty() && doc->renderView()) - return new (arena) RenderRegion(node, doc->renderView()->flowThreadController()->ensureRenderFlowThreadWithName(style->regionThread())); + return new (arena) RenderRegion(node, 0); switch (style->display()) { case NONE: return 0; @@ -834,14 +834,22 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, BoxSide side, Color color, EBorderStyle style, int adjacentWidth1, int adjacentWidth2, bool antialias) { - int width = (side == BSTop || side == BSBottom ? y2 - y1 : x2 - x1); + int thickness; + int length; + if (side == BSTop || side == BSBottom) { + thickness = y2 - y1; + length = x2 - x1; + } else { + thickness = x2 - x1; + length = y2 - y1; + } - // FIXME: We really would like this check to be an ASSERT as we don't want to draw 0px borders. However - // nothing guarantees that the following recursive calls to drawLineForBoxSide will have non-null width. - if (!width) + // FIXME: We really would like this check to be an ASSERT as we don't want to draw empty borders. However + // nothing guarantees that the following recursive calls to drawLineForBoxSide will have non-null dimensions. + if (!thickness || !length) return; - if (style == DOUBLE && width < 3) + if (style == DOUBLE && thickness < 3) style = SOLID; switch (style) { @@ -851,11 +859,11 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, case DOTTED: case DASHED: { graphicsContext->setStrokeColor(color, m_style->colorSpace()); - graphicsContext->setStrokeThickness(width); + graphicsContext->setStrokeThickness(thickness); StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); graphicsContext->setStrokeStyle(style == DASHED ? DashedStroke : DottedStroke); - if (width > 0) { + if (thickness > 0) { bool wasAntialiased = graphicsContext->shouldAntialias(); graphicsContext->setShouldAntialias(antialias); @@ -875,7 +883,8 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, break; } case DOUBLE: { - int third = (width + 1) / 3; + int thirdOfThickness = (thickness + 1) / 3; + ASSERT(thirdOfThickness); if (adjacentWidth1 == 0 && adjacentWidth2 == 0) { StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); @@ -888,16 +897,16 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, switch (side) { case BSTop: case BSBottom: - graphicsContext->drawRect(IntRect(x1, y1, x2 - x1, third)); - graphicsContext->drawRect(IntRect(x1, y2 - third, x2 - x1, third)); + graphicsContext->drawRect(IntRect(x1, y1, length, thirdOfThickness)); + graphicsContext->drawRect(IntRect(x1, y2 - thirdOfThickness, length, thirdOfThickness)); break; case BSLeft: - graphicsContext->drawRect(IntRect(x1, y1 + 1, third, y2 - y1 - 1)); - graphicsContext->drawRect(IntRect(x2 - third, y1 + 1, third, y2 - y1 - 1)); - break; case BSRight: - graphicsContext->drawRect(IntRect(x1, y1 + 1, third, y2 - y1 - 1)); - graphicsContext->drawRect(IntRect(x2 - third, y1 + 1, third, y2 - y1 - 1)); + // FIXME: Why do we offset the border by 1 in this case but not the other one? + if (length > 1) { + graphicsContext->drawRect(IntRect(x1, y1 + 1, thirdOfThickness, length - 1)); + graphicsContext->drawRect(IntRect(x2 - thirdOfThickness, y1 + 1, thirdOfThickness, length - 1)); + } break; } @@ -910,33 +919,33 @@ void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, switch (side) { case BSTop: drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0), - y1, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + third, + y1, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness, side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0), - y2 - third, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y2, + y2 - thirdOfThickness, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y2, side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); break; case BSLeft: drawLineForBoxSide(graphicsContext, x1, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0), - x1 + third, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), + x1 + thirdOfThickness, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); - drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0), + drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0), x2, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0), side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); break; case BSBottom: drawLineForBoxSide(graphicsContext, x1 + max((adjacentWidth1 * 2 + 1) / 3, 0), - y1, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + third, + y1, x2 - max((adjacentWidth2 * 2 + 1) / 3, 0), y1 + thirdOfThickness, side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); drawLineForBoxSide(graphicsContext, x1 + max((-adjacentWidth1 * 2 + 1) / 3, 0), - y2 - third, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y2, + y2 - thirdOfThickness, x2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), y2, side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); break; case BSRight: drawLineForBoxSide(graphicsContext, x1, y1 + max((adjacentWidth1 * 2 + 1) / 3, 0), - x1 + third, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0), + x1 + thirdOfThickness, y2 - max((adjacentWidth2 * 2 + 1) / 3, 0), side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); - drawLineForBoxSide(graphicsContext, x2 - third, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0), + drawLineForBoxSide(graphicsContext, x2 - thirdOfThickness, y1 + max((-adjacentWidth1 * 2 + 1) / 3, 0), x2, y2 - max((-adjacentWidth2 * 2 + 1) / 3, 0), side, color, SOLID, adjacent1BigThird, adjacent2BigThird, antialias); break; @@ -1444,10 +1453,7 @@ void RenderObject::repaintOverhangingFloats(bool) bool RenderObject::checkForRepaintDuringLayout() const { - // FIXME: <https://bugs.webkit.org/show_bug.cgi?id=20885> It is probably safe to also require - // m_everHadLayout. Currently, only RenderBlock::layoutBlock() adds this condition. See also - // <https://bugs.webkit.org/show_bug.cgi?id=15129>. - return !document()->view()->needsFullRepaint() && !hasLayer(); + return !document()->view()->needsFullRepaint() && !hasLayer() && everHadLayout(); } LayoutRect RenderObject::rectWithOutlineForRepaint(RenderBoxModelObject* repaintContainer, LayoutUnit outlineWidth) const @@ -1787,7 +1793,7 @@ void RenderObject::styleWillChange(StyleDifference diff, const RenderStyle* newS bool visibilityChanged = m_style->visibility() != newStyle->visibility() || m_style->zIndex() != newStyle->zIndex() || m_style->hasAutoZIndex() != newStyle->hasAutoZIndex(); -#if ENABLE(DASHBOARD_SUPPORT) +#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) if (visibilityChanged) document()->setDashboardRegionsDirty(true); #endif @@ -1978,7 +1984,12 @@ LayoutRect RenderObject::viewRect() const FloatPoint RenderObject::localToAbsolute(const FloatPoint& localPoint, bool fixed, bool useTransforms) const { TransformState transformState(TransformState::ApplyTransformDirection, localPoint); - mapLocalToContainer(0, fixed, useTransforms, transformState); + MapLocalToContainerFlags mode = ApplyContainerFlip; + if (fixed) + mode |= IsFixed; + if (useTransforms) + mode |= UseTransforms; + mapLocalToContainer(0, transformState, mode); transformState.flatten(); return transformState.lastPlanarPoint(); @@ -1993,7 +2004,7 @@ FloatPoint RenderObject::absoluteToLocal(const FloatPoint& containerPoint, bool return transformState.lastPlanarPoint(); } -void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool fixed, bool useTransforms, TransformState& transformState, ApplyContainerFlipOrNot applyContainerFlip, bool* wasFixed) const +void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, TransformState& transformState, MapLocalToContainerFlags mode, bool* wasFixed) const { if (repaintContainer == this) return; @@ -2004,10 +2015,10 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b // FIXME: this should call offsetFromContainer to share code, but I'm not sure it's ever called. LayoutPoint centerPoint = roundedLayoutPoint(transformState.mappedPoint()); - if (applyContainerFlip && o->isBox()) { + if (mode & ApplyContainerFlip && o->isBox()) { if (o->style()->isFlippedBlocksWritingMode()) transformState.move(toRenderBox(o)->flipForWritingModeIncludingColumns(roundedLayoutPoint(transformState.mappedPoint())) - centerPoint); - applyContainerFlip = DoNotApplyContainerFlip; + mode &= ~ApplyContainerFlip; } LayoutSize columnOffset; @@ -2018,7 +2029,7 @@ void RenderObject::mapLocalToContainer(RenderBoxModelObject* repaintContainer, b if (o->hasOverflowClip()) transformState.move(-toRenderBox(o)->scrolledContentOffset()); - o->mapLocalToContainer(repaintContainer, fixed, useTransforms, transformState, applyContainerFlip, wasFixed); + o->mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); } const RenderObject* RenderObject::pushMappingToContainer(const RenderBoxModelObject* ancestorToStopAt, RenderGeometryMap& geometryMap) const @@ -2092,7 +2103,10 @@ FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, RenderB // Track the point at the center of the quad's bounding box. As mapLocalToContainer() calls offsetFromContainer(), // it will use that point as the reference point to decide which column's transform to apply in multiple-column blocks. TransformState transformState(TransformState::ApplyTransformDirection, localQuad.boundingBox().center(), localQuad); - mapLocalToContainer(repaintContainer, fixed, true, transformState, ApplyContainerFlip, wasFixed); + MapLocalToContainerFlags mode = ApplyContainerFlip | UseTransforms; + if (fixed) + mode |= IsFixed; + mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); transformState.flatten(); return transformState.lastPlanarQuad(); @@ -2101,7 +2115,10 @@ FloatQuad RenderObject::localToContainerQuad(const FloatQuad& localQuad, RenderB FloatPoint RenderObject::localToContainerPoint(const FloatPoint& localPoint, RenderBoxModelObject* repaintContainer, bool fixed, bool* wasFixed) const { TransformState transformState(TransformState::ApplyTransformDirection, localPoint); - mapLocalToContainer(repaintContainer, fixed, true, transformState, ApplyContainerFlip, wasFixed); + MapLocalToContainerFlags mode = ApplyContainerFlip | UseTransforms; + if (fixed) + mode |= IsFixed; + mapLocalToContainer(repaintContainer, transformState, mode, wasFixed); transformState.flatten(); return transformState.lastPlanarPoint(); @@ -2632,7 +2649,7 @@ void RenderObject::getTextDecorationColors(int decorations, Color& underline, Co } } -#if ENABLE(DASHBOARD_SUPPORT) +#if ENABLE(DASHBOARD_SUPPORT) || ENABLE(WIDGET_REGION) void RenderObject::addDashboardRegions(Vector<DashboardRegionValue>& regions) { // Convert the style regions to absolute coordinates. @@ -2890,6 +2907,11 @@ bool RenderObject::canHaveGeneratedChildren() const return canHaveChildren(); } +bool RenderObject::canBeReplacedWithInlineRunIn() const +{ + return true; +} + #if ENABLE(SVG) RenderSVGResourceContainer* RenderObject::toRenderSVGResourceContainer() |