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) 2007 David Smith (catfish.man@gmail.com) | 4 * (C) 2007 David Smith (catfish.man@gmail.com) |
5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. | 5 * Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved. |
6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. | 6 * Copyright (C) Research In Motion Limited 2010. All rights reserved. |
7 * | 7 * |
8 * This library is free software; you can redistribute it and/or | 8 * This library is free software; you can redistribute it and/or |
9 * modify it under the terms of the GNU Library General Public | 9 * modify it under the terms of the GNU Library General Public |
10 * License as published by the Free Software Foundation; either | 10 * License as published by the Free Software Foundation; either |
(...skipping 14 matching lines...) Expand all Loading... | |
25 #include "core/rendering/RenderBlock.h" | 25 #include "core/rendering/RenderBlock.h" |
26 | 26 |
27 #include "HTMLNames.h" | 27 #include "HTMLNames.h" |
28 #include "core/accessibility/AXObjectCache.h" | 28 #include "core/accessibility/AXObjectCache.h" |
29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
30 #include "core/dom/Element.h" | 30 #include "core/dom/Element.h" |
31 #include "core/events/OverflowEvent.h" | 31 #include "core/events/OverflowEvent.h" |
32 #include "core/dom/shadow/ShadowRoot.h" | 32 #include "core/dom/shadow/ShadowRoot.h" |
33 #include "core/editing/Editor.h" | 33 #include "core/editing/Editor.h" |
34 #include "core/editing/FrameSelection.h" | 34 #include "core/editing/FrameSelection.h" |
35 #include "core/fetch/ResourceLoadPriorityOptimizer.h" | |
35 #include "core/frame/Frame.h" | 36 #include "core/frame/Frame.h" |
36 #include "core/frame/FrameView.h" | 37 #include "core/frame/FrameView.h" |
37 #include "core/page/Page.h" | 38 #include "core/page/Page.h" |
38 #include "core/page/Settings.h" | 39 #include "core/page/Settings.h" |
39 #include "core/rendering/FastTextAutosizer.h" | 40 #include "core/rendering/FastTextAutosizer.h" |
40 #include "core/rendering/GraphicsContextAnnotator.h" | 41 #include "core/rendering/GraphicsContextAnnotator.h" |
41 #include "core/rendering/HitTestLocation.h" | 42 #include "core/rendering/HitTestLocation.h" |
42 #include "core/rendering/HitTestResult.h" | 43 #include "core/rendering/HitTestResult.h" |
43 #include "core/rendering/InlineIterator.h" | 44 #include "core/rendering/InlineIterator.h" |
44 #include "core/rendering/InlineTextBox.h" | 45 #include "core/rendering/InlineTextBox.h" |
45 #include "core/rendering/LayoutRectRecorder.h" | 46 #include "core/rendering/LayoutRectRecorder.h" |
46 #include "core/rendering/LayoutRepainter.h" | 47 #include "core/rendering/LayoutRepainter.h" |
47 #include "core/rendering/PaintInfo.h" | 48 #include "core/rendering/PaintInfo.h" |
48 #include "core/rendering/RenderCombineText.h" | 49 #include "core/rendering/RenderCombineText.h" |
49 #include "core/rendering/RenderDeprecatedFlexibleBox.h" | 50 #include "core/rendering/RenderDeprecatedFlexibleBox.h" |
50 #include "core/rendering/RenderFlexibleBox.h" | 51 #include "core/rendering/RenderFlexibleBox.h" |
51 #include "core/rendering/RenderInline.h" | 52 #include "core/rendering/RenderInline.h" |
52 #include "core/rendering/RenderLayer.h" | 53 #include "core/rendering/RenderLayer.h" |
53 #include "core/rendering/RenderMarquee.h" | 54 #include "core/rendering/RenderMarquee.h" |
54 #include "core/rendering/RenderNamedFlowThread.h" | 55 #include "core/rendering/RenderNamedFlowThread.h" |
55 #include "core/rendering/RenderRegion.h" | 56 #include "core/rendering/RenderRegion.h" |
56 #include "core/rendering/RenderTableCell.h" | 57 #include "core/rendering/RenderTableCell.h" |
57 #include "core/rendering/RenderTextFragment.h" | 58 #include "core/rendering/RenderTextFragment.h" |
58 #include "core/rendering/RenderTheme.h" | 59 #include "core/rendering/RenderTheme.h" |
59 #include "core/rendering/RenderView.h" | 60 #include "core/rendering/RenderView.h" |
60 #include "core/rendering/shapes/ShapeOutsideInfo.h" | 61 #include "core/rendering/shapes/ShapeOutsideInfo.h" |
62 #include "core/rendering/style/ContentData.h" | |
63 #include "core/rendering/style/RenderStyle.h" | |
61 #include "platform/geometry/FloatQuad.h" | 64 #include "platform/geometry/FloatQuad.h" |
62 #include "platform/geometry/TransformState.h" | 65 #include "platform/geometry/TransformState.h" |
63 #include "platform/graphics/GraphicsContextStateSaver.h" | 66 #include "platform/graphics/GraphicsContextStateSaver.h" |
64 #include "wtf/StdLibExtras.h" | 67 #include "wtf/StdLibExtras.h" |
65 #include "wtf/TemporaryChange.h" | 68 #include "wtf/TemporaryChange.h" |
66 | 69 |
67 using namespace std; | 70 using namespace std; |
68 using namespace WTF; | 71 using namespace WTF; |
69 using namespace Unicode; | 72 using namespace Unicode; |
70 | 73 |
(...skipping 1174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1245 return; | 1248 return; |
1246 | 1249 |
1247 // It's safe to check for control clip here, since controls can never be tab le cells. | 1250 // It's safe to check for control clip here, since controls can never be tab le cells. |
1248 // If we have a lightweight clip, there can never be any overflow from child ren. | 1251 // If we have a lightweight clip, there can never be any overflow from child ren. |
1249 if (hasControlClip() && m_overflow) | 1252 if (hasControlClip() && m_overflow) |
1250 clearLayoutOverflow(); | 1253 clearLayoutOverflow(); |
1251 | 1254 |
1252 invalidateBackgroundObscurationStatus(); | 1255 invalidateBackgroundObscurationStatus(); |
1253 } | 1256 } |
1254 | 1257 |
1258 void RenderBlock::didLayout(ResourceLoadPriorityOptimizer& optimizer) | |
1259 { | |
1260 RenderBox::didLayout(optimizer); | |
1261 updateStyleImageLoadingPriorities(optimizer); | |
1262 } | |
1263 | |
1264 void RenderBlock::didScroll(ResourceLoadPriorityOptimizer& optimizer) | |
1265 { | |
1266 RenderBox::didScroll(optimizer); | |
1267 updateStyleImageLoadingPriorities(optimizer); | |
1268 } | |
1269 | |
1270 void RenderBlock::updateStyleImageLoadingPriorities(ResourceLoadPriorityOptimize r& optimizer) | |
1271 { | |
1272 RenderStyle* blockStyle = style(); | |
1273 if (!blockStyle) | |
1274 return; | |
1275 | |
1276 Vector<ImageResource*> images; | |
shatch
2013/12/07 03:16:15
Reorganized this function to grab the images out o
| |
1277 | |
1278 for (const FillLayer* layer = blockStyle->backgroundLayers(); layer; layer = layer->next()) { | |
shatch
2013/12/07 03:16:15
Swapped the ::access<func> for these (::background
| |
1279 if (layer->image()) { | |
1280 ImageResource* img = layer->image()->cachedImage(); | |
1281 if (img) { | |
1282 images.append(img); | |
1283 } | |
1284 } | |
1285 } | |
1286 for (const FillLayer* layer = blockStyle->maskLayers(); layer; layer = layer ->next()) { | |
1287 if (layer->image()) { | |
1288 ImageResource* imageResource = layer->image()->cachedImage(); | |
1289 if (imageResource) { | |
1290 images.append(imageResource); | |
1291 } | |
1292 } | |
1293 } | |
1294 ContentData* contentData = const_cast<ContentData*>(blockStyle->contentData( )); | |
1295 if (contentData && contentData->isImage()) { | |
1296 ImageContentData* imageContentData = static_cast<ImageContentData*>(cont entData); | |
1297 if (imageContentData->image() && imageContentData->image()->cachedImage( )) | |
1298 images.append(imageContentData->image()->cachedImage()); | |
1299 } | |
1300 if (blockStyle->boxReflect()) { | |
1301 if (blockStyle->boxReflect()->mask().image()) { | |
1302 if (blockStyle->boxReflect()->mask().image()->cachedImage()) { | |
1303 images.append(blockStyle->boxReflect()->mask().image()->cachedIm age()); | |
1304 } | |
1305 } | |
1306 } | |
1307 if (blockStyle->listStyleImage() && blockStyle->listStyleImage()->cachedImag e()) | |
1308 images.append(blockStyle->listStyleImage()->cachedImage()); | |
1309 if (blockStyle->borderImageSource() && blockStyle->borderImageSource()->cach edImage()) | |
1310 images.append(blockStyle->borderImageSource()->cachedImage()); | |
1311 if (blockStyle->maskBoxImageSource() && blockStyle->maskBoxImageSource()->ca chedImage()) | |
1312 images.append(blockStyle->maskBoxImageSource()->cachedImage()); | |
1313 | |
1314 if (images.isEmpty()) | |
1315 return; | |
1316 | |
1317 const LayoutRect& viewBounds = viewRect(); | |
1318 LayoutRect objectBounds = absoluteContentBox(); | |
1319 // The object bounds might be empty right now, so intersects will fail since it doesn't deal | |
1320 // with empty rects. Use LayoutRect::contains in that case. | |
1321 bool isVisible; | |
1322 if (!objectBounds.isEmpty()) | |
1323 isVisible = viewBounds.intersects(objectBounds); | |
1324 else | |
1325 isVisible = viewBounds.contains(objectBounds); | |
1326 | |
1327 ResourceLoadPriorityOptimizer::VisibilityStatus status = isVisible ? | |
1328 ResourceLoadPriorityOptimizer::Visible : ResourceLoadPriorityOptimizer:: NotVisible; | |
1329 | |
1330 for (Vector<ImageResource*>::iterator it = images.begin(), end = images.end( ); it != end; ++it) | |
1331 optimizer.notifyImageResourceVisibility(*it, status); | |
1332 } | |
1333 | |
1255 void RenderBlock::relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset) | 1334 void RenderBlock::relayoutShapeDescendantIfMoved(RenderBlock* child, LayoutSize offset) |
1256 { | 1335 { |
1257 LayoutUnit left = isHorizontalWritingMode() ? offset.width() : offset.height (); | 1336 LayoutUnit left = isHorizontalWritingMode() ? offset.width() : offset.height (); |
1258 if (!left || !child || child->shapeInsideInfo() || !layoutShapeInsideInfo()) | 1337 if (!left || !child || child->shapeInsideInfo() || !layoutShapeInsideInfo()) |
1259 return; | 1338 return; |
1260 // Propagate layout markers only up to the child, as we are still in the mid dle | 1339 // Propagate layout markers only up to the child, as we are still in the mid dle |
1261 // of a layout pass | 1340 // of a layout pass |
1262 child->setNormalChildNeedsLayout(true); | 1341 child->setNormalChildNeedsLayout(true); |
1263 child->markShapeInsideDescendantsForLayout(); | 1342 child->markShapeInsideDescendantsForLayout(); |
1264 child->layoutIfNeeded(); | 1343 child->layoutIfNeeded(); |
(...skipping 4469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5734 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const | 5813 void RenderBlock::showLineTreeAndMark(const InlineBox* markedBox1, const char* m arkedLabel1, const InlineBox* markedBox2, const char* markedLabel2, const Render Object* obj) const |
5735 { | 5814 { |
5736 showRenderObject(); | 5815 showRenderObject(); |
5737 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) | 5816 for (const RootInlineBox* root = firstRootBox(); root; root = root->nextRoot Box()) |
5738 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); | 5817 root->showLineTreeAndMark(markedBox1, markedLabel1, markedBox2, markedLa bel2, obj, 1); |
5739 } | 5818 } |
5740 | 5819 |
5741 #endif | 5820 #endif |
5742 | 5821 |
5743 } // namespace WebCore | 5822 } // namespace WebCore |
OLD | NEW |