Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: Source/core/css/resolver/StyleBuilderCustom.cpp

Issue 224723023: Implements hanging property for text-indent from CSS3 (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update description Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) 3 * Copyright (C) 1999 Lars Knoll (knoll@kde.org)
4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) 4 * (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com)
5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) 5 * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com)
6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 6 * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> 7 * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> 8 * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org>
9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/) 9 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t orchmobile.com/)
10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved. 10 * Copyright (c) 2011, Code Aurora Forum. All rights reserved.
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 CSSValue* item = i.value(); 544 CSSValue* item = i.value();
545 t |= *toCSSPrimitiveValue(item); 545 t |= *toCSSPrimitiveValue(item);
546 } 546 }
547 state.style()->setTextDecoration(t); 547 state.style()->setTextDecoration(t);
548 } 548 }
549 549
550 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState & state) 550 void StyleBuilderFunctions::applyInheritCSSPropertyTextIndent(StyleResolverState & state)
551 { 551 {
552 state.style()->setTextIndent(state.parentStyle()->textIndent()); 552 state.style()->setTextIndent(state.parentStyle()->textIndent());
553 state.style()->setTextIndentLine(state.parentStyle()->textIndentLine()); 553 state.style()->setTextIndentLine(state.parentStyle()->textIndentLine());
554 state.style()->setTextIndentType(state.parentStyle()->textIndentType());
554 } 555 }
555 556
556 void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolverState & state) 557 void StyleBuilderFunctions::applyInitialCSSPropertyTextIndent(StyleResolverState & state)
557 { 558 {
558 state.style()->setTextIndent(RenderStyle::initialTextIndent()); 559 state.style()->setTextIndent(RenderStyle::initialTextIndent());
559 state.style()->setTextIndentLine(RenderStyle::initialTextIndentLine()); 560 state.style()->setTextIndentLine(RenderStyle::initialTextIndentLine());
561 state.style()->setTextIndentType(RenderStyle::initialTextIndentType());
560 } 562 }
561 563
562 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState& state, CSSValue* value) 564 void StyleBuilderFunctions::applyValueCSSPropertyTextIndent(StyleResolverState& state, CSSValue* value)
563 { 565 {
564 if (!value->isValueList()) 566 if (!value->isValueList())
565 return; 567 return;
566 568
567 // [ <length> | <percentage> ] each-line 569 Length lengthOrPercentageValue;
568 // The order is guaranteed. See BisonCSSParser::parseTextIndent. 570 TextIndentLine textIndentLineValue = RenderStyle::initialTextIndentLine();
569 // The second value, each-line is handled only when css3TextEnabled() return s true. 571 TextIndentType textIndentTypeValue = RenderStyle::initialTextIndentType();
570 572
571 CSSValueList* valueList = toCSSValueList(value); 573 for (CSSValueListIterator i(value); i.hasMore(); i.advance()) {
572 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(valueList->itemWitho utBoundsCheck(0)); 574 CSSPrimitiveValue* primitiveValue = toCSSPrimitiveValue(i.value());
573 Length lengthOrPercentageValue = primitiveValue->convertToLength<FixedConver sion | PercentConversion>(state.cssToLengthConversionData()); 575 if (!primitiveValue->getValueID())
576 lengthOrPercentageValue = primitiveValue->convertToLength<FixedConve rsion | PercentConversion>(state.cssToLengthConversionData());
577 else if (primitiveValue->getValueID() == CSSValueEachLine)
578 textIndentLineValue = TextIndentEachLine;
579 else if (primitiveValue->getValueID() == CSSValueHanging)
580 textIndentTypeValue = TextIndentHanging;
581 else
582 ASSERT_NOT_REACHED();
583 }
584
574 state.style()->setTextIndent(lengthOrPercentageValue); 585 state.style()->setTextIndent(lengthOrPercentageValue);
575 586 state.style()->setTextIndentLine(textIndentLineValue);
576 ASSERT(valueList->length() <= 2); 587 state.style()->setTextIndentType(textIndentTypeValue);
577 CSSPrimitiveValue* eachLineValue = toCSSPrimitiveValue(valueList->item(1));
578 if (eachLineValue) {
579 ASSERT(eachLineValue->getValueID() == CSSValueEachLine);
580 state.style()->setTextIndentLine(TextIndentEachLine);
581 } else
582 state.style()->setTextIndentLine(TextIndentFirstLine);
583 } 588 }
584 589
585 void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolver State& state) 590 void StyleBuilderFunctions::applyInitialCSSPropertyTransformOrigin(StyleResolver State& state)
586 { 591 {
587 applyInitialCSSPropertyWebkitTransformOriginX(state); 592 applyInitialCSSPropertyWebkitTransformOriginX(state);
588 applyInitialCSSPropertyWebkitTransformOriginY(state); 593 applyInitialCSSPropertyWebkitTransformOriginY(state);
589 applyInitialCSSPropertyWebkitTransformOriginZ(state); 594 applyInitialCSSPropertyWebkitTransformOriginZ(state);
590 } 595 }
591 596
592 void StyleBuilderFunctions::applyInheritCSSPropertyTransformOrigin(StyleResolver State& state) 597 void StyleBuilderFunctions::applyInheritCSSPropertyTransformOrigin(StyleResolver State& state)
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
2290 break; 2295 break;
2291 } 2296 }
2292 case CSSPropertyEnableBackground: 2297 case CSSPropertyEnableBackground:
2293 // Silently ignoring this property for now 2298 // Silently ignoring this property for now
2294 // http://bugs.webkit.org/show_bug.cgi?id=6022 2299 // http://bugs.webkit.org/show_bug.cgi?id=6022
2295 break; 2300 break;
2296 } 2301 }
2297 } 2302 }
2298 2303
2299 } // namespace WebCore 2304 } // namespace WebCore
OLDNEW
« no previous file with comments | « Source/core/css/parser/CSSPropertyParser.cpp ('k') | Source/core/rendering/line/BreakingContextInlineHeaders.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698