Changeset 156527 in webkit
- Timestamp:
- Sep 26, 2013, 7:02:27 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 32 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r156522 r156527 1 2013-09-26 Antti Koivisto <antti@apple.com> 2 3 Move m_style to RenderElement 4 https://bugs.webkit.org/show_bug.cgi?id=121936 5 6 Reviewed by Andreas Kling. 7 8 Progressions from text style updating correctly in all cases. 9 10 * compositing/contents-opaque/hidden-with-visible-text-expected.txt: 11 * compositing/contents-opaque/visibility-hidden-expected.txt: 12 13 Can't figure out why these progress but they do. The new rendering (showing nothing) 14 is correct and matches Firefox. 15 16 * platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt: 17 * platform/mac/svg/custom/getTransformToElement-expected.txt: 18 * platform/mac/svg/custom/text-ctm-expected.txt: 19 * platform/mac/svg/custom/text-hit-test-expected.txt: 20 * platform/mac/svg/text/append-text-node-to-tspan-expected.txt: 21 1 22 2013-09-26 Eric Carlson <eric.carlson@apple.com> 2 23 -
trunk/LayoutTests/compositing/contents-opaque/hidden-with-visible-text-expected.txt
r149915 r156527 9 9 (position 8.00 13.00) 10 10 (bounds 200.00 100.00) 11 ( drawsContent 1)11 (contentsVisible 0) 12 12 ) 13 13 ) -
trunk/LayoutTests/compositing/contents-opaque/visibility-hidden-expected.txt
r149084 r156527 9 9 (position 8.00 20.00) 10 10 (bounds 200.00 50.00) 11 ( drawsContent 1)11 (contentsVisible 0) 12 12 ) 13 13 ) -
trunk/LayoutTests/platform/mac/svg/custom/SVGPoint-matrixTransform-expected.txt
r107057 r156527 2 2 RenderView at (0,0) size 800x600 3 3 layer at (0,0) size 800x600 4 RenderSVGRoot {svg} at (40,1 2) size 86x365 RenderSVGText {text} at (20, 6) size 43x18contains 1 chunk(s)6 RenderSVGInlineText {#text} at (0,0) size 43x1 84 RenderSVGRoot {svg} at (40,10) size 86x38 5 RenderSVGText {text} at (20,5) size 43x19 contains 1 chunk(s) 6 RenderSVGInlineText {#text} at (0,0) size 43x19 7 7 chunk 1 text run 1 at (20.00,20.00) startOffset 0 endOffset 6 width 43.00: "Passed" -
trunk/LayoutTests/platform/mac/svg/custom/getTransformToElement-expected.txt
r149210 r156527 4 4 RenderSVGRoot {svg} at (20,56) size 101x157 5 5 RenderSVGContainer {g} at (0,0) size 0x0 [transform={m=((0.00,0.00)(0.00,0.00)) t=(0.00,0.00)}] 6 RenderSVGContainer {g} at (20,56) size 4 1x18 [transform={m=((1.00,0.00)(0.00,1.00)) t=(15.00,15.00)}]7 RenderSVGText {text} at (50,12 2) size 82x35contains 1 chunk(s)8 RenderSVGInlineText {#text} at (0,0) size 8 2x359 chunk 1 text run 1 at (50.00,150.00) startOffset 0 endOffset 6 width 8 2.00: "Passed"6 RenderSVGContainer {g} at (20,56) size 42x18 [transform={m=((1.00,0.00)(0.00,1.00)) t=(15.00,15.00)}] 7 RenderSVGText {text} at (50,123) size 84x34 contains 1 chunk(s) 8 RenderSVGInlineText {#text} at (0,0) size 84x34 9 chunk 1 text run 1 at (50.00,150.00) startOffset 0 endOffset 6 width 84.00: "Passed" 10 10 RenderSVGContainer {g} at (49,141) size 72x72 [transform={m=((0.71,0.71)(-0.71,0.71)) t=(0.00,0.00)}] 11 11 RenderSVGRect {rect} at (49,141) size 72x72 [transform={m=((1.00,0.00)(0.00,1.00)) t=(100.00,0.00)}] [x=50.00] [y=50.00] [width=70.00] [height=30.00] -
trunk/LayoutTests/platform/mac/svg/custom/text-ctm-expected.txt
r146424 r156527 2 2 RenderView at (0,0) size 800x600 3 3 layer at (0,0) size 800x600 4 RenderSVGRoot {svg} at (100,7 2) size 86x365 RenderSVGContainer {g} at (100,7 2) size 86x36[transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,10.00)}]6 RenderSVGViewportContainer {svg} at (100,7 2) size 86x367 RenderSVGText {text} at (70,5 6) size 43x18contains 1 chunk(s)8 RenderSVGInlineText {#text} at (0,0) size 43x1 84 RenderSVGRoot {svg} at (100,70) size 86x38 5 RenderSVGContainer {g} at (100,70) size 86x38 [transform={m=((1.00,0.00)(0.00,1.00)) t=(10.00,10.00)}] 6 RenderSVGViewportContainer {svg} at (100,70) size 86x38 7 RenderSVGText {text} at (70,55) size 43x19 contains 1 chunk(s) 8 RenderSVGInlineText {#text} at (0,0) size 43x19 9 9 chunk 1 text run 1 at (70.00,70.00) startOffset 0 endOffset 6 width 43.00: "Passed" -
trunk/LayoutTests/platform/mac/svg/custom/text-hit-test-expected.txt
r149210 r156527 10 10 RenderSVGInlineText {#text} at (0,0) size 44x19 11 11 chunk 1 text run 1 at (10.00,130.00) startOffset 0 endOffset 7 width 43.50: "Status:" 12 RenderSVGText {text} at (90,11 6) size 43x18contains 1 chunk(s)13 RenderSVGInlineText {#text} at (0,0) size 43x1 812 RenderSVGText {text} at (90,115) size 43x19 contains 1 chunk(s) 13 RenderSVGInlineText {#text} at (0,0) size 43x19 14 14 chunk 1 text run 1 at (90.00,130.00) startOffset 0 endOffset 6 width 43.00: "Passed" 15 15 caret: position 0 of child 0 {#text} of child 1 {text} of child 3 {g} of child 1 {svg} of document -
trunk/LayoutTests/platform/mac/svg/text/append-text-node-to-tspan-expected.txt
r149210 r156527 5 5 RenderBody {BODY} at (8,8) size 784x0 6 6 layer at (0,0) size 800x600 7 RenderSVGRoot {svg} at (10,60) size 3 30x3808 RenderSVGText {text} at (0,1) size 3 3x38 contains 1 chunk(s)9 RenderSVGTSpan {tspan} at (0,0) size 30x147 RenderSVGRoot {svg} at (10,60) size 320x380 8 RenderSVGText {text} at (0,1) size 32x38 contains 1 chunk(s) 9 RenderSVGTSpan {tspan} at (0,0) size 29x14 10 10 RenderSVGInlineText {#text} at (0,0) size 16x14 11 11 chunk 1 text run 1 at (0.00,12.00) startOffset 0 endOffset 2 width 15.40: "PA" 12 12 RenderSVGInlineText {#text} at (15,0) size 14x14 13 chunk 1 text run 1 at (15.40,12.00) startOffset 0 endOffset 2 width 1 4.00: "SS"14 RenderSVGInlineText {#text} at (2 9,0) size 3x1415 chunk 1 text run 1 at (2 9.40,12.00) startOffset 0 endOffset 1 width 3.00: " "13 chunk 1 text run 1 at (15.40,12.00) startOffset 0 endOffset 2 width 13.40: "SS" 14 RenderSVGInlineText {#text} at (28,0) size 3x14 15 chunk 1 text run 1 at (28.80,12.00) startOffset 0 endOffset 1 width 3.00: " " 16 16 RenderSVGTSpan {tspan} at (0,0) size 29x14 17 17 RenderSVGInlineText {#text} at (0,12) size 29x14 -
trunk/Source/WebCore/ChangeLog
r156522 r156527 1 2013-09-26 Antti Koivisto <antti@apple.com> 2 3 Move m_style to RenderElement 4 https://bugs.webkit.org/show_bug.cgi?id=121936 5 6 Reviewed by Andreas Kling. 7 8 Text renderers always have the same style as their parent. They can get their style via the parent pointer 9 rather than having a member of their own. 10 11 This shrinks RenderText by a pointer. 12 13 * dom/PseudoElement.cpp: 14 (WebCore::PseudoElement::didRecalcStyle): 15 16 Text renderers have no independent style. No need to set it. 17 18 * editing/ApplyBlockElementCommand.cpp: 19 * rendering/RenderBlock.cpp: 20 (WebCore::RenderBlock::addChildToAnonymousColumnBlocks): 21 22 Avoid getting style from text child before it is added to tree. 23 24 (WebCore::RenderBlock::updateFirstLetterStyle): 25 (WebCore::RenderBlock::createFirstLetterRenderer): 26 * rendering/RenderButton.cpp: 27 (WebCore::RenderButton::styleDidChange): 28 (WebCore::RenderButton::setText): 29 * rendering/RenderCombineText.cpp: 30 (WebCore::RenderCombineText::styleDidChange): 31 32 Don't set text style anymore. 33 34 * rendering/RenderElement.cpp: 35 (WebCore::RenderElement::RenderElement): 36 (WebCore::RenderElement::setStyle): 37 38 Notify child text renderers of style change. 39 40 (WebCore::RenderElement::setAnimatableStyle): 41 (WebCore::RenderElement::setPseudoStyle): 42 43 Push down to RenderElement, remove text branches. 44 45 (WebCore::RenderElement::addChild): 46 47 Notify text renderers of style change when added to tree. 48 49 (WebCore::RenderElement::propagateStyleToAnonymousChildren): 50 * rendering/RenderElement.h: 51 (WebCore::RenderElement::style): 52 (WebCore::RenderElement::setStyleInternal): 53 54 Move m_style from RenderObject. 55 56 (WebCore::RenderObject::style): 57 58 Inline this in RenderElement.h instead of making it virtual. 59 60 * rendering/RenderInline.cpp: 61 (WebCore::updateStyleOfAnonymousBlockContinuations): 62 (WebCore::RenderInline::styleDidChange): 63 64 Tighten typing to call RenderElement::setStyle. 65 66 (WebCore::RenderInline::clippedOverflowRectForRepaint): 67 68 Change assert. This can get legitimately called during layout for the first letter renderers. 69 This was previously avoided by luck. 70 71 * rendering/RenderMenuList.cpp: 72 (WebCore::RenderMenuList::styleDidChange): 73 (WebCore::RenderMenuList::setText): 74 75 Don't set text style anymore. 76 77 * rendering/RenderObject.cpp: 78 (WebCore::RenderObject::RenderObject): 79 (WebCore::RenderObject::containingBlock): 80 (WebCore::RenderObject::drawLineForBoxSide): 81 (WebCore::RenderObject::hasEntirelyFixedBackground): 82 (WebCore::RenderObject::container): 83 (WebCore::RenderObject::cachedFirstLineStyle): 84 85 Switch to style(), avoid unnecessary repetition. 86 Move code out. 87 88 * rendering/RenderObject.h: 89 90 Move functions to RenderElement. 91 92 (WebCore::RenderObject::isBeforeContent): 93 (WebCore::RenderObject::isAfterContent): 94 95 Avoid accessing style for text renderers as these are called before the renderer 96 is added to tree. 97 98 (WebCore::RenderObject::setNeedsPositionedMovementLayout): 99 * rendering/RenderRegion.cpp: 100 (WebCore::RenderRegion::restoreRegionObjectsOriginalStyle): 101 (WebCore::RenderRegion::setObjectStyleInRegion): 102 * rendering/RenderSearchField.cpp: 103 (WebCore::RenderSearchField::updateCancelButtonVisibility): 104 * rendering/RenderText.cpp: 105 * rendering/RenderText.h: 106 107 Remove setStyle. 108 109 (WebCore::RenderText::style): 110 111 Get style from parent. 112 113 * rendering/mathml/RenderMathMLOperator.cpp: 114 (WebCore::RenderMathMLOperator::updateFromElement): 115 (WebCore::RenderMathMLOperator::createGlyph): 116 * rendering/style/ContentData.cpp: 117 (WebCore::TextContentData::createRenderer): 118 (WebCore::CounterContentData::createRenderer): 119 (WebCore::QuoteContentData::createRenderer): 120 121 Pseudo style for RenderText subclasses comes from parent without any explicit setting. 122 123 * style/StyleResolveTree.cpp: 124 (WebCore::Style::createTextRendererIfNeeded): 125 (WebCore::Style::resolveLocal): 126 (WebCore::Style::updateTextStyle): 127 (WebCore::Style::resolveShadowTree): 128 (WebCore::Style::resolveTree): 129 130 No need to set or update text renderer style separately. 131 1 132 2013-09-26 Eric Carlson <eric.carlson@apple.com> 2 133 -
trunk/Source/WebCore/css/CSSGradientValue.cpp
r156226 r156527 35 35 #include "IntSizeHash.h" 36 36 #include "NodeRenderStyle.h" 37 #include "Render Object.h"37 #include "RenderElement.h" 38 38 #include "StyleResolver.h" 39 39 #include <wtf/text/StringBuilder.h> -
trunk/Source/WebCore/dom/PseudoElement.cpp
r156144 r156527 112 112 for (RenderObject* child = renderer->nextInPreOrder(renderer); child; child = child->nextInPreOrder(renderer)) { 113 113 // We only manage the style for the generated content which must be images or text. 114 if (!child->is Text() && !child->isImage())114 if (!child->isImage()) 115 115 continue; 116 117 // The style for the RenderTextFragment for first letter is managed by an enclosing block, not by us. 118 if (child->style()->styleType() == FIRST_LETTER) 119 continue; 120 121 child->setPseudoStyle(renderer->style()); 116 toRenderElement(child)->setPseudoStyle(renderer->style()); 122 117 } 123 118 } -
trunk/Source/WebCore/editing/ApplyBlockElementCommand.cpp
r156289 r156527 30 30 #include "HTMLElement.h" 31 31 #include "HTMLNames.h" 32 #include "Render Object.h"32 #include "RenderElement.h" 33 33 #include "RenderStyle.h" 34 34 #include "Text.h" -
trunk/Source/WebCore/editing/HTMLInterchange.cpp
r151947 r156527 27 27 #include "HTMLInterchange.h" 28 28 29 #include "Render Object.h"29 #include "RenderElement.h" 30 30 #include "Text.h" 31 31 #include "TextIterator.h" -
trunk/Source/WebCore/editing/InsertLineBreakCommand.cpp
r156289 r156527 35 35 #include "HTMLTableElement.h" 36 36 #include "Range.h" 37 #include "Render Object.h"37 #include "RenderElement.h" 38 38 #include "Text.h" 39 39 #include "VisiblePosition.h" -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r156422 r156527 457 457 458 458 // See if the child can be placed in the box. 459 bool newChildHasColumnSpan = newChild->style()->columnSpan() && !newChild->isInline();459 bool newChildHasColumnSpan = !newChild->isInline() && newChild->style()->columnSpan(); 460 460 bool beforeChildParentHoldsColumnSpans = beforeChildParent->isAnonymousColumnSpanBlock(); 461 461 … … 5874 5874 } else 5875 5875 firstLetter->setStyle(pseudoStyle); 5876 5877 for (RenderObject* genChild = firstLetter->firstChild(); genChild; genChild = genChild->nextSibling()) {5878 if (genChild->isText())5879 genChild->setStyle(pseudoStyle);5880 }5881 5876 } 5882 5877 … … 5929 5924 remainingText = RenderTextFragment::createAnonymous(document(), oldText, length, oldText.length() - length); 5930 5925 5931 remainingText->setStyle(currentTextChild->style());5932 5926 if (remainingText->textNode()) 5933 5927 remainingText->textNode()->setRenderer(remainingText); … … 5945 5939 letter = RenderTextFragment::createAnonymous(document(), oldText, 0, length); 5946 5940 5947 letter->setStyle(pseudoStyle);5948 5941 firstLetter->addChild(letter); 5949 5942 -
trunk/Source/WebCore/rendering/RenderButton.cpp
r156155 r156527 106 106 RenderBlock::styleDidChange(diff, oldStyle); 107 107 108 if (m_buttonText)109 m_buttonText->setStyle(style());110 108 if (m_inner) // RenderBlock handled updating the anonymous block's style. 111 109 setupInnerStyle(m_inner->style()); … … 157 155 else { 158 156 m_buttonText = RenderTextFragment::createAnonymous(document(), str); 159 m_buttonText->setStyle(style());160 157 addChild(m_buttonText); 161 158 } -
trunk/Source/WebCore/rendering/RenderElement.cpp
r156478 r156527 27 27 28 28 #include "AXObjectCache.h" 29 #include "AnimationController.h" 29 30 #include "ContentData.h" 30 31 #include "CursorList.h" … … 67 68 , m_firstChild(nullptr) 68 69 , m_lastChild(nullptr) 70 , m_style(0) 69 71 { 70 72 } … … 324 326 styleDidChange(diff, oldStyle.get()); 325 327 328 // Text renderers use their parent style. Notify them about the change. 329 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 330 if (child->isText()) 331 toRenderText(child)->styleDidChange(diff, oldStyle.get()); 332 } 333 326 334 // FIXME: |this| might be destroyed here. This can currently happen for a RenderTextFragment when 327 335 // its first-letter block gets an update in RenderTextFragment::styleDidChange. For RenderTextFragment(s), … … 354 362 } 355 363 364 void RenderElement::setAnimatableStyle(PassRefPtr<RenderStyle> style) 365 { 366 setStyle(animation().updateAnimations(this, style.get())); 367 } 368 369 void RenderElement::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle) 370 { 371 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFTER); 372 373 // Images are special and must inherit the pseudoStyle so the width and height of 374 // the pseudo element doesn't change the size of the image. In all other cases we 375 // can just share the style. 376 if (isImage()) { 377 RefPtr<RenderStyle> style = RenderStyle::create(); 378 style->inheritFrom(pseudoStyle.get()); 379 setStyle(style.release()); 380 return; 381 } 382 383 setStyle(pseudoStyle); 384 } 385 356 386 void RenderElement::addChild(RenderObject* newChild, RenderObject* beforeChild) 357 387 { … … 384 414 insertChildInternal(newChild, beforeChild, NotifyChildren); 385 415 386 if (newChild->isText() && newChild->style()->textTransform() == CAPITALIZE)387 toRenderText(newChild)-> transformText();416 if (newChild->isText()) 417 toRenderText(newChild)->styleDidChange(StyleDifferenceEqual, nullptr); 388 418 389 419 // SVG creates renderers for <g display="none">, as SVG requires children of hidden … … 660 690 // FIXME: We could save this call when the change only affected non-inherited properties. 661 691 for (RenderObject* child = firstChild(); child; child = child->nextSibling()) { 692 if (child->isText()) 693 continue; 662 694 if (!child->isAnonymous() || child->style()->styleType() != NOPSEUDO) 663 695 continue; … … 684 716 newStyle->setPosition(child->style()->position()); 685 717 686 child->setStyle(newStyle.release());718 toRenderElement(child)->setStyle(newStyle.release()); 687 719 } 688 720 } -
trunk/Source/WebCore/rendering/RenderElement.h
r156338 r156527 34 34 static RenderElement* createFor(Element&, RenderStyle&); 35 35 36 virtual void setStyle(PassRefPtr<RenderStyle>) OVERRIDE; 36 RenderStyle* style() const { return m_style.get(); } 37 RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); } 38 39 virtual void setStyle(PassRefPtr<RenderStyle>); 40 // Called to update a style that is allowed to trigger animations. 41 void setAnimatableStyle(PassRefPtr<RenderStyle>); 42 // Set the style of the object if it's generated content. 43 void setPseudoStyle(PassRefPtr<RenderStyle>); 37 44 38 45 // This is null for anonymous renderers. … … 65 72 // Return the renderer whose background style is used to paint the root background. Should only be called on the renderer for which isRoot() is true. 66 73 RenderElement* rendererForRootBackground(); 74 75 // Updates only the local style ptr of the object. Does not update the state of the object, 76 // and so only should be called when the style is known not to have changed (or from setStyle). 77 void setStyleInternal(PassRefPtr<RenderStyle> style) { m_style = style; } 67 78 68 79 protected: … … 112 123 RenderObject* m_lastChild; 113 124 125 RefPtr<RenderStyle> m_style; 126 114 127 // FIXME: Get rid of this hack. 115 128 // Store state between styleWillChange and styleDidChange … … 156 169 void toRenderElement(const RenderElement&); 157 170 171 inline RenderStyle* RenderObject::style() const 172 { 173 if (isText()) 174 return m_parent->style(); 175 return toRenderElement(this)->style(); 176 } 177 158 178 inline RenderElement* Element::renderer() const 159 179 { -
trunk/Source/WebCore/rendering/RenderImageResource.cpp
r154858 r156527 31 31 #include "CachedImage.h" 32 32 #include "Image.h" 33 #include "RenderElement.h" 33 34 #include "RenderImageResourceStyleImage.h" 34 #include "RenderObject.h"35 35 36 36 namespace WebCore { -
trunk/Source/WebCore/rendering/RenderImageResourceStyleImage.cpp
r144568 r156527 30 30 31 31 #include "CachedImage.h" 32 #include "Render Object.h"32 #include "RenderElement.h" 33 33 #include "StyleCachedImage.h" 34 34 -
trunk/Source/WebCore/rendering/RenderInline.cpp
r156422 r156527 149 149 } 150 150 151 static void updateStyleOfAnonymousBlockContinuations(Render Object* block, const RenderStyle* newStyle, const RenderStyle* oldStyle)152 { 153 for (;block && block->isAnonymousBlock(); block = block->nextSibling()) {154 if (! toRenderBlock(block)->isAnonymousBlockContinuation() || block->style()->position() == newStyle->position())151 static void updateStyleOfAnonymousBlockContinuations(RenderBlock* block, const RenderStyle* newStyle, const RenderStyle* oldStyle) 152 { 153 for (;block && block->isAnonymousBlock(); block = toRenderBlock(block->nextSibling())) { 154 if (!block->isAnonymousBlockContinuation() || block->style()->position() == newStyle->position()) 155 155 continue; 156 156 // If we are no longer in-flow positioned but our descendant block(s) still have an in-flow positioned ancestor then 157 157 // their containing anonymous block should keep its in-flow positioning. 158 RenderInline* cont = toRenderBlock(block)->inlineElementContinuation();158 RenderInline* cont = block->inlineElementContinuation(); 159 159 if (oldStyle->hasInFlowPosition() && inFlowPositionedInlineAncestor(cont)) 160 160 continue; … … 191 191 RenderObject* block = containingBlock()->nextSibling(); 192 192 ASSERT(block && block->isAnonymousBlock()); 193 updateStyleOfAnonymousBlockContinuations( block, newStyle, oldStyle);193 updateStyleOfAnonymousBlockContinuations(toRenderBlock(block), newStyle, oldStyle); 194 194 } 195 195 … … 1030 1030 LayoutRect RenderInline::clippedOverflowRectForRepaint(const RenderLayerModelObject* repaintContainer) const 1031 1031 { 1032 // Only run-ins a re allowed in here during layout.1033 ASSERT(!view().layoutStateEnabled() || isRunIn() );1032 // Only run-ins and first-letter renderers are allowed in here during layout. They mutate the tree triggering repaints. 1033 ASSERT(!view().layoutStateEnabled() || isRunIn() || style()->styleType() == FIRST_LETTER); 1034 1034 1035 1035 if (!firstLineBoxIncludingCulling() && !continuation()) -
trunk/Source/WebCore/rendering/RenderMenuList.cpp
r156166 r156527 158 158 RenderBlock::styleDidChange(diff, oldStyle); 159 159 160 if (m_buttonText)161 m_buttonText->setStyle(style());162 160 if (m_innerBlock) // RenderBlock handled updating the anonymous block's style. 163 161 adjustInnerStyle(); … … 245 243 else { 246 244 m_buttonText = RenderText::createAnonymous(document(), textToUse); 247 m_buttonText->setStyle(style());248 245 addChild(m_buttonText); 249 246 } -
trunk/Source/WebCore/rendering/RenderObject.cpp
r156422 r156527 94 94 struct SameSizeAsRenderObject { 95 95 virtual ~SameSizeAsRenderObject() { } // Allocate vtable pointer. 96 void* pointers[ 5];96 void* pointers[4]; 97 97 #ifndef NDEBUG 98 98 unsigned m_debugBitfields : 2; … … 122 122 RenderObject::RenderObject(Node* node) 123 123 : CachedImageClient() 124 , m_style(0)125 124 , m_node(node) 126 125 , m_parent(0) … … 738 737 o = toRenderScrollbarPart(this)->rendererOwningScrollbar(); 739 738 740 if (!isText() && m_style->position() == FixedPosition) 739 RenderStyle* style = this->style(); 740 if (!isText() && style->position() == FixedPosition) 741 741 o = containingBlockForFixedPosition(o); 742 else if (!isText() && m_style->position() == AbsolutePosition)742 else if (!isText() && style->position() == AbsolutePosition) 743 743 o = containingBlockForAbsolutePosition(o); 744 744 else … … 811 811 812 812 void RenderObject::drawLineForBoxSide(GraphicsContext* graphicsContext, int x1, int y1, int x2, int y2, 813 BoxSide side, Color color, EBorderStyle style, 814 int adjacentWidth1, int adjacentWidth2, bool antialias) 813 BoxSide side, Color color, EBorderStyle borderStyle, int adjacentWidth1, int adjacentWidth2, bool antialias) 815 814 { 816 815 int thickness; … … 829 828 return; 830 829 831 if (style == DOUBLE && thickness < 3) 832 style = SOLID; 833 834 switch (style) { 830 if (borderStyle == DOUBLE && thickness < 3) 831 borderStyle = SOLID; 832 833 RenderStyle* style = this->style(); 834 switch (borderStyle) { 835 835 case BNONE: 836 836 case BHIDDEN: … … 842 842 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); 843 843 graphicsContext->setShouldAntialias(antialias); 844 graphicsContext->setStrokeColor(color, m_style->colorSpace());844 graphicsContext->setStrokeColor(color, style->colorSpace()); 845 845 graphicsContext->setStrokeThickness(thickness); 846 graphicsContext->setStrokeStyle( style == DASHED ? DashedStroke : DottedStroke);846 graphicsContext->setStrokeStyle(borderStyle == DASHED ? DashedStroke : DottedStroke); 847 847 848 848 switch (side) { … … 868 868 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); 869 869 graphicsContext->setStrokeStyle(NoStroke); 870 graphicsContext->setFillColor(color, m_style->colorSpace());870 graphicsContext->setFillColor(color, style->colorSpace()); 871 871 872 872 bool wasAntialiased = graphicsContext->shouldAntialias(); … … 938 938 EBorderStyle s1; 939 939 EBorderStyle s2; 940 if ( style == GROOVE) {940 if (borderStyle == GROOVE) { 941 941 s1 = INSET; 942 942 s2 = OUTSET; … … 984 984 // fall through 985 985 case OUTSET: 986 if ( style == OUTSET && (side == BSBottom || side == BSRight))986 if (borderStyle == OUTSET && (side == BSBottom || side == BSRight)) 987 987 color = color.dark(); 988 988 // fall through … … 990 990 StrokeStyle oldStrokeStyle = graphicsContext->strokeStyle(); 991 991 graphicsContext->setStrokeStyle(NoStroke); 992 graphicsContext->setFillColor(color, m_style->colorSpace());992 graphicsContext->setFillColor(color, style->colorSpace()); 993 993 ASSERT(x2 >= x1); 994 994 ASSERT(y2 >= y1); … … 1665 1665 } 1666 1666 1667 void RenderObject::setAnimatableStyle(PassRefPtr<RenderStyle> style)1668 {1669 if (!isText() && style)1670 setStyle(animation().updateAnimations(this, style.get()));1671 else1672 setStyle(style);1673 }1674 1675 void RenderObject::setPseudoStyle(PassRefPtr<RenderStyle> pseudoStyle)1676 {1677 ASSERT(pseudoStyle->styleType() == BEFORE || pseudoStyle->styleType() == AFTER);1678 1679 // Images are special and must inherit the pseudoStyle so the width and height of1680 // the pseudo element doesn't change the size of the image. In all other cases we1681 // can just share the style.1682 if (isImage()) {1683 RefPtr<RenderStyle> style = RenderStyle::create();1684 style->inheritFrom(pseudoStyle.get());1685 setStyle(style.release());1686 return;1687 }1688 1689 setStyle(pseudoStyle);1690 }1691 1692 1667 LayoutRect RenderObject::viewRect() const 1693 1668 { … … 1914 1889 bool RenderObject::hasEntirelyFixedBackground() const 1915 1890 { 1916 return m_style->hasEntirelyFixedBackground();1891 return style()->hasEntirelyFixedBackground(); 1917 1892 } 1918 1893 … … 1936 1911 return o; 1937 1912 1938 EPosition pos = m_style->position();1913 EPosition pos = style()->position(); 1939 1914 if (pos == FixedPosition) { 1940 1915 // container() can be called on an object that is not in the … … 2303 2278 ASSERT(document().styleSheetCollection().usesFirstLineRules()); 2304 2279 2305 if (RefPtr<RenderStyle> style = firstLineStyleForCachedUncachedType(Cached, isText() ? parent() : this, m_style.get())) 2306 return style.get(); 2307 2308 return m_style.get(); 2280 RenderStyle* style = this->style(); 2281 if (RefPtr<RenderStyle> firstLineStyle = firstLineStyleForCachedUncachedType(Cached, isText() ? parent() : this, style)) 2282 return firstLineStyle.get(); 2283 2284 return style; 2309 2285 } 2310 2286 -
trunk/Source/WebCore/rendering/RenderObject.h
r156422 r156527 705 705 virtual void dirtyLinesFromChangedChild(RenderObject*); 706 706 707 // Called to update a style that is allowed to trigger animations.708 // FIXME: Right now this will typically be called only when updating happens from the DOM on explicit elements.709 // We don't yet handle generated content animation such as first-letter or before/after (we'll worry about this later).710 void setAnimatableStyle(PassRefPtr<RenderStyle>);711 712 // Set the style of the object and update the state of the object accordingly.713 virtual void setStyle(PassRefPtr<RenderStyle>) = 0;714 715 // Set the style of the object if it's generated content.716 void setPseudoStyle(PassRefPtr<RenderStyle>);717 718 // Updates only the local style ptr of the object. Does not update the state of the object,719 // and so only should be called when the style is known not to have changed (or from setStyle).720 void setStyleInternal(PassRefPtr<RenderStyle> style) { m_style = style; }721 722 707 // returns the containing block level element for this element. 723 708 RenderBlock* containingBlock() const; … … 774 759 virtual LayoutUnit maxPreferredLogicalWidth() const { return 0; } 775 760 776 RenderStyle* style() const { return m_style.get(); }761 RenderStyle* style() const; 777 762 RenderStyle* firstLineStyle() const { return document().styleSheetCollection().usesFirstLineRules() ? cachedFirstLineStyle() : style(); } 778 763 RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); } … … 1002 987 void checkBlockPositionedObjectsNeedLayout(); 1003 988 #endif 1004 1005 RefPtr<RenderStyle> m_style;1006 989 1007 990 Node* m_node; … … 1143 1126 inline bool RenderObject::isBeforeContent() const 1144 1127 { 1145 if (style()->styleType() != BEFORE)1146 return false;1147 1128 // Text nodes don't have their own styles, so ignore the style on a text node. 1148 1129 if (isText()) 1149 1130 return false; 1131 if (style()->styleType() != BEFORE) 1132 return false; 1150 1133 return true; 1151 1134 } … … 1153 1136 inline bool RenderObject::isAfterContent() const 1154 1137 { 1155 if (style()->styleType() != AFTER)1156 return false;1157 1138 // Text nodes don't have their own styles, so ignore the style on a text node. 1158 1139 if (isText()) 1140 return false; 1141 if (style()->styleType() != AFTER) 1159 1142 return false; 1160 1143 return true; … … 1215 1198 markContainingBlocksForLayout(); 1216 1199 if (hasLayer()) { 1217 if (oldStyle && m_style->diffRequiresRepaint(oldStyle))1200 if (oldStyle && style()->diffRequiresRepaint(oldStyle)) 1218 1201 setLayerNeedsFullRepaint(); 1219 1202 else -
trunk/Source/WebCore/rendering/RenderRegion.cpp
r156478 r156527 531 531 RefPtr<RenderStyle> objectRegionStyle = object->style(); 532 532 RefPtr<RenderStyle> objectOriginalStyle = iter->value.style; 533 object->setStyleInternal(objectOriginalStyle); 533 if (object->isRenderElement()) 534 toRenderElement(object)->setStyleInternal(objectOriginalStyle); 534 535 535 536 bool shouldCacheRegionStyle = iter->value.cached; … … 611 612 612 613 RefPtr<RenderStyle> objectOriginalStyle = object->style(); 613 object->setStyleInternal(styleInRegion); 614 if (object->isRenderElement()) 615 toRenderElement(object)->setStyleInternal(styleInRegion); 614 616 615 617 if (object->isBoxModelObject() && !object->hasBoxDecorations()) { -
trunk/Source/WebCore/rendering/RenderSearchField.cpp
r155671 r156527 173 173 void RenderSearchField::updateCancelButtonVisibility() const 174 174 { 175 Render Object* cancelButtonRenderer = cancelButtonElement()->renderer();175 RenderElement* cancelButtonRenderer = cancelButtonElement()->renderer(); 176 176 if (!cancelButtonRenderer) 177 177 return; -
trunk/Source/WebCore/rendering/RenderText.cpp
r156325 r156527 199 199 { 200 200 return false; 201 }202 203 void RenderText::setStyle(PassRefPtr<RenderStyle> style)204 {205 if (style == this->style())206 return;207 208 StyleDifference diff = StyleDifferenceEqual;209 unsigned contextSensitiveProperties = ContextSensitivePropertyNone;210 RefPtr<RenderStyle> oldStyle = this->style();211 if (oldStyle.get())212 diff = oldStyle->diff(style.get(), contextSensitiveProperties);213 214 setStyleInternal(style);215 216 styleDidChange(diff, oldStyle.get());217 201 } 218 202 -
trunk/Source/WebCore/rendering/RenderText.h
r156325 r156527 24 24 #define RenderText_h 25 25 26 #include "Render Object.h"26 #include "RenderElement.h" 27 27 #include <wtf/Forward.h> 28 28 … … 47 47 virtual bool isTextFragment() const; 48 48 49 virtual void setStyle(PassRefPtr<RenderStyle>) OVERRIDE FINAL; 49 RenderStyle* style() const; 50 RenderStyle* style(bool firstLine) const { return firstLine ? firstLineStyle() : style(); } 50 51 51 52 virtual String originalText() const; … … 143 144 void removeAndDestroyTextBoxes(); 144 145 146 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle); 147 145 148 #if ENABLE(IOS_TEXT_AUTOSIZING) 146 149 float candidateComputedTextSize() const { return m_candidateComputedTextSize; } … … 151 154 virtual void computePreferredLogicalWidths(float leadWidth); 152 155 virtual void willBeDestroyed() OVERRIDE; 153 154 virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle);155 156 156 157 virtual void setTextInternal(const String&); … … 244 245 void toRenderText(const RenderText&); 245 246 247 inline RenderStyle* RenderText::style() const 248 { 249 return parent()->style(); 250 } 251 246 252 #ifdef NDEBUG 247 253 inline void RenderText::checkConsistency() const -
trunk/Source/WebCore/rendering/mathml/RenderMathMLOperator.cpp
r156278 r156527 235 235 // If we can't figure out the text, leave it blank. 236 236 if (text) { 237 RefPtr<RenderStyle> textStyle = RenderStyle::create();238 textStyle->inheritFrom(container->style());239 text->setStyle(textStyle.release());240 237 container->addChild(text); 241 238 } … … 317 314 318 315 RenderText* text = RenderText::createAnonymous(document(), String(&glyph, 1)); 319 text->setStyle(container->style());320 316 parent->addChild(text); 321 317 return container; -
trunk/Source/WebCore/rendering/style/ContentData.cpp
r156090 r156527 79 79 } 80 80 81 RenderObject* TextContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const81 RenderObject* TextContentData::createRenderer(Document& document, RenderStyle&) const 82 82 { 83 RenderObject* renderer = RenderTextFragment::createAnonymous(document, m_text); 84 renderer->setPseudoStyle(&pseudoStyle); 85 return renderer; 83 return RenderTextFragment::createAnonymous(document, m_text); 86 84 } 87 85 88 RenderObject* CounterContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const86 RenderObject* CounterContentData::createRenderer(Document& document, RenderStyle&) const 89 87 { 90 RenderObject* renderer = RenderCounter::createAnonymous(document, *m_counter); 91 renderer->setPseudoStyle(&pseudoStyle); 92 return renderer; 88 return RenderCounter::createAnonymous(document, *m_counter); 93 89 } 94 90 95 RenderObject* QuoteContentData::createRenderer(Document& document, RenderStyle& pseudoStyle) const91 RenderObject* QuoteContentData::createRenderer(Document& document, RenderStyle&) const 96 92 { 97 RenderObject* renderer = RenderQuote::createAnonymous(document, m_quote); 98 renderer->setPseudoStyle(&pseudoStyle); 99 return renderer; 93 return RenderQuote::createAnonymous(document, m_quote); 100 94 } 101 95 -
trunk/Source/WebCore/style/StyleResolveTree.cpp
r156422 r156527 367 367 368 368 Document& document = textNode.document(); 369 RefPtr<RenderStyle> style; 370 bool resetStyleInheritance = textNode.parentNode()->isShadowRoot() && toShadowRoot(textNode.parentNode())->resetStyleInheritance(); 371 if (resetStyleInheritance) 372 style = document.ensureStyleResolver().defaultStyleForElement(); 373 else 374 style = parentRenderer->style(); 369 RefPtr<RenderStyle> style = parentRenderer->style(); 375 370 376 371 if (!textRendererIsNeeded(textNode, *parentRenderer, *style)) … … 391 386 textNode.setRenderer(newRenderer); 392 387 // Parent takes care of the animations, no need to call setAnimatableStyle. 393 newRenderer->setStyle(style.release());394 388 parentRenderer->addChild(newRenderer, nextRenderer); 395 389 } … … 606 600 } 607 601 608 if (Render Object* renderer = current.renderer()) {602 if (RenderElement* renderer = current.renderer()) { 609 603 if (localChange != NoChange || pseudoStyleCacheIsInvalid(renderer, newStyle.get()) || (inheritedChange == Force && renderer->requiresForcedStyleRecalcPropagation()) || current.styleChangeType() == SyntheticStyleChange) 610 604 renderer->setAnimatableStyle(newStyle.get()); … … 632 626 } 633 627 634 static void updateTextStyle(Text& text , RenderStyle* parentElementStyle, Style::Change change)628 static void updateTextStyle(Text& text) 635 629 { 636 630 RenderText* renderer = toRenderText(text.renderer()); 637 638 if (change != Style::NoChange && renderer)639 renderer->setStyle(parentElementStyle);640 631 641 632 if (!text.needsStyleRecalc()) … … 650 641 } 651 642 652 static void resolveShadowTree(ShadowRoot* shadowRoot, RenderStyle* parentElementStyle,Style::Change change)643 static void resolveShadowTree(ShadowRoot* shadowRoot, Style::Change change) 653 644 { 654 645 if (!shadowRoot) … … 660 651 if (child->isTextNode()) { 661 652 // Current user agent ShadowRoots don't have immediate text children so this branch is never actually taken. 662 updateTextStyle(*toText(child) , parentElementStyle, change);653 updateTextStyle(*toText(child)); 663 654 continue; 664 655 } … … 752 743 StyleResolverParentPusher parentPusher(¤t); 753 744 754 RenderStyle* currentStyle = current.renderStyle();755 756 745 if (ShadowRoot* shadowRoot = current.shadowRoot()) { 757 746 if (change >= Inherit || shadowRoot->childNeedsStyleRecalc() || shadowRoot->needsStyleRecalc()) { 758 747 parentPusher.push(); 759 resolveShadowTree(shadowRoot, c urrentStyle, change);748 resolveShadowTree(shadowRoot, change); 760 749 } 761 750 } … … 770 759 for (Node* child = current.firstChild(); child; child = child->nextSibling()) { 771 760 if (child->isTextNode()) { 772 updateTextStyle(*toText(child) , currentStyle, change);761 updateTextStyle(*toText(child)); 773 762 continue; 774 763 } -
trunk/Source/WebKit/mac/WebView/WebHTMLRepresentation.mm
r155641 r156527 59 59 #import <WebCore/Range.h> 60 60 #import <WebCore/RegularExpression.h> 61 #import <WebCore/Render Object.h>61 #import <WebCore/RenderElement.h> 62 62 #import <WebCore/TextResourceDecoder.h> 63 63 #import <WebKit/DOMHTMLInputElement.h>
Note:
See TracChangeset
for help on using the changeset viewer.