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) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
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 2380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2391 if (!hasRareData() && size == defaultMinimumSizeForResizing()) | 2391 if (!hasRareData() && size == defaultMinimumSizeForResizing()) |
2392 return; | 2392 return; |
2393 ensureElementRareData().setMinimumSizeForResizing(size); | 2393 ensureElementRareData().setMinimumSizeForResizing(size); |
2394 } | 2394 } |
2395 | 2395 |
2396 RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) | 2396 RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) |
2397 { | 2397 { |
2398 if (PseudoElement* element = pseudoElement(pseudoElementSpecifier)) | 2398 if (PseudoElement* element = pseudoElement(pseudoElementSpecifier)) |
2399 return element->computedStyle(); | 2399 return element->computedStyle(); |
2400 | 2400 |
| 2401 if (!inActiveDocument()) { |
| 2402 // FIXME: Try to do better than this. Ensure that styleForElement() work
s for elements that are not in the |
| 2403 // document tree and figure out when to destroy the computed style for s
uch elements. |
| 2404 return 0; |
| 2405 } |
| 2406 |
2401 // FIXME: Find and use the renderer from the pseudo element instead of the a
ctual element so that the 'length' | 2407 // FIXME: Find and use the renderer from the pseudo element instead of the a
ctual element so that the 'length' |
2402 // properties, which are only known by the renderer because it did the layou
t, will be correct and so that the | 2408 // properties, which are only known by the renderer because it did the layou
t, will be correct and so that the |
2403 // values returned for the ":selection" pseudo-element will be correct. | 2409 // values returned for the ":selection" pseudo-element will be correct. |
2404 if (RenderStyle* usedStyle = renderStyle()) { | 2410 RenderStyle* elementStyle = renderStyle(); |
2405 if (pseudoElementSpecifier) { | 2411 if (!elementStyle) { |
2406 RenderStyle* cachedPseudoStyle = usedStyle->getCachedPseudoStyle(pse
udoElementSpecifier); | 2412 ElementRareData& rareData = ensureElementRareData(); |
2407 return cachedPseudoStyle ? cachedPseudoStyle : usedStyle; | 2413 if (!rareData.computedStyle()) |
2408 } else | 2414 rareData.setComputedStyle(document().styleForElementIgnoringPendingS
tylesheets(this)); |
2409 return usedStyle; | 2415 elementStyle = rareData.computedStyle(); |
2410 } | 2416 } |
2411 | 2417 |
2412 if (!inActiveDocument()) | 2418 if (!pseudoElementSpecifier) |
2413 // FIXME: Try to do better than this. Ensure that styleForElement() work
s for elements that are not in the | 2419 return elementStyle; |
2414 // document tree and figure out when to destroy the computed style for s
uch elements. | |
2415 return 0; | |
2416 | 2420 |
2417 ElementRareData& rareData = ensureElementRareData(); | 2421 if (RenderStyle* pseudoElementStyle = elementStyle->getCachedPseudoStyle(pse
udoElementSpecifier)) |
2418 if (!rareData.computedStyle()) | 2422 return pseudoElementStyle; |
2419 rareData.setComputedStyle(document().styleForElementIgnoringPendingStyle
sheets(this)); | 2423 |
2420 return pseudoElementSpecifier ? rareData.computedStyle()->getCachedPseudoSty
le(pseudoElementSpecifier) : rareData.computedStyle(); | 2424 RefPtr<RenderStyle> result = document().ensureStyleResolver().pseudoStyleFor
Element(this, PseudoStyleRequest(pseudoElementSpecifier, PseudoStyleRequest::For
ComputedStyle), elementStyle); |
| 2425 ASSERT(result); |
| 2426 return elementStyle->addCachedPseudoStyle(result.release()); |
2421 } | 2427 } |
2422 | 2428 |
2423 AtomicString Element::computeInheritedLanguage() const | 2429 AtomicString Element::computeInheritedLanguage() const |
2424 { | 2430 { |
2425 const Node* n = this; | 2431 const Node* n = this; |
2426 AtomicString value; | 2432 AtomicString value; |
2427 // The language property is inherited, so we iterate over the parents to fin
d the first language. | 2433 // The language property is inherited, so we iterate over the parents to fin
d the first language. |
2428 do { | 2434 do { |
2429 if (n->isElementNode()) { | 2435 if (n->isElementNode()) { |
2430 if (const ElementData* elementData = toElement(n)->elementData()) { | 2436 if (const ElementData* elementData = toElement(n)->elementData()) { |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3248 return v8::Handle<v8::Object>(); | 3254 return v8::Handle<v8::Object>(); |
3249 | 3255 |
3250 wrapper->SetPrototype(binding->prototype()); | 3256 wrapper->SetPrototype(binding->prototype()); |
3251 | 3257 |
3252 wrapperType->refObject(toScriptWrappableBase()); | 3258 wrapperType->refObject(toScriptWrappableBase()); |
3253 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); | 3259 V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapp
er, isolate); |
3254 return wrapper; | 3260 return wrapper; |
3255 } | 3261 } |
3256 | 3262 |
3257 } // namespace blink | 3263 } // namespace blink |
OLD | NEW |