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 2253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2264 } | 2264 } |
2265 | 2265 |
2266 LayoutRect RenderObject::localCaretRect(InlineBox*, int, LayoutUnit* extraWidthT oEndOfLine) | 2266 LayoutRect RenderObject::localCaretRect(InlineBox*, int, LayoutUnit* extraWidthT oEndOfLine) |
2267 { | 2267 { |
2268 if (extraWidthToEndOfLine) | 2268 if (extraWidthToEndOfLine) |
2269 *extraWidthToEndOfLine = 0; | 2269 *extraWidthToEndOfLine = 0; |
2270 | 2270 |
2271 return LayoutRect(); | 2271 return LayoutRect(); |
2272 } | 2272 } |
2273 | 2273 |
2274 void RenderObject::computeLayerHitTestRects(LayerHitTestRects& layerRects) const | |
2275 { | |
2276 // Figure out what layer our container is in. Any offset (or new layer) for this | |
2277 // renderer within it's container will be applied in addLayerHitTestRects. | |
2278 LayoutPoint layerOffset; | |
2279 const RenderLayer* currentLayer = 0; | |
2280 | |
2281 if (!hasLayer()) { | |
2282 RenderObject* container = this->container(); | |
2283 if (container) { | |
2284 currentLayer = container->enclosingLayer(); | |
2285 if (currentLayer && currentLayer->renderer() != container) | |
2286 layerOffset.move(container->offsetFromAncestorContainer(currentL ayer->renderer())); | |
2287 } else { | |
2288 currentLayer = enclosingLayer(); | |
2289 } | |
2290 if (!currentLayer) | |
2291 return; | |
2292 } | |
2293 | |
2294 this->addLayerHitTestRects(layerRects, currentLayer, layerOffset); | |
2295 } | |
2296 | |
2297 void RenderObject::addLayerHitTestRects(LayerHitTestRects& layerRects, const Ren derLayer* currentLayer, const LayoutPoint& layerOffset) const | |
2298 { | |
2299 ASSERT(currentLayer); | |
leviw_travelin_and_unemployed
2013/07/18 18:08:39
You could also assert this is the enclosing layer.
Rick Byers
2013/07/18 19:58:52
Done.
| |
2300 | |
2301 // If it's possible for children to have rects outside our bounds, then we n eed to descend into | |
2302 // the children and compute them. | |
2303 // Ideally there would be other cases where we could detect that children co uldn't have rects | |
2304 // outside our bounds and prune the tree walk. | |
2305 // Note that we don't use Region here because Union is O(N) - better to just keep a list of | |
2306 // partially redundant rectangles. If we find examples where this is expensi ve, then we could | |
2307 // rewrite Region to be more efficient. See https://bugs.webkit.org/show_bug .cgi?id=100814. | |
2308 if (!isRenderView()) { | |
2309 for (RenderObject* curr = firstChild(); curr; curr = curr->nextSibling() ) { | |
2310 curr->addLayerHitTestRects(layerRects, currentLayer, layerOffset); | |
2311 } | |
2312 } | |
2313 | |
2314 // Compute the rects for this renderer only and add them to the results. | |
2315 // Note that we could avoid passing the offset and instead adjust each resul t, but this | |
2316 // seems slightly simpler. | |
2317 Vector<IntRect> ownRects; | |
2318 computeOwnHitTestRects(ownRects, layerOffset); | |
2319 | |
2320 LayerHitTestRects::iterator iter = layerRects.find(currentLayer); | |
2321 if (iter == layerRects.end()) | |
2322 layerRects.add(currentLayer, ownRects); | |
2323 else | |
2324 iter->value.append(ownRects); | |
2325 } | |
2326 | |
2274 bool RenderObject::isRooted(RenderView** view) const | 2327 bool RenderObject::isRooted(RenderView** view) const |
2275 { | 2328 { |
2276 const RenderObject* o = this; | 2329 const RenderObject* o = this; |
2277 while (o->parent()) | 2330 while (o->parent()) |
2278 o = o->parent(); | 2331 o = o->parent(); |
2279 | 2332 |
2280 if (!o->isRenderView()) | 2333 if (!o->isRenderView()) |
2281 return false; | 2334 return false; |
2282 | 2335 |
2283 if (view) | 2336 if (view) |
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3200 { | 3253 { |
3201 if (object1) { | 3254 if (object1) { |
3202 const WebCore::RenderObject* root = object1; | 3255 const WebCore::RenderObject* root = object1; |
3203 while (root->parent()) | 3256 while (root->parent()) |
3204 root = root->parent(); | 3257 root = root->parent(); |
3205 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); | 3258 root->showRenderTreeAndMark(object1, "*", object2, "-", 0); |
3206 } | 3259 } |
3207 } | 3260 } |
3208 | 3261 |
3209 #endif | 3262 #endif |
OLD | NEW |