| 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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1298 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(Foc
usEvent::create(eventType, true, false, document().domWindow(), 0, oldFocusedEle
ment))); | 1298 dispatchScopedEventDispatchMediator(FocusInEventDispatchMediator::create(Foc
usEvent::create(eventType, true, false, document().domWindow(), 0, oldFocusedEle
ment))); |
| 1299 } | 1299 } |
| 1300 | 1300 |
| 1301 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF
ocusedElement) | 1301 void Element::dispatchFocusOutEvent(const AtomicString& eventType, Element* newF
ocusedElement) |
| 1302 { | 1302 { |
| 1303 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 1303 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 1304 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames:
:DOMFocusOut); | 1304 ASSERT(eventType == EventTypeNames::focusout || eventType == EventTypeNames:
:DOMFocusOut); |
| 1305 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(Fo
cusEvent::create(eventType, true, false, document().domWindow(), 0, newFocusedEl
ement))); | 1305 dispatchScopedEventDispatchMediator(FocusOutEventDispatchMediator::create(Fo
cusEvent::create(eventType, true, false, document().domWindow(), 0, newFocusedEl
ement))); |
| 1306 } | 1306 } |
| 1307 | 1307 |
| 1308 String Element::textFromChildren() | |
| 1309 { | |
| 1310 Text* firstTextNode = 0; | |
| 1311 bool foundMultipleTextNodes = false; | |
| 1312 unsigned totalLength = 0; | |
| 1313 | |
| 1314 for (Node* child = firstChild(); child; child = child->nextSibling()) { | |
| 1315 if (!child->isTextNode()) | |
| 1316 continue; | |
| 1317 Text* text = toText(child); | |
| 1318 if (!firstTextNode) | |
| 1319 firstTextNode = text; | |
| 1320 else | |
| 1321 foundMultipleTextNodes = true; | |
| 1322 unsigned length = text->data().length(); | |
| 1323 if (length > std::numeric_limits<unsigned>::max() - totalLength) | |
| 1324 return emptyString(); | |
| 1325 totalLength += length; | |
| 1326 } | |
| 1327 | |
| 1328 if (!firstTextNode) | |
| 1329 return emptyString(); | |
| 1330 | |
| 1331 if (firstTextNode && !foundMultipleTextNodes) { | |
| 1332 firstTextNode->atomize(); | |
| 1333 return firstTextNode->data(); | |
| 1334 } | |
| 1335 | |
| 1336 StringBuilder content; | |
| 1337 content.reserveCapacity(totalLength); | |
| 1338 for (Node* child = firstTextNode; child; child = child->nextSibling()) { | |
| 1339 if (!child->isTextNode()) | |
| 1340 continue; | |
| 1341 content.append(toText(child)->data()); | |
| 1342 } | |
| 1343 | |
| 1344 ASSERT(content.length() == totalLength); | |
| 1345 return content.toString(); | |
| 1346 } | |
| 1347 | |
| 1348 // FIXME(sky): Remove pseudoElementSpecifier. | 1308 // FIXME(sky): Remove pseudoElementSpecifier. |
| 1349 RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) | 1309 RenderStyle* Element::computedStyle(PseudoId pseudoElementSpecifier) |
| 1350 { | 1310 { |
| 1351 // FIXME: Find and use the renderer from the pseudo element instead of the a
ctual element so that the 'length' | 1311 // FIXME: Find and use the renderer from the pseudo element instead of the a
ctual element so that the 'length' |
| 1352 // properties, which are only known by the renderer because it did the layou
t, will be correct and so that the | 1312 // properties, which are only known by the renderer because it did the layou
t, will be correct and so that the |
| 1353 // values returned for the ":selection" pseudo-element will be correct. | 1313 // values returned for the ":selection" pseudo-element will be correct. |
| 1354 if (RenderStyle* usedStyle = renderStyle()) | 1314 if (RenderStyle* usedStyle = renderStyle()) |
| 1355 return usedStyle; | 1315 return usedStyle; |
| 1356 | 1316 |
| 1357 if (!inActiveDocument()) | 1317 if (!inActiveDocument()) |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1826 return false; | 1786 return false; |
| 1827 if (treeScope().scopedStyleResolver().features().hasSelectorForId(idValue)) | 1787 if (treeScope().scopedStyleResolver().features().hasSelectorForId(idValue)) |
| 1828 return true; | 1788 return true; |
| 1829 // Host rules could also have effects. | 1789 // Host rules could also have effects. |
| 1830 if (ShadowRoot* shadowRoot = this->shadowRoot()) | 1790 if (ShadowRoot* shadowRoot = this->shadowRoot()) |
| 1831 return shadowRoot->scopedStyleResolver().features().hasSelectorForId(idV
alue); | 1791 return shadowRoot->scopedStyleResolver().features().hasSelectorForId(idV
alue); |
| 1832 return false; | 1792 return false; |
| 1833 } | 1793 } |
| 1834 | 1794 |
| 1835 } // namespace blink | 1795 } // namespace blink |
| OLD | NEW |