WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
patch without test case
patch_76173_1009_07.patch (text/plain), 15.47 KB, created by
Dongwoo Joshua Im (dwim)
on 2012-10-11 23:00:19 PDT
(
hide
)
Description:
patch without test case
Filename:
MIME Type:
Creator:
Dongwoo Joshua Im (dwim)
Created:
2012-10-11 23:00:19 PDT
Size:
15.47 KB
patch
obsolete
>diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index f4f88b2..02fc319 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,41 @@ >+2012-10-11 Dongwoo Joshua Im <dw.im@samsung.com> >+ >+ CSS3: text-align-last on webkit >+ https://bugs.webkit.org/show_bug.cgi?id=76173 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Regarding the CSS specification below, text-align-last property is needed to be implemented in WebKit. >+ http://www.w3.org/TR/css3-text/#text-align-last >+ >+ Test will be created for this implementation. This is WIP patch. >+ >+ * css/CSSComputedStyleDeclaration.cpp: >+ (WebCore): >+ (WebCore::CSSComputedStyleDeclaration::getPropertyCSSValue): Get the value of the text-align-last property. >+ * css/CSSParser.cpp: >+ (WebCore::CSSParser::parseValue): Parse the value, and check whether it is a proper value which text-align-last can have. >+ * css/CSSPrimitiveValueMappings.h: >+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): auto is one of the possible value of text-align-last property. >+ (WebCore::CSSPrimitiveValue::operator ETextAlign): >+ * css/CSSProperty.cpp: >+ (WebCore::CSSProperty::isInheritedProperty): >+ * css/CSSPropertyNames.in: Add text-align-last property. >+ * css/StyleBuilder.cpp: Add a class to handle the text-align-last property. >+ (ApplyPropertyTextAlignLast): >+ (WebCore::ApplyPropertyTextAlignLast::applyValue): >+ (WebCore::ApplyPropertyTextAlignLast::createHandler): >+ (WebCore): >+ (WebCore::StyleBuilder::StyleBuilder): >+ * css/StylePropertySet.cpp: >+ (WebCore): >+ * css/StyleResolver.cpp: >+ (WebCore::StyleResolver::collectMatchingRulesForList): >+ * rendering/RenderBlockLineLayout.cpp: >+ (WebCore::RenderBlock::textAlignmentForLine): Add a mechanism to handle the last line. >+ * rendering/style/RenderStyle.h: >+ * rendering/style/RenderStyleConstants.h: >+ > 2012-10-11 Kent Tamura <tkent@chromium.org> > > Introduce Localizer::isRTL, and use it in DateTimeChooserImpl >diff --git a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >index aab8acb..353eea6 100644 >--- a/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >+++ b/Source/WebCore/css/CSSComputedStyleDeclaration.cpp >@@ -180,6 +180,7 @@ static const CSSPropertyID computedProperties[] = { > CSSPropertyTableLayout, > CSSPropertyTabSize, > CSSPropertyTextAlign, >+ CSSPropertyTextAlignLast, > CSSPropertyTextDecoration, > #if ENABLE(CSS3_TEXT_DECORATION) > CSSPropertyWebkitTextDecorationLine, >@@ -2024,6 +2025,8 @@ PassRefPtr<CSSValue> CSSComputedStyleDeclaration::getPropertyCSSValue(CSSPropert > return cssValuePool().createValue(style->tableLayout()); > case CSSPropertyTextAlign: > return cssValuePool().createValue(style->textAlign()); >+ case CSSPropertyTextAlignLast: >+ return cssValuePool().createValue(style->textAlignLast()); > case CSSPropertyTextDecoration: > return renderTextDecorationFlagsToCSSValue(style->textDecoration()); > #if ENABLE(CSS3_TEXT_DECORATION) >diff --git a/Source/WebCore/css/CSSParser.cpp b/Source/WebCore/css/CSSParser.cpp >index 42282a1..b2ac96d 100644 >--- a/Source/WebCore/css/CSSParser.cpp >+++ b/Source/WebCore/css/CSSParser.cpp >@@ -1765,6 +1765,13 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important) > validPrimitive = true; > break; > >+ case CSSPropertyTextAlignLast: >+ // left || right || center || justify || start || end || auto >+ if ((id >= CSSValueLeft && id <= CSSValueJustify) || id == CSSValueStart || id == CSSValueEnd || id == CSSValueAuto >+ || value->unit == CSSPrimitiveValue::CSS_STRING) >+ validPrimitive = true; >+ break; >+ > case CSSPropertyFontWeight: { // normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit > if (m_valueList->size() != 1) > return false; >diff --git a/Source/WebCore/css/CSSPrimitiveValueMappings.h b/Source/WebCore/css/CSSPrimitiveValueMappings.h >index 3dd09a6..d230977 100644 >--- a/Source/WebCore/css/CSSPrimitiveValueMappings.h >+++ b/Source/WebCore/css/CSSPrimitiveValueMappings.h >@@ -2168,6 +2168,9 @@ template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ETextAlign e) > case WEBKIT_CENTER: > m_value.ident = CSSValueWebkitCenter; > break; >+ case TAAUTO: >+ m_value.ident = CSSValueWebkitAuto; >+ break; > } > } > >@@ -2179,6 +2182,8 @@ template<> inline CSSPrimitiveValue::operator ETextAlign() const > return TASTART; > case CSSValueEnd: > return TAEND; >+ case CSSValueAuto: // AUTO is a value only for text-align-last, not for text-align. >+ return TAAUTO; > default: > return static_cast<ETextAlign>(m_value.ident - CSSValueLeft); > } >diff --git a/Source/WebCore/css/CSSProperty.cpp b/Source/WebCore/css/CSSProperty.cpp >index bf2ead1..0d7f451 100644 >--- a/Source/WebCore/css/CSSProperty.cpp >+++ b/Source/WebCore/css/CSSProperty.cpp >@@ -311,6 +311,7 @@ bool CSSProperty::isInheritedProperty(CSSPropertyID propertyID) > case CSSPropertySpeak: > case CSSPropertyTabSize: > case CSSPropertyTextAlign: >+ case CSSPropertyTextAlignLast: > case CSSPropertyTextDecoration: > case CSSPropertyTextIndent: > case CSSPropertyTextRendering: >diff --git a/Source/WebCore/css/CSSPropertyNames.in b/Source/WebCore/css/CSSPropertyNames.in >index 69dafb8..b8b3900 100644 >--- a/Source/WebCore/css/CSSPropertyNames.in >+++ b/Source/WebCore/css/CSSPropertyNames.in >@@ -160,6 +160,7 @@ speak > table-layout > tab-size > text-align >+text-align-last > text-decoration > text-indent > text-line-through >diff --git a/Source/WebCore/css/StyleBuilder.cpp b/Source/WebCore/css/StyleBuilder.cpp >index 3129059..9f4f6fa 100644 >--- a/Source/WebCore/css/StyleBuilder.cpp >+++ b/Source/WebCore/css/StyleBuilder.cpp >@@ -1130,6 +1130,31 @@ public: > } > }; > >+class ApplyPropertyTextAlignLast { >+public: >+ static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) >+ { >+ if (!value->isPrimitiveValue()) >+ return; >+ >+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value); >+ >+ if (primitiveValue->getIdent() != CSSValueWebkitMatchParent) >+ styleResolver->style()->setTextAlignLast(*primitiveValue); >+ else if (styleResolver->parentStyle()->textAlignLast() == TASTART) >+ styleResolver->style()->setTextAlignLast(styleResolver->parentStyle()->isLeftToRightDirection() ? LEFT : RIGHT); >+ else if (styleResolver->parentStyle()->textAlignLast() == TAEND) >+ styleResolver->style()->setTextAlignLast(styleResolver->parentStyle()->isLeftToRightDirection() ? RIGHT : LEFT); >+ else >+ styleResolver->style()->setTextAlignLast(styleResolver->parentStyle()->textAlignLast()); >+ } >+ static PropertyHandler createHandler() >+ { >+ PropertyHandler handler = ApplyPropertyDefaultBase<ETextAlign, &RenderStyle::textAlignLast, ETextAlign, &RenderStyle::setTextAlignLast, ETextAlign, &RenderStyle::initialTextAlignLast>::createHandler(); >+ return PropertyHandler(handler.inheritFunction(), handler.initialFunction(), &applyValue); >+ } >+}; >+ > class ApplyPropertyTextDecoration { > public: > static void applyValue(CSSPropertyID, StyleResolver* styleResolver, CSSValue* value) >@@ -1913,6 +1938,7 @@ StyleBuilder::StyleBuilder() > setPropertyHandler(CSSPropertyTableLayout, ApplyPropertyDefault<ETableLayout, &RenderStyle::tableLayout, ETableLayout, &RenderStyle::setTableLayout, ETableLayout, &RenderStyle::initialTableLayout>::createHandler()); > setPropertyHandler(CSSPropertyTabSize, ApplyPropertyDefault<unsigned, &RenderStyle::tabSize, unsigned, &RenderStyle::setTabSize, unsigned, &RenderStyle::initialTabSize>::createHandler()); > setPropertyHandler(CSSPropertyTextAlign, ApplyPropertyTextAlign::createHandler()); >+ setPropertyHandler(CSSPropertyTextAlignLast, ApplyPropertyTextAlignLast::createHandler()); > setPropertyHandler(CSSPropertyTextDecoration, ApplyPropertyTextDecoration::createHandler()); > #if ENABLE(CSS3_TEXT_DECORATION) > setPropertyHandler(CSSPropertyWebkitTextDecorationLine, ApplyPropertyTextDecoration::createHandler()); >diff --git a/Source/WebCore/css/StylePropertySet.cpp b/Source/WebCore/css/StylePropertySet.cpp >index 5e522af..2fded1b 100644 >--- a/Source/WebCore/css/StylePropertySet.cpp >+++ b/Source/WebCore/css/StylePropertySet.cpp >@@ -939,6 +939,7 @@ static const CSSPropertyID blockProperties[] = { > CSSPropertyWebkitRegionBreakInside, > #endif > CSSPropertyTextAlign, >+ CSSPropertyTextAlignLast, > CSSPropertyTextIndent, > CSSPropertyWidows > }; >diff --git a/Source/WebCore/css/StyleResolver.cpp b/Source/WebCore/css/StyleResolver.cpp >index 669681c..644d1fa 100644 >--- a/Source/WebCore/css/StyleResolver.cpp >+++ b/Source/WebCore/css/StyleResolver.cpp >@@ -3723,6 +3723,7 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value) > case CSSPropertyTabSize: > case CSSPropertyTableLayout: > case CSSPropertyTextAlign: >+ case CSSPropertyTextAlignLast: > case CSSPropertyTextDecoration: > case CSSPropertyTextIndent: > case CSSPropertyTextOverflow: >diff --git a/Source/WebCore/rendering/RenderBlockLineLayout.cpp b/Source/WebCore/rendering/RenderBlockLineLayout.cpp >index d61361b..1b8aa4f 100755 >--- a/Source/WebCore/rendering/RenderBlockLineLayout.cpp >+++ b/Source/WebCore/rendering/RenderBlockLineLayout.cpp >@@ -612,8 +612,18 @@ RootInlineBox* RenderBlock::constructLine(BidiRunList<BidiRun>& bidiRuns, const > ETextAlign RenderBlock::textAlignmentForLine(bool endsWithSoftBreak) const > { > ETextAlign alignment = style()->textAlign(); >- if (!endsWithSoftBreak && alignment == JUSTIFY) >- alignment = TASTART; >+ ETextAlign alignmentLast = style()->textAlignLast(); >+ >+ if (!endsWithSoftBreak) { >+ if (alignmentLast == TAAUTO) { >+ if (alignment == JUSTIFY) >+ alignmentLast = TASTART; >+ else >+ alignmentLast = alignment; >+ } >+ >+ return alignmentLast; >+ } > > return alignment; > } >@@ -865,6 +875,9 @@ void RenderBlock::updateLogicalWidthForAlignment(const ETextAlign& textAlign, Bi > else > updateLogicalWidthForLeftAlignedBlock(style()->isLeftToRightDirection(), trailingSpaceRun, logicalLeft, totalLogicalWidth, availableLogicalWidth); > break; >+ case TAAUTO: >+ ASSERT_NOT_REACHED(); >+ break; > } > } > >diff --git a/Source/WebCore/rendering/RenderBoxModelObject.cpp b/Source/WebCore/rendering/RenderBoxModelObject.cpp >index 3502f47..c3cd4f2 100644 >--- a/Source/WebCore/rendering/RenderBoxModelObject.cpp >+++ b/Source/WebCore/rendering/RenderBoxModelObject.cpp >@@ -2659,6 +2659,9 @@ LayoutRect RenderBoxModelObject::localCaretRectForEmptyElement(LayoutUnit width, > if (currentStyle->isLeftToRightDirection()) > alignment = alignRight; > break; >+ case TAAUTO: >+ ASSERT_NOT_REACHED(); >+ break; > } > > LayoutUnit x = borderLeft() + paddingLeft(); >diff --git a/Source/WebCore/rendering/RenderText.cpp b/Source/WebCore/rendering/RenderText.cpp >index d032812..cf50782 100644 >--- a/Source/WebCore/rendering/RenderText.cpp >+++ b/Source/WebCore/rendering/RenderText.cpp >@@ -702,6 +702,9 @@ LayoutRect RenderText::localCaretRect(InlineBox* inlineBox, int caretOffset, Lay > case TAEND: > rightAligned = cbStyle->isLeftToRightDirection(); > break; >+ case TAAUTO: >+ ASSERT_NOT_REACHED(); >+ break; > } > > if (rightAligned) { >diff --git a/Source/WebCore/rendering/style/RenderStyle.h b/Source/WebCore/rendering/style/RenderStyle.h >index e970947..da3c300 100644 >--- a/Source/WebCore/rendering/style/RenderStyle.h >+++ b/Source/WebCore/rendering/style/RenderStyle.h >@@ -234,6 +234,7 @@ protected: > && (_list_style_position == other._list_style_position) > && (_visibility == other._visibility) > && (_text_align == other._text_align) >+ && (m_textAlignLast == other.m_textAlignLast) > && (_text_transform == other._text_transform) > && (_text_decorations == other._text_decorations) > && (_cursor_style == other._cursor_style) >@@ -256,6 +257,7 @@ protected: > unsigned _list_style_position : 1; // EListStylePosition > unsigned _visibility : 2; // EVisibility > unsigned _text_align : 4; // ETextAlign >+ unsigned m_textAlignLast : 4; // ETextAlignLast > unsigned _text_transform : 2; // ETextTransform > unsigned _text_decorations : ETextDecorationBits; > unsigned _cursor_style : 6; // ECursor >@@ -351,6 +353,7 @@ protected: > inherited_flags._list_style_position = initialListStylePosition(); > inherited_flags._visibility = initialVisibility(); > inherited_flags._text_align = initialTextAlign(); >+ inherited_flags.m_textAlignLast = initialTextAlignLast(); > inherited_flags._text_transform = initialTextTransform(); > inherited_flags._text_decorations = initialTextDecoration(); > inherited_flags._cursor_style = initialCursor(); >@@ -614,6 +617,7 @@ public: > > Length textIndent() const { return rareInheritedData->indent; } > ETextAlign textAlign() const { return static_cast<ETextAlign>(inherited_flags._text_align); } >+ ETextAlign textAlignLast() const { return static_cast<ETextAlign>(inherited_flags.m_textAlignLast); } > ETextTransform textTransform() const { return static_cast<ETextTransform>(inherited_flags._text_transform); } > ETextDecoration textDecorationsInEffect() const { return static_cast<ETextDecoration>(inherited_flags._text_decorations); } > ETextDecoration textDecoration() const { return static_cast<ETextDecoration>(visual->textDecoration); } >@@ -1144,6 +1148,7 @@ public: > void setColor(const Color&); > void setTextIndent(Length v) { SET_VAR(rareInheritedData, indent, v) } > void setTextAlign(ETextAlign v) { inherited_flags._text_align = v; } >+ void setTextAlignLast(ETextAlign v) { inherited_flags.m_textAlignLast = v; } > void setTextTransform(ETextTransform v) { inherited_flags._text_transform = v; } > void addToTextDecorationsInEffect(ETextDecoration v) { inherited_flags._text_decorations |= v; } > void setTextDecorationsInEffect(ETextDecoration v) { inherited_flags._text_decorations = v; } >@@ -1606,6 +1611,7 @@ public: > static short initialOrphans() { return 2; } > static Length initialLineHeight() { return Length(-100.0, Percent); } > static ETextAlign initialTextAlign() { return TASTART; } >+ static ETextAlign initialTextAlignLast() { return TAAUTO; } > static ETextDecoration initialTextDecoration() { return TDNONE; } > #if ENABLE(CSS3_TEXT_DECORATION) > static TextDecorationStyle initialTextDecorationStyle() { return TextDecorationStyleSolid; } >diff --git a/Source/WebCore/rendering/style/RenderStyleConstants.h b/Source/WebCore/rendering/style/RenderStyleConstants.h >index 251f683..0ef645c 100644 >--- a/Source/WebCore/rendering/style/RenderStyleConstants.h >+++ b/Source/WebCore/rendering/style/RenderStyleConstants.h >@@ -326,7 +326,7 @@ enum EWhiteSpace { > > // The order of this enum must match the order of the text align values in CSSValueKeywords.in. > enum ETextAlign { >- LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND, >+ LEFT, RIGHT, CENTER, JUSTIFY, WEBKIT_LEFT, WEBKIT_RIGHT, WEBKIT_CENTER, TASTART, TAEND, TAAUTO > }; > > enum ETextTransform {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 76173
:
167707
|
167711
|
167738
|
168175
|
168363
|
168364
|
168699
|
168703
|
168824