OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1288 { | 1288 { |
1289 RefPtr<Element> styleElement = frame()->document()->createElement(HTMLNames: :linkTag, false); | 1289 RefPtr<Element> styleElement = frame()->document()->createElement(HTMLNames: :linkTag, false); |
1290 | 1290 |
1291 styleElement->setAttribute(HTMLNames::typeAttr, "text/css"); | 1291 styleElement->setAttribute(HTMLNames::typeAttr, "text/css"); |
1292 styleElement->setAttribute(HTMLNames::relAttr, "stylesheet"); | 1292 styleElement->setAttribute(HTMLNames::relAttr, "stylesheet"); |
1293 styleElement->setAttribute(HTMLNames::hrefAttr, url); | 1293 styleElement->setAttribute(HTMLNames::hrefAttr, url); |
1294 | 1294 |
1295 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCE PTION); | 1295 frame()->document()->head()->appendChild(styleElement.release(), IGNORE_EXCE PTION); |
1296 } | 1296 } |
1297 | 1297 |
1298 void WebLocalFrameImpl::notifyTransitionShown(int elementsToHide) | |
abarth-chromium
2014/06/13 17:29:01
This is way too much logic for WebLocalFrameImpl.
| |
1299 { | |
1300 RefPtr<HTMLCollection> metaElements = frame()->document()->getElementsByTagN ame(HTMLNames::metaTag.localName()); | |
esprehn
2014/06/13 08:55:20
We don't use node lists of querySelector inside So
oystein (OOO til 10th of July)
2014/06/18 23:37:41
Somewhat improved now. Is it worth using ::inserte
| |
1301 if (elementsToHide >= 0) { | |
1302 int currentValidTransitionElementsTag = 0; | |
1303 unsigned length = metaElements->length(); | |
esprehn
2014/06/13 08:55:20
Touching length() walks the entire document, then
oystein (OOO til 10th of July)
2014/06/18 23:37:42
Done.
| |
1304 for (unsigned i = 0; i < length; ++i) { | |
1305 ASSERT(metaElements->item(i)->isHTMLElement()); | |
1306 HTMLMetaElement* metaElement = toHTMLMetaElement(metaElements->item( i)); | |
1307 if (metaElement->name() != "transition-elements") | |
1308 continue; | |
1309 | |
1310 Vector<String> tokens; | |
1311 String(metaElement->content().impl()).split(';', tokens); | |
esprehn
2014/06/13 08:55:20
metaElement->content().string().split(...)
oystein (OOO til 10th of July)
2014/06/18 23:37:42
Done.
| |
1312 if (tokens.size() != 2) | |
1313 continue; | |
1314 | |
1315 TrackExceptionState exceptionState; | |
1316 RefPtr<NodeList> nodeList = frame()->document()->querySelectorAll(At omicString(tokens[0]), exceptionState); | |
1317 if (nodeList && !exceptionState.hadException()) { | |
1318 unsigned nodeListLength = nodeList->length(); | |
1319 if (nodeListLength && elementsToHide != currentValidTransitionEl ementsTag++) | |
1320 continue; | |
1321 | |
1322 for (unsigned nodeIdx = 0; nodeIdx < nodeListLength; ++nodeIdx) { | |
1323 Node* node = nodeList->item(nodeIdx); | |
1324 toElement(node)->setInlineStyleProperty(CSSPropertyDisplay, CSSValueNone); | |
esprehn
2014/06/13 08:55:19
Modifying parts of the page like this doesn't seem
oystein (OOO til 10th of July)
2014/06/18 23:37:41
Is there a better way of hiding these elements?
| |
1325 } | |
1326 } | |
1327 } | |
1328 } | |
1329 | |
1330 frame()->loader().closeURL(); | |
1331 frame()->document()->setIsTransitionDocument(); | |
1332 frame()->document()->styleEngine()->enableExitTransitionStylesheets(); | |
esprehn
2014/06/13 08:55:19
You can't do this, closeURL() shuts the FrameLoade
oystein (OOO til 10th of July)
2014/06/18 23:37:41
I believe dispatching the unload events first was
| |
1333 } | |
1334 | |
1335 void WebLocalFrameImpl::setupTransitionView(const WebString& markup) | |
1336 { | |
1337 RefPtr<Document> ownerDocument(frame()->document()); | |
1338 | |
1339 // Need this so that the transition UA stylesheet gets applied. | |
1340 frame()->document()->setIsTransitionDocument(); | |
1341 frame()->document()->enforceSandboxFlags(SandboxAll); | |
abarth-chromium
2014/06/13 17:29:01
Can you assert that document()->securityOrigin()->
oystein (OOO til 10th of July)
2014/06/18 23:37:41
Done, though I'm not quite sure what I'm doing her
| |
1342 frame()->page()->settings().setScriptEnabled(false); | |
abarth-chromium
2014/06/13 17:29:01
This line is redundant with enforceSandboxFlags(Sa
oystein (OOO til 10th of July)
2014/06/18 23:37:41
Done.
| |
1343 | |
1344 // FIXME(oysteine): Is there a better way to set this? Or should this HTML b e an embedded resource? | |
1345 // It could alternatively be generated in markup.cpp and included in |markup |. | |
1346 String tempMarkup = String("<!DOCTYPE html><meta name=\"viewport\" content=\ "width=device-width, user-scalable=0\">") + String(markup); | |
esprehn
2014/06/13 08:55:20
You should talk to abarth@ about this.
abarth-chromium
2014/06/13 17:29:01
This should be included in |markup|. I'm not sure
oystein (OOO til 10th of July)
2014/06/18 23:37:42
Done.
| |
1347 frame()->document()->loader()->replaceDocument(tempMarkup, ownerDocument.get ()); | |
1348 } | |
abarth-chromium
2014/06/13 17:29:01
All this logic should be in core also.
| |
1349 | |
1298 void WebLocalFrameImpl::setCaretVisible(bool visible) | 1350 void WebLocalFrameImpl::setCaretVisible(bool visible) |
1299 { | 1351 { |
1300 frame()->selection().setCaretVisible(visible); | 1352 frame()->selection().setCaretVisible(visible); |
1301 } | 1353 } |
1302 | 1354 |
1303 VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) | 1355 VisiblePosition WebLocalFrameImpl::visiblePositionForWindowPoint(const WebPoint& point) |
1304 { | 1356 { |
1305 FloatPoint unscaledPoint(point); | 1357 FloatPoint unscaledPoint(point); |
1306 unscaledPoint.scale(1 / view()->pageScaleFactor(), 1 / view()->pageScaleFact or()); | 1358 unscaledPoint.scale(1 / view()->pageScaleFactor(), 1 / view()->pageScaleFact or()); |
1307 | 1359 |
(...skipping 604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1912 | 1964 |
1913 void WebLocalFrameImpl::invalidateAll() const | 1965 void WebLocalFrameImpl::invalidateAll() const |
1914 { | 1966 { |
1915 ASSERT(frame() && frame()->view()); | 1967 ASSERT(frame() && frame()->view()); |
1916 FrameView* view = frame()->view(); | 1968 FrameView* view = frame()->view(); |
1917 view->invalidateRect(view->frameRect()); | 1969 view->invalidateRect(view->frameRect()); |
1918 invalidateScrollbar(); | 1970 invalidateScrollbar(); |
1919 } | 1971 } |
1920 | 1972 |
1921 } // namespace blink | 1973 } // namespace blink |
OLD | NEW |