+2012-11-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r134205.
+ http://trac.webkit.org/changeset/134205
+ https://bugs.webkit.org/show_bug.cgi?id=102093
+
+ Broke webkit-flow-inlines-dynamic.html on several ports
+ (Requested by mihnea on #webkit).
+
+ * fast/regions/region-style-text-shadow-expected.html: Removed.
+ * fast/regions/region-style-text-shadow.html: Removed.
+
2012-11-13 Raphael Kubo da Costa <raphael.kubo.da.costa@intel.com>
[EFL] WK1 gardening.
+++ /dev/null
-<!doctype html>
-<html>
- <!--
- Test for https://bugs.webkit.org/show_bug.cgi?id=94472 ([CSSRegions]Add support for text-shadow in region styling).
- You should not see any red text below.
- -->
- <head>
- <style>
- body { font-family: monospace; }
- .divSize { width: 340px; height: 40px; }
- .shadowGreen { text-shadow: 340px 100px #008000; }
- .shadowBlue { text-shadow: 340px 100px #0000ff; }
- .multipleShadow { text-shadow: 340px 100px #0000ff, 0px 100px #0000ff, 340px 0px #0000ff; }
- #p1 { position: absolute; top: 10px; }
- #span2 { position: absolute; top: 50px; }
- #article3 { position: absolute; top: 90px; }
- #div4 { position: absolute; top: 140px; }
- #div51 { position: absolute; top: 190px; }
- #div6 { position: absolute; top: 240px; }
- #div7 { position: absolute; top: 290px; }
- </style>
- </head>
-<body>
- <p id="p1" class="shadowGreen">P shadow styled in region: #008000.</p>
-
- <span id="span2" class="shadowGreen">Span shadow styled in region: #008000.</span>
-
- <div id="article3" class="shadowBlue">
- Text shadow styled in region: #0000ff.
- <div id="div3" class="shadowGreen">Div shadow styled in region: #008000.</div>
- Text shadow styled in region: #0000ff.
- </div>
-
- <div id="div4" class="divSize">
- Text without shadow.
- <p id="p4" class="shadowBlue">P shadow styled in region: #0000ff.</p>
- </div>
-
- <div id="div51" class="divSize">
- Text without shadow.
- <div id="div52" class="shadowBlue">Div shadow styled in region: #0000ff.</div>
- </div>
-
- <div id="div6" class="divSize">
- Text with removed shadow due to region styling.
- </div>
-
- <div id="div7" class="multipleShadow divSize">
- Text with multiple shadows.
- </div>
- </body>
-</html>
+++ /dev/null
-<!doctype html>
-<html>
- <!--
- Test for https://bugs.webkit.org/show_bug.cgi?id=94472 ([CSSRegions]Add support for text-shadow in region styling).
- You should not see any red shadows below.
- -->
- <head>
- <style>
- body { font-family: monospace; }
- .regionBox { width: 340px; height: 24px; }
- .regionBox2 { width: 340px; height: 40px; }
-
- #article1 { -webkit-flow-into: flow1; }
- #region1 { -webkit-flow-from: flow1; position: absolute; top: 10px; }
- #p1 { text-shadow: 340px 100px #ff0000; }
- @-webkit-region #region1 { #p1 { text-shadow: 340px 100px #008000; } }
-
- #article2 { -webkit-flow-into: flow2; }
- #region2 { -webkit-flow-from: flow2; position: absolute; top: 50px; }
- #span2 { text-shadow: 340px 100px #ff0000; }
- @-webkit-region #region2 { #span2 { text-shadow: 340px 100px #008000; } }
-
- #article3 { -webkit-flow-into: flow3; }
- #region3 { -webkit-flow-from: flow3; position: absolute; top: 90px; }
- #article3 { text-shadow: 340px 100px #ff0000; }
- @-webkit-region #region3 {
- #article3 { text-shadow: 340px 100px #0000ff; }
- #div3 { text-shadow: 340px 100px #008000; }
- }
-
- #article4 { -webkit-flow-into: flow4; }
- #p4 { text-shadow: 340px 100px #ff0000; }
- #region4 { -webkit-flow-from: flow4; position: absolute; top: 140px; }
- @-webkit-region #region4 { #p4 { text-shadow: 340px 100px #0000ff; } }
-
- #article5 { -webkit-flow-into: flow5; }
- #div5 { text-shadow: 340px 100px #ff0000; }
- #region5 { -webkit-flow-from: flow5; position: absolute; top: 190px; }
- @-webkit-region #region5 { #div5 { text-shadow: 340px 100px #0000ff; } }
-
- #article6 { -webkit-flow-into: flow6; }
- #div6 { text-shadow: 340px 100px #ff0000; }
- #region6 { -webkit-flow-from: flow6; position: absolute; top: 240px; }
- @-webkit-region #region6 { #div6 { text-shadow: none; } }
-
- #article7 { -webkit-flow-into: flow7; }
- #div7 { text-shadow: 340px 100px #ff0000; }
- #region7 { -webkit-flow-from: flow7; position: absolute; top: 290px; }
- @-webkit-region #region7 { #div7 { text-shadow: 340px 100px #0000ff, 0px 100px #0000ff, 340px 0px #0000ff; } }
- </style>
- </head>
- <body>
- <div id="article1">
- <p id="p1">P shadow styled in region: #008000.</p>
- </div>
- <div id="region1" class="regionBox"></div>
-
- <div id="article2">
- <span id="span2">Span shadow styled in region: #008000.</span>
- </div>
- <div id="region2" class="regionBox"></div>
-
- <div id="article3">
- Text shadow styled in region: #0000ff.
- <div id="div3">Div shadow styled in region: #008000.</div>
- Text shadow styled in region: #0000ff.
- </div>
- <div id="region3" class="regionBox2"></div>
-
- <div id="article4">
- Text without shadow.
- <p id="p4">P shadow styled in region: #0000ff.</p>
- </div>
- <div id="region4" class="regionBox2"></div>
-
- <div id="article5">
- Text without shadow.
- <div id="div5">Div shadow styled in region: #0000ff.</div>
- </div>
- <div id="region5" class="regionBox2"></div>
-
- <div id="article6">
- <div id="div6">
- Text with removed shadow due to region styling.
- </div>
- </div>
- <div id="region6" class="regionBox"></div>
-
- <div id="article7">
- <div id="div7">
- Text with multiple shadows.
- </div>
- </div>
- <div id="region7" class="regionBox"></div>
- </body>
-</html>
+2012-11-13 Sheriff Bot <webkit.review.bot@gmail.com>
+
+ Unreviewed, rolling out r134205.
+ http://trac.webkit.org/changeset/134205
+ https://bugs.webkit.org/show_bug.cgi?id=102093
+
+ Broke webkit-flow-inlines-dynamic.html on several ports
+ (Requested by mihnea on #webkit).
+
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::isValidRegionStyleProperty):
+ * rendering/InlineBox.cpp:
+ * rendering/InlineBox.h:
+ (WebCore):
+ (InlineBox):
+ * rendering/InlineFlowBox.cpp:
+ (WebCore::InlineFlowBox::addToLine):
+ (WebCore::InlineFlowBox::addTextBoxVisualOverflow):
+ * rendering/RenderRegion.cpp:
+ (WebCore::RenderRegion::setRegionObjectsRegionStyle):
+ (WebCore::RenderRegion::restoreRegionObjectsOriginalStyle):
+ (WebCore::RenderRegion::computeStyleInRegion):
+ (WebCore::RenderRegion::computeChildrenStyleInRegion):
+ (WebCore::RenderRegion::setObjectStyleInRegion):
+ (WebCore::RenderRegion::clearObjectStyleInRegion):
+ * rendering/RenderRegion.h:
+ (RenderRegion):
+ (ObjectRegionStyleInfo):
+
2012-11-13 Andreas Kling <kling@webkit.org>
Remove the non-const overload of ElementAttributeData::inlineStyle().
switch (id) {
case CSSPropertyBackgroundColor:
case CSSPropertyColor:
- case CSSPropertyTextShadow:
return true;
default:
break;
#include "PaintInfo.h"
#include "RenderArena.h"
#include "RenderBlock.h"
-#include "RenderFlowThread.h"
-#include "RenderRegion.h"
-#include "RenderStyle.h"
-#include "RenderView.h"
#include "RootInlineBox.h"
#ifndef NDEBUG
}
}
-RenderStyle* InlineBox::styleInRegion(RenderRegion* region) const
-{
- if (!region || !renderer()->inRenderFlowThread())
- return renderer()->style(isFirstLineStyle());
-
- // Find the first parent element.
- RenderObject* elementRenderer = renderer();
- while (elementRenderer && (elementRenderer->isAnonymous() || !elementRenderer->node() || !elementRenderer->node()->isElementNode()))
- elementRenderer = elementRenderer->parent();
-
- if (!elementRenderer)
- return renderer()->style(isFirstLineStyle());
-
- // FIXME: We should be taking into account isFirstLine
- return region->ensureRegionStyleForObject(elementRenderer);
-}
-
-RenderRegion* InlineBox::regionDuringLayout() const
-{
- // This assumes that the box has not been positioned yet
- // so it uses the containing block's current logical height to get the region.
- ASSERT(renderer() && renderer()->view() && renderer()->view()->layoutState());
- if (!renderer()->inRenderFlowThread())
- return 0;
-
- RenderFlowThread* flowThread = renderer()->enclosingRenderFlowThread();
- ASSERT(flowThread);
-
- RenderBlock* containingBlock = renderer()->containingBlock();
- return flowThread->regionAtBlockOffset(containingBlock->offsetFromLogicalTopOfFirstPage() + containingBlock->logicalHeight());
-}
-
bool InlineBox::nodeAtPoint(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit /* lineTop */, LayoutUnit /*lineBottom*/)
{
// Hit test all phases of replaced elements atomically, as though the replaced element established its
class HitTestRequest;
class HitTestResult;
-class RenderRegion;
-class RenderStyle;
class RootInlineBox;
// InlineBox represents a rectangle that occurs on a line. It corresponds to
virtual void paint(PaintInfo&, const LayoutPoint&, LayoutUnit lineTop, LayoutUnit lineBottom);
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset, LayoutUnit lineTop, LayoutUnit lineBottom);
- RenderStyle* styleInRegion(RenderRegion*) const;
- RenderRegion* regionDuringLayout() const;
-
// Overloaded new operator.
void* operator new(size_t, RenderArena*);
if (descendantsHaveSameLineHeightAndBaseline() && !child->renderer()->isOutOfFlowPositioned()) {
RenderStyle* parentStyle = renderer()->style(isFirstLineStyle());
- RenderStyle* childStyle = child->styleInRegion(child->regionDuringLayout());
+ RenderStyle* childStyle = child->renderer()->style(isFirstLineStyle());
bool shouldClearDescendantsHaveSameLineHeightAndBaseline = false;
if (child->renderer()->isReplaced())
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
if (textBox->knownToHaveNoOverflow())
return;
- RenderStyle* style = textBox->styleInRegion(textBox->regionDuringLayout());
+ RenderStyle* style = textBox->renderer()->style(isFirstLineStyle());
GlyphOverflowAndFallbackFontsMap::iterator it = textBoxDataMap.find(textBox);
GlyphOverflow* glyphOverflow = it == textBoxDataMap.end() ? 0 : &it->value.second;
if (!flowThread()->objectInFlowRegion(object, this))
continue;
- setObjectStyleInRegion(object);
- setChildrenStyleInRegion(object);
+ // If the object has style in region, use that instead of computing a new one.
+ RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find(object);
+ RefPtr<RenderStyle> objectStyleInRegion;
+ bool objectRegionStyleCached = false;
+ if (it != m_renderObjectRegionStyle.end()) {
+ objectStyleInRegion = it->value.style;
+ ASSERT(it->value.cached);
+ objectRegionStyleCached = true;
+ } else
+ objectStyleInRegion = computeStyleInRegion(object);
+
+ setObjectStyleInRegion(object, objectStyleInRegion, objectRegionStyleCached);
+
+ computeChildrenStyleInRegion(object);
}
}
-static bool canCacheObjectStyleInRegion(const RenderStyle* styleInRegion, const RenderStyle* originalStyle)
-{
- ASSERT(styleInRegion);
- ASSERT(originalStyle);
-
- unsigned changedContextSensitiveProperties = ContextSensitivePropertyNone;
- StyleDifference styleDiff = originalStyle->diff(styleInRegion, changedContextSensitiveProperties);
- return styleDiff < StyleDifferenceLayoutPositionedMovementOnly;
-}
-
-// Restore the objects original style and cache the style in region for the objects
-// for which it is safe to cache that style.
void RenderRegion::restoreRegionObjectsOriginalStyle()
{
if (!hasCustomRegionStyle())
RefPtr<RenderStyle> objectOriginalStyle = iter->value.style;
object->setStyleInternal(objectOriginalStyle);
- if (iter->value.canBeCached || canCacheObjectStyleInRegion(objectRegionStyle.get(), objectOriginalStyle.get())) {
+ bool shouldCacheRegionStyle = iter->value.cached;
+ if (!shouldCacheRegionStyle) {
+ // Check whether we should cache the computed style in region.
+ unsigned changedContextSensitiveProperties = ContextSensitivePropertyNone;
+ StyleDifference styleDiff = objectOriginalStyle->diff(objectRegionStyle.get(), changedContextSensitiveProperties);
+ if (styleDiff < StyleDifferenceLayoutPositionedMovementOnly)
+ shouldCacheRegionStyle = true;
+ }
+ if (shouldCacheRegionStyle) {
ObjectRegionStyleInfo styleInfo;
styleInfo.style = objectRegionStyle;
- styleInfo.canBeCached = true;
- styleInfo.originalStyle = false;
+ styleInfo.cached = true;
temp.set(object, styleInfo);
}
}
detachRegion();
}
-// We also need to compute parent's region style to inherit styling information.
-// The computation of styles in region should not exceed content nodes boundaries.
PassRefPtr<RenderStyle> RenderRegion::computeStyleInRegion(const RenderObject* object)
{
ASSERT(object);
ASSERT(object->view());
ASSERT(object->view()->document());
-
- if (object->isAnonymous())
- return RenderStyle::createAnonymousStyleWithDisplay(ensureRegionStyleForObject(object->parent()), object->style()->display());
-
- if (object->isText())
- return RenderStyle::clone(ensureRegionStyleForObject(object->parent()));
+ ASSERT(!object->isAnonymous());
+ ASSERT(object->node() && object->node()->isElementNode());
// FIXME: Region styling fails for pseudo-elements because the renderers don't have a node.
- ASSERT(object->node() && object->node()->isElementNode());
Element* element = toElement(object->node());
- RefPtr<RenderStyle> renderObjectRegionStyle = object->view()->document()->styleResolver()->styleForElement(element,
- element->inNamedFlow() ? 0 : ensureRegionStyleForObject(object->parent()) /*parent style in region*/, DisallowStyleSharing, MatchAllRules, this);
+ RefPtr<RenderStyle> renderObjectRegionStyle = object->view()->document()->styleResolver()->styleForElement(element, 0, DisallowStyleSharing, MatchAllRules, this);
return renderObjectRegionStyle.release();
}
-void RenderRegion::setChildrenStyleInRegion(const RenderObject* object)
+void RenderRegion::computeChildrenStyleInRegion(const RenderObject* object)
{
for (RenderObject* child = object->firstChild(); child; child = child->nextSibling()) {
- setObjectStyleInRegion(child);
- setChildrenStyleInRegion(child);
+
+ RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find(child);
+
+ RefPtr<RenderStyle> childStyleInRegion;
+ bool objectRegionStyleCached = false;
+ if (it != m_renderObjectRegionStyle.end()) {
+ childStyleInRegion = it->value.style;
+ objectRegionStyleCached = true;
+ } else {
+ if (child->isAnonymous())
+ childStyleInRegion = RenderStyle::createAnonymousStyleWithDisplay(object->style(), child->style()->display());
+ else if (child->isText())
+ childStyleInRegion = RenderStyle::clone(object->style());
+ else
+ childStyleInRegion = computeStyleInRegion(child);
+ }
+
+ setObjectStyleInRegion(child, childStyleInRegion, objectRegionStyleCached);
+
+ computeChildrenStyleInRegion(child);
}
}
-static void setObjectHasBoxDecorationsFlag(RenderObject* object)
+void RenderRegion::setObjectStyleInRegion(RenderObject* object, PassRefPtr<RenderStyle> styleInRegion, bool objectRegionStyleCached)
{
- ASSERT(object);
ASSERT(object->inRenderFlowThread());
-
- if (!object->isBoxModelObject() || object->hasBoxDecorations())
+ if (!object->inRenderFlowThread())
return;
- bool hasBoxDecorations = object->isTableCell()
+ RefPtr<RenderStyle> objectOriginalStyle = object->style();
+ object->setStyleInternal(styleInRegion);
+
+ if (object->isBoxModelObject() && !object->hasBoxDecorations()) {
+ bool hasBoxDecorations = object->isTableCell()
|| object->style()->hasBackground()
|| object->style()->hasBorder()
|| object->style()->hasAppearance()
|| object->style()->boxShadow();
- object->setHasBoxDecorations(hasBoxDecorations);
-}
-
-// Set the current style for the object to be the style in region.
-// If the style in region is not computed yet, compute it before replacing the original style.
-// The original object style is stored so that it can be restored later.
-void RenderRegion::setObjectStyleInRegion(RenderObject* object)
-{
- ASSERT(object->inRenderFlowThread());
- ASSERT(!object->isRenderFlowThread());
-
- RefPtr<RenderStyle> objectOriginalStyle = object->style();
- RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find(object);
-
- if (it == m_renderObjectRegionStyle.end()) {
- ensureRegionStyleForObject(object);
- it = m_renderObjectRegionStyle.find(object);
+ object->setHasBoxDecorations(hasBoxDecorations);
}
- object->setStyleInternal(it->value.style);
- setObjectHasBoxDecorationsFlag(object);
-
- it->value.style = objectOriginalStyle;
- it->value.originalStyle = true;
+ ObjectRegionStyleInfo styleInfo;
+ styleInfo.style = objectOriginalStyle;
+ styleInfo.cached = objectRegionStyleCached;
+ m_renderObjectRegionStyle.set(object, styleInfo);
}
-// Clear the style for the children of this object.
void RenderRegion::clearObjectStyleInRegion(const RenderObject* object)
{
ASSERT(object);
m_renderObjectRegionStyle.remove(object);
+ // Clear the style for the children of this object.
for (RenderObject* child = object->firstChild(); child; child = child->nextSibling())
clearObjectStyleInRegion(child);
}
-RenderStyle* RenderRegion::ensureRegionStyleForObject(const RenderObject* object)
-{
- ASSERT(object);
- ASSERT(object->inRenderFlowThread());
-
- if (object->isRenderFlowThread())
- return object->style();
-
- RenderObjectRegionStyleMap::iterator it = m_renderObjectRegionStyle.find(object);
- if (it != m_renderObjectRegionStyle.end()) {
- // If the current value stored is the original style, it means that we already
- // switched styles and the style in region can be retrived using style().
- return it->value.originalStyle ? object->style() : it->value.style.get();
- }
-
- RefPtr<RenderStyle> objectStyleInRegion = computeStyleInRegion(object);
-
- ObjectRegionStyleInfo styleInfo;
- styleInfo.style = objectStyleInRegion;
- styleInfo.originalStyle = false;
- styleInfo.canBeCached = canCacheObjectStyleInRegion(objectStyleInRegion.get(), object->style());
- m_renderObjectRegionStyle.add(object, styleInfo);
-
- return objectStyleInRegion.get();
-}
-
// FIXME: when RenderRegion will inherit from RenderBlock instead of RenderReplaced,
// we should overwrite computePreferredLogicalWidths ( see https://bugs.webkit.org/show_bug.cgi?id=74132 )
LayoutUnit RenderRegion::minPreferredLogicalWidth() const
virtual void repaintFlowThreadContent(const LayoutRect& repaintRect, bool immediate) const;
- RenderStyle* ensureRegionStyleForObject(const RenderObject*);
-
protected:
void setRegionObjectsRegionStyle();
void restoreRegionObjectsOriginalStyle();
virtual void installFlowThread();
PassRefPtr<RenderStyle> computeStyleInRegion(const RenderObject*);
- void setChildrenStyleInRegion(const RenderObject*);
- void setObjectStyleInRegion(RenderObject*);
+ void computeChildrenStyleInRegion(const RenderObject*);
+ void setObjectStyleInRegion(RenderObject*, PassRefPtr<RenderStyle>, bool objectRegionStyleCached);
+ void printRegionObjectsStyles();
void checkRegionStyle();
void updateRegionHasAutoLogicalHeightFlag();
// region paintings, so that the style in region is computed only
// when necessary.
RefPtr<RenderStyle> style;
-
- // True if the computed style in region can be cached.
- bool canBeCached : 1;
-
- // True if style keeps the original object style, false if style keeps
- // the object style in region.
- bool originalStyle : 1;
+ // True if the computed style in region is cached.
+ bool cached;
};
typedef HashMap<const RenderObject*, ObjectRegionStyleInfo > RenderObjectRegionStyleMap;
RenderObjectRegionStyleMap m_renderObjectRegionStyle;