Changeset 162972 in webkit
- Timestamp:
- Jan 28, 2014, 3:36:04 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 14 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/css-generated-content/quote-first-letter-expected.html (added)
-
LayoutTests/fast/css-generated-content/quote-first-letter.html (added)
-
LayoutTests/platform/mac/fast/css-generated-content/005-expected.txt (modified) (2 diffs)
-
LayoutTests/platform/mac/fast/css-generated-content/beforeAfter-interdocument-expected.txt (modified) (2 diffs)
-
LayoutTests/platform/mac/fast/css-generated-content/nested-tables-with-before-after-content-crash-expected.txt (modified) (1 diff)
-
LayoutTests/platform/mac/fast/css-generated-content/no-openclose-quote-expected.txt (modified) (2 diffs)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/dom/PseudoElement.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderImage.cpp (modified) (1 diff)
-
Source/WebCore/rendering/RenderImage.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderQuote.cpp (modified) (6 diffs)
-
Source/WebCore/rendering/RenderQuote.h (modified) (3 diffs)
-
Source/WebCore/rendering/style/ContentData.cpp (modified) (2 diffs)
-
Source/WebCore/rendering/style/RenderStyle.cpp (modified) (1 diff)
-
Source/WebCore/rendering/style/RenderStyle.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r162963 r162972 1 2014-01-23 Myles C. Maxfield <mmaxfield@apple.com> 2 3 ASSERT_WITH_SECURITY_IMPLICATION in WebCore::InlineTextBox::paint 4 https://bugs.webkit.org/show_bug.cgi?id=114586 5 6 Reviewed by Dave Hyatt. 7 8 Taken mostly from https://chromium.googlesource.com/chromium/blink/+/cb2297db16f2e9328cb4dd8b552093d6b22340a8 9 10 If RenderQuote is a subclass of RenderObject, it can't be split by the first-letter CSS pseudoclass. 11 Instead, we should make it a subclass of RenderElement, so that it can be split properly. 12 13 This adds a test to make sure that the splitting behavior occurs, as well as updates existing tests that 14 didn't use the splitting behavior. 15 16 * fast/css-generated-content/quote-first-letter-expected.html: Added. 17 * fast/css-generated-content/quote-first-letter.html: Added. 18 * platform/mac/fast/css-generated-content/005-expected.txt: 19 * platform/mac/fast/css-generated-content/beforeAfter-interdocument-expected.txt: 20 * platform/mac/fast/css-generated-content/nested-tables-with-before-after-content-crash-expected.txt: 21 * platform/mac/fast/css-generated-content/no-openclose-quote-expected.txt: 22 1 23 2014-01-28 Carlos Alberto Lopez Perez <clopez@igalia.com> 2 24 -
trunk/LayoutTests/platform/mac/fast/css-generated-content/005-expected.txt
r80151 r162972 8 8 RenderInline (generated) at (0,0) size 7x18 9 9 RenderQuote at (0,0) size 7x18 10 text run at (0,0) width 7: "\"" 10 RenderText at (0,0) size 7x18 11 text run at (0,0) width 7: "\"" 11 12 RenderText {#text} at (7,0) size 151x18 12 13 text run at (7,0) width 151: "Quotes should surround" … … 18 19 text run at (0,0) width 53: "this text." 19 20 RenderInline (generated) at (0,0) size 7x18 20 RenderQuote at (53,0) size 7x18 21 text run at (53,0) width 7: "\"" 21 RenderQuote at (0,0) size 7x18 22 RenderText at (53,0) size 7x18 23 text run at (53,0) width 7: "\"" 22 24 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/fast/css-generated-content/beforeAfter-interdocument-expected.txt
r80151 r162972 20 20 RenderInline (generated) at (0,0) size 7x18 21 21 RenderQuote at (0,0) size 7x18 22 text run at (0,0) width 7: "\"" 22 RenderText at (0,0) size 7x18 23 text run at (0,0) width 7: "\"" 23 24 RenderText {#text} at (7,0) size 151x18 24 25 text run at (7,0) width 151: "Quotes should surround" … … 30 31 text run at (0,0) width 53: "this text." 31 32 RenderInline (generated) at (0,0) size 7x18 32 RenderQuote at (53,0) size 7x18 33 text run at (53,0) width 7: "\"" 33 RenderQuote at (0,0) size 7x18 34 RenderText at (53,0) size 7x18 35 text run at (53,0) width 7: "\"" -
trunk/LayoutTests/platform/mac/fast/css-generated-content/nested-tables-with-before-after-content-crash-expected.txt
r117339 r162972 17 17 RenderInline (generated) at (0,0) size 16x16 18 18 RenderQuote at (0,0) size 16x16 19 text run at (0,0) width 16: "\"" 19 RenderText at (0,0) size 16x16 20 text run at (0,0) width 16: "\"" 20 21 RenderInline (generated) at (0,0) size 16x16 21 RenderQuote at (16,0) size 16x16 22 text run at (16,0) width 16: "\"" 22 RenderQuote at (0,0) size 16x16 23 RenderText at (16,0) size 16x16 24 text run at (16,0) width 16: "\"" 23 25 RenderText {#text} at (0,0) size 0x0 24 26 RenderText {#text} at (0,0) size 0x0 -
trunk/LayoutTests/platform/mac/fast/css-generated-content/no-openclose-quote-expected.txt
r80151 r162972 8 8 RenderText at (0,0) size 8x18 9 9 text run at (0,0) width 8: "*" 10 RenderQuote at (0,0) size 0x 010 RenderQuote at (0,0) size 0x18 11 11 RenderText {#text} at (8,0) size 425x18 12 12 text run at (8,0) width 114: "This is some text. " … … 15 15 RenderText at (433,0) size 8x18 16 16 text run at (433,0) width 8: "*" 17 RenderQuote at (0,0) size 0x 017 RenderQuote at (0,0) size 0x18 -
trunk/Source/WebCore/ChangeLog
r162962 r162972 1 2014-01-23 Myles C. Maxfield <mmaxfield@apple.com> 2 3 ASSERT_WITH_SECURITY_IMPLICATION in WebCore::InlineTextBox::paint 4 https://bugs.webkit.org/show_bug.cgi?id=114586 5 6 Reviewed by Dave Hyatt. 7 8 Taken mostly from https://chromium.googlesource.com/chromium/blink/+/cb2297db16f2e9328cb4dd8b552093d6b22340a8 9 10 If RenderQuote is a subclass of RenderObject, it can't be split by the first-letter CSS pseudoclass. 11 Instead, we should make it a subclass of RenderElement, so that it can be split properly. 12 13 Test: fast/css-generated-content/quote-first-letter.html 14 15 * dom/PseudoElement.cpp: 16 (WebCore::PseudoElement::didRecalcStyle): 17 * rendering/RenderQuote.cpp: 18 (WebCore::RenderQuote::RenderQuote): 19 (WebCore::RenderQuote::willBeDestroyed): 20 (WebCore::RenderQuote::willBeRemovedFromTree): 21 (WebCore::RenderQuote::styleDidChange): 22 (WebCore::RenderQuote::updateText): 23 (WebCore::RenderQuote::computeText): 24 (WebCore::RenderQuote::updateDepth): 25 * rendering/RenderQuote.h: 26 * rendering/style/ContentData.cpp: 27 (WebCore::QuoteContentData::createContentRenderer): 28 1 29 2014-01-28 Antti Koivisto <antti@apple.com> 2 30 -
trunk/Source/WebCore/dom/PseudoElement.cpp
r162679 r162972 113 113 for (RenderObject* child = renderer->nextInPreOrder(renderer); child; child = child->nextInPreOrder(renderer)) { 114 114 // We only manage the style for the generated content which must be images or text. 115 if (!child->isRenderImage() )115 if (!child->isRenderImage() && !child->isQuote()) 116 116 continue; 117 toRenderImage(*child).setStyle(RenderImage::createStyleInheritingFromPseudoStyle(renderer->style())); 117 PassRef<RenderStyle> createdStyle = RenderStyle::createStyleInheritingFromPseudoStyle(renderer->style()); 118 toRenderElement(*child).setStyle(std::move(createdStyle)); 118 119 } 119 120 } -
trunk/Source/WebCore/rendering/RenderImage.cpp
r162356 r162972 143 143 } 144 144 145 PassRef<RenderStyle> RenderImage::createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle)146 {147 ASSERT(pseudoStyle.styleType() == BEFORE || pseudoStyle.styleType() == AFTER);148 149 // Images are special and must inherit the pseudoStyle so the width and height of150 // the pseudo element doesn't change the size of the image. In all other cases we151 // can just share the style.152 auto style = RenderStyle::create();153 style.get().inheritFrom(&pseudoStyle);154 return style;155 }156 157 145 // If we'll be displaying either alt text or an image, add some padding. 158 146 static const unsigned short paddingWidth = 4; -
trunk/Source/WebCore/rendering/RenderImage.h
r162356 r162972 39 39 RenderImage(Document&, PassRef<RenderStyle>, StyleImage* = nullptr); 40 40 virtual ~RenderImage(); 41 42 // Create a RenderStyle for generated content by inheriting from a pseudo style.43 static PassRef<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle&);44 41 45 42 RenderImageResource& imageResource() { return *m_imageResource; } -
trunk/Source/WebCore/rendering/RenderQuote.cpp
r162907 r162972 25 25 26 26 #include "QuotesData.h" 27 #include "RenderTextFragment.h" 27 28 #include "RenderView.h" 28 29 … … 31 32 namespace WebCore { 32 33 33 RenderQuote::RenderQuote(Document& document, QuoteType quote)34 : Render Text(document, emptyString())34 RenderQuote::RenderQuote(Document& document, PassRef<RenderStyle> style, QuoteType quote) 35 : RenderInline(document, std::move(style)) 35 36 , m_type(quote) 36 37 , m_depth(-1) … … 51 52 { 52 53 detachQuote(); 53 Render Text::willBeDestroyed();54 RenderInline::willBeDestroyed(); 54 55 } 55 56 56 57 void RenderQuote::willBeRemovedFromTree() 57 58 { 58 Render Text::willBeRemovedFromTree();59 RenderInline::willBeRemovedFromTree(); 59 60 detachQuote(); 60 61 } … … 62 63 void RenderQuote::styleDidChange(StyleDifference diff, const RenderStyle* oldStyle) 63 64 { 64 Render Text::styleDidChange(diff, oldStyle);65 setText(originalText(), true);65 RenderInline::styleDidChange(diff, oldStyle); 66 updateText(); 66 67 } 67 68 … … 337 338 } 338 339 339 String RenderQuote::originalText() const 340 void RenderQuote::updateText() 341 { 342 String text = computeText(); 343 if (m_text == text) 344 return; 345 346 while (RenderObject* child = firstChild()) 347 child->destroy(); 348 349 if (text == emptyString() || text == String()) { 350 m_text = String(); 351 return; 352 } 353 354 m_text = text; 355 356 RenderTextFragment* fragment = new RenderTextFragment(document(), m_text.impl()); 357 addChild(fragment); 358 } 359 360 String RenderQuote::computeText() const 340 361 { 341 362 if (m_depth < 0) … … 453 474 return; 454 475 m_depth = depth; 455 setText(originalText(), true);476 updateText(); 456 477 } 457 478 -
trunk/Source/WebCore/rendering/RenderQuote.h
r162158 r162972 24 24 #define RenderQuote_h 25 25 26 #include "Render Text.h"26 #include "RenderInline.h" 27 27 28 28 namespace WebCore { 29 29 30 class RenderQuote final : public Render Text{30 class RenderQuote final : public RenderInline { 31 31 public: 32 RenderQuote(Document&, QuoteType);32 RenderQuote(Document&, PassRef<RenderStyle>, QuoteType); 33 33 virtual ~RenderQuote(); 34 34 … … 41 41 virtual const char* renderName() const override { return "RenderQuote"; } 42 42 virtual bool isQuote() const override { return true; }; 43 virtual String originalText() const override;44 43 virtual void styleDidChange(StyleDifference, const RenderStyle*) override; 45 44 virtual void willBeRemovedFromTree() override; 46 45 46 String computeText() const; 47 void updateText(); 47 48 void updateDepth(); 48 49 … … 52 53 RenderQuote* m_previous; 53 54 bool m_isAttached; 55 String m_text; 54 56 }; 55 57 -
trunk/Source/WebCore/rendering/style/ContentData.cpp
r162356 r162972 50 50 RenderPtr<RenderObject> ImageContentData::createContentRenderer(Document& document, const RenderStyle& pseudoStyle) const 51 51 { 52 auto image = createRenderer<RenderImage>(document, Render Image::createStyleInheritingFromPseudoStyle(pseudoStyle), m_image.get());52 auto image = createRenderer<RenderImage>(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), m_image.get()); 53 53 image->initializeStyle(); 54 54 image->setAltText(altText()); … … 68 68 } 69 69 70 RenderPtr<RenderObject> QuoteContentData::createContentRenderer(Document& document, const RenderStyle& ) const70 RenderPtr<RenderObject> QuoteContentData::createContentRenderer(Document& document, const RenderStyle& pseudoStyle) const 71 71 { 72 return createRenderer<RenderQuote>(document, m_quote); 72 auto quote = createRenderer<RenderQuote>(document, RenderStyle::createStyleInheritingFromPseudoStyle(pseudoStyle), m_quote); 73 quote->initializeStyle(); 74 return std::move(quote); 73 75 } 74 76 -
trunk/Source/WebCore/rendering/style/RenderStyle.cpp
r162907 r162972 106 106 { 107 107 return adoptRef(*new RenderStyle(*other)); 108 } 109 110 PassRef<RenderStyle> RenderStyle::createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle) 111 { 112 ASSERT(pseudoStyle.styleType() == BEFORE || pseudoStyle.styleType() == AFTER); 113 114 // Images are special and must inherit the pseudoStyle so the width and height of 115 // the pseudo element doesn't change the size of the image. In all other cases we 116 // can just share the style. 117 auto style = RenderStyle::create(); 118 style.get().inheritFrom(&pseudoStyle); 119 return style; 108 120 } 109 121 -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r162795 r162972 352 352 static PassRef<RenderStyle> createAnonymousStyleWithDisplay(const RenderStyle* parentStyle, EDisplay); 353 353 static PassRef<RenderStyle> clone(const RenderStyle*); 354 355 // Create a RenderStyle for generated content by inheriting from a pseudo style. 356 static PassRef<RenderStyle> createStyleInheritingFromPseudoStyle(const RenderStyle& pseudoStyle); 354 357 355 358 enum IsAtShadowBoundary {
Note:
See TracChangeset
for help on using the changeset viewer.