<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>141683</bug_id>
          
          <creation_ts>2015-02-16 17:47:25 -0800</creation_ts>
          <short_desc>HTMLFormControlElement::didAttachRenderers() should not force layout via focus() until the style resolution is done</short_desc>
          <delta_ts>2016-03-25 15:49:34 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>Forms</component>
          <version>528+ (Nightly build)</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>DUPLICATE</resolution>
          <dup_id>155503</dup_id>
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Simon Fraser (smfr)">simon.fraser</reporter>
          <assigned_to name="alan">zalan</assigned_to>
          <cc>simon.fraser</cc>
    
    <cc>zalan</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1069697</commentid>
    <comment_count>0</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2015-02-16 17:47:25 -0800</bug_when>
    <thetext>HTMLFormControlElement::didAttachRenderers() has:

        Style::queuePostResolutionCallback([element] {
            element-&gt;focus();
        });

The focus call forces layout, but too soon, before we&apos;ve done with the rest of Document::recalcStyle()

1   com.apple.WebCore             	0x000000010fc5a636 WebCore::FrameView::layout(bool) + 246 (FrameView.cpp:1126)
2   com.apple.WebCore             	0x000000010f8c8357 WebCore::Document::updateLayout() + 343 (Document.cpp:1857)
3   com.apple.WebCore             	0x000000010f8cbdaf WebCore::Document::updateLayoutIgnorePendingStylesheets(WebCore::Document::RunPostLayoutTasks) + 207 (Document.cpp:1891)
4   com.apple.WebCore             	0x000000010fa70084 WebCore::Element::focus(bool, WebCore::FocusDirection) + 148 (Element.cpp:1983)
5   com.apple.WebCore             	0x000000010fdd6508 WebCore::HTMLFormControlElement::didAttachRenderers()::$_0::operator()() const + 40 (HTMLFormControlElement.cpp:225)
6   com.apple.WebCore             	0x000000010fdd64cc std::__1::__function::__func&lt;WebCore::HTMLFormControlElement::didAttachRenderers()::$_0, std::__1::allocator&lt;WebCore::HTMLFormControlElement::didAttachRenderers()::$_0&gt;, void ()&gt;::operator()() + 60 (functional:1370)
7   com.apple.WebCore             	0x000000010f3cc3aa std::__1::function&lt;void ()&gt;::operator()() const + 26 (functional:1756)
8   com.apple.WebCore             	0x000000011107ca10 WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler() + 96 (StyleResolveTree.cpp:1046)
9   com.apple.WebCore             	0x000000011107ca95 WebCore::Style::PostResolutionCallbackDisabler::~PostResolutionCallbackDisabler() + 21 (StyleResolveTree.cpp:1054)
10  com.apple.WebCore             	0x000000010f8cb51c WebCore::Document::recalcStyle(WebCore::Style::Change) + 764 (Document.cpp:1795)
11  com.apple.WebCore             	0x000000010f8c745b WebCore::Document::updateStyleIfNeeded() + 347 (Document.cpp:1833)
12  com.apple.WebCore             	0x000000010f8cba76 WebCore::Document::implicitClose() + 1094 (Document.cpp:2516)
13  com.apple.WebCore             	0x000000010fc24e1b WebCore::FrameLoader::checkCallImplicitClose() + 155 (FrameLoader.cpp:901)
14  com.apple.WebCore             	0x000000010fc24aee WebCore::FrameLoader::checkCompleted() + 270 (FrameLoader.cpp:848)
15  com.apple.WebCore             	0x000000010fc235f2 WebCore::FrameLoader::finishedParsing() + 178 (FrameLoader.cpp:768)
16  com.apple.WebCore             	0x000000010f8d8133 WebCore::Document::finishedParsing() + 483 (Document.cpp:4649)
17  com.apple.WebCore             	0x000000010fd73288 WebCore::HTMLConstructionSite::finishedParsing() + 24 (HTMLConstructionSite.cpp:405)
18  com.apple.WebCore             	0x000000010feaaada WebCore::HTMLTreeBuilder::finished() + 186 (HTMLTreeBuilder.cpp:2942)
19  com.apple.WebCore             	0x000000010fda15ae WebCore::HTMLDocumentParser::end() + 190 (HTMLDocumentParser.cpp:403)
20  com.apple.WebCore             	0x000000010fd9f9fe WebCore::HTMLDocumentParser::attemptToRunDeferredScriptsAndEnd() + 254 (HTMLDocumentParser.cpp:412)
21  com.apple.WebCore             	0x000000010fd9f79e WebCore::HTMLDocumentParser::prepareToStopParsing() + 270 (HTMLDocumentParser.cpp:133)
22  com.apple.WebCore             	0x000000010fda15ff WebCore::HTMLDocumentParser::attemptToEnd() + 63 (HTMLDocumentParser.cpp:424)
23  com.apple.WebCore             	0x000000010fda1658 WebCore::HTMLDocumentParser::finish() + 72 (HTMLDocumentParser.cpp:452)
24  com.apple.WebCore             	0x000000010f95bfac WebCore::DocumentWriter::end() + 332 (DocumentWriter.cpp:247)
25  com.apple.WebCore             	0x000000010f923e46 WebCore::DocumentLoader::finishedLoading(double) + 1574 (DocumentLoader.cpp:442)
26  com.apple.WebCore             	0x000000010f92378e WebCore::DocumentLoader::notifyFinished(WebCore::CachedResource*) + 270 (DocumentLoader.cpp:376)
27  com.apple.WebCore             	0x000000010f57bd92 WebCore::CachedResource::checkNotify() + 130 (CachedResource.cpp:292)
28  com.apple.WebCore             	0x000000010f57bea1 WebCore::CachedResource::finishLoading(WebCore::SharedBuffer*) + 49 (CachedResource.cpp:310)
29  com.apple.WebCore             	0x000000010f5778ca WebCore::CachedRawResource::finishLoading(WebCore::SharedBuffer*) + 218 (CachedRawResource.cpp:105)
30  com.apple.WebCore             	0x000000011109dbd5 WebCore::SubresourceLoader::didFinishLoading(double) + 517 (SubresourceLoader.cpp:366)
31  com.apple.WebCore             	0x0000000110d8e415 WebCore::ResourceLoader::didFinishLoading(WebCore::ResourceHandle*, double) + 53 (ResourceLoader.cpp:543)
32  com.apple.WebCore             	0x000000011133efaa -[WebCoreResourceHandleAsDelegate connectionDidFinishLoading:] + 186 (WebCoreResourceHandleAsDelegate.mm:261)
33  com.apple.CFNetwork           	0x00007fff9055620d __65-[NSURLConnectionInternal _withConnectionAndDelegate:onlyActive:]_block_invoke + 69</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1177874</commentid>
    <comment_count>1</comment_count>
    <who name="Simon Fraser (smfr)">simon.fraser</who>
    <bug_when>2016-03-24 21:18:41 -0700</bug_when>
    <thetext>Zalan, you fixed this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1177880</commentid>
    <comment_count>2</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2016-03-24 21:59:07 -0700</bug_when>
    <thetext>yay</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1178148</commentid>
    <comment_count>3</comment_count>
    <who name="alan">zalan</who>
    <bug_when>2016-03-25 15:49:34 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 155503 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>