⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 176294 in webkit


Ignore:
Timestamp:
Nov 18, 2014, 4:20:07 PM (12 years ago)
Author:
akling@apple.com
Message:

Avoid synchronous style recalc in Document.activeElement
<https://webkit.org/b/138850>

Reviewed by Ryosuke Niwa.

Source/WebCore:

This subtly changes the behavior of <input autofocus>, which was caught by
a layout test. Auto-focus doesn't happen until the render tree is attached,
although it was possible to force it by accessing document.activeElement.

Now auto-focus is always lazy. This is consistent with other browser engines.

~1% progression on Speedometer locally.

  • dom/Document.cpp:

(WebCore::Document::activeElement):

LayoutTests:

Tweak a test to run once the DOM is loaded instead of during parsing.

  • fast/forms/autofocus-in-sandbox-with-allow-scripts.html:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r176287 r176294  
     12014-11-18  Andreas Kling  <akling@apple.com>
     2
     3        Avoid synchronous style recalc in Document.activeElement
     4        <https://webkit.org/b/138850>
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Tweak a test to run once the DOM is loaded instead of during parsing.
     9
     10        * fast/forms/autofocus-in-sandbox-with-allow-scripts.html:
     11
    1122014-11-18  David Hyatt  <hyatt@apple.com>
    213
  • trunk/LayoutTests/fast/forms/autofocus-in-sandbox-with-allow-scripts.html

    r127481 r176294  
    66(which it would be if the sandbox didn't allow autofocus although allow-scripts flag is set).
    77<iframe sandbox="allow-scripts"
    8     src="data:text/html,<input autofocus onfocus><script>alert(document.activeElement.tagName)</script>"></iframe>
     8    src="data:text/html,<input autofocus onfocus><script>window.onload = function() { alert(document.activeElement.tagName) }</script>"></iframe>
  • trunk/Source/WebCore/ChangeLog

    r176293 r176294  
     12014-11-18  Andreas Kling  <akling@apple.com>
     2
     3        Avoid synchronous style recalc in Document.activeElement
     4        <https://webkit.org/b/138850>
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        This subtly changes the behavior of <input autofocus>, which was caught by
     9        a layout test. Auto-focus doesn't happen until the render tree is attached,
     10        although it was possible to force it by accessing document.activeElement.
     11
     12        Now auto-focus is always lazy. This is consistent with other browser engines.
     13
     14        ~1% progression on Speedometer locally.
     15
     16        * dom/Document.cpp:
     17        (WebCore::Document::activeElement):
     18
    1192014-11-18  Chris Dumez  <cdumez@apple.com>
    220
  • trunk/Source/WebCore/dom/Document.cpp

    r176174 r176294  
    63166316Element* Document::activeElement()
    63176317{
    6318     updateStyleIfNeeded();
    63196318    if (Element* element = treeScope().focusedElement())
    63206319        return element;
Note: See TracChangeset for help on using the changeset viewer.