| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
| 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
| 4 * (C) 2000 Dirk Mueller (mueller@kde.org) | 4 * (C) 2000 Dirk Mueller (mueller@kde.org) |
| 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) | 5 * (C) 2004 Allan Sandfeld Jensen (kde@carewolf.com) |
| 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. | 6 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2011 Apple Inc. All rights reserv
ed. |
| 7 * Copyright (C) 2009 Google Inc. All rights reserved. | 7 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) | 8 * Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmo
bile.com/) |
| 9 * | 9 * |
| 10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 RenderImage* image = new RenderImage(element); | 145 RenderImage* image = new RenderImage(element); |
| 146 // RenderImageResourceStyleImage requires a style being present on the i
mage but we don't want to | 146 // RenderImageResourceStyleImage requires a style being present on the i
mage but we don't want to |
| 147 // trigger a style change now as the node is not fully attached. Moving
this code to style change | 147 // trigger a style change now as the node is not fully attached. Moving
this code to style change |
| 148 // doesn't make sense as it should be run once at renderer creation. | 148 // doesn't make sense as it should be run once at renderer creation. |
| 149 image->setStyleInternal(style); | 149 image->setStyleInternal(style); |
| 150 if (const StyleImage* styleImage = static_cast<const ImageContentData*>(
contentData)->image()) { | 150 if (const StyleImage* styleImage = static_cast<const ImageContentData*>(
contentData)->image()) { |
| 151 image->setImageResource(RenderImageResourceStyleImage::create(const_
cast<StyleImage*>(styleImage))); | 151 image->setImageResource(RenderImageResourceStyleImage::create(const_
cast<StyleImage*>(styleImage))); |
| 152 image->setIsGeneratedContent(); | 152 image->setIsGeneratedContent(); |
| 153 } else | 153 } else |
| 154 image->setImageResource(RenderImageResource::create()); | 154 image->setImageResource(RenderImageResource::create()); |
| 155 image->setStyleInternal(0); | 155 image->setStyleInternal(nullptr); |
| 156 return image; | 156 return image; |
| 157 } | 157 } |
| 158 | 158 |
| 159 switch (style->display()) { | 159 switch (style->display()) { |
| 160 case NONE: | 160 case NONE: |
| 161 return 0; | 161 return 0; |
| 162 case INLINE: | 162 case INLINE: |
| 163 return new RenderInline(element); | 163 return new RenderInline(element); |
| 164 case BLOCK: | 164 case BLOCK: |
| 165 case INLINE_BLOCK: | 165 case INLINE_BLOCK: |
| (...skipping 29 matching lines...) Expand all Loading... |
| 195 return new RenderGrid(element); | 195 return new RenderGrid(element); |
| 196 } | 196 } |
| 197 | 197 |
| 198 return 0; | 198 return 0; |
| 199 } | 199 } |
| 200 | 200 |
| 201 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, renderObjectCounter, ("Rend
erObject")); | 201 DEFINE_DEBUG_ONLY_GLOBAL(WTF::RefCountedLeakCounter, renderObjectCounter, ("Rend
erObject")); |
| 202 | 202 |
| 203 RenderObject::RenderObject(Node* node) | 203 RenderObject::RenderObject(Node* node) |
| 204 : ImageResourceClient() | 204 : ImageResourceClient() |
| 205 , m_style(0) | 205 , m_style(nullptr) |
| 206 , m_node(node) | 206 , m_node(node) |
| 207 , m_parent(0) | 207 , m_parent(0) |
| 208 , m_previous(0) | 208 , m_previous(0) |
| 209 , m_next(0) | 209 , m_next(0) |
| 210 #ifndef NDEBUG | 210 #ifndef NDEBUG |
| 211 , m_hasAXObject(false) | 211 , m_hasAXObject(false) |
| 212 , m_setNeedsLayoutForbidden(false) | 212 , m_setNeedsLayoutForbidden(false) |
| 213 #endif | 213 #endif |
| 214 , m_bitfields(node) | 214 , m_bitfields(node) |
| 215 { | 215 { |
| (...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2854 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin
eStyle(); | 2854 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLin
eStyle(); |
| 2855 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { | 2855 if (parentStyle != rendererForFirstLineStyle->parent()->style()) { |
| 2856 if (type == Cached) { | 2856 if (type == Cached) { |
| 2857 // A first-line style is in effect. Cache a first-line style for
ourselves. | 2857 // A first-line style is in effect. Cache a first-line style for
ourselves. |
| 2858 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE
_INHERITED); | 2858 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE
_INHERITED); |
| 2859 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN
E_INHERITED, parentStyle); | 2859 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LIN
E_INHERITED, parentStyle); |
| 2860 } | 2860 } |
| 2861 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle
Request(FIRST_LINE_INHERITED), parentStyle, style); | 2861 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyle
Request(FIRST_LINE_INHERITED), parentStyle, style); |
| 2862 } | 2862 } |
| 2863 } | 2863 } |
| 2864 return 0; | 2864 return nullptr; |
| 2865 } | 2865 } |
| 2866 | 2866 |
| 2867 PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style)
const | 2867 PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style)
const |
| 2868 { | 2868 { |
| 2869 if (!document().styleEngine()->usesFirstLineRules()) | 2869 if (!document().styleEngine()->usesFirstLineRules()) |
| 2870 return 0; | 2870 return nullptr; |
| 2871 | 2871 |
| 2872 ASSERT(!isText()); | 2872 ASSERT(!isText()); |
| 2873 | 2873 |
| 2874 return firstLineStyleForCachedUncachedType(Uncached, this, style); | 2874 return firstLineStyleForCachedUncachedType(Uncached, this, style); |
| 2875 } | 2875 } |
| 2876 | 2876 |
| 2877 RenderStyle* RenderObject::cachedFirstLineStyle() const | 2877 RenderStyle* RenderObject::cachedFirstLineStyle() const |
| 2878 { | 2878 { |
| 2879 ASSERT(document().styleEngine()->usesFirstLineRules()); | 2879 ASSERT(document().styleEngine()->usesFirstLineRules()); |
| 2880 | 2880 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 2895 | 2895 |
| 2896 RefPtr<RenderStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pseud
o), parentStyle); | 2896 RefPtr<RenderStyle> result = getUncachedPseudoStyle(PseudoStyleRequest(pseud
o), parentStyle); |
| 2897 if (result) | 2897 if (result) |
| 2898 return style()->addCachedPseudoStyle(result.release()); | 2898 return style()->addCachedPseudoStyle(result.release()); |
| 2899 return 0; | 2899 return 0; |
| 2900 } | 2900 } |
| 2901 | 2901 |
| 2902 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe
quest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) cons
t | 2902 PassRefPtr<RenderStyle> RenderObject::getUncachedPseudoStyle(const PseudoStyleRe
quest& pseudoStyleRequest, RenderStyle* parentStyle, RenderStyle* ownStyle) cons
t |
| 2903 { | 2903 { |
| 2904 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s
tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) | 2904 if (pseudoStyleRequest.pseudoId < FIRST_INTERNAL_PSEUDOID && !ownStyle && !s
tyle()->hasPseudoStyle(pseudoStyleRequest.pseudoId)) |
| 2905 return 0; | 2905 return nullptr; |
| 2906 | 2906 |
| 2907 if (!parentStyle) { | 2907 if (!parentStyle) { |
| 2908 ASSERT(!ownStyle); | 2908 ASSERT(!ownStyle); |
| 2909 parentStyle = style(); | 2909 parentStyle = style(); |
| 2910 } | 2910 } |
| 2911 | 2911 |
| 2912 // FIXME: This "find nearest element parent" should be a helper function. | 2912 // FIXME: This "find nearest element parent" should be a helper function. |
| 2913 Node* n = node(); | 2913 Node* n = node(); |
| 2914 while (n && !n->isElementNode()) | 2914 while (n && !n->isElementNode()) |
| 2915 n = n->parentNode(); | 2915 n = n->parentNode(); |
| 2916 if (!n) | 2916 if (!n) |
| 2917 return 0; | 2917 return nullptr; |
| 2918 Element* element = toElement(n); | 2918 Element* element = toElement(n); |
| 2919 | 2919 |
| 2920 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { | 2920 if (pseudoStyleRequest.pseudoId == FIRST_LINE_INHERITED) { |
| 2921 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl
ement(element, parentStyle, DisallowStyleSharing); | 2921 RefPtr<RenderStyle> result = document().ensureStyleResolver().styleForEl
ement(element, parentStyle, DisallowStyleSharing); |
| 2922 result->setStyleType(FIRST_LINE_INHERITED); | 2922 result->setStyleType(FIRST_LINE_INHERITED); |
| 2923 return result.release(); | 2923 return result.release(); |
| 2924 } | 2924 } |
| 2925 | 2925 |
| 2926 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud
oStyleRequest, parentStyle); | 2926 return document().ensureStyleResolver().pseudoStyleForElement(element, pseud
oStyleRequest, parentStyle); |
| 2927 } | 2927 } |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3300 { | 3300 { |
| 3301 if (object1) { | 3301 if (object1) { |
| 3302 const WebCore::RenderObject* root = object1; | 3302 const WebCore::RenderObject* root = object1; |
| 3303 while (root->parent()) | 3303 while (root->parent()) |
| 3304 root = root->parent(); | 3304 root = root->parent(); |
| 3305 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3305 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
| 3306 } | 3306 } |
| 3307 } | 3307 } |
| 3308 | 3308 |
| 3309 #endif | 3309 #endif |
| OLD | NEW |