Changeset 245509 in webkit
- Timestamp:
- May 19, 2019, 8:15:30 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 3 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/fast/dom/window-inner-width-crash-expected.txt (added)
-
LayoutTests/fast/dom/window-inner-width-crash.html (added)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/page/DOMWindow.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r245507 r245509 1 2019-05-19 Brent Fulgham <bfulgham@apple.com> 2 3 Wait to get frame until after layout has been run 4 https://bugs.webkit.org/show_bug.cgi?id=197999 5 <rdar://problem/50800345> 6 7 Reviewed by Alex Christensen. 8 9 * fast/dom/window-inner-width-crash-expected.txt: Added. 10 * fast/dom/window-inner-width-crash.html: Added. 11 1 12 2019-05-19 Antoine Quint <graouts@apple.com> 2 13 -
trunk/Source/WebCore/ChangeLog
r245508 r245509 1 2019-05-19 Brent Fulgham <bfulgham@apple.com> 2 3 Wait to get frame until after layout has been run 4 https://bugs.webkit.org/show_bug.cgi?id=197999 5 <rdar://problem/50800345> 6 7 Reviewed by Alex Christensen. 8 9 The current frame can change when layout runs, so don't bother retrieving 10 the frame until the final layout pass is complete. 11 12 Test: fast/dom/window-inner-width-crash.html 13 14 * page/DOMWindow.cpp: 15 (WebCore::DOMWindow::innerHeight const): Move frame access past the 16 layout operation. 17 (WebCore::DOMWindow::innerWidth const): Ditto. 18 (WebCore::DOMWindow::scrollX const): Ditto. 19 (WebCore::DOMWindow::scrollY const): Ditto. 20 1 21 2019-05-19 Brent Fulgham <bfulgham@apple.com> 2 22 -
trunk/Source/WebCore/page/DOMWindow.cpp
r244695 r245509 1230 1230 int DOMWindow::innerHeight() const 1231 1231 { 1232 auto* frame = this->frame(); 1233 if (!frame) 1234 return 0; 1235 1232 if (!frame()) 1233 return 0; 1234 1236 1235 // Force enough layout in the parent document to ensure that the FrameView has been resized. 1237 1236 if (auto* frameElement = this->frameElement()) 1238 1237 frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, HeightDimensionsCheck); 1239 1238 1239 auto* frame = this->frame(); 1240 if (!frame) 1241 return 0; 1242 1240 1243 FrameView* view = frame->view(); 1241 1244 if (!view) … … 1247 1250 int DOMWindow::innerWidth() const 1248 1251 { 1249 auto* frame = this->frame(); 1250 if (!frame) 1252 if (!frame()) 1251 1253 return 0; 1252 1254 … … 1255 1257 frameElement->document().updateLayoutIfDimensionsOutOfDate(*frameElement, WidthDimensionsCheck); 1256 1258 1259 auto* frame = this->frame(); 1260 if (!frame) 1261 return 0; 1262 1257 1263 FrameView* view = frame->view(); 1258 1264 if (!view) … … 1304 1310 frame->document()->updateLayoutIgnorePendingStylesheets(); 1305 1311 1306 return view->mapFromLayoutToCSSUnits(view->contentsScrollPosition().x()); 1312 // Layout may have affected the current frame: 1313 auto* frameAfterLayout = this->frame(); 1314 if (!frameAfterLayout) 1315 return 0; 1316 1317 FrameView* viewAfterLayout = frameAfterLayout->view(); 1318 if (!viewAfterLayout) 1319 return 0; 1320 1321 return viewAfterLayout->mapFromLayoutToCSSUnits(viewAfterLayout->contentsScrollPosition().x()); 1307 1322 } 1308 1323 … … 1323 1338 frame->document()->updateLayoutIgnorePendingStylesheets(); 1324 1339 1325 return view->mapFromLayoutToCSSUnits(view->contentsScrollPosition().y()); 1340 // Layout may have affected the current frame: 1341 auto* frameAfterLayout = this->frame(); 1342 if (!frameAfterLayout) 1343 return 0; 1344 1345 FrameView* viewAfterLayout = frameAfterLayout->view(); 1346 if (!viewAfterLayout) 1347 return 0; 1348 1349 return viewAfterLayout->mapFromLayoutToCSSUnits(viewAfterLayout->contentsScrollPosition().y()); 1326 1350 } 1327 1351
Note:
See TracChangeset
for help on using the changeset viewer.