Changeset 102234 in webkit
- Timestamp:
- Dec 7, 2011 6:51:33 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r102231 r102234 1 2011-12-07 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSSRegions]Add support for background-color in region styling 4 https://bugs.webkit.org/show_bug.cgi?id=71488 5 6 Reviewed by David Hyatt. 7 8 * fast/regions/region-style-block-background-color.html: Added. 9 * fast/regions/region-style-block-background-color2.html: Added. 10 * fast/regions/region-style-image-background-color.html: Added. 11 * fast/regions/region-style-inline-background-color.html: Added. 12 * fast/regions/resources/transparent.png: Added. 13 * platform/mac-snowleopard/fast/regions/region-style-block-background-color-expected.png: Added. 14 * platform/mac-snowleopard/fast/regions/region-style-block-background-color-expected.txt: Added. 15 * platform/mac-snowleopard/fast/regions/region-style-block-background-color2-expected.png: Added. 16 * platform/mac-snowleopard/fast/regions/region-style-block-background-color2-expected.txt: Added. 17 * platform/mac-snowleopard/fast/regions/region-style-image-background-color-expected.png: Added. 18 * platform/mac-snowleopard/fast/regions/region-style-image-background-color-expected.txt: Added. 19 * platform/mac-snowleopard/fast/regions/region-style-inline-background-color-expected.png: Added. 20 * platform/mac-snowleopard/fast/regions/region-style-inline-background-color-expected.txt: Added. 21 1 22 2011-12-07 Shinya Kawanaka <shinyak@google.com> 2 23 -
trunk/Source/WebCore/ChangeLog
r102233 r102234 1 2011-12-07 Mihnea Ovidenie <mihnea@adobe.com> 2 3 [CSSRegions]Add support for background-color in region styling 4 https://bugs.webkit.org/show_bug.cgi?id=71488 5 6 Reviewed by David Hyatt. 7 8 Tests: fast/regions/region-style-block-background-color.html 9 fast/regions/region-style-block-background-color2.html 10 fast/regions/region-style-image-background-color.html 11 fast/regions/region-style-inline-background-color.html 12 13 * WebCore.exp.in: 14 * css/CSSStyleSelector.cpp: 15 (WebCore::RuleData::regionStyleRule): 16 (WebCore::CSSStyleSelector::CSSStyleSelector): 17 (WebCore::CSSStyleSelector::addMatchedDeclaration): 18 (WebCore::CSSStyleSelector::matchRules): 19 (WebCore::CSSStyleSelector::matchAllRules): 20 (WebCore::CSSStyleSelector::initForRegionStyling): 21 (WebCore::CSSStyleSelector::styleForElement): 22 (WebCore::CSSStyleSelector::pseudoStyleForElement): 23 (WebCore::RuleData::RuleData): 24 (WebCore::RuleSet::RuleSet): 25 (WebCore::RuleSet::addToRuleSet): 26 (WebCore::CSSStyleSelector::applyDeclarations): 27 (WebCore::isValidRegionStyleProperty): 28 (WebCore::CSSStyleSelector::applyProperty): 29 * css/CSSStyleSelector.h: 30 (WebCore::CSSStyleSelector::setRegionForStyling): 31 (WebCore::CSSStyleSelector::regionForStyling): 32 (WebCore::CSSStyleSelector::applyPropertyToRegionStyle): 33 * rendering/RenderFlowThread.cpp: 34 (WebCore::RenderFlowThread::clearRenderRegionRangeMap): 35 (WebCore::RenderFlowThread::~RenderFlowThread): 36 (WebCore::RenderFlowThread::layout): 37 (WebCore::RenderFlowThread::clearRenderObjectCustomStyle): 38 (WebCore::RenderFlowThread::setRegionRangeForBox): 39 * rendering/RenderFlowThread.h: 40 * rendering/RenderLayer.cpp: 41 (WebCore::CurrentRenderRegionMaintainer::CurrentRenderRegionMaintainer): 42 (WebCore::CurrentRenderRegionMaintainer::~CurrentRenderRegionMaintainer): 43 (WebCore::RenderLayer::paint): 44 (WebCore::RenderLayer::hitTest): 45 * rendering/RenderObject.cpp: 46 (WebCore::RenderObject::style): 47 * rendering/RenderObject.h: 48 (WebCore::RenderObject::canHaveRegionStyle): 49 * rendering/RenderObjectChildList.cpp: 50 (WebCore::RenderObjectChildList::removeChildNode): 51 * rendering/RenderRegion.cpp: 52 (WebCore::RenderRegion::layout): 53 (WebCore::RenderRegion::renderObjectRegionStyle): 54 (WebCore::RenderRegion::computeStyleInRegion): 55 (WebCore::RenderRegion::clearObjectStyleInRegion): 56 * rendering/RenderRegion.h: 57 * rendering/RenderView.cpp: 58 (WebCore::RenderView::RenderView): 59 * rendering/RenderView.h: 60 (WebCore::RenderView::currentRenderRegion): 61 (WebCore::RenderView::setCurrentRenderRegion): 62 1 63 2011-12-01 Vsevolod Vlasov <vsevik@chromium.org> 2 64 -
trunk/Source/WebCore/WebCore.exp.in
r102205 r102234 1181 1181 __ZNK7WebCore12RenderObject15localToAbsoluteERKNS_10FloatPointEbb 1182 1182 __ZNK7WebCore12RenderObject7childAtEj 1183 __ZNK7WebCore12RenderObject5styleEv 1183 1184 __ZNK7WebCore12RenderWidget14windowClipRectEv 1184 1185 __ZNK7WebCore12SharedBuffer11getSomeDataERPKcj -
trunk/Source/WebCore/css/CSSStyleSelector.cpp
r102188 r102234 81 81 #include "QuotesData.h" 82 82 #include "Rect.h" 83 #include "RenderRegion.h" 83 84 #include "RenderScrollbar.h" 84 85 #include "RenderScrollbarTheme.h" … … 168 169 class RuleData { 169 170 public: 170 RuleData(CSSStyleRule*, CSSSelector*, unsigned position );171 RuleData(CSSStyleRule*, CSSSelector*, unsigned position, bool regionStyleRule = false); 171 172 172 173 unsigned position() const { return m_position; } … … 180 181 unsigned specificity() const { return m_specificity; } 181 182 unsigned linkMatchType() const { return m_linkMatchType; } 183 bool regionStyleRule() const { return m_regionStyleRule; } 182 184 183 185 // Try to balance between memory usage (there can be lots of RuleData objects) and good filtering performance. … … 195 197 bool m_containsUncommonAttributeSelector : 1; 196 198 unsigned m_linkMatchType : 2; // SelectorChecker::LinkMatchMask 199 bool m_regionStyleRule : 1; 197 200 // Use plain array instead of a Vector to minimize memory overhead. 198 201 unsigned m_descendantSelectorIdentifierHashes[maximumIdentifierCount]; … … 202 205 WTF_MAKE_NONCOPYABLE(RuleSet); 203 206 public: 204 RuleSet( );207 RuleSet(bool regionStyleRules = false); 205 208 206 209 typedef HashMap<AtomicStringImpl*, OwnPtr<Vector<RuleData> > > AtomRuleMap; … … 237 240 unsigned m_ruleCount; 238 241 bool m_autoShrinkToFitEnabled; 242 bool m_regionStyleRules; 239 243 }; 240 244 … … 323 327 , m_element(0) 324 328 , m_styledElement(0) 329 , m_regionForStyling(0) 325 330 , m_elementLinkState(NotInsideLink) 326 331 , m_parentNode(0) … … 332 337 , m_applyPropertyToRegularStyle(true) 333 338 , m_applyPropertyToVisitedLinkStyle(false) 339 , m_applyPropertyToRegionStyle(false) 334 340 , m_applyProperty(CSSStyleApplyProperty::sharedCSSStyleApplyProperty()) 335 341 #if ENABLE(CSS_SHADERS) … … 586 592 } 587 593 588 void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType )594 void CSSStyleSelector::addMatchedDeclaration(CSSMutableStyleDeclaration* styleDeclaration, unsigned linkMatchType, bool regionStyleRule) 589 595 { 590 596 m_matchedDecls.grow(m_matchedDecls.size() + 1); … … 592 598 newDeclaration.styleDeclaration = styleDeclaration; 593 599 newDeclaration.linkMatchType = linkMatchType; 600 newDeclaration.regionStyleRule = regionStyleRule; 594 601 } 595 602 … … 641 648 if (swapVisitedUnvisited && linkMatchType && linkMatchType != SelectorChecker::MatchAll) 642 649 linkMatchType = (linkMatchType == SelectorChecker::MatchVisited) ? SelectorChecker::MatchLink : SelectorChecker::MatchVisited; 643 addMatchedDeclaration(m_matchedRules[i]->rule()->declaration(), linkMatchType );650 addMatchedDeclaration(m_matchedRules[i]->rule()->declaration(), linkMatchType, m_matchedRules[i]->regionStyleRule()); 644 651 } 645 652 } else { … … 794 801 if (m_matchAuthorAndUserStyles) 795 802 matchRules(m_authorStyle.get(), result.firstAuthorRule, result.lastAuthorRule, false); 796 803 804 if (m_regionForStyling) 805 matchRules(m_regionRules.get(), result.firstAuthorRule, result.lastAuthorRule, false); 806 797 807 // Now check our inline style attribute. 798 808 if (m_matchAuthorAndUserStyles && m_styledElement) { … … 845 855 846 856 m_fontDirty = false; 857 } 858 859 void CSSStyleSelector::initForRegionStyling(RenderRegion* region) 860 { 861 setRegionForStyling(region); 862 // Mark that the set of rules comes from region styling since we need to filter 863 // the properties that can be applied. 864 m_regionRules = adoptPtr(new RuleSet(true)); 865 866 if (!region) 867 return; 868 869 // From all the region style rules, select those that apply to the specified region. 870 for (Vector<RefPtr<WebKitCSSRegionRule> >::iterator it = m_regionStyleRules.begin(); it != m_regionStyleRules.end(); ++it) { 871 const CSSSelectorList& regionSelectorList = (*it)->selectorList(); 872 for (CSSSelector* s = regionSelectorList.first(); s; s = regionSelectorList.next(s)) { 873 if (!m_checker.checkSelector(s, static_cast<Element*>(region->node()))) 874 continue; 875 CSSRuleList* regionStylingRules = (*it)->cssRules(); 876 for (unsigned index = 0; index < regionStylingRules->length(); ++index) { 877 CSSRule* regionStylingRule = regionStylingRules->item(index); 878 if (regionStylingRule->isStyleRule()) 879 m_regionRules->addStyleRule(static_cast<CSSStyleRule*>(regionStylingRule)); 880 } 881 } 882 } 847 883 } 848 884 … … 1201 1237 // relative units are interpreted according to document root element style, styled only with UA stylesheet 1202 1238 1203 PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* element, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault )1239 PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* element, RenderStyle* defaultParent, bool allowSharing, bool resolveForRootDefault, RenderRegion* regionForStyling) 1204 1240 { 1205 1241 // Once an element has a renderer, we don't try to destroy it, since otherwise the renderer … … 1217 1253 initElement(element); 1218 1254 initForStyleResolve(element, defaultParent); 1255 initForRegionStyling(regionForStyling); 1219 1256 if (allowSharing) { 1220 1257 RenderStyle* sharedStyle = locateSharedStyle(); … … 1372 1409 } 1373 1410 1374 PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle )1411 PassRefPtr<RenderStyle> CSSStyleSelector::pseudoStyleForElement(PseudoId pseudo, Element* e, RenderStyle* parentStyle, RenderRegion* regionForStyling) 1375 1412 { 1376 1413 if (!e) … … 1380 1417 1381 1418 initForStyleResolve(e, parentStyle, pseudo); 1419 initForRegionStyling(regionForStyling); 1382 1420 m_style = RenderStyle::create(); 1383 1421 … … 1836 1874 } 1837 1875 1838 RuleData::RuleData(CSSStyleRule* rule, CSSSelector* selector, unsigned position )1876 RuleData::RuleData(CSSStyleRule* rule, CSSSelector* selector, unsigned position, bool regionStyleRule) 1839 1877 : m_rule(rule) 1840 1878 , m_selector(selector) … … 1846 1884 , m_containsUncommonAttributeSelector(WebCore::containsUncommonAttributeSelector(selector)) 1847 1885 , m_linkMatchType(SelectorChecker::determineLinkMatchType(selector)) 1886 , m_regionStyleRule(regionStyleRule) 1848 1887 { 1849 1888 SelectorChecker::collectIdentifierHashes(m_selector, m_descendantSelectorIdentifierHashes, maximumIdentifierCount); 1850 1889 } 1851 1890 1852 RuleSet::RuleSet( )1891 RuleSet::RuleSet(bool regionStyleRules) 1853 1892 : m_ruleCount(0) 1854 1893 , m_autoShrinkToFitEnabled(true) 1894 , m_regionStyleRules(regionStyleRules) 1855 1895 { 1856 1896 } … … 1863 1903 if (!rules) 1864 1904 rules = adoptPtr(new Vector<RuleData>); 1865 rules->append(RuleData(rule, selector, m_ruleCount++ ));1905 rules->append(RuleData(rule, selector, m_ruleCount++, m_regionStyleRules)); 1866 1906 } 1867 1907 … … 2166 2206 return; 2167 2207 } 2168 for (int i = startIndex; i <= endIndex; ++i) 2208 for (int i = startIndex; i <= endIndex; ++i) { 2209 m_applyPropertyToRegionStyle = m_matchedDecls[i].regionStyleRule; 2169 2210 applyDeclaration<applyFirst>(m_matchedDecls[i].styleDeclaration, isImportant, inheritedOnly); 2211 m_applyPropertyToRegionStyle = false; 2212 } 2170 2213 } 2171 2214 … … 2447 2490 } 2448 2491 2492 // http://dev.w3.org/csswg/css3-regions/#the-at-region-style-rule 2493 // FIXME: add incremental support for other region styling properties. 2494 inline bool isValidRegionStyleProperty(int id) 2495 { 2496 switch (static_cast<CSSPropertyID>(id)) { 2497 case CSSPropertyBackgroundColor: 2498 return true; 2499 default: 2500 break; 2501 } 2502 2503 return false; 2504 } 2505 2449 2506 class SVGDisplayPropertyGuard { 2450 2507 WTF_MAKE_NONCOPYABLE(SVGDisplayPropertyGuard); … … 2573 2630 return; 2574 2631 } 2632 2633 // Filter region style property 2634 if (applyPropertyToRegionStyle() && !isValidRegionStyleProperty(id)) 2635 return; 2575 2636 2576 2637 CSSPropertyID property = static_cast<CSSPropertyID>(id); -
trunk/Source/WebCore/css/CSSStyleSelector.h
r102188 r102234 64 64 class MediaQueryEvaluator; 65 65 class Node; 66 class RenderRegion; 66 67 class RuleData; 67 68 class RuleSet; … … 105 106 void popParent(Element* parent) { m_checker.popParent(parent); } 106 107 107 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false );108 PassRefPtr<RenderStyle> styleForElement(Element*, RenderStyle* parentStyle = 0, bool allowSharing = true, bool resolveForRootDefault = false, RenderRegion* regionForStyling = 0); 108 109 109 110 void keyframeStylesForAnimation(Element*, const RenderStyle*, KeyframeList&); 110 111 111 PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0 );112 PassRefPtr<RenderStyle> pseudoStyleForElement(PseudoId, Element*, RenderStyle* parentStyle = 0, RenderRegion* regionForStyling = 0); 112 113 113 114 PassRefPtr<RenderStyle> styleForPage(int pageIndex); … … 130 131 void initForStyleResolve(Element*, RenderStyle* parentStyle = 0, PseudoId = NOPSEUDO); 131 132 void initElement(Element*); 133 void initForRegionStyling(RenderRegion*); 132 134 RenderStyle* locateSharedStyle(); 133 135 bool matchesRuleSet(RuleSet*); … … 137 139 138 140 PassRefPtr<RenderStyle> styleForKeyframe(const RenderStyle*, const WebKitCSSKeyframeRule*, KeyframeValue&); 141 142 void setRegionForStyling(RenderRegion* region) { m_regionForStyling = region; } 143 RenderRegion* regionForStyling() const { return m_regionForStyling; } 139 144 140 145 public: … … 245 250 246 251 void addMatchedRule(const RuleData* rule) { m_matchedRules.append(rule); } 247 void addMatchedDeclaration(CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll );252 void addMatchedDeclaration(CSSMutableStyleDeclaration*, unsigned linkMatchType = SelectorChecker::MatchAll, bool regionStyleRule = false); 248 253 249 254 struct MatchResult { … … 281 286 OwnPtr<RuleSet> m_authorStyle; 282 287 OwnPtr<RuleSet> m_userStyle; 288 OwnPtr<RuleSet> m_regionRules; 283 289 284 290 Features m_features; … … 304 310 bool applyPropertyToRegularStyle() const { return m_applyPropertyToRegularStyle; } 305 311 bool applyPropertyToVisitedLinkStyle() const { return m_applyPropertyToVisitedLinkStyle; } 312 bool applyPropertyToRegionStyle() const { return m_applyPropertyToRegionStyle; } 306 313 307 314 private: … … 351 358 CSSMutableStyleDeclaration* styleDeclaration; 352 359 unsigned linkMatchType; 360 bool regionStyleRule; 353 361 }; 354 362 static unsigned computeDeclarationHash(MatchedStyleDeclaration*, unsigned size); … … 391 399 Element* m_element; 392 400 StyledElement* m_styledElement; 401 RenderRegion* m_regionForStyling; 393 402 EInsideLink m_elementLinkState; 394 403 ContainerNode* m_parentNode; … … 403 412 bool m_applyPropertyToRegularStyle; 404 413 bool m_applyPropertyToVisitedLinkStyle; 414 bool m_applyPropertyToRegionStyle; 405 415 const CSSStyleApplyProperty& m_applyProperty; 406 416 -
trunk/Source/WebCore/rendering/RenderFlowThread.cpp
r99467 r102234 56 56 } 57 57 58 RenderFlowThread::~RenderFlowThread()58 void RenderFlowThread::clearRenderRegionRangeMap() 59 59 { 60 60 deleteAllValues(m_regionRangeMap); 61 61 m_regionRangeMap.clear(); 62 } 63 64 RenderFlowThread::~RenderFlowThread() 65 { 66 clearRenderRegionRangeMap(); 62 67 } 63 68 … … 311 316 m_regionsHaveUniformLogicalWidth = true; 312 317 m_regionsHaveUniformLogicalHeight = true; 313 deleteAllValues(m_regionRangeMap); 314 m_regionRangeMap.clear(); 318 clearRenderRegionRangeMap(); 315 319 LayoutUnit previousRegionLogicalWidth = 0; 316 320 LayoutUnit previousRegionLogicalHeight = 0; … … 741 745 } 742 746 747 void RenderFlowThread::clearRenderObjectCustomStyle(const RenderObject* object, 748 const RenderRegion* oldStartRegion, const RenderRegion* oldEndRegion, 749 const RenderRegion* newStartRegion, const RenderRegion* newEndRegion) 750 { 751 // Clear the styles for the object in the regions. 752 // The styles are not cleared for the regions that are contained in both ranges. 753 bool insideOldRegionRange = false; 754 bool insideNewRegionRange = false; 755 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { 756 RenderRegion* region = *iter; 757 758 if (oldStartRegion == region) 759 insideOldRegionRange = true; 760 if (newStartRegion == region) 761 insideNewRegionRange = true; 762 763 if (!(insideOldRegionRange && insideNewRegionRange)) 764 region->clearObjectStyleInRegion(object); 765 766 if (oldEndRegion == region) 767 insideOldRegionRange = false; 768 if (newEndRegion == region) 769 insideNewRegionRange = false; 770 } 771 } 772 743 773 void RenderFlowThread::setRegionRangeForBox(const RenderBox* box, LayoutUnit offsetFromLogicalTopOfFirstPage) 744 774 { … … 752 782 return; 753 783 784 RenderRegion* oldStartRegion = range->startRegion(); 785 RenderRegion* oldEndRegion = range->endRegion(); 754 786 // Delete any info that we find before our new startRegion and after our new endRegion. 755 787 for (RenderRegionList::iterator iter = m_regionList.begin(); iter != m_regionList.end(); ++iter) { … … 759 791 continue; 760 792 } 761 793 762 794 region->removeRenderBoxRegionInfo(box); 763 795 … … 765 797 break; 766 798 } 767 799 768 800 range->setRange(startRegion, endRegion); 801 clearRenderObjectCustomStyle(box, oldStartRegion, oldEndRegion, startRegion, endRegion); 769 802 return; 770 803 } -
trunk/Source/WebCore/rendering/RenderFlowThread.h
r96975 r102234 122 122 void getRegionRangeForBox(const RenderBox*, RenderRegion*& startRegion, RenderRegion*& endRegion) const; 123 123 124 void clearRenderObjectCustomStyle(const RenderObject*, 125 const RenderRegion* oldStartRegion = 0, const RenderRegion* oldEndRegion = 0, 126 const RenderRegion* newStartRegion = 0, const RenderRegion* newEndRegion = 0); 127 124 128 private: 125 129 virtual const char* renderName() const { return "RenderFlowThread"; } … … 131 135 132 136 bool shouldRepaint(const LayoutRect&) const; 137 138 void clearRenderRegionRangeMap(); 133 139 134 140 typedef ListHashSet<RenderObject*> FlowThreadChildList; -
trunk/Source/WebCore/rendering/RenderLayer.cpp
r102217 r102234 2558 2558 } 2559 2559 2560 class CurrentRenderRegionMaintainer { 2561 WTF_MAKE_NONCOPYABLE(CurrentRenderRegionMaintainer); 2562 public: 2563 CurrentRenderRegionMaintainer(RenderView* view, RenderRegion* renderRegion) 2564 : m_view(view) 2565 , m_renderRegion(view->currentRenderRegion()) 2566 { 2567 m_view->setCurrentRenderRegion(renderRegion); 2568 } 2569 ~CurrentRenderRegionMaintainer() 2570 { 2571 m_view->setCurrentRenderRegion(m_renderRegion); 2572 } 2573 private: 2574 RenderView* m_view; 2575 RenderRegion* m_renderRegion; 2576 }; 2577 2560 2578 void RenderLayer::paint(GraphicsContext* p, const LayoutRect& damageRect, PaintBehavior paintBehavior, RenderObject *paintingRoot, 2561 2579 RenderRegion* region, PaintLayerFlags paintFlags) 2562 2580 { 2581 CurrentRenderRegionMaintainer renderRegionMaintainer(renderer()->view(), region); 2563 2582 OverlapTestRequestMap overlapTestRequests; 2564 2583 paintLayer(this, p, damageRect, paintBehavior, paintingRoot, region, &overlapTestRequests, paintFlags); … … 3063 3082 bool RenderLayer::hitTest(const HitTestRequest& request, HitTestResult& result) 3064 3083 { 3084 CurrentRenderRegionMaintainer renderRegionMaintainer(renderer()->view(), result.region()); 3065 3085 renderer()->document()->updateLayout(); 3066 3086 -
trunk/Source/WebCore/rendering/RenderObject.cpp
r102185 r102234 1724 1724 } 1725 1725 1726 RenderStyle* RenderObject::style() const 1727 { 1728 if (!inRenderFlowThread() 1729 || !canHaveRegionStyle() 1730 || !((view() && view()->currentRenderRegion() && view()->currentRenderRegion()->hasCustomRegionStyle()))) 1731 return m_style.get(); 1732 1733 RenderStyle* regionStyle = view()->currentRenderRegion()->renderObjectRegionStyle(this); 1734 if (!regionStyle) 1735 view()->currentRenderRegion()->computeStyleInRegion(this); 1736 return view()->currentRenderRegion()->renderObjectRegionStyle(this); 1737 } 1738 1726 1739 void RenderObject::setStyle(PassRefPtr<RenderStyle> style) 1727 1740 { -
trunk/Source/WebCore/rendering/RenderObject.h
r102185 r102234 343 343 virtual bool isRenderFlowThread() const { return false; } 344 344 345 bool canHaveRegionStyle() const { return isRenderBlock() && !isAnonymous() && !isRenderFlowThread(); } 346 345 347 bool isRoot() const { return document()->documentElement() == m_node; } 346 348 bool isBody() const; … … 658 660 virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; } 659 661 660 RenderStyle* style() const { return m_style.get(); }662 RenderStyle* style() const; 661 663 RenderStyle* firstLineStyle() const { return document()->usesFirstLineRules() ? firstLineStyleSlowCase() : style(); } 662 664 RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); } -
trunk/Source/WebCore/rendering/RenderObjectChildList.cpp
r100630 r102234 115 115 toRenderRegion(oldChild)->detachRegion(); 116 116 117 if (oldChild->inRenderFlowThread() && oldChild->isBox()) 117 if (oldChild->inRenderFlowThread() && oldChild->isBox()) { 118 118 oldChild->enclosingRenderFlowThread()->removeRenderBoxRegionInfo(toRenderBox(oldChild)); 119 if (oldChild->canHaveRegionStyle()) 120 oldChild->enclosingRenderFlowThread()->clearRenderObjectCustomStyle(oldChild); 121 } 119 122 120 123 if (RenderFlowThread* containerFlowThread = renderFlowThreadContainer(owner)) -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r99467 r102234 148 148 m_flowThread->invalidateRegions(); 149 149 } 150 150 151 151 // FIXME: We need to find a way to set up overflow properly. Our flow thread hasn't gotten a layout 152 152 // yet, so we can't look to it for correct information. It's possible we could wait until after the RenderFlowThread … … 243 243 } 244 244 245 RenderStyle* RenderRegion::renderObjectRegionStyle(const RenderObject* renderObject) const 246 { 247 RenderObjectRegionStyleMap::const_iterator it = m_renderObjectRegionStyle.find(renderObject); 248 return (it != m_renderObjectRegionStyle.end()) ? it->second.get() : 0; 249 } 250 251 void RenderRegion::computeStyleInRegion(const RenderObject* object) 252 { 253 ASSERT(object); 254 ASSERT(object->view()); 255 ASSERT(object->view()->document()); 256 ASSERT(!object->isAnonymous()); 257 ASSERT(object->node() && object->node()->isElementNode()); 258 259 Element* element = toElement(object->node()); 260 RefPtr<RenderStyle> renderObjectStyle = object->view()->document()->styleSelector()->styleForElement(element, 0, false, false, this); 261 m_renderObjectRegionStyle.set(object, renderObjectStyle); 262 263 if (!object->hasBoxDecorations()) { 264 RenderBox* box = const_cast<RenderBox*>(toRenderBox(object)); 265 RenderStyle* styleInRegion = renderObjectRegionStyle(object); 266 ASSERT(styleInRegion); 267 268 bool hasBoxDecorations = object->isTableCell() || styleInRegion->hasBackground() || styleInRegion->hasBorder() || styleInRegion->hasAppearance() || styleInRegion->boxShadow(); 269 box->setHasBoxDecorations(hasBoxDecorations); 270 } 271 } 272 273 void RenderRegion::clearObjectStyleInRegion(const RenderObject* object) 274 { 275 ASSERT(object); 276 m_renderObjectRegionStyle.remove(object); 277 } 278 245 279 } // namespace WebCore -
trunk/Source/WebCore/rendering/RenderRegion.h
r98600 r102234 74 74 RenderBoxRegionInfo* takeRenderBoxRegionInfo(const RenderBox*); 75 75 void removeRenderBoxRegionInfo(const RenderBox*); 76 76 77 77 void deleteAllRenderBoxRegionInfo(); 78 78 … … 82 82 bool isLastRegion() const; 83 83 84 RenderStyle* renderObjectRegionStyle(const RenderObject*) const; 85 void computeStyleInRegion(const RenderObject*); 86 void clearObjectStyleInRegion(const RenderObject*); 84 87 private: 85 88 virtual const char* renderName() const { return "RenderRegion"; } … … 98 101 // it will also hold a custom style for any box (for region styling). 99 102 HashMap<const RenderBox*, RenderBoxRegionInfo*> m_renderBoxRegionInfo; 103 104 // This map holds information about the region style associated with the render objects that 105 // are displayed into this region. 106 typedef HashMap<const RenderObject*, RefPtr<RenderStyle> > RenderObjectRegionStyleMap; 107 RenderObjectRegionStyleMap m_renderObjectRegionStyle; 100 108 101 109 bool m_isValid; -
trunk/Source/WebCore/rendering/RenderView.cpp
r101574 r102234 59 59 , m_layoutStateDisableCount(0) 60 60 , m_currentRenderFlowThread(0) 61 , m_currentRenderRegion(0) 61 62 { 62 63 // Clear our anonymous bit, set because RenderObject assumes -
trunk/Source/WebCore/rendering/RenderView.h
r102185 r102234 32 32 33 33 class RenderFlowThread; 34 class RenderRegion; 34 35 class RenderWidget; 35 36 … … 187 188 void setCurrentRenderFlowThread(RenderFlowThread* flowThread) { m_currentRenderFlowThread = flowThread; } 188 189 190 RenderRegion* currentRenderRegion() const { return m_currentRenderRegion; } 191 void setCurrentRenderRegion(RenderRegion* region) { m_currentRenderRegion = region; } 192 189 193 void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 190 194 191 195 protected: 192 196 virtual void mapLocalToContainer(RenderBoxModelObject* repaintContainer, bool useTransforms, bool fixed, TransformState&, bool* wasFixed = 0) const; … … 274 278 OwnPtr<RenderFlowThreadList> m_renderFlowThreadList; 275 279 RenderFlowThread* m_currentRenderFlowThread; 280 RenderRegion* m_currentRenderRegion; 276 281 }; 277 282
Note: See TracChangeset
for help on using the changeset viewer.