Changeset 130616 in webkit
- Timestamp:
- Oct 7, 2012 9:42:26 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r130610 r130616 1 2012-10-07 Arpita Bahuguna <arpitabahuguna@gmail.com> 2 3 :first-line pseudo selector ignoring words created from :before 4 https://bugs.webkit.org/show_bug.cgi?id=80794 5 6 Reviewed by Daniel Bates. 7 8 * fast/css/first-line-style-for-before-after-content-expected.html: Added. 9 * fast/css/first-line-style-for-before-after-content.html: Added. 10 Added ref test for verification of the scenario when :first-line style 11 is applied to content generated from :before/:after pseudo-elements. 12 1 13 2012-10-07 Nick Carter <nick@chromium.org> 2 14 -
trunk/Source/WebCore/ChangeLog
r130615 r130616 1 2012-10-07 Arpita Bahuguna <arpitabahuguna@gmail.com> 2 3 :first-line pseudo selector ignoring words created from :before 4 https://bugs.webkit.org/show_bug.cgi?id=80794 5 6 Reviewed by Daniel Bates. 7 8 The :first-line pseudo-element style is not applied for content 9 which is generated from the :before/:after pseudo-elements. 10 11 Test: fast/css/first-line-style-for-before-after-content.html 12 13 * rendering/RenderObject.cpp: 14 (WebCore::firstLineStyleForCachedUncachedType): 15 Added a new static helper function incorporating the common 16 functionality of both uncachedFirstLineStyle() and firstLineStyleSlowCase() 17 functions. It also modifies the functionality to handle the 18 scenario when :first-line style needs to be applied on content 19 generated from :before/:after. 20 21 While getting the :first-line style we should also consider the case 22 when the content is generated from a :before/:after pseudo-element in 23 which case the RenderInline's parent should be considered for 24 obtaining the first-line style. 25 26 (WebCore): 27 (WebCore::RenderObject::uncachedFirstLineStyle): 28 (WebCore::RenderObject::firstLineStyleSlowCase): 29 Moved the duplicate code between the two functions to the common 30 helper function firstLineStyleForCachedUncachedType(). 31 1 32 2012-10-07 Peter Wang <peter.wang@torchmobile.com.cn> 2 33 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r130573 r130616 2603 2603 } 2604 2604 2605 enum StyleCacheState { 2606 Cached, 2607 Uncached 2608 }; 2609 2610 static PassRefPtr<RenderStyle> firstLineStyleForCachedUncachedType(StyleCacheState type, const RenderObject* renderer, RenderStyle* style) 2611 { 2612 const RenderObject* rendererForFirstLineStyle = renderer; 2613 if (renderer->isBeforeOrAfterContent()) 2614 rendererForFirstLineStyle = renderer->parent(); 2615 2616 if (rendererForFirstLineStyle->isBlockFlow()) { 2617 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBlock()) { 2618 if (type == Cached) 2619 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); 2620 return firstLineBlock->getUncachedPseudoStyle(FIRST_LINE, style, firstLineBlock == renderer ? style : 0); 2621 } 2622 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLineStyle->isRenderInline()) { 2623 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLineStyle(); 2624 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { 2625 if (type == Cached) { 2626 // A first-line style is in effect. Cache a first-line style for ourselves. 2627 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE_INHERITED); 2628 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle); 2629 } 2630 return rendererForFirstLineStyle->getUncachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle, style); 2631 } 2632 } 2633 return 0; 2634 } 2635 2605 2636 PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style) const 2606 2637 { … … 2610 2641 ASSERT(!isText()); 2611 2642 2612 RefPtr<RenderStyle> result; 2613 2614 if (isBlockFlow()) { 2615 if (RenderBlock* firstLineBlock = this->firstLineBlock()) 2616 result = firstLineBlock->getUncachedPseudoStyle(FIRST_LINE, style, firstLineBlock == this ? style : 0); 2617 } else if (!isAnonymous() && isRenderInline()) { 2618 RenderStyle* parentStyle = parent()->firstLineStyle(); 2619 if (parentStyle != parent()->style()) 2620 result = getUncachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle, style); 2621 } 2622 2623 return result.release(); 2643 return firstLineStyleForCachedUncachedType(Uncached, this, style); 2624 2644 } 2625 2645 … … 2628 2648 ASSERT(document()->styleSheetCollection()->usesFirstLineRules()); 2629 2649 2630 RenderStyle* style = m_style.get(); 2631 const RenderObject* renderer = isText() ? parent() : this; 2632 if (renderer->isBlockFlow()) { 2633 if (RenderBlock* firstLineBlock = renderer->firstLineBlock()) 2634 style = firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style); 2635 } else if (!renderer->isAnonymous() && renderer->isRenderInline()) { 2636 RenderStyle* parentStyle = renderer->parent()->firstLineStyle(); 2637 if (parentStyle != renderer->parent()->style()) { 2638 // A first-line style is in effect. Cache a first-line style for ourselves. 2639 renderer->style()->setHasPseudoStyle(FIRST_LINE_INHERITED); 2640 style = renderer->getCachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle); 2641 } 2642 } 2643 2644 return style; 2650 if (RefPtr<RenderStyle> style = firstLineStyleForCachedUncachedType(Cached, isText() ? parent() : this, m_style.get())) 2651 return style.get(); 2652 2653 return m_style.get(); 2645 2654 } 2646 2655
Note: See TracChangeset
for help on using the changeset viewer.