Moved layout check to give priority to view-specified layouts.