Changeset 156608 in webkit for trunk/Source/WebCore/rendering/RenderObject.cpp
- Timestamp:
- Sep 28, 2013, 11:30:16 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/rendering/RenderObject.cpp
r156527 r156608 2233 2233 } 2234 2234 2235 enum StyleCacheState {2236 Cached,2237 Uncached2238 };2239 2240 static PassRefPtr<RenderStyle> firstLineStyleForCachedUncachedType(StyleCacheState type, const RenderObject* renderer, RenderStyle* style)2241 {2242 const RenderObject* rendererForFirstLineStyle = renderer;2243 if (renderer->isBeforeOrAfterContent())2244 rendererForFirstLineStyle = renderer->parent();2245 2246 if (rendererForFirstLineStyle->isRenderBlockFlow() || rendererForFirstLineStyle->isRenderButton()) {2247 if (RenderBlock* firstLineBlock = rendererForFirstLineStyle->firstLineBlock()) {2248 if (type == Cached)2249 return firstLineBlock->getCachedPseudoStyle(FIRST_LINE, style);2250 return firstLineBlock->getUncachedPseudoStyle(PseudoStyleRequest(FIRST_LINE), style, firstLineBlock == renderer ? style : 0);2251 }2252 } else if (!rendererForFirstLineStyle->isAnonymous() && rendererForFirstLineStyle->isRenderInline()) {2253 RenderStyle* parentStyle = rendererForFirstLineStyle->parent()->firstLineStyle();2254 if (parentStyle != rendererForFirstLineStyle->parent()->style()) {2255 if (type == Cached) {2256 // A first-line style is in effect. Cache a first-line style for ourselves.2257 rendererForFirstLineStyle->style()->setHasPseudoStyle(FIRST_LINE_INHERITED);2258 return rendererForFirstLineStyle->getCachedPseudoStyle(FIRST_LINE_INHERITED, parentStyle);2259 }2260 return rendererForFirstLineStyle->getUncachedPseudoStyle(PseudoStyleRequest(FIRST_LINE_INHERITED), parentStyle, style);2261 }2262 }2263 return 0;2264 }2265 2266 PassRefPtr<RenderStyle> RenderObject::uncachedFirstLineStyle(RenderStyle* style) const2267 {2268 if (!document().styleSheetCollection().usesFirstLineRules())2269 return 0;2270 2271 ASSERT(!isText());2272 2273 return firstLineStyleForCachedUncachedType(Uncached, this, style);2274 }2275 2276 RenderStyle* RenderObject::cachedFirstLineStyle() const2277 {2278 ASSERT(document().styleSheetCollection().usesFirstLineRules());2279 2280 RenderStyle* style = this->style();2281 if (RefPtr<RenderStyle> firstLineStyle = firstLineStyleForCachedUncachedType(Cached, isText() ? parent() : this, style))2282 return firstLineStyle.get();2283 2284 return style;2285 }2286 2287 2235 RenderStyle* RenderObject::getCachedPseudoStyle(PseudoId pseudo, RenderStyle* parentStyle) const 2288 2236 { … … 2355 2303 Color resultColor; 2356 2304 do { 2357 styleToUse = curr->style(firstlineStyle);2305 styleToUse = firstlineStyle ? curr->firstLineStyle() : curr->style(); 2358 2306 currDecs = styleToUse->textDecoration(); 2359 2307 resultColor = decorationColor(styleToUse); … … 2382 2330 // If we bailed out, use the element we bailed out at (typically a <font> or <a> element). 2383 2331 if (decorations && curr) { 2384 styleToUse = curr->style(firstlineStyle);2332 styleToUse = firstlineStyle ? curr->firstLineStyle() : curr->style(); 2385 2333 resultColor = decorationColor(styleToUse); 2386 2334 if (decorations & TextDecorationUnderline)
Note:
See TracChangeset
for help on using the changeset viewer.