summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/rendering/style
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/WebCore/rendering/style
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/WebCore/rendering/style')
-rw-r--r--Source/WebCore/rendering/style/BorderData.h8
-rw-r--r--Source/WebCore/rendering/style/FillLayer.cpp18
-rw-r--r--Source/WebCore/rendering/style/RenderStyle.cpp49
-rw-r--r--Source/WebCore/rendering/style/RenderStyle.h11
-rw-r--r--Source/WebCore/rendering/style/RenderStyleConstants.h5
-rw-r--r--Source/WebCore/rendering/style/StyleRareInheritedData.cpp3
-rw-r--r--Source/WebCore/rendering/style/StyleRareInheritedData.h1
-rw-r--r--Source/WebCore/rendering/style/StyleRareNonInheritedData.h2
8 files changed, 45 insertions, 52 deletions
diff --git a/Source/WebCore/rendering/style/BorderData.h b/Source/WebCore/rendering/style/BorderData.h
index 0e50edb..26f089f 100644
--- a/Source/WebCore/rendering/style/BorderData.h
+++ b/Source/WebCore/rendering/style/BorderData.h
@@ -49,13 +49,13 @@ public:
bool hasBorderRadius() const
{
- if (m_topLeft.width().rawValue() > 0)
+ if (!m_topLeft.width().isZero())
return true;
- if (m_topRight.width().rawValue() > 0)
+ if (!m_topRight.width().isZero())
return true;
- if (m_bottomLeft.width().rawValue() > 0)
+ if (!m_bottomLeft.width().isZero())
return true;
- if (m_bottomRight.width().rawValue() > 0)
+ if (!m_bottomRight.width().isZero())
return true;
return false;
}
diff --git a/Source/WebCore/rendering/style/FillLayer.cpp b/Source/WebCore/rendering/style/FillLayer.cpp
index 59f3bb2..c957cfe 100644
--- a/Source/WebCore/rendering/style/FillLayer.cpp
+++ b/Source/WebCore/rendering/style/FillLayer.cpp
@@ -129,17 +129,6 @@ bool FillLayer::operator==(const FillLayer& o) const
void FillLayer::fillUnsetProperties()
{
FillLayer* curr;
- for (curr = this; curr && curr->isImageSet(); curr = curr->next()) { }
- if (curr && curr != this) {
- // We need to fill in the remaining values with the pattern specified.
- for (FillLayer* pattern = this; curr; curr = curr->next()) {
- curr->m_image = pattern->m_image;
- pattern = pattern->next();
- if (pattern == curr || !pattern)
- pattern = this;
- }
- }
-
for (curr = this; curr && curr->isXPositionSet(); curr = curr->next()) { }
if (curr && curr != this) {
// We need to fill in the remaining values with the pattern specified.
@@ -246,12 +235,7 @@ void FillLayer::cullEmptyLayers()
FillLayer* next;
for (FillLayer* p = this; p; p = next) {
next = p->m_next;
- if (next && !next->isImageSet() &&
- !next->isXPositionSet() && !next->isYPositionSet() &&
- !next->isAttachmentSet() && !next->isClipSet() &&
- !next->isCompositeSet() && !next->isOriginSet() &&
- !next->isRepeatXSet() && !next->isRepeatYSet()
- && !next->isSizeSet()) {
+ if (next && !next->isImageSet()) {
delete next;
p->m_next = 0;
break;
diff --git a/Source/WebCore/rendering/style/RenderStyle.cpp b/Source/WebCore/rendering/style/RenderStyle.cpp
index 122b762..34e972d 100644
--- a/Source/WebCore/rendering/style/RenderStyle.cpp
+++ b/Source/WebCore/rendering/style/RenderStyle.cpp
@@ -56,6 +56,14 @@ PassRefPtr<RenderStyle> RenderStyle::createDefaultStyle()
return adoptRef(new RenderStyle(true));
}
+PassRefPtr<RenderStyle> RenderStyle::createAnonymousStyle(const RenderStyle* parentStyle)
+{
+ RefPtr<RenderStyle> newStyle = RenderStyle::create();
+ newStyle->inheritFrom(parentStyle);
+ newStyle->inheritUnicodeBidiFrom(parentStyle);
+ return newStyle;
+}
+
PassRefPtr<RenderStyle> RenderStyle::clone(const RenderStyle* other)
{
return adoptRef(new RenderStyle(*other));
@@ -295,21 +303,6 @@ static bool positionedObjectMoved(const LengthBox& a, const LengthBox& b)
return true;
}
-/*
- compares two styles. The result gives an idea of the action that
- needs to be taken when replacing the old style with a new one.
-
- CbLayout: The containing block of the object needs a relayout.
- Layout: the RenderObject needs a relayout after the style change
- Visible: The change is visible, but no relayout is needed
- NonVisible: The object does need neither repaint nor relayout after
- the change.
-
- ### TODO:
- A lot can be optimised here based on the display type, lots of
- optimisations are unimplemented, and currently result in the
- worst case result causing a relayout of the containing block.
-*/
StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedContextSensitiveProperties) const
{
changedContextSensitiveProperties = ContextSensitivePropertyNone;
@@ -411,7 +404,8 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
rareInheritedData->locale != other->rareInheritedData->locale ||
rareInheritedData->textEmphasisMark != other->rareInheritedData->textEmphasisMark ||
rareInheritedData->textEmphasisPosition != other->rareInheritedData->textEmphasisPosition ||
- rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark)
+ rareInheritedData->textEmphasisCustomMark != other->rareInheritedData->textEmphasisCustomMark ||
+ rareInheritedData->m_lineBoxContain != other->rareInheritedData->m_lineBoxContain)
return StyleDifferenceLayout;
if (!rareInheritedData->shadowDataEquivalent(*other->rareInheritedData.get()))
@@ -499,15 +493,19 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
rareNonInheritedData->m_counterReset != other->rareNonInheritedData->m_counterReset)
return StyleDifferenceLayout;
+ if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
+ return StyleDifferenceLayout;
+
if ((rareNonInheritedData->opacity == 1 && other->rareNonInheritedData->opacity < 1) ||
(rareNonInheritedData->opacity < 1 && other->rareNonInheritedData->opacity == 1)) {
- // FIXME: We should add an optimized form of layout that just recomputes visual overflow.
+ // FIXME: We would like to use SimplifiedLayout here, but we can't quite do that yet.
+ // We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need
+ // to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
+ // In addition we need to solve the floating object issue when layers come and go. Right now
+ // a full layout is necessary to keep floating object lists sane.
return StyleDifferenceLayout;
}
- if ((visibility() == COLLAPSE) != (other->visibility() == COLLAPSE))
- return StyleDifferenceLayout;
-
#if ENABLE(SVG)
// SVGRenderStyle::diff() might have returned StyleDifferenceRepaint, eg. if fill changes.
// If eg. the font-size changed at the same time, we're not allowed to return StyleDifferenceRepaint,
@@ -525,13 +523,10 @@ StyleDifference RenderStyle::diff(const RenderStyle* other, unsigned& changedCon
if (position() == AbsolutePosition && positionedObjectMoved(surround->offset, other->surround->offset))
return StyleDifferenceLayoutPositionedMovementOnly;
- // FIXME: We will need to do a bit of work in RenderObject/Box::setStyle before we
- // can stop doing a layout when relative positioned objects move. In particular, we'll need
- // to update scrolling positions and figure out how to do a repaint properly of the updated layer.
- //if (other->position() == RelativePosition)
- // return RepaintLayer;
- //else
- return StyleDifferenceLayout;
+ // FIXME: We would like to use SimplifiedLayout for relative positioning, but we can't quite do that yet.
+ // We need to make sure SimplifiedLayout can operate correctly on RenderInlines (we will need
+ // to add a selfNeedsSimplifiedLayout bit in order to not get confused and taint every line).
+ return StyleDifferenceLayout;
} else if (m_box->zIndex() != other->m_box->zIndex() || m_box->hasAutoZIndex() != other->m_box->hasAutoZIndex() ||
visual->clip != other->visual->clip || visual->hasClip != other->visual->hasClip)
return StyleDifferenceRepaintLayer;
diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h
index 79ed6e4..859348f 100644
--- a/Source/WebCore/rendering/style/RenderStyle.h
+++ b/Source/WebCore/rendering/style/RenderStyle.h
@@ -27,6 +27,7 @@
#include "AnimationList.h"
#include "BorderValue.h"
+#include "CSSLineBoxContainValue.h"
#include "CSSPrimitiveValue.h"
#include "CSSPropertyNames.h"
#include "Color.h"
@@ -58,6 +59,7 @@
#include "StyleTransformData.h"
#include "StyleVisualData.h"
#include "TextDirection.h"
+#include "TextOrientation.h"
#include "ThemeTypes.h"
#include "TransformOperations.h"
#include <wtf/Forward.h>
@@ -106,6 +108,7 @@ class RenderStyle: public RefCounted<RenderStyle> {
friend class AnimationBase; // Used by CSS animations. We can't allow them to animate based off visited colors.
friend class ApplyStyleCommand; // Editing has to only reveal unvisited info.
friend class EditingStyle; // Editing has to only reveal unvisited info.
+ friend class CSSStyleApplyProperty; // Sets members directly.
friend class CSSStyleSelector; // Sets members directly.
friend class CSSComputedStyleDeclaration; // Ignores visited styles, so needs to be able to see unvisited info.
friend class PropertyWrapperMaybeInvalidColor; // Used by CSS animations. We can't allow them to animate based off visited colors.
@@ -184,7 +187,7 @@ protected:
unsigned _list_style_type : 7; // EListStyleType
unsigned _list_style_position : 1; // EListStylePosition
unsigned _visibility : 2; // EVisibility
- unsigned _text_align : 3; // ETextAlign
+ unsigned _text_align : 4; // ETextAlign
unsigned _text_transform : 2; // ETextTransform
unsigned _text_decorations : 4;
unsigned _cursor_style : 6; // ECursor
@@ -310,6 +313,7 @@ private:
public:
static PassRefPtr<RenderStyle> create();
static PassRefPtr<RenderStyle> createDefaultStyle();
+ static PassRefPtr<RenderStyle> createAnonymousStyle(const RenderStyle* parentStyle);
static PassRefPtr<RenderStyle> clone(const RenderStyle*);
~RenderStyle();
@@ -770,6 +774,7 @@ public:
bool isRunningAcceleratedAnimation() const { return rareNonInheritedData->m_runningAcceleratedAnimation; }
#endif
+ LineBoxContain lineBoxContain() const { return rareInheritedData->m_lineBoxContain; }
const LineClampValue& lineClamp() const { return rareNonInheritedData->lineClamp; }
bool textSizeAdjust() const { return rareInheritedData->textSizeAdjust; }
ETextSecurity textSecurity() const { return static_cast<ETextSecurity>(rareInheritedData->textSecurity); }
@@ -1130,6 +1135,7 @@ public:
void setIsRunningAcceleratedAnimation(bool b = true) { SET_VAR(rareNonInheritedData, m_runningAcceleratedAnimation, b); }
#endif
+ void setLineBoxContain(LineBoxContain c) { SET_VAR(rareInheritedData, m_lineBoxContain, c); }
void setLineClamp(LineClampValue c) { SET_VAR(rareNonInheritedData, lineClamp, c); }
void setTextSizeAdjust(bool b) { SET_VAR(rareInheritedData, textSizeAdjust, b); }
void setTextSecurity(ETextSecurity aTextSecurity) { SET_VAR(rareInheritedData, textSecurity, aTextSecurity); }
@@ -1246,6 +1252,7 @@ public:
static TextDirection initialDirection() { return LTR; }
static WritingMode initialWritingMode() { return TopToBottomWritingMode; }
static TextCombine initialTextCombine() { return TextCombineNone; }
+ static TextOrientation initialTextOrientation() { return TextOrientationVerticalRight; }
static EDisplay initialDisplay() { return INLINE; }
static EEmptyCell initialEmptyCells() { return SHOW; }
static EFloat initialFloating() { return FNONE; }
@@ -1339,6 +1346,7 @@ public:
static TextEmphasisMark initialTextEmphasisMark() { return TextEmphasisMarkNone; }
static const AtomicString& initialTextEmphasisCustomMark() { return nullAtom; }
static TextEmphasisPosition initialTextEmphasisPosition() { return TextEmphasisPositionOver; }
+ static LineBoxContain initialLineBoxContain() { return LineBoxContainBlock | LineBoxContainInline | LineBoxContainReplaced; }
// Keep these at the end.
static LineClampValue initialLineClamp() { return LineClampValue(); }
@@ -1365,6 +1373,7 @@ public:
#endif
private:
+ void inheritUnicodeBidiFrom(const RenderStyle* parent) { noninherited_flags._unicodeBidi = parent->noninherited_flags._unicodeBidi; }
void getShadowExtent(const ShadowData*, int& top, int& right, int& bottom, int& left) const;
void getShadowHorizontalExtent(const ShadowData*, int& left, int& right) const;
void getShadowVerticalExtent(const ShadowData*, int& top, int& bottom) const;
diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h
index 3c62dbe..08f2c15 100644
--- a/Source/WebCore/rendering/style/RenderStyleConstants.h
+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h
@@ -51,6 +51,7 @@ enum StyleDifference {
StyleDifferenceRepaint,
StyleDifferenceRepaintLayer,
StyleDifferenceLayoutPositionedMovementOnly,
+ StyleDifferenceSimplifiedLayout,
StyleDifferenceLayout
};
@@ -120,7 +121,7 @@ enum ETableLayout {
};
enum EUnicodeBidi {
- UBNormal, Embed, Override
+ UBNormal, Embed, Override, Isolate
};
// CSS Text Layout Module Level 3: Vertical writing support
@@ -318,7 +319,7 @@ enum EWhiteSpace {
};
enum ETextAlign {
- TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER
+ TAAUTO, LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND,
};
enum ETextTransform {
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
index 2798fd1..2253d1c 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
@@ -66,6 +66,7 @@ StyleRareInheritedData::StyleRareInheritedData()
, textEmphasisFill(TextEmphasisFillFilled)
, textEmphasisMark(TextEmphasisMarkNone)
, textEmphasisPosition(TextEmphasisPositionOver)
+ , m_lineBoxContain(RenderStyle::initialLineBoxContain())
, hyphenationLimitBefore(-1)
, hyphenationLimitAfter(-1)
{
@@ -113,6 +114,7 @@ StyleRareInheritedData::StyleRareInheritedData(const StyleRareInheritedData& o)
, textEmphasisFill(o.textEmphasisFill)
, textEmphasisMark(o.textEmphasisMark)
, textEmphasisPosition(o.textEmphasisPosition)
+ , m_lineBoxContain(o.m_lineBoxContain)
, hyphenationString(o.hyphenationString)
, hyphenationLimitBefore(o.hyphenationLimitBefore)
, hyphenationLimitAfter(o.hyphenationLimitAfter)
@@ -179,6 +181,7 @@ bool StyleRareInheritedData::operator==(const StyleRareInheritedData& o) const
&& textEmphasisFill == o.textEmphasisFill
&& textEmphasisMark == o.textEmphasisMark
&& textEmphasisPosition == o.textEmphasisPosition
+ && m_lineBoxContain == o.m_lineBoxContain
&& hyphenationString == o.hyphenationString
&& locale == o.locale
&& textEmphasisCustomMark == o.textEmphasisCustomMark
diff --git a/Source/WebCore/rendering/style/StyleRareInheritedData.h b/Source/WebCore/rendering/style/StyleRareInheritedData.h
index d4f233c..39cfe3c 100644
--- a/Source/WebCore/rendering/style/StyleRareInheritedData.h
+++ b/Source/WebCore/rendering/style/StyleRareInheritedData.h
@@ -99,6 +99,7 @@ public:
unsigned textEmphasisFill : 1; // TextEmphasisFill
unsigned textEmphasisMark : 3; // TextEmphasisMark
unsigned textEmphasisPosition : 1; // TextEmphasisPosition
+ unsigned m_lineBoxContain: 7; // LineBoxContain
AtomicString hyphenationString;
short hyphenationLimitBefore;
diff --git a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
index 89437f6..268a123 100644
--- a/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
+++ b/Source/WebCore/rendering/style/StyleRareNonInheritedData.h
@@ -107,7 +107,7 @@ public:
short m_counterIncrement;
short m_counterReset;
-
+
#if USE(ACCELERATED_COMPOSITING)
bool m_runningAcceleratedAnimation : 1;
#endif